create-pmos 0.476.0 → 0.478.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 (83) hide show
  1. package/package.json +33 -27
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/board-publish-ui-test.js +11 -16
  7. package/workspace/board-shared-ui-test.js +34 -33
  8. package/workspace/changelog.json +32 -0
  9. package/workspace/guide/briefing-premium.md +2 -2
  10. package/workspace/guide/claude-proposes.md +3 -1
  11. package/workspace/guide/forecast.md +16 -3
  12. package/workspace/guide/home.md +2 -2
  13. package/workspace/guide/published-board.md +1 -0
  14. package/workspace/guide/workflows.md +13 -2
  15. package/workspace/home-railcard-test.js +4 -4
  16. package/workspace/home-rows-test.js +17 -5
  17. package/workspace/ini-workflow-test.js +1 -1
  18. package/workspace/lib/board-pack.js +20 -1
  19. package/workspace/lib/board-trail.js +17 -1
  20. package/workspace/lib/boards-host.js +22 -2
  21. package/workspace/lib/briefing-premium-agent.js +2 -2
  22. package/workspace/lib/engine/boards.js +15 -3
  23. package/workspace/lib/engine/workflows.js +79 -10
  24. package/workspace/lib/forecast-offer.js +57 -0
  25. package/workspace/lib/grill-runs.js +1 -0
  26. package/workspace/lib/grill.js +1 -1
  27. package/workspace/lib/insight-moves.js +8 -6
  28. package/workspace/lib/news-for-you.js +6 -4
  29. package/workspace/lib/report-chat.js +2 -0
  30. package/workspace/lib/routes-board-publish.js +7 -2
  31. package/workspace/lib/routes-boards.js +18 -5
  32. package/workspace/lib/routes-briefing-premium.js +16 -2
  33. package/workspace/lib/routes-forecast.js +8 -1
  34. package/workspace/lib/routes-insight-moves.js +7 -5
  35. package/workspace/lib/routes-news.js +3 -1
  36. package/workspace/lib/routes-workflows.js +13 -0
  37. package/workspace/lib/wf-bridge.js +165 -0
  38. package/workspace/package-lock.json +2 -2
  39. package/workspace/package.json +1 -1
  40. package/workspace/panels-test.js +1 -2
  41. package/workspace/public/pm/bd-fc-card.js +45 -0
  42. package/workspace/public/pm/bd-next.js +1 -1
  43. package/workspace/public/pm/bd-publish.css +22 -18
  44. package/workspace/public/pm/bd-publish.js +57 -48
  45. package/workspace/public/pm/bd-shared.css +92 -30
  46. package/workspace/public/pm/bd-shared.js +143 -55
  47. package/workspace/public/pm/bd-span.js +27 -7
  48. package/workspace/public/pm/cozy-board.css +16 -0
  49. package/workspace/public/pm/cozy-ev.css +46 -0
  50. package/workspace/public/pm/cozy-home.css +4 -4
  51. package/workspace/public/pm/cozy-insights.css +21 -0
  52. package/workspace/public/pm/cozy-jl.js +158 -0
  53. package/workspace/public/pm/cozy-news.js +56 -2
  54. package/workspace/public/pm/cozy-panels.js +3 -2
  55. package/workspace/public/pm/cozy-settings.js +11 -7
  56. package/workspace/public/pm/cozy-today.css +3 -0
  57. package/workspace/public/pm/cozy-viewer.js +19 -3
  58. package/workspace/public/pm/goal-forecast.js +101 -0
  59. package/workspace/public/pm/hi-pop.css +16 -0
  60. package/workspace/public/pm/home-app.js +11 -4
  61. package/workspace/public/pm/home-day.js +5 -3
  62. package/workspace/public/pm/home-list.js +14 -4
  63. package/workspace/public/pm/home-mentions.js +5 -0
  64. package/workspace/public/pm/home-task.js +1 -1
  65. package/workspace/public/pm/home-today.js +11 -4
  66. package/workspace/public/pm/ini-view-model.js +27 -14
  67. package/workspace/public/pm/ini-view.js +1 -1
  68. package/workspace/public/pm/ini-wf-model.js +76 -19
  69. package/workspace/public/pm/ini-wf.js +69 -18
  70. package/workspace/public/pm/metric-drafts.css +9 -0
  71. package/workspace/public/pm/metric-drafts.js +2 -2
  72. package/workspace/public/pm/premium-board.js +13 -3
  73. package/workspace/public/pm/premium-insights.js +43 -6
  74. package/workspace/public/pm/premium-report-tab.js +13 -3
  75. package/workspace/public/pm/premium-vw-item.js +1 -1
  76. package/workspace/public/pm/readonly.js +4 -0
  77. package/workspace/public/pm/report-chat.js +2 -1
  78. package/workspace/public/pm/task-card.js +4 -3
  79. package/workspace/public/pm/wf-page.css +9 -0
  80. package/workspace/public/pm/wf-page.js +30 -1
  81. package/workspace/run-tests.js +54 -8
  82. package/workspace/server.js +5 -2
  83. package/workspace/test-lists/forecast-board.json +5 -0
@@ -366,8 +366,12 @@ const wfRowFields = (x) => {
366
366
  wfStages: x.stages.map((s) => ({ key: s.key, name: s.name, cat: s.cat, milestone: !!s.milestone, auto: !!s.auto, when: s.when, status: s.status, reading: s.reading,
367
367
  output: s.output, finish: s.finish })), // output and finish: what finishes the stage (the stage card's exit steps on a library workflow)
368
368
  ended: x.ended ? { as: x.ended.as, reason: x.ended.reason, note: x.ended.note, at: x.ended.at } : null,
369
+ // batch 20 item 3: where the tasks of an earlier workflow's stages sit now (old key → stage key), and the switch Undo can still put back (7 days)
370
+ wfMap: x.own && x.own.map ? x.own.map : null,
371
+ wfSwitch: x.own && x.own.batch && !x.own.undo && x.own.at && Date.now() - Date.parse(x.own.at) < UNDO_DAYS * 864e5 ? { batch: x.own.batch, at: x.own.at, from: x.own.from } : null,
369
372
  };
370
373
  };
374
+ const UNDO_DAYS = 7;
371
375
 
