create-pmos 0.614.0 → 0.616.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 (44) hide show
  1. package/package.json +57 -39
  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/changelog.json +56 -0
  7. package/workspace/guide/backlog.md +70 -0
  8. package/workspace/guide/cli.md +1 -0
  9. package/workspace/guide/index.md +1 -0
  10. package/workspace/guide/layout.md +5 -4
  11. package/workspace/guide/programs.md +1 -1
  12. package/workspace/guide/routine.md +1 -1
  13. package/workspace/lib/backlog.js +323 -0
  14. package/workspace/lib/day-run.js +3 -2
  15. package/workspace/lib/doc-library.js +26 -3
  16. package/workspace/lib/events-place.js +45 -9
  17. package/workspace/lib/jira-status.js +4 -1
  18. package/workspace/lib/mention-cli.js +7 -5
  19. package/workspace/lib/mention-store.js +9 -5
  20. package/workspace/lib/route-modules.js +1 -0
  21. package/workspace/lib/routes-backlog.js +283 -0
  22. package/workspace/lib/routes-boards.js +13 -0
  23. package/workspace/package-lock.json +2 -2
  24. package/workspace/package.json +1 -1
  25. package/workspace/public/pm/bd-backlog.css +158 -0
  26. package/workspace/public/pm/bd-backlog.js +531 -0
  27. package/workspace/public/pm/bk-model.js +169 -0
  28. package/workspace/public/pm/cozy-events-view.js +23 -4
  29. package/workspace/public/pm/cozy-events.js +8 -2
  30. package/workspace/public/pm/cozy-pick.js +6 -3
  31. package/workspace/public/pm/cozy-routine.js +3 -2
  32. package/workspace/public/pm/cozy-today-app.js +23 -5
  33. package/workspace/public/pm/cozy-today-model.js +44 -10
  34. package/workspace/public/pm/cozy-today-page.css +9 -1
  35. package/workspace/public/pm/cozy-today-view.js +14 -9
  36. package/workspace/public/pm/home-app.js +5 -0
  37. package/workspace/public/pm/mention-one-model.js +6 -4
  38. package/workspace/public/pm/premium-board.js +21 -3
  39. package/workspace/public/pm/premium-goals.js +12 -9
  40. package/workspace/public/pm/premium-library.js +15 -3
  41. package/workspace/public/pm/scope-chip.js +5 -2
  42. package/workspace/public/premium-board.html +1 -0
  43. package/workspace/skills/morning-brief.skill +1 -1
  44. package/workspace/test-lists/backlog.json +9 -0
@@ -44,13 +44,15 @@ const MENTION_SOURCES = Object.freeze(['slack', 'jira', 'confluence', 'mail']);
44
44
  const VIAS = Object.freeze(['at', 'dm', 'name']);
45
45
  const NAME_SOURCES = new Set(['slack', 'mail']); // where a plain name, with no @, counts (Jira and Confluence mention by handle)
46
46
  const ACTS = Object.freeze(['answered', 'notask', 'snooze', 'task', 'keep', 'drafted', 'draft', 'read', 'closed', 'undo',
47
- 'gist', 'nodraft', 'stands', 'offer', 'watch', 'nowatch', 'landed', 'reopen', 'looks']);
47
+ 'gist', 'nodraft', 'stands', 'offer', 'watch', 'nowatch', 'landed', 'reopen', 'looks', 'others']);
48
48
  // what Undo never takes back: opening, a task closed by a reply, and what Claude wrote (the reply, the gist, why no draft, Where it stands,
49
49
  // the watch offer and its landing)
50
- const NOT_UNDONE = new Set(['read', 'draft', 'closed', 'gist', 'nodraft', 'stands', 'offer', 'landed', 'looks']);
50
+ const NOT_UNDONE = new Set(['read', 'draft', 'closed', 'gist', 'nodraft', 'stands', 'offer', 'landed', 'looks', 'others']);
51
51
  // looks: "someone else may have answered" with the quoted line (round 3 point 10d). The morning brief writes it (step 5b, `pmos mention
52
52
  // looks`, the PM's yes of 2026-11-19); the row drops to Can wait with ✓ ✕ and nothing closes until the PM says so.
53
- const AGENT_ACTS = new Set(['draft', 'gist', 'nodraft', 'stands', 'offer', 'landed', 'looks']);
53
+ // others: PMOS is sure someone else answered (the asker accepted it or moved on): the ask leaves Today with the line quoted, into PMOS
54
+ // handled, Undo (reopen) puts it back. Written by the morning brief (`pmos mention answered`), the PM's yes of 2026-11-19 (round 3 point 14).
55
+ const AGENT_ACTS = new Set(['draft', 'gist', 'nodraft', 'stands', 'offer', 'landed', 'looks', 'others']);
54
56
  const STILL_DAYS = 21; // an ask with no move this long asks "Still needed?" once (round 3 point 10g)
55
57
  const DAY = 86400000;
56
58
  const KEEP_DAYS = 14; // a mention that stopped waiting is kept this long (Last 7 days shows 7 of them)
@@ -257,11 +259,12 @@ function mark(rt, b, now = new Date(), by = 'pm') {
257
259
  if (Number.isFinite(d)) line.due = new Date(d).toISOString();
258
260
  }
259
261
  }
