create-pmos 0.383.0 → 0.385.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 +30 -35
- 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-initiative-test.js +9 -0
- package/workspace/briefing-premium-test.js +1 -1
- package/workspace/changelog.json +29 -0
- package/workspace/guide/briefing-premium.md +7 -1
- package/workspace/lib/lead-cli.js +63 -0
- package/workspace/lib/my-work-premium.js +29 -3
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/lib/popup-leads.js +68 -0
- package/workspace/lib/routes-briefing-premium.js +4 -1
- package/workspace/lib/routes-pm-items.js +5 -2
- package/workspace/lib/work-assigned.js +12 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-vw-jira-test.js +18 -0
- package/workspace/public/pm/premium-shell.js +21 -0
- package/workspace/public/pm/premium-vw-jira-model.js +26 -0
- package/workspace/public/pm/premium-vw-jira.js +10 -6
- package/workspace/public/pm/premium-work.js +18 -3
- package/workspace/public/pm/premium.css +11 -0
- package/workspace/public/pm/premium.js +3 -1
- package/workspace/server.js +8 -2
- package/workspace/test-lists/popup-context.json +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.385.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": {
|
|
@@ -32,6 +32,35 @@
|
|
|
32
32
|
"audit"
|
|
33
33
|
],
|
|
34
34
|
"pmosChanges": [
|
|
35
|
+
{
|
|
36
|
+
"v": "0.385.0",
|
|
37
|
+
"at": "2026-10-21T14:04:22.922Z",
|
|
38
|
+
"f": 2,
|
|
39
|
+
"prs": [
|
|
40
|
+
{
|
|
41
|
+
"n": 996,
|
|
42
|
+
"t": "A task's Jira ticket from the stored reads, with Read it now",
|
|
43
|
+
"s": "A task's Jira ticket from the stored reads, with Read it now"
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"v": "0.384.0",
|
|
49
|
+
"at": "2026-10-21T13:39:28.616Z",
|
|
50
|
+
"f": 2,
|
|
51
|
+
"prs": [
|
|
52
|
+
{
|
|
53
|
+
"n": 993,
|
|
54
|
+
"t": "A Work item from the brief opens on its source",
|
|
55
|
+
"s": "A Work item from the brief opens on its source"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"n": 995,
|
|
59
|
+
"t": "Claude's stored lead shows first in a popup, with Refresh",
|
|
60
|
+
"s": "Claude's stored lead shows first in a popup, with Refresh"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
},
|
|
35
64
|
{
|
|
36
65
|
"v": "0.383.0",
|
|
37
66
|
"at": "2026-10-21T13:13:17.082Z",
|
|
@@ -277,40 +306,6 @@
|
|
|
277
306
|
"s": "Refresh all is one ordered run on the server, following Wawan's rule (2026-10-21): derived content is rebuilt only after its sources are fresh."
|
|
278
307
|
}
|
|
279
308
|
]
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
"v": "0.365.0",
|
|
283
|
-
"at": "2026-10-21T01:17:24.947Z",
|
|
284
|
-
"f": 2,
|
|
285
|
-
"prs": [
|
|
286
|
-
{
|
|
287
|
-
"n": 962,
|
|
288
|
-
"t": "Item fields move out of the chat start into Edit ▾ beside the tabs",
|
|
289
|
-
"s": "Item fields move out of the chat start into Edit ▾ beside the tabs"
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
"n": 972,
|
|
293
|
-
"t": "The morning brief is built from the saved reads of your tools (briefing-source-flow, slice 2)",
|
|
294
|
-
"s": "The brief is derived content, following the rule Wawan set on 2026-10-21."
|
|
295
|
-
}
|
|
296
|
-
]
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
"v": "0.364.0",
|
|
300
|
-
"at": "2026-10-21T00:58:08.077Z",
|
|
301
|
-
"f": 2,
|
|
302
|
-
"prs": [
|
|
303
|
-
{
|
|
304
|
-
"n": 967,
|
|
305
|
-
"t": "Chat is its own page, with the sessions on it",
|
|
306
|
-
"s": "Chat is its own page, with the sessions on it"
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
"n": 970,
|
|
310
|
-
"t": "Each tool the Briefing uses gets a stored read (briefing-source-flow, slice 1)",
|
|
311
|
-
"s": "Each tool the Briefing uses gets a stored read (briefing-source-flow, slice 1)"
|
|
312
|
-
}
|
|
313
|
-
]
|
|
314
309
|
}
|
|
315
310
|
]
|
|
316
311
|
}
|
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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-21T14:04:20Z"}
|
|
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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-21T14:04:20Z"}
|
|
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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-21T14:04:20Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -127,6 +127,15 @@ const HEALTH = { ok: true, path: 'planning/prd/self-serve-v2-prd.md', health: {
|
|
|
127
127
|
await p.locator('#cIniTk .tkq').first().click(); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(500);
|
|
128
128
|
const td = await p.evaluate(() => ({ title: document.querySelector('#dTitle').textContent, grid: [...document.querySelectorAll('#oMain .kv2 span')].map((s) => s.textContent).join('|'), ask: document.querySelector('#askF').hidden, seg: !!document.querySelector('#oMain .tkst') }));
|
|
129
129
|
ok('I6 a Jira task opens its record as a grid, read-only: no status control, and its own conversation (premium-popup-context P1)', td.title === 'Sandbox key step' && /Reference\|ONB-12\|Source\|Jira \(read-only\)/.test(td.grid) && td.ask === false && td.seg === false, JSON.stringify(td));
|
|
130
|
+
// popup context slice 3 (L2, L3): the stored lead comes first, with its time and reads, and Refresh asks the popup's own session
|
|
131
|
+
A.setThread({ ok: true, working: false, turns: [], lead: { text: 'ONB-12 waits on the sandbox key. Ask Sam for a date.', cites: ['Jira read 07:02'], at: new Date().toISOString() } });
|
|
132
|
+
await p.keyboard.press('Escape'); await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
|
|
133
|
+
await p.locator('#cIniTk .tkq').first().click(); await until(() => p.evaluate(() => !!document.querySelector('#dlg.on #leadT .plead')), 6000);
|
|
134
|
+
const ld = await p.evaluate(() => { const s = document.querySelector('#dBody .stream'); return { first: s.firstElementChild && s.firstElementChild.id, text: document.querySelector('#leadT').textContent }; });
|
|
135
|
+
ok('I6 a task popup shows Claude\'s stored lead first, with when it was written and what it read (popup context L2)', ld.first === 'leadT' && /waits on the sandbox key/.test(ld.text) && /Lead · written \d\d:\d\d · from Jira read 07:02/.test(ld.text), JSON.stringify(ld));
|
|
136
|
+
{ const nA = A.posts.length; await p.click('#leadT [data-lead="refresh"]');
|
|
137
|
+
ok('I6 Refresh asks the popup\'s own session to write the lead again and save it with pmos lead put (popup context L3)', await until(() => A.posts.slice(nA).some((x) => x.path === '/api/briefing-premium/ask' && /^pop:task:/.test(x.body.key) && x.body.text.includes('pmos lead put --key ' + x.body.key))), JSON.stringify(A.posts.slice(nA))); }
|
|
138
|
+
A.setThread({ ok: true, working: false, turns: [] });
|
|
130
139
|
await p.keyboard.press('Escape'); await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
|
|
131
140
|
/* a PMOS task: its status can be changed */
|
|
132
141
|
A.set({ status: 200, body: { ok: true, item: {} } });
|
|
@@ -306,7 +306,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
306
306
|
ok('R11 the page behind the dialog is inert and the dialog is modal', d.inert && d.role === 'true');
|
|
307
307
|
ok('R4 the dialog offers Pin to the top for a list row (premium-calmer-first-screen)', await p.evaluate(() => { const b = document.querySelector('#card .dpin'); return !!b && /Pin to the top/.test(b.textContent) && b.getAttribute('aria-pressed') === 'false'; }));
|
|
308
308
|
ok('R4 the dialog names the row, with an activity log of what was read', d.title === MODEL.list.rows[0].title && /Readfromtherepository3steps/.test(d.log.replace(/\s+/g, '')), d.log);
|
|
309
|
-
ok('R4 the detail pane opens with the record\'s path and
|
|
309
|
+
ok('R4 the detail pane opens with the record\'s path and does not repeat the title the dialog head shows (popup context slice 2)', await p.evaluate(() => { const o = document.querySelector('#oMain'), t = document.querySelector('#dTitle').textContent.trim(); return !!o.querySelector('.dpath') && ![...o.querySelectorAll('.d1, h1, h2, h3')].some((h) => h.textContent.trim() === t); }));
|
|
310
310
|
ok('R4 the card holds the evidence and the next step, and the right pane the record', /The way through/.test(d.card) && /Blocked at/.test(d.card) && /Initiative record/.test(d.label) && /planning\/initiatives|console-3-boards/.test(d.pane), d.card.slice(0, 120));
|
|
311
311
|
await until(() => p.evaluate(() => getComputedStyle(document.querySelector('#dlg')).transform === 'none' || /matrix\(1, 0, 0, 1, 0, 0\)/.test(getComputedStyle(document.querySelector('#dlg')).transform)), 3000);
|
|
312
312
|
const pane0 = await p.evaluate(() => { const b = document.querySelector('#dPane'); const r = b.getBoundingClientRect(); return { on: b.getAttribute('aria-pressed'), t: b.title, w: r.width, h: r.height, convo: getComputedStyle(document.querySelector('#dBody')).display }; });
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,33 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.385.0",
|
|
4
|
+
"at": "2026-10-21T14:04:22.922Z",
|
|
5
|
+
"f": 2,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 996,
|
|
9
|
+
"t": "A task's Jira ticket from the stored reads, with Read it now",
|
|
10
|
+
"s": "A task's Jira ticket from the stored reads, with Read it now"
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"v": "0.384.0",
|
|
16
|
+
"at": "2026-10-21T13:39:28.616Z",
|
|
17
|
+
"f": 2,
|
|
18
|
+
"prs": [
|
|
19
|
+
{
|
|
20
|
+
"n": 993,
|
|
21
|
+
"t": "A Work item from the brief opens on its source",
|
|
22
|
+
"s": "A Work item from the brief opens on its source"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"n": 995,
|
|
26
|
+
"t": "Claude's stored lead shows first in a popup, with Refresh",
|
|
27
|
+
"s": "Claude's stored lead shows first in a popup, with Refresh"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
},
|
|
2
31
|
{
|
|
3
32
|
"v": "0.383.0",
|
|
4
33
|
"at": "2026-10-21T13:13:17.082Z",
|
|
@@ -205,7 +205,7 @@ When you scroll past the hero, the hero folds into a bar at the top. The bar sho
|
|
|
205
205
|
|
|
206
206
|
## What a dialog holds
|
|
207
207
|
|
|
208
|
-
A row or a Today item opens a dialog with the same parts every time. At the top is a short log of what PMOS read, for example the kill-condition file and `pm-decisions.md`. Under it is one plain sentence. Then one card holds the evidence and, for a decision, the options. The record sits on the right: a draft `pm-decisions.md` entry for a decision, the initiative record for blocked work, the commit for a merge.
|
|
208
|
+
A row or a Today item opens a dialog with the same parts every time. At the top is a short log of what PMOS read, for example the kill-condition file and `pm-decisions.md`. Under it is one plain sentence. Then one card holds the evidence and, for a decision, the options. The record sits on the right, without the title again, because the top of the dialog already shows it: a draft `pm-decisions.md` entry for a decision, the initiative record for blocked work, the commit for a merge.
|
|
209
209
|
|
|
210
210
|
The right side can hold more than one item. When the dialog opens a related item there, such as a document, a meeting or a ticket, the item opens as a tab beside the dialog's own detail. The first tab is always the dialog's own detail. You can have up to four more tabs; a fifth closes the oldest. Click a tab or use the arrow keys to move between them. Use the **×** on a tab, or press Delete, to close it. The tabs close when the dialog closes. With no extra item, there are no tabs.
|
|
211
211
|
|
|
@@ -277,6 +277,12 @@ My work is the second place on the rail, at `/premium-work.html`. It reads the l
|
|
|
277
277
|
|
|
278
278
|
**The item dialog.** The conversation gets the whole body. Two controls sit beside the Detail / Conversation switch, on both tabs: **Edit ▾** and **Done**. On a wide screen the row also shows where the item is. **Edit ▾** opens a sheet with one labelled field for each choice. Each field shows its value from the record and opens when you press it: **When** (Today, Later today, Tomorrow, Next week, Not before a date, Someday), **Waiting on**, **Who does it** (the steps) and **Priority · Due** (the edit panel). **Keep it** and **Drop it** are at the bottom of the sheet. The sheet closes when you press Edit again, press outside it, or press Escape. **Waiting on** is not shown when the item cannot wait and waits on nobody. An agent that only can draft is a field in the sheet. An agent that is working, has a draft, or stopped stays in the conversation, because it needs you. Every action stays reachable.
|
|
279
279
|
|
|
280
|
+
**Where an item came from.** An item from the morning brief opens on its source. Claude's first line says why it is here now and what was asked, for example "Claudia Loo asks: Can the form text hold images?". The right side shows who asked and where, their messages or words, the sources the brief read, and **Open in Slack** (or Jira, mail, and so on) when the brief kept a link. The title is not drawn there again. The item's own fields (place, due date, who asked) are behind **Details**. All of this is what the brief stored when it was written: opening the item reads nothing new. An item you added yourself still shows its fields.
|
|
281
|
+
|
|
282
|
+
**Claude's lead in a popup.** A popup such as a task, a document, a report or a measure opens on Claude's short lead, written ahead of time: why the thing matters now, what is asked or blocking, and what to do. Under it is when the lead was written and what Claude read for it. Opening a popup starts nothing: the lead is read from what is stored. **Refresh** asks the popup's own Claude Code session to write the lead again from the stored reads, and the new lead replaces the old one. A popup with no lead yet says so and offers **Write the lead**. An agent session saves a lead with `pmos lead put --key <popup key> --text "<lead>" --cite "<what it read, when>"`, and `pmos lead show [<key>]` prints what is stored. `pmos lead` calls no tool.
|
|
283
|
+
|
|
284
|
+
**A Jira ticket PMOS has not read.** A task's Jira tab first looks in the initiative's ticket draft and the sprint reads. When neither holds the ticket, it shows the newest Jira check that read it, or else what the stored Jira read says about it, and names which one. When nothing stored holds it, the tab says **Not read yet**, gives the time of the last Jira read, and offers **Read it now**. Read it now asks the popup's own Claude session to read that one ticket with your Atlassian connection, read only, and to save the popup's lead. Nothing reads Jira when the tab opens.
|
|
285
|
+
|
|
280
286
|
**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**. Its heading names the item ("Draft for IDPF-2989", or "Draft for you"), the round and the time of the latest round, and an approved step shows as "Step when you approve". A long draft is cut short, with **Show all**. 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.
|
|
281
287
|
|
|
282
288
|
**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.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* lead-cli.js — `pmos lead …`: Claude's short lead for a popup (popup context slice 3).
|
|
3
|
+
* pmos lead put --key <pop:kind:id> --text "<lead>" [--cite "<what you read, when>"] … save the lead the popup shows first
|
|
4
|
+
* pmos lead show [<key>] [--json] what is stored, for one popup or all
|
|
5
|
+
* The leads are kept in the per-user runtime folder (lib/popup-leads.js). This command calls no tool: write the lead from stored
|
|
6
|
+
* reads (`pmos source show`, the repository files) and name them in --cite.
|
|
7
|
+
*/
|
|
8
|
+
const stateRoot = require('./state-root');
|
|
9
|
+
const PL = require('./popup-leads.js');
|
|
10
|
+
|
|
11
|
+
const COMMANDS = { lead: ['put', 'show'] };
|
|
12
|
+
const USAGE = [
|
|
13
|
+
'usage: pmos lead put|show — Claude\'s short lead for a popup, written ahead and shown first',
|
|
14
|
+
' pmos lead put --key <pop:kind:id> --text "<lead>" [--cite "<what you read, when>"] …',
|
|
15
|
+
' the lead: why it matters now, what is asked or blocking, and what to do, in at most 400 characters; at most 4 cites',
|
|
16
|
+
' pmos lead show [<key>] the stored lead of one popup, or every stored lead',
|
|
17
|
+
' every command: [--json]',
|
|
18
|
+
'This command never calls a tool. Write the lead from stored reads and name them.',
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
function parseArgs(argv) {
|
|
22
|
+
const out = { _: [], cite: [] };
|
|
23
|
+
for (let i = 0; i < argv.length; i++) {
|
|
24
|
+
const t = argv[i];
|
|
25
|
+
if (!t.startsWith('--')) { out._.push(t); continue; }
|
|
26
|
+
const eq = t.indexOf('=');
|
|
27
|
+
const key = eq > 0 ? t.slice(2, eq) : t.slice(2);
|
|
28
|
+
const val = eq > 0 ? t.slice(eq + 1) : key === 'json' || key === 'help' ? true : argv[i + 1] !== undefined ? argv[++i] : '';
|
|
29
|
+
if (key === 'cite') out.cite.push(String(val)); else out[key] = val;
|
|
30
|
+
}
|
|
31
|
+
return out;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function run(argv, { say = console.log, env = process.env, stateDir, now = () => new Date() } = {}) {
|
|
35
|
+
const a = parseArgs(argv.slice(1));
|
|
36
|
+
const sub = a._[0];
|
|
37
|
+
const out = (o, line) => { if (a.json) say(JSON.stringify(o)); else say(line); };
|
|
38
|
+
if (!sub || a.help || sub === 'help') { USAGE.forEach((l) => say(l)); return sub || a.help ? 0 : 2; }
|
|
39
|
+
if (!COMMANDS.lead.includes(sub)) { say(`✗ pmos lead ${sub} is not a command`); USAGE.forEach((l) => say(l)); return 2; }
|
|
40
|
+
const dir = stateDir || stateRoot.defaultRoot({ env });
|
|
41
|
+
if (sub === 'put') {
|
|
42
|
+
const v = PL.validate({ key: a.key, text: a.text, cites: a.cite });
|
|
43
|
+
if (!v.ok) { out({ ok: false, error: v.error }, `✗ refused: ${v.error}. Nothing was saved.`); return a.key && a.text ? 1 : 2; }
|
|
44
|
+
const rec = PL.put(dir, v.lead, now());
|
|
45
|
+
out({ ok: true, lead: rec }, `saved the lead of ${rec.key} at ${rec.at}`);
|
|
46
|
+
return 0;
|
|
47
|
+
}
|
|
48
|
+
const key = a._[1];
|
|
49
|
+
if (key) {
|
|
50
|
+
const r = PL.get(dir, key);
|
|
51
|
+
if (a.json) { say(JSON.stringify({ ok: true, lead: r })); return 0; }
|
|
52
|
+
say(r ? `${key} · ${r.at}\n ${r.text}${r.cites.length ? '\n from: ' + r.cites.join('; ') : ''}` : `${key} has no lead yet`);
|
|
53
|
+
return 0;
|
|
54
|
+
}
|
|
55
|
+
const m = PL.all(dir);
|
|
56
|
+
if (a.json) { say(JSON.stringify({ ok: true, leads: m })); return 0; }
|
|
57
|
+
const ks = Object.keys(m);
|
|
58
|
+
if (!ks.length) { say('no lead is stored yet'); return 0; }
|
|
59
|
+
for (const k of ks) say(`${k} · ${m[k].at} · ${m[k].text}`);
|
|
60
|
+
return 0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
module.exports = { run, COMMANDS, USAGE };
|
|
@@ -109,6 +109,25 @@ function fridayOf({ today, work, tray, ready, review }) {
|
|
|
109
109
|
note: 'One step for each place a thing waits for you. A step opens its first item. PMOS keeps no review schedule or timing, so none is shown.' };
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
const SRC_NAME = { calendar: 'Calendar', wispr: 'Wispr', mail: 'Mail', slack: 'Slack', jira: 'Jira', confluence: 'Confluence', github: 'GitHub', drive: 'Drive', figma: 'Figma', website: 'the website', derived: 'PMOS' };
|
|
113
|
+
/* Where a brief item came from, as the popup shows it first: who, where, their words, the conversation and the link (popup context slice 2). */
|
|
114
|
+
function sourceOf(b) {
|
|
115
|
+
if (!b) return null;
|
|
116
|
+
const name = SRC_NAME[b.source] || (b.source ? String(b.source) : '');
|
|
117
|
+
const thread = (b.thread || []).map((m) => ({ who: m.who ? clip(m.who, 80) : null, at: m.at ? clip(m.at, 20) : null, text: clip(m.text, 280) })).filter((m) => m.text);
|
|
118
|
+
const refs = (b.refs || []).map((r) => ({ label: clip(r.label, 120), link: r.link || null, lines: (r.lines || []).map((l) => clip(l, 200)) }));
|
|
119
|
+
const o = { name, who: b.who ? clip(b.who, 120) : '', where: b.where ? clip(b.where, 120) : '', ask: b.ask ? clip(b.ask, 240) : '', quote: b.quote ? clip(b.quote, 280) : '',
|
|
120
|
+
about: b.about ? clip(b.about, 480) : '', evidence: b.evidence ? clip(b.evidence, 240) : '', link: /^https?:\/\//.test(b.link || '') ? b.link : '', thread, refs };
|
|
121
|
+
return o.who || o.where || o.ask || o.quote || o.about || o.evidence || o.link || thread.length || refs.length ? o : null;
|
|
122
|
+
}
|
|
123
|
+
/* Claude's first line for a brief item: why it is here now, and what is asked. */
|
|
124
|
+
function leadOf(b) {
|
|
125
|
+
if (!b) return '';
|
|
126
|
+
const why = b.why_now ? clip(b.why_now, 240).replace(/\s*$/, '') : '';
|
|
127
|
+
const ask = b.ask ? (b.who ? clip(b.who, 80) + ' asks: ' : 'The ask: ') + clip(b.ask, 240) : '';
|
|
128
|
+
return [why && !/[.!?]$/.test(why) ? why + '.' : why, ask && !/[.!?]$/.test(ask) ? ask + '.' : ask].filter(Boolean).join(' ');
|
|
129
|
+
}
|
|
130
|
+
|
|
112
131
|
function rowOf(it, list, v, inReview, focusIds) {
|
|
113
132
|
const today = v.today, { chip, overdue } = dueChip(it, today);
|
|
114
133
|
const sub = [srcLabel(it) + (it.key && it.source !== 'local' ? ' ' + it.key : ''), it.priority, it.waiting_on ? 'waiting on ' + it.waiting_on : null, (it.steps || []).length ? (it.steps || []).length + ' ' + plural((it.steps || []).length, 'step', 'steps') + ((it.steps || []).some((x) => x.who === 'agent-does' || x.who === 'agent-drafts') ? ' · agent can do ' + (it.steps || []).filter((x) => x.who !== 'you').length : '') : null].filter(Boolean).join(' · ');
|
|
@@ -125,7 +144,13 @@ function rowOf(it, list, v, inReview, focusIds) {
|
|
|
125
144
|
if (list !== 'waiting') actions.push('waiting');
|
|
126
145
|
actions.push('remove');
|
|
127
146
|
if (inReview) actions.push('keep');
|
|
128
|
-
const
|
|
147
|
+
const src = sourceOf(it.brief), lead = leadOf(it.brief);
|
|
148
|
+
if (src) {
|
|
149
|
+
if (src.who) facts.splice(1, 0, ['Asked by', src.who]);
|
|
150
|
+
if (src.where) facts.splice(src.who ? 2 : 1, 0, ['Where', src.where]);
|
|
151
|
+
}
|
|
152
|
+
const state = overdue ? 'This was due ' + shortDate(it.due) + ' and is still open.' : list === 'tray' ? 'You added this. It has no date or place yet. Place it, or drop it.' : list === 'inbox' ? 'This is new and has no date or place yet.' : list === 'waiting' ? 'You are waiting on ' + (it.waiting_on || 'someone') + (days != null ? ' for ' + days + ' ' + plural(days, 'day', 'days') : '') + '.' : 'This is on your list.';
|
|
153
|
+
const say = lead ? (overdue || list === 'waiting' ? state + ' ' : '') + lead : state;
|
|
129
154
|
const { sug, cta } = suggestOf(it, list, today, overdue);
|
|
130
155
|
return {
|
|
131
156
|
key: 'work:' + it.id, id: it.id, list, title: clip(it.title, 140), sub: sub + (added && (list === 'inbox' || list === 'tray') ? ' · added ' + added : ''), chip, overdue, src: srcLabel(it), sug, cta,
|
|
@@ -133,7 +158,7 @@ function rowOf(it, list, v, inReview, focusIds) {
|
|
|
133
158
|
focus: list === 'today' && focusIds.has(it.id),
|
|
134
159
|
dialog: {
|
|
135
160
|
eye: 'Your item', logTitle: 'Read from your list',
|
|
136
|
-
log: ['Read the item (' + srcLabel(it) + ')', 'Placed it from its date, its flag and who it waits on: ' + list, inReview ? 'Found it untouched for ' + v.review_days + ' days' : 'Checked it against the seven-day review'],
|
|
161
|
+
log: ['Read the item (' + srcLabel(it) + ')', 'Placed it from its date, its flag and who it waits on: ' + list, ...(it.brief ? ['Read the brief item it came from' + (it.brief.source ? ' (' + (SRC_NAME[it.brief.source] || it.brief.source) + ')' : '')] : []), inReview ? 'Found it untouched for ' + v.review_days + ' days' : 'Checked it against the seven-day review'],
|
|
137
162
|
say, head: 'Where it stands', facts,
|
|
138
163
|
write: { kind: 'work', id: it.id, actions },
|
|
139
164
|
hold: HOLD.agent,
|
|
@@ -142,7 +167,8 @@ function rowOf(it, list, v, inReview, focusIds) {
|
|
|
142
167
|
steps: (it.steps || []).map((x) => ({ id: x.id, text: clip(x.text, 200), who: x.who })),
|
|
143
168
|
defer: it.defer || null,
|
|
144
169
|
someday: list === 'someday',
|
|
145
|
-
|
|
170
|
+
source: src,
|
|
171
|
+
pane: { label: src ? 'Source' : 'Item record', file: 'pm-items · ' + it.id, h: clip(it.title, 120), intro: sub, rows: facts, paras: draft ? [clip(draft, 1500)] : [], parasTitle: draft ? 'Agent draft, not checked' : '' },
|
|
146
172
|
},
|
|
147
173
|
};
|
|
148
174
|
}
|
|
@@ -56,6 +56,9 @@ const VERBS = Object.freeze({
|
|
|
56
56
|
// Not a pm-os-absorb verb (run: null): briefing-source-flow added it through the same table.
|
|
57
57
|
source: Object.freeze({ module: 'source-cli.js', run: null, guide: 'data-freshness.md',
|
|
58
58
|
help: 'pmos source save|status|show — the stored read of each tool the Briefing uses: Mail, Slack, Confluence and the rest (pmos source help)' }),
|
|
59
|
+
// Not a pm-os-absorb verb (run: null): the popup context work (premium-chat-session slice 7) added it through the same table.
|
|
60
|
+
lead: Object.freeze({ module: 'lead-cli.js', run: null, guide: 'briefing-premium.md',
|
|
61
|
+
help: 'pmos lead put|show — Claude\'s short lead for a popup, written ahead from stored reads (pmos lead help)' }),
|
|
59
62
|
// Not a pm-os-absorb verb (run: null): c3-meet-extension added it through the same table.
|
|
60
63
|
extension: Object.freeze({ module: 'extension-cli.js', run: null, guide: 'console-calendar.md',
|
|
61
64
|
help: 'pmos extension — the folder of the Chrome extension for Google Meet, and the three steps to load it' }),
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* popup-leads.js — Claude's short lead for a popup, written ahead and stored (popup context slice 3, PRD premium-chat-session L1–L4).
|
|
3
|
+
*
|
|
4
|
+
* validate({ key, text, cites }) → { ok, lead } | { ok: false, error }
|
|
5
|
+
* put(runtimeDir, lead, now) → the stored record · get(runtimeDir, key) → record | null · all(runtimeDir) → { key: record }
|
|
6
|
+
*
|
|
7
|
+
* A lead says why the thing in the popup matters now, what is asked or blocking, and what to do, in at most 400 characters, with
|
|
8
|
+
* the reads it came from (at most 4 cites). It is keyed by the popup's conversation key (`pop:<kind>:<id>`, premium-shell popKey).
|
|
9
|
+
* The records live in the per-user runtime folder, one file, newest 500 keys kept. Writing a lead calls no tool: an agent session
|
|
10
|
+
* writes it with `pmos lead put` from stored reads, and the popup only reads the file.
|
|
11
|
+
*/
|
|
12
|
+
const fs = require('fs');
|
|
13
|
+
const path = require('path');
|
|
14
|
+
|
|
15
|
+
const KEY_RE = /^pop:[a-z][a-z-]{0,30}(?::[A-Za-z0-9._-]{1,100}){0,4}$/;
|
|
16
|
+
const MAX_TEXT = 400;
|
|
17
|
+
const MAX_CITES = 4;
|
|
18
|
+
const MAX_CITE = 120;
|
|
19
|
+
const KEEP = 500;
|
|
20
|
+
|
|
21
|
+
const fileOf = (runtimeDir) => path.join(runtimeDir, 'popup-leads.json');
|
|
22
|
+
const clean = (s) => String(s).replace(/\s+/g, ' ').trim();
|
|
23
|
+
|
|
24
|
+
function validate(raw) {
|
|
25
|
+
const r = raw && typeof raw === 'object' ? raw : {};
|
|
26
|
+
const key = typeof r.key === 'string' ? r.key : '';
|
|
27
|
+
if (!KEY_RE.test(key) || key.length > 140) return { ok: false, error: 'key must be a popup key, pop:<kind>:<id>' };
|
|
28
|
+
if (typeof r.text !== 'string' || !clean(r.text)) return { ok: false, error: 'text is required: why it matters now, what is asked, what to do' };
|
|
29
|
+
const text = clean(r.text);
|
|
30
|
+
if (text.length > MAX_TEXT) return { ok: false, error: `text is over ${MAX_TEXT} characters` };
|
|
31
|
+
const cites = r.cites === undefined || r.cites === null ? [] : r.cites;
|
|
32
|
+
if (!Array.isArray(cites) || cites.length > MAX_CITES) return { ok: false, error: `cites must be a list of at most ${MAX_CITES} reads` };
|
|
33
|
+
const out = [];
|
|
34
|
+
for (const c of cites) {
|
|
35
|
+
if (typeof c !== 'string' || !clean(c)) return { ok: false, error: 'each cite names what was read, and when' };
|
|
36
|
+
if (clean(c).length > MAX_CITE) return { ok: false, error: `a cite is over ${MAX_CITE} characters` };
|
|
37
|
+
out.push(clean(c));
|
|
38
|
+
}
|
|
39
|
+
return { ok: true, lead: { key, text, cites: out } };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function all(runtimeDir) {
|
|
43
|
+
if (!runtimeDir) return {};
|
|
44
|
+
try { const m = JSON.parse(fs.readFileSync(fileOf(runtimeDir), 'utf8')); return m && typeof m === 'object' && !Array.isArray(m) ? m : {}; } catch { return {}; }
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function get(runtimeDir, key) {
|
|
48
|
+
if (typeof key !== 'string' || !KEY_RE.test(key)) return null;
|
|
49
|
+
const r = all(runtimeDir)[key];
|
|
50
|
+
return r && typeof r.text === 'string' && r.at ? r : null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function put(runtimeDir, lead, now = new Date()) {
|
|
54
|
+
const m = all(runtimeDir);
|
|
55
|
+
const rec = { text: lead.text, cites: lead.cites || [], at: now.toISOString() };
|
|
56
|
+
delete m[lead.key];
|
|
57
|
+
m[lead.key] = rec;
|
|
58
|
+
const keys = Object.keys(m).sort((a, b) => String(m[a].at).localeCompare(String(m[b].at)));
|
|
59
|
+
for (const k of keys.slice(0, Math.max(0, keys.length - KEEP))) delete m[k];
|
|
60
|
+
const f = fileOf(runtimeDir);
|
|
61
|
+
fs.mkdirSync(path.dirname(f), { recursive: true });
|
|
62
|
+
const tmp = `${f}.${process.pid}.tmp`;
|
|
63
|
+
fs.writeFileSync(tmp, JSON.stringify(m) + '\n');
|
|
64
|
+
fs.renameSync(tmp, f);
|
|
65
|
+
return { key: lead.key, ...rec };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
module.exports = { KEY_RE, MAX_TEXT, validate, put, get, all, fileOf };
|
|
@@ -14,6 +14,7 @@ const guard = require('./pm-guard.js');
|
|
|
14
14
|
const Wr = require('./briefing-premium-writes.js');
|
|
15
15
|
const Ag = require('./briefing-premium-agent.js');
|
|
16
16
|
const Goal = require('./goal-chat.js');
|
|
17
|
+
const Leads = require('./popup-leads.js');
|
|
17
18
|
const Files = require('./chat-files.js');
|
|
18
19
|
const Inbox = require('./agent-inbox.js');
|
|
19
20
|
const actor = require('./actor.js');
|
|
@@ -207,7 +208,9 @@ module.exports = {
|
|
|
207
208
|
const live = !!(sid && ctx.chatSessions && ctx.chatSessions.alive(sid));
|
|
208
209
|
// item-chat-history: with no live session, the conversation the key had is read from its saved Claude Code file, so ending a session never empties the panel
|
|
209
210
|
const history = !live && ctx.runtimeDir ? Ag.chatHistory({ runtimeDir: ctx.runtimeDir, key, sessions: ctx.chatSessions }) : null;
|
|
210
|
-
|
|
211
|
+
// popup context slice 3: a popup's stored lead comes with its thread, so the popup shows it first and starts nothing
|
|
212
|
+
const lead = key.startsWith('pop:') && ctx.runtimeDir ? Leads.get(ctx.runtimeDir, key) : undefined;
|
|
213
|
+
ctx.json(res, { ok: true, ...Ag.threadOf(ctx.runtimeDir, key), session: live ? sid : null, history, goal: ctx.runtimeDir ? Goal.goalOf(ctx.runtimeDir, key) : null, ...(lead !== undefined ? { lead } : {}) });
|
|
211
214
|
return true;
|
|
212
215
|
}
|
|
213
216
|
if (url.pathname !== '/api/briefing-premium') return false;
|
|
@@ -354,9 +354,12 @@ module.exports = {
|
|
|
354
354
|
const readBriefOf = (d) => { try { return JSON.parse(fs.readFileSync(path.join(ctx.runtimeDir, 'briefs', d + '.json'), 'utf8')); } catch { return null; } };
|
|
355
355
|
for (const it of v.items) {
|
|
356
356
|
const m = /^brief:([0-9a-f]{12})$/.exec(String(it.id || ''));
|
|
357
|
-
if (!m || it.
|
|
357
|
+
if (!m || it.done || !ctx.runtimeDir) continue;
|
|
358
358
|
const x = assigned.findBriefItem(readBriefOf, m[1], c.now.getTime());
|
|
359
|
-
if (x)
|
|
359
|
+
if (!x) continue;
|
|
360
|
+
// the brief item's own context goes with it, so the popup shows who asked, where, their words and the link (popup context slice 2)
|
|
361
|
+
it.brief = assigned.briefContext(x);
|
|
362
|
+
if (!it.agent) { it.agent = assigned.briefAgent(x, assigned.runWith(runs, 't-' + x.id)); if (!it.place) it.place = x.source || null; }
|
|
360
363
|
}
|
|
361
364
|
ctx.json(res, v);
|
|
362
365
|
return true;
|
|
@@ -125,6 +125,17 @@ function findBriefItem(readBrief, id, nowMs, days = 7) {
|
|
|
125
125
|
return null;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
/** The context a brief item carries, for the popup of the Work item made from it: why now, the source, who asked, where,
|
|
129
|
+
* their words, the conversation and the link. Only the fields the brief gave. */
|
|
130
|
+
function briefContext(x) {
|
|
131
|
+
if (!x) return null;
|
|
132
|
+
const o = {};
|
|
133
|
+
for (const k of ['why_now', 'evidence', 'source', 'who', 'where', 'about', 'ask', 'quote', 'link', 'todo']) if (typeof x[k] === 'string' && x[k].trim()) o[k] = x[k];
|
|
134
|
+
if (Array.isArray(x.thread) && x.thread.length) o.thread = x.thread.slice(0, 4).map((m) => ({ who: m.who || null, at: m.at || null, text: String(m.text || '') }));
|
|
135
|
+
if (Array.isArray(x.refs) && x.refs.length) o.refs = x.refs.slice(0, 3).map((r) => ({ label: r.label, source: r.source || null, link: r.link || null, lines: (r.lines || []).slice(0, 5) }));
|
|
136
|
+
return Object.keys(o).length ? o : null;
|
|
137
|
+
}
|
|
138
|
+
|
|
128
139
|
function fromBrief(brief, todayIso, run = null) {
|
|
129
140
|
if (!brief || brief.date !== todayIso) return [];
|
|
130
141
|
const list = [...(Array.isArray(brief.priorities) ? brief.priorities : []), ...(Array.isArray(brief.items) ? brief.items : [])];
|
|
@@ -160,4 +171,4 @@ function overlay(item, byId) {
|
|
|
160
171
|
return out;
|
|
161
172
|
}
|
|
162
173
|
|
|
163
|
-
module.exports = { fromMyWork, fromBrief, addable, createdEvent, overlay, agentOf, briefAgent, briefSuggest, briefDraftSpec, taskAgent, localTaskId, localOffer, localSuggest, localDraftSpec, localAgent, runWith, recentRuns, recentDates, findBriefItem, AGENT };
|
|
174
|
+
module.exports = { fromMyWork, fromBrief, addable, createdEvent, overlay, agentOf, briefAgent, briefSuggest, briefDraftSpec, taskAgent, localTaskId, localOffer, localSuggest, localDraftSpec, localAgent, runWith, recentRuns, recentDates, findBriefItem, briefContext, AGENT };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.385.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.385.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -141,6 +141,24 @@ const TICKETS = {
|
|
|
141
141
|
ok('N2 a ticket that cannot be read says why, and invents nothing', !!k && /no such initiative/.test(k), k);
|
|
142
142
|
await N.ctx.close();
|
|
143
143
|
}
|
|
144
|
+
/* popup context slice 4: a ticket in no draft and no sprint read, and in no stored read either */
|
|
145
|
+
{
|
|
146
|
+
const Q = await open();
|
|
147
|
+
await Q.page.route('**/api/jira/ticket?*', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, ticket: null, jira_read_at: new Date().toISOString() }) }));
|
|
148
|
+
await Q.page.evaluate(async () => { const m = await import('/pm/premium-vw-jira.js'); m.openTicket({ ws: 'w1', board: 'w1', initiative: 'self-serve-v2', ref: 'IDPF-2611' }); });
|
|
149
|
+
const q = await until(async () => { const x = await paneText(Q.page, 'jira:IDPF-2611'); return x && /Not read yet/.test(x) ? x : null; });
|
|
150
|
+
ok('N3 a ticket nothing stored holds says Not read yet, when Jira was last read, and offers Read it now (popup context slice 4)', !!q && /Not read yet: IDPF-2611\. The last Jira read \(read \d\d:\d\d\) does not hold it/.test(q) && /Read it now/.test(q)
|
|
151
|
+
&& Q.reads.some((r) => /^\/api\/jira\/ticket\?.*key=IDPF-2611/.test(r)) && Q.posts.length === 0, q || JSON.stringify(Q.reads));
|
|
152
|
+
await Q.ctx.close();
|
|
153
|
+
// the route itself: a ticket no snapshot holds is found in the stored Jira source read, with what the read says and when
|
|
154
|
+
const fs = require('fs'), path = require('path');
|
|
155
|
+
fs.mkdirSync(path.join(T.STATE_DIR, 'source-reads'), { recursive: true });
|
|
156
|
+
fs.writeFileSync(path.join(T.STATE_DIR, 'source-reads', 'jira.json'), JSON.stringify({ source: 'jira', state: 'read', read_at: '2026-10-21T07:02:00.000Z', items: [{ id: 'a1b2c3d4e5f6', title: 'IDPF-2611 Payment retry', link: 'https://x.atlassian.net/browse/IDPF-2611', who: 'Sam', ask: 'Confirm the copy', about: 'Moved back to review' }] }));
|
|
157
|
+
const got = async (k) => (await fetch(BASE + '/api/jira/ticket?key=' + k)).json();
|
|
158
|
+
const g1 = await got('IDPF-2611'), g2 = await got('IDPF-261'), g3 = await got('idpf-2611');
|
|
159
|
+
ok('N4 GET /api/jira/ticket falls back to the stored Jira read: the key, title, what it says and the read time; a shorter key does not match', g1.ok && g1.ticket && g1.ticket.from === 'source-read' && g1.ticket.summary === 'IDPF-2611 Payment retry' && g1.ticket.about === 'Moved back to review' && g1.ticket.fetchedAt === '2026-10-21T07:02:00.000Z'
|
|
160
|
+
&& g2.ticket === null && g2.jira_read_at === '2026-10-21T07:02:00.000Z' && g3.ticket && g3.ticket.key === 'IDPF-2611', JSON.stringify([g1, g2]));
|
|
161
|
+
}
|
|
144
162
|
|
|
145
163
|
/* I the initiative page loads the ticket view for its Jira tasks */
|
|
146
164
|
{
|
|
@@ -440,9 +440,28 @@ function putHtml(el, html) {
|
|
|
440
440
|
return true;
|
|
441
441
|
}
|
|
442
442
|
function clearHtml(el) { el.__h = undefined; el.classList.remove('still'); el.innerHTML = ''; }
|
|
443
|
+
/* popup context slice 3: Claude's lead for a popup, written ahead from stored reads, comes first. Refresh asks the popup's own
|
|
444
|
+
* session to write it again; nothing runs when the popup opens. */
|
|
445
|
+
const leadAsk = (key) => 'Refresh the short lead for this popup. In 1 to 3 sentences say why it matters now, what is asked or blocking, and what you would do. '
|
|
446
|
+
+ 'Use only stored reads (pmos source show, the repository files) and say which. Save it with: pmos lead put --key ' + key + ' --text "<the lead>" --cite "<what you read, when>". Then give the lead here.';
|
|
447
|
+
const leadTime = (iso) => { const d = new Date(iso); if (Number.isNaN(d.getTime())) return ''; const p = (n) => String(n).padStart(2, '0'); return (d.toDateString() === new Date().toDateString() ? '' : d.getDate() + ' ' + d.toLocaleString('en-GB', { month: 'short' }) + ' ') + p(d.getHours()) + ':' + p(d.getMinutes()); };
|
|
448
|
+
function leadHtml(lead) {
|
|
449
|
+
if (!lead) return `<div class="plead none"><p class="fine2">No lead is written for this yet.</p><button type="button" class="xtb" data-lead="refresh">Write the lead</button></div>`;
|
|
450
|
+
return `<div class="plead"><p>${esc(lead.text)}</p><p class="fine2">Lead · written ${esc(leadTime(lead.at))}${lead.cites && lead.cites.length ? ' · from ' + esc(lead.cites.join('; ')) : ''}</p><button type="button" class="xtb" data-lead="refresh">Refresh</button></div>`;
|
|
451
|
+
}
|
|
452
|
+
function drawLead(box, th) {
|
|
453
|
+
if (!('lead' in th)) return;
|
|
454
|
+
let l = $('#leadT', box); if (!l) { box.insertAdjacentHTML('afterbegin', '<div id="leadT"></div>'); l = $('#leadT', box); }
|
|
455
|
+
putHtml(l, leadHtml(th.lead));
|
|
456
|
+
}
|
|
457
|
+
$('#dBody').addEventListener('click', async (e) => {
|
|
458
|
+
const b = e.target.closest('[data-lead="refresh"]'); if (!b || !S.key || !S.key.startsWith('pop:')) return;
|
|
459
|
+
b.disabled = true; await sendText(S.key, leadAsk(S.key));
|
|
460
|
+
});
|
|
443
461
|
export function drawThread(th, key, conv) {
|
|
444
462
|
if (S.key !== key) return;
|
|
445
463
|
const box = $('#dBody .stream'); if (!box) return;
|
|
464
|
+
drawLead(box, th);
|
|
446
465
|
let t = $('#thr', box); if (!t) { box.insertAdjacentHTML('beforeend', '<div id="thr"></div>'); t = $('#thr', box); }
|
|
447
466
|
const b = $('#dBody'), atEnd = b.scrollHeight - b.scrollTop - b.clientHeight < 80;
|
|
448
467
|
putHtml(t, threadHtml(th) + sessionHtml(conv, th.goal));
|
|
@@ -566,6 +585,8 @@ const onWebLink = (e) => {
|
|
|
566
585
|
};
|
|
567
586
|
$('#dBody').addEventListener('click', onWebLink); $('#dOut').addEventListener('click', onWebLink);
|
|
568
587
|
/* /goal (slice 2): a chip sends its answer; Start and Cancel are the PM's presses on the goal card; Change something hands the box back. */
|
|
588
|
+
/** Send one message to the open popup's own conversation (a viewer tab's Read it now). False when no popup conversation is open. */
|
|
589
|
+
export async function askHere(text) { return S.key && $('#dlg').classList.contains('on') ? sendText(S.key, text) : false; }
|
|
569
590
|
async function sendText(key, text, files) {
|
|
570
591
|
const go = $('#askGo'); if (go) go.disabled = true; $('#askNote').textContent = 'Sending.';
|
|
571
592
|
const ctx = S.ctx && key === S.key ? { context: S.ctx } : {};
|
|
@@ -119,3 +119,29 @@ export function readLine(iso, now = Date.now()) {
|
|
|
119
119
|
const same = d.getFullYear() === n.getFullYear() && d.getMonth() === n.getMonth() && d.getDate() === n.getDate();
|
|
120
120
|
return 'read ' + (same ? String(d.getHours()).padStart(2, '0') + ':' + String(d.getMinutes()).padStart(2, '0') : d.getDate() + ' ' + MON[d.getMonth()]);
|
|
121
121
|
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* A ticket that is in no ticket draft and no sprint read, from GET /api/jira/ticket (popup context slice 4): the newest Jira check
|
|
125
|
+
* snapshot that holds it, or else the stored Jira source read. ans: that answer (or null), ref: the key.
|
|
126
|
+
* → a ticket model (fromStore: 'snapshot' | 'source-read'), or { ok: false, why, canRead } when nothing stored holds it, so the
|
|
127
|
+
* tab offers Read it now for that one ticket.
|
|
128
|
+
*/
|
|
129
|
+
export function storedModel(ans, ref) {
|
|
130
|
+
const r = str(ref).toUpperCase();
|
|
131
|
+
const t = ans && ans.ok && ans.ticket ? ans.ticket : null;
|
|
132
|
+
if (!t) {
|
|
133
|
+
const last = ans && ans.jira_read_at ? ` The last Jira read (${readLine(ans.jira_read_at)}) does not hold it.` : ' Jira has not been read yet.';
|
|
134
|
+
return { ok: false, ref: r, canRead: !!r, why: `Not read yet: ${r || 'this ticket'}.${last} Read it now asks this popup's Claude session to read the one ticket.` };
|
|
135
|
+
}
|
|
136
|
+
const src = t.from === 'source-read' ? 'source-read' : 'snapshot';
|
|
137
|
+
const sp = t.sprint && t.sprint.name ? { name: t.sprint.name, state: t.sprint.state || '', dates: [day(t.sprint.start), day(t.sprint.end)].filter(Boolean).join(' – ') } : null;
|
|
138
|
+
const sub = t.subtasks && Number.isInteger(t.subtasks.total) && t.subtasks.total > 0 ? { done: Math.min(t.subtasks.done || 0, t.subtasks.total), total: t.subtasks.total } : null;
|
|
139
|
+
const about = [str(t.about), t.who && t.ask ? `${str(t.who)} asks: ${str(t.ask)}` : str(t.ask)].filter(Boolean).join('\n\n');
|
|
140
|
+
return {
|
|
141
|
+
ok: true, id: '', key: str(t.key) || r, inJira: true, title: str(t.summary) || r, type: '', priority: '', estimate: '', points: null,
|
|
142
|
+
status: str(t.status) || (src === 'source-read' ? 'Status not in the read' : 'No status read'), category: t.category || 'todo', sprint: sp,
|
|
143
|
+
flagged: !!t.flagged, reason: t.flagged ? str(t.reason) || 'Flagged in Jira' : '', stale: false,
|
|
144
|
+
sections: about ? [{ key: 'about', name: 'What the Jira read says', text: about }] : [], subtasks: sub, links: [], epic: null, prd: '', initiative: '',
|
|
145
|
+
url: safeUrl(t.url), readAt: t.fetchedAt || null, draftOnly: true, noDraft: false, readingOnly: false, fromStore: src,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
import { vwOpen, vwStyle } from './premium-viewer.js';
|
|
9
9
|
import { openBacklog } from './premium-vw-backlog.js';
|
|
10
10
|
import { mdRender } from './markdown.js';
|
|
11
|
-
import { esc, toast } from './premium-shell.js';
|
|
12
|
-
import { ticketModel, sprintModel, readLine } from './premium-vw-jira-model.js';
|
|
11
|
+
import { esc, toast, askHere } from './premium-shell.js';
|
|
12
|
+
import { ticketModel, sprintModel, readLine, storedModel } from './premium-vw-jira-model.js';
|
|
13
13
|
|
|
14
14
|
const ICO = (p) => `<svg class="i" viewBox="0 0 24 24">${p}</svg>`;
|
|
15
15
|
const EXT = ICO('<path d="M14 4h6v6M20 4l-9 9M18 14v6H4V6h6"/>');
|
|
@@ -26,11 +26,13 @@ const md = (t) => { try { const d = document.createElement('div'); d.append(...m
|
|
|
26
26
|
const bar = (what, m) => `<div class="jbar"><span class="jlg" aria-hidden="true">J</span><span class="jbt"><b>From the last Jira read</b> · ${esc(what)} · ${esc(readLine(m.readAt))}</span>${m.url ? `<a class="jbtn" href="${esc(m.url)}" target="_blank" rel="noopener">${EXT}Open in Jira</a>` : ''}<button type="button" class="jbtn" data-jre>Read again</button></div>`;
|
|
27
27
|
// the bars' widths are run-time geometry, set as a property rather than an inline style
|
|
28
28
|
const bars = (el) => el.querySelectorAll('[data-pct]').forEach((i) => i.style.setProperty('--bd-w', Math.max(0, Math.min(100, +i.dataset.pct || 0)) + '%'));
|
|
29
|
-
const empty = (why) => `<div class="jv"><div class="jempty"><b
|
|
29
|
+
const empty = (why, canRead) => `<div class="jv"><div class="jempty"><b>${canRead ? 'Not read yet' : 'Nothing to show'}</b><p>${esc(why)}</p>${canRead ? '<button type="button" class="jbtn" data-jread>Read it now</button>' : ''}</div></div>`;
|
|
30
|
+
// popup context slice 4: Read it now asks the popup's own Claude session to read the one ticket; nothing reads Jira when the tab opens
|
|
31
|
+
const readAsk = (ref) => `Read the Jira ticket ${ref} with my Atlassian connection, read only. Tell me its status, who has it, the latest comment and what is asked of me. Change nothing in Jira. Then save the lead of this popup with pmos lead put.`;
|
|
30
32
|
|
|
31
33
|
/* ── the ticket ─────────────────────────────────────────────────────────────────────────────────────────── */
|
|
32
34
|
function ticketHtml(m) {
|
|
33
|
-
if (!m.ok) return empty(m.why);
|
|
35
|
+
if (!m.ok) return empty(m.why, m.canRead);
|
|
34
36
|
const chips = [
|
|
35
37
|
m.sprint ? `<span class="jchip" title="Sprint">${esc(m.sprint.name)}${m.sprint.state ? ` · ${esc(m.sprint.state)}` : ''}</span>` : '<span class="jchip mut" title="Sprint">No sprint</span>',
|
|
36
38
|
m.points != null ? `<span class="jpts" title="Story points">${esc(m.points)} pt</span>` : '',
|
|
@@ -43,7 +45,7 @@ function ticketHtml(m) {
|
|
|
43
45
|
? `<button type="button" data-jt="${esc(l.ref)}">${LINK}<span class="jk">${esc(l.key || l.ref)}</span><b>${esc(l.title)}</b></button>`
|
|
44
46
|
: `<span class="jlx">${LINK}<span class="jk">${esc(l.ref)}</span></span>`}</div>`).join('')}${m.prd ? `<div class="jln"><em>from</em><span class="jlx">${DOC}<b>${esc(m.prd)}</b></span></div>` : ''}</div>` : '';
|
|
45
47
|
const body = m.sections.length ? m.sections.map((s) => `<h3>${esc(s.name)}</h3><div class="jmd">${md(s.text)}</div>`).join('')
|
|
46
|
-
: `<p class="jnote">${m.noDraft ? 'This ticket is on no initiative of this board, so PMOS holds no text for it. Its title, status and points come from the sprint read.' : m.draftOnly ? 'This ticket is not in the initiative\'s ticket draft, so PMOS holds no text for it. Its title, status and points come from the sprint read.' : 'The ticket draft holds no text for this ticket.'}</p>`;
|
|
48
|
+
: `<p class="jnote">${m.fromStore ? `This ticket is not in the initiative's ticket draft. Its title and status come from ${m.fromStore === 'source-read' ? 'the stored Jira read' : 'the last Jira check that held it'}.` : m.noDraft ? 'This ticket is on no initiative of this board, so PMOS holds no text for it. Its title, status and points come from the sprint read.' : m.draftOnly ? 'This ticket is not in the initiative\'s ticket draft, so PMOS holds no text for it. Its title, status and points come from the sprint read.' : 'The ticket draft holds no text for this ticket.'}</p>`;
|
|
47
49
|
return `<div class="jv">${bar('ticket', m)}<article class="jtk">
|
|
48
50
|
<div class="jbc">${m.epic ? `<span class="jk">${esc(m.epic.key)}</span>${m.epic.title ? ` ${esc(m.epic.title)}` : ''} <span aria-hidden="true">/</span> ` : m.initiative ? `${esc(m.initiative)} <span aria-hidden="true">/</span> ` : ''}<span class="jk">${esc(m.key || m.id)}</span></div>
|
|
49
51
|
<h1>${esc(m.title)}</h1>
|
|
@@ -65,8 +67,10 @@ export async function openTicket(o) {
|
|
|
65
67
|
const draw = async (el) => {
|
|
66
68
|
el.innerHTML = '<div class="jv"><p class="jnote">Reading the ticket</p></div>';
|
|
67
69
|
const [view, sprints] = await Promise.all([initiative ? getJson('/api/jira/tickets', { ws, initiative }) : null, board ? getJson('/api/boards/sprints', { ws, board }) : null]);
|
|
68
|
-
|
|
70
|
+
let m = ticketModel(view, ref, sprints);
|
|
71
|
+
if (!m.ok && !(view && view.ok === false && view.error)) m = storedModel(await getJson('/api/jira/ticket', { ws, key: ref }), ref);
|
|
69
72
|
el.innerHTML = ticketHtml(m); bars(el);
|
|
73
|
+
const rd = el.querySelector('[data-jread]'); if (rd) rd.onclick = async () => { rd.disabled = true; toast(await askHere(readAsk(ref)) ? 'Claude is reading ' + ref + ' in this popup\'s chat.' : 'Open the ticket from its popup to read it.'); };
|
|
70
74
|
el.querySelectorAll('[data-jt]').forEach((b) => { b.onclick = () => openTicket({ ws, board, initiative, ref: b.dataset.jt }); });
|
|
71
75
|
const re = el.querySelector('[data-jre]'); if (re) re.onclick = async () => { await draw(el); toast('Read the cached Jira reading again. A Jira check reads Jira itself.'); };
|
|
72
76
|
};
|
|
@@ -295,9 +295,24 @@ function paneHtml(r) {
|
|
|
295
295
|
+ (dr.step ? `<p class="agstep">Step when you approve: ${esc(dr.step)}</p>` : '')
|
|
296
296
|
+ `<div class="mdr${clip ? ' clipd' : ''}">${mdHtml(dr.body || dr.summary)}</div>${long ? `<button class="xtb" data-pp="all" type="button" aria-expanded="${!clip}">${clip ? 'Show all' : 'Show less'}</button>` : ''}</article>`;
|
|
297
297
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
298
|
+
// the dialog head already shows the title and its line, so the pane opens the source and keeps the record behind Details
|
|
299
|
+
const kv = p.rows && p.rows.length ? `<div class="kv2">${p.rows.map(([a, b]) => `<span>${esc(a)}</span><span>${esc(b)}</span>`).join('')}</div>` : '';
|
|
300
|
+
const sc = r.dialog.source;
|
|
301
|
+
if (sc) return h + srcHtml(sc) + `<details class="paper doc wkdet"><summary>Details</summary>${kv}<p class="xn">${esc(p.file)}</p></details>`;
|
|
302
|
+
return h + `<article class="paper doc">${kv}<p class="xn">The item as your list holds it · ${esc(p.file)}</p></article>`;
|
|
303
|
+
}
|
|
304
|
+
/* the message, ticket or thread the item came from, as the brief stored it: nothing is read live on open */
|
|
305
|
+
function srcHtml(sc) {
|
|
306
|
+
const by = [sc.who, sc.where ? 'in ' + sc.where : ''].filter(Boolean).join(' ');
|
|
307
|
+
let g = `<p class="agtag"><span class="agst">${esc(sc.name || 'Source')}</span>${by ? ' ' + esc(by) : ''}</p>`;
|
|
308
|
+
if (sc.thread && sc.thread.length) g += `<div class="wksrc">${sc.thread.map((m) => `<p class="wkmsg"><b>${esc(m.who || 'Someone')}</b>${m.at ? ` <span class="xn">${esc(m.at)}</span>` : ''}<br>${esc(m.text)}</p>`).join('')}</div>`;
|
|
309
|
+
else if (sc.quote) g += `<blockquote class="wkq">${esc(sc.quote)}</blockquote>`;
|
|
310
|
+
if (sc.ask && !(sc.thread && sc.thread.length) && !sc.quote) g += `<p><b>Asked:</b> ${esc(sc.ask)}</p>`;
|
|
311
|
+
if (sc.about) g += `<p>${esc(sc.about)}</p>`;
|
|
312
|
+
for (const rf of sc.refs || []) g += `<p class="wkref"><b>${rf.link ? `<a href="${esc(rf.link)}" target="_blank" rel="noopener">${esc(rf.label)}</a>` : esc(rf.label)}</b></p>${rf.lines.length ? `<ul>${rf.lines.map((l) => `<li>${esc(l)}</li>`).join('')}</ul>` : ''}`;
|
|
313
|
+
if (sc.evidence) g += `<p class="xn">Evidence: ${esc(sc.evidence)}</p>`;
|
|
314
|
+
if (sc.link) g += `<p><a class="xtb" href="${esc(sc.link)}" target="_blank" rel="noopener">Open in ${esc(sc.name || 'its source')}</a></p>`;
|
|
315
|
+
return `<article class="paper doc wksrcp">${g}</article>`;
|
|
301
316
|
}
|
|
302
317
|
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);
|
|
303
318
|
const paneSig = (r) => JSON.stringify([r.dialog.agent && r.dialog.agent.draft, r.dialog.agent && r.dialog.agent.round, r.dialog.agent && r.dialog.agent.state, r.dialog.pane]);
|
|
@@ -2707,3 +2707,14 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
|
|
|
2707
2707
|
.ctxpeek b{color:var(--ink);font-weight:600}
|
|
2708
2708
|
.ctxpeek em{font-style:normal;font-weight:600;color:var(--ink)}
|
|
2709
2709
|
.vwtk b{display:block}
|
|
2710
|
+
/* popup context slice 2: a Work item from the brief opens its source; the record folds behind Details */
|
|
2711
|
+
.wksrcp .wkmsg{margin:0 0 10px;font-size:var(--fs-3);line-height:1.5;overflow-wrap:anywhere}
|
|
2712
|
+
.wksrcp .wkq{margin:0 0 10px;padding:6px 12px;border-left:3px solid var(--hair);color:var(--ink-2);font-size:var(--fs-3);line-height:1.5}
|
|
2713
|
+
.wksrcp .wkref{margin:10px 0 2px}.wksrcp ul{margin:0 0 8px;padding-left:18px;font-size:var(--fs-3)}
|
|
2714
|
+
.wkdet summary{cursor:pointer;font:600 var(--t-micro) var(--mono);letter-spacing:.08em;text-transform:uppercase;color:var(--ink-3)}
|
|
2715
|
+
.wkdet[open] summary{margin-bottom:10px}
|
|
2716
|
+
/* popup context slice 3: Claude's stored lead opens the conversation of a popup */
|
|
2717
|
+
.plead{margin:0 0 14px;padding:12px 14px;border-radius:12px;background:var(--well)}
|
|
2718
|
+
.plead p{margin:0 0 6px;font-size:var(--fs-3);line-height:1.5;overflow-wrap:anywhere}
|
|
2719
|
+
.plead .fine2{color:var(--ink-3)}
|
|
2720
|
+
.plead.none{display:flex;align-items:center;gap:10px;justify-content:space-between}.plead.none p{margin:0}
|
|
@@ -240,7 +240,9 @@ function cardHtml(r) {
|
|
|
240
240
|
function paneHtml(r) {
|
|
241
241
|
// as the mockup draws it: the record's path, its heading and one lead line, then its grid or sections
|
|
242
242
|
const p = r.dialog.pane, sel = SEL[r.key] || r.dialog.sel, o = (r.dialog.opts || []).find((x) => x.k === sel);
|
|
243
|
-
|
|
243
|
+
// the dialog head already shows the title and its line: the pane does not draw them a second time
|
|
244
|
+
const same = (a, b) => String(a || '').trim() === String(b || '').trim();
|
|
245
|
+
let h = `<p class="dpath">${esc(p.file || '')}</p>${p.h && !same(p.h, r.dialog.title || r.title) ? H1(p.h) : ''}${p.intro && !same(p.intro, r.dialog.sub || r.subject) ? P1(p.intro) : ''}`;
|
|
244
246
|
if (p.list) h = `<p class="dpath">planning/runs/evals.jsonl</p><ol class="stp">${r.dialog.items.map((x, k) => `<li><i>${k + 1}</i><span><b>${esc(x.t)}</b><small>${esc(x.m + ' · ' + x.s)}${x.lead ? '. ' + esc(x.lead) : ''}</small></span></li>`).join('')}</ol>`;
|
|
245
247
|
else if (p.optsDraft) h += H2('Evidence') + UL(p.evidence.filter((x) => x && x[1]).map(([k, v]) => k + ': ' + v)) + H2('Decision') + P1(o ? o.t + '. ' + o.draft : 'Choose an option to draft the entry.') + `<p class="xn">A draft. Nothing is written to the journal until you press Record.</p>`;
|
|
246
248
|
else h += (p.rows && p.rows.length ? kv(p.rows) : '') + (p.paras && p.paras.length ? (p.parasTitle ? H2(p.parasTitle) : '') + p.paras.map(P1).join('') : '') + `<p class="xn">The record as it stands. Nothing is drafted here.</p>`;
|
package/workspace/server.js
CHANGED
|
@@ -8132,8 +8132,14 @@ async function handleRequest(req, res) {
|
|
|
8132
8132
|
// holding the PM's own Atlassian connection, does (D53, D88).
|
|
8133
8133
|
if (p === '/api/jira/ticket' && req.method === 'GET') { // premium-chat-viewer slice 2: one ticket by key from the stored Jira readings
|
|
8134
8134
|
const w = getWs(url.searchParams.get('ws'));
|
|
8135
|
-
const
|
|
8136
|
-
|
|
8135
|
+
const key = String(url.searchParams.get('key') || '').toUpperCase();
|
|
8136
|
+
const t = jiraStatus.findTicket(w ? w.root : SELF_ROOT, key);
|
|
8137
|
+
if (t) return json(res, { ok: true, ticket: t });
|
|
8138
|
+
// popup context slice 4: a ticket no Jira check snapshot holds may be in the stored Jira source read (lib/source-reads.js)
|
|
8139
|
+
const jr = require('./lib/source-reads.js').read(STATE, 'jira');
|
|
8140
|
+
const hit = jr && /^[A-Z][A-Z0-9]+-\d+$/.test(key) ? (jr.items || []).find((x) => new RegExp('(^|[^A-Z0-9-])' + key + '($|[^0-9])').test(String(x.title || '') + ' ' + String(x.link || ''))) : null;
|
|
8141
|
+
return json(res, { ok: true, ticket: hit ? { key, summary: hit.title, status: null, about: hit.about || null, who: hit.who || null, ask: hit.ask || null, url: hit.link || null, fetchedAt: jr.read_at, from: 'source-read' } : null,
|
|
8142
|
+
jira_read_at: jr ? jr.read_at : null });
|
|
8137
8143
|
}
|
|
8138
8144
|
if (p === '/api/jira/tickets' && req.method === 'GET') {
|
|
8139
8145
|
const w = getWs(url.searchParams.get('ws'));
|