372
376
  /** The span of an initiative's own tasks: the earliest start (or due) to the latest due (or start). Won't do and Archived
373
377
  * tasks leave it out. null when no task has a date. Feedback batch 8 item 1: a bar drew only from breakdown items, so an initiative
@@ -490,7 +494,9 @@ function stageTasks(file, folded, board, row, by) {
490
494
  if (!list.length) return 0;
491
495
  const have = new Set();
492
496
  // a To finish task the PM deleted stays deleted: the next read must not make it again (batch 17 item 2: "Deleting task, but keep appearing")
493
- for (const t of [...tasksOfIni(folded, row.id), ...(folded.removed ? folded.removed.values() : [])]) if (t.initiative === row.id && t.from && t.from.stage === st.key) have.add(t.from.finish);
497
+ // a To finish task of an old stage that the switch merged into this one counts as this stage's (batch 20 item 3): a ticked item carries over
498
+ const mine = (k) => k === st.key || !!(row.wfMap && row.wfMap[k] === st.key);
499
+ for (const t of [...tasksOfIni(folded, row.id), ...(folded.removed ? folded.removed.values() : [])]) if (t.initiative === row.id && t.from && mine(t.from.stage)) have.add(t.from.finish);
494
500
  let n = 0;
495
501
  for (const f of list) {
496
502
  if (have.has(f)) continue;
@@ -787,7 +793,7 @@ const READS = {
787
793
  seedRows(ctx, r.w, r.fr, r.board, live);
788
794
  ctx.json(res, { ok: true, ws: r.w.id, board: r.board.id, build: r.board.build, jira: r.board.jira, jiraProjects: r.board.jiraProjects, items: itemsOf(r.w, r.fr, r.board, live),
789
795
  initiatives: live.map((x) => ({ id: x.id, title: x.title, stage: x.stage, cat: x.cat, status: x.status, owner: x.owner, anchor: x.anchor || '', horizon: x.horizon, start: x.start, end: x.end, progress: x.progress, template: x.template, epics: x.epics,
790
- stages: (x.wfStages || []).map((st) => ({ key: st.key, name: st.name, milestone: !!st.milestone })) })) }); // the sections a task can sit in (the task Viewer's move icon)
796
+ stages: (x.wfStages || []).map((st) => ({ key: st.key, name: st.name, milestone: !!st.milestone })), ...(x.wfMap ? { map: x.wfMap } : {}) })) }); // the sections a task can sit in (the task Viewer's move icon)
791
797
  },
792
798
  '/api/boards/sprints': (ctx, res, url) => {
793
799
  const r = boardRead(ctx, res, url);
@@ -1109,13 +1115,20 @@ const WRITES = {
1109
1115
  if (!b0 || boardIdOf(b0, p.fr.boards, p.fr.folded, p.w) !== p.board.id) return fail(ctx, res, 404, 'That initiative is not on this board any more.');
1110
1116
  const before = boardRow(p.board, b0, p.fr.folded);
1111
1117
  const from = WF.resolve(lib, before.wf.id);
1112
- let target = WF.switchTarget(from, to, before.wfStage.key);
1118
+ if (body.map != null && !isObj(body.map)) return fail(ctx, res, 400, 'map is { old stage key: stage of the new workflow }');
1119
+ if (body.batch != null && !(typeof body.batch === 'string' && /^[a-z0-9-]{4,60}$/.test(body.batch))) return fail(ctx, res, 400, 'batch is a short id');
1120
+ // every stage of the old workflow and where it lands (batch 20 item 3): the PM's picks, the bridge saved with the new workflow, Claude's
1121
+ // proposal. The map goes on the line, so the initiative's tasks move with their stage and none fall into "Not in a stage".
1122
+ const map = WF.mapOf(from, to, body.map || null);
1123
+ const curSt = WF.stageByRef(from, before.wfStage.key);
1124
+ let target = (curSt && map[curSt.key]) || to.stages[0].key;
1113
1125
  if (body.to != null) { const t = WF.stageByRef(to, body.to); if (!t) return fail(ctx, res, 400, `That stage is not part of ${to.name}.`); target = t.key; }
1114
1126
  const moved = { from: before.wfStage.key, to: target };
1115
1127
  // A workflow the PM saved in another workspace's library (Settings opens on the home workspace) is written into this one's first, so
1116
1128
  // this workspace's own record still reads the initiative's workflow when the other workspace is not open.
1117
1129
  if (found.ws) { const a = WS.adopt(ctx.stateDirFor(p.w), to, g.actor, found.ws.id); if (!a.ok) return fail(ctx, res, a.status || 400, a.error); }
1118
- append(p.file, g.actor, { kind: 'ini-wf', board: p.board.id, id: body.id, wf: to.id, from: from.id, moved, why: body.why ? body.why.trim() : '', ...(body.pmos === true ? { pmos: true } : {}) });
1130
+ append(p.file, g.actor, { kind: 'ini-wf', board: p.board.id, id: body.id, wf: to.id, from: from.id, moved, map, why: body.why ? body.why.trim() : '', ...(body.pmos === true ? { pmos: true } : {}),
1131
+ ...(body.batch ? { batch: body.batch } : {}), ...(body.undo === true ? { undo: true } : {}) });
1119
1132
  const f1 = foldOf(ctx, p.w), row = boardRow(p.board, b0, f1);
1120
1133
  const made = stageTasks(p.file, f1, p.board, row, g.actor.by);
1121
1134
  ctx.json(res, { ok: true, row, moved, ...(made ? { tasksMade: made } : {}) });
@@ -1741,4 +1754,4 @@ function meetingBoards(ctx) {
1741
1754
  return { list, detail };
1742
1755
  }
1743
1756
 
1744
- module.exports = { prefixes: ['/api/boards'], handle, postFrame, needRows, itemsOf, readLedger, foldOf, epicsOf, rowsOfBoard, invalidateRows: (w) => { rowsLib.invalidate(w.root); rowCache.delete(w.root); }, move, switchWorkflow, taskState, taskAdd, taskEdit, writeAs, taskDelete, taskRestore, initiativeWorkflow, seedInitiative, stageTasks, boardIndex, appendScanAsk, scanDeclineSignal, createAndPlace, ledgerFile, append, frameFor, boardIdOf, meetingBoards, boardsOf, baseRows, boardRow, taskSpanOf, workflowRowOf, foldOf, portfolio, SELF_REFUSAL, NO_STATE };
1757
+ module.exports = { prefixes: ['/api/boards'], handle, tasksOfIni, postFrame, needRows, itemsOf, readLedger, foldOf, epicsOf, rowsOfBoard, invalidateRows: (w) => { rowsLib.invalidate(w.root); rowCache.delete(w.root); }, move, switchWorkflow, taskState, taskAdd, taskEdit, writeAs, taskDelete, taskRestore, initiativeWorkflow, seedInitiative, stageTasks, boardIndex, appendScanAsk, scanDeclineSignal, createAndPlace, ledgerFile, append, frameFor, boardIdOf, meetingBoards, boardsOf, baseRows, boardRow, taskSpanOf, workflowRowOf, foldOf, portfolio, SELF_REFUSAL, NO_STATE };
@@ -57,6 +57,18 @@ const rootOf = (url, ctx) => {
57
57
  /** The PM's own calls (initiative briefing-premium-writes). Each appends one record and answers with the rebuilt model. */
58
58
  /** An initiative chat's workflow and stage (lib/initiative-chat.js infoOf), from the Board's own row (lib/routes-boards.js initiativeWorkflow):
59
59
  * the chat's workspace first, then the others (Home opens initiatives of other products too). null while the rows are being read. */
