create-pmos 0.547.0 → 0.549.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 -57
- package/payload/KIT-VERSION +2 -2
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/payload/state/log.md +1 -1
- package/workspace/changelog.json +26 -0
- package/workspace/guide/home.md +9 -4
- package/workspace/guide/programs.md +2 -0
- package/workspace/guide/settings-and-switches.md +15 -1
- package/workspace/lib/artefacts.js +49 -0
- package/workspace/lib/autonomy.js +107 -9
- package/workspace/lib/board-pack-route.js +5 -0
- package/workspace/lib/board-pack.js +7 -1
- package/workspace/lib/driver-decide.js +6 -1
- package/workspace/lib/routes-artefacts.js +40 -1
- package/workspace/lib/routes-autonomy.js +65 -8
- package/workspace/lib/routes-proposals.js +1 -1
- package/workspace/lib/settings-store.js +5 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-board.css +6 -0
- package/workspace/public/pm/cozy-ev.css +5 -0
- package/workspace/public/pm/cozy-settings.js +47 -4
- package/workspace/public/pm/cozy-today.css +7 -0
- package/workspace/public/pm/good-morning.js +73 -14
- package/workspace/public/pm/home-app.js +24 -10
- package/workspace/public/pm/home-day.js +11 -6
- package/workspace/public/pm/ini-agent.js +164 -0
- package/workspace/public/pm/ini-view.css +32 -3
- package/workspace/public/pm/ini-view.js +25 -2
- package/workspace/public/pm/move-rank.js +6 -3
- package/workspace/public/pm/readonly.js +18 -0
- package/workspace/public/pm/story.css +8 -0
- package/workspace/public/pm/story.js +39 -0
- package/workspace/skills/report-weekly.skill +2 -1
- package/workspace/stage-card-tasks-test.js +3 -0
- package/workspace/test-lists/agent-run-workspace.json +9 -0
|
@@ -3,7 +3,15 @@
|
|
|
3
3
|
*
|
|
4
4
|
* GET /api/artefacts?ws&scope → { ok, ws, scope, kind, artefacts: [{ key, title, owner, for, labels, fields, carried, empty }] }
|
|
5
5
|
* scope: portfolio (default), board:<id>, goal:<id>, experiment:<id> (initiative:<id> is an alias)
|
|
6
|
+
* GET /api/artefacts/story?ws → { ok, ws, story: { scope, at, lines: [{ text, sources }] } | null } "The story so far" on the product
|
|
7
|
+
* page (board AwE): the Narrative of board:<ws>, else of the portfolio (lib/artefacts.js storyOf). A shared
|
|
8
|
+
* Board carries it without the sources (lib/board-pack.js).
|
|
9
|
+
* GET /api/artefacts/lessons → { ok, lessons: [{ ws, product, scope, text, at }] } every product's Lessons, newest first, at most 20
|
|
10
|
+
* (Settings › Claude, board AwG2)
|
|
6
11
|
* GET /api/artefacts/map → { ok, artefacts, rows: [{ from, name, artefact, field, note }] } what every older shape became
|
|
12
|
+
* POST /api/artefacts/set { ws, scope, artefact, field, text } → { ok, line } the PM edits one line from the Viewer (board AwB: "You edit
|
|
13
|
+
* any line"). A page press (pm-guard requirePagePress); the actor is the PM, so Claude asks before it
|
|
14
|
+
* changes that line again (lib/artefacts.js pmEdited, lib/driver-decide.js autoApply).
|
|
7
15
|
*
|
|
8
16
|
* THE MIGRATION. Every read of a repository carries its older records (core documents, kept driver proposals,
|
|
9
17
|
* report drafts) under their artefacts: lib/artefacts.js migrateRepo. It is idempotent and only appends pointers; nothing is deleted or
|
|
@@ -24,9 +32,40 @@ const pageBy = (x) => (x && x.by ? { ...x, by: actorLib.pageName(x.by) } : x);
|
|
|
24
32
|
|
|
25
33
|
async function handle(req, res, url, ctx) {
|
|
26
34
|
const send = (status, body) => { ctx.json(res, body, status); return true; };
|
|
27
|
-
if (req.method !== 'GET') return send(405, { ok: false, error: 'the artefacts are read here; agents write them through the driver' });
|
|
28
35
|
const sub = url.pathname.replace(/^\/api\/artefacts\/?/, '');
|
|
36
|
+
if (sub === 'set' && req.method === 'POST') {
|
|
37
|
+
const read = await ctx.readJson(req);
|
|
38
|
+
if (!read.ok) return send(400, { ok: false, error: 'the body is not JSON' });
|
|
39
|
+
const b = read.body || {};
|
|
40
|
+
const g = require('./pm-guard.js').requirePagePress(req, b);
|
|
41
|
+
if (!g.ok) return send(g.status, { ok: false, error: g.error });
|
|
42
|
+
if (!/^pm:/.test(String((g.actor && g.actor.by) || ''))) return send(403, { ok: false, error: 'the Viewer edits a line for the PM; agents propose through the driver' });
|
|
43
|
+
const w = wsOf(ctx, typeof b.ws === 'string' ? b.ws : '');
|
|
44
|
+
if (!w || !w.root) return send(404, { ok: false, error: 'no such workspace' });
|
|
45
|
+
let dir;
|
|
46
|
+
try { dir = A.dirOf(w.root); } catch (e) { return send(409, { ok: false, error: String((e && e.message) || e) }); }
|
|
47
|
+
const r = A.set(A.file(dir), { scope: b.scope, artefact: b.artefact, field: b.field, text: typeof b.text === 'string' ? b.text : '' }, g.actor);
|
|
48
|
+
return r.ok ? send(200, { ok: true, line: pageBy(r.line) }) : send(r.status, { ok: false, error: r.error });
|
|
49
|
+
}
|
|
50
|
+
if (req.method !== 'GET') return send(405, { ok: false, error: 'the artefacts are read here; the PM edits a line with POST /api/artefacts/set' });
|
|
29
51
|
if (sub === 'map') return send(200, { ok: true, artefacts: A.KEYS, rows: require('./artefacts-cli.js').mapRows() });
|
|
52
|
+
if (sub === 'lessons') {
|
|
53
|
+
const out = [];
|
|
54
|
+
for (const w of (ctx.workspaceList ? ctx.workspaceList() : []).filter((x) => x && x.root && !x.linked)) {
|
|
55
|
+
let dir; try { dir = A.dirOf(w.root); } catch { continue; }
|
|
56
|
+
for (const l of A.lessonsOf(A.fold(A.readLines(A.file(dir))))) out.push({ ws: w.id, product: w.label || w.name || w.id, scope: l.scope, text: l.text, at: l.at });
|
|
57
|
+
}
|
|
58
|
+
out.sort((a, b) => String(b.at).localeCompare(String(a.at)));
|
|
59
|
+
return send(200, { ok: true, lessons: out.slice(0, 20) });
|
|
60
|
+
}
|
|
61
|
+
if (sub === 'story') {
|
|
62
|
+
const w = wsOf(ctx, url.searchParams.get('ws'));
|
|
63
|
+
if (!w || !w.root) return send(404, { ok: false, error: 'no such workspace' });
|
|
64
|
+
let dir;
|
|
65
|
+
try { dir = A.dirOf(w.root); } catch (e) { return send(409, { ok: false, error: String((e && e.message) || e) }); }
|
|
66
|
+
const scopes = (A.parseScope('board:' + w.id) ? ['board:' + w.id] : []).concat('portfolio');
|
|
67
|
+
return send(200, { ok: true, ws: w.id, story: A.storyOf(A.fold(A.readLines(A.file(dir))), scopes) });
|
|
68
|
+
}
|
|
30
69
|
if (sub) return send(404, { ok: false, error: 'no such artefacts route' });
|
|
31
70
|
const q = url.searchParams;
|
|
32
71
|
const w = wsOf(ctx, q.get('ws'));
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/* routes-autonomy.js — what agents did by themselves, and its Undo (D106, "Full autonomy now").
|
|
3
3
|
*
|
|
4
|
-
* GET /api/autonomy?ws → { ok, ws, done: [change], notices: [demotion] }
|
|
5
|
-
* change: { ref, job, title, cls, at, undo_until } the changes agents applied by themselves in the last 14 days that
|
|
6
|
-
* newest first: the Done group
|
|
4
|
+
* GET /api/autonomy?ws → { ok, ws, done: [change], notices: [demotion], failed: [run] }
|
|
5
|
+
* change: { ref, job, title, cls, way, at, undo_until, ini, reason } way: quiet | show (lib/autonomy.js: show draws first) the changes agents applied by themselves in the last 14 days that
|
|
6
|
+
* nobody undid, newest first: the Done group ("Claude did" on Your day, "Claude's work" in the Viewer; agent-run workspace, boards
|
|
7
|
+
* AwA and AwB). title is said as an act ("Wrote the problem: …"); reason is lib/autonomy.js reasonOf, one line.
|
|
8
|
+
* notices: the jobs that fell back to propose and Home has not said so yet (say it once).
|
|
9
|
+
* failed: the agent runs of the last 7 days that ended with an error and that no later run of the same target answered:
|
|
10
|
+
* { run, ini, at, why, source: 'driver' | 'team' }, newest first. Requirement R4: a failure is never the PM's work; it is one amber
|
|
11
|
+
* line where the work is.
|
|
7
12
|
* POST /api/autonomy/undo { ws, ref } → { ok, back, demoted? } Undo of one change: a Driver proposal (p-…) or a ✦ batch (pk-…)
|
|
8
13
|
* POST /api/autonomy/seen { ws, job, product, until } → { ok } Home said the demotion once
|
|
14
|
+
* GET /api/autonomy/kinds → { ok, kinds: [{ kind, label, made, kept, undone, auto, set, way, until }], showUntil }
|
|
15
|
+
* How Claude decides (Settings › Claude, boards AwG and AwG2), over every product's state folders: lib/autonomy.js kindsOf. The PM
|
|
16
|
+
* sets a kind's way with POST /api/settings { key: 'claude.ways', value: { kind: quiet | show | ask } }.
|
|
9
17
|
*
|
|
10
18
|
* Every POST passes pm-guard requirePagePress. An Undo is a correction (the north star) and a setback of its job (lib/autonomy.js).
|
|
11
19
|
*/
|
|
@@ -59,19 +67,68 @@ async function undoRef(ctx, w, ref, g) {
|
|
|
59
67
|
return bad(400, 'ref is a Driver proposal id (p-…) or a ✦ batch id (pk-…)');
|
|
60
68
|
}
|
|
61
69
|
|
|
70
|
+
/* the Driver's kinds said as an act: "problem: Scarlet tickets lack…" reads "Wrote the problem: Scarlet tickets lack…" */
|
|
71
|
+
const ACT = { problem: 'Wrote the problem', evidence: 'Added evidence', sizing: 'Sized it', assumption: 'Wrote an assumption', stakeholders: 'Named the people',
|
|
72
|
+
move: 'Moved it', note: 'Added a note', doc: 'Drafted a document', overlap: 'Noted an overlap', artefact: 'Wrote the experiment', 'next-step': 'Set the next step', 'follow-up': 'Set a follow-up' };
|
|
73
|
+
function sayOf(a) {
|
|
74
|
+
const m = /^driver:([a-z-]+)$/.exec(String(a.job || ''));
|
|
75
|
+
const t = String(a.title || '').trim();
|
|
76
|
+
if (!m || !ACT[m[1]]) return t;
|
|
77
|
+
const rest = t.startsWith(m[1] + ': ') ? t.slice(m[1].length + 2) : t;
|
|
78
|
+
return rest ? ACT[m[1]] + ': ' + rest : ACT[m[1]];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** The runs that stopped (R4): the Driver's runs (run-end ok false) and the role agents' steps (state failed) of the last `days` days whose
|
|
82
|
+
* target no later run answered. Never throws: an unreadable ledger is no failure to show. */
|
|
83
|
+
function failedOf(w, dirs, { now = Date.now(), days = 7 } = {}) {
|
|
84
|
+
const since = now - days * DAY, out = [];
|
|
85
|
+
try {
|
|
86
|
+
const stateDir = D.stateDirOf(w.root);
|
|
87
|
+
const file = stateDir ? D.ledgerFile(stateDir) : null;
|
|
88
|
+
if (file) {
|
|
89
|
+
const runs = [...D.fold(D.readLines(file)).runs.values()].filter((r) => r.end && r.target);
|
|
90
|
+
const lastOk = new Map();
|
|
91
|
+
for (const r of runs) if (r.ok) { const k = r.target.id; if (!lastOk.has(k) || r.end > lastOk.get(k)) lastOk.set(k, r.end); }
|
|
92
|
+
for (const r of runs) {
|
|
93
|
+
if (r.ok || Date.parse(r.end) < since) continue;
|
|
94
|
+
if (lastOk.has(r.target.id) && lastOk.get(r.target.id) > r.end) continue;
|
|
95
|
+
out.push({ run: r.run, ini: r.target.kind === 'initiative' ? r.target.id : null, at: r.end, why: r.reason || '', source: 'driver' });
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
} catch { /* no driver ledger */ }
|
|
99
|
+
try {
|
|
100
|
+
const TR = require('./team-runs.js');
|
|
101
|
+
for (const d of dirs) {
|
|
102
|
+
const steps = TR.fold(TR.read(d)).steps;
|
|
103
|
+
for (const s of steps) {
|
|
104
|
+
if (s.state !== 'failed' || Date.parse(s.at) < since) continue;
|
|
105
|
+
if (steps.some((x) => x.state === 'done' && x.ini === s.ini && x.role === s.role && String(x.at) > String(s.at))) continue;
|
|
106
|
+
out.push({ run: s.id, ini: s.ini || null, at: s.at, why: s.why || '', source: 'team' });
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
} catch { /* no team ledger */ }
|
|
110
|
+
return out.sort((a, b) => String(b.at).localeCompare(String(a.at)));
|
|
111
|
+
}
|
|
112
|
+
|
|
62
113
|
async function handle(req, res, url, ctx) {
|
|
63
114
|
const send = (r) => { ctx.json(res, r.body, r.status); return true; };
|
|
64
115
|
const sub = url.pathname.replace(/^\/api\/autonomy\/?/, '');
|
|
65
116
|
if (sub === '' && req.method === 'GET') {
|
|
66
117
|
const w = wsOf(ctx, url.searchParams.get('ws'));
|
|
67
118
|
if (!w) return send(bad(404, 'no such workspace'));
|
|
68
|
-
const done = [], notices = [];
|
|
69
|
-
for (const d of
|
|
70
|
-
for (const a of A.done(d)) done.push({ ref: a.ref, job: a.job, title: a
|
|
119
|
+
const done = [], notices = [], dirs = dirsOf(ctx, w);
|
|
120
|
+
for (const d of dirs) {
|
|
121
|
+
for (const a of A.done(d, { settingsDir: ctx.runtimeDir || null })) done.push({ ref: a.ref, job: a.job, title: sayOf(a), cls: a.cls, way: a.way, at: a.at, undo_until: new Date(Date.parse(a.at) + A.UNDO_DAYS * DAY).toISOString(), ini: a.ini || null, reason: a.reason });
|
|
71
122
|
for (const n of A.notices(d)) notices.push(n);
|
|
72
123
|
}
|
|
73
124
|
done.sort((a, b) => Date.parse(b.at) - Date.parse(a.at));
|
|
74
|
-
return send({ status: 200, body: { ok: true, ws: w.id, done, notices } });
|
|
125
|
+
return send({ status: 200, body: { ok: true, ws: w.id, done, notices, failed: failedOf(w, dirs) } });
|
|
126
|
+
}
|
|
127
|
+
if (sub === 'kinds' && req.method === 'GET') {
|
|
128
|
+
const list = (ctx.workspaceList ? ctx.workspaceList() : []).filter((w) => w && w.root && !w.linked);
|
|
129
|
+
const dirs = [];
|
|
130
|
+
for (const w of list) for (const d of dirsOf(ctx, w)) if (!dirs.includes(d)) dirs.push(d);
|
|
131
|
+
return send({ status: 200, body: { ok: true, kinds: A.kindsOf(dirs, { settingsDir: ctx.runtimeDir || null }), showUntil: A.SHOW_UNTIL } });
|
|
75
132
|
}
|
|
76
133
|
if (sub !== 'undo' && sub !== 'seen') return send(bad(404, 'no such autonomy route'));
|
|
77
134
|
if (req.method !== 'POST') return send(bad(405, 'POST only'));
|
|
@@ -92,4 +149,4 @@ async function handle(req, res, url, ctx) {
|
|
|
92
149
|
return send({ status: 200, body: { ok: true } });
|
|
93
150
|
}
|
|
94
151
|
|
|
95
|
-
module.exports = { prefixes: ['/api/autonomy'], handle, undoRef };
|
|
152
|
+
module.exports = { prefixes: ['/api/autonomy'], handle, undoRef, failedOf, sayOf };
|
|
@@ -154,7 +154,7 @@ function autoKeep(ctx, w, { modeOf = () => 'auto', now } = {}) {
|
|
|
154
154
|
if (!d.apply) { out.held++; continue; }
|
|
155
155
|
try {
|
|
156
156
|
const r = keepCore(ctx, p, g, f, ini, [x], {}, { auto: true, group: x.group });
|
|
157
|
-
A.recordApplied(dir, { job: `propose:${x.group}`, product: w.id, ref: r.batch, title: x.title || x.why || x.group, cls }, { now });
|
|
157
|
+
A.recordApplied(dir, { job: `propose:${x.group}`, product: w.id, ref: r.batch, title: x.title || x.why || x.group, cls, ini, why: x.title && x.why && x.why !== x.title ? x.why : '' }, { now });
|
|
158
158
|
out.applied.push({ ini, batch: r.batch, group: x.group, title: x.title || x.why || '' });
|
|
159
159
|
} catch { out.held++; }
|
|
160
160
|
}
|
|
@@ -105,6 +105,9 @@ const DEFS = Object.freeze({
|
|
|
105
105
|
// `pmos ai off [job]` and `pmos ai on [job]` set them; PMOS_AI=off wins over both.
|
|
106
106
|
'ai.on': bool('checks', 'computer', true),
|
|
107
107
|
'ai.off': { section: 'checks', scope: 'computer', type: 'jobs', max: 40, def: [] },
|
|
108
|
+
// Settings › Claude › How Claude decides (lib/autonomy.js KIND_LIST): the way the PM set for a kind of change, { kind: quiet | show | ask }.
|
|
109
|
+
// A kind left out follows the automatic way. The PM's way wins over it, a demotion included.
|
|
110
|
+
'claude.ways': { section: 'claude', scope: 'computer', type: 'ways', max: 30, def: {} },
|
|
108
111
|
});
|
|
109
112
|
|
|
110
113
|
/* The environment variables that win over a setting, here or in a setting's own store. `key` names the setting the page
|
|
@@ -168,6 +171,8 @@ function validate(key, value) {
|
|
|
168
171
|
}
|
|
169
172
|
// ['*'] alone is every workspace (the product picker's All, lib/briefing-premium-products.js)
|
|
170
173
|
case 'ids': return value === null || Array.isArray(value) && (value.length === 1 && value[0] === '*' || value.length <= d.max && value.every((x) => typeof x === 'string' && WS_ID.test(x)) && new Set(value).size === value.length) ? null : `${key} must list at most ${d.max} workspace ids, each once, or ['*'] for every one`;
|
|
174
|
+
case 'ways': return value && typeof value === 'object' && !Array.isArray(value) && Object.keys(value).length <= d.max
|
|
175
|
+
&& Object.entries(value).every(([k, v]) => /^[a-z][a-z-]{1,30}$/.test(k) && ['quiet', 'show', 'ask'].includes(v)) ? null : `${key} must map at most ${d.max} kinds of change to quiet, show or ask`;
|
|
171
176
|
case 'jobs': return Array.isArray(value) && value.length <= d.max && value.every((x) => typeof x === 'string' && /^[a-z][a-z0-9-]{1,40}$/.test(x)) && new Set(value).size === value.length ? null : `${key} must list at most ${d.max} job ids, each once`;
|
|
172
177
|
// Dress for the day (pm/cozy-seasons.js): a day's key is its charm key, as in DAYS there
|
|
173
178
|
case 'country': return value === '' || typeof value === 'string' && /^[A-Z]{2}$/.test(value) ? null : `${key} must be a two-letter country code, or empty for this computer's`;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.549.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.549.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -1517,6 +1517,12 @@ span.tg-ng { cursor: default; }
|
|
|
1517
1517
|
/* the shared-by line ends with two quiet icons, Open in my PMOS and Get PMOS; the tabs of a link of several picks sit under it (batch 27 items 1 to 3) */
|
|
1518
1518
|
.ro-by { display: flex; align-items: center; gap: 8px; }
|
|
1519
1519
|
.ro-by .ro-txt { flex: 1; min-width: 0; }
|
|
1520
|
+
/* "The story so far" above the timeline (board AwF, pm/readonly.js storyOf): the product page's story, no sources */
|
|
1521
|
+
.ro-story { margin: 12px 18px 16px; padding: 16px 20px 18px; border-radius: 18px; background: var(--cz-card); border: 1px solid var(--cz-hair); display: flex; flex-direction: column; gap: 8px; }
|
|
1522
|
+
.ro-story p { margin: 0; font-size: var(--fs-body); line-height: var(--lh-body); color: var(--cz-ink); }
|
|
1523
|
+
.ro-story p b, .ro-sth b { font-weight: var(--fw-strong); color: var(--cz-ink); }
|
|
1524
|
+
.ro-sth { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: var(--fs-row); }
|
|
1525
|
+
.ro-sth small { font-size: var(--fs-label); color: var(--cz-ink3); }
|
|
1520
1526
|
.ro-ways { display: inline-flex; gap: 4px; flex: none; }
|
|
1521
1527
|
.ro-way { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--cz-ink2); background: var(--cz-well); }
|
|
1522
1528
|
.ro-way:hover { color: var(--cz-ink); }
|
|
@@ -393,3 +393,8 @@
|
|
|
393
393
|
/* a quiet place (pm/quiet-place.js, onboarding B3 ObA4Gradual): one honest line instead of empty tables, until its moment comes */
|
|
394
394
|
.qp-on > :not(.qp-line) { display: none !important; }
|
|
395
395
|
.qp-line { margin: 18vh auto 0; max-width: 520px; padding: 0 16px; text-align: center; font-size: var(--fs-row); font-weight: var(--fw-strong); color: var(--cz-ink2); line-height: 1.5; }
|
|
396
|
+
/* Settings › Claude › How Claude decides and Lessons (boards AwG, AwG2): a lesson says what went wrong in amber, what changed in blue */
|
|
397
|
+
.cz .ev-lead { margin: 0 0 4px; }
|
|
398
|
+
.cz .ev-ls { display: flex; flex-direction: column; gap: 2px; }
|
|
399
|
+
.cz .ev-ls .ev-ms { color: var(--cz-late); }
|
|
400
|
+
.cz .ev-ls .ev-nx { color: var(--cz-blueink); }
|
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
* for Adler's leaf, the impact log and the weekly check; the page hears `pmos:impact`), Agents write to Jira (fixed: only after Commit).
|
|
6
6
|
* Extras at the bottom (UI grill U4, 2026-11-08: nine sections became five): "Adler ›" and "Jev and Laya ›" open each as a
|
|
7
7
|
* sub-panel inside General with the controls they had as sections, nothing removed (T.sub; ‹ goes back to General).
|
|
8
|
-
* Claude
|
|
8
|
+
* Claude How Claude decides (boards AwG, AwG2, agreed 2026-11-10): each kind of change Claude makes by itself, how many it made and you
|
|
9
|
+
* kept, and Quietly, Show me or Ask first (GET /api/autonomy/kinds; the PM's way is claude.ways, POST /api/settings). Then the
|
|
10
|
+
* five Always yours rows (the six calls that always wait) and Lessons (GET /api/artefacts/lessons, the D107 artefact). Then
|
|
11
|
+
* the Claude profile, the API key, and Sharpen prompts: suggestions after a reply, Sharpen as I type, the style and Your own rules
|
|
9
12
|
* (GET/POST /api/next-prompt/prefs; batch 26 item 2)
|
|
10
13
|
* › Checks (a heading inside Claude since U4; it was the section Claude’s checks) Grill by itself (Full, Only at stage exits, Off) and the monthly credit for checks with what this month used (grill.mode,
|
|
11
14
|
* grill.cap, POST /api/settings; GET /api/grill; canvas GrillEntry). At the cap Claude pauses and says so once here.
|
|
@@ -286,6 +289,43 @@ function weeks() {
|
|
|
286
289
|
const arc = old.length ? `<div class="ev-arc"><button type="button" class="ev-arcb" data-ev-arc aria-expanded="${T.arc}"><b>Archive</b><span class="ev-small ev-mut">${old.length} earlier ${old.length === 1 ? 'week' : 'weeks'}</span>${svg(ICON.down, 14)}</button>${T.arc ? rows : ''}</div>` : '';
|
|
287
290
|
return `<div class="ev-wk">${head}${weekTop(w)}${arc}</div>`;
|
|
288
291
|
}
|
|
292
|
+
/* Settings › Claude › How Claude decides (AwG): one row per kind of change Claude made by itself, with what it made and you kept and the way
|
|
293
|
+
* it acts now. Pressing the automatic way clears yours. Then Always yours (AwG2): the calls that never move without you. Then Lessons. */
|
|
294
|
+
const WAY = [['quiet', 'Quietly'], ['show', 'Show me'], ['ask', 'Ask first']];
|
|
295
|
+
const dayOf = (iso) => { const t = Date.parse(iso || ''); return Number.isFinite(t) ? new Date(t).toLocaleDateString('en-GB', { day: 'numeric', month: 'short' }) : ''; };
|
|
296
|
+
function kindSub(k, until) {
|
|
297
|
+
const made = k.made === 1 ? '1 made' : k.made + ' made', kept = k.kept === k.made ? (k.made === 1 ? 'you kept it' : 'you kept all') : k.kept ? 'you kept ' + k.kept : 'none kept yet';
|
|
298
|
+
const how = k.set ? 'You set this.' : k.auto === 'ask' ? 'Two Undos, so Claude asks first' + (k.until ? ' until ' + dayOf(k.until) : '') + '.'
|
|
299
|
+
: k.auto === 'quiet' ? 'Claude does these quietly.' : 'A new kind shows until you keep ' + until + '.';
|
|
300
|
+
return (k.made ? made + ', ' + kept + '. ' : '') + how;
|
|
301
|
+
}
|
|
302
|
+
const ALWAYS = [['Start a new request', 'Claude recommends. You decide.'], ['Say if it worked', 'The verdict on an outcome is yours.'], ['Send a message to people', 'Claude drafts. Only you send.'],
|
|
303
|
+
['Move what the team reads', 'Stages and dates in Jira or on the Board.'], ['Merge, delete or spend', '']];
|
|
304
|
+
function lessonRow(l) {
|
|
305
|
+
const [wrong, ...rest] = String(l.text || '').split(/\n+/); // a lesson's first line says what went wrong, the rest what changed
|
|
306
|
+
return `<div class="ev-trow"><div class="ev-tx ev-ls"><b>${esc([dayOf(l.at), l.product].filter(Boolean).join(' · '))}</b><p class="ev-small${rest.length ? ' ev-ms' : ''}">${esc(wrong)}</p>${rest.length ? `<p class="ev-small ev-nx">${esc(rest.join(' '))}</p>` : ''}</div></div>`;
|
|
307
|
+
}
|
|
308
|
+
function decidesSec() {
|
|
309
|
+
const K = T.ck;
|
|
310
|
+
const kinds = !K ? '<p class="ev-small ev-mut">Reading what Claude did by itself.</p>' : K.ok === false ? `<p class="ev-small ev-mut">What Claude did could not be read: ${esc(K.error || 'the server did not answer')}.</p>`
|
|
311
|
+
: !K.kinds.length ? '<p class="ev-small ev-mut">Claude has not changed anything by itself yet. Each kind of change shows here once it has.</p>'
|
|
312
|
+
: K.kinds.map((k) => trow(k.label, kindSub(k, K.showUntil || 3), seg(k.label, 'claude.way:' + k.kind, k.way, WAY))).join('');
|
|
313
|
+
const L = T.ls && T.ls.ok ? T.ls.lessons || [] : [];
|
|
314
|
+
return '<h4>How Claude decides</h4><p class="ev-small ev-mut ev-lead">Claude picks for each kind of change from what you kept and undid. Two Undos on a kind and it asks first for 7 days. You can set any kind yourself.</p>'
|
|
315
|
+
+ kinds + '<h4>Always yours</h4>' + ALWAYS.map(([b, p]) => trow(b, p, '<span class="ev-pill">Always asks</span>')).join('')
|
|
316
|
+
+ (L.length ? '<h4>Lessons</h4>' + L.slice(0, 8).map(lessonRow).join('') : '');
|
|
317
|
+
}
|
|
318
|
+
/** A press on a kind's way: the PM's way is kept, unless it is the automatic one (then the kind follows the automatic way again). */
|
|
319
|
+
async function saveWay(kind, v) {
|
|
320
|
+
const K = T.ck; if (!K || !K.ok) return;
|
|
321
|
+
const ways = {}; for (const k of K.kinds) if (k.set) ways[k.kind] = k.set;
|
|
322
|
+
const k = K.kinds.find((x) => x.kind === kind); if (!k) return;
|
|
323
|
+
if (v === k.auto) delete ways[kind]; else ways[kind] = v;
|
|
324
|
+
const r = await pmPost('/api/settings', { key: 'claude.ways', value: ways });
|
|
325
|
+
if (r && r.ok) { k.set = ways[kind] || null; k.way = v; }
|
|
326
|
+
T.msg = r && r.ok ? 'Saved. ' + k.label + ': ' + (v === 'ask' ? 'Claude asks you first.' : v === 'show' ? 'Claude does them and shows them first in Claude did.' : 'Claude does them quietly.') : (r && r.error) || 'Not saved.';
|
|
327
|
+
draw();
|
|
328
|
+
}
|
|
289
329
|
/* Settings > Claude: which Claude profile PMOS starts Claude sessions with, and the API key for Claude's own runs (D101).
|
|
290
330
|
* The key is typed here and goes to this computer only; the page never gets it back, only whether one is set and where from. */
|
|
291
331
|
function claudeSec() {
|
|
@@ -298,7 +338,7 @@ function claudeSec() {
|
|
|
298
338
|
const k = C.key || {};
|
|
299
339
|
const keySub = k.present ? (k.source === 'environment' ? 'Set in ANTHROPIC_API_KEY. A key saved here is used first.' : 'Saved on this computer only. PMOS never shows it again.') : 'Not set. Claude\u2019s own runs, such as Grill, use a Claude session instead.';
|
|
300
340
|
const keyRight = `<span class="ev-dr-pl"><label class="ev-vh" for="evKey">Anthropic API key</label><input id="evKey" class="ev-inp" type="password" autocomplete="off" spellcheck="false" placeholder="${k.present ? 'Replace the key' : 'sk-ant-\u2026'}" data-ev-key><button type="button" class="ev-btn sm pri" data-ev-keysave>Save</button>${k.source === 'settings' ? '<button type="button" class="ev-btn sm" data-ev-keyclear>Remove</button>' : ''}</span>`;
|
|
301
|
-
return '<h4>Claude login and profile</h4><div data-claude-setup></div>'
|
|
341
|
+
return decidesSec() + '<h4>Claude login and profile</h4><div data-claude-setup></div>'
|
|
302
342
|
+ trow('API key', keySub, keyRight)
|
|
303
343
|
+ (k.present && C.off ? trow('Runs on the API', 'Off: PMOS_GRILL_API is off in the environment.', '<span class="ev-pill">Off</span>') : '')
|
|
304
344
|
+ sharpenRows()
|
|
@@ -436,6 +476,7 @@ async function press(e) {
|
|
|
436
476
|
if (t.dataset.evMore) { T.wkMore.add(t.dataset.evMore); draw(); return; }
|
|
437
477
|
if (t.dataset.evGo) { T.sec = t.dataset.evGo; T.sub = ''; draw(); return; }
|
|
438
478
|
if (t.dataset.evSub !== undefined) { const k = t.dataset.evSub, was = T.sub; T.sub = k; T.dress = false; T.more = false; T.bday = false; T.msg = ''; draw(); const f = T.el.querySelector(k ? '[data-ev-sub=""]' : `[data-ev-sub="${was}"]`); if (f) f.focus(); return; }
|
|
479
|
+
if (t.dataset.evSeg && t.dataset.evSeg.startsWith('claude.way:')) { await saveWay(t.dataset.evSeg.slice(11), t.dataset.v); return; }
|
|
439
480
|
if (t.dataset.evSeg === 'theme') { const M = await import('./cozy-nav.js'); M.setTheme(t.dataset.v); draw(); return; }
|
|
440
481
|
if (t.dataset.evSeg && t.dataset.evSeg.startsWith('grill.')) {
|
|
441
482
|
const key = t.dataset.evSeg, value = key === 'grill.cap' ? Number(t.dataset.v) : t.dataset.v;
|
|
@@ -562,7 +603,9 @@ async function readAgain(id) {
|
|
|
562
603
|
}
|
|
563
604
|
async function load() {
|
|
564
605
|
readFresh();
|
|
565
|
-
pmGet('/api/
|
|
606
|
+
pmGet('/api/autonomy/kinds').then((k) => { T.ck = k && k.ok ? k : { ok: false, error: (k && k.error) || '' }; draw(); }).catch(() => { T.ck = { ok: false }; draw(); });
|
|
607
|
+
pmGet('/api/artefacts/lessons').then((l) => { T.ls = l && l.ok ? l : null; draw(); }).catch(() => { T.ls = null; });
|
|
608
|
+
pmGet('/api/grill').then((g) => { T.gr = g && g.ok ? g : { ok: false, error: (g && g.error) || '' }; draw(); }).catch(() => { T.gr = { ok: false }; draw(); });
|
|
566
609
|
pmGet('/api/next-prompt/prefs').then((n) => { T.np = n && n.ok ? n : null; draw(); }).catch(() => { T.np = null; });
|
|
567
610
|
pmGet('/api/profiles').then(async (pr) => { const k = await pmGet('/api/anthropic'); T.cl = { profiles: pr && Array.isArray(pr.profiles) ? pr.profiles : [], prefs: (pr && pr.prefs) || {}, perr: pr && pr.ok === false ? (pr.error || 'the server did not answer') : '', key: k && k.ok ? k.key : { present: false, source: null }, off: !!(k && k.off) }; draw(); }).catch(() => { T.cl = { profiles: [], prefs: {}, perr: 'the server did not answer', key: { present: false, source: null } }; draw(); });
|
|
568
611
|
const [w, p, s, b] = await Promise.all([pmGet('/api/workspaces'), pmGet('/api/proactive/settings'), pmGet('/api/settings'), pmGet('/api/briefing-premium')]);
|
|
@@ -588,7 +631,7 @@ export function openSettings(section, o = {}) {
|
|
|
588
631
|
const m = MOVED[section];
|
|
589
632
|
if (m) { T.sec = m[0]; T.sub = m[1]; T.dress = section === 'dress'; } else if (section && BODY[section]) { T.sec = section; T.sub = ''; T.dress = false; }
|
|
590
633
|
else if (el.hidden) { T.sec = 'general'; T.sub = ''; T.dress = false; } // a fresh open with no section opens on General (R2), not on the section of the last visit
|
|
591
|
-
if (el.hidden) { const ae = document.activeElement; T.back = ae && ae !== document.body ? ae : null; T.ws = null; T.src = null; T.msg = ''; T.phase = ''; T.auto = false; T.wkOpen = new Set(); T.wkMore = new Set(); T.arc = false; T.fresh = null; T.note = {}; T.info = false; T.fold = false; T.dset = {}; T.cl = null; T.gr = null; T.np = null; JL.reset(); }
|
|
634
|
+
if (el.hidden) { const ae = document.activeElement; T.back = ae && ae !== document.body ? ae : null; T.ws = null; T.src = null; T.msg = ''; T.phase = ''; T.auto = false; T.wkOpen = new Set(); T.wkMore = new Set(); T.arc = false; T.fresh = null; T.note = {}; T.info = false; T.fold = false; T.dset = {}; T.cl = null; T.gr = null; T.np = null; T.ck = null; T.ls = null; JL.reset(); }
|
|
592
635
|
el.hidden = false; document.getElementById('evStScrim').hidden = false; el.setAttribute('data-esc-layer', '');
|
|
593
636
|
draw();
|
|
594
637
|
const f = el.querySelector('[aria-current="page"]'); if (f) f.focus();
|
|
@@ -652,6 +652,13 @@ body.cz-home .hm-hd.hv-bar > .hv-hi { flex: 1 0 auto; max-width: 100%; }
|
|
|
652
652
|
.gm-more { display: flex; flex-wrap: wrap; gap: 4px 18px; padding-top: 8px; }
|
|
653
653
|
.gm-more button { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; border: 0; background: none; padding: 0; font: inherit; font-size: var(--fs-body); color: var(--cz-ink2); cursor: pointer; }
|
|
654
654
|
.gm-more b { color: var(--cz-ink); font-weight: var(--fw-strong); }
|
|
655
|
+
/* agent-run (AwA, AwAPhone): each call says its kind; Claude did lists each change with its reason and Undo; a run that stopped is one amber line */
|
|
656
|
+
.gm-rt .gm-k2 { color: var(--cz-ink2); font-weight: var(--fw-strong); }
|
|
657
|
+
.gm-didl { margin-top: 18px; }
|
|
658
|
+
.gm-r .gm-undo { flex: none; margin-top: 4px; }
|
|
659
|
+
.gm-fail { display: flex; align-items: flex-start; gap: 8px; margin: 6px 0 2px; padding: 10px 12px; border-radius: 14px; background: var(--cz-latebg); color: var(--cz-late); font-size: var(--fs-label); line-height: 1.45; }
|
|
660
|
+
.gm-fail svg { flex: none; margin-top: 2px; }
|
|
661
|
+
.gm-fail b { font-weight: var(--fw-strong); }
|
|
655
662
|
/* Since yesterday: neutral dots; orange only for a real rise */
|
|
656
663
|
.gm-sl { display: flex; flex-direction: column; }
|
|
657
664
|
.gm-si { display: flex; align-items: baseline; gap: 10px; min-height: 44px; padding: 8px 0; border: 0; border-bottom: 1px solid var(--cz-hair); background: none; text-align: left; font: inherit; font-size: var(--fs-body); color: var(--cz-ink); cursor: pointer; line-height: 1.4; }
|
|
@@ -19,6 +19,13 @@
|
|
|
19
19
|
* morning (zero is silence); past items fade and their notes fold under them. After 17:00 (G3) the strip says how the quarter moved since
|
|
20
20
|
* the morning, "Today made possible" lists what the day moved, "Still yours" what is left, and the rail turns to tomorrow.
|
|
21
21
|
*
|
|
22
|
+
* AGENT-RUN (agreed 2026-11-10, boards AwA and AwAPhone on the main canvas, In development; requirements R1, R2, R4). Your move holds only
|
|
23
|
+
* the calls that always wait for the PM (callKindOf: a verdict, a new request or decision, a message to people, a move the team reads, a
|
|
24
|
+
* merge, a delete or spend), each with its kind and why, in W3's order; at most 5 show and the rest fold under one line. Can wait is gone:
|
|
25
|
+
* Claude acts on the rest. "Claude did" lists what Claude finished by itself (GET /api/autonomy done), each with its one-line reason and
|
|
26
|
+
* Undo (14 days); a run that stopped is one amber line there, never a row of Your move. The lead says it straight: "N calls are yours. I
|
|
27
|
+
* did the other M." Your call is no longer a section of its own: it is a row of Your move (say it once).
|
|
28
|
+
*
|
|
22
29
|
* PROVEN ONLY. The quarter's goal states, the PM's line, the morning's snapshot, a row's goal tag and what Yes does to a goal come from the
|
|
23
30
|
* Good morning goal data (GM1), passed in o.quarter, o.tags and the call's effect. Each part that is missing is left out: no goals, no strip;
|
|
24
31
|
* no line, no tick and the verdict counts only; no morning snapshot, no "up from"; no effect, no goal clause. Nothing is guessed.
|
|
@@ -196,6 +203,26 @@ export function notesOf(rows, now, o = {}) {
|
|
|
196
203
|
});
|
|
197
204
|
}
|
|
198
205
|
|
|
206
|
+
/** The kind of a ranked row that always waits for the PM (the six kinds of requirement R2, as the rows of W3 name them), or null: Claude
|
|
207
|
+
* acts on that row by itself. A call that is not a message is the PM's decision, a blocked one says so. Pure. */
|
|
208
|
+
export function callKindOf(r) {
|
|
209
|
+
if (!r) return null;
|
|
210
|
+
if (r.kind === 'verdict') return 'Verdict';
|
|
211
|
+
if (r.kind === 'mention' || r.kind === 'outbox') return 'Message';
|
|
212
|
+
if (r.kind === 'meeting') return 'Move the team reads';
|
|
213
|
+
if (r.kind !== 'call' || !r.call) return null;
|
|
214
|
+
const c = r.call, t = String(c.name || '') + ' ' + String((c.row && c.row.title) || '');
|
|
215
|
+
if (c.kind === 'update') return 'Message';
|
|
216
|
+
if (/\b(intake|new request|request)\b/i.test(t)) return 'New request';
|
|
217
|
+
if (/\b(merge|pull request)\b/i.test(t)) return 'Merge';
|
|
218
|
+
if (/\b(delete|spend|budget)\b/i.test(t)) return 'Delete or spend';
|
|
219
|
+
if (c.state === 'blocked') return 'Blocked';
|
|
220
|
+
return 'Your call';
|
|
221
|
+
}
|
|
222
|
+
/** At most this many of the PM's calls show; the rest fold under one line ("N more of your calls"). */
|
|
223
|
+
export const MOVE_CAP = 5;
|
|
224
|
+
const SINCE_MS = 24 * 3600e3;
|
|
225
|
+
|
|
199
226
|
/** The page's model. Y: dayModel's answer (Y.rank from W3); D: Home's data; o: { quarter, tags, notes, picks, today: meetings }. */
|
|
200
227
|
export function gmModel(Y, D, now = Date.now(), o = {}) {
|
|
201
228
|
D = D || {};
|
|
@@ -214,10 +241,21 @@ export function gmModel(Y, D, now = Date.now(), o = {}) {
|
|
|
214
241
|
why: [meet ? 'Yes puts it on the ' + hm(meet.start) + ' agenda.' : '', fx ? fx.goal + ' moves from ' + WORD[fx.from] + ' to ' + WORD[fx.to] + '.' : ''].filter(Boolean).join(' ')
|
|
215
242
|
|| (c.pick ? 'I’d ' + c.pick.charAt(0).toLowerCase() + c.pick.slice(1).replace(/\.?$/, '.') + ' It’s your call.' : c.when ? 'Goes out ' + c.when + '.' : c.sub || '') } : null;
|
|
216
243
|
|
|
217
|
-
// Your move: the
|
|
218
|
-
|
|
219
|
-
const
|
|
220
|
-
const
|
|
244
|
+
// Your move (agent-run, AwA): only the calls that always wait for the PM, in W3's order (its Can wait included: a call is never "can
|
|
245
|
+
// wait"), each with its kind and why; the rest of W3's list is Claude's to do. With no ranked list, the calls Your day holds.
|
|
246
|
+
const all = Y.rank ? [...Y.rank.rows, ...(Y.rank.wait || [])] : (Y.calls || []).map((x) => ({ key: 'call:' + x.id, kind: 'call', call: x, title: x.name, sub: '', age: '' }));
|
|
247
|
+
const callWhy = (x) => (c && x.id === c.id && call && call.why) || (x.pick ? 'I’d ' + x.pick.charAt(0).toLowerCase() + x.pick.slice(1).replace(/\.?$/, '.') + ' It’s your call.' : x.when ? 'Goes out ' + x.when + '.' : x.sub || x.hint || '');
|
|
248
|
+
const mine = all.map((r) => ({ r, k: callKindOf(r) })).filter((x) => x.k)
|
|
249
|
+
.map(({ r, k }) => ({ ...r, callKind: k, sub: r.kind === 'call' ? callWhy(r.call) : r.sub, goal: tagOf(o.tags, r.ws, r.ini), late: r.days != null && r.days > 0 }));
|
|
250
|
+
const move = mine.slice(0, MOVE_CAP), more = mine.length - move.length;
|
|
251
|
+
// Claude did (AwA): what Claude finished by itself, newest first, each with its reason and Undo; a run that stopped is one amber line
|
|
252
|
+
const R = Y.rank || {}, recent = (x) => { const t = Date.parse(x.at || ''); return Number.isFinite(t) && now - t <= SINCE_MS; };
|
|
253
|
+
// a kind Claude shows you (Settings › Claude: a new kind, or one you set to Show me) comes first; the quiet ones follow, newest first
|
|
254
|
+
const did = (R.done || []).map((d, i) => ({ d, i })).sort((a, b) => (a.d.way === 'show' ? 0 : 1) - (b.d.way === 'show' ? 0 : 1) || a.i - b.i).map(({ d }) => d).map((d) => ({ ...d, title: d.via === 'proposals' && d.name ? d.name + ': ' + (d.said || 'done') : d.said || 'done',
|
|
255
|
+
why: d.reason || 'Done by itself. You can undo it for 14 days.' }));
|
|
256
|
+
const didN = did.filter(recent).length;
|
|
257
|
+
const fl = (R.failed || []).filter(recent);
|
|
258
|
+
const failed = fl.length ? { n: fl.length, names: [...new Set(fl.map((x) => x.name).filter(Boolean))], why: fl[0].why || '' } : null;
|
|
221
259
|
|
|
222
260
|
// the lead: honest first; a call that moves a goal ties today to the quarter; else Your day's own line. A failed source is one quiet line
|
|
223
261
|
// under the lead, never the lead itself (G1, G3), and the face is never happier than the data
|
|
@@ -235,6 +273,13 @@ export function gmModel(Y, D, now = Date.now(), o = {}) {
|
|
|
235
273
|
// the header already greets: the lead never says "Morning, Wawan." again (say it once); a festival's wish stays
|
|
236
274
|
const g = /^(?:Morning|Afternoon|Evening)(?:, [^.]+)?\.\s*/;
|
|
237
275
|
if (g.test(line)) { line = line.replace(g, ''); if (!line) { line = sub || ''; sub = ''; } }
|
|
276
|
+
// the straight answer (AwA): how many calls are the PM's and how much Claude did since yesterday; Your day's own line when nothing is read
|
|
277
|
+
if (state !== 'soon' && B.mood !== 'concerned' && Y.rank && (mine.length || didN)) {
|
|
278
|
+
const n = mine.length, yours = n === 1 ? '1 call is yours.' : n + ' calls are yours.', prev = line;
|
|
279
|
+
const wish = /^Happy [^.]+\./.exec(prev); // a festival's wish stays first (AsPlaces); the straight answer follows it
|
|
280
|
+
line = (wish ? wish[0] + ' ' : '') + (n && didN ? 'Straight answer: ' + yours + ' I did the other ' + didN + '.' : n ? 'Straight answer: ' + yours : 'Straight answer: nothing needs you. I did ' + plural(didN, 'thing', 'things') + '.');
|
|
281
|
+
sub = didN ? 'Each one says why. You can undo any of them for 14 days.' : prev || sub; // Your day's own line (or the gap line) follows
|
|
282
|
+
}
|
|
238
283
|
const lead = { ...Y, mood: B.mood, face: B === Y ? Y.face : B.mood, failLead: false, line, sub, did: Y.chips.length ? 'Done for you: ' + Y.chips.join(', ') : '' };
|
|
239
284
|
|
|
240
285
|
// the next meeting's prep card (G2): what to agree, its bullets, Record as an icon
|
|
@@ -267,7 +312,7 @@ export function gmModel(Y, D, now = Date.now(), o = {}) {
|
|
|
267
312
|
|
|
268
313
|
// Since yesterday: up to 3 of New for you, neutral dots; orange only for a real rise (an item that says so)
|
|
269
314
|
const since = state === 'soon' ? [] : (Y.news || []).slice(0, 3); // the hour before a meeting shows no Since yesterday at all (G2)
|
|
270
|
-
return { state, date, hello, quarter, lead, call, move, more, made, prep, rail, notes, since, newsN: state === 'soon' ? 0 : (Y.news || []).length + (Y.digests || 0),
|
|
315
|
+
return { state, date, hello, quarter, lead, call, move, more, rest: mine.slice(MOVE_CAP), did, didN, failed, made, prep, rail, notes, since, newsN: state === 'soon' ? 0 : (Y.news || []).length + (Y.digests || 0),
|
|
271
316
|
drafts: Y.drafts.length, wait: Y.wait.length, concerned: B.mood === 'concerned', confirm: state === 'evening' && rc && rc.to_confirm > 0 ? rc.to_confirm : 0 };
|
|
272
317
|
}
|
|
273
318
|
|
|
@@ -289,10 +334,23 @@ function quarterHtml(Q) {
|
|
|
289
334
|
function rowHtml(r) {
|
|
290
335
|
const yes = r.yes ? `<button type="button" class="gm-tc" data-yd="mv-yes" data-key="${esc(r.key)}" aria-label="${esc(r.yes + ': ' + r.title)}" title="${esc(r.yes)}"></button>`
|
|
291
336
|
: r.kind === 'call' ? `<button type="button" class="gm-tc" data-yd="mv-open" data-key="${esc(r.key)}" aria-label="${esc('Open: ' + r.title)}" title="Open"></button>` : '<span class="gm-tc no" aria-hidden="true"></span>';
|
|
292
|
-
const tag = r.goal ? `<span class="gm-gt"><i class="d-${r.goal.dot}"></i>${esc(r.goal.text)}</span>` :
|
|
337
|
+
const tag = r.callKind ? `<em><span class="gm-k2">${esc(r.callKind)}</span>${r.sub ? ' · ' + esc(r.sub) : ''}</em>${r.goal ? `<span class="gm-gt"><i class="d-${r.goal.dot}"></i>${esc(r.goal.text)}</span>` : ''}`
|
|
338
|
+
: r.goal ? `<span class="gm-gt"><i class="d-${r.goal.dot}"></i>${esc(r.goal.text)}</span>` : r.sub ? `<em>${esc(r.sub)}</em>` : '';
|
|
293
339
|
return `<div class="gm-r" data-key="${esc(r.key)}"${r.kind === 'call' && r.call ? ` data-id="${esc(r.call.id)}"` : ''}>${yes}<button type="button" class="gm-rt" data-yd="mv-open" data-key="${esc(r.key)}"><b>${esc(r.title)}</b>${tag}</button>${r.age ? `<span class="gm-due${r.late ? ' late' : ''}">${esc(r.age)}</span>` : ''}</div>`;
|
|
294
340
|
}
|
|
295
341
|
const doneHtml = (r) => `<div class="gm-r done"><span class="gm-tc dn" aria-hidden="true">${svg(CHECK, 13, 2.6)}</span><span class="gm-rt"><b>${esc(r.title)}</b>${r.goal ? `<span class="gm-gt"><i class="d-o"></i>${esc(r.goal)}</span>` : r.sub ? `<em>${esc(r.sub)}</em>` : ''}</span></div>`;
|
|
342
|
+
const UNDO = 'M9 14L4 9l5-5M4 9h10a6 6 0 0 1 0 12h-3', WARN = 'M12 8v5M12 16.5v.01M10.3 3.9L2.6 17.5A2 2 0 0 0 4.3 20.5h15.4a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z';
|
|
343
|
+
/** One change Claude made by itself (AwA): ✓, what it did, its one-line reason, and Undo as an icon. Your day's Done fold draws it too. */
|
|
344
|
+
export function didRowHtml(d) {
|
|
345
|
+
return `<div class="gm-r done" data-ref="${esc(d.ref)}"><span class="gm-tc dn" aria-hidden="true">${svg(CHECK, 13, 2.6)}</span><span class="gm-rt"><b>${esc(d.title)}</b>${d.why ? `<em>${esc(d.why)}</em>` : ''}</span>`
|
|
346
|
+
+ `<button type="button" class="yd-alt sm gm-undo" data-yd="done-undo" data-ref="${esc(d.ref)}" data-via="${esc(d.via || 'proposals')}" data-ws="${esc(d.ws || '')}" data-board="${esc(d.board || '')}" aria-label="${esc('Undo: ' + d.title)}" title="Undo">${svg(UNDO, 16, 2)}</button></div>`;
|
|
347
|
+
}
|
|
348
|
+
/** A run that stopped, said once as one amber line (R4): never a row of Your move. */
|
|
349
|
+
export function failHtml(F) {
|
|
350
|
+
if (!F) return '';
|
|
351
|
+
const who = F.names.length === 1 ? F.names[0] + ' ' : '';
|
|
352
|
+
return `<div class="gm-fail" role="status">${svg(WARN, 14, 2)}<span><b>${esc(plural(F.n, who + 'run', who + 'runs') + ' stopped.')}</b>${F.why ? ' ' + esc(String(F.why).replace(/\.?$/, '.')) : ''} I run ${F.n === 1 ? 'it' : 'them'} again on the next wake. Nothing ${F.n === 1 ? 'it' : 'they'} made was kept.</span></div>`;
|
|
353
|
+
}
|
|
296
354
|
function agendaHtml(rows) {
|
|
297
355
|
return rows.map((x) => {
|
|
298
356
|
if (x.kind === 'allday') return `<div class="gm-ar"><span class="gm-tm">All day</span><div class="gm-ad">${esc(x.title)}</div></div>`;
|
|
@@ -317,19 +375,20 @@ export function gmHtml(G, openHtml, o = {}) {
|
|
|
317
375
|
a += `<section class="gm-prep"><span class="gm-k">${esc(P.k)}</span>${P.head ? `<h2>${esc(P.head)}</h2>` : ''}${P.bullets.length ? `<ul>${P.bullets.map((b) => `<li>${esc(b)}</li>`).join('')}</ul>` : ''}`
|
|
318
376
|
+ `<div class="gm-pr"><button type="button" class="gm-rec" data-yd="gm-rec" data-id="${esc(P.meeting.id || '')}" aria-label="Record this meeting" title="Record">${svg(MIC, 18, 2)}</button>${P.files ? `<em>${esc(P.files)}</em>` : ''}</div></section>`;
|
|
319
377
|
}
|
|
320
|
-
|
|
321
|
-
a += `<section class="gm-sec"><h3 class="gm-sh">Your call</h3><div class="gm-call yd-call${G.call.blocked ? ' am' : ''}" data-id="${esc(G.call.id)}"><div><b>${esc(G.call.name)}</b>${G.call.why ? `<em>${esc(G.call.why)}</em>` : ''}</div>`
|
|
322
|
-
+ `<button type="button" class="yd-alt" data-yd="sel" aria-label="${esc('Open: ' + G.call.name)}" title="Open">${svg(CHEV, 18, 2)}</button></div></section>`;
|
|
323
|
-
}
|
|
378
|
+
// Your call is a row of Your move now (AwA: say it once); its why rides on that row
|
|
324
379
|
// a decision caught in today's notes counts only once the PM confirms it (GET /api/phone-day recap.to_confirm): until then it is one quiet line
|
|
325
380
|
const conf = G.confirm ? `<div class="gm-more"><button type="button" data-yd="gm-notes"><b>${G.confirm}</b> ${G.confirm === 1 ? 'decision' : 'decisions'} from today’s notes to confirm${svg(CHEV, 14, 2)}</button></div>` : '';
|
|
326
381
|
if (G.made.length) a += `<section class="gm-sec"><h3 class="gm-sh">Today made possible</h3>${G.made.map(doneHtml).join('')}${conf}</section>`;
|
|
327
382
|
else a += conf;
|
|
328
|
-
const quiet = [G.more > 0
|
|
329
|
-
G.drafts ? `<button type="button" data-yd="gm-fold" data-fold="drafts"><b>${G.drafts}</b> drafted for you${svg(CHEV, 14, 2)}</button>` : ''
|
|
330
|
-
|
|
331
|
-
if (G.move.length) a += `<section class="gm-sec gm-move"><h3 class="gm-sh">${G.state === 'evening' ? 'Still yours' : 'Your move'} <span class="gm-n">${
|
|
383
|
+
const quiet = [G.more > 0 ? `<button type="button" data-yd="gm-fold" data-fold="more"><b>${G.more}</b> more ${G.more === 1 ? 'call' : 'calls'} of yours${svg(CHEV, 14, 2)}</button>` : '',
|
|
384
|
+
G.drafts ? `<button type="button" data-yd="gm-fold" data-fold="drafts"><b>${G.drafts}</b> drafted for you${svg(CHEV, 14, 2)}</button>` : ''].filter(Boolean).join('');
|
|
385
|
+
const nMine = G.move.length + (G.more || 0);
|
|
386
|
+
if (G.move.length) a += `<section class="gm-sec gm-move"><h3 class="gm-sh">${G.state === 'evening' ? 'Still yours' : 'Your move'} <span class="gm-n">${nMine}</span></h3>${G.move.map(rowHtml).join('')}${quiet ? `<div class="gm-more">${quiet}</div>` : ''}</section>`;
|
|
332
387
|
else if (quiet) a += `<div class="gm-more">${quiet}</div>`;
|
|
388
|
+
// Claude did (AwA): the amber line of a run that stopped, then the newest changes with their reasons and Undo; the rest fold
|
|
389
|
+
const dl = (G.did || []).slice(0, MOVE_CAP), dmore = (G.did || []).length - dl.length;
|
|
390
|
+
if (dl.length || G.failed) a += `<section class="gm-sec gm-didl"><h3 class="gm-sh">Claude did${G.didN ? ` <span class="gm-n">${G.didN} since yesterday</span>` : ''}<button type="button" class="gm-lnk" data-yd="gm-claude">By product</button></h3>${failHtml(G.failed)}${dl.map(didRowHtml).join('')}`
|
|
391
|
+
+ (dmore > 0 ? `<div class="gm-more"><button type="button" data-yd="gm-fold" data-fold="done"><b>${dmore}</b> more Claude did${svg(CHEV, 14, 2)}</button></div>` : '') + '</section>';
|
|
333
392
|
const b = G.since.length || G.newsN ? `<section class="gm-sec gm-since"><h3 class="gm-sh">Since yesterday${G.since.length ? `<button type="button" class="yd-all" data-yd="seen" aria-label="Mark all ${G.newsN} seen" title="Mark all seen">${svg(MARK2, 18, 1.9)}</button>` : ''}</h3>`
|
|
334
393
|
+ `<div class="gm-sl">${G.since.map((it) => `<button type="button" class="gm-si${it.rise ? ' hot' : ''}" data-yd="news" data-id="${esc(it.id)}"><i aria-hidden="true"></i><span>${esc(it.kind === 'task' ? String(it.title || '').replace(/^New task: /, '') : it.title)}</span>${it.at ? `<em>${esc(at(it.at))}</em>` : ''}</button>`).join('')}</div>`
|
|
335
394
|
+ `<button type="button" class="gm-lnk" data-yd="news-all">New for you · ${G.newsN}</button></section>` : '';
|