create-pmos 0.421.0 → 0.422.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 +13 -13
- 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/anchor-resolve.js +93 -15
- package/payload/state/discoveries.md +1 -1
- package/workspace/board-programs-test.js +59 -3
- package/workspace/briefing-premium-board-test.js +1 -1
- package/workspace/changelog.json +12 -0
- package/workspace/fixtures/report-api/draft.json +2 -1
- package/workspace/guide/briefing-premium.md +1 -0
- package/workspace/guide/home.md +5 -2
- package/workspace/guide/programs.md +4 -3
- package/workspace/home-other-product-test.js +55 -0
- package/workspace/lib/board-premium.js +18 -4
- package/workspace/lib/doc-live-root.js +37 -0
- package/workspace/lib/engine/anchor-resolve.js +93 -15
- package/workspace/lib/engine/boards.js +7 -2
- package/workspace/lib/engine/intake.js +1 -1
- package/workspace/lib/hold-spans.js +24 -10
- package/workspace/lib/kg.js +1 -1
- package/workspace/lib/report-draft.js +3 -0
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-board-premium.js +6 -0
- package/workspace/lib/routes-boards.js +48 -9
- package/workspace/lib/routes-doc-sheet.js +29 -1
- package/workspace/lib/routes-programs.js +44 -5
- package/workspace/lib/routes-task-plans.js +333 -0
- package/workspace/lib/task-cli.js +16 -9
- package/workspace/lib/task-items.js +1 -1
- package/workspace/lib/task-plans.js +232 -0
- package/workspace/lib/vendor/scripts/anchor-resolve.js +93 -15
- package/workspace/lib/vendor/scripts/intake.js +1 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-vw-doc-test.js +26 -3
- package/workspace/program-leave-test.js +203 -0
- package/workspace/public/pm/bd-acts.js +5 -2
- package/workspace/public/pm/bd-ini-panel.js +20 -7
- package/workspace/public/pm/bd-prog-panel.js +22 -7
- package/workspace/public/pm/bd-span.js +175 -25
- package/workspace/public/pm/cozy-board.css +80 -0
- package/workspace/public/pm/cozy-home.css +3 -0
- package/workspace/public/pm/doc-follow.js +36 -0
- package/workspace/public/pm/home-app.js +38 -7
- package/workspace/public/pm/home-ini.js +11 -2
- package/workspace/public/pm/home-list.js +2 -2
- package/workspace/public/pm/home-today.js +3 -1
- package/workspace/public/pm/ini-tasks.js +81 -16
- package/workspace/public/pm/ini-versions.js +343 -0
- package/workspace/public/pm/ini-view-model.js +27 -41
- package/workspace/public/pm/ini-view.css +82 -0
- package/workspace/public/pm/ini-view.js +17 -10
- package/workspace/public/pm/premium-board.js +109 -18
- package/workspace/public/pm/premium-report-read.js +20 -1
- package/workspace/public/pm/premium-shell.js +29 -4
- package/workspace/public/pm/premium-vw-doc.js +46 -11
- package/workspace/public/pm/prog-move.js +69 -0
- package/workspace/public/pm/task-card.css +3 -0
- package/workspace/public/pm/task-card.js +10 -3
- package/workspace/task-milestones-test.js +176 -0
- package/workspace/task-plans-test.js +175 -0
- package/workspace/task-views-test.js +2 -2
- package/workspace/test-lists/program-leave.json +6 -0
- package/workspace/test-lists/task-milestones.json +6 -0
- package/workspace/test-lists/task-plans.json +6 -0
- package/workspace/test-lists/viewer-live-file.json +9 -0
- package/workspace/timeline-holds-test.js +61 -4
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* task-plans.js — planned versus actual (feedback batch 11 item 8; canvas In development, row "Planned vs actual": PvaACGrill, PvaAC1Live,
|
|
3
|
+
* PvaAC2Menu, PvaAC3Draft, PvaAC4Board, PvaAC5Phone). THE ONE WRITER and THE ONE FOLD of <state>/task-plans.jsonl, beside boards.jsonl.
|
|
4
|
+
*
|
|
5
|
+
* Two records, both append-only:
|
|
6
|
+
* A DRAFT is a named copy of an initiative's PMOS tasks (title, stage, dates, owner, milestone flag). It changes nothing in Live, on the
|
|
7
|
+
* Board or in Jira; Jira tickets are not copied. Every task in it is an assumption. An initiative with no saved plan keeps a new task in an
|
|
8
|
+
* automatic draft named "Proposal". "Make live" applies a draft to Live (lib/routes-task-plans.js) and saves a plan named after it; the
|
|
9
|
+
* initiative's other open drafts go to Not chosen (kept, folded).
|
|
10
|
+
* A SAVED PLAN is a frozen copy of each Live task's start and due day: made by Make live, by "Save Live as a plan", and once by PMOS when
|
|
11
|
+
* the initiative enters Build with no plan yet. The timelines draw it as the thin line under each bar.
|
|
12
|
+
*
|
|
13
|
+
* THE LEDGER. One line per change, { at, by, kind, ... }:
|
|
14
|
+
* draft-new { draft, board, initiative, name, auto?, from: 'live' | 'empty' | <draft id>, tasks: [task] } task: { k, src, title, section,
|
|
15
|
+
* from, itemStage, start, due, owner, milestone, status } — `src` is the Live task it copies (null for a new one); its fields at
|
|
16
|
+
* the copy are its `base`, so Make live knows what the draft changed and what Live changed since
|
|
17
|
+
* draft-task { draft, k, add: {fields} | set: {fields} | drop: true | undrop: true }
|
|
18
|
+
* draft-name { draft, name } · draft-delete { draft } · draft-restore { draft }
|
|
19
|
+
* draft-live { draft, plan, undo: { added: [uid], changed: [{ uid, item, from }], dropped: [{ uid, item, from }], unchosen: [draft id] } }
|
|
20
|
+
* draft-unlive { draft } the Undo of Make live (the route writes the reverse lines in boards.jsonl and the plan-items ledger)
|
|
21
|
+
* plan { plan, board, initiative, name, source: 'draft' | 'live' | 'build', tasks: [{ uid, title, start, due }] }
|
|
22
|
+
* plan-remove { plan } the Undo of a save
|
|
23
|
+
*
|
|
24
|
+
* ledgerFile(dir) · read(dir) → fold · append(dir, actor, line) → the line
|
|
25
|
+
* fold(lines) → { drafts: Map, plans: Map, t } PURE
|
|
26
|
+
* taskOfLive(x) → a draft task copied from a Live task (the work-item shape of routes-boards itemsOf)
|
|
27
|
+
* versionsOf(F, ini, live) → { t, drafts, notChosen, plans } | null what the Tasks header chip reads (null: nothing to show)
|
|
28
|
+
* planTasksOf(live) → [{ uid, title, start, due }] the frozen dates of the Live tasks that count (no Won't do, no Archived)
|
|
29
|
+
* stepsOf(draft, live) → { add, change, drop, conflicts } PURE: what Make live writes
|
|
30
|
+
* summaryOf(steps) → { added, moved, dropped, conflicts: [title] }
|
|
31
|
+
* spanOf(tasks) → { start, end } | null
|
|
32
|
+
* dayDiff(a, b) → whole days from a to b
|
|
33
|
+
*/
|
|
34
|
+
const fs = require('fs');
|
|
35
|
+
const path = require('path');
|
|
36
|
+
const crypto = require('crypto');
|
|
37
|
+
|
|
38
|
+
const LEDGER = 'task-plans.jsonl';
|
|
39
|
+
const KINDS = new Set(['draft-new', 'draft-task', 'draft-name', 'draft-delete', 'draft-restore', 'draft-live', 'draft-unlive', 'plan', 'plan-remove']);
|
|
40
|
+
const FIELDS = ['title', 'section', 'start', 'due', 'owner', 'milestone', 'status'];
|
|
41
|
+
const isObj = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
|
|
42
|
+
const str = (v) => (typeof v === 'string' ? v : '');
|
|
43
|
+
const DAY = /^\d{4}-\d{2}-\d{2}$/;
|
|
44
|
+
const newId = (stem) => stem + '-' + crypto.randomBytes(5).toString('hex');
|
|
45
|
+
const newKey = () => 'k' + crypto.randomBytes(4).toString('hex');
|
|
46
|
+
|
|
47
|
+
function ledgerFile(dir) { return dir ? path.join(dir, LEDGER) : null; }
|
|
48
|
+
function readLines(file) {
|
|
49
|
+
if (!file) return [];
|
|
50
|
+
let text = '';
|
|
51
|
+
try { text = fs.readFileSync(file, 'utf8'); } catch { return []; }
|
|
52
|
+
const out = [];
|
|
53
|
+
for (const raw of text.split('\n')) { if (!raw.trim()) continue; try { const l = JSON.parse(raw); if (isObj(l) && KINDS.has(l.kind)) out.push(l); } catch { /* a torn line is skipped */ } }
|
|
54
|
+
return out;
|
|
55
|
+
}
|
|
56
|
+
function read(dir) { return fold(readLines(ledgerFile(dir))); }
|
|
57
|
+
function append(dir, actor, ev) {
|
|
58
|
+
const line = { at: new Date().toISOString(), by: (actor && actor.by) || null, ...ev };
|
|
59
|
+
fs.appendFileSync(ledgerFile(dir), JSON.stringify(line) + '\n');
|
|
60
|
+
return line;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** One draft task's fields, cleaned: the strings it may hold, a day or '' for start and due. */
|
|
64
|
+
function clean(t) {
|
|
65
|
+
const o = {};
|
|
66
|
+
for (const k of FIELDS) {
|
|
67
|
+
if (!(k in t)) continue;
|
|
68
|
+
if (k === 'milestone') o.milestone = t.milestone === true;
|
|
69
|
+
else if (k === 'start' || k === 'due') o[k] = DAY.test(str(t[k])) ? t[k] : '';
|
|
70
|
+
else o[k] = str(t[k]);
|
|
71
|
+
}
|
|
72
|
+
return o;
|
|
73
|
+
}
|
|
74
|
+
/** A draft task as the ledger holds it: its fields and where it came from. A copy of a draft also carries the base and the drop it had. */
|
|
75
|
+
function taskLine(t) {
|
|
76
|
+
const f = clean(t);
|
|
77
|
+
return { k: str(t.k) || newKey(), src: typeof t.src === 'string' && t.src ? t.src : null, ...f,
|
|
78
|
+
...(isObj(t.from) ? { from: { stage: str(t.from.stage), finish: str(t.from.finish) } } : {}), ...(t.itemStage ? { itemStage: str(t.itemStage) } : {}), ...(t.item ? { item: true } : {}) };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function fold(lines) {
|
|
82
|
+
const drafts = new Map(), plans = new Map();
|
|
83
|
+
let t = '';
|
|
84
|
+
for (const e of Array.isArray(lines) ? lines : []) {
|
|
85
|
+
if (!isObj(e) || !KINDS.has(e.kind)) continue;
|
|
86
|
+
if (e.at && e.at > t) t = e.at;
|
|
87
|
+
if (e.kind === 'draft-new' && typeof e.draft === 'string' && typeof e.initiative === 'string' && !drafts.has(e.draft)) {
|
|
88
|
+
const tasks = new Map();
|
|
89
|
+
for (const x of Array.isArray(e.tasks) ? e.tasks : []) {
|
|
90
|
+
if (!isObj(x) || typeof x.k !== 'string') continue;
|
|
91
|
+
const f = clean(x);
|
|
92
|
+
tasks.set(x.k, { ...x, ...f, base: x.src ? (isObj(x.base) ? clean(x.base) : { ...f }) : null, drop: x.drop === true && !!x.src });
|
|
93
|
+
}
|
|
94
|
+
drafts.set(e.draft, { id: e.draft, board: str(e.board), ini: e.initiative, name: str(e.name) || 'Draft', auto: e.auto === true, from: str(e.from) || 'live',
|
|
95
|
+
at: e.at || null, by: e.by || null, state: 'open', tasks, liveAt: null, plan: null });
|
|
96
|
+
} else if (e.kind === 'draft-task' && drafts.has(e.draft) && typeof e.k === 'string') {
|
|
97
|
+
const d = drafts.get(e.draft), x = d.tasks.get(e.k);
|
|
98
|
+
if (isObj(e.add) && !x) d.tasks.set(e.k, { k: e.k, src: null, title: '', section: '', start: '', due: '', owner: '', milestone: false, status: 'To do', ...clean(e.add), base: null, drop: false, addedAt: e.at || null });
|
|
99
|
+
else if (x && isObj(e.set)) Object.assign(x, clean(e.set));
|
|
100
|
+
else if (x && e.drop === true) { if (x.src) x.drop = true; else d.tasks.delete(e.k); }
|
|
101
|
+
else if (x && e.undrop === true) x.drop = false;
|
|
102
|
+
} else if (e.kind === 'draft-name' && drafts.has(e.draft) && str(e.name).trim()) {
|
|
103
|
+
drafts.get(e.draft).name = e.name.trim();
|
|
104
|
+
} else if (e.kind === 'draft-delete' && drafts.has(e.draft)) {
|
|
105
|
+
const d = drafts.get(e.draft); d.was = d.state; d.state = 'deleted';
|
|
106
|
+
} else if (e.kind === 'draft-restore' && drafts.has(e.draft) && drafts.get(e.draft).state === 'deleted') {
|
|
107
|
+
const d = drafts.get(e.draft); d.state = d.was || 'open';
|
|
108
|
+
} else if (e.kind === 'draft-live' && drafts.has(e.draft)) {
|
|
109
|
+
const d = drafts.get(e.draft), u = isObj(e.undo) ? e.undo : {};
|
|
110
|
+
d.state = 'live'; d.liveAt = e.at || null; d.plan = str(e.plan) || null; d.undo = u;
|
|
111
|
+
for (const id of Array.isArray(u.unchosen) ? u.unchosen : []) { const o = drafts.get(id); if (o && o.state === 'open') o.state = 'not-chosen'; }
|
|
112
|
+
} else if (e.kind === 'draft-unlive' && drafts.has(e.draft) && drafts.get(e.draft).state === 'live') {
|
|
113
|
+
const d = drafts.get(e.draft), u = d.undo || {};
|
|
114
|
+
d.state = 'open'; d.liveAt = null; d.plan = null;
|
|
115
|
+
for (const id of Array.isArray(u.unchosen) ? u.unchosen : []) { const o = drafts.get(id); if (o && o.state === 'not-chosen') o.state = 'open'; }
|
|
116
|
+
} else if (e.kind === 'plan' && typeof e.plan === 'string' && typeof e.initiative === 'string' && !plans.has(e.plan)) {
|
|
117
|
+
plans.set(e.plan, { id: e.plan, board: str(e.board), ini: e.initiative, name: str(e.name) || 'Plan', source: str(e.source) || 'live', at: e.at || null, by: e.by || null,
|
|
118
|
+
tasks: (Array.isArray(e.tasks) ? e.tasks : []).filter((x) => isObj(x) && typeof x.uid === 'string').map((x) => ({ uid: x.uid, title: str(x.title), start: DAY.test(str(x.start)) ? x.start : '', due: DAY.test(str(x.due)) ? x.due : '' })) });
|
|
119
|
+
} else if (e.kind === 'plan-remove' && plans.has(e.plan)) {
|
|
120
|
+
plans.delete(e.plan);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return { drafts, plans, t };
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** A Live task (routes-boards itemsOf's work item, or board-premium's r.tasks row) as a draft task's fields. */
|
|
127
|
+
function taskOfLive(x) {
|
|
128
|
+
return taskLine({ src: x.uid, title: x.title || '', section: typeof x.section === 'string' ? x.section : '', start: x.start || '', due: x.end || x.due || '', owner: x.owner || '',
|
|
129
|
+
milestone: x.milestone === true, status: x.status || 'To do', from: x.from || null, itemStage: x.itemStage || '', item: x.store === 'item' || x.item === true });
|
|
130
|
+
}
|
|
131
|
+
const counts = (x) => x && x.status !== "Won't do" && x.status !== 'Archived';
|
|
132
|
+
/** The frozen dates of a plan: every Live task that counts, with a date. */
|
|
133
|
+
function planTasksOf(live) {
|
|
134
|
+
return (live || []).filter((x) => x && x.uid && counts(x) && (x.start || x.end || x.due)).map((x) => ({ uid: x.uid, title: x.title || '', start: x.start || '', due: x.end || x.due || '' }));
|
|
135
|
+
}
|
|
136
|
+
function spanOf(tasks) {
|
|
137
|
+
let a = '', b = '';
|
|
138
|
+
for (const x of tasks || []) {
|
|
139
|
+
const s = x.start || x.due || x.end || '', e = x.due || x.end || x.start || '';
|
|
140
|
+
if (s && (!a || s < a)) a = s;
|
|
141
|
+
if (e && (!b || e > b)) b = e;
|
|
142
|
+
}
|
|
143
|
+
return a ? { start: a, end: b } : null;
|
|
144
|
+
}
|
|
145
|
+
const dayNo = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? Math.round(Date.UTC(+m[1], +m[2] - 1, +m[3]) / 864e5) : null; };
|
|
146
|
+
function dayDiff(a, b) { const x = dayNo(a), y = dayNo(b); return x == null || y == null ? null : y - x; }
|
|
147
|
+
|
|
148
|
+
/** A draft's tasks in the shape r.tasks has (board-premium), so the one view draws a draft as it draws Live: uid `dt:<draft>:<k>`. */
|
|
149
|
+
function draftRows(d) {
|
|
150
|
+
const out = [];
|
|
151
|
+
for (const x of d.tasks.values()) {
|
|
152
|
+
if (x.drop) continue;
|
|
153
|
+
out.push({ uid: 'dt:' + d.id + ':' + x.k, title: x.title, status: x.status || 'To do', owner: x.owner || '', start: x.start || '', end: x.due || '',
|
|
154
|
+
...(x.section ? { section: x.section } : {}), ...(x.from && x.from.stage ? { from: x.from } : {}), ...(x.itemStage ? { itemStage: x.itemStage } : {}),
|
|
155
|
+
...(x.milestone ? { milestone: true } : {}), ...(x.src ? { src: x.src } : { added: true }), draft: true });
|
|
156
|
+
}
|
|
157
|
+
return out;
|
|
158
|
+
}
|
|
159
|
+
/** Whether Live changed a task of the draft since the copy (the draft row's blue dot). */
|
|
160
|
+
function liveChanged(d, liveBy) {
|
|
161
|
+
for (const x of d.tasks.values()) {
|
|
162
|
+
if (!x.src || !x.base) continue;
|
|
163
|
+
const l = liveBy.get(x.src);
|
|
164
|
+
if (!l) return true;
|
|
165
|
+
const now = taskOfLive(l);
|
|
166
|
+
if (['title', 'start', 'due', 'owner'].some((k) => (now[k] || '') !== (x.base[k] || ''))) return true;
|
|
167
|
+
}
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
/** What the Tasks header chip reads for one initiative. null when there is no draft, no Not chosen and no saved plan (the chip hides). */
|
|
171
|
+
function versionsOf(F, ini, live) {
|
|
172
|
+
const liveBy = new Map((live || []).map((x) => [x.uid, x]));
|
|
173
|
+
const ds = [...F.drafts.values()].filter((d) => d.ini === ini);
|
|
174
|
+
const plans = [...F.plans.values()].filter((p) => p.ini === ini).sort((a, b) => String(a.at || '').localeCompare(String(b.at || '')));
|
|
175
|
+
const open = ds.filter((d) => d.state === 'open'), nc = ds.filter((d) => d.state === 'not-chosen');
|
|
176
|
+
if (!open.length && !nc.length && !plans.length) return null;
|
|
177
|
+
const one = (d) => { const rows = draftRows(d); return { id: d.id, name: d.name, auto: d.auto, from: d.from, at: d.at, liveChanged: d.from !== 'empty' && liveChanged(d, liveBy), tasks: rows, span: spanOf(rows) }; };
|
|
178
|
+
return { t: F.t, drafts: open.map(one), notChosen: nc.map(one),
|
|
179
|
+
plans: plans.map((p) => ({ id: p.id, name: p.name, source: p.source, at: p.at, tasks: p.tasks, span: spanOf(p.tasks) })).reverse() };
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** What Make live writes for draft d against Live (the work items of the initiative, by uid). Pure.
|
|
183
|
+
* add: the draft's new tasks · change: a copied task whose fields the draft changed (the draft wins; `conflict` when Live changed the same
|
|
184
|
+
* field since the copy) · drop: a copied task the draft dropped, still open in Live (it becomes Won't do, never deleted). */
|
|
185
|
+
function stepsOf(d, live) {
|
|
186
|
+
const by = new Map((live || []).map((x) => [x.uid, x]));
|
|
187
|
+
const add = [], change = [], drop = [], conflicts = [];
|
|
188
|
+
for (const x of d.tasks.values()) {
|
|
189
|
+
if (!x.src) { if (!x.drop) add.push(x); continue; }
|
|
190
|
+
const l = by.get(x.src);
|
|
191
|
+
if (!l) continue; // gone from Live since the copy: nothing to change
|
|
192
|
+
const now = taskOfLive(l);
|
|
193
|
+
if (x.drop) { if (now.status !== "Won't do" && now.status !== 'Archived' && now.status !== 'Done') drop.push({ uid: x.src, item: !!now.item, title: now.title, from: now.status }); continue; }
|
|
194
|
+
const set = {}, from = {};
|
|
195
|
+
let clash = false;
|
|
196
|
+
for (const k of ['title', 'start', 'due', 'owner', 'section']) {
|
|
197
|
+
const base = (x.base && x.base[k]) || '', mine = x[k] || '', theirs = now[k] || '';
|
|
198
|
+
if (mine === base) continue; // the draft did not change it: Live keeps its own
|
|
199
|
+
if (mine === theirs) continue;
|
|
200
|
+
if (theirs !== base) clash = true;
|
|
201
|
+
set[k] = mine; from[k] = theirs;
|
|
202
|
+
}
|
|
203
|
+
if (Object.keys(set).length) { change.push({ uid: x.src, item: !!now.item, title: x.title || now.title, set, from, moved: 'start' in set || 'due' in set }); if (clash) conflicts.push(x.title || now.title); }
|
|
204
|
+
}
|
|
205
|
+
return { add, change, drop, conflicts };
|
|
206
|
+
}
|
|
207
|
+
function summaryOf(s) {
|
|
208
|
+
return { added: s.add.length, moved: s.change.filter((c) => c.moved).length, changed: s.change.length, dropped: s.drop.length, conflicts: s.conflicts.slice(0, 20),
|
|
209
|
+
milestones: s.add.filter((x) => x.milestone).map((x) => ({ title: x.title, due: x.due || '' })).slice(0, 10) };
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** The Board's rows (board-premium) with what planned versus actual adds: r.versions (the Tasks header chip), r.plan (the newest saved plan's
|
|
213
|
+
* span and the end slip, for the thin line under the bar) and r.draft (an initiative with drafts only: its newest draft, drawn dashed).
|
|
214
|
+
* Zero is silence: nothing is added to a row with no draft and no plan. Mutates and returns rows. */
|
|
215
|
+
function decorate(rows, F) {
|
|
216
|
+
for (const r of rows || []) {
|
|
217
|
+
if (!r || !r.id || r.versions !== undefined) continue;
|
|
218
|
+
const live = r.tasks || [], v = versionsOf(F, r.id, live);
|
|
219
|
+
if (!v) continue;
|
|
220
|
+
r.versions = v;
|
|
221
|
+
const cnt = live.filter(counts), ls = spanOf(cnt), p = v.plans[0];
|
|
222
|
+
if (p && p.span) r.plan = { id: p.id, name: p.name, start: p.span.start, end: p.span.end, slip: ls ? dayDiff(p.span.end, ls.end) : null };
|
|
223
|
+
if (!cnt.length && v.drafts.length) {
|
|
224
|
+
const ds = v.drafts.slice().sort((a, b) => String(b.at || '').localeCompare(String(a.at || '')));
|
|
225
|
+
const top = ds.find((d) => d.span) || ds[0];
|
|
226
|
+
if (top && top.span) r.draft = { id: top.id, name: top.name, start: top.span.start, end: top.span.end, others: ds.filter((d) => d !== top).map((d) => ({ name: d.name, end: d.span ? d.span.end : '' })) };
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return rows;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
module.exports = { decorate, LEDGER, ledgerFile, read, readLines, append, fold, taskLine, taskOfLive, planTasksOf, versionsOf, draftRows, stepsOf, summaryOf, spanOf, dayDiff, newId, newKey };
|
|
@@ -73,20 +73,45 @@ const ACCEPTED_FORMS = [
|
|
|
73
73
|
* called `okrs` that every subsequent KR would then attach to. The shape is therefore pinned:
|
|
74
74
|
* an objective is `O` + digits, or `O-` + a word; a KR is `KR` + digits, or `KR-` + a word.
|
|
75
75
|
*/
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
/*
|
|
77
|
+
* Batch 11 item 6 (2026-10-26): the OKR document as people write it. `## Objective 1 — title` is
|
|
78
|
+
* objective `o1`, the same objective as `## O1 — title`; and `KR1.2` (KR 2 of objective 1) is its own
|
|
79
|
+
* KR `kr1.2`. Before, the heading matched nothing — so no objective was read at all — and `KR1.2`
|
|
80
|
+
* matched as `KR1` with a name starting `.2`: a silent collapse of two KRs into one. The dotted part is
|
|
81
|
+
* digits only, and the token is followed by a lookahead, so `KR1.2` can never be read as `KR1`.
|
|
82
|
+
* `Objective` needs a number after it: `## Objectives` and the H1 `# OKRs — …` stay non-objectives.
|
|
83
|
+
*/
|
|
84
|
+
const OBJ_TOKEN = '(O\\d+|O-[A-Za-z][A-Za-z0-9-]*|[Oo]bjective\\s*\\d+)';
|
|
85
|
+
const KR_TOKEN = '(KR\\d+(?:\\.\\d+)*|KR-[A-Za-z][A-Za-z0-9-]*)';
|
|
86
|
+
const TOKEN_END = '(?![A-Za-z0-9]|\\.\\d)';
|
|
78
87
|
const PERIOD = '((?:q|Q)[1-4]-\\d{4})';
|
|
79
88
|
|
|
80
|
-
const RE_OBJ_HEADING = new RegExp('^#{1,3}\\s+' + OBJ_TOKEN + '
|
|
81
|
-
|
|
89
|
+
const RE_OBJ_HEADING = new RegExp('^#{1,3}\\s+(?:\\*\\*)?' + OBJ_TOKEN + TOKEN_END + '(?:\\*\\*)?\\s*(?:[—–:-]\\s*(.*))?$');
|
|
90
|
+
/* A KR bullet: `- **KR1 — name.** more`, `- **KR1.2** — name`, `- KR1.2: name`, `- KR-C — name`. The
|
|
91
|
+
* name is the bolded text when the bold wraps the id and the name, else the rest of the line. */
|
|
92
|
+
const RE_KR_BULLET = new RegExp('^\\s*[-*]\\s*(\\*\\*)?\\s*' + KR_TOKEN + TOKEN_END + '(.*)$');
|
|
93
|
+
|
|
94
|
+
function krBullet(line) {
|
|
95
|
+
const m = RE_KR_BULLET.exec(line);
|
|
96
|
+
if (!m) return null;
|
|
97
|
+
let rest = m[3];
|
|
98
|
+
const sep = /^\s*[—–:.-]?\s*/;
|
|
99
|
+
let name;
|
|
100
|
+
if (m[1] && /^\s*\*\*/.test(rest)) name = rest.replace(/^\s*\*\*/, '').replace(sep, ''); // **KR1.2** — name
|
|
101
|
+
else if (m[1]) { rest = rest.replace(sep, ''); const end = rest.indexOf('**'); name = end >= 0 ? rest.slice(0, end) : rest; }
|
|
102
|
+
else name = rest.replace(sep, '');
|
|
103
|
+
return { token: m[2], name: name.replace(/\*\*/g, '').trim() };
|
|
104
|
+
}
|
|
82
105
|
|
|
83
106
|
// Anchor forms. Order matters only in that the colon forms are tried before the looser ones.
|
|
84
107
|
const RE_HEALTH = /^health:([a-z0-9_-]+)/i; // START-anchored — rule 2
|
|
85
108
|
const RE_DOMAIN = /^domain:([a-z0-9][a-z0-9_-]*)/i; // D67 — the third anchor class
|
|
86
|
-
const RE_COLON_KR = new RegExp('^(?:okrs-)?' + PERIOD + ':([a-z0-9][a-z0-9-]*):(kr-?[a-z0-9-]+)$', 'i');
|
|
109
|
+
const RE_COLON_KR = new RegExp('^(?:okrs-)?' + PERIOD + ':([a-z0-9][a-z0-9-]*):(kr-?[a-z0-9-]+(?:\\.\\d+)*)$', 'i');
|
|
87
110
|
const RE_COLON_OBJ = new RegExp('^(?:okrs-)?' + PERIOD + ':([a-z0-9][a-z0-9-]*)$', 'i');
|
|
88
111
|
const RE_ARROW = new RegExp('^(?:okrs-)?' + PERIOD + '\\s*(?:→|->)\\s*' + OBJ_TOKEN + '(?:\\.' + KR_TOKEN + ')?$', 'i');
|
|
89
112
|
const RE_BARE = new RegExp('^' + OBJ_TOKEN + '(?:\\.' + KR_TOKEN + ')?$', 'i');
|
|
113
|
+
// A KR on its own (`KR1.2`, `KR3`): it names its objective only by being declared under exactly one.
|
|
114
|
+
const RE_BARE_KR = new RegExp('^' + KR_TOKEN + '$', 'i');
|
|
90
115
|
|
|
91
116
|
/** Strip markdown emphasis and trailing commentary. `(`, `#` and `/` never appear inside an id. */
|
|
92
117
|
function stripCommentary(raw) {
|
|
@@ -101,6 +126,8 @@ function stripCommentary(raw) {
|
|
|
101
126
|
* the heading token minus a leading `O-`, lower-cased. */
|
|
102
127
|
function objectiveId(token) {
|
|
103
128
|
const t = String(token || '').trim();
|
|
129
|
+
const n = /^objective\s*(\d+)$/i.exec(t);
|
|
130
|
+
if (n) return 'o' + n[1];
|
|
104
131
|
const m = /^O-(.+)$/i.exec(t);
|
|
105
132
|
return (m ? m[1] : t).toLowerCase();
|
|
106
133
|
}
|
|
@@ -110,6 +137,28 @@ function krId(token) {
|
|
|
110
137
|
return String(token || '').trim().toLowerCase();
|
|
111
138
|
}
|
|
112
139
|
|
|
140
|
+
/*
|
|
141
|
+
* The OKR period, in the order a reader would look for it: a `period:` line (front matter or body),
|
|
142
|
+
* then the H1 (`# OKRs — Q3 2026`), then the filename (`okrs-q3-2026.md`). Each accepts `2026-Q3`,
|
|
143
|
+
* `Q3 2026` and `q3-2026`. → `q3-2026` or null. Only the canonical form needs it; resolution does not.
|
|
144
|
+
*/
|
|
145
|
+
function periodOf(text) {
|
|
146
|
+
const s = String(text || '');
|
|
147
|
+
let m = /(\d{4})[\s_-]*(Q[1-4])(?![0-9])/i.exec(s);
|
|
148
|
+
if (m) return `${m[2].toLowerCase()}-${m[1]}`;
|
|
149
|
+
m = /(?<![A-Za-z])(Q[1-4])[\s_-]*(\d{4})(?![0-9])/i.exec(s);
|
|
150
|
+
return m ? `${m[1].toLowerCase()}-${m[2]}` : null;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function filePeriod(text, file) {
|
|
154
|
+
const line = /^\s*[-*]?\s*\**period\**\s*:\s*(.+)$/im.exec(text);
|
|
155
|
+
if (line && periodOf(line[1])) return { period: periodOf(line[1]), from: 'period line' };
|
|
156
|
+
const h1 = /^#\s+(.+)$/m.exec(text);
|
|
157
|
+
if (h1 && periodOf(h1[1])) return { period: periodOf(h1[1]), from: 'title' };
|
|
158
|
+
const name = periodOf(path.basename(file, '.md'));
|
|
159
|
+
return name ? { period: name, from: 'file name' } : null;
|
|
160
|
+
}
|
|
161
|
+
|
|
113
162
|
function listOkrFiles(root) {
|
|
114
163
|
const out = [];
|
|
115
164
|
const seen = new Set();
|
|
@@ -150,41 +199,54 @@ function parseOkrIndex(root) {
|
|
|
150
199
|
const objectives = [];
|
|
151
200
|
const byId = new Map();
|
|
152
201
|
let period = null;
|
|
202
|
+
let periodFrom = null;
|
|
203
|
+
const noPeriod = [];
|
|
153
204
|
for (const file of files) {
|
|
154
205
|
let text;
|
|
155
206
|
try { text = fs.readFileSync(file, 'utf8'); }
|
|
156
207
|
catch (e) {
|
|
157
208
|
return { ok: false, objectives: [], files, error: `could not read ${file}: ${String((e && e.message) || e).slice(0, 120)}` };
|
|
158
209
|
}
|
|
210
|
+
const fp = filePeriod(text, file);
|
|
211
|
+
let declaresObjective = false;
|
|
159
212
|
let cur = null;
|
|
160
213
|
for (const line of text.split('\n')) {
|
|
161
|
-
if (!period) {
|
|
162
|
-
const p = /^\s*[-*]?\s*period\s*:\s*(\d{4})-(Q[1-4])\s*$/i.exec(line);
|
|
163
|
-
if (p) period = `${p[2].toLowerCase()}-${p[1]}`;
|
|
164
|
-
}
|
|
165
214
|
const o = RE_OBJ_HEADING.exec(line);
|
|
166
215
|
if (o) {
|
|
216
|
+
declaresObjective = true;
|
|
167
217
|
const id = objectiveId(o[1]);
|
|
168
218
|
cur = byId.get(id);
|
|
169
219
|
if (!cur) {
|
|
170
|
-
cur = { id, token: o[1], name: (o[2] || '').replace(/\*\*/g, '').trim(), krs: [], file: path.relative(root, file) };
|
|
220
|
+
cur = { id, token: o[1].replace(/\s+/g, ' '), name: (o[2] || '').replace(/\*\*/g, '').trim(), krs: [], file: path.relative(root, file), period: fp ? fp.period : null };
|
|
171
221
|
byId.set(id, cur);
|
|
172
222
|
objectives.push(cur);
|
|
173
223
|
}
|
|
174
224
|
continue;
|
|
175
225
|
}
|
|
176
|
-
const k =
|
|
226
|
+
const k = krBullet(line);
|
|
177
227
|
// A KR with no open objective stays UNATTACHED (rule 3) — never inherited from a previous one.
|
|
178
|
-
if (k && cur && !cur.krs.some((x) => x.id === krId(k
|
|
179
|
-
cur.krs.push({ id: krId(k
|
|
228
|
+
if (k && cur && !cur.krs.some((x) => x.id === krId(k.token))) {
|
|
229
|
+
cur.krs.push({ id: krId(k.token), token: k.token, name: k.name });
|
|
180
230
|
continue;
|
|
181
231
|
}
|
|
182
232
|
// the KR's own measure — its `baseline: … → target: …` sub-bullet (overhaul-r2 B4)
|
|
183
233
|
const bl = /^\s+[-*]\s*baseline\s*:\s*(.+)$/i.exec(line);
|
|
184
234
|
if (bl && cur && cur.krs.length && !cur.krs[cur.krs.length - 1].line) cur.krs[cur.krs.length - 1].line = bl[1].trim();
|
|
185
235
|
}
|
|
236
|
+
if (!declaresObjective) continue; // health-budgets.md, domains.md: not OKR documents, no period expected
|
|
237
|
+
if (fp && !period) { period = fp.period; periodFrom = `${fp.from} of ${path.relative(root, file)}`; }
|
|
238
|
+
if (!fp) noPeriod.push(path.relative(root, file));
|
|
239
|
+
}
|
|
240
|
+
const rels = files.map((f) => path.relative(root, f));
|
|
241
|
+
// What is missing, named with its fix, so a caller never has to guess why a field is empty.
|
|
242
|
+
const missing = [];
|
|
243
|
+
if (!objectives.length) {
|
|
244
|
+
missing.push(`no objective headings were read from ${rels.join(', ')} — write each objective as \`## O1 — title\` or \`## Objective 1 — title\``);
|
|
245
|
+
}
|
|
246
|
+
if (!period && objectives.length) {
|
|
247
|
+
missing.push(`no period found in ${noPeriod.join(', ') || rels.join(', ')} — add a line \`period: 2026-Q3\`, or put the quarter in the title (\`# OKRs — Q3 2026\`) or the file name (\`okrs-q3-2026.md\`)`);
|
|
186
248
|
}
|
|
187
|
-
return { ok: true, objectives, files:
|
|
249
|
+
return { ok: true, objectives, files: rels, period: period || null, period_from: periodFrom, missing, error: null };
|
|
188
250
|
}
|
|
189
251
|
|
|
190
252
|
function readBudgets(root) {
|
|
@@ -298,18 +360,34 @@ function resolveAnchor(raw, index, budgets) {
|
|
|
298
360
|
else if ((m = RE_COLON_OBJ.exec(s))) { period = m[1].toLowerCase(); objTok = m[2]; form = 'q3-2026:<objective>'; }
|
|
299
361
|
else if ((m = RE_ARROW.exec(s))) { period = m[1].toLowerCase(); objTok = m[2]; krTok = m[3] || null; form = 'legacy arrow'; }
|
|
300
362
|
else if ((m = RE_BARE.exec(s))) { objTok = m[1]; krTok = m[2] || null; form = 'legacy bare'; }
|
|
363
|
+
else if ((m = RE_BARE_KR.exec(s))) { krTok = m[1]; form = 'bare KR'; }
|
|
301
364
|
else {
|
|
302
365
|
return Object.assign(base, { kind: 'okr', status: 'unresolvable', form: 'unrecognised', reason: `'${s}' matches no accepted anchor form` });
|
|
303
366
|
}
|
|
304
367
|
|
|
305
368
|
const out = Object.assign({}, base, {
|
|
306
369
|
kind: 'okr', form, period,
|
|
307
|
-
objective: objectiveId(objTok),
|
|
370
|
+
objective: objTok ? objectiveId(objTok) : null,
|
|
308
371
|
kr: krTok ? krId(krTok) : null,
|
|
309
372
|
});
|
|
310
373
|
|
|
311
374
|
if (!index) return Object.assign(out, { status: 'unknown', reason: 'OKR index not supplied to the resolver' });
|
|
312
375
|
if (!index.ok) return Object.assign(out, { status: 'unknown', reason: index.error || 'OKR documents unreadable' });
|
|
376
|
+
if (!index.objectives.length) {
|
|
377
|
+
return Object.assign(out, { status: 'unresolvable', reason: (index.missing && index.missing[0]) || `no objectives declared in ${index.files.join(', ')}` });
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
if (!out.objective) {
|
|
381
|
+
// A bare KR: its objective is the one objective that declares it. Two objectives with the same KR
|
|
382
|
+
// id is ambiguous, and the reader is told how to write it — never a guess.
|
|
383
|
+
const holders = index.objectives.filter((o) => o.krs.some((k) => k.id === out.kr));
|
|
384
|
+
if (holders.length !== 1) {
|
|
385
|
+
return Object.assign(out, { status: 'unresolvable', reason: holders.length
|
|
386
|
+
? `KR '${out.kr}' is declared under ${holders.map((o) => o.id).join(' and ')} — write it with its objective, e.g. ${holders[0].token}.${krTok}`
|
|
387
|
+
: `no objective declares KR '${out.kr}' in ${index.files.join(', ')}` });
|
|
388
|
+
}
|
|
389
|
+
out.objective = holders[0].id;
|
|
390
|
+
}
|
|
313
391
|
|
|
314
392
|
const obj = index.objectives.find((o) => o.id === out.objective);
|
|
315
393
|
if (!obj) {
|
|
@@ -57,7 +57,7 @@ function priorRejections(root, text) {
|
|
|
57
57
|
|
|
58
58
|
// anchor: only an explicit `health:<id>` or `KR<n>` typed in the line; the caller must still confirm it.
|
|
59
59
|
function suggestAnchor(line) {
|
|
60
|
-
const m = String(line || '').match(/\bhealth:[a-z0-9-]+\b/i) || String(line || '').match(/\bKR\d
|
|
60
|
+
const m = String(line || '').match(/\bhealth:[a-z0-9-]+\b/i) || String(line || '').match(/\bKR\d+(?:\.\d+)*\b/);
|
|
61
61
|
return m ? m[0] : null;
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.422.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.422.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* Serves the real Home from the real server (premium-agreed-design: the initiative is a layout of Home, ?ini=<id>) and opens its PRD from the
|
|
5
5
|
* initiative's Files group; the document opens as its page in the cozy Viewer (#czViewer), one item at a time, so "a tab" is now "the card". The /api/doc-sheet routes are answered by a
|
|
6
6
|
* small stateful stand-in, so each press can be read off the request the page sent. The routes' own behaviour is in briefing-premium-doc-edit.test.js.
|
|
7
|
-
* D1 the page · D2 edit in place · D3 Markdown · D4 an agent's edit · D5 Undo all · D6 ask · D7 the sheet reads again · D8 floors
|
|
7
|
+
* D1 the page · D2 edit in place · D3 Markdown · D4 an agent's edit · D5 Undo all · D6 ask · D7 the sheet reads again · D8 floors
|
|
8
|
+
* D10 the page follows the file: a chat's edit shows with no refresh, from the initiative's worktree, and an unsaved edit is never replaced */
|
|
8
9
|
const path = require('path');
|
|
9
10
|
const { spawn } = require('child_process');
|
|
10
11
|
const { findBrowser } = require('./lib/find-browser');
|
|
@@ -47,10 +48,10 @@ const prop = (o) => Object.assign({ id: 'prop-a', state: 'proposed', prompt: 'ad
|
|
|
47
48
|
await T.waitForServer(BASE);
|
|
48
49
|
browser = await chromium.launch({ executablePath: exe });
|
|
49
50
|
|
|
50
|
-
const open = async ({ w = 1280, h = 900, theme = 'light', props = [], post = null } = {}) => {
|
|
51
|
+
const open = async ({ w = 1280, h = 900, theme = 'light', props = [], post = null, live = false } = {}) => {
|
|
51
52
|
const ctx = await browser.newContext({ viewport: { width: w, height: h } });
|
|
52
53
|
const page = await ctx.newPage();
|
|
53
|
-
const S = { text: TEXT, revs: [{ rev: 1, why: '', by: 'baseline', at: '2026-10-16T08:00:00Z' }], props, ask: null, errors: [], posts: [], gets: [], links: [] };
|
|
54
|
+
const S = { text: TEXT, revs: [{ rev: 1, why: '', by: 'baseline', at: '2026-10-16T08:00:00Z', after_hash: 'h1' }], hash: 'h1', ws: 'w1', props, ask: null, errors: [], posts: [], gets: [], links: [] };
|
|
54
55
|
page.on('pageerror', (e) => S.errors.push(String((e && e.message) || e)));
|
|
55
56
|
await page.route('**/api/initiative-premium*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: IP.build(F.facts()), as_of: F.NOW }) }));
|
|
56
57
|
await page.route('**/api/doc-health/check', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, health: { passed: 1, total: 1, checks: [{ id: 'fresh', pass: true, reason: 'ok' }] } }) }));
|
|
@@ -66,6 +67,7 @@ const prop = (o) => Object.assign({ id: 'prop-a', state: 'proposed', prompt: 'ad
|
|
|
66
67
|
if (route === 'at') return send({ ok: true, path: PATH, rev: S.revs.length, text: S.text });
|
|
67
68
|
if (route === 'proposals') return send({ ok: true, path: PATH, proposals: S.props });
|
|
68
69
|
if (route === 'ask') return send(S.ask || { ok: true, id: 'ask-1', state: 'working' });
|
|
70
|
+
if (route === 'stamp' && live) return send({ ok: true, path: PATH, ws: S.ws, hash: S.hash });
|
|
69
71
|
return send({ ok: false, error: 'not in this test' }, 404);
|
|
70
72
|
}
|
|
71
73
|
const body = JSON.parse(rq.postData() || '{}'); S.posts.push({ route, query: u.search, body });
|
|
@@ -198,6 +200,27 @@ const prop = (o) => Object.assign({ id: 'prop-a', state: 'proposed', prompt: 'ad
|
|
|
198
200
|
ok('0 no page error', C.S.errors.length === 0, C.S.errors.join(' | '));
|
|
199
201
|
await C.ctx.close();
|
|
200
202
|
}
|
|
203
|
+
/* D10 the page follows the file (feedback batch 11 item 1): the stand-in's stamp is the file's hash; a chat's write is a new hash and a new revision */
|
|
204
|
+
{
|
|
205
|
+
const L = await open({ live: true }); const q = L.page;
|
|
206
|
+
const write = (text, hash, ws) => { L.S.text = text; L.S.hash = hash; if (ws) L.S.ws = ws; L.S.revs.push({ rev: L.S.revs.length + 1, why: 'changed outside the sheet', by: 'baseline', via: 'outside', at: '2026-10-26T08:00:00Z', after_hash: hash }); };
|
|
207
|
+
await until(() => L.S.gets.some((g) => g.route === 'stamp'));
|
|
208
|
+
const st = L.S.gets.find((g) => g.route === 'stamp');
|
|
209
|
+
ok('D10 the page asks which copy is live with its workspace and its initiative', /ws=w1/.test(st.query) && /ini=self-serve-v2/.test(st.query), st.query);
|
|
210
|
+
write(TEXT.replace('A partner waits for a person.', 'A partner waits for a person. The chat wrote this line.'), 'h2', 'w2');
|
|
211
|
+
ok('D10 a chat\'s edit shows within a few seconds, with no refresh and no commit', !!(await until(() => q.evaluate((v) => /The chat wrote this line/.test((document.querySelector(v + ' .cfb') || {}).textContent || ''), V), 8000)));
|
|
212
|
+
ok('D10 the copy in the initiative\'s worktree is read there: the page reads with the workspace the stamp named', L.S.gets.some((g) => g.route === 'at' && /ws=w2/.test(g.query)) && L.S.gets.filter((g) => g.route === 'stamp').every((g) => /ws=w1/.test(g.query)));
|
|
213
|
+
await q.click(V + ' [data-vd="mode:edit"]');
|
|
214
|
+
await until(() => q.evaluate((v) => !!document.querySelector(v + ' .cfb[contenteditable="true"]'), V));
|
|
215
|
+
await q.evaluate((v) => { const b = document.querySelector(v + ' .cfb'); const pp = [...b.querySelectorAll('p')].find((x) => /The chat wrote this line/.test(x.textContent)); pp.textContent = pp.textContent + ' I typed this.'; }, V);
|
|
216
|
+
const nAt = L.S.gets.filter((g) => g.route === 'at').length;
|
|
217
|
+
write(TEXT.replace('A partner waits for a person.', 'A second chat edit.'), 'h3');
|
|
218
|
+
ok('D10 while you edit, a change says the file changed and keeps what you typed', !!(await until(() => q.evaluate((v) => /The chat changed this file while you were editing/.test((document.querySelector(v + ' #vwErr') || {}).textContent || ''), V), 8000)) && /I typed this/.test(await txt(q, V + ' .cfb')) && L.S.gets.filter((g) => g.route === 'at').length === nAt);
|
|
219
|
+
await q.click(V + ' [data-vd="cancel"]');
|
|
220
|
+
ok('D10 Cancel shows the new text', !!(await until(() => q.evaluate((v) => /A second chat edit/.test((document.querySelector(v + ' .cfb') || {}).textContent || ''), V), 8000)));
|
|
221
|
+
ok('0 no page error', L.S.errors.length === 0, L.S.errors.join(' | '));
|
|
222
|
+
await L.ctx.close();
|
|
223
|
+
}
|
|
201
224
|
/* D8 floors */
|
|
202
225
|
for (const [w, h, theme] of [[1280, 900, 'light'], [1280, 900, 'dark'], [390, 844, 'light'], [390, 844, 'dark']]) {
|
|
203
226
|
const R = await open({ w, h, theme, props: [prop()] });
|