60
+ /** "grill this" (or "grill it", "grill <name>") in an initiative's chat: start Claude's grill run now and tell the chat's Claude, in one line, what
61
+ * happened, so it answers in a line and does not grill a second time in the chat. → { text, started } | null when the message is not that ask. */
62
+ const GRILL_RE = /^\s*(please\s+)?(grill|re-?grill)\b/i;
63
+ function grillAsk(ctx, key, text, wsId) {
64
+ const k = String(key || ''), q = String(text == null ? '' : text);
65
+ if (!/^init:/.test(k) || !GRILL_RE.test(q) || typeof ctx.grillStart !== 'function') return null;
66
+ const ini = k.replace(/^init:/, '').replace(/:\d+$/, '');
67
+ let r; try { r = ctx.grillStart({ ws: wsId, ini, why: 'ask', key: 'ask:' + Date.now(), detail: q.slice(0, 200) }); } catch (e) { r = { ok: false, error: String((e && e.message) || e).slice(0, 160) }; }
68
+ const note = r && r.ok ? '[PMOS] A grill run on this initiative started in the background just now. Its findings will wait under the initiative\'s ✦. Say so in one line. Do not grill it again here.'
69
+ : '[PMOS] The grill run did not start: ' + ((r && r.error) || 'no answer') + '. Say so in one line, and what would let it run.';
70
+ return { text: note + '\n\nThe PM says: ' + q, started: !!(r && r.ok) };
71
+ }
60
72
  function iniInfoOf(ctx, key, wsId) {
61
73
  const id = String(key || '').replace(/^init:/, '').replace(/:\d+$/, '');
62
74
  if (!/^init:/.test(String(key || '')) || !id) return null;
@@ -111,7 +123,9 @@ async function post(req, res, url, ctx) {
111
123
  // premium-chat-attach A5: the files a message names must be saved files of its conversation; one closing line names each for Claude
112
124
  const att = Files.pathsOf({ runtimeDir, key: b.key, names: b.files });
113
125
  if (!att.ok) { ctx.json(res, { ok: false, error: att.error }, att.status); return true; }
114
- const a = (ctx.chatSessions ? Ag.chat : Ag.ask)({ runtimeDir, key: b.key, text: Files.withFiles(b.text, att.paths), context: b.context, sessions: ctx.chatSessions, model: /^work:/.test(String(b.key || '')) ? WP.peekModel() : /^board:/.test(String(b.key || '')) ? BoardP.peekModel() : /^ins:/.test(String(b.key || '')) ? InsP.peekModel() : /^(init|doc):/.test(String(b.key || '')) ? InitP.peekModel() : sk || (/^src:/.test(String(b.key || '')) && !(b.key === 'src:this-page' && url.searchParams.get('ws'))) ? Prod.peekModel() : BP.peekModel(root), spawnSession: ctx.spawnSession, wsId, iniInfo: () => iniInfoOf(ctx, b.key, wsId) });
126
+ // batch 20 item 13: the PM can start a grill any time by asking for it in an initiative's chat; it also runs by itself
127
+ const g2 = grillAsk(ctx, b.key, b.text, wsId);
128
+ const a = (ctx.chatSessions ? Ag.chat : Ag.ask)({ runtimeDir, key: b.key, text: Files.withFiles(g2 ? g2.text : b.text, att.paths), context: b.context, sessions: ctx.chatSessions, model: /^work:/.test(String(b.key || '')) ? WP.peekModel() : /^board:/.test(String(b.key || '')) ? BoardP.peekModel() : /^ins:/.test(String(b.key || '')) ? InsP.peekModel() : /^(init|doc):/.test(String(b.key || '')) ? InitP.peekModel() : sk || (/^src:/.test(String(b.key || '')) && !(b.key === 'src:this-page' && url.searchParams.get('ws'))) ? Prod.peekModel() : BP.peekModel(root), spawnSession: ctx.spawnSession, wsId, iniInfo: () => iniInfoOf(ctx, b.key, wsId) });
115
129
  ctx.json(res, a.body, a.status);
116
130
  return true;
117
131
  }
@@ -190,7 +204,7 @@ async function chatFile(req, res, url, ctx) {
190
204
  return true;
191
205
  }
192
206
 
193
- module.exports = {
207
+ module.exports = { grillAsk,
194
208
  products,
195
209
  prefixes: ['/api/briefing-premium', '/api/chat-file'],
196
210
  handle: async (req, res, url, ctx) => {
@@ -4,6 +4,8 @@
4
4
  * POST /api/forecast/baseline { ws, goal, label, exclude: [{ from, to }] } keep a baseline: those readings leave the goal's range
5
5
  * POST /api/forecast/baseline-off { ws, goal } back to every reading
6
6
  * GET /api/forecast/turned?ws=<id>&since=<ISO time> → { ok, turned: [line] } the forecasts whose state changed
7
+ * POST /api/forecast/offer { goal: { id, series, target, byAt, unit, direction, base, type }, today } → { ok, offer | null }
8
+ * the baseline worth offering in the goal Viewer (lib/forecast-offer.js). Reads and writes nothing
7
9
  *
8
10
  * The writes are page presses (pm-guard requirePagePress); `pmos forecast` is the terminal's way. The forecasts themselves ride on
9
11
  * /api/insights-premium and /api/board-premium (lib/forecast.js). File mode only: <state>/forecast.jsonl. */
@@ -16,7 +18,7 @@ const NO_STATE = 'This repository has no PMOS state folder (pmos/state, state or
16
18
  async function handle(req, res, url, ctx) {
17
19
  const send = (status, body) => { ctx.json(res, body, status); return true; };
18
20
  const what = url.pathname.replace(/^\/api\/forecast\/?/, '');
19
- if (!['baseline', 'baseline-off', 'turned'].includes(what)) return send(404, { ok: false, error: 'no such forecast route' });
21
+ if (!['baseline', 'baseline-off', 'turned', 'offer'].includes(what)) return send(404, { ok: false, error: 'no such forecast route' });
20
22
  let body = {};
21
23
  if (what === 'turned') {
22
24
  if (req.method !== 'GET') return send(405, { ok: false, error: 'GET only' });
@@ -26,6 +28,11 @@ async function handle(req, res, url, ctx) {
26
28
  if (!read.ok) return send(400, { ok: false, error: 'the body is not JSON' });
27
29
  body = read.body || {};
28
30
  }
31
+ if (what === 'offer') {
32
+ let offer = null;
33
+ try { offer = require('./forecast-offer.js').forGoal(body.goal, text(body.today) || new Date().toISOString().slice(0, 10)); } catch { offer = null; }
34
+ return send(200, { ok: true, offer });
35
+ }
29
36
  const wsId = what === 'turned' ? url.searchParams.get('ws') : text(body.ws);
30
37
  let w = null;
31
38
  try { w = ctx.getWs(wsId || null); } catch { w = null; }
@@ -10,7 +10,7 @@
10
10
  * THE WRITERS, the same ones the rest of PMOS uses:
11
11
  * date scripts/records edit of the KR metric record: { by } Undo: { by: the day it had }
12
12
  * anchor lib/initiative-writer.js setAnchor (PM-only act 'anchor', pm-guard) Undo: restoreAnchor, the line exactly as it was
13
- * chase scripts/outbox.js draftOutbox → lib/outbox-store.js, channel jira-write Undo: the outbox entry discarded (a sent entry stays: 409)
13
+ * chase scripts/outbox.js draftOutbox → lib/outbox-store.js: channel jira-write on the epic, or team-note to the owner when there is no epic. Undo: the outbox entry discarded (a sent entry stays: 409)
14
14
  * Each ✓ and each Undo is one line of <state>/insight-moves.jsonl. With no state folder every write answers 409. Nothing is sent outward. */
15
15
  const guard = require('./pm-guard.js');
16
16
  const MV = require('./insight-moves.js');
@@ -45,13 +45,15 @@ function write(ctx, w, mv, actor) {
45
45
  return r.ok ? { undo: { from: r.from || '' } } : { error: r.error || 'The anchor could not be set.' };
46
46
  }
47
47
  if (mv.kind === 'chase') {
48
- if (!ctx.runtimeDir) return { error: 'This workspace has no outbox, so the comment could not be drafted.' };
48
+ if (!ctx.runtimeDir) return { error: 'This workspace has no outbox, so the message could not be drafted.' };
49
49
  try {
50
- const e = require(repoScript('outbox.js')).draftOutbox({ channel: 'jira-write', recipient: mv.epic, subject: 'A new date for ' + mv.ini, body: mv.body, origin: 'pm' });
50
+ const e = require(repoScript('outbox.js')).draftOutbox(mv.epic
51
+ ? { channel: 'jira-write', recipient: mv.epic, subject: 'A new date for ' + mv.ini, body: mv.body, origin: 'pm' }
52
+ : { channel: 'team-note', recipient: mv.owner, subject: 'A new date for ' + mv.ini, body: mv.body, origin: 'pm' });
51
53
  const entry = { id: 'out-' + require('crypto').randomBytes(6).toString('hex'), ...e };
52
54
  require('./outbox-store.js').appendEvent(ctx.runtimeDir, { event: 'queued', ...entry }, new Date());
53
55
  return { undo: { entry: entry.id } };
54
- } catch (x) { return { error: 'The comment could not go to the outbox: ' + String((x && x.message) || x).slice(0, 160) }; }
56
+ } catch (x) { return { error: 'The message could not go to the outbox: ' + String((x && x.message) || x).slice(0, 160) }; }
55
57
  }
56
58
  return { error: 'There is no such move.' };
57
59
  }
@@ -69,7 +71,7 @@ function unwrite(ctx, w, x, actor, req) {
69
71
  }
70
72
  if (mv.kind === 'chase') {
71
73
  const r = require('./routes-outbox.js').discard(req, { id: u.entry }, ctx.runtimeDir);
72
- return r.status === 200 ? {} : { status: r.status, error: (r.body && r.body.error) === 'a sent entry is a record and is not discarded' ? 'The comment was sent already, so it cannot be taken back.' : 'The comment could not be taken out of the outbox.' };
74
+ return r.status === 200 ? {} : { status: r.status, error: (r.body && r.body.error) === 'a sent entry is a record and is not discarded' ? 'The message was sent already, so it cannot be taken back.' : 'The message could not be taken out of the outbox.' };
73
75
  }
74
76
  return { error: 'There is no such move.' };
75
77
  }
@@ -58,7 +58,9 @@ module.exports = {
58
58
  ask('./routes-inbox.js', req, ctx, '/api/inbox'),
59
59
  ask('./routes-pm-items.js', req, ctx, '/api/pm-items'),
60
60
  ]);
61
- const out = News.build({ inbox, work: work && work.ok !== false ? work : null, seen: ctx.runtimeDir ? News.readSeen(ctx.runtimeDir) : new Set(), name: namesOf(ctx) });
61
+ let bridges = [];
62
+ try { bridges = require('./wf-bridge.js').proposals(ctx); } catch { bridges = []; } // batch 20 item 3: Claude's ✦ to move a replaced workflow's initiatives
63
+ const out = News.build({ inbox, work: work && work.ok !== false ? work : null, seen: ctx.runtimeDir ? News.readSeen(ctx.runtimeDir) : new Set(), name: namesOf(ctx), bridges });
62
64
  ctx.json(res, { ok: true, ...out });
63
65
  return true;
64
66
  },
@@ -7,12 +7,17 @@
7
7
  * POST /api/workflows/copy { ws, id, name? } → { ok, workflow }
8
8
  * POST /api/workflows/archive { ws, id, archived } → { ok } | 409 { inUse }
9
9
  * POST /api/workflows/draft { ws, draft | null, note? } → { ok, draft } (the page relays the chat's draft; the agent writes through `pmos workflow draft`)
10
+ * GET /api/workflows/proposals → { ok, items } Claude's ✦: move the initiatives of a replaced workflow (batch 20 item 3, lib/wf-bridge.js)
11
+ * POST /api/workflows/bridge { ws, id, from, map } → { ok, workflow } the bridge saved with the new workflow (WmB, Settings)
12
+ * POST /api/workflows/switch-all { ws, id, from, map?, save? } → { ok, batch, moved, tasks, failed } every initiative on `from` moves (WmB ✓)
13
+ * POST /api/workflows/switch-all/undo { ws, batch } → { ok, undone, of, kept } within 7 days (WmD)
10
14
  *
11
15
  * WHO WRITES. Every POST passes pm-guard requirePagePress and refuses an agent session header (403), as routes-premium-dashboards.js does.
12
16
  * The agent drafts and judges through lib/workflow-cli.js, which calls lib/workflows-store.js; only the PM's press saves a workflow.
13
17
  * A save that removes a stage moves the initiatives standing in it with one `move` line each in boards.jsonl, on their own board. */
14
18
  const guard = require('./pm-guard.js');
15
19
  const WS = require('./workflows-store.js');
20
+ const Bridge = require('./wf-bridge.js');
16
21
  const boards = require('./routes-boards.js');
17
22
  const { repoScript } = require('./repo-script.js');
18
23
  const WF = require(repoScript('workflows.js'));
@@ -50,6 +55,7 @@ async function handle(req, res, url, ctx) {
50
55
  if (!w) return send(bad(404, 'no such workspace'));
51
56
  const lib = WS.library(stateOf(ctx, w));
52
57
  if (p === '/api/workflows/draft') return send({ body: { ok: true, draft: lib.draft } });
58
+ if (p === '/api/workflows/proposals') return send({ body: { ok: true, items: Bridge.proposals(ctx) } });
53
59
  if (p !== '/api/workflows') return send(bad(404, 'not found'));
54
60
  const st = standingOf(ctx, w) || [];
55
61
  const counts = {};
@@ -95,6 +101,13 @@ async function handle(req, res, url, ctx) {
95
101
  const r = WS.archive(dir, body.id, body.archived, g.actor, { inUse });
96
102
  return send(r.ok ? { body: { ok: true } } : bad(r.status || 400, r.error, r.inUse ? { inUse: r.inUse } : null));
97
103
  }
104
+ if (p === '/api/workflows/bridge' || p === '/api/workflows/switch-all' || p === '/api/workflows/switch-all/undo') {
105
+ if (p !== '/api/workflows/switch-all/undo' && (typeof body.id !== 'string' || !body.id || typeof body.from !== 'string' || !body.from)) return send(bad(400, 'id (the new workflow) and from (the one it replaces) are required'));
106
+ const r = p === '/api/workflows/bridge' ? Bridge.saveBridge(ctx, w, body, g.actor) : p === '/api/workflows/switch-all' ? Bridge.switchAll(ctx, w, body, g) : Bridge.undoAll(ctx, w, body, g);
107
+ if (!r.ok) return send(bad(r.status || 400, r.error, r.pending ? { pending: true } : null));
108
+ const { ok, status, ...rest } = r;
109
+ return send({ body: { ok: true, ...rest } });
110
+ }
98
111
  if (p === '/api/workflows/draft') {
99
112
  const r = WS.saveDraft(dir, { draft: body.draft, note: body.note }, g.actor);
100
113
  return send(r.ok ? { body: { ok: true, draft: r.draft } } : bad(r.status || 400, r.error));
@@ -0,0 +1,165 @@
1
+ 'use strict';
2
+ /* wf-bridge.js — moving initiatives to a new workflow together (feedback batch 20 item 3; canvas In development WmB, WmD).
3
+ *
4
+ * The PM simplifies the workflow (for example Discovery, Implementation, Evaluation in place of Product feature's eight stages). The BRIDGE
5
+ * says where each old stage lands; it is saved with the new workflow (scripts/workflows.js `bridge`), so it is set once and every later switch
6
+ * from the old workflow uses it. Claude proposes it once, as a ✦ in New for you; the PM only approves.
7
+ *
8
+ * proposals(ctx) → [item] the ✦: a workflow that replaces another (its bridge, or it began as a copy of it) while
9
+ * initiatives still run the old one. One per workflow; New for you shows it once.
10
+ * saveBridge(ctx, w, { id, from, map }, actor) → { ok, workflow } | { ok:false, status, error }
11
+ * switchAll(ctx, w, body, g) → { ok, batch, moved, tasks, failed } every initiative on `from` switches, one batch id
12
+ * undoAll(ctx, w, body, g) → { ok, undone, of, kept } within 7 days; an initiative that moved since stays where it is
13
+ *
14
+ * Every switch is POST /api/boards/ini-wf's own function (routes-boards switchWorkflow), so each initiative gets the route's line, its stage map
15
+ * (its tasks move with their stage) and its To finish tasks. Nothing is deleted: Undo writes the way back. */
16
+ const crypto = require('crypto');
17
+ const WS = require('./workflows-store.js');
18
+ const { repoScript } = require('./repo-script.js');
19
+ const WF = require(repoScript('workflows.js'));
20
+
21
+ const UNDO_MS = 7 * 864e5;
22
+ const isObj = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
23
+ const boards = () => require('./routes-boards.js');
24
+
25
+ /** Every open workspace: the home one first, then the products, each once. */
26
+ function workspaces(ctx) {
27
+ const home = ctx.getWs ? ctx.getWs(null) : null;
28
+ return [home, ...(ctx.workspaceList ? ctx.workspaceList() : [])].filter((x, i, a) => x && a.findIndex((y) => y && y.id === x.id) === i);
29
+ }
30
+
31
+ /** Every initiative of one workspace with its board, workflow, stage key and its tasks' places. null while its rows are being read. */
32
+ function standing(ctx, w) {
33
+ const B = boards();
34
+ const got = B.baseRows(w);
35
+ if (!got || !got.ok) return null;
36
+ let fr;
37
+ try { fr = B.frameFor(ctx, w); } catch { return null; }
38
+ const SEC = (fr.folded && fr.folded.sections) || new Map();
39
+ const out = [];
40
+ for (const b of fr.boards) {
41
+ for (const r of got.rows) {
42
+ if (B.boardIdOf(r, fr.boards, fr.folded, w) !== b.id) continue;
43
+ let row; try { row = B.boardRow(b, r, fr.folded); } catch { continue; }
44
+ const tasks = B.tasksOfIni(fr.folded, r.id).filter((t) => t && t.initiative === r.id && t.state !== 'Archived')
45
+ .map((t) => (SEC.has(t.id) ? SEC.get(t.id) || '' : (t.from && t.from.stage) || ''));
46
+ out.push({ w, id: r.id, title: r.title, board: b.id, self: !!b.self, wf: row.wf.id, stage: row.wfStage.key, ended: !!row.ended, tasks, own: fr.folded.iniWf ? fr.folded.iniWf.get(b.id + '\u0000' + r.id) || null : null });
47
+ }
48
+ }
49
+ return out;
50
+ }
51
+ const movable = (x, from) => x.wf === from && !x.ended && !x.self;
52
+
53
+ /** The workflow a new one replaces: its saved bridge's, else the one it began as a copy of, when that one has a stage the new one dropped. */
54
+ function replacesOf(lib, wf) {
55
+ if (!wf || wf.builtin || wf.archived) return null;
56
+ const fromId = (wf.bridge && wf.bridge.from) || wf.copiedFrom || null;
57
+ if (!fromId || fromId === wf.id) return null;
58
+ const from = WF.resolve(lib, fromId);
59
+ if (!from || from.id !== fromId) return null;
60
+ const keys = new Set(wf.stages.map((s) => s.key));
61
+ if (!wf.bridge && from.stages.every((s) => keys.has(s.key))) return null; // a plain copy that keeps every stage replaces nothing
62
+ return from;
63
+ }
64
+
65
+ /** The ✦ (WmB): "Move 12 initiatives to the 3-stage workflow", each new stage with the old ones that go into it and how many initiatives and
66
+ * tasks land there. Read from the home workspace's library; the initiatives from every open workspace. */
67
+ function proposals(ctx) {
68
+ const home = ctx.getWs ? ctx.getWs(null) : null;
69
+ const dir = home && ctx.stateDirFor ? ctx.stateDirFor(home) : null;
70
+ if (!dir) return [];
71
+ const lib = WS.library(dir);
72
+ const all = [];
73
+ for (const w of workspaces(ctx)) { const st = standing(ctx, w); if (st) all.push(...st); }
74
+ const out = [];
75
+ for (const wf of lib.byId.values()) {
76
+ const from = replacesOf(lib, wf);
77
+ if (!from) continue;
78
+ const mine = all.filter((x) => movable(x, from.id));
79
+ if (!mine.length) continue;
80
+ const map = WF.mapOf(from, wf);
81
+ const groups = wf.stages.map((t) => ({ key: t.key, name: t.name, from: from.stages.filter((s) => map[s.key] === t.key).map((s) => s.name), inis: 0, tasks: 0 }));
82
+ const g = (k) => groups.find((x) => x.key === k);
83
+ for (const x of mine) {
84
+ const cur = WF.stageByRef(from, x.stage); const to = g((cur && map[cur.key]) || wf.stages[0].key); if (to) to.inis++;
85
+ for (const sec of x.tasks) { const s = WF.stageByRef(from, sec); const tg = s ? g(map[s.key]) : null; if (tg) tg.tasks++; }
86
+ }
87
+ out.push({ id: 'prop:wf-bridge:' + wf.id + ':' + from.id, kind: 'wf-bridge', title: 'Move ' + mine.length + (mine.length === 1 ? ' initiative' : ' initiatives') + ' to ' + wf.name,
88
+ ws: home.id, wf: { id: wf.id, name: wf.name, icon: wf.icon }, from: { id: from.id, name: from.name }, n: mine.length,
89
+ saved: !!(wf.bridge && wf.bridge.from === from.id), map, groups: groups.filter((x) => x.from.length || x.inis || x.tasks), at: wf.at ? Date.parse(wf.at) || null : null });
90
+ }
91
+ return out;
92
+ }
93
+
94
+ /** The bridge saved with the new workflow (WmB, right: Settings › Workflows). map: { old stage key: stage key or name of the new workflow }. */
95
+ function saveBridge(ctx, w, { id, from, map } = {}, actor) {
96
+ const dir = ctx.stateDirFor ? ctx.stateDirFor(w) : null;
97
+ if (!dir) return { ok: false, status: 409, error: 'This workspace has no state folder yet, so the bridge cannot be saved.' };
98
+ const lib = WS.library(dir);
99
+ const wf = lib.byId.get(id);
100
+ if (!wf) return { ok: false, status: 404, error: 'That workflow could not be found. It may have been removed.' };
101
+ if (wf.builtin) return { ok: false, status: 409, error: 'Product feature is built in. Its stages stay as they are.' };
102
+ const src = WF.resolve(lib, from);
103
+ if (!src || src.id !== from) return { ok: false, status: 404, error: 'The workflow it replaces could not be found.' };
104
+ if (!isObj(map)) return { ok: false, status: 400, error: 'map is { old stage key: stage of the new workflow }' };
105
+ const full = WF.mapOf(src, wf, map);
106
+ const { count, at, copiedFrom, archived, ...plain } = wf;
107
+ return WS.save(dir, { wf: { ...plain, bridge: { from, map: full } } }, actor, { standing: [] });
108
+ }
109
+
110
+ /** Every initiative on `from` switches to `id` with one batch id (WmB ✓). body: { id, from, map?, save? } — save (default true) keeps the map as
111
+ * the bridge. Answers how many initiatives and tasks moved, and the batch Undo names. */
112
+ function switchAll(ctx, w, body, g) {
113
+ const dir = ctx.stateDirFor ? ctx.stateDirFor(w) : null;
114
+ if (!dir) return { ok: false, status: 409, error: 'This workspace has no state folder yet.' };
115
+ const lib = WS.library(dir);
116
+ const to = lib.byId.get(body.id);
117
+ if (!to) return { ok: false, status: 404, error: 'That workflow could not be found. It may have been removed.' };
118
+ if (to.archived) return { ok: false, status: 409, error: `${to.name} is archived. Bring it back first.` };
119
+ const from = WF.resolve(lib, body.from);
120
+ if (!from || from.id !== body.from) return { ok: false, status: 404, error: 'The workflow it replaces could not be found.' };
121
+ if (from.id === to.id) return { ok: false, status: 400, error: 'Pick another workflow to move to.' };
122
+ if (body.map != null && !isObj(body.map)) return { ok: false, status: 400, error: 'map is { old stage key: stage of the new workflow }' };
123
+ let target = to;
124
+ if (body.save !== false) {
125
+ const s = saveBridge(ctx, w, { id: to.id, from: from.id, map: body.map || {} }, g.actor);
126
+ if (!s.ok) return s;
127
+ target = s.workflow;
128
+ }
129
+ const map = WF.mapOf(from, target, body.map || null);
130
+ const all = [];
131
+ for (const x of workspaces(ctx)) { const st = standing(ctx, x); if (st === null) return { ok: false, status: 202, error: 'The initiatives are still being read. Try again in a moment.', pending: true }; all.push(...st); }
132
+ const batch = 'wfb-' + crypto.randomBytes(5).toString('hex');
133
+ let moved = 0, tasks = 0;
134
+ const failed = [];
135
+ for (const x of all.filter((y) => movable(y, from.id))) {
136
+ const r = boards().switchWorkflow(ctx, { ws: x.w.id, board: x.board, id: x.id, wf: target.id, map, batch, why: 'moved with ' + from.name + ' to ' + target.name + ' (approved ✦)' }, g);
137
+ if (r.status === 200 && r.body && r.body.ok) { moved++; tasks += x.tasks.length; } else failed.push({ id: x.id, title: x.title, error: (r.body && r.body.error) || 'not moved' });
138
+ }
139
+ return { ok: true, batch, moved, tasks, failed, workflow: { id: target.id, name: target.name }, from: { id: from.id, name: from.name } };
140
+ }
141
+
142
+ /** Undo a batch (WmD): within 7 days, every initiative of the batch that still stands where the switch put it goes back to its old workflow
143
+ * and stage; its tasks go back with the map from before. One that moved since stays where it is, and the answer says so ("11 of 12 undone"). */
144
+ function undoAll(ctx, w, body, g) {
145
+ if (typeof body.batch !== 'string' || !/^wfb-[a-f0-9]{10}$/.test(body.batch)) return { ok: false, status: 400, error: 'batch names the move to undo' };
146
+ let of = 0, undone = 0;
147
+ const kept = [];
148
+ for (const x of workspaces(ctx)) {
149
+ const st = standing(ctx, x);
150
+ if (st === null) return { ok: false, status: 202, error: 'The initiatives are still being read. Try again in a moment.', pending: true };
151
+ for (const y of st) {
152
+ const own = y.own;
153
+ if (!own || own.batch !== body.batch || own.undo) continue;
154
+ of++;
155
+ if (!own.at || Date.now() - Date.parse(own.at) > UNDO_MS) { kept.push({ id: y.id, title: y.title, why: 'more than 7 days ago' }); continue; }
156
+ if (y.wf !== own.wf || (own.landed && y.stage !== own.landed)) { kept.push({ id: y.id, title: y.title, why: 'moved since' }); continue; }
157
+ const r = boards().switchWorkflow(ctx, { ws: x.id, board: y.board, id: y.id, wf: own.from || WF.PRODUCT_FEATURE_ID, ...(own.left ? { to: own.left } : {}), undo: true, why: 'undo of the move to the new workflow' }, g);
158
+ if (r.status === 200 && r.body && r.body.ok) undone++; else kept.push({ id: y.id, title: y.title, why: (r.body && r.body.error) || 'not undone' });
159
+ }
160
+ }
161
+ if (!of) return { ok: false, status: 404, error: 'That move could not be found.' };
162
+ return { ok: true, undone, of, kept };
163
+ }
164
+
165
+ module.exports = { proposals, saveBridge, switchAll, undoAll, standing, replacesOf, UNDO_MS };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.476.0",
3
+ "version": "0.478.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.476.0",
9
+ "version": "0.478.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.476.0",
3
+ "version": "0.478.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",
@@ -177,8 +177,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
177
177
  // a third row: it replaces the Viewer used least recently (v0, as v1 was used last)
178
178
  await A.page.click('#czViewer2 .cz-vw-hd', { position: { x: 30, y: 20 } });
179
179
  await A.page.evaluate(() => window.czPanels.putAway());
180
- await A.page.click('[data-cz-vw-rail="show"]'); // two Viewers fold the list to a rail; its list button brings the rows back
181
- await until(() => lay(A.page).then((l) => (!l.rail ? l : null)), 3000);
180
+ ok('N6 two Viewers leave the list as it was: only its own fold folds it (batch 20 item 6)', !(await lay(A.page)).rail);
182
181
  const v1r = (await lay(A.page)).panels.find((p) => p.id === 'v1').box;
183
182
  await drag(A.page, `#hmList .hm-rm[data-hm-sel="${R[2]}"]`, v1r.r - 60, 450);
184
183
  const l6c = await until(() => lay(A.page).then((l) => { const t = l.panels.filter((p) => p.kind === 'viewer' && p.box.shown); return t.length === 2 && t.some((p) => p.title !== t6[0] && p.title !== t6[1]) ? l : null; }), 6000);
@@ -0,0 +1,45 @@
1
+ /* pm/bd-fc-card.js — the forecast card on the Board timeline (build brief Grill and Forecast, UI-B Board; canvas FcBoard "Tap the hatched part").
2
+ * A press on a row's hatched range (`[data-fc-pick]`, drawn by pm/bd-span.js) opens a small card under it, never a panel: the range in one
3
+ * line, one line on why it is that wide, and the blue ✦ that opens what Claude proposes on the initiative (pm/ini-props.js, where the Grill's
4
+ * findings go). The ✦ shows only when there is something to open (zero is silence).
5
+ * init(api): api = { rowOf(key), openFindings(r, from) }. */
6
+ import { esc } from './premium-shell.js';
7
+ import * as Pop from './bd-pop.js';
8
+ import { fcRange, md } from './bd-span.js';
9
+
10
+ const SPARK = '<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3l1.8 4.7L18.5 9.5l-4.7 1.8L12 16l-1.8-4.7L5.5 9.5l4.7-1.8z"/></svg>';
11
+ let A = null, curKey = null;
12
+ export function init(api) { A = api; }
13
+
14
+ /** The card's words for row r: { head, why, n } | null. Pure, so a test reads it without a page. */
15
+ export function cardWords(r) {
16
+ const fr = fcRange(r); if (!fr) return null;
17
+ const F = r.forecast, range = +fr.low !== +fr.high ? md(fr.low) + ' to ' + md(fr.high) : md(fr.high);
18
+ const head = fr.tone === 'held' ? 'The forecast for ' + r.title + ' is held at ' + range + '.' : r.title + ' will land ' + range + '.';
19
+ const open = F.total > 0 && F.done != null ? F.total - F.done : null;
20
+ const why = fr.tone === 'held' ? F.why || 'Jira has not been read for over a week, so the range is held where it was.'
21
+ : open != null ? 'Jira shows ' + open + ' of ' + F.total + ' tickets open' + (F.promised ? ', and the promise is ' + md(new Date(+F.promised.slice(0, 4), +F.promised.slice(5, 7) - 1, +F.promised.slice(8, 10))) : '') + '.'
22
+ : F.why || '';
23
+ const n = r.props && r.props.n > 0 ? r.props.n : 0;
24
+ return { head, why, n };
25
+ }
26
+
27
+ function cardHtml(r) {
28
+ const w = cardWords(r); if (!w) return '';
29
+ const go = w.n ? `<div class="bd-fc-go"><button type="button" class="bd-fc-sp" data-fc-props aria-label="${esc('See what Claude proposes: ' + w.n)}" title="What Claude proposes">${SPARK}</button></div>` : '';
30
+ return `<p class="bd-pc-h">${esc(w.head)}</p>${w.why ? `<p class="bd-amut bd-pc-sub">${esc(w.why)}</p>` : ''}${go}`;
31
+ }
32
+
33
+ export function openCard(btn, key) {
34
+ const r = A && A.rowOf(key); if (!r) return;
35
+ const html = cardHtml(r); if (!html) return;
36
+ curKey = key;
37
+ Pop.open(html, btn, { label: 'Forecast of ' + r.title, width: 300, cls: 'bd-pc bd-fc', focus: '[data-fc-props]', onClose: () => { curKey = null; } });
38
+ }
39
+
40
+ document.addEventListener('click', (e) => {
41
+ if (!A) return;
42
+ const pk = e.target.closest('[data-fc-pick]'); if (pk) { e.preventDefault(); openCard(pk, pk.dataset.fcPick); return; }
43
+ const go = e.target.closest('[data-fc-props]');
44
+ if (go && Pop.isOpen() && Pop.el().contains(go) && curKey) { const r = A.rowOf(curKey); Pop.close(false); if (r) A.openFindings(r, null); }
45
+ });
@@ -65,7 +65,7 @@ export function nextOf(r, ctx = {}) {
65
65
  // another workflow: the first open task of its stage, by order
66
66
  if (r.wf && r.wf.id && r.wf.id !== PF && r.wfStage) {
67
67
  const st = r.wfStage, list = r.wfStages || [st];
68
- const mine = (r.tasks || []).filter((k) => sectionOf(k, list) === st.key && k.status !== 'Archived')
68
+ const mine = (r.tasks || []).filter((k) => sectionOf(k, list, r.wfMap) === st.key && k.status !== 'Archived')
69
69
  .map((k, i) => ({ k, i })).sort((a, b) => (Number.isFinite(a.k.order) ? a.k.order : 1e9 + a.i) - (Number.isFinite(b.k.order) ? b.k.order : 1e9 + b.i)).map((x) => x.k);
70
70
  const counted = mine.filter((k) => k.status !== "Won't do"), done = counted.filter((k) => k.status === 'Done').length;
71
71
  if (!mine.length) return { verb: 'Add what finishes', obj: st.name, act: { kind: 'add', label: 'Add a task to ' + st.name, stage: st.key } };
@@ -1,6 +1,22 @@
1
- /* pm/bd-publish.css — the Publish popover (pm/bd-publish.js). It looks like the viewer's share popover (premium-vw-doc.css .vwshp): the same card, rows,
2
- * switch, segmented control and Open links list. A bottom sheet on a phone. Design: prototype/board-publish/publish-popover-design.html. */
3
- .bppop{position:absolute;right:0;top:calc(100% + 6px);z-index:30;width:360px;max-width:min(360px,calc(100vw - 32px));max-height:min(80vh,640px);overflow:auto;padding:8px;border-radius:12px;background:var(--card-solid);border:1px solid var(--hair);box-shadow:0 10px 30px rgb(0 0 0 / .14);color:var(--ink);font:inherit;text-align:left}
1
+ /* pm/bd-publish.css — the Publish popover (pm/bd-publish.js). Design: batch 20 item 2, SbPublish: a card under the share icon with a caret to it,
2
+ * icon-only buttons, one row to the Shared tab. A bottom sheet on a phone. pm/bd-publish.js places it (position: fixed, from the icon's box). */
3
+ .bppop{--card-solid:var(--cz-card);--hair:var(--cz-hair);--ink:var(--cz-ink);--ink-2:var(--cz-ink2);--ink-3:var(--cz-ink3);--solid:var(--cz-blueink);--on-solid:var(--cz-card);--bad:var(--cz-red);--mono:var(--cz-mono);--ember:var(--cz-blue);position:fixed;left:16px;top:64px;z-index:60;width:380px;max-width:calc(100vw - 32px);border-radius:20px;background:var(--card-solid);border:1px solid var(--hair);box-shadow:0 14px 40px rgb(20 24 40 / .14);color:var(--ink);font:inherit;text-align:left}
4
+ .bppop .bpbody{max-height:min(80vh,640px);overflow:auto;padding:10px 8px}
5
+ .bppop .bpcaret{position:absolute;top:-8px;left:var(--bp-caret,330px);width:14px;height:14px;background:var(--card-solid);border-left:1px solid var(--hair);border-top:1px solid var(--hair);transform:rotate(45deg)}
6
+ .bppop .bpib{width:36px;height:36px;border-radius:999px;border:1px solid var(--hair);background:var(--card-solid);color:var(--ink-2);display:inline-flex;align-items:center;justify-content:center;padding:0;flex:none;cursor:pointer;font:inherit}
7
+ .bppop .bpib .i{width:18px;height:18px;color:inherit}
8
+ .bppop .bpib.gh{background:transparent;border-color:transparent}.bppop .bpib:hover{background:color-mix(in srgb,var(--ink) 6%,transparent)}
9
+ .bppop .bpib.pri{background:var(--solid);border-color:var(--solid);color:var(--on-solid)}
10
+ .bppop .bpib.sm,.bppop .bpib.xs{width:34px;height:34px}.bppop .bpib.xs .i{width:14px;height:14px}
11
+ .bppop .bpib.big{width:48px;height:48px}.bppop .bpib.big .i{width:20px;height:20px}
12
+ .bppop .bpib:disabled{opacity:.55;cursor:default}
13
+ .bppop .bphead{display:flex;align-items:center;gap:10px;padding:4px 8px 10px}.bppop .bphead b{display:block;font-weight:800}.bppop .bphead em{font-style:normal;color:var(--ink-3);font-size:12px}
14
+ .bppop .bptile{width:36px;height:36px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--cz-risk) 14%,transparent);flex:none}.bppop .bptile .i{color:var(--cz-risk)}
15
+ .bppop .bpfoot{display:flex;align-items:center;gap:8px;padding:8px 8px 4px}
16
+ .bppop .bphost{display:flex;align-items:center;gap:6px;min-width:0;padding:0}.bppop .bphn{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
17
+ .bppop .bpoff{color:var(--ink-3)}
18
+ .bppop .bpshared{display:flex;align-items:center;gap:8px;width:calc(100% - 16px);min-height:44px;margin:10px 8px 0;padding:0 2px;border:0;border-top:1px solid var(--hair);background:transparent;color:var(--ink-2);font:inherit;text-align:left;cursor:pointer}
19
+ .bppop .bpshared:hover{color:var(--ink)}
4
20
  .bppop .i{width:16px;height:16px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;color:var(--ink-3)}
5
21
  .bppop .bpeye{font:500 11px var(--mono);letter-spacing:.08em;text-transform:uppercase;color:var(--ink-3);padding:8px 8px 2px}
6
22
  .bppop .bpchips{display:flex;flex-wrap:wrap;gap:6px;padding:2px 8px 6px}
@@ -14,7 +30,8 @@
14
30
  .bppop .bpfield{display:grid;gap:2px;padding:2px 8px}.bppop .bpfield>label{font-size:12px;color:var(--ink-3)}
15
31
  .bppop .bpinp,.bppop .bpinp2{min-height:40px;border:1px solid var(--hair);border-radius:8px;background:var(--card-solid);color:inherit;font:inherit}
16
32
  .bppop .bpinp{padding:0 12px;width:100%}
17
- .bppop .bpinp2{display:flex;align-items:center;gap:8px;padding:0 6px 0 12px}.bppop .bpinp2 input{flex:1;min-width:0;border:0;background:transparent;color:inherit;font:500 12px var(--mono);outline:0;min-height:38px}
33
+ .bppop .bpinp2{display:flex;align-items:center;gap:8px;padding:0 4px 0 12px;min-height:44px;border-radius:22px}.bppop .bpinp2 input{flex:1;min-width:0;border:0;background:transparent;color:inherit;font:inherit;outline:0;min-height:40px}.bppop .bpinp2 #bpPass{font:700 14px var(--mono)}
34
+ .bppop .bpfield{padding:3px 8px}
18
35
  .bppop .bpline2{display:flex;align-items:center;gap:10px;min-height:40px;padding:2px 8px}.bppop .bpg{flex:1;min-width:0}
19
36
  .bppop .bpsw{width:48px;height:40px;border:0;background:transparent;position:relative;cursor:pointer;flex:none;padding:0}
20
37
  .bppop .bpsw::before{content:"";position:absolute;left:6px;top:9px;width:36px;height:22px;border-radius:99px;background:var(--hair)}
@@ -23,23 +40,10 @@
23
40
  .bppop .bpseg{display:inline-flex;border:1px solid var(--hair);border-radius:8px;overflow:hidden}
24
41
  .bppop .bpseg button{border:0;background:transparent;color:var(--ink-2);min-height:36px;padding:0 12px;font:inherit;cursor:pointer}
25
42
  .bppop .bpseg button[aria-pressed="true"]{background:color-mix(in srgb, var(--ink) 6%, transparent);color:inherit;font-weight:600}
26
- .bppop .bpbtn{display:inline-flex;align-items:center;justify-content:center;min-height:40px;padding:0 14px;border-radius:8px;border:1px solid var(--hair);background:var(--card-solid);color:inherit;font:600 14px inherit;font-family:inherit;cursor:pointer;text-decoration:none}
27
- .bppop .bpbtn.pri{background:var(--solid);border-color:var(--solid);color:var(--on-solid)}
28
- .bppop .bpbtn.sm{min-height:34px;padding:0 10px;font-size:12px}
29
- .bppop .bpbtn.bad{color:var(--bad)}.bppop .bpbtn.bad.sure{background:color-mix(in srgb,var(--bad) 12%,transparent)}
30
- .bppop .bpbtn:disabled{opacity:.55;cursor:default}
31
- .bppop .bpgo{margin:6px 8px 2px;width:calc(100% - 16px)}
32
43
  .bppop .bpnote{color:var(--ink-3);font-size:12px;padding:4px 8px;margin:0}
33
44
  .bppop .bperr{margin:4px 8px;padding:8px 10px;border-radius:8px;background:color-mix(in srgb,var(--bad) 12%,transparent);color:var(--bad);font-size:14px}
34
- .bppop .bplink{display:inline-flex;align-items:center;border:0;background:transparent;color:var(--solid);font:inherit;text-decoration:underline;cursor:pointer;padding:0 8px;min-height:36px}
35
- .bppop .bpsep{height:1px;background:var(--hair);margin:8px 0 2px}
36
45
  .bppop .bplnk{margin:2px 8px;padding:10px 12px;border-radius:8px;background:color-mix(in srgb, var(--ink) 6%, transparent);display:grid;gap:8px}
37
46
  .bppop .bpline{display:flex;align-items:center;gap:8px}.bppop .bplnk code{font:500 12px var(--mono);overflow-wrap:anywhere}
38
- .bppop .bpact{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.bppop .bpok{color:var(--ink-2);font-size:14px}
39
- .bppop .bprow{display:flex;align-items:center;gap:8px;padding:6px 8px}.bppop .bprow .bpg b{display:block;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
40
- .bppop .bprow em{font-style:normal;color:var(--ink-3);font-size:12px}.bppop .bprow em.soon{color:var(--bad)}
41
- .bppop .bpempty{display:grid;gap:10px;padding:12px 8px 10px;justify-items:start}.bppop .bpempty p{margin:0;color:var(--ink-2)}
42
47
  .bppop :focus-visible{outline:2px solid var(--ember);outline-offset:2px}
43
- .bd-tools:has(.bppop){position:relative}
44
48
  #bdPublish{position:relative}#bdPublish .bpn{position:absolute;top:2px;right:0;min-width:16px;padding:0 5px;border-radius:99px;background:var(--solid);color:var(--on-solid);font:600 11px var(--mono);text-align:center;line-height:16px}
45
- @media (max-width:640px){.bppop{position:fixed;left:0;right:0;bottom:0;top:auto;width:auto;max-width:none;max-height:85vh;border-radius:16px 16px 0 0;border-width:1px 0 0;padding:12px 12px calc(18px + env(safe-area-inset-bottom,0px));box-shadow:0 -8px 30px rgb(0 0 0 / .18)}}
49
+ @media (max-width:640px){.bppop{left:0 !important;right:0;bottom:0;top:auto !important;width:auto;max-width:none;border-radius:16px 16px 0 0;border-width:1px 0 0;box-shadow:0 -8px 30px rgb(0 0 0 / .18)}.bppop .bpbody{max-height:85vh;padding:12px 12px calc(18px + env(safe-area-inset-bottom,0px))}.bppop .bpcaret{display:none}}