260
- if (b.act === 'looks') { // the quoted line that may answer it, and who wrote it
262
+ if (b.act === 'looks' || b.act === 'others') { // the quoted line that (may) answer it, and who wrote it
261
263
  if (typeof b.text !== 'string' || !b.text.trim()) return { ok: false, error: 'text is the line that answers it, quoted from the thread' };
262
264
  if (b.text.trim().length > 200) return { ok: false, error: 'text is over 200 characters: quote the one line' };
263
265
  line.text = b.text.trim();
264
266
  if (b.who) line.who = clip(b.who, 80);
267
+ if (b.act === 'others' && !line.who) return { ok: false, error: 'who is the person who answered it' };
265
268
  const t = b.on ? Date.parse(b.on) : NaN; if (Number.isFinite(t)) line.on = new Date(t).toISOString();
266
269
  }
267
270
  if (b.act === 'stands') {
@@ -391,7 +394,7 @@ function judgeConv(list, mk, now, me) {
391
394
  const reopened = mk.reopen ? T(mk.reopen.at) : 0;
392
395
  const auto = (t) => (t && t > reopened ? t : 0);
393
396
  const cover = [['replied', auto(Math.max(lastMe, upTo(repSeen)))], ['closed', auto(upTo(closedSeen))], ['withdrawn', auto(upTo(wdSeen))],
394
- ['answered', mk.answered ? T(mk.answered.at) : 0], ['notask', mk.notask ? T(mk.notask.at) : 0], ['task', mk.task ? T(mk.task.at) : 0]];
397
+ ['others', auto(mk.others ? upTo(T(mk.others.on || mk.others.at)) : 0)], ['answered', mk.answered ? T(mk.answered.at) : 0], ['notask', mk.notask ? T(mk.notask.at) : 0], ['task', mk.task ? T(mk.task.at) : 0]];
395
398
  const upto = Math.max(...cover.map((c) => c[1]));
396
399
  const how = upto ? cover.filter((c) => c[1] === upto)[0][0] : '';
397
400
  const pending = askT.filter((t) => t > upto);
@@ -451,6 +454,7 @@ function convRow(id, list, j, mk, reads, now, me) {
451
454
  const kept = mk.keep ? T(mk.keep.at) : 0;
452
455
  if (j.waiting && j.since && now - Math.max(j.last, j.since) >= STILL_DAYS * DAY && !(kept && kept >= j.lastOther)) r.check = true;
453
456
  // the proof the self check found (round 3 point 10c, 10f): what closed it, from the records only
457
+ if (!j.waiting && j.how === 'others' && mk.others) { r.proof = { how: 'others', at: mk.others.on || mk.others.at, cleared: mk.others.at, who: mk.others.who || '', text: clip(mk.others.text, 160) }; r.auto = true; }
454
458
  if (!j.waiting && ['replied', 'closed', 'withdrawn'].includes(j.how)) {
455
459
  const mine = msgs.filter((m) => m.me && T(m.at) && T(m.at) <= j.upto + 1).pop() || msgs.filter((m) => m.me).pop();
456
460
  const by = (byT.find((e) => e.closed_as) || {}).closed_as;
@@ -112,6 +112,7 @@ const MODULES = Object.freeze([
112
112
  'routes-report-setups', // report-workspace: recurring reports, the Ask box, the finder, the report documents and their export (report-setups.jsonl)
113
113
  'routes-artefacts', // R18 (D107): the seven artefacts, read-only, and the lossless carry of the older records (artefacts.jsonl)
114
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-backlog', // work-backlog: every open task of a product in one list (No home, Jira epic), and PMOS taking tasks itself through the day run (gives.jsonl; page-press POST)
115
116
  'routes-pop-work', // popup-work-contents (slice 3): the summary of an initiative changed or confirmed in place (initiative-writer setDescription; page-press POST)
116
117
  'routes-custom-docs', // briefing-premium-adddoc: the documents the PM adds beyond the core set, Add a document (custom-docs.jsonl)
117
118
  'routes-library', // library-place (slice 7 of the six-place navigation): GET /api/library-items, what was made, every product (read only)
@@ -0,0 +1,283 @@
1
+ 'use strict';
2
+ /* routes-backlog.js — the Backlog in Work: every open task of a product in one list, and PMOS taking tasks and finishing them itself
3
+ * (initiative work-backlog; brief nav-structure/backlog/build-brief.md, Part A and Part B; boards BkList and BkSelect on Exploring 2).
4
+ *
5
+ * GET /api/backlog?ws=&board= → { ok, ws, board, product, mode, modeLabel, factory, readAt, tasks: [task], inis: [{ id, title }] }
6
+ * lib/backlog.js tasksOf: the board's PMOS tasks and Jira tickets, and the tickets of its sprints no
7
+ * initiative holds (No home). 202 { pending } while the initiatives are still being read.
8
+ * POST /api/backlog/give { ws, board, tasks: [id] } PMOS takes each task: one task of today's day run (lib/day-run.js), the
9
+ * same agent path as My work's "Have the agent draft it". What it does and whether the result waits
10
+ * for the PM come from lib/backlog.js takeOf; a task the words do not place gets "write up what you
11
+ * find" as a document.
12
+ * POST /api/backlog/stop { ws, board, task } the PM takes it back before it finishes (its session ends)
13
+ * POST /api/backlog/decide { ws, board, task, action: approve|revise, note?, body? } the PM's Approve or Send back on a result that
14
+ * waits; body: the message's words as the PM changed them in the Review popup
15
+ * POST /api/backlog/undo { ws, board, task } the Undo of "Done by PMOS today": the task is open again, PMOS's result stays
16
+ * in the day run for the record
17
+ * POST /api/backlog/decline { ws, board, task, undo? } ✕ on "PMOS can take these": not for PMOS (and its Undo)
18
+ * POST /api/backlog/place { ws, board, key, to } a No home Jira ticket into an initiative (a ticket-move line on the board
19
+ * ledger, as a split or merge writes it; Jira is not written to, D88). to '' takes it back out.
20
+ *
21
+ * Every POST is a page press (lib/pm-guard.js requirePagePress). The gives ledger is <runtime>/backlog/gives.jsonl, append-only, and this file
22
+ * is its one writer. Nothing here sends anything: a message PMOS drafts goes out only after the PM's Approve, through the day run's own send.
23
+ * A task PMOS finished by itself is closed (Done) on the next read, by the same function `pmos task state` runs, written as the agent. */
24
+ const fs = require('fs');
25
+ const path = require('path');
26
+ const guard = require('./pm-guard.js');
27
+ const actorLib = require('./actor.js');
28
+ const BL = require('./backlog.js');
29
+ const dayRun = require('./day-run.js');
30
+ const assigned = require('./work-assigned.js');
31
+ const WK = require('./work-kind.js');
32
+
33
+ const RUN_DAYS = 14;
34
+ const bad = (status, error, extra = {}) => ({ status, body: { ok: false, error, ...extra } });
35
+ const text = (v) => (typeof v === 'string' ? v.trim() : '');
36
+ const pad = (n) => String(n).padStart(2, '0');
37
+ const localDate = (ms) => { const d = new Date(ms); return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`; };
38
+
39
+ const givesFile = (ctx) => path.join(ctx.runtimeDir, 'backlog', 'gives.jsonl');
40
+ function readGives(ctx) {
41
+ let raw = '';
42
+ try { raw = fs.readFileSync(givesFile(ctx), 'utf8'); } catch { return []; }
43
+ const out = [];
44
+ for (const l of raw.split('\n')) { if (!l.trim()) continue; try { out.push(JSON.parse(l)); } catch { /* a torn line has no effect */ } }
45
+ return out;
46
+ }
47
+ function appendGive(ctx, line) {
48
+ fs.mkdirSync(path.dirname(givesFile(ctx)), { recursive: true });
49
+ fs.appendFileSync(givesFile(ctx), JSON.stringify({ at: new Date().toISOString(), ...line }) + '\n');
50
+ }
51
+
52
+ /** The day runs of the last RUN_DAYS days, newest first, and the newest copy of each task in them. */
53
+ function runsRead(ctx, now) {
54
+ const runs = assigned.recentRuns(ctx.readDayRun, now, RUN_DAYS);
55
+ const tasks = new Map();
56
+ for (const r of runs.slice().reverse()) for (const t of r.tasks || []) if (t && t.id) tasks.set(t.id, t);
57
+ return { runs, tasks };
58
+ }
59
+
60
+ /** The Jira readings of a board: every snapshot of its linked initiatives, then the whole-sprint read (the newer one for sprints). */
61
+ function readingsOf(w, jiraStatus) {
62
+ const R = new Map(); let readAt = null; const sprintKeys = [];
63
+ const add = (t) => { if (t && t.key) R.set(String(t.key).toUpperCase(), { ...(R.get(String(t.key).toUpperCase()) || {}), ...t }); };
64
+ try {
65
+ for (const q of jiraStatus.linkedInitiatives(w.root).filter((x) => x.linked)) {
66
+ const s = jiraStatus.readSnapshot(w.root, q.initiative);
67
+ if (!s) continue;
68
+ if (s.fetchedAt && (!readAt || s.fetchedAt < readAt)) readAt = s.fetchedAt;
69
+ for (const t of s.tickets.values()) add(t);
70
+ }
71
+ } catch { /* no reading yet */ }
72
+ try {
73
+ const whole = jiraStatus.readSprints(w.root);
74
+ if (whole) {
75
+ if (whole.fetchedAt && (!readAt || whole.fetchedAt < readAt)) readAt = whole.fetchedAt;
76
+ for (const t of whole.tickets.values()) { add(t); if (t.sprint && t.sprint.name && t.sprint.state !== 'closed') sprintKeys.push(String(t.key).toUpperCase()); }
77
+ }
78
+ } catch { /* no whole-sprint read */ }
79
+ return { R, readAt, sprintKeys };
80
+ }
81
+
82
+ /** One board's tasks, as GET /api/backlog answers them. → { ok, ... } | { pending } | { error, status } */
83
+ function listOf(ctx, wsId, boardId, now) {
84
+ const RB = require('./routes-boards.js');
85
+ const jiraStatus = require('./jira-status.js');
86
+ const w = ctx.getWs(wsId || null);
87
+ if (!w || (wsId && w.id !== wsId)) return { error: 'no such workspace', status: 404 };
88
+ const fr = RB.frameFor(ctx, w);
89
+ const board = fr.boards.find((b) => b.id === (boardId || w.id)) || (!boardId ? fr.boards[0] : null);
90
+ if (!board) return { error: `no board ${boardId} in this workspace`, status: 404 };
91
+ const b = RB.baseRows(w, ctx);
92
+ if (b.pending) return { pending: true, ws: w.id, board: board.id };
93
+ if (!b.ok) return { error: b.error, status: 500 };
94
+ const rows = RB.rowsOfBoard(fr, board, b.rows);
95
+ const live = rows.filter((x) => !x.archived);
96
+ const items = RB.itemsOf(w, fr, board, live);
97
+ const all = new Set(b.rows.map((x) => x.id));
98
+ // a PMOS task of this board whose initiative is on no row at all (a record removed): No home
99
+ const homeless = [];
100
+ for (const t of fr.folded.tasks.values()) if (t.board === board.id && t.kind !== 'Epic' && !all.has(t.initiative)) homeless.push({ uid: t.id, title: t.title, owner: t.owner, status: t.state, end: t.due, milestone: false });
101
+ const { R, readAt, sprintKeys } = readingsOf(w, jiraStatus);
102
+ const today = localDate(now);
103
+ const { tasks: runTasks } = runsRead(ctx, now);
104
+ const gives = BL.foldGives(readGives(ctx));
105
+ let factory = false; try { factory = WK.factoryRuns(w.root); } catch { factory = false; }
106
+ const inis = live.filter((x) => !x.closed).map((x) => ({ id: x.id, title: x.title, kind: BL.KINDS.includes(x.kind) ? x.kind : 'product', epics: x.epics || [] }));
107
+ const tasks = BL.tasksOf({ ws: w.id, board: board.id, product: board.product || board.name || w.name || w.id, today, items, inis, readings: R, sprintKeys,
108
+ moves: fr.folded.ticketMoves || new Map(), homeless, gives, runTasks, factory, me: actorLib.PM_SLUG });
109
+ const mode = BL.modeOf(inis.map((x) => x.kind));
110
+ // the product's display name ("IDPF"), not its folder id ("pmos-idpf"): the board's own name first
111
+ const product = board.name || board.product || w.name || w.id;
112
+ return { ok: true, ws: w.id, board: board.id, product, mode, modeLabel: BL.MODE_LABEL[mode], kinds: BL.countKinds(inis.map((x) => x.kind)), factory, readAt, today,
113
+ tasks, inis: inis.map((x) => ({ id: x.id, title: x.title, kind: x.kind })), _w: w, _RB: RB, _runTasks: runTasks };
114
+ }
115
+
116
+ /** A task PMOS finished by itself (or the PM approved) is closed in PMOS, once: the same write as `pmos task state --to Done`, as the agent. */
117
+ function settle(ctx, L) {
118
+ for (const t of L.tasks) {
119
+ if (t.src !== 'pmos' || !t.agent || t.agent.state !== 'done' || !['To do', 'In progress', 'In review'].includes(t.state)) continue;
120
+ const rt = t.given && L._runTasks ? L._runTasks.get(t.given.run) || null : null;
121
+ const sess = rt && actorLib.SESSION_RE.test(String(rt.session_id || '')) ? rt.session_id : null;
122
+ const r = L._RB.taskState(ctx, { ws: L.ws, board: L.board, task: t.id, state: 'Done', why: 'PMOS finished it' + (t.agent.draft && t.agent.draft.summary ? ': ' + t.agent.draft.summary.slice(0, 200) : '') }, { ok: true, actor: { by: sess ? 'agent:' + sess : 'agent:unknown', via: 'cli' } });
123
+ if (r.status === 200) t.state = 'Done';
124
+ }
125
+ }
126
+
127
+ const strip = (L) => { const { _w, _RB, _runTasks, ...rest } = L; void _w; void _RB; void _runTasks; return rest; };
128
+
129
+ /** What a give asks the agent to do, written for it. */
130
+ function specOf(t, take, id) {
131
+ const review = take ? take.review : null;
132
+ const where = t.iniTitle ? ` It is part of the initiative "${t.iniTitle}".` : '';
133
+ const jira = t.key ? ` It is the Jira ticket ${t.key}${t.epic && t.epic.name ? ` under the epic "${t.epic.name}"` : ''}. Read it; never change it in Jira.` : '';
134
+ const ask = review === 'pr'
135
+ ? `Build this task through the factory (D65, propose-only): open ONE pull request in the product repository and put its link as the draft's link. Never merge it and never push to a main branch. The draft's summary says what the pull request changes; its body lists every file it changes, one "diff --git a/<path> b/<path>" line or one "- <path>" line each, and a line "Checks: …" with the checks it passed. PMOS reads the files against the guardrail list (migrations, sign-in, payments, personal data, secrets, CI, dependencies, public API) to decide whether the PM reviews it. If the change cannot be undone for another reason, add one line "Guarded: <two or three words>", for example "Guarded: deletes old records".`
136
+ : review === 'message'
137
+ ? `Draft the message this task needs. Draft only: send nothing to anyone. The draft's summary says who it goes to and where, as "To <who> in <where>" (Slack channel, email, Jira comment); its body is the message exactly as it will go. The PM approves it before it goes.`
138
+ : review === 'doc'
139
+ ? `Do this task and deliver the result as ONE document${take.to ? ` for ${take.to}` : ''}. Send nothing to anyone: the PM reads it first and passes it on.`
140
+ : `Do this task and deliver the result as ONE document for the PM: the finding, the comparison, the notes or the plan the task asks for. Use what this repository and your connected tools hold. Send nothing to anyone.`;
141
+ // only a message waits inside the day run (its send needs the PM's yes); every other result finishes there, and the Backlog decides from
142
+ // the gives ledger whether it waits (a guarded pull request, a document that goes to others)
143
+ return { id, item_id: null, title: t.title.slice(0, 250), source: 'backlog', link: t.url || null, kind: review === 'message' ? 'approve' : 'auto',
144
+ instruction: `The PM gave this task to PMOS: "${t.title}".${where}${jira} ${ask}`,
145
+ context: { about: t.title, due: t.due || null, from: t.who || null, ask: null } };
146
+ }
147
+
148
+ async function handle(req, res, url, ctx) {
149
+ const send = (r) => { ctx.json(res, r.body, r.status); return true; };
150
+ const sub = url.pathname.replace(/^\/api\/backlog\/?/, '');
151
+ const now = Date.now();
152
+ if (sub === '') {
153
+ if (req.method !== 'GET') return send(bad(405, 'GET only'));
154
+ const L = listOf(ctx, url.searchParams.get('ws') || null, url.searchParams.get('board') || null, now);
155
+ if (L.pending) return send({ status: 202, body: { ok: true, pending: true, ws: L.ws, board: L.board } });
156
+ if (!L.ok) return send(bad(L.status || 500, L.error));
157
+ try { settle(ctx, L); } catch { /* the next read tries again */ }
158
+ return send({ status: 200, body: strip(L) });
159
+ }
160
+ if (!['give', 'stop', 'decide', 'undo', 'decline', 'place'].includes(sub)) return send(bad(404, 'no such route'));
161
+ if (req.method !== 'POST') return send(bad(405, 'POST only'));
162
+ const read = await ctx.readJson(req);
163
+ if (!read.ok || !read.body || typeof read.body !== 'object') return send(bad(400, 'the body must be a JSON object'));
164
+ const body = read.body;
165
+ const g = guard.requirePagePress(req, body);
166
+ if (!g.ok) return send(bad(g.status, g.error));
167
+ const L = listOf(ctx, text(body.ws) || null, text(body.board) || null, now);
168
+ if (L.pending) return send(bad(409, 'the initiatives are still being read — try again in a moment'));
169
+ if (!L.ok) return send(bad(L.status || 500, L.error));
170
+ const ws = L.ws, board = L.board;
171
+ const find = (id) => L.tasks.find((t) => t.id === id) || null;
172
+ const gives = BL.foldGives(readGives(ctx));
173
+ const giveOf = (id) => (gives.get(BL.keyOf(ws, board, id)) || { give: null, declined: null, n: 0 });
174
+
175
+ if (sub === 'place') {
176
+ const key = text(body.key).toUpperCase(), to = text(body.to);
177
+ if (!/^[A-Z][A-Z0-9_]*-\d+$/.test(key)) return send(bad(400, 'key is a Jira key like IDPF-3340'));
178
+ if (to && !L.inis.some((x) => x.id === to)) return send(bad(404, `no open initiative ${to} on this board`));
179
+ const file = L._RB.ledgerFile(ctx, L._w);
180
+ if (!file) return send(bad(409, L._RB.NO_STATE));
181
+ const was = (L._RB.frameFor(ctx, L._w).folded.ticketMoves || new Map()).get(key) || '';
182
+ L._RB.append(file, g.actor, { kind: 'ticket-move', board, key, to, why: to ? 'placed from the Backlog' : 'taken back out (Undo)' });
183
+ return send({ status: 200, body: { ok: true, key, to, from: was } });
184
+ }
185
+
186
+ if (sub === 'give') {
187
+ const ids = Array.isArray(body.tasks) ? body.tasks.map(text).filter(Boolean).slice(0, 50) : [text(body.task)].filter(Boolean);
188
+ if (!ids.length) return send(bad(400, 'tasks is a list of task ids'));
189
+ const done = [], refused = [];
190
+ for (const id of ids) {
191
+ const t = find(id);
192
+ if (!t) { refused.push({ id, error: 'not an open task of this board' }); continue; }
193
+ if (t.agent && t.agent.state !== 'failed') { refused.push({ id, error: 'PMOS already has it' }); continue; }
194
+ if (t.milestone) { refused.push({ id, error: 'a milestone is a date, not work PMOS can do' }); continue; }
195
+ const take = t.take || { what: 'writes up what it finds', review: null, to: '' };
196
+ const n = giveOf(id).n + 1, run = BL.runTaskId(ws, board, id, n);
197
+ const b = ctx.myWorkBrief(specOf(t, take, run), ws);
198
+ if (!b.ok) { refused.push({ id, error: b.error }); continue; }
199
+ appendGive(ctx, { ev: 'give', ws, board, task: id, src: t.src, run, review: take.review || null, to: take.to || '', what: take.what, why: BL.reviewWhy(take.review, take.to), by: g.actor.by });
200
+ done.push(id);
201
+ }
202
+ return send({ status: done.length ? 200 : 409, body: { ok: done.length > 0, given: done, refused, ...(done.length ? {} : { error: refused.map((r) => r.error)[0] || 'nothing was given' }) } });
203
+ }
204
+
205
+ const id = text(body.task);
206
+ const t = find(id), gv = giveOf(id);
207
+ if (sub === 'decline') {
208
+ if (!t) return send(bad(404, 'not an open task of this board'));
209
+ appendGive(ctx, { ev: body.undo ? 'undecline' : 'decline', ws, board, task: id, by: g.actor.by });
210
+ return send({ status: 200, body: { ok: true } });
211
+ }
212
+ if (!gv.give) return send(bad(409, 'PMOS does not have this task'));
213
+ const { runs } = runsRead(ctx, now);
214
+ const run = assigned.runWith(runs, gv.give.run), rt = run ? dayRun.findTask(run, gv.give.run) : null;
215
+
216
+ if (sub === 'stop') {
217
+ if (rt && (rt.status === 'waiting' || rt.status === 'working')) {
218
+ if (rt.session_id && rt.status === 'working' && ctx.endSession) { try { ctx.endSession(rt.session_id); } catch { /* it ended already */ } }
219
+ const f = dayRun.stop(run, rt.id, 'You took it back.', now);
220
+ const wd = f.ok ? dayRun.withdraw(f.run, rt.id) : f;
221
+ if (!wd.ok) return send(bad(409, wd.error));
222
+ if (!ctx.writeDayRun(wd.run)) return send(bad(500, 'could not save — nothing changed'));
223
+ } else if (rt && !['failed'].includes(rt.status)) return send(bad(409, `PMOS has finished it (${rt.status}) — use Undo or Send back`));
224
+ appendGive(ctx, { ev: 'stop', ws, board, task: id, by: g.actor.by });
225
+ return send({ status: 200, body: { ok: true } });
226
+ }
227
+
228
+ if (sub === 'undo') {
229
+ // the task is open again; a PMOS task PMOS closed goes back to To do (the same write as the Board's status press)
230
+ if (t && t.src === 'pmos' && t.state === 'Done') {
231
+ const r = L._RB.taskState(ctx, { ws, board, task: id, state: 'To do', why: 'Undo of PMOS finishing it' }, g);
232
+ if (r.status !== 200) return send(bad(r.status, (r.body && r.body.error) || 'the task could not be opened again'));
233
+ }
234
+ appendGive(ctx, { ev: 'undo', ws, board, task: id, by: g.actor.by });
235
+ return send({ status: 200, body: { ok: true } });
236
+ }
237
+
238
+ // decide
239
+ const action = text(body.action);
240
+ if (action !== 'approve' && action !== 'revise') return send(bad(400, 'action is approve or revise'));
241
+ if (!rt) return send(bad(409, 'PMOS has not delivered this task yet'));
242
+ if (action === 'revise') {
243
+ const note = text(body.note).slice(0, 500);
244
+ if (!note) return send(bad(400, 'say what to change: Send back needs a note'));
245
+ if (run.date === localDate(now)) {
246
+ const d = dayRun.decide(run, rt.id, { action: 'revise', note }, now);
247
+ if (!d.ok) return send(bad(409, d.error));
248
+ if (!ctx.writeDayRun(ctx.startDayTasks ? ctx.startDayTasks(d.run, now) : d.run)) return send(bad(500, 'could not save — nothing changed'));
249
+ } else {
250
+ // an earlier day's result: the job reads today's run only, so the next round is a new give of today, with the note and the old draft
251
+ const n = gv.n + 1, nid = BL.runTaskId(ws, board, id, n), take = { review: gv.give.review, to: gv.give.to || '' };
252
+ const spec = specOf(t || { title: rt.title, iniTitle: '', key: '', url: null }, take, nid);
253
+ spec.instruction += `\n\nThe PM sent your earlier result back with this note: ${note}${rt.draft && rt.draft.body ? `\n\nYour earlier result, to change:\n${String(rt.draft.body).slice(0, 4000)}` : ''}`;
254
+ const b = ctx.myWorkBrief(spec, ws);
255
+ if (!b.ok) return send(bad(b.status || 500, b.error));
256
+ appendGive(ctx, { ev: 'give', ws, board, task: id, src: gv.give.src || 'pmos', run: nid, review: gv.give.review || null, to: gv.give.to || '', what: gv.give.what || '', why: gv.give.why || '', by: g.actor.by });
257
+ }
258
+ return send({ status: 200, body: { ok: true } });
259
+ }
260
+ // approve: a message waits for its send; any other result is the PM's yes, and the task closes
261
+ if (rt.kind === 'approve' && rt.status === 'review') {
262
+ // the PM may change the words in the Review popup before the yes: the day run keeps the agent's own words beside them (dayRun.edit)
263
+ const edited = typeof body.body === 'string' ? body.body.trim() : '';
264
+ if (run.date === localDate(now)) {
265
+ let cur = run;
266
+ if (edited && rt.draft && edited !== rt.draft.body) { const e = dayRun.edit(cur, rt.id, edited, now); if (!e.ok) return send(bad(400, e.error)); cur = e.run; }
267
+ const d = dayRun.decide(cur, rt.id, { action: 'approve' }, now);
268
+ if (!d.ok) return send(bad(409, d.error));
269
+ if (!ctx.writeDayRun(ctx.startDayTasks ? ctx.startDayTasks(d.run, now) : d.run)) return send(bad(500, 'could not save — nothing changed'));
270
+ } else {
271
+ const spec = edited && rt.draft ? { ...rt, draft: { ...rt.draft, body: edited.slice(0, 8000) } } : rt;
272
+ const b = ctx.myWorkBrief(spec, ws, (today, sp, at) => dayRun.carry(today, sp, at));
273
+ if (!b.ok) return send(bad(b.status || 500, b.error));
274
+ }
275
+ return send({ status: 200, body: { ok: true, sending: true } });
276
+ }
277
+ if (rt.status !== 'done' && rt.status !== 'review') return send(bad(409, `the task is ${rt.status} — nothing waits for your yes`));
278
+ appendGive(ctx, { ev: 'approve', ws, board, task: id, by: g.actor.by });
279
+ if (t && t.src === 'pmos' && t.state !== 'Done') L._RB.taskState(ctx, { ws, board, task: id, state: 'Done', why: 'you approved what PMOS did' }, g);
280
+ return send({ status: 200, body: { ok: true } });
281
+ }
282
+
283
+ module.exports = { prefixes: ['/api/backlog'], handle, listOf, specOf };
@@ -802,6 +802,19 @@ function itemsOf(w, fr, board, rows) {
802
802
  // a split or a merge took a Jira ticket to another initiative (batch 11 item 14): PMOS holds where it belongs; Jira is not written to
803
803
  const TM = fr.folded.ticketMoves || new Map();
804
804
  if (TM.size) for (const x of out) if (x.src === 'jira' && x.key && TM.has(x.key)) x.ini = TM.get(x.key);
805
+ // a sprint ticket no initiative held, placed in one from the Backlog (work-backlog, a ticket-move line): it shows on that initiative too
806
+ if (TM.size && board.build) {
807
+ let whole = null;
808
+ for (const [k, to] of TM) {
809
+ if (!to || !ids.has(to) || jiraKeys.has(k) || out.some((x) => x.src === 'jira' && x.key === k)) continue;
810
+ if (whole === null) { try { whole = jiraStatus.readSprints(w.root) || false; } catch { whole = false; } }
811
+ const rd = whole && whole.tickets && whole.tickets.get ? whole.tickets.get(k) : null;
812
+ if (!rd) continue;
813
+ const kind = ['Story', 'Task', 'Bug'].find((t) => t.toLowerCase() === String(rd.type || '').toLowerCase()) || 'Task';
814
+ out.push({ uid: k, key: k, kind, src: 'jira', title: rd.summary || k, status: B.itemStatus(rd.status, rd.category), blocked: !!rd.flagged, owner: null, ini: to, epic: rd.parent || null, start: null, end: null, ref: null, board: board.id, readAt: whole.fetchedAt || null, notes: '' });
815
+ jiraKeys.add(k);
816
+ }
817
+ }
805
818
  // a task's place in the breakdown (one view): the PM's own choice, else the stage whose To finish entry made it
806
819
  const SEC = fr.folded.sections || new Map();
807
820
  for (const x of out) if (x.src === 'pmos' && x.kind !== 'Epic') { if (SEC.has(x.uid)) x.section = SEC.get(x.uid); else if (x.from && x.from.stage) x.section = x.from.stage; }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.614.0",
3
+ "version": "0.616.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.614.0",
9
+ "version": "0.616.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.614.0",
3
+ "version": "0.616.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",
@@ -0,0 +1,158 @@
1
+ /* pm/bd-backlog.css — the Backlog in Work (initiative work-backlog; boards BkList and BkSelect on Exploring 2). Workspace tokens only, so
2
+ * dark mode follows cozy.css. Every class starts with bk-. body.bk-on: the Backlog shows in place of the initiatives; the view chip and the
3
+ * count pill, which are the initiatives', step aside. */
4
+ body.bd-page.bk-on [id="ibBody"], body.bd-page.bk-on [id="bdVieww"], body.bd-page.bk-on [id="bdChipset"] { display: none !important; }
5
+ body.bd-page.bk-on .bd-hd .bd-tools { margin-left: auto; }
6
+
7
+ /* the switch: Initiatives | Backlog N */
8
+ .bk-sw { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--cz-well); margin-left: 12px; flex: none; }
9
+ .bk-sw button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 14px; border-radius: 999px; font-size: var(--fs-row); font-weight: var(--fw-regular); color: var(--cz-ink2); }
10
+ .bk-sw button.on { background: var(--cz-card); color: var(--cz-ink); font-weight: var(--fw-strong); box-shadow: 0 1px 3px rgba(30, 34, 42, .12); }
11
+ .bk-sw .k { font-weight: var(--fw-regular); color: var(--cz-ink3); }
12
+ .bk-sw button:focus-visible, .bk-chip:focus-visible, .bk-gt:focus-visible, .bk-t:focus-visible, .bk-ib:focus-visible, .bk-rvb:focus-visible, .bk-yes:focus-visible, .bk-lnk:focus-visible, .bk-ck:focus-visible, .bk-bar button:focus-visible, .bk-pop button:focus-visible, .bk-go:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
13
+
14
+ .bk-host { max-width: 1272px; padding-bottom: 96px; }
15
+ .bk-wait, .bk-none, .bk-err { margin: 16px 4px; font-size: var(--fs-row); color: var(--cz-ink3); }
16
+ .bk-err { color: var(--cz-late); }
17
+
18
+ /* the quick filters */
19
+ .bk-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
20
+ .bk-chip { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; background: var(--cz-well); font-size: var(--fs-row); color: var(--cz-ink2); white-space: nowrap; }
21
+ .bk-chip .k { color: var(--cz-ink3); }
22
+ .bk-chip.on { background: var(--cz-ink); color: var(--cz-card); }
23
+ .bk-chip.on .k { color: var(--cz-card); opacity: .75; }
24
+ .bk-mode, .bk-show { margin: 0 4px 10px; font-size: var(--fs-meta); color: var(--cz-ink3); }
25
+ .bk-mode b { font-weight: var(--fw-strong); color: var(--cz-ink2); }
26
+ .bk-lnk { all: unset; cursor: pointer; color: var(--cz-blue); display: inline-flex; align-items: center; gap: 4px; border-radius: 4px; }
27
+ .bk-lnk svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
28
+
29
+ /* the list */
30
+ /* the Task column takes the spare width (design check 1 f); the others keep a width that holds their words */
31
+ .bk { --bk-cols: 40px minmax(240px, 1fr) 104px minmax(80px, 130px) minmax(110px, 160px) 76px minmax(200px, 290px) 72px;
32
+ border-radius: 16px; box-shadow: inset 0 0 0 1px var(--cz-hair); background: var(--cz-card); }
33
+ .bk-r { display: grid; grid-template-columns: var(--bk-cols); column-gap: 12px; align-items: center; min-height: 42px; padding: 0 12px 0 4px; font-size: var(--fs-row); line-height: 20px; color: var(--cz-ink2); }
34
+ .bk-r + .bk-r { box-shadow: inset 0 1px 0 var(--cz-hair); }
35
+ .bk-r > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
36
+ .bk-r > .c-ck { display: flex; justify-content: center; }
37
+ .bk-h { min-height: 38px; background: var(--cz-well); border-radius: 16px 16px 0 0; font-size: var(--fs-label); font-weight: var(--fw-strong); color: var(--cz-ink3); }
38
+ .bk-g { min-height: 36px; background: var(--cz-well); display: flex; justify-content: space-between; padding: 0 12px 0 12px; }
39
+ .bk-gt { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-size: var(--fs-label); color: var(--cz-ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 6px; }
40
+ .bk-gt svg, .bk-more svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; flex: none; }
41
+ .bk-gt b { font-weight: var(--fw-strong); color: var(--cz-ink); }
42
+ .bk-gt .k { color: var(--cz-ink3); }
43
+ .bk-gt small { font-size: var(--fs-label); color: var(--cz-ink3); overflow: hidden; text-overflow: ellipsis; }
44
+ .bk-yes { all: unset; cursor: pointer; flex: none; height: 26px; padding: 0 12px; border-radius: 999px; background: var(--cz-card); color: var(--cz-blue); font-size: var(--fs-meta); font-weight: var(--fw-strong); box-shadow: inset 0 0 0 1px var(--cz-hair); }
45
+ .bk-more { all: unset; cursor: pointer; display: flex; align-items: center; gap: 6px; min-height: 40px; padding-left: 52px; font-size: var(--fs-meta); color: var(--cz-ink3); box-shadow: inset 0 1px 0 var(--cz-hair); }
46
+ .bk-i.sel { background: var(--cz-bluebg); }
47
+ .bk-i:last-child, .bk-more:last-child, .bk-g:last-child { border-radius: 0 0 16px 16px; }
48
+ /* an outlined box in light and dark alike (design check 1 e): the line colour on the card fill, blue with a tick when ticked */
49
+ .bk-ck { appearance: none; -webkit-appearance: none; width: 16px; height: 16px; margin: 0; border-radius: 4px; background: var(--cz-card); box-shadow: inset 0 0 0 1.5px var(--cz-ink3); cursor: pointer; flex: none; }
50
+ .bk-ck:checked { background: var(--cz-blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7' fill='none' stroke='white' stroke-width='3'/%3E%3C/svg%3E") center / 12px no-repeat; box-shadow: none; }
51
+ .bk-n { display: flex; align-items: center; gap: 8px; }
52
+ .bk-ic { display: inline-flex; flex: none; color: var(--cz-ink3); }
53
+ .bk-ic svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.2; }
54
+ .bk-t { all: unset; cursor: pointer; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--cz-ink); border-radius: 4px; }
55
+ .bk-jk { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
56
+ .bk-jk svg { width: 12px; height: 12px; fill: none; stroke: var(--cz-blue); stroke-width: 2.4; flex: none; }
57
+ .bk-r .q { color: var(--cz-ink3); }
58
+ .bk-pm { color: var(--cz-blue); }
59
+ .bk-s em { font-style: normal; color: var(--cz-ink3); }
60
+ .bk-s.late em { color: var(--cz-late); }
61
+ .bk-s.tk em { color: var(--cz-ink3); }
62
+ .bk-s.tk em.lt { color: var(--cz-late); }
63
+ .bk-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; background: var(--cz-ink3); }
64
+ .bk-dot.blue { background: var(--cz-blue); }
65
+ .bk-dot.amber { background: var(--cz-risk); }
66
+ .bk-dot.red { background: var(--cz-late); }
67
+ .bk-dot.green { background: var(--cz-ok); }
68
+ .bk-a { display: flex; justify-content: flex-end; }
69
+ .bk-two { display: inline-flex; gap: 6px; }
70
+ .bk-ib { all: unset; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; color: var(--cz-ink3); box-shadow: inset 0 0 0 1px var(--cz-hair); }
71
+ .bk-ib svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
72
+ .bk-ib.big { width: 44px; height: 44px; }
73
+ .bk-ib.big svg { width: 20px; height: 20px; }
74
+ .bk-ib.ok { background: var(--cz-ink); color: var(--cz-card); box-shadow: none; }
75
+ .bk-rvb, .bk-go { all: unset; cursor: pointer; height: 30px; padding: 0 14px; border-radius: 999px; background: var(--cz-ink); color: var(--cz-card); font-size: var(--fs-meta); font-weight: var(--fw-strong); display: inline-flex; align-items: center; }
76
+ @media (hover: hover) {
77
+ .bk-sw button:hover:not(.on), .bk-gt:hover b, .bk-t:hover { color: var(--cz-ink); }
78
+ .bk-chip:hover:not(.on) { background: var(--cz-well2); }
79
+ .bk-i:hover { background: var(--cz-well); }
80
+ .bk-i.sel:hover { background: var(--cz-bluebg); }
81
+ .bk-ib:hover { color: var(--cz-ink); background: var(--cz-well2); }
82
+ .bk-ib.ok:hover { background: var(--cz-ink); color: var(--cz-card); opacity: .9; }
83
+ .bk-t:hover { text-decoration: underline; }
84
+ }
85
+
86
+ /* the bar under ticked rows */
87
+ .bk-bar { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 18px; border-radius: 999px; background: var(--cz-ink); color: var(--cz-card); box-shadow: 0 12px 32px -8px rgba(30, 34, 42, .45); max-width: calc(100vw - 32px); overflow-x: auto; }
88
+ .bk-bar .c { font-size: var(--fs-row); margin-right: 6px; white-space: nowrap; }
89
+ .bk-bar button { all: unset; cursor: pointer; height: 34px; padding: 0 14px; border-radius: 999px; background: rgba(255, 255, 255, .12); font-size: var(--fs-row); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
90
+ .bk-bar button.pm { background: var(--cz-blue); }
91
+ .bk-bar button.x { width: 34px; padding: 0; justify-content: center; background: none; }
92
+ .bk-bar button.x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
93
+
94
+ /* small popovers: a pick list, a date, the tune panel, the kind of work */
95
+ .bk-pop { position: fixed; z-index: 70; min-width: 220px; max-width: min(420px, calc(100vw - 16px)); max-height: 60vh; overflow: auto; padding: 10px; border-radius: 14px; background: var(--cz-card); box-shadow: 0 12px 32px -8px rgba(30, 34, 42, .3), 0 0 0 1px var(--cz-hair); }
96
+ .bk-pop .h { margin: 4px 6px 6px; font-size: var(--fs-label); font-weight: var(--fw-strong); color: var(--cz-ink3); }
97
+ .bk-pop .l { display: flex; flex-direction: column; }
98
+ .bk-pop .l button { all: unset; cursor: pointer; padding: 8px 10px; border-radius: 8px; font-size: var(--fs-row); color: var(--cz-ink); }
99
+ .bk-pop .q, .bk-help { margin: 4px 6px; font-size: var(--fs-meta); color: var(--cz-ink3); max-width: 340px; white-space: normal; }
100
+ .bk-pop .r { display: flex; justify-content: flex-end; margin-top: 8px; }
101
+ .bk-in { box-sizing: border-box; width: 100%; height: 34px; margin: 0 0 6px; padding: 0 10px; border: 0; border-radius: 8px; background: var(--cz-well); color: var(--cz-ink); font: inherit; font-size: var(--fs-row); }
102
+ .bk-fg { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 4px 8px; }
103
+ .bk-tune { width: 380px; }
104
+ @media (hover: hover) { .bk-pop .l button:hover { background: var(--cz-well); } }
105
+
106
+ /* Review: what PMOS made, left; why it needs the PM and the two buttons, right */
107
+ .bk-rv { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; background: rgba(20, 22, 28, .32); padding: 16px; }
108
+ .bk-rvc { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; width: min(980px, 100%); max-height: calc(100vh - 32px); border-radius: 18px; background: var(--cz-card); box-shadow: 0 24px 60px -12px rgba(30, 34, 42, .45); padding: 22px; box-sizing: border-box; overflow: hidden; }
109
+ .bk-rvl { min-width: 0; overflow: auto; }
110
+ .bk-rvl .k { margin: 0 0 4px; font-size: var(--fs-label); color: var(--cz-ink3); }
111
+ .bk-rvl h3 { margin: 0 0 8px; font-size: var(--fs-panel); font-weight: var(--fw-strong); color: var(--cz-ink); }
112
+ .bk-rvl .sm { margin: 0 0 8px; font-size: var(--fs-body); color: var(--cz-ink2); }
113
+ /* the whole result in the normal text font (design check 1 c): a message is editable in place, a document reads as written */
114
+ .bk-rvl .bd { box-sizing: border-box; display: block; width: 100%; margin: 12px 0 0; padding: 14px; border: 0; border-radius: 10px; background: var(--cz-well); white-space: pre-wrap; font: inherit; font-size: var(--fs-body); line-height: 1.5; color: var(--cz-ink); max-height: 56vh; overflow: auto; }
115
+ textarea.bk-rvl-ed, .bk-rvl textarea.bd { resize: vertical; min-height: 180px; }
116
+ .bk-rvl .to { margin: 0 0 4px; font-size: var(--fs-body); color: var(--cz-ink2); }
117
+ .bk-rvl .to b { font-weight: var(--fw-strong); color: var(--cz-ink); }
118
+ .bk-rvl .fl { margin: 12px 0 0; padding: 0; list-style: none; font-size: var(--fs-row); color: var(--cz-ink2); }
119
+ .bk-rvl .fl li { padding: 6px 0; box-shadow: inset 0 -1px 0 var(--cz-hair); overflow-wrap: anywhere; }
120
+ .bk-rvl .ck { margin: 12px 0 0; font-size: var(--fs-row); color: var(--cz-ink2); }
121
+ .bk-rvl .ck b { color: var(--cz-ok); font-weight: var(--fw-strong); }
122
+ .bk-said { display: flex; align-items: center; gap: 10px; margin: 0 4px 10px; font-size: var(--fs-row); color: var(--cz-ink2); }
123
+ .bk-kd { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; margin: 0 6px; }
124
+ .bk-kd span { font-size: var(--fs-row); color: var(--cz-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
125
+ .bk-kd select { height: 30px; border: 0; border-radius: 8px; padding: 0 8px; background: var(--cz-well); color: var(--cz-ink); font: inherit; font-size: var(--fs-meta); }
126
+ .bk-kdp { width: 440px; }
127
+ .bk-note1 { box-sizing: border-box; width: 100%; height: 36px; border: 0; border-radius: 10px; padding: 0 10px; background: var(--cz-well); color: var(--cz-ink); font: inherit; font-size: var(--fs-row); }
128
+ .bk-rvr { display: flex; flex-direction: column; gap: 12px; padding-top: 28px; }
129
+ .bk-rvr .why { margin: 0; font-size: var(--fs-body); color: var(--cz-ink2); }
130
+ .bk-rvb2 { display: flex; gap: 10px; }
131
+ .bk-note { box-sizing: border-box; width: 100%; border: 0; border-radius: 10px; padding: 10px; background: var(--cz-well); color: var(--cz-ink); font: inherit; font-size: var(--fs-row); resize: vertical; }
132
+ .bk-rvr .x { position: absolute; top: 14px; right: 14px; }
133
+ .bk-rv [hidden] { display: none !important; }
134
+
135
+ /* a phone: each row is two lines, the name and then the rest */
136
+ @media (max-width: 760px) {
137
+ /* the tick boxes wait for a long press on a row, so the name gets the width (design check 1 h) */
138
+ .bk-host:not(.picking) .bk-i > .c-ck, .bk-emb .bk-i > .c-ck { display: none; }
139
+ .bk-host:not(.picking) .bk-i, .bk-emb .bk-i { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'n a' 'm a'; padding-left: 12px; }
140
+ .bk-sw.bk-sw-row { display: flex; margin: 0 0 10px; padding: 2px; }
141
+ .bk-sw.bk-sw-row button { flex: 1; justify-content: center; height: 32px; padding: 0 8px; }
142
+ .bk-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -16px; padding-right: 16px; }
143
+ .bk, .bk-emb { --bk-cols: 32px minmax(0, 1fr) auto !important; }
144
+ .bk-h { display: none; }
145
+ .bk-i { grid-template-columns: 32px minmax(0, 1fr) auto; grid-template-areas: 'c n a' 'c m a'; padding: 8px 10px 8px 0; row-gap: 2px; }
146
+ .bk-i > .c-ck { grid-area: c; }
147
+ .bk-i > .c-n { grid-area: n; }
148
+ .bk-i > .c-a { grid-area: a; }
149
+ .bk-i > .c-jira, .bk-i > .c-epic, .bk-i > .c-ini, .bk-i > .c-who { display: none; }
150
+ .bk-i > .c-state { grid-area: m; font-size: var(--fs-meta); }
151
+ .bk-rvc { grid-template-columns: 1fr; overflow: auto; }
152
+ .bk-rvr { padding-top: 0; }
153
+ .bk-bar { left: 8px; right: 8px; transform: none; }
154
+ }
155
+ @media (pointer: coarse) { .bk-ib { width: 40px; height: 40px; } .bk-chip { height: 40px; } }
156
+ .bk-emb .bk-i > .c-ck .bk-ck { visibility: hidden; } /* ticking is the Backlog's, not an embedded list's */
157
+ .bk-r > .c-due.lt { color: var(--cz-late); } /* the popup's optional Due cell: late in red words */
158
+ @media (max-width: 760px) { .bk-i > .c-due { display: none; } }