create-pmos 0.598.0 → 0.600.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +27 -27
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/scripts/pmos-memory.js +42 -16
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +26 -0
- package/workspace/guide/cli.md +9 -0
- package/workspace/guide/layout.md +10 -3
- package/workspace/lib/bg-queue.js +1 -0
- package/workspace/lib/briefing-premium-agent.js +12 -5
- package/workspace/lib/corrections-memory.js +9 -5
- package/workspace/lib/cos-chat.js +15 -1
- package/workspace/lib/driver.js +4 -1
- package/workspace/lib/engine/pmos-memory.js +42 -16
- package/workspace/lib/goal-loop.js +2 -1
- package/workspace/lib/headless.js +7 -3
- package/workspace/lib/initiative-premium.js +2 -2
- package/workspace/lib/job-graph.js +4 -0
- package/workspace/lib/owner-cli.js +30 -0
- package/workspace/lib/pmos-verbs.js +5 -0
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-briefing-premium.js +3 -1
- package/workspace/lib/routes-home-desk.js +13 -1
- package/workspace/lib/routes-initiative-premium.js +11 -1
- package/workspace/lib/routes-proposals.js +1 -1
- package/workspace/lib/routes-units.js +52 -0
- package/workspace/lib/team-cli.js +16 -1
- package/workspace/lib/team-runs.js +5 -2
- package/workspace/lib/unit-memory.js +65 -0
- package/workspace/lib/unit-owner.js +185 -0
- package/workspace/lib/units-cli.js +45 -0
- package/workspace/lib/units-host.js +151 -0
- package/workspace/lib/units.js +88 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-home.css +76 -0
- package/workspace/public/pm/cozy-live-pill.js +4 -0
- package/workspace/public/pm/cozy-nav.js +26 -6
- package/workspace/public/pm/cozy-today.css +3 -0
- package/workspace/public/pm/home-app.js +60 -2
- package/workspace/public/pm/home-chat.js +17 -2
- package/workspace/public/pm/home-list.js +14 -2
- package/workspace/public/pm/home-today.js +7 -4
- package/workspace/public/pm/phone-chat-head.js +147 -0
- package/workspace/server.js +26 -1
- package/workspace/test-files.json +1 -0
- package/workspace/test-lists/roomier-phone-chat.json +9 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* unit-owner.js — the owner of a Program, Product or Project: a RECORD with a daily tick, never a session (chief-unit-owners ✦2;
|
|
3
|
+
* grill doc GCFCo233wHawPk7Ypjba4J "Improved plan", agreed by Wawan 2026-11-18 "Build now").
|
|
4
|
+
*
|
|
5
|
+
* Which unit owns an initiative is lib/units.js. This file is what the owner keeps and how it reports up: one brief a day, which the chief
|
|
6
|
+
* (Home's chat, lib/cos-chat.js) reads in its opening and Home shows as one quiet line on the unit's group. Reporting up is that one thing.
|
|
7
|
+
*
|
|
8
|
+
* LEDGER = 'units.jsonl' in the home workspace's state folder. Append-only; THIS FILE IS ITS ONE WRITER.
|
|
9
|
+
* append(dir, line, now?) · read(dir) → [line]
|
|
10
|
+
* fold(lines) → Map(unit key → { key, plan: [ini], lessons: [{ text, sources, at }], briefs: [brief] }) briefs oldest first
|
|
11
|
+
* eventsFor(unit, { team, driver, loops }, since) → { events: [{ ini, state: 'done'|'failed', what, why, at }], forYou } PURE
|
|
12
|
+
* team: [{ ws, lines }] team.jsonl lines (lib/team-runs.js): a role run's step that ended done or failed
|
|
13
|
+
* driver: [{ ws, state }] lib/driver.js fold(): a Driver run that ended, and the open proposals that wait on the PM (forYou)
|
|
14
|
+
* loops: [{ ws, lines }] goal-loops.jsonl lines (lib/goal-loop.js): a round that ended, counted on the goal's product
|
|
15
|
+
* briefOf({ events, forYou, plan }) → { done, forYou, failed: [{ ini, why }], items: [{ ini, what }], next } PURE
|
|
16
|
+
* tick(dir, { units, gather, rankedOf?, promote?, now?, only?, force? }) → { wrote: [key], skipped: [key] }
|
|
17
|
+
* units: lib/units.js list(). gather(unit, sinceIso) → eventsFor's result. rankedOf(unit) → [ini] in Roadmap order (D105).
|
|
18
|
+
* promote(unit) → [{ text, sources }] lessons to note (✦4, lib/unit-memory.js). Once a day per unit; `only` + `force` is the chief's
|
|
19
|
+
* "run it now" (`pmos owner brief <unit>`). A restart mid-tick resumes: a unit that has today's brief is skipped, so no brief doubles.
|
|
20
|
+
* lineOf(brief) → '3 done · 1 for you' | '' zero is silence (design principles): no brief, or nothing done and nothing for you, says nothing
|
|
21
|
+
* latest(F) → { [key]: { line, day, at, done, forYou, failed, next } } the newest brief of every unit (Home and the chief)
|
|
22
|
+
* openingLines(F, units, { cap }) → [string] the chief's opening: one line per unit with a brief, newest first
|
|
23
|
+
*
|
|
24
|
+
* THE LINES (append-only, { at, kind, unit, … }):
|
|
25
|
+
* plan { unit, ranked: [ini] } the unit's initiatives in Roadmap order (derived at each tick; written only when it changed)
|
|
26
|
+
* lesson { unit, text, sources: [ini] } a lesson seen on two of the unit's initiatives (✦4); its notebook
|
|
27
|
+
* brief { unit, day, since, done, forYou, failed: [{ ini, why }], items: [{ ini, what }], next }
|
|
28
|
+
*
|
|
29
|
+
* A FAILED RUN IS NOT THE PM'S WORK (R4). It counts under done with its reason; `forYou` is only what waits on the PM's ✓ (open proposals).
|
|
30
|
+
* The tick reads ledgers and writes this ledger: no model, no session, nothing that merges, sends or touches a control-graph record (D65).
|
|
31
|
+
*/
|
|
32
|
+
const fs = require('fs');
|
|
33
|
+
const path = require('path');
|
|
34
|
+
|
|
35
|
+
const LEDGER = 'units.jsonl';
|
|
36
|
+
const KINDS = Object.freeze(['plan', 'lesson', 'brief']);
|
|
37
|
+
const DAY = 86400000;
|
|
38
|
+
const one = (s, n) => String(s == null ? '' : s).replace(/\s+/g, ' ').trim().slice(0, n);
|
|
39
|
+
const file = (dir) => path.join(dir, LEDGER);
|
|
40
|
+
|
|
41
|
+
function localDay(ms) {
|
|
42
|
+
const d = new Date(ms), p = (n) => String(n).padStart(2, '0');
|
|
43
|
+
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())}`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function append(dir, line, now = Date.now()) {
|
|
47
|
+
if (!dir) throw new Error('unit-owner: no state folder');
|
|
48
|
+
if (!line || !KINDS.includes(line.kind) || !line.unit) throw new Error('unit-owner: a line needs a kind and a unit');
|
|
49
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
50
|
+
const l = { at: new Date(now).toISOString(), ...line };
|
|
51
|
+
fs.appendFileSync(file(dir), JSON.stringify(l) + '\n');
|
|
52
|
+
return l;
|
|
53
|
+
}
|
|
54
|
+
function read(dir) {
|
|
55
|
+
let text = '';
|
|
56
|
+
try { text = fs.readFileSync(file(dir), 'utf8'); } catch { return []; }
|
|
57
|
+
const out = [];
|
|
58
|
+
for (const raw of text.split('\n')) { if (!raw.trim()) continue; try { const l = JSON.parse(raw); if (l && KINDS.includes(l.kind) && l.unit) out.push(l); } catch { /* a torn line */ } }
|
|
59
|
+
return out;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function fold(lines) {
|
|
63
|
+
const F = new Map();
|
|
64
|
+
const get = (key) => F.get(key) || F.set(key, { key, plan: [], lessons: [], briefs: [] }).get(key);
|
|
65
|
+
for (const l of lines || []) {
|
|
66
|
+
const u = get(String(l.unit));
|
|
67
|
+
if (l.kind === 'plan' && Array.isArray(l.ranked)) u.plan = l.ranked.map(String);
|
|
68
|
+
else if (l.kind === 'lesson' && l.text) { if (!u.lessons.some((x) => x.text === l.text)) u.lessons.push({ text: String(l.text), sources: Array.isArray(l.sources) ? l.sources : [], at: l.at }); }
|
|
69
|
+
else if (l.kind === 'brief' && l.day) u.briefs.push({ day: l.day, at: l.at, since: l.since || null, done: +l.done || 0, forYou: +l.forYou || 0,
|
|
70
|
+
failed: Array.isArray(l.failed) ? l.failed : [], items: Array.isArray(l.items) ? l.items : [], next: l.next || '' });
|
|
71
|
+
}
|
|
72
|
+
return F;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** The workers' ended runs on the unit's initiatives since `since`, and what waits on the PM there now. */
|
|
76
|
+
function eventsFor(unit, { team = [], driver = [], loops = [] } = {}, since = null) {
|
|
77
|
+
const mine = new Set((unit.initiatives || []).map((x) => `${x.ws}:${x.ini}`));
|
|
78
|
+
const key = `${unit.kind}:${unit.id}`;
|
|
79
|
+
const after = (at) => !since || String(at || '') > String(since);
|
|
80
|
+
const ours = (ws, ini, u) => (u && u.kind ? `${u.kind}:${u.id}` === key : mine.has(`${ws}:${ini}`));
|
|
81
|
+
const events = [];
|
|
82
|
+
for (const { ws, lines } of team) {
|
|
83
|
+
const last = new Map(); // a later step line for the same id replaces the earlier one (lib/team-runs.js fold)
|
|
84
|
+
for (const l of lines || []) if (l && l.kind === 'step' && l.id) last.set(l.id, { ...(last.get(l.id) || {}), ...l });
|
|
85
|
+
const result = new Map();
|
|
86
|
+
for (const l of lines || []) if (l && l.kind === 'result' && l.run) result.set(l.run, l.summary);
|
|
87
|
+
for (const s of last.values()) {
|
|
88
|
+
if ((s.state !== 'done' && s.state !== 'failed') || !after(s.at) || !s.ini || !ours(s.ws || ws, s.ini, s.unit)) continue;
|
|
89
|
+
events.push({ ini: s.ini, state: s.state, what: one(result.get(s.id) || `${s.role || 'a role'} run`, 160), why: s.state === 'failed' ? one(s.why || 'the run failed', 160) : '', at: s.at });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
let forYou = 0;
|
|
93
|
+
for (const { ws, state } of driver) {
|
|
94
|
+
if (!state) continue;
|
|
95
|
+
for (const r of state.runs ? state.runs.values() : []) {
|
|
96
|
+
if (!r.end || !after(r.end) || !r.target || r.target.kind !== 'initiative' || !ours(r.target.ws || ws, r.target.id, null)) continue;
|
|
97
|
+
events.push({ ini: r.target.id, state: r.ok ? 'done' : 'failed', what: 'Driver run', why: r.ok ? '' : one(r.reason || 'the run failed', 160), at: r.end });
|
|
98
|
+
}
|
|
99
|
+
for (const id of state.order || []) {
|
|
100
|
+
const p = state.proposals.get(id);
|
|
101
|
+
if (p && p.state === 'open' && p.target && p.target.kind === 'initiative' && ours(p.target.ws || ws, p.target.id, null)) forYou++;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (unit.kind === 'product') {
|
|
105
|
+
for (const { ws, lines } of loops) {
|
|
106
|
+
if (ws && ws !== unit.id) continue;
|
|
107
|
+
const wsOf = new Map(), goalOf = new Map();
|
|
108
|
+
for (const l of lines || []) if (l && l.ev === 'start') { wsOf.set(l.id, l.ws); goalOf.set(l.id, l.goal); }
|
|
109
|
+
for (const l of lines || []) {
|
|
110
|
+
if (!l || l.ev !== 'round-end' || !after(l.at) || wsOf.get(l.id) !== unit.id) continue;
|
|
111
|
+
events.push({ ini: '', state: l.ok === false ? 'failed' : 'done', what: one(`a round of the goal "${goalOf.get(l.id) || l.id}"`, 160), why: l.ok === false ? one(l.reason || 'the round failed', 160) : '', at: l.at });
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
events.sort((a, b) => String(a.at).localeCompare(String(b.at)));
|
|
116
|
+
return { events, forYou };
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function briefOf({ events = [], forYou = 0, plan = [] } = {}) {
|
|
120
|
+
const failed = events.filter((e) => e.state === 'failed').map((e) => ({ ini: e.ini || '', why: e.why || 'the run failed' })).slice(0, 8);
|
|
121
|
+
const items = events.filter((e) => e.state === 'done').map((e) => ({ ini: e.ini || '', what: e.what || '' })).slice(-12);
|
|
122
|
+
const touched = new Set(events.map((e) => e.ini).filter(Boolean));
|
|
123
|
+
const next = (plan || []).find((x) => !touched.has(x)) || (plan || [])[0] || '';
|
|
124
|
+
return { done: events.length, forYou: Math.max(0, forYou | 0), failed, items, next };
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function tick(dir, { units = [], gather, rankedOf = null, promote = null, now = Date.now(), only = null, force = false } = {}) {
|
|
128
|
+
const out = { wrote: [], skipped: [] };
|
|
129
|
+
if (!dir || typeof gather !== 'function') return out;
|
|
130
|
+
const day = localDay(now);
|
|
131
|
+
let F = fold(read(dir));
|
|
132
|
+
for (const unit of units) {
|
|
133
|
+
const key = `${unit.kind}:${unit.id}`;
|
|
134
|
+
if (only && key !== only) continue;
|
|
135
|
+
const have = F.get(key);
|
|
136
|
+
const last = have && have.briefs.length ? have.briefs[have.briefs.length - 1] : null;
|
|
137
|
+
if (!force && last && last.day === day) { out.skipped.push(key); continue; }
|
|
138
|
+
let plan = (unit.initiatives || []).map((x) => x.ini);
|
|
139
|
+
if (rankedOf) { try { const r = rankedOf(unit); if (Array.isArray(r)) { const set = new Set(plan); plan = r.filter((x) => set.has(x)).concat(plan.filter((x) => !r.includes(x))); } } catch { /* the unit's own order */ } }
|
|
140
|
+
if (!have || JSON.stringify(have.plan) !== JSON.stringify(plan)) append(dir, { kind: 'plan', unit: key, ranked: plan }, now);
|
|
141
|
+
if (promote) {
|
|
142
|
+
let ls = []; try { ls = promote(unit) || []; } catch { ls = []; }
|
|
143
|
+
for (const x of ls) if (x && x.text && !(have && have.lessons.some((y) => y.text === x.text))) append(dir, { kind: 'lesson', unit: key, text: one(x.text, 600), sources: (x.sources || []).slice(0, 8) }, now);
|
|
144
|
+
}
|
|
145
|
+
const since = last ? last.at : new Date(now - DAY).toISOString();
|
|
146
|
+
let g = { events: [], forYou: 0 };
|
|
147
|
+
try { g = gather(unit, since) || g; } catch { /* an unreadable ledger: an empty brief, said once */ }
|
|
148
|
+
append(dir, { kind: 'brief', unit: key, day, since, ...briefOf({ events: g.events, forYou: g.forYou, plan }) }, now);
|
|
149
|
+
out.wrote.push(key);
|
|
150
|
+
F = fold(read(dir));
|
|
151
|
+
}
|
|
152
|
+
return out;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function lineOf(b) {
|
|
156
|
+
if (!b) return '';
|
|
157
|
+
const parts = [];
|
|
158
|
+
if (b.done) parts.push(`${b.done} done`);
|
|
159
|
+
if (b.forYou) parts.push(`${b.forYou} for you`);
|
|
160
|
+
return parts.join(' · ');
|
|
161
|
+
}
|
|
162
|
+
function latest(F) {
|
|
163
|
+
const out = {};
|
|
164
|
+
for (const [key, u] of F || []) {
|
|
165
|
+
const b = u.briefs[u.briefs.length - 1];
|
|
166
|
+
if (!b) continue;
|
|
167
|
+
out[key] = { line: lineOf(b), day: b.day, at: b.at, done: b.done, forYou: b.forYou, failed: b.failed, next: b.next };
|
|
168
|
+
}
|
|
169
|
+
return out;
|
|
170
|
+
}
|
|
171
|
+
function openingLines(F, units = [], { cap = 8 } = {}) {
|
|
172
|
+
const title = new Map(units.map((u) => [u.key || `${u.kind}:${u.id}`, u.title]));
|
|
173
|
+
const rows = [];
|
|
174
|
+
for (const [key, u] of F || []) {
|
|
175
|
+
const b = u.briefs[u.briefs.length - 1];
|
|
176
|
+
if (!b || (units.length && !title.has(key))) continue;
|
|
177
|
+
const bits = [lineOf(b) || 'nothing new'];
|
|
178
|
+
if (b.failed.length) bits.push(`failed: ${b.failed.slice(0, 3).map((f) => (f.ini ? f.ini + ' — ' : '') + f.why).join('; ')}`);
|
|
179
|
+
if (b.next) bits.push(`next: ${b.next}`);
|
|
180
|
+
rows.push({ at: b.at, text: `- ${title.get(key) || key} (${key}), ${b.day}: ${bits.join('; ')}` });
|
|
181
|
+
}
|
|
182
|
+
return rows.sort((a, b) => String(b.at).localeCompare(String(a.at))).slice(0, cap).map((r) => r.text);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
module.exports = { LEDGER, KINDS, localDay, append, read, fold, eventsFor, briefOf, tick, lineOf, latest, openingLines };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* units-cli.js — `pmos units`: every Program, Product and Project, who owns which initiative, and each owner's newest brief
|
|
3
|
+
* (chief-unit-owners ✦1 and ✦3). A read: it runs at once, from Home's chat (the chief) or a terminal.
|
|
4
|
+
*
|
|
5
|
+
* pmos units [list] [--json] one row per unit: its key, title, initiatives, the brief line, what failed, what is next, runs a day
|
|
6
|
+
* pmos units show <unit> [--json] one unit with the ids of its initiatives
|
|
7
|
+
* The owner is derived (lib/units.js): an initiative in a program is the program's, else its product's (project work: the project's).
|
|
8
|
+
* It reads GET /api/units on the running workspace. Exit codes: 0 done, 1 refused or no workspace running, 2 usage.
|
|
9
|
+
*/
|
|
10
|
+
const COMMANDS = { units: ['list', 'show'] };
|
|
11
|
+
const USAGE = [
|
|
12
|
+
'usage: pmos units [list|show <unit>] — the programs, products and projects, who owns each initiative, and each owner\'s brief',
|
|
13
|
+
' pmos units list one row per unit: initiatives, today\'s brief ("3 done · 1 for you"), what failed, what is next',
|
|
14
|
+
' pmos units show <unit> one unit (program:<id>, product:<id> or project:<id>) and its initiatives',
|
|
15
|
+
'every command: [--json]',
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
async function run(argv, { say = (s) => console.log(s), call = async () => null } = {}) {
|
|
19
|
+
const args = argv[0] === 'units' ? argv.slice(1) : argv.slice();
|
|
20
|
+
const json = args.includes('--json');
|
|
21
|
+
const pos = args.filter((a) => !a.startsWith('--'));
|
|
22
|
+
const verb = pos[0] || 'list';
|
|
23
|
+
if (['help', '-h'].includes(verb) || args.includes('--help')) { for (const l of USAGE) say(l); return 0; }
|
|
24
|
+
if (!COMMANDS.units.includes(verb)) { say(`unknown units command "${verb}" — one of ${COMMANDS.units.join(', ')}`); return 2; }
|
|
25
|
+
const r = await call('GET', '/api/units');
|
|
26
|
+
if (!r || !r.ok) { say(json ? JSON.stringify({ ok: false, error: (r && r.error) || 'no PMOS workspace is running' }) : `✗ ${(r && r.error) || 'no PMOS workspace is running: start it with `pmos`'}`); return 1; }
|
|
27
|
+
let units = r.units || [];
|
|
28
|
+
if (verb === 'show') {
|
|
29
|
+
const key = pos[1];
|
|
30
|
+
if (!key) { say('usage: pmos units show <unit>'); return 2; }
|
|
31
|
+
units = units.filter((u) => u.key === key);
|
|
32
|
+
if (!units.length) { say(`✗ no unit ${key} (pmos units lists them)`); return 1; }
|
|
33
|
+
if (json) { say(JSON.stringify({ ok: true, unit: units[0] })); return 0; }
|
|
34
|
+
}
|
|
35
|
+
if (json) { say(JSON.stringify({ ok: true, units })); return 0; }
|
|
36
|
+
if (!units.length) { say('No units yet: no workspace has an open initiative.'); return 0; }
|
|
37
|
+
for (const u of units) {
|
|
38
|
+
say(`${u.key} ${u.title} · ${u.initiatives} ${u.initiatives === 1 ? 'initiative' : 'initiatives'}`);
|
|
39
|
+
if (u.day) say(` brief ${u.day}: ${u.line || 'nothing new'}${u.next ? ` · next: ${u.next}` : ''}`);
|
|
40
|
+
for (const f of u.failed || []) say(` did not finish: ${f.ini ? f.ini + ' — ' : ''}${f.why}`);
|
|
41
|
+
}
|
|
42
|
+
return 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
module.exports = { run, COMMANDS, USAGE };
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* units-host.js — the server's side of the units and their owners (chief-unit-owners ✦1 and ✦2). It reads what lib/units.js and
|
|
3
|
+
* lib/unit-owner.js need from the registered workspaces and hands it to them; those two stay pure.
|
|
4
|
+
*
|
|
5
|
+
* create({ workspaces, stateDirFor, homeDir, programs, rowsOf, runtimeDir, cacheMs? }) → host
|
|
6
|
+
* workspaces() → [w] the registered workspaces ({ id, name, root })
|
|
7
|
+
* stateDirFor(w) → dir | null a workspace's state folder (server.js stateDirFor); null skips it
|
|
8
|
+
* homeDir() → dir | null where units.jsonl lives: the home workspace's state folder
|
|
9
|
+
* programs() → [program] lib/programs.js merge() of every workspace (lib/routes-programs.js all)
|
|
10
|
+
* rowsOf(w) → [{ id, kind?, rank?, stopped?, archived? }] | null the initiative rows of a workspace (lib/routes-boards.js baseRows);
|
|
11
|
+
* null while they are still being read (then nothing is cached)
|
|
12
|
+
* runtimeDir the folder of goal-loops.jsonl (lib/goal-loop.js)
|
|
13
|
+
* memoryRoot() → root the repository whose D72 memory the units' lessons go to (the home workspace)
|
|
14
|
+
* promote(unit) → [lesson] ✦4 lib/unit-memory.js promote, called by each tick
|
|
15
|
+
* host.units() → lib/units.js list() cached for cacheMs (60 s): every ledger append asks resolve()
|
|
16
|
+
* host.resolve({ ws, ini }) → unit | null what lib/units.js stamp() uses (setResolver)
|
|
17
|
+
* host.tick({ now?, only?, force? }) → unit-owner tick() the bg-queue job `owner` (once a day per unit) and `pmos owner brief`
|
|
18
|
+
* host.state() → { units, latest, F } GET /api/units, Home's group lines, the chief's opening
|
|
19
|
+
* host.dispatch(key, { roles? }) · host.pause(key, on) the chief's `pmos team dispatch|pause|resume --unit` (✦3)
|
|
20
|
+
* host.chiefLines() → [line] · host.iniLines(ws, ini) → [line] what the chief's and an initiative chat's openings carry (✦3)
|
|
21
|
+
*/
|
|
22
|
+
const fs = require('fs');
|
|
23
|
+
const path = require('path');
|
|
24
|
+
const U = require('./units.js');
|
|
25
|
+
const O = require('./unit-owner.js');
|
|
26
|
+
|
|
27
|
+
function readJsonl(f) {
|
|
28
|
+
let text = '';
|
|
29
|
+
try { text = fs.readFileSync(f, 'utf8'); } catch { return []; }
|
|
30
|
+
const out = [];
|
|
31
|
+
for (const raw of text.split('\n')) { if (!raw.trim()) continue; try { out.push(JSON.parse(raw)); } catch { /* a torn line */ } }
|
|
32
|
+
return out;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function create(deps) {
|
|
36
|
+
const cacheMs = deps.cacheMs == null ? 60000 : deps.cacheMs;
|
|
37
|
+
let cache = null, cachedAt = 0;
|
|
38
|
+
const wss = () => { try { return deps.workspaces() || []; } catch { return []; } };
|
|
39
|
+
let pending = false; // a workspace whose rows are still being read: the list is not cached, so the next ask reads again
|
|
40
|
+
const rowsOf = (w) => { try { const r = deps.rowsOf(w); if (r === null) { pending = true; return []; } return r || []; } catch { return []; } };
|
|
41
|
+
const progs = () => { try { return deps.programs() || []; } catch { return []; } };
|
|
42
|
+
|
|
43
|
+
function units(now = Date.now()) {
|
|
44
|
+
if (cache && now - cachedAt < cacheMs) return cache.list;
|
|
45
|
+
pending = false;
|
|
46
|
+
const workspaces = wss().map((w) => ({ id: w.id, name: w.name || w.id,
|
|
47
|
+
inis: rowsOf(w).map((r) => ({ ini: r.id, kind: r.kind, resting: !!(r.stopped || r.archived) })) }));
|
|
48
|
+
const programs = progs();
|
|
49
|
+
const idx = U.memberIndex(programs);
|
|
50
|
+
const kindOf = new Map();
|
|
51
|
+
for (const w of workspaces) for (const x of w.inis) kindOf.set(`${w.id}:${x.ini}`, x.kind);
|
|
52
|
+
cache = { list: U.list({ workspaces, programs }), idx, kindOf };
|
|
53
|
+
cachedAt = pending ? 0 : now;
|
|
54
|
+
return cache.list;
|
|
55
|
+
}
|
|
56
|
+
function resolve({ ws, ini } = {}) {
|
|
57
|
+
units();
|
|
58
|
+
if (!cache) return null;
|
|
59
|
+
return U.unitOf({ ws, ini, kind: ini ? cache.kindOf.get(`${ws}:${ini}`) : null, programOf: cache.idx });
|
|
60
|
+
}
|
|
61
|
+
const homeDir = () => { try { return deps.homeDir(); } catch { return null; } };
|
|
62
|
+
|
|
63
|
+
/** Every ledger the owner's brief reads, for one unit's workspaces. */
|
|
64
|
+
function gather(unit, since) {
|
|
65
|
+
const want = new Set(unit.kind === 'program' ? (unit.initiatives || []).map((x) => x.ws) : [unit.id]);
|
|
66
|
+
const team = [], driver = [];
|
|
67
|
+
const D = require('./driver.js');
|
|
68
|
+
for (const w of wss()) {
|
|
69
|
+
if (!want.has(w.id)) continue;
|
|
70
|
+
let dir = null; try { dir = deps.stateDirFor(w); } catch { dir = null; }
|
|
71
|
+
if (!dir) continue;
|
|
72
|
+
team.push({ ws: w.id, lines: readJsonl(path.join(dir, 'team.jsonl')) });
|
|
73
|
+
driver.push({ ws: w.id, state: D.fold(D.readLines(D.ledgerFile(dir))) });
|
|
74
|
+
}
|
|
75
|
+
const loops = deps.runtimeDir ? [{ ws: null, lines: readJsonl(path.join(deps.runtimeDir, 'goal-loops.jsonl')) }] : [];
|
|
76
|
+
return O.eventsFor(unit, { team, driver, loops }, since);
|
|
77
|
+
}
|
|
78
|
+
function rankedOf(unit) {
|
|
79
|
+
const rank = new Map();
|
|
80
|
+
for (const w of wss()) for (const r of rowsOf(w)) if (Number.isInteger(r.rank)) rank.set(`${w.id}:${r.id}`, r.rank);
|
|
81
|
+
return [...(unit.initiatives || [])].sort((a, b) => (rank.has(`${a.ws}:${a.ini}`) ? rank.get(`${a.ws}:${a.ini}`) : 1e9) - (rank.has(`${b.ws}:${b.ini}`) ? rank.get(`${b.ws}:${b.ini}`) : 1e9)).map((x) => x.ini);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function tick({ now = Date.now(), only = null, force = false, promote = deps.promote || null } = {}) {
|
|
85
|
+
const dir = homeDir();
|
|
86
|
+
if (!dir) return { wrote: [], skipped: [], error: 'no home workspace with a state folder' };
|
|
87
|
+
return O.tick(dir, { units: units(now), gather, rankedOf, promote, now, only, force });
|
|
88
|
+
}
|
|
89
|
+
function state() {
|
|
90
|
+
const dir = homeDir();
|
|
91
|
+
const F = dir ? O.fold(O.read(dir)) : new Map();
|
|
92
|
+
const list = units();
|
|
93
|
+
return { units: list, latest: O.latest(F), F };
|
|
94
|
+
}
|
|
95
|
+
/** The chief's opening (✦3): one line per unit's newest brief, newest first. */
|
|
96
|
+
function chiefLines({ cap = 8 } = {}) { const st = state(); return O.openingLines(st.F, st.units, { cap }); }
|
|
97
|
+
/** An initiative chat's opening (✦3): the brief line of the unit that owns it and the unit's last 3 lessons. */
|
|
98
|
+
function iniLines(ws, ini) {
|
|
99
|
+
const u = resolve({ ws, ini });
|
|
100
|
+
if (!u) return [];
|
|
101
|
+
const key = U.keyOf(u), st = state();
|
|
102
|
+
const unit = st.units.find((x) => x.key === key), have = st.F.get(key), b = st.latest[key];
|
|
103
|
+
const out = [`This initiative is owned by ${unit ? unit.title : key} (${key}).${b ? ` Its brief of ${b.day}: ${b.line || 'nothing new'}${b.next ? `; next: ${b.next}` : ''}.` : ''}`];
|
|
104
|
+
const ls = have ? have.lessons.slice(-3) : [];
|
|
105
|
+
if (ls.length) out.push('Lessons of that unit:', ...ls.map((l) => '- ' + l.text));
|
|
106
|
+
return out;
|
|
107
|
+
}
|
|
108
|
+
const wsById = (id) => wss().find((w) => w.id === id) || null;
|
|
109
|
+
const dirOf = (w) => { try { return w ? deps.stateDirFor(w) : null; } catch { return null; } };
|
|
110
|
+
/** ✦3 `pmos team dispatch --unit`: the role agents for the unit's first open initiative in Roadmap order that has no dispatch running. */
|
|
111
|
+
function dispatch(key, { roles = null, now = Date.now() } = {}) {
|
|
112
|
+
const unit = units(now).find((u) => u.key === key);
|
|
113
|
+
if (!unit) return { ok: false, error: `no unit ${key} (pmos units lists them)` };
|
|
114
|
+
const R = require('./team-runs.js');
|
|
115
|
+
const order = rankedOf(unit), errors = [];
|
|
116
|
+
for (const ini of order) {
|
|
117
|
+
const x = unit.initiatives.find((y) => y.ini === ini), w = x && wsById(x.ws), dir = dirOf(w);
|
|
118
|
+
if (!dir) continue;
|
|
119
|
+
const r = R.dispatch(dir, { kind: 'initiative', target: ini, ws: w.id, facts: R.factsOf(w.root, ini), roles, now });
|
|
120
|
+
if (r.ok) return { ...r, unit: key, initiative: ini };
|
|
121
|
+
errors.push(`${ini}: ${r.error}`);
|
|
122
|
+
}
|
|
123
|
+
return { ok: false, error: errors.length ? `no initiative of ${key} could take a dispatch (${errors.slice(0, 3).join('; ')})` : `${key} has no open initiative` };
|
|
124
|
+
}
|
|
125
|
+
/** ✦3 `pmos team pause|resume --unit`: one pause line per workspace of the unit; the role runner skips the unit's steps while it holds. */
|
|
126
|
+
function pause(key, on, { now = Date.now() } = {}) {
|
|
127
|
+
const unit = units(now).find((u) => u.key === key);
|
|
128
|
+
if (!unit) return { ok: false, error: `no unit ${key} (pmos units lists them)` };
|
|
129
|
+
const R = require('./team-runs.js');
|
|
130
|
+
const seen = new Set(unit.kind === 'program' ? unit.initiatives.map((x) => x.ws) : [unit.id]);
|
|
131
|
+
let n = 0;
|
|
132
|
+
for (const id of seen) { const dir = dirOf(wsById(id)); if (!dir) continue; R.append(dir, { kind: 'pause', role: 'unit:' + key, on: !!on }, now); n++; }
|
|
133
|
+
return n ? { ok: true, unit: key, on: !!on } : { ok: false, error: `${key} has no workspace with a state folder` };
|
|
134
|
+
}
|
|
135
|
+
/** A unit's own chat (addendum): its newest brief, what failed and why, and its last 3 lessons. */
|
|
136
|
+
function unitLines(key) {
|
|
137
|
+
const st = state(), unit = st.units.find((x) => x.key === key);
|
|
138
|
+
if (!unit) return [`The unit ${key} has no open initiative now.`];
|
|
139
|
+
const b = st.latest[key], have = st.F.get(key);
|
|
140
|
+
const out = [`This chat is about ${unit.title} (${key}), with ${unit.initiatives.length} open ${unit.initiatives.length === 1 ? 'initiative' : 'initiatives'}: ${unit.initiatives.slice(0, 20).map((x) => x.ini).join(', ') || 'none'}. Answer about this unit first.`];
|
|
141
|
+
out.push(b ? `Its brief of ${b.day}: ${b.line || 'nothing new'}${b.next ? `; next: ${b.next}` : ''}.` : 'It has no brief yet; `pmos owner brief ' + key + '` writes one.');
|
|
142
|
+
for (const f of (b && b.failed) || []) out.push(`- did not finish: ${f.ini ? f.ini + ' — ' : ''}${f.why}`);
|
|
143
|
+
const ls = have ? have.lessons.slice(-3) : [];
|
|
144
|
+
if (ls.length) out.push('Its lessons:', ...ls.map((l) => '- ' + l.text));
|
|
145
|
+
return [out.join('\n')];
|
|
146
|
+
}
|
|
147
|
+
const memoryRoot = () => { try { return deps.memoryRoot ? deps.memoryRoot() : null; } catch { return null; } };
|
|
148
|
+
return { units, resolve, gather, rankedOf, tick, state, memoryRoot, chiefLines, iniLines, unitLines, dispatch, pause, invalidate: () => { cache = null; } };
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
module.exports = { create, readJsonl };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* units.js — who owns each initiative (chief-unit-owners ✦1; grill doc GCFCo233wHawPk7Ypjba4J, agreed by Wawan 2026-11-18 "Build now").
|
|
3
|
+
*
|
|
4
|
+
* THREE LAYERS, ONE LIVE SESSION. The chief is Home's chat (lib/cos-chat.js). Each Program, Product and Project has ONE owner, which is a
|
|
5
|
+
* RECORD with a daily tick (lib/unit-owner.js), never a session. Workers are the short runs PMOS already has (Driver, role runs, Builder,
|
|
6
|
+
* goal-loop rounds). This file says which unit owns an initiative. The owner is DERIVED, never declared, like the stage (lib/stage-read.js).
|
|
7
|
+
*
|
|
8
|
+
* unitOf({ ws, ini, kind, programOf }) → { kind: 'program'|'product'|'project', id }
|
|
9
|
+
* the program when the initiative is in one (Wawan 2026-11-18: the program owns it, the product only reads it); else its product,
|
|
10
|
+
* the workspace; kind 'project' when the initiative's work kind is Project management (lib/work-kind.js), with the workspace's id.
|
|
11
|
+
* No initiative (a goal loop of the workspace): the product.
|
|
12
|
+
* keyOf(unit) → 'program:<id>' · parseKey(key) → unit | null
|
|
13
|
+
* memberIndex(programs) → Map('<ws>:<ini>' → program id) programs: lib/programs.js merge() (members [{ ws, initiative }])
|
|
14
|
+
* list({ workspaces, programs }) → [{ key, kind, id, title, ws?, initiatives: [{ ws, ini }] }]
|
|
15
|
+
* workspaces: [{ id, name, inis: [{ ini, kind?, resting? }] }]. Resting initiatives are left out. A program with no open initiative is listed.
|
|
16
|
+
* setResolver(fn) · resolve({ ws, ini }) → unit | null the server sets fn once, from the same reads as list()
|
|
17
|
+
* stamp(line, { ws, ini }) → the line with `unit` added what every new team, driver and goal-loop line carries (old lines have none)
|
|
18
|
+
*
|
|
19
|
+
* No model, no I/O here. The server gathers the workspaces and programs.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
const KINDS = Object.freeze(['program', 'product', 'project']);
|
|
23
|
+
const ID_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,80}$/;
|
|
24
|
+
|
|
25
|
+
const keyOf = (u) => (u && KINDS.includes(u.kind) && u.id ? `${u.kind}:${u.id}` : '');
|
|
26
|
+
function parseKey(key) {
|
|
27
|
+
const m = /^(program|product|project):([A-Za-z0-9][A-Za-z0-9._-]{0,80})$/.exec(String(key || ''));
|
|
28
|
+
return m ? { kind: m[1], id: m[2] } : null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function memberIndex(programs) {
|
|
32
|
+
const out = new Map();
|
|
33
|
+
for (const p of programs || []) {
|
|
34
|
+
if (!p || p.archived || !p.id) continue;
|
|
35
|
+
for (const m of p.members || []) if (m && m.ws && m.initiative && !out.has(`${m.ws}:${m.initiative}`)) out.set(`${m.ws}:${m.initiative}`, p.id);
|
|
36
|
+
}
|
|
37
|
+
return out;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function unitOf({ ws, ini, kind, programOf } = {}) {
|
|
41
|
+
const w = String(ws || '');
|
|
42
|
+
if (ini && programOf) {
|
|
43
|
+
const pid = programOf instanceof Map ? programOf.get(`${w}:${ini}`) : programOf(w, ini);
|
|
44
|
+
if (pid) return { kind: 'program', id: String(pid) };
|
|
45
|
+
}
|
|
46
|
+
if (!w) return null;
|
|
47
|
+
return { kind: ini && kind === 'project' ? 'project' : 'product', id: w };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function list({ workspaces = [], programs = [] } = {}) {
|
|
51
|
+
const idx = memberIndex(programs);
|
|
52
|
+
const units = new Map();
|
|
53
|
+
const get = (u, title, ws) => {
|
|
54
|
+
const k = keyOf(u);
|
|
55
|
+
if (!units.has(k)) units.set(k, { key: k, kind: u.kind, id: u.id, title, ...(ws ? { ws } : {}), initiatives: [] });
|
|
56
|
+
return units.get(k);
|
|
57
|
+
};
|
|
58
|
+
for (const p of programs || []) if (p && !p.archived && p.id) get({ kind: 'program', id: p.id }, p.title || p.id);
|
|
59
|
+
for (const w of workspaces) {
|
|
60
|
+
if (!w || !w.id) continue;
|
|
61
|
+
const name = w.name || w.id;
|
|
62
|
+
get({ kind: 'product', id: w.id }, name, w.id);
|
|
63
|
+
for (const x of w.inis || []) {
|
|
64
|
+
if (!x || !ID_RE.test(String(x.ini || '')) || x.resting) continue;
|
|
65
|
+
const u = unitOf({ ws: w.id, ini: x.ini, kind: x.kind, programOf: idx });
|
|
66
|
+
const unit = get(u, u.kind === 'project' ? `${name} projects` : u.kind === 'product' ? name : u.id, u.kind === 'program' ? null : w.id);
|
|
67
|
+
unit.initiatives.push({ ws: w.id, ini: x.ini });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const order = { program: 0, product: 1, project: 2 };
|
|
71
|
+
return [...units.values()].sort((a, b) => order[a.kind] - order[b.kind] || String(a.title).localeCompare(String(b.title)));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
let resolver = null;
|
|
75
|
+
function setResolver(fn) { resolver = typeof fn === 'function' ? fn : null; }
|
|
76
|
+
function resolve({ ws, ini } = {}) {
|
|
77
|
+
if (!resolver) return null;
|
|
78
|
+
try { const u = resolver({ ws, ini }); return u && keyOf(u) ? { kind: u.kind, id: u.id } : null; } catch { return null; }
|
|
79
|
+
}
|
|
80
|
+
/** The line with the unit of its initiative (or of its workspace) added. A line that already says its unit, or whose unit cannot be told,
|
|
81
|
+
* is returned as it is: a ledger line never waits on this. */
|
|
82
|
+
function stamp(line, { ws, ini } = {}) {
|
|
83
|
+
if (!line || typeof line !== 'object' || line.unit) return line;
|
|
84
|
+
const u = resolve({ ws, ini });
|
|
85
|
+
return u ? { ...line, unit: u } : line;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
module.exports = { KINDS, keyOf, parseKey, memberIndex, unitOf, list, setResolver, resolve, stamp };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.600.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pmos-workspace",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.600.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -860,3 +860,79 @@ form.hm-box textarea { min-height: 48px; border: 0; background: none; resize: no
|
|
|
860
860
|
/* chief-of-staff C1 (board CsA): where an answer came from, one quiet line under it (pm/chat-src.js) */
|
|
861
861
|
.hm-src { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 6px 0 2px; }
|
|
862
862
|
.hm-src span { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-meta); color: var(--cz-ink3); }
|
|
863
|
+
|
|
864
|
+
/* ── the phone chat (batch 31 item 5, roomier-phone-chat; boards RcB, RcBfiles, RcBmenu): three zones on one 16 px grid ──
|
|
865
|
+
* The top bar: ← · the title over ONE context line · ⋯ (pm/phone-chat-head.js). The stream: messages only, full width, 24 px between
|
|
866
|
+
* turns and tight inside one. The foot: one box, + · input · mic · send, four 44 px controls. Desktop draws none of this. */
|
|
867
|
+
.hm-ctx, .hm-ell { display: none; }
|
|
868
|
+
.hm-cs[hidden], .hm-csc[hidden] { display: none; }
|
|
869
|
+
@media (max-width: 760px) {
|
|
870
|
+
/* the top bar: the 44 px boxes of ← and ⋯ put their glyphs on the 16 px margins */
|
|
871
|
+
body.cz-home:not(.hm-plist) .hm-top { align-items: center; gap: 0; min-height: 56px; box-sizing: border-box; padding: 6px 4px 6px 3px; }
|
|
872
|
+
body.cz-home:not(.hm-plist) .hm-top .hm-back { flex: none; margin: 0; }
|
|
873
|
+
body.cz-home:not(.hm-plist) .hm-top-t { flex-direction: column; align-items: flex-start; gap: 0; padding: 0 8px 0 5px; }
|
|
874
|
+
body.cz-home:not(.hm-plist) .hm-top-t b { max-width: 100%; font-size: var(--fs-row); line-height: 22px; } /* the row role on a 22 px line (R28-14: no raw size) */
|
|
875
|
+
body.cz-home:not(.hm-plist) .hm-top-t:has(.hm-ctx:not([hidden])) .hm-rn { min-height: 22px; }
|
|
876
|
+
body.cz-home:not(.hm-plist) .hm-ctx:not([hidden]) { display: flex; align-items: center; gap: 4px; max-width: 100%; min-height: 18px; margin: 0; padding: 0; border: 0; background: none; color: var(--cz-ink3); font: var(--fw-regular) var(--fs-meta)/18px var(--cz-sans); cursor: pointer; text-align: left; }
|
|
877
|
+
body.cz-home:not(.hm-plist) .hm-ctx em { font-style: normal; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
878
|
+
body.cz-home:not(.hm-plist) .hm-ctx svg { flex: none; }
|
|
879
|
+
body.cz-home:not(.hm-plist) .hm-ell { position: relative; flex: none; display: grid; place-items: center; width: 44px; height: 44px; margin: 0 0 0 auto; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--cz-ink2); cursor: pointer; }
|
|
880
|
+
body.cz-home:not(.hm-plist) .hm-top:has(.hm-ren) :is(.hm-ell, .hm-ctx) { display: none; } /* renaming: the field fills the bar beside back */
|
|
881
|
+
body.cz-home:not(.hm-plist) .hm-top-t:has(.hm-ren) { align-items: stretch; }
|
|
882
|
+
.hm-ell i { position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--cz-blue); box-shadow: 0 0 0 2px var(--cz-card); }
|
|
883
|
+
.hm-ell i[hidden] { display: none; }
|
|
884
|
+
/* ⋯ opens the one nav menu under the top bar; no round button, no live bubble, no waiting bar on a phone chat */
|
|
885
|
+
body.cz-home:not(.hm-plist):not(.hm-sheet) .cz-fabw.cz-top,
|
|
886
|
+
body.cz-home:not(.hm-plist):not(.hm-sheet) .cz-fabw:has(> .lv-tray:not([hidden])) { display: flex; }
|
|
887
|
+
body.cz-home:not(.hm-plist):not(.hm-sheet) .cz-fabw.cz-top { top: 52px; right: 16px; bottom: auto; left: auto; }
|
|
888
|
+
body.cz-home:not(.hm-plist):not(.hm-sheet) .cz-fabw > :is(.cz-fab, .cz-live, .ev-fd) { display: none; }
|
|
889
|
+
body.cz-home:not(.hm-plist) .hm-also, body.cz-home:not(.hm-plist) form#hmForm.hm-box .hm-chip { display: none; }
|
|
890
|
+
/* the sheet the context line opens: the initiative, its files, its pull requests, Sends to */
|
|
891
|
+
.hm-csc { position: fixed; inset: 0; z-index: 70; background: color-mix(in srgb, var(--cz-ink) 22%, transparent); }
|
|
892
|
+
.hm-cs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 71; max-height: 80vh; max-height: 80dvh; overflow-y: auto; box-sizing: border-box; padding: 8px 16px calc(20px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; background: var(--cz-card); box-shadow: var(--cz-sheet); display: flex; flex-direction: column; }
|
|
893
|
+
.hm-csg { flex: none; width: 36px; height: 4px; margin: 0 auto 12px; border-radius: 2px; background: var(--cz-hair); }
|
|
894
|
+
.hm-csl { margin: 0; padding: 8px 0 4px; font-size: var(--fs-meta); line-height: 18px; color: var(--cz-ink3); }
|
|
895
|
+
.hm-css { height: 1px; margin: 8px 0; background: var(--cz-hair); }
|
|
896
|
+
.hm-csr { display: flex; align-items: center; gap: 12px; min-height: 56px; width: 100%; padding: 0; border: 0; background: none; color: var(--cz-ink); font: inherit; font-size: var(--fs-body); text-align: left; text-decoration: none; cursor: pointer; }
|
|
897
|
+
.hm-csr .ic { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; background: var(--cz-well); color: var(--cz-ink2); }
|
|
898
|
+
.hm-csr .t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
|
|
899
|
+
.hm-csr .t b { font-weight: var(--fw-regular); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
900
|
+
.hm-csr .t small { font-size: var(--fs-meta); color: var(--cz-ink3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
901
|
+
.hm-csr em { flex: none; font-style: normal; font-size: var(--fs-meta); color: var(--cz-ink3); }
|
|
902
|
+
.hm-csr > svg { flex: none; color: var(--cz-ink3); }
|
|
903
|
+
.hm-csr:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; border-radius: 12px; }
|
|
904
|
+
|
|
905
|
+
/* the stream: messages only, from margin to margin. Adler stays on the empty chat's intro. */
|
|
906
|
+
body.cz-home:not(.hm-plist) .hm-log { gap: 0; padding: 12px 0 16px; }
|
|
907
|
+
body.cz-home:not(.hm-plist) .hm-log > * + * { margin-top: 24px; }
|
|
908
|
+
body.cz-home:not(.hm-plist) .hm-log > .hm-worked + .hm-a { margin-top: 2px; }
|
|
909
|
+
body.cz-home:not(.hm-plist) .hm-a:not(.hm-intro) > .hm-av { display: none; }
|
|
910
|
+
body.cz-home:not(.hm-plist) .hm-a { gap: 0; }
|
|
911
|
+
body.cz-home:not(.hm-plist) .hm-a.hm-intro { gap: 10px; }
|
|
912
|
+
body.cz-home:not(.hm-plist) :is(.hm-worked, .hm-pills) { padding-left: 0; }
|
|
913
|
+
body.cz-home:not(.hm-plist) .hm-wk { padding: 0; gap: 6px; min-height: 28px; }
|
|
914
|
+
body.cz-home:not(.hm-plist) .hm-ab .md p { margin: 0 0 8px; }
|
|
915
|
+
body.cz-home:not(.hm-plist) .hm-ab .md p:last-child { margin-bottom: 0; }
|
|
916
|
+
body.cz-home:not(.hm-plist) .hm-bub { padding: 10px 16px; }
|
|
917
|
+
/* no name and time line and no "You · 12:09": still read out to a screen reader. The ask card keeps its name line. */
|
|
918
|
+
body.cz-home:not(.hm-plist) .hm-a:not(.ask):not(.hm-intro) .hm-ab > .hm-who:not(:has(.hm-say)),
|
|
919
|
+
body.cz-home:not(.hm-plist) .hm-u > .hm-you { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
|
|
920
|
+
/* Copy, Retry and Make a work-item: on the newest message; an older one shows them on press and hold, or on focus */
|
|
921
|
+
body.cz-home:not(.hm-plist) .hm-tools { margin-top: 8px; }
|
|
922
|
+
body.cz-home:not(.hm-plist) .hm-a:not(.last):not(.held):not(:focus-within) .hm-tools { height: 0; margin: 0; overflow: hidden; opacity: 0; }
|
|
923
|
+
|
|
924
|
+
/* the foot: one box, + · input · mic · send, on the card with no fade over the stream */
|
|
925
|
+
body.cz-home:not(.hm-plist) #hmFoot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--cz-card); }
|
|
926
|
+
body.cz-home:not(.hm-plist) #hmFoot::before { content: none; }
|
|
927
|
+
body.cz-home:not(.hm-plist) form#hmForm.hm-box { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 0; padding: 4px; border-radius: 26px; }
|
|
928
|
+
body.cz-home:not(.hm-plist) form#hmForm.hm-box .hm-tb { display: contents; }
|
|
929
|
+
body.cz-home:not(.hm-plist) form#hmForm.hm-box .hm-tb > :is(.sp, .hm-key) { display: none; }
|
|
930
|
+
body.cz-home:not(.hm-plist) form#hmForm.hm-box > *, body.cz-home:not(.hm-plist) form#hmForm.hm-box .hm-tb > * { order: 2; }
|
|
931
|
+
body.cz-home:not(.hm-plist) form#hmForm.hm-box .hm-addw { order: 0; width: 44px; flex: none; margin: 0; }
|
|
932
|
+
body.cz-home:not(.hm-plist) form#hmForm.hm-box textarea { order: 1; flex: 1; min-width: 0; box-sizing: border-box; min-height: 44px; margin: 0; padding: 11px 8px 11px 4px; line-height: 22px; }
|
|
933
|
+
body.cz-home:not(.hm-plist) form#hmForm.hm-box textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* one row: a long placeholder ends in … */
|
|
934
|
+
body.cz-home:not(.hm-plist) form#hmForm.hm-box .ut-mic { order: 3; }
|
|
935
|
+
body.cz-home:not(.hm-plist) form#hmForm.hm-box .hm-send { order: 4; }
|
|
936
|
+
body.cz-home:not(.hm-plist) form#hmForm.hm-box :is(.hm-tool, .ut-mic, .hm-send) { flex: none; width: 44px; height: 44px; margin: 0; }
|
|
937
|
+
body.cz-home:not(.hm-plist) form#hmForm.hm-box > .hm-files { order: 9; flex-basis: 100%; padding: 4px 8px; box-sizing: border-box; }
|
|
938
|
+
}
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
* Reads GET /api/live every 10 s while the page is shown, and on the cz:live event (Home sends it after the PM opens or answers a
|
|
22
22
|
* session); the recording comes from pm/rec-state.js. The recording's row has one icon-only Stop beside it (Wawan, 2026-11-03: finish
|
|
23
23
|
* from anywhere): the first press asks "Press again", the second ends the meeting (rec-state.js stopPress). Nothing else is written.
|
|
24
|
+
* The phone chat has no round button (batch 31 item 5): its ⋯ menu shows "Live now · N" from the event 'cz:live-n' ({ n }) and opens
|
|
25
|
+
* this list with the event 'cz:live-open'.
|
|
24
26
|
* Adler (batch 17 item 4-B, AdM1 "Live recording pill", AdH5): while a meeting records, his S face with headphones follows the clock, now in
|
|
25
27
|
* the recording's row. The red dot stays: the face never replaces the row's mark. Paused, he is not shown (nobody is listening). */
|
|
26
28
|
import { onRecording, stopPress } from './rec-state.js';
|
|
@@ -111,6 +113,7 @@ export function mountLivePill(doc = document, opts = {}) {
|
|
|
111
113
|
function draw() {
|
|
112
114
|
if (!pill) return;
|
|
113
115
|
const now = items();
|
|
116
|
+
if (now.length !== L.n) { L.n = now.length; doc.dispatchEvent(new CustomEvent('cz:live-n', { detail: { n: now.length } })); } // the phone chat's ⋯ says "Live now · N" (batch 31 item 5)
|
|
114
117
|
if (!now.length && !L.open) { pill.hidden = true; tray.hidden = true; scrim.hidden = true; return; }
|
|
115
118
|
const list = L.open ? keepOrder(L.shown, now) : now;
|
|
116
119
|
if (L.open && !list.length) { set(false); return; }
|
|
@@ -219,5 +222,6 @@ export function mountLivePill(doc = document, opts = {}) {
|
|
|
219
222
|
setInterval(read, 10000);
|
|
220
223
|
doc.addEventListener('visibilitychange', () => { if (!doc.hidden) read(); });
|
|
221
224
|
doc.addEventListener('cz:live', () => read());
|
|
225
|
+
doc.addEventListener('cz:live-open', () => { if (pill) set(true); }); // the phone chat's ⋯ > Live now: the same list, with no round button
|
|
222
226
|
doc.addEventListener('cz-panels', () => draw()); // a panel put away or brought back
|
|
223
227
|
}
|