create-pmos 0.597.0 → 0.599.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/settings-and-switches.md +1 -1
- 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/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-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-schedwork.js +4 -2
- package/workspace/public/pm/cozy-settings.js +2 -2
- package/workspace/public/pm/cozy-today.css +3 -0
- package/workspace/public/pm/home-app.js +13 -1
- package/workspace/public/pm/home-list.js +14 -2
- package/workspace/public/pm/home-today.js +7 -4
- package/workspace/server.js +26 -1
- package/workspace/test-files.json +1 -0
|
@@ -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.599.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.599.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -142,7 +142,7 @@ export function swBody(sub) {
|
|
|
142
142
|
|
|
143
143
|
const said = (r, ok) => (r && r.ok ? ok : 'Not saved: ' + ((r && r.error) || 'the server did not answer') + '.');
|
|
144
144
|
/** A press inside Scheduled work. → true when it was one. `go(sub)` opens a panel ('' goes back to Connectors); `say(text)` the status line. */
|
|
145
|
-
export async function swPress(t, { go, say, draw }) {
|
|
145
|
+
export async function swPress(t, { go, say, draw, fresh }) {
|
|
146
146
|
const d = t.dataset;
|
|
147
147
|
if (d.evSw !== undefined) {
|
|
148
148
|
const k = d.evSw;
|
|
@@ -168,10 +168,11 @@ export async function swPress(t, { go, say, draw }) {
|
|
|
168
168
|
else if (d.evSwTrun) { const x = await pmPost('/api/schedules/run', { id }); say(x && x.ok !== false ? 'Started.' : 'It did not start: ' + ((x && x.error) || 'the server did not answer') + '.'); }
|
|
169
169
|
} finally { S.busy = false; }
|
|
170
170
|
await swLoad(draw);
|
|
171
|
+
if (fresh) fresh(); // the Connectors rows read /api/sources: read it again, or a row keeps the old rhythm
|
|
171
172
|
return true;
|
|
172
173
|
}
|
|
173
174
|
/** A change of Repeats. → true when it was one. */
|
|
174
|
-
export async function swChange(x, { say, draw }) {
|
|
175
|
+
export async function swChange(x, { say, draw, fresh }) {
|
|
175
176
|
const id = x.dataset.evSwRep || x.dataset.evSwCad || x.dataset.evSwAt || x.dataset.evSwDay;
|
|
176
177
|
if (!id) return false;
|
|
177
178
|
if (S.busy) return true;
|
|
@@ -197,5 +198,6 @@ export async function swChange(x, { say, draw }) {
|
|
|
197
198
|
}
|
|
198
199
|
} finally { S.busy = false; }
|
|
199
200
|
await swLoad(draw);
|
|
201
|
+
if (fresh) fresh(); // the Connectors rows read /api/sources: read it again, or a row keeps the old rhythm
|
|
200
202
|
return true;
|
|
201
203
|
}
|
|
@@ -527,7 +527,7 @@ function mount() {
|
|
|
527
527
|
document.addEventListener('keydown', (e) => { if (e.key === 'Escape' && T.el && !T.el.hidden && !T.el.contains(e.target) && !(e.target.closest && e.target.closest('.wf-menu'))) { e.preventDefault(); e.stopPropagation(); if (!vwFirst()) closeSettings(); } }, true);
|
|
528
528
|
T.el.addEventListener('change', async (e) => {
|
|
529
529
|
const x = e.target;
|
|
530
|
-
if (await SW.swChange(x, { say: (m) => { T.msg = m; }, draw })) return;
|
|
530
|
+
if (await SW.swChange(x, { say: (m) => { T.msg = m; }, draw, fresh: readFresh })) return;
|
|
531
531
|
if (x.matches('[data-ev-prof]')) {
|
|
532
532
|
const r = await pmPost('/api/profiles/prefer', { agent: 'claude', profile: x.value || null });
|
|
533
533
|
if (r && r.ok) { T.cl = { ...T.cl, prefs: { ...((T.cl && T.cl.prefs) || {}) } }; if (x.value) T.cl.prefs.claude = x.value; else delete T.cl.prefs.claude; }
|
|
@@ -609,7 +609,7 @@ async function press(e) {
|
|
|
609
609
|
draw(); return;
|
|
610
610
|
}
|
|
611
611
|
if (await JL.press(t, draw, (m) => { T.msg = m; })) return;
|
|
612
|
-
if (await SW.swPress(t, { go: (k) => { T.sub = k; T.msg = ''; draw(); const f = T.el.querySelector('.ev-dr-hd .ev-ib') || T.el.querySelector('[data-ev-sw="list"]'); if (f) f.focus(); }, say: (m) => { T.msg = m; }, draw })) return;
|
|
612
|
+
if (await SW.swPress(t, { go: (k) => { T.sub = k; T.msg = ''; draw(); const f = T.el.querySelector('.ev-dr-hd .ev-ib') || T.el.querySelector('[data-ev-sw="list"]'); if (f) f.focus(); }, say: (m) => { T.msg = m; }, draw, fresh: readFresh })) return;
|
|
613
613
|
if (t.dataset.evRead || 'evReadall' in t.dataset) { readAgain(t.dataset.evRead || ''); return; }
|
|
614
614
|
if (T.busy) return;
|
|
615
615
|
T.busy = true; T.msg = '';
|
|
@@ -292,6 +292,9 @@ body.cz-home .hm-lsc { margin: 0 -12px; padding: 0 12px 4px; }
|
|
|
292
292
|
|
|
293
293
|
/* the card and its one-line rows (HvAC .card, .row, .kid) */
|
|
294
294
|
.hv-card { background: var(--cz-card); border-radius: 18px; padding: 3px 0; }
|
|
295
|
+
/* chief-unit-owners ✦2 + addendum: the group owner's one quiet line under the group's name; a press opens the unit's chat */
|
|
296
|
+
.hv-unit { display: block; margin: 0 14px 6px 44px; padding: 0; border: 0; background: none; font: inherit; font-size: var(--fs-meta); color: var(--cz-ink3); line-height: var(--lh-meta); text-align: left; cursor: pointer; }
|
|
297
|
+
.hv-unit:hover { color: var(--cz-ink2, var(--cz-ink3)); text-decoration: underline; }
|
|
295
298
|
body.cz-home .hv-r { position: relative; display: flex; align-items: center; gap: 0; min-height: 0; margin: 0; border-radius: 14px; background: none; box-shadow: none; }
|
|
296
299
|
body.cz-home .hv-r .hm-rm { flex: 1; min-width: 0; min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 6px; border-radius: 14px; }
|
|
297
300
|
body.cz-home .hv-r .hm-ck + .hm-rm { padding-left: 8px; }
|
|
@@ -1384,6 +1384,17 @@ function programTarget(id, task) {
|
|
|
1384
1384
|
empty: 'Ask about ' + pr.title + '. PMOS reads the program and its initiatives in a real Claude Code session.',
|
|
1385
1385
|
context: 'Program ' + pr.title + ' (' + id + ')' + (inis.length ? ', with the initiatives ' + inis.join(', ') : '') + '.' + (task ? ' The PM opened its task "' + task.name + '"' + (task.hint ? ' (' + task.hint + ')' : '') + '.' : ''), also: null };
|
|
1386
1386
|
}
|
|
1387
|
+
/** chief-unit-owners addendum: a unit's own chat (chat:unit:<kind>:<id>), from the press on its Home line. The server opens it with the
|
|
1388
|
+
* chief's rule, the unit's newest brief and its last 3 lessons (lib/briefing-premium-agent.js). */
|
|
1389
|
+
function unitTarget(unit) {
|
|
1390
|
+
const [kind, ...rest] = String(unit).split(':'), id = rest.join(':');
|
|
1391
|
+
const pr = kind === 'program' ? (S.D.programs || []).find((p) => p && p.id === id) : null;
|
|
1392
|
+
const g = ((S.M && S.M.groups) || []).find((x) => x.unitLine && x.unitLine.key === unit);
|
|
1393
|
+
const name = pr ? pr.title : g ? g.name : id;
|
|
1394
|
+
return { key: 'chat:unit:' + unit, ws: WS || undefined, title: name, sub: kind === 'program' ? 'Program' : kind === 'project' ? 'Projects' : 'Product',
|
|
1395
|
+
scope: { text: name, icon: kind === 'program' ? TD.P.layers : GLOBE }, rich: false, role: CLAUDE, placeholder: 'Message PMOS about ' + name,
|
|
1396
|
+
empty: 'Ask about ' + name + '. PMOS reads its brief and its initiatives.', context: 'The unit ' + name + ' (' + unit + ').', also: null };
|
|
1397
|
+
}
|
|
1387
1398
|
/** A chat Intelligence asks for (?ask=insights|verdict): titled from the goal it names (?label), scoped to the product's goals, never "ins:insights"
|
|
1388
1399
|
* and never "All work" (workspace grill W4). */
|
|
1389
1400
|
function insTarget(key) {
|
|
@@ -2162,7 +2173,8 @@ $('#hmList').onclick = (e) => { // delegated: every press on the list is a <bu
|
|
|
2162
2173
|
if ('hmDay' in d) { day(!S.day); return; }
|
|
2163
2174
|
if ('hmDayx' in d) { day(false); return; }
|
|
2164
2175
|
if ('hmFlt' in d) { filterMenu(b); return; }
|
|
2165
|
-
if (d.hmProg) { goProgram(d.hmProg); return; }
|
|
2176
|
+
if (d.hmProg) { goProgram(d.hmProg); return; }
|
|
2177
|
+
if (d.hmUnit) { S.phoneChat = isPhone(); openTarget(unitTarget(d.hmUnit)); return; } // chief-unit-owners addendum: the unit's own chat // the program panel, in Home's Viewer (HbCProg)
|
|
2166
2178
|
if (d.hmProdopen) { const g = ((S.M && S.M.groups) || []).find((x) => x.key === d.hmProdopen); if (g && !g.primary && g.product && g.product.ws) { goOtherProduct(g); return; } goIni('product'); return; }
|
|
2167
2179
|
if (d.hmKids) { // the chevron of an initiative: what sits under it shows or hides
|
|
2168
2180
|
if (b.getAttribute('aria-expanded') === 'true') { S.kids.delete(d.hmKids); S.kidsOff.add(d.hmKids); } else { S.kids.add(d.hmKids); S.kidsOff.delete(d.hmKids); }
|
|
@@ -60,6 +60,17 @@ const prodOf = (x) => (x && x.product && x.product !== ACROSS ? x.product : '');
|
|
|
60
60
|
* product's place with the board's own first, then the registered order (pm/cozy-pick.js tonesOf), so the chip and the group agree. */
|
|
61
61
|
/** The pick's unticked test: true for a registered product that is not ticked; a product the pick does not list is never hidden. */
|
|
62
62
|
const unticked = (D) => { const P = (D.pick && D.pick.products) || (D.brief && D.brief.products && D.brief.products.available) || []; return (ws) => !!ws && P.some((a) => a.ws === ws && !a.on); };
|
|
63
|
+
/** chief-unit-owners ✦2: the one quiet line a group shows from its owner's newest brief (GET /api/home-desk units), "3 done · 1 for you".
|
|
64
|
+
* key: the unit whose chat a press on the line opens (the program, or the product).
|
|
65
|
+
* A product group sums its product and project units. Zero is silence: '' when nothing was done and nothing waits. A failed run counts
|
|
66
|
+
* under done; its reasons go in the line's title, never as the PM's work. */
|
|
67
|
+
export function unitLineOf(D, keys) {
|
|
68
|
+
const U = (D && D.desk && D.desk.units) || {};
|
|
69
|
+
let done = 0, forYou = 0; const failed = [];
|
|
70
|
+
for (const k of keys) { const u = U[k]; if (!u) continue; done += u.done || 0; forYou += u.forYou || 0; failed.push(...(u.failed || [])); }
|
|
71
|
+
const line = [done ? done + ' done' : '', forYou ? forYou + ' for you' : ''].filter(Boolean).join(' · ');
|
|
72
|
+
return line ? { key: keys[0], line, why: failed.length ? failed.length + ' did not finish: ' + failed.map((f) => (f.ini ? f.ini + ', ' : '') + f.why).join('; ') : '' } : null;
|
|
73
|
+
}
|
|
63
74
|
export function productsOf(D) {
|
|
64
75
|
const out = [];
|
|
65
76
|
const b = D.board && D.board.board;
|
|
@@ -204,7 +215,7 @@ export function programGroups(D, groups, products, o, now) {
|
|
|
204
215
|
const msRow = msSub ? { id: 'ms:' + pr.id, kind: 'msreview', program: pr.id, name: pr.title, hint: msSub, state: 'needs' } : null;
|
|
205
216
|
// the program's own chats sit in its header's pill, as a product's do, never under "Not in an initiative" (Wawan, 2026-11-02, batch 22 item 17)
|
|
206
217
|
const kids = (D.sessions || []).filter((s) => listed(s) && isProgramChat(keyOfSession(s), pr.id)).map((s) => sessionRow(s, D.desk && D.desk.roles)).sort((a, b) => (RANK[b.state] || 0) - (RANK[a.state] || 0));
|
|
207
|
-
out.push({ key: 'g:' + pr.id, kind: 'program', program: pr, st, name: pr.title, subs, inis, rest: [], tasks, count: inis.length, turnN, msRow, kids,
|
|
218
|
+
out.push({ key: 'g:' + pr.id, kind: 'program', program: pr, unitLine: unitLineOf(D, ['program:' + pr.id]), st, name: pr.title, subs, inis, rest: [], tasks, count: inis.length, turnN, msRow, kids,
|
|
208
219
|
yours: inis.reduce((n, x) => n + x.yours, 0) + tasks.filter((t) => t.mine && t.late).length + (msRow ? 1 : 0) + kids.filter((k) => k.state === 'needs' || k.state === 'blocked').length, late: inis.some((x) => x.late) || tasks.some((t) => t.late),
|
|
209
220
|
products: st.products, closedLine: closedOf(inis.length, turnN) });
|
|
210
221
|
}
|
|
@@ -278,7 +289,8 @@ export function homeList(D, o = {}) {
|
|
|
278
289
|
const shown = inis.filter((x) => x.turn);
|
|
279
290
|
// the product's own chats (its heading's chat and its new sessions) sit in the header's pill, as an initiative's sit in its row's
|
|
280
291
|
const kids = (D.sessions || []).filter((s) => listed(s) && isProductChat(keyOfSession(s), p)).map((s) => sessionRow(s, D.desk && D.desk.roles)).sort((a, b) => (RANK[b.state] || 0) - (RANK[a.state] || 0));
|
|
281
|
-
|
|
292
|
+
const unitLine = unitLineOf(D, p.ws ? ['product:' + p.ws, 'project:' + p.ws] : []);
|
|
293
|
+
groups.push({ key: 'p:' + p.key, kind: 'product', product: p, unitLine, name: p.name, kids, initials: p.initials, tone: p.tone, primary: !!p.primary, goals: p.goals, flat, inis: shown, rest: inis.filter((x) => !shown.includes(x)),
|
|
282
294
|
count: inis.length, turnN, yours: inis.reduce((n, x) => n + x.yours, 0) + flat.length + kids.filter((k) => k.state === 'needs' || k.state === 'blocked').length, late: inis.some((x) => x.late), closedLine: [inis.length ? plural(inis.length, 'initiative', 'initiatives') : '', turnN ? turnN + ' your turn' : ''].filter(Boolean).join(' · ') || 'Nothing open' });
|
|
283
295
|
}
|
|
284
296
|
// programs first (program-hierarchy P3): each program takes its initiatives out of their product groups, so an initiative shows once
|
|
@@ -166,6 +166,9 @@ function iniHtml(r, o, po) {
|
|
|
166
166
|
const dots = (g) => (g.goals && g.goals.n ? `<span class="hv-gd" role="img" aria-label="${esc(g.goals.text)}">${g.goals.dots.map((ok) => `<i${ok ? '' : ' class="off"'}></i>`).join('')}</span>` : '');
|
|
167
167
|
const nd = (g) => (g.yours ? '<span class="hv-nd"></span>' : g.late ? '<span class="hv-nd am"></span>' : '');
|
|
168
168
|
const yoursWords = (g) => (g.yours ? (g.yours === 1 ? '1 is yours' : g.yours + ' are yours') : '');
|
|
169
|
+
// chief-unit-owners ✦2: the group owner's one line from today's brief ("3 done · 1 for you"); nothing when it has nothing to say.
|
|
170
|
+
// Addendum (Wawan 2026-11-18 12:32 SGT): it sits under the group's name, folded or open, and a press opens the unit's own chat.
|
|
171
|
+
const unitHtml = (g) => (g.unitLine ? `<button type="button" class="hv-unit" data-hm-unit="${esc(g.unitLine.key)}" aria-label="${esc(g.name)}: ${esc(g.unitLine.line)}. Open its chat"${g.unitLine.why ? ` title="${esc(g.unitLine.why)}"` : ''}>${esc(g.unitLine.line)}</button>` : '');
|
|
169
172
|
function productHtml(g, o) {
|
|
170
173
|
const open = o.pOpen(g);
|
|
171
174
|
// open: the goal dots; folded: the tile's dot says something in it is yours (blue) or late (amber). No counts in words (HvAC)
|
|
@@ -175,8 +178,8 @@ function productHtml(g, o) {
|
|
|
175
178
|
+ `<span class="hv-tl t${g.tone}" aria-hidden="true" data-cz-rail-tile="${esc(g.key)}" data-cz-rail-name="${esc(g.name)}"${o.here === g.key ? ' data-cz-rail-here' : ''}>${esc(g.initials)}${open ? '' : nd(g)}</span><b>${esc(g.name)}</b></button>${prodPillHtml(g, o)}`
|
|
176
179
|
+ `<button type="button" class="hv-pf" data-hm-pg="${esc(g.key)}" aria-expanded="${open}" aria-label="${esc(say)}. ${open ? 'Close' : 'Open'} the group">${open ? dots(g) : ''}<span class="hv-cv">${svg(open ? P.chevD : P.chevR, 16)}</span></button>${prodPopHtml(g, o)}</div>`;
|
|
177
180
|
const sec = `<section class="hm-pg hv-g" aria-label="${esc(g.name)}" data-po-id="${esc(prodKey(g.name))}">${SO.gripHtml(g.name)}`;
|
|
178
|
-
if (!open) return `${sec}${head}</section>`;
|
|
179
|
-
return `${sec}${head}<div class="hv-card">${productBody(g, o, true)}</div></section>`;
|
|
181
|
+
if (!open) return `${sec}${head}${unitHtml(g)}</section>`;
|
|
182
|
+
return `${sec}${head}${unitHtml(g)}<div class="hv-card">${productBody(g, o, true)}</div></section>`;
|
|
180
183
|
}
|
|
181
184
|
/** A fold line under a group (home-nav-rows-with-a-call): "N more" (· N running) opens the folded rows in place, "Fewer" folds them back. */
|
|
182
185
|
function foldHtml(key, F) {
|
|
@@ -211,11 +214,11 @@ function programHtml(g, o) {
|
|
|
211
214
|
+ `<span class="hv-tl tp" aria-hidden="true" data-cz-rail-tile="${esc(g.key)}" data-cz-rail-name="${esc(g.name)}"${o.here === g.key ? ' data-cz-rail-here' : ''}>${svg(P.layers, 16)}${open ? '' : nd(g)}</span><b>${esc(g.name)}</b></button>${prodPillHtml(g, o)}${open && g.st ? sugHtml(g.program, g.st) : ''}`
|
|
212
215
|
+ `<button type="button" class="hv-pf" data-hm-pg="${esc(g.key)}" aria-expanded="${open}" aria-label="${esc(g.name)}. ${esc(line)}${g.yours ? '. ' + yoursWords(g) : ''}. ${open ? 'Close' : 'Open'} the group">${ms}<span class="hv-cv">${svg(open ? P.chevD : P.chevR, 16)}</span></button>${prodPopHtml(g, o)}</div>`;
|
|
213
216
|
const sec = `<section class="hm-pg hv-g prg" aria-label="${esc(g.name)}" data-po-id="g:${esc(g.program.id)}">${SO.gripHtml(g.name)}`;
|
|
214
|
-
if (!open) return `${sec}${head}</section>`;
|
|
217
|
+
if (!open) return `${sec}${head}${unitHtml(g)}</section>`;
|
|
215
218
|
// the program's tasks are on its panel (On the program), not on Home: Home lists no tasks (Wawan, 2026-10-25)
|
|
216
219
|
// a product's sub-heading only when the program's rows on Home come from two or more products (batch 12 item 6): one product repeated
|
|
217
220
|
// under every program said nothing
|
|
218
|
-
return `${sec}${head}<div class="hv-card">${programBody(g, o, true)}</div></section>`;
|
|
221
|
+
return `${sec}${head}${unitHtml(g)}<div class="hv-card">${programBody(g, o, true)}</div></section>`;
|
|
219
222
|
}
|
|
220
223
|
/** The next milestone in a program's header: its diamond and date, then one small diamond per initiative it waits on. */
|
|
221
224
|
function msHtml(g) {
|
package/workspace/server.js
CHANGED
|
@@ -3081,6 +3081,21 @@ const teamRuns = require('./lib/team-runs.js').create({
|
|
|
3081
3081
|
warn: (what, e) => warnWriteFail(what, e),
|
|
3082
3082
|
});
|
|
3083
3083
|
const teamTick = () => { try { teamRuns.tick({}); } catch (e) { warnWriteFail('team tick', e); } };
|
|
3084
|
+
// chief-unit-owners ✦1 ✦2 (Wawan 2026-11-18 "Build now", doc GCFCo233wHawPk7Ypjba4J): every initiative has ONE owner unit, derived (its program,
|
|
3085
|
+
// else its product, or project work), and each unit's owner is a record with a daily tick that writes one brief (lib/unit-owner.js). No new
|
|
3086
|
+
// session and no model call: the tick folds the workers' ledgers. lib/units.js stamp() puts the unit on every new team, driver and goal-loop line.
|
|
3087
|
+
const unitsHost = require('./lib/units-host.js').create({
|
|
3088
|
+
workspaces: () => [...workspaces.values()],
|
|
3089
|
+
stateDirFor: (w) => (isPlanNeedsTree(w) ? stateDirFor(w) : null),
|
|
3090
|
+
homeDir: () => { const h = homeWorkspace(); return h && isPlanNeedsTree(h) ? stateDirFor(h, { create: true }) : null; },
|
|
3091
|
+
programs: () => require('./lib/routes-programs.js').all(msReviewCtx()),
|
|
3092
|
+
rowsOf: (w) => { if (!isPlanNeedsTree(w)) return []; const r = require('./lib/routes-boards.js').baseRows(w); return r && r.pending ? null : r && r.ok ? r.rows : []; }, // null: still being read
|
|
3093
|
+
runtimeDir: STATE,
|
|
3094
|
+
memoryRoot: () => { const h = homeWorkspace(); return h ? h.root : null; },
|
|
3095
|
+
promote: (unit) => require('./lib/unit-memory.js').promote(unitsHost, unit),
|
|
3096
|
+
});
|
|
3097
|
+
require('./lib/units.js').setResolver((x) => unitsHost.resolve(x));
|
|
3098
|
+
const ownerTick = () => { try { unitsHost.tick({}); } catch (e) { warnWriteFail('unit owner tick', e); } };
|
|
3084
3099
|
// batch 15 item 1 (canvas Iq8Suggest and Iq9Draft): Claude drafts metrics without being asked (lib/metric-draft-runs.js): a product with no North
|
|
3085
3100
|
// Star, a program charter with no goal, an initiative that gets a PRD with no success metric, and next quarter's key results. The run's only
|
|
3086
3101
|
// write is `pmos metrics draft`; the PM's ✓ keep writes the kr-metrics record. At most 2 at once, once per scope. PMOS_METRIC_DRAFT=off.
|
|
@@ -3396,6 +3411,7 @@ bgQueue.register('forecast', () => forecastTick());
|
|
|
3396
3411
|
bgQueue.register('report-design', () => reportDesignTick());
|
|
3397
3412
|
bgQueue.register('report-structure', () => reportStructureTick());
|
|
3398
3413
|
bgQueue.register('team', () => teamTick());
|
|
3414
|
+
bgQueue.register('owner', () => ownerTick()); // chief-unit-owners ✦2: one brief a day per unit (lib/unit-owner.js)
|
|
3399
3415
|
bgQueue.register('scan', (turn) => gated('scan', () => scanTick(turn))());
|
|
3400
3416
|
// idle lab build E (lib/idle-lab-engine.js): while the PM is away Claude prototypes and scans for the initiatives, proves each result (a
|
|
3401
3417
|
// specimen renders in a headless browser; every claim quotes what was read, through lib/ai-guard.js) and files it under the ✦. Step 5 of the
|
|
@@ -4714,6 +4730,13 @@ function learnConnectorTools(env, tools) {
|
|
|
4714
4730
|
} catch (e) { warnWriteFail('connector tools', e); }
|
|
4715
4731
|
}
|
|
4716
4732
|
|
|
4733
|
+
/** The memory scopes a run reads (lib/units.js): its initiative and the unit that owns it; none for a run on no initiative. */
|
|
4734
|
+
function memoryScopeOf(base) {
|
|
4735
|
+
const ini = base && base.initiative ? String(base.initiative) : null;
|
|
4736
|
+
if (!ini) return {};
|
|
4737
|
+
const u = require('./lib/units.js').resolve({ ws: base.ws, ini });
|
|
4738
|
+
return { ini, unit: u ? require('./lib/units.js').keyOf(u) : null };
|
|
4739
|
+
}
|
|
4717
4740
|
function startHeadless(base, workdir, kind, launchArgs, env, initialInput, addDirs, onDone, writePaths) {
|
|
4718
4741
|
const prompt = safeFirstInput(String(initialInput).replace(/\r+$/, ''));
|
|
4719
4742
|
// report-design-studio: writePaths names the one render file a report-design run may write; for a skill run, the folders it may write in (lib/headless.js ignores it for every other kind).
|
|
@@ -4725,7 +4748,8 @@ function startHeadless(base, workdir, kind, launchArgs, env, initialInput, addDi
|
|
|
4725
4748
|
budgetUsd: !env ? null : kind === 'grill' ? env.PMOS_GRILL_BUDGET : kind === 'lab-proto' || kind === 'lab-scan' ? env.PMOS_LAB_BUDGET : null,
|
|
4726
4749
|
connectorTools: headlessLib.CONNECTOR_READ_KINDS.includes(kind) ? knownConnectorTools(env) : [],
|
|
4727
4750
|
team: kind === 'team' && env ? { role: env.PMOS_TEAM_ROLE, mode: env.PMOS_TEAM_MODE } : null,
|
|
4728
|
-
|
|
4751
|
+
// chief-unit-owners ✦4: a run on an initiative reads the workspace scope, its unit's lessons and its own, never another unit's
|
|
4752
|
+
memory: headlessLib.memoryNote([workdir, ...(Array.isArray(addDirs) ? addDirs : [])], env, memoryScopeOf(base)) });
|
|
4729
4753
|
const s = { ...base, cwd: workdir, state: 'working', pty: null, tmux: null, headless: kind, child: null, ...(lean ? { lean: true } : {}),
|
|
4730
4754
|
note: '', buf: '', cols: 80, rows: 24, clients: new Set(), created: nowISO(), lastOutputAt: Date.now() };
|
|
4731
4755
|
const say = (text) => {
|
|
@@ -10920,6 +10944,7 @@ async function handleRequest(req, res) {
|
|
|
10920
10944
|
runtimeDir: STATE, claudeSetup, registerWorkspace, pickFolder, broadcast, workspaceList: () => [...workspaces.values()], homeRoot: HOME_ENABLED ? SELF_ROOT : null, spawnSession, jevModelOpts, sendToSession, endSupersededRuns, proSettings,
|
|
10921
10945
|
// premium-chat-session: every premium chat panel is an interactive Claude Code session the PM talks to (text as typed, `/` kept)
|
|
10922
10946
|
chatSessions,
|
|
10947
|
+
unitsHost, // chief-unit-owners: GET /api/units, the chief's `pmos owner brief`, Home's group lines (lib/routes-units.js)
|
|
10923
10948
|
// batch 20 item 13: "grill this" in an initiative's chat starts Claude's grill run at once (lib/grill-runs.js start, why 'ask')
|
|
10924
10949
|
grillStart: (o) => grillRuns.start(o),
|
|
10925
10950
|
// report-workspace: the schedule store a recurring report registers its draft-only schedule in, a skill's body, and the stop of a headless run
|