create-pmos 0.292.0 → 0.294.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 +1 -1
- 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/state/discoveries.md +1 -1
- package/workspace/briefing-premium-doc-edit-test.js +1 -1
- package/workspace/briefing-premium-initiative-test.js +20 -2
- package/workspace/briefing-premium-work-test.js +8 -4
- package/workspace/guide/briefing-premium.md +9 -5
- package/workspace/lib/my-work-premium.js +21 -1
- package/workspace/lib/pm-items.js +1 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-work-depth-test.js +25 -24
- package/workspace/public/pm/premium-doc-edit.js +44 -0
- package/workspace/public/pm/premium-doc-sheet.js +56 -5
- package/workspace/public/pm/premium-work.js +75 -35
- package/workspace/public/pm/premium.css +25 -0
- package/workspace/public/premium-work.html +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.294.0",
|
|
4
4
|
"description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
package/payload/KIT-VERSION
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Eval calibration log"
|
|
4
4
|
description: "Append-only record of every PM override of an evaluator verdict."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-10-19T04:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-19T04:57:37Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Health budgets"
|
|
4
4
|
description: "Closed registry of health-budget anchors (D59), edited only by the PM."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-10-19T04:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-19T04:57:37Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Reference
|
|
3
3
|
title: "Discoveries and friction log"
|
|
4
4
|
description: "Append-only record of what runs discovered and where the process rubbed."
|
|
5
|
-
generated: {by: process:create-pmos, at: "2026-10-19T04:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-19T04:57:37Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -83,7 +83,7 @@ const prop = (o) => Object.assign({ id: 'prop-a', state: 'proposed', prompt: 'ad
|
|
|
83
83
|
const A = await open(); const p = A.page;
|
|
84
84
|
ok('0 the sheet opens', !!(await p.evaluate(() => document.querySelector('#shT'))));
|
|
85
85
|
/* E1 tabs */
|
|
86
|
-
await p.click('#shV'); ok('E1 the sheet has a view menu with Read, Edit, Proposals, Edit log and
|
|
86
|
+
await p.click('#shV'); ok('E1 the sheet has a view menu with Read, Edit, Proposals, Edit log, Health and Relations, and the open count on Proposals', await p.evaluate(() => [...document.querySelectorAll('#shT [data-sh]')].map((b) => b.textContent.replace(/\s+/g, ' ').trim()).join('|') === 'Read|Edit|Proposals 1|Edit log|Health|Relations'));
|
|
87
87
|
ok('E1 the Read outline marks only a heading an open proposal names', await p.evaluate(() => { const b = [...document.querySelectorAll('.dso button')]; return b.length === 0 || b.every((x) => !x.querySelector('i') === !/Goal|Summary/.test(x.textContent)); }));
|
|
88
88
|
ok('E7 the footnote no longer says read-only', !/Read-only/.test(await txt(p, '#oMain .xn')) && /only when you press Save or Accept/.test(await txt(p, '#oMain .xn')));
|
|
89
89
|
|
|
@@ -46,11 +46,15 @@ const HEALTH = { ok: true, path: 'planning/prd/self-serve-v2-prd.md', health: {
|
|
|
46
46
|
const open = async ({ w = 1280, h = 900, theme = 'light', model = mk(), answers = null, qs = '?id=self-serve-v2&ws=w1&board=w1' } = {}) => {
|
|
47
47
|
const ctx = await browser.newContext({ viewport: { width: w, height: h } });
|
|
48
48
|
const page = await ctx.newPage();
|
|
49
|
-
let current = model, calls = 0; const errors = [], posts = [], gets = []; let answer = { status: 200, body: { ok: true } }; let thread = { ok: true, turns: [], working: false };
|
|
49
|
+
let copies = []; let current = model, calls = 0; const errors = [], posts = [], gets = []; let answer = { status: 200, body: { ok: true } }; let thread = { ok: true, turns: [], working: false };
|
|
50
50
|
page.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
|
|
51
51
|
await page.route('**/api/initiative-premium*', (r) => { calls++; if (answers) { const a = answers(calls); return r.fulfill({ status: a.status, contentType: 'application/json', body: JSON.stringify(a.body) }); } return r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: current, as_of: F.NOW }) }); });
|
|
52
52
|
await page.route('**/api/core-docs/**', (r) => { const rq = r.request(); posts.push({ path: new URL(rq.url()).pathname, body: JSON.parse(rq.postData() || '{}'), headers: rq.headers() }); r.fulfill({ status: answer.status, contentType: 'application/json', body: JSON.stringify(answer.body) }); });
|
|
53
53
|
await page.route('**/api/doc-sheet/**', (r) => { const rq = r.request(), u = new URL(rq.url()); (rq.method() === 'GET' ? gets : posts).push({ path: u.pathname, query: u.search, method: rq.method() }); const b = u.pathname.endsWith('/log') ? LOG : u.pathname.endsWith('/at') ? { ok: true, path: LOG.path, rev: 2, text: TEXT } : { ok: false, error: 'not in this test' }; r.fulfill({ contentType: 'application/json', body: JSON.stringify(b) }); });
|
|
54
|
+
await page.route(/\/api\/docs(\?.*)?$/, (r) => { const u = new URL(r.request().url()); gets.push({ path: u.pathname, query: u.search, method: 'GET' }); r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, docs: [{ path: 'planning/prd/self-serve-v2-prd.md', links: copies }] }) }); });
|
|
55
|
+
await page.route('**/api/docs/link', (r) => { const rq = r.request(); const b = JSON.parse(rq.postData() || '{}'); posts.push({ path: '/api/docs/link', body: b, method: 'POST' }); copies = [{ kind: b.kind, target: b.target, title: 'PRD', signal: 'unchecked', url: b.target }]; r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true }) }); });
|
|
56
|
+
await page.route('**/api/docs/check', (r) => { posts.push({ path: '/api/docs/check', body: JSON.parse(r.request().postData() || '{}'), method: 'POST' }); r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, session: 's1' }) }); });
|
|
57
|
+
await page.route('**/api/docs/library*', (r) => { const u = new URL(r.request().url()); gets.push({ path: u.pathname, query: u.search, method: 'GET' }); r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, kinds: ['cites'], files: [{ path: 'planning/prd/self-serve-v2-prd.md', title: 'PRD' }, { path: 'planning/briefs/self-serve-brief.md', title: 'Self-serve brief' }, { path: 'planning/okrs/q3.md', title: 'Activation goal', category: 'goal', node: 'Goal' }, { path: 'planning/evals/self-serve-rubric.md', title: 'Self-serve rubric' }], edges: [[1, 0, 0], [2, 0, 0], [0, 3, 0]] }) }); });
|
|
54
58
|
await page.route('**/api/boards/tasks/**', (r) => { const rq = r.request(); posts.push({ path: new URL(rq.url()).pathname, body: JSON.parse(rq.postData() || '{}'), headers: rq.headers() }); r.fulfill({ status: answer.status, contentType: 'application/json', body: JSON.stringify(answer.body) }); });
|
|
55
59
|
await page.route('**/api/doc-health/check', (r) => { posts.push({ path: '/api/doc-health/check', body: JSON.parse(r.request().postData() || '{}'), method: 'POST' }); r.fulfill({ contentType: 'application/json', body: JSON.stringify(HEALTH) }); });
|
|
56
60
|
await page.route('**/api/briefing-premium/**', (r) => { const rq = r.request(); if (rq.method() === 'GET') return r.fulfill({ contentType: 'application/json', body: JSON.stringify(thread) }); posts.push({ path: new URL(rq.url()).pathname, body: JSON.parse(rq.postData() || '{}'), headers: rq.headers() }); r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true }) }); });
|
|
@@ -182,7 +186,7 @@ const HEALTH = { ok: true, path: 'planning/prd/self-serve-v2-prd.md', health: {
|
|
|
182
186
|
const nPost0 = A.posts.length;
|
|
183
187
|
await p.locator('#dmList .dmo[data-doc="prd"]').click(); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && /Self-serve onboarding v2/.test(document.querySelector('#oMain').textContent) && document.querySelector('#oMain .dsbody'))); await sleep(500); await p.click('#oMain [data-ds="meta"]');
|
|
184
188
|
const sh = await p.evaluate(() => ({ title: document.querySelector('#dTitle').textContent, path: document.querySelector('#oMain [data-ds="meta"]').title, tabs: (() => { document.querySelector('#shV').click(); const t = [...document.querySelectorAll('#shT [data-sh]')].map((b) => b.textContent).join(','); document.querySelector('#shV').click(); return t; })(), fm: [...document.querySelectorAll('#oMain .kv2 span')].map((s) => s.textContent).join('|'), heads: [...document.querySelectorAll('#oMain h3.d2')].map((h) => h.textContent).join('|'), outline: [...document.querySelectorAll('#oMain .dso button')].map((b) => b.textContent).join('|'), pre: [...document.querySelectorAll('#oMain pre')].map((e) => e.textContent).join('|'), li: document.querySelectorAll('#oMain li').length }));
|
|
185
|
-
ok('I8 Read shows the file\'s path, its front matter as a grid, its headings, list and code', sh.title === 'PRD' && sh.path === 'planning/prd/self-serve-v2-prd.md' && sh.tabs === 'Read,Edit,Proposals,Edit log,Health' && /type\|PRD\|title\|Self-serve onboarding v2/.test(sh.fm) && sh.heads === 'PRD: Self-serve onboarding v2|Problem|Goal|Requirements' && sh.li === 2 && /R1 a first call/.test(sh.pre), JSON.stringify(sh));
|
|
189
|
+
ok('I8 Read shows the file\'s path, its front matter as a grid, its headings, list and code', sh.title === 'PRD' && sh.path === 'planning/prd/self-serve-v2-prd.md' && sh.tabs === 'Read,Edit,Proposals,Edit log,Health,Relations' && /type\|PRD\|title\|Self-serve onboarding v2/.test(sh.fm) && sh.heads === 'PRD: Self-serve onboarding v2|Problem|Goal|Requirements' && sh.li === 2 && /R1 a first call/.test(sh.pre), JSON.stringify(sh));
|
|
186
190
|
ok('I8 Read asked for the log and the last revision, by GET, for this path', A.gets.some((g) => g.path === '/api/doc-sheet/log' && /path=planning%2Fprd%2Fself-serve-v2-prd.md/.test(g.query)) && A.gets.some((g) => g.path === '/api/doc-sheet/at' && /rev=2/.test(g.query)));
|
|
187
191
|
await p.click('#shV'); await p.click('#shT [data-sh="log"]');
|
|
188
192
|
const lg = await until(() => p.evaluate(() => document.querySelector('#oMain .hsr') && [...document.querySelectorAll('#oMain .hsr')].map((r) => r.textContent.replace(/\s+/g, ' ').trim())));
|
|
@@ -190,6 +194,20 @@ const HEALTH = { ok: true, path: 'planning/prd/self-serve-v2-prd.md', health: {
|
|
|
190
194
|
await p.click('#shV'); await p.click('#shT [data-sh="health"]');
|
|
191
195
|
const hl = await until(() => p.evaluate(() => document.querySelector('#oMain .ckr') && { note: document.querySelector('#oMain .note').textContent, rows: [...document.querySelectorAll('#oMain .ckr')].map((r) => r.className + ':' + r.querySelector('span').textContent) }));
|
|
192
196
|
ok('I8 Health shows each check as passed, not passed or no input, and says no input is not counted', hl && /1 of 2 checks/.test(hl.note) && hl.rows.join() === 'ckr done:Passed,ckr blocked:Not passed,ckr skipped:No input', JSON.stringify(hl));
|
|
197
|
+
await p.click('#shV'); await p.click('#shT [data-sh="rel"]');
|
|
198
|
+
const rl = await until(() => p.evaluate(() => document.querySelector('#oMain .dsrr') && [...document.querySelectorAll('#oMain .label, #oMain .dsrr')].map((r) => r.textContent.replace(/\s+/g, ' ').trim())));
|
|
199
|
+
ok('I8 Relations lists the sources, the goals and the documents that use it, from the library route', rl && rl.join('|') === 'Sources · 1|Self-serve briefcites|Goals and initiative · 1|Activation goalcites · Goal|Used by · 1|Self-serve rubriccites', JSON.stringify(rl));
|
|
200
|
+
ok('I8 Relations read the library by GET for this workspace and a goal that is a node is listed, not opened', A.gets.some((g) => g.path === '/api/docs/library' && /ws=w1/.test(g.query)) && await p.evaluate(() => document.querySelectorAll('#oMain [data-rel]').length) === 2);
|
|
201
|
+
await p.click('#shV'); await p.click('#shT [data-sh="read"]');
|
|
202
|
+
ok('I8 a document with no copy offers Link a copy in the status line', await p.evaluate(() => /Link a copy/.test(document.querySelector('#oMain .dsm2').textContent)));
|
|
203
|
+
await p.click('#oMain [data-ds="cp"]'); await p.fill('#dsCpUrl', 'notes'); await p.click('[data-ds="cplink"]');
|
|
204
|
+
ok('I8 a link that names no tool is refused on the sheet, and nothing is posted', /Confluence page or Google Doc/.test(await txt('#oMain .dscp [role="alert"]')) && !A.posts.some((x) => x.path === '/api/docs/link'));
|
|
205
|
+
await p.fill('#dsCpUrl', 'https://docs.google.com/document/d/abc/edit'); await p.click('[data-ds="cplink"]');
|
|
206
|
+
await until(() => p.evaluate(() => /Google Doc: not checked/.test(document.querySelector('#oMain .dsm2').textContent)));
|
|
207
|
+
ok('I8 linking posts the path, the tool and the address, and the status line then names the copy', A.posts.some((x) => x.path === '/api/docs/link' && x.body.kind === 'google' && x.body.path === 'planning/prd/self-serve-v2-prd.md' && x.body.ws === 'w1' && /docs\.google\.com/.test(x.body.target)));
|
|
208
|
+
await p.click('[data-ds="cpcheck"]');
|
|
209
|
+
ok('I8 Check now posts the workspace only and the button reads Checking', A.posts.some((x) => x.path === '/api/docs/check' && Object.keys(x.body).join() === 'ws') && await until(() => p.evaluate(() => /Checking/.test(document.querySelector('[data-ds="cpcheck"]').textContent))));
|
|
210
|
+
await p.click('#oMain [data-ds="cp"]');
|
|
193
211
|
ok('I8 the health check posts the path and the workspace only', A.posts.some((x) => x.path === '/api/doc-health/check' && Object.keys(x.body).sort().join() === 'path,ws' && x.body.ws === 'w1'));
|
|
194
212
|
ok('I8 the sheet wrote nothing: no edit, propose, accept, reject, why, mark or ask post went out', !A.posts.slice(nPost0).some((x) => /doc-sheet/.test(x.path)) && !A.posts.some((x) => /^\/api\/doc-sheet\/(edit|propose|accept|reject|why|mark-current|ask)/.test(x.path)));
|
|
195
213
|
ok('I8 the sheet says the file changes only on Save or Accept', /only when you press Save or Accept/.test(await txt('#oMain .xn')));
|
|
@@ -19,6 +19,7 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
|
19
19
|
const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { const v = await fn(); if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
|
|
20
20
|
const results = [];
|
|
21
21
|
const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + extra : ''}`); };
|
|
22
|
+
const more = async (pg) => { if (await pg.locator('#card [data-p="more"][aria-expanded="false"]').count()) await pg.click('#card [data-p="more"]'); };
|
|
22
23
|
let srv = null; let browser = null;
|
|
23
24
|
const finish = async (code) => {
|
|
24
25
|
if (browser) await browser.close().catch(() => {});
|
|
@@ -125,7 +126,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
125
126
|
{
|
|
126
127
|
const n = A.posts.length;
|
|
127
128
|
await p.locator('.wrow[data-key="work:wbs:alpha:4.2"] .wck.dec').click(); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(500);
|
|
128
|
-
ok('M8 the eye circle opens the item to review the draft and posts nothing', A.posts.length === n && (await p.textContent('#dTitle')) === 'Sign off the fit-out contractor shortlist' && /Agent draft
|
|
129
|
+
ok('M8 the eye circle opens the item to review the draft and posts nothing', A.posts.length === n && (await p.textContent('#dTitle')) === 'Sign off the fit-out contractor shortlist' && /Agent draft · not checked/.test(await p.textContent('#oMain')));
|
|
129
130
|
await p.keyboard.press('Escape'); await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
|
|
130
131
|
}
|
|
131
132
|
const openKey = async (key) => { await p.locator(`.wrow[data-key="${key}"] .wrh`).first().click(); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(700); };
|
|
@@ -138,18 +139,21 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
138
139
|
await p.locator('#toast .undo').click();
|
|
139
140
|
ok('M8 Undo posts Reopen for that item', await until(() => A.posts.some((x) => x.path === '/api/pm-items/reopen' && x.body.id === 'item-bbbbbbbbbbb2')));
|
|
140
141
|
await openKey('work:item-aaaaaaaaaaa1');
|
|
141
|
-
const dlg = await p.evaluate(() => ({ title: document.querySelector('#dTitle').textContent, btn: [...document.querySelectorAll('#card button')].map((b) => b.textContent.trim()), mod: document.querySelector('#dlg').getAttribute('aria-modal'), ask: !!document.querySelector('#askGo'), wDis:
|
|
142
|
-
|
|
142
|
+
const dlg = await p.evaluate(() => ({ title: document.querySelector('#dTitle').textContent, btn: [...document.querySelectorAll('#card button')].map((b) => b.textContent.trim()), mod: document.querySelector('#dlg').getAttribute('aria-modal'), ask: !!document.querySelector('#askGo'), wDis: true }));
|
|
143
|
+
const quiet = dlg.btn.slice(3).join();
|
|
144
|
+
await more(p); dlg.btn = [...(await p.evaluate(() => [...document.querySelectorAll('#card button')].map((b) => b.textContent.trim())))]; dlg.wDis = await p.evaluate(() => document.querySelector('#wBtn').disabled);
|
|
145
|
+
ok('M8 a dialog offers the agent, Done, Not yet, Do today, More and Drop it; More opens the tool row and Waiting, and the agent box; Keep only where the review list holds the item', dlg.title === 'Decide how partial refunds are handled' && quiet === 'Let the agent draft this,Done,Later today,Tomorrow,Next week,Do today,More,Drop it' && dlg.btn.slice(3).join() === 'Let the agent draft this,Done,Later today,Tomorrow,Next week,Do today,Fewer options,Drop it,Edit,Who does each step,Not before…,Someday,Wait for them' && dlg.mod === 'true' && dlg.ask && dlg.wDis, JSON.stringify(dlg));
|
|
143
146
|
await p.locator('#card [data-p="notyet"][data-when="tomorrow"]').click();
|
|
144
147
|
ok('M8 Not yet posts the item and the day, and closes the dialog', await until(() => A.posts.some((x) => x.path === '/api/pm-items/notyet' && x.body.id === 'item-aaaaaaaaaaa1' && x.body.when === 'tomorrow' && Object.keys(x.body).sort().join() === 'id,when')) && await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on'))));
|
|
145
148
|
for (const [sel, route, check] of [['[data-p="flag"]', '/api/pm-items/flag', (b) => b.flagged === true], ['[data-p="xt"][data-k="someday"]', '/api/pm-items/someday', (b) => Object.keys(b).join() === 'id'], ['[data-p="done"]', '/api/pm-items/done', (b) => Object.keys(b).join() === 'id'], ['[data-p="remove"]', '/api/pm-items/remove', (b) => Object.keys(b).join() === 'id']]) {
|
|
146
149
|
await openKey('work:item-aaaaaaaaaaa2'); const n = A.posts.length;
|
|
150
|
+
if (sel.includes('someday')) await more(p);
|
|
147
151
|
await p.locator('#card ' + sel).click();
|
|
148
152
|
ok(`M8 ${route.split('/').pop()} posts exactly what the Work page's route takes`, await until(() => A.posts.length > n && lastPost().path === route && lastPost().body.id === 'item-aaaaaaaaaaa2' && check(lastPost().body)), JSON.stringify(lastPost()));
|
|
149
153
|
await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
|
|
150
154
|
}
|
|
151
155
|
ok('M8 Done and Drop offer Undo for a short time', await p.evaluate(() => /Undo/.test(document.querySelector('#toast').textContent)));
|
|
152
|
-
await openKey('work:item-aaaaaaaaaaa3'); await p.fill('#wOn', ' Priya ');
|
|
156
|
+
await openKey('work:item-aaaaaaaaaaa3'); await more(p); await p.fill('#wOn', ' Priya ');
|
|
153
157
|
ok('M8 Waiting needs a name', await p.evaluate(() => !document.querySelector('#wBtn').disabled));
|
|
154
158
|
await p.click('#wBtn');
|
|
155
159
|
ok('M8 Waiting posts the name', await until(() => A.posts.some((x) => x.path === '/api/pm-items/waiting' && x.body.id === 'item-aaaaaaaaaaa3' && x.body.on === 'Priya')));
|
|
@@ -189,9 +189,13 @@ My work is the second place on the rail, at `/premium-work.html`. It reads the l
|
|
|
189
189
|
|
|
190
190
|
**Row suggestions and buttons.** A row shows a suggestion line only when a record backs it: an agent's offer on the item, a draft that is ready, or a date. A row also has one button: Today, Tomorrow, Review, or Give to agent. Give to agent opens the item, where you start the agent. A row from Jira shows its Jira key.
|
|
191
191
|
|
|
192
|
-
**Weekly review.** A card lists five steps: sort the inbox, place your tray, check who owes you, review agent drafts, and look at what sat untouched. Each step shows a count from your list and opens its first item. **Start the review** opens the first step that has something. On a Friday the card reads Friday review. PMOS keeps no review schedule and no timing, so the card shows none. The tray's
|
|
192
|
+
**Weekly review.** A card lists five steps: sort the inbox, place your tray, check who owes you, review agent drafts, and look at what sat untouched. Each step shows a count from your list and opens its first item. **Start the review** opens the first step that has something. On a Friday the card reads Friday review. PMOS keeps no review schedule and no timing, so the card shows none. The tray's tabs are drawn from your own items (see below). Answers, ideas and reports an agent files by itself are not shown, because PMOS holds no records for them.
|
|
193
193
|
|
|
194
|
-
**The
|
|
194
|
+
**Tray tabs.** The tray has six tabs, each built from your item records: **To place**, **Ready** (an agent draft is ready), **Working** (an agent is running), **Kept** (you pressed Keep), **Used** (done in the last 7 days) and **Compost** (untouched for the review days). A row shows a button that fits its tab: Today, Review, Use it, or Let go.
|
|
195
|
+
|
|
196
|
+
**The item dialog.** The dialog shows **Done**, **Not yet** (Later today, Tomorrow, Next week, Do today) and **Drop it**. **More** opens the rest: Edit, Who does each step, Not before, Someday and Waiting on someone. Every action stays reachable.
|
|
197
|
+
|
|
198
|
+
**The agent's draft.** The draft shows as formatted text in the detail panel on the right, labelled as the agent's and not checked, with **Open** and **Copy**. It appears there as soon as the agent finishes, even while the dialog is open. The left column keeps the conversation (with **View round**) and the decision cards, in the console's words: **Post it to Jira** (marked outward, with exactly the text that goes), **Edit the draft**, **Keep it as a draft** and **Mark it done**. Post asks you to confirm the exact text first, and nothing is posted before that.
|
|
195
199
|
|
|
196
200
|
**An agent's offer.** When an agent has offered to draft an item, the dialog shows three choices: let the agent draft it (suggested), do it today, or not before next Monday. You pick one and press its button. A row with steps says how many it has and how many an agent can do. PMOS does not record that a step is done, so it shows no "done" count.
|
|
197
201
|
|
|
@@ -211,7 +215,7 @@ My work is the second place on the rail, at `/premium-work.html`. It reads the l
|
|
|
211
215
|
- **Focus** sits under the add line. It shows the first of the (at most three) things PMOS suggests for today, grouped by the job they serve, with **Accept**. **See all** lists them with Accept, Not today and Clear, and your jobs with their open counts, and **Add a job** takes one line (`when …, I want …, so …`). An accepted group tags its Today rows with Focus. Focus starts empty each day. Editing and deleting a job stay in the console.
|
|
212
216
|
- **Keys and swipe** work on the rows of the plate and the tray. J and K move between rows. The right arrow, or a drag to the right past 90 px, does Done on a Today row and In Today elsewhere; the left arrow, or a drag to the left, does Tomorrow on a Today row and Someday elsewhere. A Today row whose draft is ready offers Review on the right. A row in Waiting has none. Each one offers Undo, and under reduced motion the row does not slide.
|
|
213
217
|
|
|
214
|
-
Not drawn, because no record backs them:
|
|
218
|
+
Not drawn, because no record backs them: answers and ideas an agent files by itself, "fold the laundry", the week bars and the capacity figure, and the mockup's suggested place on an inbox item.
|
|
215
219
|
|
|
216
220
|
## Board
|
|
217
221
|
|
|
@@ -244,7 +248,7 @@ The initiative page is at `/premium-initiative.html?id=<initiative>`. A click on
|
|
|
244
248
|
- **Checks** lists the engine's six steps (spec, contract, build, quality, review, accept) with their state and the evidence each states, and marks the next one. "All N workflow steps" lists every step.
|
|
245
249
|
- **Tasks** lists the PRD requirements and the board's tracker items for this initiative. The repository records no result for each requirement, so a requirement says "No result" and is never drawn as done or open. **By stage** groups them by state. **Timeline** draws a bar for each task that has both a start and a due date, and lists the rest. Press a task to read its record; for a PMOS task you can change its status. **Add a task** writes a PMOS task to the board's own record; with no dates the board plans it from tomorrow for a week. Jira tickets stay read-only. **Add a document** works as on the Board, with a phase as well, and saves on the initiative's record.
|
|
246
250
|
- **Core documents** has the same counts, filter and search as the Board's card, for this initiative. **Draft it** starts the existing read-only run that writes a draft and sends nothing. Technical documents (the record, the rubric, the stories, the review and the explainer) are grouped and not counted.
|
|
247
|
-
- **The document sheet.** A document that has a file opens in a dialog with **Read** (the file's text, its front matter as a grid and an outline), **Edit** (the file as plain Markdown, a reason, and **Save**), **Proposals** (**Ask the agent**, the open proposals with **Accept** and **Reject**, and the closed ones), **Edit log** (the revisions and other entries of the document sheet)
|
|
251
|
+
- **The document sheet.** A document that has a file opens in a dialog with **Read** (the file's text, its front matter as a grid and an outline), **Edit** (the file as plain Markdown, a reason, and **Save**), **Proposals** (**Ask the agent**, the open proposals with **Accept** and **Reject**, and the closed ones), **Edit log** (the revisions and other entries of the document sheet), **Health** (the document-health checks; a check with no input is not counted) and **Relations** (the documents it draws on, its goals, and the documents that use it, from the document library; a related file opens in the same sheet, and a goal or a missing file is listed but cannot be opened). The status line also names each **copy in another tool** (a Confluence page or Google Doc, with its state: in step, behind, both changed and so on), or offers **Link a copy**. Pressing it opens a panel with each copy's state, a link to open it, **Check now** (one agent session reads the copies with your connectors) and a box to paste a link. The sheet never writes to a copy; updating one is in the console. The file changes only when you press Save or Accept, and every change is kept in the Edit log with its reason. Save and Reject need a reason. A proposal made on text that has since changed shows which sections are out of date and cannot take them. The agent beside the sheet still only reads. A draft shows a bar above its text: **Issue it** marks the draft issued, through the console's own route, and sends nothing; it refuses while the Edit tab holds unsaved changes. Bold and undo buttons and Drop are not built on this page.
|
|
248
252
|
|
|
249
253
|
Not drawn, because PMOS holds no record for them: the mockup's demo tasks, its Jira data, and the owner "Agents" on a requirement.
|
|
250
254
|
|
|
@@ -283,7 +287,7 @@ The premium Briefing is the default page: `/` and `/index.html` open it. The con
|
|
|
283
287
|
|
|
284
288
|
## The dialog on a phone and the document sheet's views
|
|
285
289
|
|
|
286
|
-
On a phone or tablet (under 1000 px) every dialog opens on **Detail**. A **Detail / Conversation** switch sits under the title, and **Open it** at the foot of Detail brings the conversation when an action waits there. The header holds only **Close**. A document sheet picks its view (**Read**, **Edit**, **Proposals**, **Edit log**, **Health**) from one button with a menu.
|
|
290
|
+
On a phone or tablet (under 1000 px) every dialog opens on **Detail**. A **Detail / Conversation** switch sits under the title, and **Open it** at the foot of Detail brings the conversation when an action waits there. The header holds only **Close**. A document sheet picks its view (**Read**, **Edit**, **Proposals**, **Edit log**, **Health**, **Relations**) from one button with a menu.
|
|
287
291
|
|
|
288
292
|
A dialog's detail panel opens with the record's path, its heading and one lead line. A decision's evidence reads as a list. A measure's dialog draws the measure's chart above its facts and readings.
|
|
289
293
|
|
|
@@ -23,6 +23,7 @@ const dateLine = (ms) => { const d = new Date(ms); return WEEKDAYS[d.getDay()] +
|
|
|
23
23
|
const isoDay = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); return m ? new Date(+m[1], +m[2] - 1, +m[3]) : null; };
|
|
24
24
|
const shortDate = (iso) => { const d = isoDay(iso); return d ? d.getDate() + ' ' + MON[d.getMonth()] : ''; };
|
|
25
25
|
const daysBetween = (fromIso, toIso) => { const a = isoDay(fromIso), b = isoDay(toIso); return a && b ? Math.round((b - a) / 86400000) : null; };
|
|
26
|
+
const daysAgo = (iso, n) => { const d = isoDay(iso); d.setDate(d.getDate() - n); return d.getFullYear() + '-' + pad(d.getMonth() + 1) + '-' + pad(d.getDate()); };
|
|
26
27
|
const clip = (s, n) => { s = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return s.length > n ? s.slice(0, n - 1).trimEnd() + '…' : s; };
|
|
27
28
|
const MAX_PER = 8;
|
|
28
29
|
const SECTIONS = [['inbox', 'Inbox'], ['today', 'Today'], ['upcoming', 'Upcoming'], ['someday', 'Someday']];
|
|
@@ -212,7 +213,25 @@ function build({ v, now, events }) {
|
|
|
212
213
|
const waitingRows = (work.waiting || []).slice(0, MAX_PER).map((it) => rowOf(it, 'waiting', v, reviewIds.has(it.id), focusIds));
|
|
213
214
|
const agentRows = ready.concat(running, failed.filter((x) => !ready.includes(x))).slice(0, MAX_PER).map((x) => rowOf(x.it, x.list, v, reviewIds.has(x.it.id), focusIds));
|
|
214
215
|
const trayRows = tray.slice(0, MAX_PER).map((it) => rowOf(it, 'tray', v, reviewIds.has(it.id), focusIds));
|
|
215
|
-
const
|
|
216
|
+
const shelf = shelfOf();
|
|
217
|
+
const rowsAll = [].concat(...sections.map((s) => s.rows), waitingRows, agentRows, trayRows, ...shelf.tabs.map((t) => t.rows));
|
|
218
|
+
/* The tray as tabs, from the item records alone: To place, Ready (an agent draft is ready), Working (an agent runs), Kept (a Keep press was recorded), Used (done in the last 7 days), Compost (untouched for the review days). */
|
|
219
|
+
function shelfOf() {
|
|
220
|
+
const loc = (v.items || all.map((x) => x.it)).filter(isLocal);
|
|
221
|
+
const rowFor = (it, cta) => { const r = rowOf(it, 'tray', v, reviewIds.has(it.id), focusIds); r.cta = cta; return r; };
|
|
222
|
+
const week = daysAgo(today, 7);
|
|
223
|
+
const open = loc.filter((it) => !it.done);
|
|
224
|
+
const tabs = [
|
|
225
|
+
['place', 'To place', tray.filter((it) => !isReady(it) && !isRunning(it) && !reviewIds.has(it.id)), { label: 'Today', act: 'today' }],
|
|
226
|
+
['ready', 'Ready', tray.filter(isReady), { label: 'Review', act: 'open' }],
|
|
227
|
+
['working', 'Working', tray.filter(isRunning), null],
|
|
228
|
+
['kept', 'Kept', open.filter((it) => it.kept_at), { label: 'Use it', act: 'done' }],
|
|
229
|
+
['used', 'Used', loc.filter((it) => it.done && String(it.done_at || '').slice(0, 10) >= week), null],
|
|
230
|
+
['compost', 'Compost', tray.filter((it) => reviewIds.has(it.id)), { label: 'Let go', act: 'letgo' }],
|
|
231
|
+
];
|
|
232
|
+
return { tabs: tabs.map(([key, label, items, cta]) => ({ key, label, n: items.length, more: Math.max(0, items.length - MAX_PER), rows: items.slice(0, MAX_PER).map((it) => rowFor(it, cta)) })),
|
|
233
|
+
note: 'Tabs come from your items: a draft ready, an agent running, a Keep you pressed, an item done this week, or one untouched for ' + (v.review_days || 7) + ' days. Answers and ideas an agent files on its own are not shown: PMOS holds no record of them.' };
|
|
234
|
+
}
|
|
216
235
|
const firstToday = sections[1].rows[0];
|
|
217
236
|
const model = {
|
|
218
237
|
date: dateLine(now), today, pending: false,
|
|
@@ -225,6 +244,7 @@ function build({ v, now, events }) {
|
|
|
225
244
|
waiting: { title: 'Waiting on others', cap: longest != null ? 'longest ' + longest + ' ' + plural(longest, 'day', 'days') : (work.waiting || []).length ? num(work.waiting.length) + ' waiting' : '', n: (work.waiting || []).length, more: Math.max(0, (work.waiting || []).length - MAX_PER), rows: waitingRows },
|
|
226
245
|
review: { n: (v.review || []).length, days: v.review_days, ids: (v.review || []).map((i) => i.id) },
|
|
227
246
|
dock: { needs: clear, label: 'to clear', next: firstToday ? firstToday.title : (sections[0].rows[0] ? sections[0].rows[0].title : null) },
|
|
247
|
+
shelf,
|
|
228
248
|
friday: fridayOf({ today, work, tray, ready, review: v.review || [] }),
|
|
229
249
|
week: weekOf({ today, items: v.items || all.map((x) => x.it), events }),
|
|
230
250
|
focus, jobs,
|
|
@@ -141,7 +141,7 @@ function fold(lines) {
|
|
|
141
141
|
items.set(ev.id, { ...items.get(ev.id), done: true, done_at: ev.at, done_how: DONE_HOW.includes(ev.how) ? ev.how : 'you', touched_at: ev.at, ...outcome });
|
|
142
142
|
}
|
|
143
143
|
else if (ev.event === 'reopened' && items.has(ev.id)) items.set(ev.id, { ...items.get(ev.id), done: false, done_at: null, done_how: null, touched_at: ev.at });
|
|
144
|
-
else if (ev.event === 'kept' && items.has(ev.id)) items.set(ev.id, { ...items.get(ev.id), touched_at: ev.at });
|
|
144
|
+
else if (ev.event === 'kept' && items.has(ev.id)) items.set(ev.id, { ...items.get(ev.id), touched_at: ev.at, kept_at: ev.at });
|
|
145
145
|
else if (ev.event === 'dropped' || ev.event === 'deleted') items.delete(ev.id);
|
|
146
146
|
}
|
|
147
147
|
return [...items.values()];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.294.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.294.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -17,6 +17,7 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
|
17
17
|
const until = async (fn, ms = 10000, step = 100) => { const t0 = Date.now(); for (;;) { const v = await fn(); if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
|
|
18
18
|
const results = [];
|
|
19
19
|
const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + extra : ''}`); };
|
|
20
|
+
const more = async (pg) => { if (await pg.locator('#card [data-p="more"][aria-expanded="false"]').count()) await pg.click('#card [data-p="more"]'); };
|
|
20
21
|
let srv = null; let browser = null;
|
|
21
22
|
const finish = async (code) => {
|
|
22
23
|
if (browser) await browser.close().catch(() => {});
|
|
@@ -105,7 +106,7 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
|
|
|
105
106
|
|
|
106
107
|
/* W2 edit */
|
|
107
108
|
await openKey(p, 'work:item-aaaaaaaaaaa1');
|
|
108
|
-
await p.click('[data-p="xt"][data-k="edit"]');
|
|
109
|
+
await more(p); await p.click('[data-p="xt"][data-k="edit"]');
|
|
109
110
|
const ed = await p.evaluate(() => ({ dis: document.querySelector('#xeT').disabled, note: document.querySelector('.xpan .note').textContent, exp: document.querySelector('[data-p="xt"][data-k="edit"]').getAttribute('aria-expanded') }));
|
|
110
111
|
ok('W2 a title owned by Jira is read-only and says why', ed.dis && /comes from Jira/.test(ed.note) && ed.exp === 'true', JSON.stringify(ed));
|
|
111
112
|
const n0 = pc(); await p.click('[data-p="xsave"]'); await sleep(300);
|
|
@@ -117,16 +118,16 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
|
|
|
117
118
|
ok('W9 Undo of Save posts the old values back', A.last().path === '/api/pm-items/edit' && JSON.stringify(A.last().body.fields) === JSON.stringify({ due: null, priority: null, job: null }), JSON.stringify(A.last()));
|
|
118
119
|
await dlgOff(p);
|
|
119
120
|
await openKey(p, 'work:item-bbbbbbbbbbb2');
|
|
120
|
-
await p.click('[data-p="xt"][data-k="edit"]'); await p.fill('#xeT', 'Prepare for the Design review (final)'); await p.fill('#xeW', 'Priya');
|
|
121
|
+
await more(p); await p.click('[data-p="xt"][data-k="edit"]'); await p.fill('#xeT', 'Prepare for the Design review (final)'); await p.fill('#xeW', 'Priya');
|
|
121
122
|
await p.click('[data-p="xsave"]');
|
|
122
123
|
ok('W2 a local title can change, and a name in Waiting on goes to the waiting route', await wait(() => A.posts.some((x) => x.path === '/api/pm-items/edit' && x.body.id === 'item-bbbbbbbbbbb2' && JSON.stringify(x.body.fields) === JSON.stringify({ title: 'Prepare for the Design review (final)' })) && A.last().path === '/api/pm-items/waiting' && A.last().body.on === 'Priya'), JSON.stringify(A.last()));
|
|
123
124
|
await dlgOff(p);
|
|
124
125
|
|
|
125
126
|
/* W3 steps */
|
|
126
127
|
await openKey(p, 'work:item-bbbbbbbbbbb2');
|
|
127
|
-
const sbtn = await txt('[data-p="xt"][data-k="steps"]');
|
|
128
|
+
await more(p); const sbtn = await txt('[data-p="xt"][data-k="steps"]');
|
|
128
129
|
ok('W3 the tool row counts the item\'s steps', /Who does each step · 2/.test(sbtn), sbtn);
|
|
129
|
-
await p.click('[data-p="xt"][data-k="steps"]');
|
|
130
|
+
await more(p); await p.click('[data-p="xt"][data-k="steps"]');
|
|
130
131
|
const st = await p.evaluate(() => ({ items: [...document.querySelectorAll('.xsteps li .xst')].map((x) => x.textContent), pressed: [...document.querySelectorAll('.xsteps [aria-pressed="true"]')].map((x) => x.textContent), h: [...document.querySelectorAll('.xpan .cta, .xpan input')].map((b) => Math.round(b.getBoundingClientRect().height)) }));
|
|
131
132
|
ok('W3 each step shows who does it, from the record', st.items.join('|') === 'List the open questions|Send the agenda to the team' && st.pressed.join() === 'You,Agent drafts' && st.h.every((x) => x >= 44), JSON.stringify(st));
|
|
132
133
|
A.replies['/api/pm-items/steps/who'] = { ok: true, who: 'agent-drafts', forced: true };
|
|
@@ -142,8 +143,8 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
|
|
|
142
143
|
|
|
143
144
|
/* W4 Not before */
|
|
144
145
|
await openKey(p, 'work:item-ccccccccccc1');
|
|
145
|
-
ok('W4 an item with a Not before day says it on the tool', /From 18 Oct/.test(await txt('[data-p="xt"][data-k="defer"]')));
|
|
146
|
-
await p.click('[data-p="xt"][data-k="defer"]');
|
|
146
|
+
await more(p); ok('W4 an item with a Not before day says it on the tool', /From 18 Oct/.test(await txt('[data-p="xt"][data-k="defer"]')));
|
|
147
|
+
await more(p); await p.click('[data-p="xt"][data-k="defer"]');
|
|
147
148
|
const dq = await p.evaluate(() => [...document.querySelectorAll('[data-p="xdq"]')].map((b) => [b.textContent, b.dataset.v].join('=')));
|
|
148
149
|
ok('W4 Tomorrow, Monday and In a week are dates from the server\'s day (Fri 16 Oct)', dq.join() === 'Tomorrow=2026-10-17,Monday=2026-10-19,In a week=2026-10-23', dq.join());
|
|
149
150
|
await p.click('[data-p="xdq"][data-v="2026-10-19"]');
|
|
@@ -151,7 +152,7 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
|
|
|
151
152
|
await undoOf(p);
|
|
152
153
|
ok('W9 Undo restores the earlier day', A.last().path === '/api/pm-items/defer' && A.last().body.until === '2026-10-18', JSON.stringify(A.last()));
|
|
153
154
|
await dlgOff(p);
|
|
154
|
-
await openKey(p, 'work:item-ccccccccccc1'); await p.click('[data-p="xt"][data-k="defer"]');
|
|
155
|
+
await openKey(p, 'work:item-ccccccccccc1'); await more(p); await p.click('[data-p="xt"][data-k="defer"]');
|
|
155
156
|
ok('W4 a date field turns the button on and names the day', await p.evaluate(() => document.querySelector('[data-p="xdgo"]').disabled) && (await p.fill('#xdD', '2026-11-02'), await p.evaluate(() => !document.querySelector('[data-p="xdgo"]').disabled && /Not before 2 Nov/.test(document.querySelector('[data-p="xdgo"]').textContent))));
|
|
156
157
|
await p.click('[data-p="xdclr"]');
|
|
157
158
|
ok('W4 Clear the date posts until null', await wait(() => A.last().path === '/api/pm-items/defer' && A.last().body.until === null), JSON.stringify(A.last()));
|
|
@@ -159,14 +160,14 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
|
|
|
159
160
|
|
|
160
161
|
/* W5 Someday */
|
|
161
162
|
await openKey(p, 'work:item-aaaaaaaaaaa2');
|
|
162
|
-
await p.click('[data-p="xt"][data-k="someday"]');
|
|
163
|
+
await more(p); await p.click('[data-p="xt"][data-k="someday"]');
|
|
163
164
|
ok('W5 Someday posts the id to someday', await wait(() => A.last().path === '/api/pm-items/someday' && A.last().body.id === 'item-aaaaaaaaaaa2' && Object.keys(A.last().body).join() === 'id'), JSON.stringify(A.last()));
|
|
164
165
|
await undoOf(p);
|
|
165
166
|
ok('W9 Undo posts unpark', A.last().path === '/api/pm-items/unpark' && A.last().body.id === 'item-aaaaaaaaaaa2', JSON.stringify(A.last()));
|
|
166
167
|
await dlgOff(p);
|
|
167
168
|
await openKey(p, 'work:item-eeeeeeeeeee1');
|
|
168
|
-
ok('W5 an item already in Someday says so and the press brings it back', /In Someday/.test(await txt('[data-p="xt"][data-k="someday"]')) && await p.evaluate(() => document.querySelector('[data-p="xt"][data-k="someday"]').getAttribute('aria-pressed') === 'true'));
|
|
169
|
-
await p.click('[data-p="xt"][data-k="someday"]');
|
|
169
|
+
await more(p); ok('W5 an item already in Someday says so and the press brings it back', /In Someday/.test(await txt('[data-p="xt"][data-k="someday"]')) && await p.evaluate(() => document.querySelector('[data-p="xt"][data-k="someday"]').getAttribute('aria-pressed') === 'true'));
|
|
170
|
+
await more(p); await p.click('[data-p="xt"][data-k="someday"]');
|
|
170
171
|
ok('W5 …by posting unpark', await wait(() => A.last().path === '/api/pm-items/unpark' && A.last().body.id === 'item-eeeeeeeeeee1'), JSON.stringify(A.last()));
|
|
171
172
|
await dlgOff(p);
|
|
172
173
|
|
|
@@ -193,39 +194,39 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
|
|
|
193
194
|
/* W7 a ready draft: nothing is posted before the confirm */
|
|
194
195
|
const RD = await open({ model: mk((v) => { v.work.today[0].origin = 'jira'; v.work.today[0].place = null; }) }), q = RD.page;
|
|
195
196
|
await openKey(q, 'work:wbs:alpha:4.2');
|
|
196
|
-
const rd = await q.evaluate(() => ({ state: document.querySelector('.agblk').dataset.state, tag: document.querySelector('.
|
|
197
|
-
ok('W7 a ready draft is labelled the agent\'s, unchecked, and offers Post, Edit,
|
|
197
|
+
const rd = await q.evaluate(() => ({ state: document.querySelector('.agblk').dataset.state, tag: document.querySelector('.agpane .agtag').textContent, body: document.querySelector('.agpane').textContent, btn: [...document.querySelectorAll('.agblk .xco b, .agblk > .cact button')].map((b) => b.textContent.trim()), copy: !!document.querySelector('[data-pp="copy"]'), open: !!document.querySelector('[data-pp="open"]') }));
|
|
198
|
+
ok('W7 a ready draft is labelled the agent\'s, unchecked, and shows it in the detail panel with Open and Copy, and offers Post, Edit, Keep, Mark done and Send back', rd.state === 'ready' && /Agent draft · not checked/.test(rd.tag) && /sign off A and B/.test(rd.body) && rd.copy && rd.open && rd.btn.join() === 'Post it to Jira,Edit the draft,Keep it as a draft,Mark it done,Post it to Jira,Send it back with a note', JSON.stringify(rd));
|
|
198
199
|
const m0 = RD.posts.length; await q.click('[data-p="ag-post"]'); await sleep(300);
|
|
199
200
|
const cf = await q.evaluate(() => ({ text: document.querySelector('.xcon').textContent, btn: [...document.querySelectorAll('.xcon button')].map((b) => b.textContent.trim()) }));
|
|
200
201
|
ok('W7 Post it posts nothing: it asks, names Jira and shows exactly the text', RD.posts.length === m0 && /Post this to Jira as you\?/.test(cf.text) && /Two of the three quotes meet the brief\. I would sign off A and B\./.test(cf.text) && cf.btn.join() === 'Post it to Jira now,Not yet', JSON.stringify(cf));
|
|
201
202
|
await q.click('[data-p="ag-no"]'); await sleep(200);
|
|
202
203
|
ok('W7 Not yet takes the confirm away and still posts nothing', RD.posts.length === m0 && await q.evaluate(() => !document.querySelector('.xcon')));
|
|
203
|
-
await q.click('[data-p="
|
|
204
|
+
await q.click('[data-p="dpick"][data-v="edit"]'); await q.fill('#agBody', 'Sign off A only.');
|
|
204
205
|
await q.click('[data-p="ag-save"]');
|
|
205
206
|
ok('W7 Save my version posts decide edit with the text', await until(() => RD.last() && RD.last().path === '/api/my-work/decide' && RD.last().body.action === 'edit' && RD.last().body.body === 'Sign off A only.' && RD.last().body.item === 'wbs:alpha:4.2'), JSON.stringify(RD.last()));
|
|
206
|
-
await q.click('[data-p="ag-post"]'); await q.click('[data-p="ag-go"]');
|
|
207
|
+
await q.click('[data-p="dpick"][data-v="post"]'); await q.click('[data-p="ag-post"]'); await q.click('[data-p="ag-go"]');
|
|
207
208
|
ok('W7 the confirm posts decide approve, with the PM\'s text because it was edited', await until(() => RD.last().path === '/api/my-work/decide' && RD.last().body.action === 'approve' && RD.last().body.body === 'Sign off A only.' && RD.last().body.item === 'wbs:alpha:4.2'), JSON.stringify(RD.last()));
|
|
208
|
-
await q.click('[data-p="ag-edit"]');
|
|
209
|
+
await q.click('[data-p="ag-edit"]');
|
|
209
210
|
await q.click('[data-p="ag-post"]'); await q.click('[data-p="ag-go"]');
|
|
210
211
|
ok('W7 approving the agent\'s own text sends no body', await until(() => RD.posts.filter((x) => x.body.action === 'approve').length === 2) && !('body' in RD.posts.filter((x) => x.body.action === 'approve')[1].body) || true);
|
|
211
212
|
await q.click('[data-p="ag-back"]');
|
|
212
213
|
ok('W7 Send it back needs a note', await q.evaluate(() => document.querySelector('[data-p="ag-sendback"]').disabled));
|
|
213
214
|
await q.fill('#agNote', 'Cover the third quote too.'); await q.click('[data-p="ag-sendback"]');
|
|
214
215
|
ok('W7 Send it back posts decide revise with the note', await until(() => RD.last().body.action === 'revise' && RD.last().body.note === 'Cover the third quote too.' && RD.last().body.item === 'wbs:alpha:4.2'), JSON.stringify(RD.last()));
|
|
215
|
-
await q.click('[data-p="ag-done"]');
|
|
216
|
+
await q.click('[data-p="dpick"][data-v="done"]'); await q.click('[data-p="ag-done"]');
|
|
216
217
|
ok('W7 Mark it done posts done for the item and nothing outward', await until(() => RD.last().path === '/api/pm-items/done' && RD.last().body.id === 'wbs:alpha:4.2'), JSON.stringify(RD.last()));
|
|
217
218
|
ok('W7 every press of the agent block went to a listed route, and none to Jira or Slack', RD.posts.every((x) => ALLOWED.has(x.path)), RD.posts.map((x) => x.path).join());
|
|
218
219
|
await RD.ctx.close();
|
|
219
220
|
{ const M2 = mk((v) => { v.work.today[1].agent = F.A('ready', { draft: { summary: 'First version', body: 'A first version of the agenda.' } }); });
|
|
220
221
|
const R = await open({ model: M2 }); await openKey(R.page, 'work:item-bbbbbbbbbbb2');
|
|
221
|
-
const b = await R.page.evaluate(() => [...document.querySelectorAll('.agblk
|
|
222
|
-
ok('W7 an item the PM added has no Post: nothing leaves PMOS, it can be kept or marked done', b.join() === 'Edit the draft,
|
|
222
|
+
const b = await R.page.evaluate(() => [...document.querySelectorAll('.agblk .xco b')].map((x) => x.textContent.trim()));
|
|
223
|
+
ok('W7 an item the PM added has no Post: nothing leaves PMOS, it can be kept or marked done', b.join() === 'Edit the draft,Keep it as a draft,Mark it done' && /Nothing went to anyone/.test(await R.page.evaluate(() => document.querySelector('.agblk .nodef').textContent)), b.join());
|
|
223
224
|
await R.ctx.close(); }
|
|
224
225
|
|
|
225
226
|
/* W11 a refusal shows its reason and changes nothing */
|
|
226
227
|
{ const R = await open(); await openKey(R.page, 'work:item-bbbbbbbbbbb2');
|
|
227
228
|
R.refuse({ status: 409, body: { ok: false, error: 'the draft moved on while you read it' } });
|
|
228
|
-
await R.page.click('[data-p="xt"][data-k="someday"]'); await sleep(500);
|
|
229
|
+
await more(R.page); await R.page.click('[data-p="xt"][data-k="someday"]'); await sleep(500);
|
|
229
230
|
const e = await R.page.evaluate(() => ({ open: document.querySelector('#dlg').classList.contains('on'), msg: document.querySelector('#cardErr').textContent, shown: !document.querySelector('#cardErr').hidden, dis: [...document.querySelectorAll('#card button')].filter((b) => b.disabled && b.id !== 'wBtn').length }));
|
|
230
231
|
ok('W11 a refused press shows the server\'s words, keeps the dialog open and leaves the buttons on', e.open && e.shown && /the draft moved on/.test(e.msg) && e.dis === 0, JSON.stringify(e));
|
|
231
232
|
await R.ctx.close(); }
|
|
@@ -304,7 +305,7 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
|
|
|
304
305
|
await openKey(q2, 'work:item-bbbbbbbbbbb2'); await q2.click('#dTabs [data-t="chat"]'); await sleep(900);
|
|
305
306
|
const g = {};
|
|
306
307
|
for (const k of ['edit', 'steps', 'defer']) {
|
|
307
|
-
await q2.click(`[data-p="xt"][data-k="${k}"]`); await sleep(150);
|
|
308
|
+
await more(q2); await q2.click(`[data-p="xt"][data-k="${k}"]`); await sleep(150);
|
|
308
309
|
g[k] = await q2.evaluate(() => ({ over: document.documentElement.scrollWidth > innerWidth + 1 || document.querySelector('#dlg').scrollWidth > document.querySelector('#dlg').clientWidth + 1, small: [...document.querySelectorAll('#card button, #card input, #card select')].filter((b) => !b.closest('[hidden]') && b.getBoundingClientRect().height > 0 && b.getBoundingClientRect().height < 43.5).map((b) => (b.dataset.p || b.id) + ':' + Math.round(b.getBoundingClientRect().height)) }));
|
|
309
310
|
}
|
|
310
311
|
ok(`W12 at 390 px (${theme}) the edit, steps and Not before panels have no sideways scroll and every control is 44 px`, ['edit', 'steps', 'defer'].every((k) => !g[k].over && g[k].small.length === 0), JSON.stringify(g));
|
|
@@ -327,7 +328,7 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
|
|
|
327
328
|
ok('E1 on an empty scratch state the page says the list is empty and Focus has nothing to suggest', await until(() => pg.evaluate(() => document.querySelector('#brief').textContent === 'Your list is empty.' && /Nothing to suggest/.test(document.querySelector('#xFocus').textContent)), 20000));
|
|
328
329
|
await pg.fill('#capIn', 'Reply to Rina about SSO !p1'); await pg.press('#capIn', 'Enter');
|
|
329
330
|
await dlgOn(pg); await sleep(700);
|
|
330
|
-
await pg.click('[data-p="xt"][data-k="edit"]'); await pg.fill('#xeT', 'Reply to Rina about SSO beta'); await pg.fill('#xeD', '2026-10-30'); await pg.click('[data-p="xpri"][data-v="P2"]'); await pg.click('[data-p="xsave"]');
|
|
331
|
+
await more(pg); await pg.click('[data-p="xt"][data-k="edit"]'); await pg.fill('#xeT', 'Reply to Rina about SSO beta'); await pg.fill('#xeD', '2026-10-30'); await pg.click('[data-p="xpri"][data-v="P2"]'); await pg.click('[data-p="xsave"]');
|
|
331
332
|
await dlgOff(pg);
|
|
332
333
|
let it = (await get('/api/pm-items')).items.find((i) => /SSO beta/.test(i.title));
|
|
333
334
|
ok('E2 Edit saves the title, the day and the priority through the real route', it && it.title === 'Reply to Rina about SSO beta' && it.due === '2026-10-30' && it.priority === 'P2', JSON.stringify(it));
|
|
@@ -335,13 +336,13 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
|
|
|
335
336
|
it = (await get('/api/pm-items')).items.find((i) => i.id === it.id);
|
|
336
337
|
ok('E3 Undo writes the old values back (the title the parser made, no day, P1)', it.title === 'Reply to Rina about SSO !' && !it.due && it.priority === 'P1', JSON.stringify(it));
|
|
337
338
|
await pg.locator('#trayBody .wrh').first().click(); await dlgOn(pg); await sleep(700);
|
|
338
|
-
await pg.click('[data-p="xt"][data-k="steps"]');
|
|
339
|
+
await more(pg); await pg.click('[data-p="xt"][data-k="steps"]');
|
|
339
340
|
await pg.fill('#xsIn', 'Send the SSO plan to Rina'); await pg.click('[data-p="xsadd"]');
|
|
340
341
|
ok('E4 a step is added through the real route', await until(async () => ((await get('/api/pm-items')).items.find((i) => i.id === it.id) || {}).steps && (await get('/api/pm-items')).items.find((i) => i.id === it.id).steps.length === 1, 8000));
|
|
341
342
|
await pg.click('[data-p="xwho"][data-v="agent-does"]');
|
|
342
343
|
const sid = (await get('/api/pm-items')).items.find((i) => i.id === it.id).steps[0];
|
|
343
344
|
ok('E5 an outward step asked to be Agent does comes back as Agent drafts, and the page says so', await until(async () => ((await get('/api/pm-items')).items.find((i) => i.id === it.id).steps[0] || {}).who === 'agent-drafts', 8000) && await pg.evaluate(() => /Agent drafts/.test(document.querySelector('#toast').textContent) || /sends something to a person/.test(document.querySelector('.xpan .note').textContent)) && sid.text === 'Send the SSO plan to Rina');
|
|
344
|
-
await pg.click('[data-p="xt"][data-k="defer"]'); await pg.click('[data-p="xdq"][data-v]:nth-of-type(1)');
|
|
345
|
+
await more(pg); await pg.click('[data-p="xt"][data-k="defer"]'); await pg.click('[data-p="xdq"][data-v]:nth-of-type(1)');
|
|
345
346
|
await dlgOff(pg);
|
|
346
347
|
it = (await get('/api/pm-items')).items.find((i) => i.id === it.id);
|
|
347
348
|
ok('E6 Not before sets the defer day on the real record (tomorrow, the server\'s day)', /^\d{4}-\d{2}-\d{2}$/.test(it.defer || '') && it.defer > (await get('/api/pm-items')).today, JSON.stringify(it));
|
|
@@ -350,7 +351,7 @@ const mk = (edit) => { const v = F.view(); if (edit) edit(v); return WP.build({
|
|
|
350
351
|
ok('E7 Undo clears it', !it.defer, JSON.stringify(it));
|
|
351
352
|
await pg.locator('.wrow, #trayBody .wrh').first().click({ trial: true }).catch(() => {});
|
|
352
353
|
await pg.locator('#trayBody .wrh').first().click(); await dlgOn(pg); await sleep(700);
|
|
353
|
-
await pg.click('[data-p="xt"][data-k="someday"]'); await dlgOff(pg);
|
|
354
|
+
await more(pg); await pg.click('[data-p="xt"][data-k="someday"]'); await dlgOff(pg);
|
|
354
355
|
ok('E8 Someday parks the real record', (await get('/api/pm-items')).work.someday.some((i) => i.id === it.id));
|
|
355
356
|
await undoOf(pg, true); await sleep(300);
|
|
356
357
|
ok('E9 Undo brings it back (unpark)', !(await get('/api/pm-items')).work.someday.some((i) => i.id === it.id));
|
|
@@ -145,3 +145,47 @@ export function sectionAttribution(revs, texts) {
|
|
|
145
145
|
});
|
|
146
146
|
return out;
|
|
147
147
|
}
|
|
148
|
+
|
|
149
|
+
/** What surrounds one document in a /api/docs/library answer (the console reader's hoodOf and graph columns, as three plain lists): the documents it draws on
|
|
150
|
+
* (sources), its initiative and goals, and the documents that use it. An edge is "in step" unless the answer says otherwise, or an older source is cited by a newer
|
|
151
|
+
* document. `open` is set only for a real file; a node or a missing file is listed and cannot be opened. */
|
|
152
|
+
export function relationsOf(lib, path, iniName) {
|
|
153
|
+
const none = { sources: [], goals: [], used: [], count: 0 };
|
|
154
|
+
if (!lib || !Array.isArray(lib.files)) return none;
|
|
155
|
+
const me = lib.files.findIndex((f) => f.path === path);
|
|
156
|
+
if (me < 0) return none;
|
|
157
|
+
const kinds = lib.kinds || [], files = lib.files;
|
|
158
|
+
const st = (a, b, k, s) => s || (['link', 'cites', 'anchor'].includes(kinds[k]) && a.date && b.date && a.date > b.date ? 'drift' : 'ok');
|
|
159
|
+
const isGoal = (f) => f.category === 'goal' || f.node === 'Goal';
|
|
160
|
+
const node = (f, kind, s) => ({ name: f.title || f.path, sub: [kind, f.node || ''].filter((x, i, a) => x && a.indexOf(x) === i).join(' · '), st: s, path: f.path, open: !f.node && f.st !== 'node' && f.st !== 'missing' });
|
|
161
|
+
const src = [], out = [];
|
|
162
|
+
for (const [a, b, k, s] of lib.edges || []) {
|
|
163
|
+
if (b === me && a !== me && files[a]) src.push(node(files[a], kinds[k] || '', st(files[a], files[me], k, s)));
|
|
164
|
+
else if (a === me && b !== me && files[b]) out.push(node(files[b], kinds[k] || '', st(files[me], files[b], k, s)));
|
|
165
|
+
}
|
|
166
|
+
const goals = src.filter((n) => isGoal(files.find((f) => f.path === n.path) || {}));
|
|
167
|
+
const sources = src.filter((n) => !goals.includes(n));
|
|
168
|
+
if (iniName) goals.unshift({ name: iniName, sub: 'initiative', st: 'ok', path: '', open: false });
|
|
169
|
+
return { sources, goals, used: out, count: sources.length + goals.filter((n) => n.path).length + out.length };
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/** Which tool a pasted address names (the server checks it again): 'confluence', 'google', 'google-slides', 'google-sheets' or null. The console reader's rule. */
|
|
173
|
+
export function copyKindOf(target) {
|
|
174
|
+
const t = String(target || '');
|
|
175
|
+
if (/atlassian|confluence|\/wiki\/|pageId=/i.test(t)) return 'confluence';
|
|
176
|
+
if (/docs\.google\.com\/presentation|slides\.google|\/presentation\/d\//i.test(t)) return 'google-slides';
|
|
177
|
+
if (/docs\.google\.com\/spreadsheets|sheets\.google|\/spreadsheets\/d\//i.test(t)) return 'google-sheets';
|
|
178
|
+
if (/google|docs\.|drive\./i.test(t)) return 'google';
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
const COPY_STATE = {
|
|
182
|
+
same: ['In step', 'ok', 'Both have the same text.'], ahead: ['PMOS is ahead', 'warn', 'PMOS has changes the copy does not have.'], behind: ['Behind', 'warn', 'The copy has changes PMOS does not have.'],
|
|
183
|
+
diverged: ['Both changed', 'warn', 'Both changed since they last matched.'], unchecked: ['Not checked', '', 'No check has read this copy yet.'], unreadable: ['Cannot open', 'warn', 'The last check could not open the copy.'],
|
|
184
|
+
none: ['Not created', '', 'No copy exists yet.'], 'missing-remote': ['Not found', 'warn', 'The copy is not there any more.'], 'missing-repo': ['Not in PMOS', 'warn', 'This file is not in the repository any more.'] };
|
|
185
|
+
const COPY_KIND = { google: 'Google Doc', 'google-slides': 'Google Slides', 'google-sheets': 'Google Sheets', confluence: 'Confluence' };
|
|
186
|
+
/** One link of GET /api/docs as the sheet shows it: the tool's name, the state in words, a tone for the chip, and the sentence under it. */
|
|
187
|
+
export function copyView(l) {
|
|
188
|
+
const g = l.syncing ? ['Updating', 'warn', 'A session is updating this copy.'] : COPY_STATE[l.signal] || COPY_STATE.unchecked;
|
|
189
|
+
const tool = COPY_KIND[l.kind] || l.label || String(l.kind || 'Copy');
|
|
190
|
+
return { tool, state: g[0], tone: g[1], words: l.words || g[2], title: l.title || tool, url: l.url || '', target: l.target || '', checked: l.checked_at || '' };
|
|
191
|
+
}
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
* /api/doc-sheet routes and POST /api/doc-health/check. A draft has Issue it (POST /api/core-docs/issue) and, where the page asks for it, Draft it again.
|
|
4
4
|
* The caller gives the page's own facts: { ws(), scope(), rows(), reload(), noteKey(d), sub(), again }. */
|
|
5
5
|
import { pmPost } from './http.js';
|
|
6
|
-
import { proposalsModel, editBody, acceptBody, rejectBody, askBody, askLine, issueBody, mdHtml, sectionAttribution } from './premium-doc-edit.js';
|
|
6
|
+
import { proposalsModel, relationsOf, copyKindOf, copyView, editBody, acceptBody, rejectBody, askBody, askLine, issueBody, mdHtml, sectionAttribution } from './premium-doc-edit.js';
|
|
7
7
|
import { $, $$, esc, openDlg, closeDlg, toast, loadThread, logHtml, turnA, ptx, kv, CHECK, CHEV, AI } from './premium-shell.js';
|
|
8
8
|
|
|
9
9
|
const when = (iso) => { const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(iso || '')); if (!m) return ''; return +m[3] + ' ' + ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][+m[2] - 1]; };
|
|
10
10
|
|
|
11
11
|
export function mountDocSheet(ctx) {
|
|
12
12
|
let sheet = null; // { d, tab, text, log, health, props, draft, why, ask, askText, picked, busy, msg, err }
|
|
13
|
-
const TABS = [['read', 'Read'], ['edit', 'Edit'], ['props', 'Proposals'], ['log', 'Edit log'], ['health', 'Health']];
|
|
13
|
+
const TABS = [['read', 'Read'], ['edit', 'Edit'], ['props', 'Proposals'], ['log', 'Edit log'], ['health', 'Health'], ['rel', 'Relations']];
|
|
14
14
|
const wsq = () => (ctx.ws() ? '&ws=' + encodeURIComponent(ctx.ws()) : '');
|
|
15
15
|
const propsM = (s) => proposalsModel(s.props || []);
|
|
16
16
|
/** The bar above a draft (core document Issue, initiative premium-core-doc-issue). The words are fixed; the state is the row's own. */
|
|
@@ -41,13 +41,16 @@ export function mountDocSheet(ctx) {
|
|
|
41
41
|
}
|
|
42
42
|
function sheetPane() {
|
|
43
43
|
const s = sheet, d = s.d;
|
|
44
|
-
const
|
|
44
|
+
const rels = s.lib && !s.lib.err ? relationsOf(s.lib, s.d.path, s.d.iniName) : null;
|
|
45
|
+
const cnt = (k) => (k === 'props' && s.props && propsM(s).count ? ` <em>${propsM(s).count}</em>` : k === 'rel' && rels && rels.count ? ` <em>${rels.count}</em>` : '');
|
|
45
46
|
const EYE = '<svg class="i" viewBox="0 0 24 24"><path d="M2 12s4-7 10-7 10 7 10 7-4 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/></svg>';
|
|
46
47
|
const revs = (s.log && s.log.revisions) || [], last = revs[revs.length - 1], m0 = s.md || (s.text != null ? (s.md = mdHtml(s.text, { attr: s.attr })) : null);
|
|
47
48
|
const menu = `<div class="dsvr" id="shT"><span class="dsvw"><button type="button" class="dsvb" id="shV" aria-haspopup="menu" aria-expanded="${!!s.vm}">${EYE}${esc(TABS.find((t) => t[0] === s.tab)[1])}${cnt(s.tab)}${CHEV}</button>${s.vm ? `<div class="dsmn" role="menu" aria-label="Document views">${TABS.map(([k, n]) => `<button type="button" role="menuitem" data-sh="${k}" aria-current="${s.tab === k}">${n}${cnt(k)}${s.tab === k ? CHECK : ''}</button>`).join('')}</div>` : ''}</span>${s.tab === 'read' && m0 && m0.outline.length > 2 ? `<button type="button" class="dsvb ol" data-ds="olt" aria-pressed="${!s.olHide}">${s.olHide ? 'Show the outline' : 'Hide the outline'}</button>` : ''}</div>`;
|
|
48
49
|
const chk = s.health && s.health.total ? `<button type="button" class="chp lk ${s.health.passed === s.health.total ? 'ok' : 'warn'}" data-sh="health"><i></i>${s.health.passed} of ${s.health.total} checks</button>` : '';
|
|
50
|
+
const cps = (s.copies || []).map(copyView);
|
|
51
|
+
const cpc = s.copies == null ? '' : cps.length ? cps.map((c) => `<button type="button" class="chp lk ${c.tone}" data-ds="cp" aria-expanded="${!!s.cp}" title="${esc(c.words)}"><i></i>${esc(c.tool)}: ${esc(c.state.toLowerCase())}</button>`).join('') : `<button type="button" class="chp lk" data-ds="cp" aria-expanded="${!!s.cp}"><i></i>Link a copy</button>`;
|
|
49
52
|
const file = String(d.path).split('/').pop();
|
|
50
|
-
const head = `<div class="dsm2"><span class="chp ${d.st === 'ok' ? 'ok' : d.st === 'draft' ? 'warn' : ''}"><i></i>${esc(d.state)}</span>${revs.length ? `<span class="chp mono">v${revs.length}</span>` : ''}${chk}<button type="button" class="chp lk" data-ds="meta" aria-expanded="${!!s.meta}" title="${esc(d.path)}">${esc(file)}</button>${last ? `<span class="chp"><span>Last change: <b>${esc(whoOf(last))}</b>${last.at ? ', ' + esc(when(last.at)) : ''}</span></span>` : ''}${d.when && !last ? `<span class="chp">updated ${esc(d.when)}</span>` : ''}</div>${s.meta ? `<div class="dsmeta"><p class="dpath">${esc(d.path)}</p>${m0 && m0.fm.length ? kv(m0.fm) : '<p class="note">The file has no front matter.</p>'}</div>` : ''}`;
|
|
53
|
+
const head = `<div class="dsm2"><span class="chp ${d.st === 'ok' ? 'ok' : d.st === 'draft' ? 'warn' : ''}"><i></i>${esc(d.state)}</span>${revs.length ? `<span class="chp mono">v${revs.length}</span>` : ''}${chk}${cpc}<button type="button" class="chp lk" data-ds="meta" aria-expanded="${!!s.meta}" title="${esc(d.path)}">${esc(file)}</button>${last ? `<span class="chp"><span>Last change: <b>${esc(whoOf(last))}</b>${last.at ? ', ' + esc(when(last.at)) : ''}</span></span>` : ''}${d.when && !last ? `<span class="chp">updated ${esc(d.when)}</span>` : ''}</div>${s.cp ? copiesHtml(s, cps) : ''}${s.meta ? `<div class="dsmeta"><p class="dpath">${esc(d.path)}</p>${m0 && m0.fm.length ? kv(m0.fm) : '<p class="note">The file has no front matter.</p>'}</div>` : ''}`;
|
|
51
54
|
let body = '';
|
|
52
55
|
if (s.err) body = `<p class="empty3 plain">${esc(s.err)}</p>`;
|
|
53
56
|
else if (s.tab === 'read') {
|
|
@@ -87,9 +90,26 @@ export function mountDocSheet(ctx) {
|
|
|
87
90
|
} else if (s.tab === 'health') {
|
|
88
91
|
if (!s.health) body = '<p class="empty3 plain">Checking the document.</p>';
|
|
89
92
|
else body = `<p class="note" style="margin:0 0 10px">${s.health.passed} of ${s.health.total} checks that had the input they need passed. A check with no input is not counted.</p><div class="ckl">${s.health.checks.map((c) => `<div class="ckr ${c.pass === true ? 'done' : c.pass === false ? 'blocked' : 'skipped'}"><i></i><b>${esc(c.id)}</b><span>${c.pass === true ? 'Passed' : c.pass === false ? 'Not passed' : 'No input'}</span><small>${esc(c.reason || '')}</small></div>`).join('')}</div>`;
|
|
93
|
+
} else if (s.tab === 'rel') {
|
|
94
|
+
body = relHtml(s, rels);
|
|
90
95
|
}
|
|
91
96
|
return `<article class="paper doc">${head}${menu}<div id="shBody">${body}</div><p class="xn">Every change is kept in the Edit log with its reason. The file changes only when you press Save or Accept.</p></article>`;
|
|
92
97
|
}
|
|
98
|
+
/** Copies in other tools: each linked copy with its state, a link to open it, Check now, and a box to link another. The sheet never writes to the copy; updating one stays in the console. */
|
|
99
|
+
function copiesHtml(s, cps) {
|
|
100
|
+
const rows = cps.map((c) => `<div class="dscr"><div><b>${esc(c.title)}</b><span class="chp ${c.tone}">${esc(c.state)}</span></div><small>${esc([c.tool, c.target].filter(Boolean).join(' · '))}</small><p class="note" style="margin:4px 0 0">${esc(c.words)}${c.checked ? ' Last checked ' + esc(when(c.checked)) + '.' : ' Not checked yet.'}</p>${c.url ? `<a class="lk" href="${esc(c.url)}" target="_blank" rel="noopener">Open in ${esc(c.tool)}</a>` : ''}</div>`).join('');
|
|
101
|
+
return `<div class="dscp" data-copies><p class="label">Copies in other tools</p>${rows || '<p class="note">This document has no copy in Confluence or Google Docs yet. Link one to see whether it is in step.</p>'}`
|
|
102
|
+
+ `<div class="dsrow"><input id="dsCpUrl" class="dsy" type="text" placeholder="Paste a Confluence page or Google Doc link" aria-label="Address of the copy" value="${esc(s.cpUrl || '')}"><button class="dmcta dark" data-ds="cplink">Link</button>${cps.length ? `<button class="dmcta alt" data-ds="cpcheck"${s.checkRun ? ' disabled' : ''}>${s.checkRun ? 'Checking' : 'Check now'}</button>` : ''}</div>`
|
|
103
|
+
+ `${s.cpMsg ? `<p class="note" role="alert" style="margin:6px 0 0;color:var(--ember-ink)">${esc(s.cpMsg)}</p>` : ''}<p class="note" style="margin:8px 0 0">PMOS never writes to a copy from this sheet. Check now starts one agent session that reads the copies with your connectors. Updating a copy is in the console.</p></div>`;
|
|
104
|
+
}
|
|
105
|
+
/** Relations: three plain lists from the document library. A related file opens in this same sheet. */
|
|
106
|
+
function relHtml(s, R) {
|
|
107
|
+
if (s.lib === undefined || (s.lib === null && !s.err)) return '<p class="empty3 plain">Reading the document graph.</p>';
|
|
108
|
+
if (s.lib && s.lib.err) return `<p class="empty3 plain">${esc(s.lib.err)}</p>`;
|
|
109
|
+
const ST = { drift: 'Out of step', conflict: 'Conflict', missing: 'Missing', ahead: 'PMOS ahead' };
|
|
110
|
+
const grp = (h, list) => (list.length ? `<p class="label" style="margin:14px 0 8px">${h} · ${list.length}</p><div class="dsrel">${list.map((n) => `<div class="dsrr">${n.open ? `<button type="button" data-rel="${esc(n.path)}" data-rt="${esc(n.name)}" title="Open ${esc(n.name)}"><b>${esc(n.name)}</b><small>${esc(n.sub)}</small></button>` : `<span><b>${esc(n.name)}</b><small>${esc(n.sub)}</small></span>`}${n.st && n.st !== 'ok' ? `<span class="chp ${n.st === 'drift' ? 'warn' : ''}">${esc(ST[n.st] || n.st)}</span>` : ''}</div>`).join('')}</div>` : '');
|
|
111
|
+
return R && (R.sources.length || R.goals.length || R.used.length) ? grp('Sources', R.sources) + grp('Goals and initiative', R.goals) + grp('Used by', R.used) : '<p class="mut">No relation is recorded for this document.</p>';
|
|
112
|
+
}
|
|
93
113
|
function propHtml(s, p) {
|
|
94
114
|
const picked = s.picked && s.picked[p.id], on = (n) => (picked ? picked.includes(n) : true);
|
|
95
115
|
const secs = p.sections.map((x) => `<div class="dsdf">${p.sections.length > 1 && !x.stale ? `<label><input type="checkbox" data-pk="${esc(p.id)}" value="${esc(x.name)}"${on(x.name) ? ' checked' : ''}> ` : ''}<b>${esc(x.name)}</b>${p.sections.length > 1 && !x.stale ? '</label>' : ''} ${x.stale ? '<span class="dst2">Changed since this was proposed</span>' : `<ins>+ ${esc(x.add)}</ins>`}</div>`).join('');
|
|
@@ -124,6 +144,11 @@ export function mountDocSheet(ctx) {
|
|
|
124
144
|
if (sheet !== s) return;
|
|
125
145
|
if (!h || h.ok === false) s.err = (h && h.error) || 'The health check could not run.'; else s.health = h.health;
|
|
126
146
|
}
|
|
147
|
+
if (tab === 'rel' && s.lib === undefined) {
|
|
148
|
+
s.lib = null; const j = await getJson('/api/docs/library?' + wsq().slice(1));
|
|
149
|
+
if (sheet !== s) return;
|
|
150
|
+
s.lib = j && j.ok ? j : { err: (j && j.error) || 'The document graph could not be read.' };
|
|
151
|
+
}
|
|
127
152
|
if (sheet === s && s.tab === tab) drawSheet();
|
|
128
153
|
if (tab === 'read' && s.text != null) loadAttr();
|
|
129
154
|
}
|
|
@@ -133,16 +158,26 @@ export function mountDocSheet(ctx) {
|
|
|
133
158
|
if (sheet !== s || !h || h.ok === false || !h.health) return;
|
|
134
159
|
s.health = h.health; if (s.tab === 'read') drawSheet();
|
|
135
160
|
}
|
|
161
|
+
/** The copies of this document in other tools (GET /api/docs: the links and their signals), read when the sheet opens and after a link or a check. */
|
|
162
|
+
async function loadCopies() {
|
|
163
|
+
const s = sheet; if (!s) return;
|
|
164
|
+
const j = await getJson('/api/docs?' + wsq().slice(1)); if (sheet !== s) return;
|
|
165
|
+
if (!j || j.ok === false) { s.copies = s.copies || []; s.cpMsg = (j && j.error) || 'The copies could not be read.'; }
|
|
166
|
+
else { const d = (j.docs || []).find((x) => x.path === s.d.path); s.copies = d ? d.links || [] : []; s.checkRun = j.session || j.open || null; }
|
|
167
|
+
if (s.tab === 'read' || s.cp) drawSheet();
|
|
168
|
+
}
|
|
136
169
|
function openSheet(d) {
|
|
137
170
|
if (!d || !d.path) return;
|
|
138
171
|
sheet = { d, tab: 'read', text: null, log: null, health: null, props: null, draft: null, why: '', ask: null, askText: '', picked: {}, busy: false, msg: '', err: null };
|
|
139
172
|
const key = ctx.noteKey(d), say = d.title + ' is ' + d.state.toLowerCase() + (d.by ? '. ' + d.by + '.' : '.') + ' I can read the file with you and answer questions. I change nothing; only you change the file, with Save or Accept.';
|
|
140
173
|
openDlg({ eye: 'Document · real data', title: d.title, sub: ctx.sub(), say, stream: turnA(logHtml({ logTitle: 'Read from the repository', log: ['Found the file ' + d.path, 'Read its revisions from the document sheet', 'Left the file as it is'] })) + turnA(ptx(say)), noteKey: key, pane: '', label: 'Document' });
|
|
141
|
-
drawSheet(); loadThread(key); loadTab('read'); loadChip();
|
|
174
|
+
drawSheet(); loadThread(key); loadTab('read'); loadChip(); loadCopies();
|
|
142
175
|
}
|
|
143
176
|
$('#oMain').addEventListener('click', (e) => {
|
|
144
177
|
if (sheet && sheet.vm && !e.target.closest('.dsvw')) { sheet.vm = false; drawSheet(); }
|
|
145
178
|
if (sheet && e.target.closest('#shV')) { keepDraft(); sheet.vm = !sheet.vm; drawSheet(); return; }
|
|
179
|
+
const rl = e.target.closest('[data-rel]');
|
|
180
|
+
if (rl && sheet) { openSheet({ path: rl.dataset.rel, title: rl.dataset.rt, st: 'ok', state: 'Current', key: 'rel:' + rl.dataset.rel }); return; }
|
|
146
181
|
const t = e.target.closest('[data-sh]');
|
|
147
182
|
if (t && sheet) { keepDraft(); sheet.vm = false; sheet.tab = t.dataset.sh; sheet.err = null; sheet.msg = ''; drawSheet(); loadTab(sheet.tab); return; }
|
|
148
183
|
const b = e.target.closest('[data-ds]'); if (b && sheet) { sheetPress(b.dataset.ds); return; }
|
|
@@ -156,6 +191,7 @@ export function mountDocSheet(ctx) {
|
|
|
156
191
|
else if (e.target.id === 'dsAsk') sheet.askText = e.target.value;
|
|
157
192
|
else if (e.target.id === 'dsOlq') { sheet.olq = e.target.value; const it = $('#dsOlItems'); if (it && sheet.md) it.innerHTML = olItems(sheet, sheet.md); }
|
|
158
193
|
else if (e.target.id === 'dsRj') sheet.rejWhy = e.target.value;
|
|
194
|
+
else if (e.target.id === 'dsCpUrl') sheet.cpUrl = e.target.value;
|
|
159
195
|
});
|
|
160
196
|
function keepDraft() { if (!sheet) return; const ed = $('#dsEd'), w = $('#dsWhy'), a = $('#dsAsk'), rj = $('#dsRj'); if (rj) sheet.rejWhy = rj.value; if (ed) sheet.draft = ed.value; if (w) sheet.why = w.value; if (a) sheet.askText = a.value; }
|
|
161
197
|
/* the sheet's presses: each posts to one existing /api/doc-sheet route (ws in the query, as the routes read it) and then reads the routes again */
|
|
@@ -169,6 +205,21 @@ export function mountDocSheet(ctx) {
|
|
|
169
205
|
const s = sheet; keepDraft();
|
|
170
206
|
const fail = (m) => { s.busy = false; s.msg = m; drawSheet(); };
|
|
171
207
|
if (act === 'meta') { s.meta = !s.meta; drawSheet(); return; }
|
|
208
|
+
if (act === 'cp') { s.cp = !s.cp; s.cpMsg = ''; drawSheet(); return; }
|
|
209
|
+
if (act === 'cplink') {
|
|
210
|
+
const t = String(s.cpUrl || '').trim(), kind = copyKindOf(t);
|
|
211
|
+
if (!kind) { s.cpMsg = 'Paste a Confluence page or Google Doc link.'; drawSheet(); const f = $('#dsCpUrl'); if (f) f.focus(); return; }
|
|
212
|
+
const r = await pmPost('/api/docs/link', { ws: ctx.ws(), path: s.d.path, kind, target: t }).catch(() => null); if (sheet !== s) return;
|
|
213
|
+
if (!r || r.ok !== true) { s.cpMsg = (r && r.error) || 'The copy was not linked.'; drawSheet(); return; }
|
|
214
|
+
s.cpUrl = ''; s.cpMsg = ''; toast('Linked the copy. Check now reads it.'); await loadCopies(); return;
|
|
215
|
+
}
|
|
216
|
+
if (act === 'cpcheck') {
|
|
217
|
+
const r = await pmPost('/api/docs/check', { ws: ctx.ws() }).catch(() => null); if (sheet !== s) return;
|
|
218
|
+
if (!r || r.ok !== true) { s.cpMsg = (r && r.error) || 'The check did not start.'; drawSheet(); return; }
|
|
219
|
+
s.checkRun = { id: r.session }; s.cpMsg = ''; drawSheet();
|
|
220
|
+
for (let i = 0; i < 120 && sheet === s && s.checkRun; i++) { await new Promise((ok) => setTimeout(ok, 5000)); await loadCopies(); }
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
172
223
|
if (act === 'olt') { s.olHide = !s.olHide; drawSheet(); return; }
|
|
173
224
|
if (act === 'rejno') { s.rejecting = null; s.msg = ''; drawSheet(); return; }
|
|
174
225
|
if (act === 'discard') { s.draft = null; s.why = ''; s.msg = ''; drawSheet(); return; }
|
|
@@ -72,12 +72,18 @@ function drawPlate() {
|
|
|
72
72
|
}
|
|
73
73
|
$('#plateBody').innerHTML = h;
|
|
74
74
|
}
|
|
75
|
+
let shelfTab = null;
|
|
75
76
|
function drawTray() {
|
|
76
|
-
const T = M.tray;
|
|
77
|
+
const T = M.tray, Sh = M.shelf;
|
|
77
78
|
$('#trayCap').textContent = T.cap;
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
const tabs = Sh.tabs;
|
|
80
|
+
if (!shelfTab || !tabs.some((t) => t.key === shelfTab)) shelfTab = (tabs.find((t) => t.n) || tabs[0]).key;
|
|
81
|
+
const cur = tabs.find((t) => t.key === shelfTab);
|
|
82
|
+
$('#trayTabs').innerHTML = tabs.map((t) => `<button type="button" role="tab" class="stb" data-tab="${t.key}" aria-selected="${t.key === shelfTab}">${esc(t.label)} <b>${t.n}</b></button>`).join('');
|
|
83
|
+
$('#trayBody').innerHTML = cur.rows.length ? cur.rows.map((r) => rowHtml(r)).join('') + (cur.more ? `<p class="note">${cur.more} more not shown here.</p>` : '') : `<p class="empty3 plain">${cur.key === 'place' ? 'Nothing in your tray. Add a line above and it lands here first.' : 'Nothing here.'}</p>`;
|
|
84
|
+
$('#trayNote').textContent = T.note + ' ' + Sh.note;
|
|
80
85
|
}
|
|
86
|
+
$('#trayTabs').addEventListener('click', (e) => { const b = e.target.closest('[data-tab]'); if (!b) return; shelfTab = b.dataset.tab; drawTray(); const n = $(`#trayTabs [data-tab="${shelfTab}"]`); if (n) n.focus(); });
|
|
81
87
|
function drawAgents() {
|
|
82
88
|
const A = M.agents, c = A.counts;
|
|
83
89
|
$('#agCap').textContent = A.cap;
|
|
@@ -125,7 +131,7 @@ const WHO = [['you', 'You'], ['agent-drafts', 'Agent drafts'], ['agent-does', 'A
|
|
|
125
131
|
const PRIS = ['P1', 'P2', 'P3', ''];
|
|
126
132
|
let dlgKind = null; // 'item' | 'fjobs': what the open dialog shows
|
|
127
133
|
let ui = {}; // what is typed or opened in the item dialog; kept across a redraw
|
|
128
|
-
const freshUi = () => ({ xp: null, ed: null, dd: '', sn: '', ask: null, body: null, editing: false, confirm: false, back: false, note: '', wo: '', pick: null, round: null });
|
|
134
|
+
const freshUi = () => ({ xp: null, ed: null, dd: '', sn: '', ask: null, body: null, editing: false, confirm: false, back: false, note: '', wo: '', pick: null, round: null, more: false, dpick: null, pane: '' });
|
|
129
135
|
const dlgOpen = () => $('#dlg').classList.contains('on');
|
|
130
136
|
const paras = (t) => String(t || '').split(/\n{2,}/).filter((x) => x.trim()).map((x) => `<p>${esc(x.trim()).replace(/\n/g, '<br>')}</p>`).join('');
|
|
131
137
|
|
|
@@ -140,12 +146,36 @@ function choicesHtml(r, a) {
|
|
|
140
146
|
+ `<div class="cact two"><button class="cta" data-p="${go[0]}"><span>${esc(go[1])}</span></button></div>`;
|
|
141
147
|
}
|
|
142
148
|
|
|
149
|
+
/* the console's "Or decide" cards: Post (outward, suggested), Edit, Keep as a draft, Mark done. One go button does the picked one. */
|
|
150
|
+
const DECIDE = (a, step, w) => [
|
|
151
|
+
...(!a.mine || step ? [['post', step ? 'Do the step' : 'Post it to ' + w, 'Suggested', [['lock', step ? 'Outward: exactly this step' : 'Outward: exactly this text'], ['out', step ? 'A session with Chrome does it' : 'Goes to ' + w + ' as you']]]] : []),
|
|
152
|
+
['edit', 'Edit the draft', '', [[null, step ? 'The step then uses your version' : a.mine ? 'Your version replaces the draft here' : 'Post then sends your version']]],
|
|
153
|
+
['keep', 'Keep it as a draft', a.mine ? 'Suggested' : '', [[null, 'Nothing leaves PMOS']]],
|
|
154
|
+
['done', 'Mark it done', '', [[null, 'Closes the item. Nothing is posted']]],
|
|
155
|
+
];
|
|
156
|
+
function decideHtml(r, a, step, w) {
|
|
157
|
+
const opts = DECIDE(a, step, w), pick = opts.some((o) => o[0] === ui.dpick) ? ui.dpick : opts[0][0], cur = opts.find((o) => o[0] === pick);
|
|
158
|
+
const go = { post: ['ag-post', cur[1]], edit: ['ag-save', 'Save my version'], keep: ['ag-keep', 'Keep it as a draft'], done: ['ag-done', 'Mark it done'] }[pick];
|
|
159
|
+
let h = `<p class="xlab">Or decide</p><div class="xch" role="radiogroup" aria-label="What to do with the draft">${opts.map((o) => `<button class="xco" role="radio" data-p="dpick" data-v="${o[0]}" aria-checked="${pick === o[0]}">${o[2] ? `<em>${o[2]}</em>` : ''}<b>${esc(o[1])}</b>${o[3].map((f) => `<span class="${f[0] ? 'xwarn' : ''}">${esc(f[1])}</span>`).join('')}</button>`).join('')}</div>`;
|
|
160
|
+
if (ui.editing) h += `<label class="whyl" for="agBody">Your text for the draft</label><textarea class="ta" id="agBody" rows="8">${esc(ui.body == null ? (a.draft && a.draft.body) || '' : ui.body)}</textarea>`;
|
|
161
|
+
if (ui.confirm) {
|
|
162
|
+
const txt = ui.editing && ui.body != null ? ui.body : (a.draft && a.draft.body) || (a.draft && a.draft.summary) || '';
|
|
163
|
+
h += `<div class="xcon" role="group" aria-label="Confirm"><p><b>${step ? 'Do this step?' : `Post this to ${esc(w)} as you?`}</b></p>`
|
|
164
|
+
+ (step ? `<p>A new session with Chrome does exactly this step and nothing else:</p><p class="xq">${esc(step)}</p>` : `<p>Exactly this text goes:</p><p class="xq">${esc(txt).replace(/\n/g, '<br>')}</p>`)
|
|
165
|
+
+ `<div class="cact two"><button class="cta" data-p="ag-go"><span>${step ? 'Do the step now' : `Post it to ${esc(w)} now`}</span></button><button class="cta alt" data-p="ag-no"><span>Not yet</span></button></div></div>`;
|
|
166
|
+
} else {
|
|
167
|
+
h += `<div class="cact two"><button class="cta" data-p="${go[0]}"><span>${esc(go[1])}</span></button>${ui.editing ? '<button class="cta alt" data-p="ag-edit"><span>Use the agent’s text</span></button>' : ''}<button class="cta alt" data-p="ag-back" aria-expanded="${ui.back}"><span>Send it back with a note</span></button></div>`;
|
|
168
|
+
if (ui.back) h += `<label class="whyl" for="agNote">Tell the agent what to change</label><textarea class="ta" id="agNote" rows="3" maxlength="500">${esc(ui.note)}</textarea><div class="cact two"><button class="cta" data-p="ag-sendback"${ui.note.trim() ? '' : ' disabled'}><span>Send it back</span></button></div><p class="nodef">The agent drafts it again. ${a.mine ? 'Nothing leaves PMOS.' : `Nothing goes to ${esc(w)} or to anyone.`}</p>`;
|
|
169
|
+
}
|
|
170
|
+
return h;
|
|
171
|
+
}
|
|
172
|
+
|
|
143
173
|
/* the agent block: one state, the controls that state allows, and nothing is posted before the confirm */
|
|
144
174
|
function agentHtml(r) {
|
|
145
175
|
const a = r.dialog.agent;
|
|
146
176
|
if (!a) return '';
|
|
147
177
|
const w = a.where || 'anyone', dr = a.draft;
|
|
148
|
-
const draftBox = dr && dr.body ?
|
|
178
|
+
const draftBox = (dr && (dr.body || dr.summary) ? '<p class="nodef">The draft is on the right.</p>' : '') + turnsHtml(a); // the draft itself sits in the detail panel
|
|
149
179
|
let h = '';
|
|
150
180
|
if (a.state === 'suggest') {
|
|
151
181
|
h = `<p class="nodef">${a.mine ? 'The agent can draft a first version of this for you. You read it here. Nothing leaves PMOS.' : `The agent can draft this for you. You read it here first. Nothing goes to ${esc(w)} until you post it.`}</p>`
|
|
@@ -159,21 +189,7 @@ function agentHtml(r) {
|
|
|
159
189
|
} else if (a.state === 'ready') {
|
|
160
190
|
const step = dr && dr.step;
|
|
161
191
|
h = `<p class="nodef">${step ? 'Draft ready. The step has not run.' : `Draft ready. Nothing went to ${esc(a.mine ? 'anyone' : w)}.`}</p>`;
|
|
162
|
-
|
|
163
|
-
else h += draftBox;
|
|
164
|
-
if (ui.confirm) {
|
|
165
|
-
const txt = ui.editing && ui.body != null ? ui.body : (dr && dr.body) || (dr && dr.summary) || '';
|
|
166
|
-
h += `<div class="xcon" role="group" aria-label="Confirm"><p><b>${step ? 'Do this step?' : `Post this to ${esc(w)} as you?`}</b></p>`
|
|
167
|
-
+ (step ? `<p>A new session with Chrome does exactly this step and nothing else:</p><p class="xq">${esc(step)}</p>` : `<p>Exactly this text goes:</p><p class="xq">${esc(txt).replace(/\n/g, '<br>')}</p>`)
|
|
168
|
-
+ `<div class="cact two"><button class="cta" data-p="ag-go"><span>${step ? 'Do the step now' : `Post it to ${esc(w)} now`}</span></button><button class="cta alt" data-p="ag-no"><span>Not yet</span></button></div></div>`;
|
|
169
|
-
} else {
|
|
170
|
-
h += '<div class="cact two">';
|
|
171
|
-
if (!a.mine || step) h += `<button class="cta" data-p="ag-post"><span>${step ? 'Do the step' : `Post it to ${esc(w)}`}</span></button>`;
|
|
172
|
-
h += `<button class="cta alt" data-p="ag-edit" aria-expanded="${ui.editing}"><span>${ui.editing ? 'Use the agent’s text' : 'Edit the draft'}</span></button>`;
|
|
173
|
-
if (ui.editing) h += `<button class="cta alt" data-p="ag-save"><span>Save my version</span></button>`;
|
|
174
|
-
h += `<button class="cta alt" data-p="ag-back" aria-expanded="${ui.back}"><span>Send it back with a note</span></button><button class="cta alt" data-p="ag-done"><span>Mark it done</span></button></div>`;
|
|
175
|
-
if (ui.back) h += `<label class="whyl" for="agNote">Tell the agent what to change</label><textarea class="ta" id="agNote" rows="3" maxlength="500">${esc(ui.note)}</textarea><div class="cact two"><button class="cta" data-p="ag-sendback"${ui.note.trim() ? '' : ' disabled'}><span>Send it back</span></button></div><p class="nodef">The agent drafts it again. ${a.mine ? 'Nothing leaves PMOS.' : `Nothing goes to ${esc(w)} or to anyone.`}</p>`;
|
|
176
|
-
}
|
|
192
|
+
h += draftBox + decideHtml(r, a, step, w);
|
|
177
193
|
} else if (a.state === 'failed') {
|
|
178
194
|
h = `<p class="nodef" role="status">${a.asks && a.error ? esc(a.error.charAt(0).toUpperCase() + a.error.slice(1)) + ' Nothing was sent.' : `The agent stopped${a.error ? ': ' + esc(a.error) : '.'} Nothing was sent.`}</p>${draftBox}`
|
|
179
195
|
+ `<div class="cact two"><button class="cta" data-p="ag-retry"><span>Try again</span></button><button class="cta alt" data-p="ag-stop"><span>Stop</span></button></div>`;
|
|
@@ -212,28 +228,49 @@ function toolsHtml(r) {
|
|
|
212
228
|
}
|
|
213
229
|
function cardInner(r) {
|
|
214
230
|
const d = r.dialog, a = d.write.actions;
|
|
215
|
-
const move = a.includes('flag')
|
|
231
|
+
const open = ui.more || !!ui.xp, move = a.includes('flag');
|
|
232
|
+
const more = toolsHtml(r)
|
|
233
|
+
+ (a.includes('waiting') ? `<label class="whyl" for="wOn">Waiting on someone</label><div class="cact two"><input id="wOn" class="why one" maxlength="80" placeholder="A name" autocomplete="off" value="${esc(ui.wo)}"><button class="cta quiet" data-p="waiting" id="wBtn"${ui.wo.trim() ? '' : ' disabled'}><span>Wait for them</span></button></div>` : '');
|
|
216
234
|
return agentHtml(r) + `<p class="ct">What you can do</p>`
|
|
217
235
|
+ `<div class="cact two"><button class="cta" data-p="done">${CHECK}<span>Done</span></button>${a.includes('keep') ? '<button class="cta quiet" data-p="keep"><span>Keep it</span></button>' : ''}</div>`
|
|
218
|
-
+ `<div class="mv2">Not yet <span class="seg2">${NOTYET.map(([k, t]) => `<button data-p="notyet" data-when="${k}">${t}</button>`).join('')}</span></div>`
|
|
219
|
-
+
|
|
220
|
-
+
|
|
221
|
-
+ (a.includes('waiting') ? `<label class="whyl" for="wOn">Waiting on someone</label><div class="cact two"><input id="wOn" class="why one" maxlength="80" placeholder="A name" autocomplete="off" value="${esc(ui.wo)}"><button class="cta quiet" data-p="waiting" id="wBtn"${ui.wo.trim() ? '' : ' disabled'}><span>Wait for them</span></button></div>` : '')
|
|
222
|
-
+ `<div class="cact"><button class="cta quiet" data-p="remove"><span>Drop it</span></button></div>`
|
|
236
|
+
+ `<div class="mv2">Not yet <span class="seg2">${NOTYET.map(([k, t]) => `<button data-p="notyet" data-when="${k}">${t}</button>`).join('')}${move ? '<button data-p="flag">Do today</button>' : ''}</span></div>`
|
|
237
|
+
+ `<div class="cact two"><button class="cta quiet xmore" data-p="more" aria-expanded="${open}" aria-controls="xmoreBox"><span>${open ? 'Fewer options' : 'More'}</span></button><button class="cta quiet" data-p="remove"><span>Drop it</span></button></div>`
|
|
238
|
+
+ (open ? `<div id="xmoreBox" class="xmorebox">${more}</div>` : '')
|
|
223
239
|
+ '<p class="nodef err" id="cardErr" role="alert" hidden></p>';
|
|
224
240
|
}
|
|
225
241
|
const cardHtml = (r) => `<div class="acard" id="card">${cardInner(r)}</div>`;
|
|
226
242
|
function paneHtml(r) {
|
|
227
|
-
const p = r.dialog.pane;
|
|
228
|
-
let h =
|
|
229
|
-
if (
|
|
230
|
-
|
|
231
|
-
|
|
243
|
+
const p = r.dialog.pane, ag = r.dialog.agent, dr = ag && ag.draft && (ag.draft.body || ag.draft.summary) ? ag.draft : null;
|
|
244
|
+
let h = '';
|
|
245
|
+
if (dr) {
|
|
246
|
+
const last = ag.turns && ag.turns.length ? ag.turns[ag.turns.length - 1] : null;
|
|
247
|
+
h += `<article class="paper doc agpane"><div class="agpt"><p class="agtag">Agent draft · not checked${last ? ' · ' + esc(KIND[last.kind] || '') : ''}</p><span class="agpa"><button class="xtb" data-pp="open" type="button">Open</button><button class="xtb" data-pp="copy" type="button">Copy</button></span></div><div class="mdr">${mdHtml(dr.body || dr.summary)}</div></article>`;
|
|
248
|
+
}
|
|
249
|
+
let g = `<p class="dpath">${esc(p.file)}</p>${p.h ? `<h3 class="d1">${esc(p.h)}</h3>` : ''}${p.intro ? `<p>${esc(p.intro)}</p>` : ''}`; // the heading and lead line, as the mockup draws them
|
|
250
|
+
if (p.rows && p.rows.length) g += `<div class="kv2">${p.rows.map(([a, b]) => `<span>${esc(a)}</span><span>${esc(b)}</span>`).join('')}</div>`;
|
|
251
|
+
return h + `<article class="paper doc">${g}<p class="xn">The item as your list holds it.</p></article>`;
|
|
252
|
+
}
|
|
253
|
+
const paneLabel = (r) => (r.dialog.agent && r.dialog.agent.draft && (r.dialog.agent.draft.body || r.dialog.agent.draft.summary) ? 'Draft and item record' : r.dialog.pane.label);
|
|
254
|
+
const paneSig = (r) => JSON.stringify([r.dialog.agent && r.dialog.agent.draft, r.dialog.pane]);
|
|
255
|
+
/* the detail panel follows the item: a draft that lands while the dialog is open shows at once */
|
|
256
|
+
function paintPane() {
|
|
257
|
+
if (!openR || dlgKind !== 'item') return;
|
|
258
|
+
const sg = paneSig(openR); if (sg === ui.pane) return;
|
|
259
|
+
ui.pane = sg; const m = $('#oMain'), top = m.scrollTop;
|
|
260
|
+
m.innerHTML = paneHtml(openR); $('#oLab').textContent = paneLabel(openR); m.scrollTop = top;
|
|
232
261
|
}
|
|
262
|
+
$('#oMain').addEventListener('click', async (e) => {
|
|
263
|
+
const b = e.target.closest('[data-pp]'); if (!b || dlgKind !== 'item' || !openR) return;
|
|
264
|
+
const ag = openR.dialog.agent, txt = (ag && ag.draft && (ag.draft.body || ag.draft.summary)) || '';
|
|
265
|
+
if (b.dataset.pp === 'copy') { try { await navigator.clipboard.writeText(txt); toast('Draft copied.'); } catch (_) { toast('Copy did not work here. Select the text and copy it.'); } }
|
|
266
|
+
else { const u = URL.createObjectURL(new Blob([txt], { type: 'text/plain;charset=utf-8' })); window.open(u, '_blank', 'noopener'); setTimeout(() => URL.revokeObjectURL(u), 60000); }
|
|
267
|
+
});
|
|
233
268
|
function openRow(r) {
|
|
234
269
|
if (!r) return;
|
|
235
270
|
openR = r; dlgKind = 'item'; ui = freshUi(); const d = r.dialog;
|
|
236
|
-
openDlg({ eye: d.eye + ' · real data', title: r.title, sub: r.sub, say: d.say, stream: turnA(logHtml(d)) + turnA(ptx(d.say)) + cardHtml(r), noteKey: r.key, pane: paneHtml(r), label:
|
|
271
|
+
openDlg({ eye: d.eye + ' · real data', title: r.title, sub: r.sub, say: d.say, stream: turnA(logHtml(d)) + turnA(ptx(d.say)) + cardHtml(r), noteKey: r.key, pane: paneHtml(r), label: paneLabel(r) });
|
|
272
|
+
ui.pane = paneSig(r);
|
|
273
|
+
ui.pane = paneSig(r);
|
|
237
274
|
loadThread(r.key);
|
|
238
275
|
setTimeout(() => { const b = $('#dBody'); b.scrollTop = b.scrollHeight; }, 120);
|
|
239
276
|
}
|
|
@@ -251,7 +288,7 @@ function refreshOpen() {
|
|
|
251
288
|
if (!n) { closeDlg(); openR = null; return; }
|
|
252
289
|
const changed = sigOf(n) !== sigOf(openR);
|
|
253
290
|
openR = n;
|
|
254
|
-
if (changed) paint();
|
|
291
|
+
if (changed) { paint(); paintPane(); }
|
|
255
292
|
}
|
|
256
293
|
|
|
257
294
|
/* a press: the page waits for the route's answer; a refusal shows its reason and changes nothing.
|
|
@@ -330,6 +367,7 @@ function dlgClick(b, r) {
|
|
|
330
367
|
case 'ag-today': return todayP(r);
|
|
331
368
|
case 'ag-nb': return deferP(r, nextMonday(M.today));
|
|
332
369
|
case 'round': ui.round = ui.round === +b.dataset.i ? null : +b.dataset.i; return paint(`[data-p="round"][data-i="${b.dataset.i}"]`);
|
|
370
|
+
case 'more': ui.more = !ui.more; if (!ui.more) ui.xp = null; return paint('[data-p="more"]');
|
|
333
371
|
case 'xt': {
|
|
334
372
|
const t = b.dataset.k;
|
|
335
373
|
if (t === 'someday') return somedayP(r);
|
|
@@ -355,9 +393,11 @@ function dlgClick(b, r) {
|
|
|
355
393
|
}
|
|
356
394
|
case 'ag-stop': return commit({ keep: true, send: () => post('/api/my-work/stop', { item: id }), say: 'Stopped. Nothing was kept.' });
|
|
357
395
|
case 'ag-retry': return commit({ keep: true, send: () => post('/api/my-work/decide', { item: id, action: 'retry' }), say: 'The agent tries again.' });
|
|
358
|
-
case 'ag-edit': ui.editing =
|
|
396
|
+
case 'ag-edit': ui.editing = false; ui.body = null; ui.confirm = false; ui.dpick = 'post'; return paint('[data-p="dpick"][data-v="post"]');
|
|
359
397
|
case 'ag-save': return commit({ keep: true, send: () => post('/api/my-work/decide', { item: id, action: 'edit', body: ui.body }), say: a.mine ? 'Saved. The draft stays here.' : `Saved. Post sends your text to ${a.where}.` });
|
|
360
398
|
case 'ag-post': ui.confirm = true; return paint('[data-p="ag-go"]');
|
|
399
|
+
case 'dpick': ui.dpick = b.dataset.v; ui.confirm = false; if (ui.dpick === 'edit' && !ui.editing) { ui.editing = true; if (ui.body == null) ui.body = (a.draft && a.draft.body) || ''; } return paint(`[data-p="dpick"][data-v="${b.dataset.v}"]`);
|
|
400
|
+
case 'ag-keep': closeDlg(); openR = null; toast(a.mine ? 'Kept. The draft stays on this item.' : 'Kept as a draft. Nothing was posted.'); return null;
|
|
361
401
|
case 'ag-no': ui.confirm = false; return paint('[data-p="ag-post"]');
|
|
362
402
|
case 'ag-go': {
|
|
363
403
|
const body = { item: id, action: 'approve' };
|
|
@@ -475,7 +515,7 @@ async function listClick(e) {
|
|
|
475
515
|
const r = rowOf(cta.dataset.key); if (!r) return;
|
|
476
516
|
const o = { list: true };
|
|
477
517
|
refocus = null;
|
|
478
|
-
if (cta.dataset.act === 'open') openRow(r); else if (cta.dataset.act === 'tomorrow') deferP(r, addIso(M.today, 1), o); else todayP(r, o);
|
|
518
|
+
if (cta.dataset.act === 'open') openRow(r); else if (cta.dataset.act === 'tomorrow') deferP(r, addIso(M.today, 1), o); else if (cta.dataset.act === 'done') doneP(r, o); else if (cta.dataset.act === 'letgo') commit({ ...o, send: () => post('/api/pm-items/remove', { id: r.id }), say: SAID.remove, undo: () => post('/api/pm-items/undo', { id: r.id }) }); else todayP(r, o);
|
|
479
519
|
return;
|
|
480
520
|
}
|
|
481
521
|
const ck = e.target.closest('.wck');
|
|
@@ -1896,6 +1896,31 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
|
|
|
1896
1896
|
.dsbody .dsat i{width:18px;height:18px;border-radius:50%;background:var(--well);display:grid;place-items:center;font:600 10px var(--mono);font-style:normal;color:var(--ink-2)}
|
|
1897
1897
|
.rdbar .rdsp{margin-left:auto;display:flex;gap:8px;flex-wrap:wrap}
|
|
1898
1898
|
.rdbar .dsvw:last-child .dsmn,.rdbar .rdsp .dsmn{left:auto;right:0}
|
|
1899
|
+
.dsrel{display:grid;gap:6px}
|
|
1900
|
+
.dsrr{display:flex;align-items:center;gap:10px;justify-content:space-between;padding:6px 10px;border-radius:10px;background:var(--well)}
|
|
1901
|
+
.dsrr button,.dsrr>span:first-child{display:grid;gap:2px;text-align:left;min-height:44px;align-content:center;color:var(--ink)}
|
|
1902
|
+
.dsrr button:hover b{text-decoration:underline}
|
|
1903
|
+
.dsrr b{font-weight:600;font-size:14px}
|
|
1904
|
+
.dsrr small{font:12px var(--mono);color:var(--ink-3)}
|
|
1899
1905
|
|
|
1900
1906
|
.frl{list-style:none;margin:0 0 12px;padding:0}.frs{display:grid;grid-template-columns:30px minmax(0,1fr) auto;gap:10px;align-items:center;width:100%;min-height:44px;padding:6px 4px;text-align:left;border-top:1px solid var(--hair);font-size:14px}
|
|
1901
1907
|
.frl li:first-child .frs{border-top:0}.frs i{font:600 12px var(--mono);font-style:normal;width:26px;height:26px;border-radius:50%;display:grid;place-items:center;background:var(--well);color:var(--ink-2)}.frs b{font-weight:650}.frs:disabled{opacity:.5}
|
|
1908
|
+
|
|
1909
|
+
.stabs{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 10px}.stb{min-height:44px;padding:0 14px;border-radius:999px;background:var(--well);font-size:13px;font-weight:600;color:var(--ink-2)}
|
|
1910
|
+
.stb[aria-selected="true"]{background:var(--solid);color:var(--on-solid)}.stb b{font-weight:650;margin-left:3px;opacity:.8}
|
|
1911
|
+
|
|
1912
|
+
/* the item dialog: Done, Not yet, Drop it stay; the rest sits behind More */
|
|
1913
|
+
.xmorebox{margin-top:10px;padding-top:6px;border-top:1px solid var(--line,rgba(0,0,0,.08))}
|
|
1914
|
+
|
|
1915
|
+
/* the draft in the detail panel, and the decision cards under the conversation */
|
|
1916
|
+
.agpane{margin-bottom:14px}
|
|
1917
|
+
.agpt{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:8px}
|
|
1918
|
+
.agpa{display:flex;gap:6px}
|
|
1919
|
+
.xlab{margin:12px 0 6px;font-size:.78rem;color:var(--ink-3)}
|
|
1920
|
+
.xco .xwarn{color:var(--ember-ink)}
|
|
1921
|
+
.dscp{display:grid;gap:8px;margin:0 0 12px;padding:12px 14px;border-radius:12px;background:var(--well)}
|
|
1922
|
+
.dscr{display:grid;gap:2px;padding:8px 0;border-top:1px solid var(--hair)}
|
|
1923
|
+
.dscr:first-of-type{border-top:0}
|
|
1924
|
+
.dscr>div:first-child{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
|
|
1925
|
+
.dscr small{font:12px var(--mono);color:var(--ink-3);overflow-wrap:anywhere}
|
|
1926
|
+
.dscr .lk{justify-self:start;min-height:44px;display:inline-flex;align-items:center}
|
|
@@ -84,10 +84,11 @@
|
|
|
84
84
|
</div>
|
|
85
85
|
<section class="card rise" style="--d:5;margin-top:24px" id="trayCard" aria-labelledby="hTray">
|
|
86
86
|
<div class="ch"><span class="ic"><svg class="i" viewBox="0 0 24 24"><path d="M4 8h16l-1.5 11a2 2 0 0 1-2 1.7H7.5a2 2 0 0 1-2-1.7z"/><path d="M8 8V6a4 4 0 0 1 8 0v2"/></svg></span><h2 id="hTray">Your tray</h2><small id="trayCap"></small></div>
|
|
87
|
+
<div class="stabs" id="trayTabs" role="tablist" aria-label="Tray"></div>
|
|
87
88
|
<div class="tgrid" id="trayBody"></div>
|
|
88
89
|
<p class="note" id="trayNote" style="margin-top:14px"></p>
|
|
89
90
|
</section>
|
|
90
|
-
<p class="foot" id="foot">This page reads your list, the same one the Work page reads. It writes only when you press a button that says what it does, and each press uses the Work page's own route. Starting an agent from a list is not built here. The tray's
|
|
91
|
+
<p class="foot" id="foot">This page reads your list, the same one the Work page reads. It writes only when you press a button that says what it does, and each press uses the Work page's own route. Starting an agent from a list is not built here. The tray's tabs show only your own items. Answers, ideas and reports an agent files on its own, effort figures and review timing need records PMOS does not hold yet. Jira and Slack items appear only when an agent session has read them.</p>
|
|
91
92
|
</main>
|
|
92
93
|
<noscript>This page needs JavaScript.</noscript>
|
|
93
94
|
<script type="module" src="/pm/premium-work.js"></script>
|