create-pmos 0.363.0 → 0.364.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 +18 -13
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/briefing-premium-board-test.js +4 -4
- package/workspace/briefing-premium-initiative-test.js +4 -3
- package/workspace/briefing-premium-test.js +57 -54
- package/workspace/changelog.json +17 -0
- package/workspace/guide/briefing-premium.md +7 -7
- package/workspace/guide/data-freshness.md +15 -1
- package/workspace/lib/briefing-premium-agent.js +3 -1
- package/workspace/lib/freshness.js +17 -1
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/lib/source-cli.js +85 -0
- package/workspace/lib/source-reads.js +200 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-studio-test.js +4 -4
- package/workspace/premium-vw-item-test.js +3 -3
- package/workspace/public/pm/premium-board.js +4 -3
- package/workspace/public/pm/premium-chat.js +9 -0
- package/workspace/public/pm/premium-initiative.js +4 -3
- package/workspace/public/pm/premium-insights.js +2 -2
- package/workspace/public/pm/premium-shell.js +30 -17
- package/workspace/public/pm/premium-work.js +2 -2
- package/workspace/public/pm/premium.css +6 -0
- package/workspace/public/pm/premium.js +2 -2
- package/workspace/public/premium-board.html +1 -1
- package/workspace/public/premium-chat.html +39 -0
- package/workspace/public/premium-initiative.html +1 -1
- package/workspace/public/premium-insights.html +1 -1
- package/workspace/public/premium-work.html +1 -1
- package/workspace/public/premium.html +1 -1
- package/workspace/server.js +4 -2
- package/workspace/skills/sources-read.skill +54 -0
- package/workspace/test-lists/briefing-source-flow.json +5 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* source-cli.js — `pmos source …`: the stored read of each tool the Briefing uses (initiative briefing-source-flow, slice 1).
|
|
3
|
+
* pmos source save --file <reads.json> [--json] the sources-read skill saves what it read, one record per source
|
|
4
|
+
* pmos source status [--json] when each source was last read, and which were not reached
|
|
5
|
+
* pmos source show [<source>] [--json] what a source's last read holds (every source when none is named)
|
|
6
|
+
* The records are kept in the per-user runtime folder (lib/source-reads.js), never in a repository. This command calls no
|
|
7
|
+
* tool: an agent session reads them with the PM's own connections and saves the result here. Derived content (the brief,
|
|
8
|
+
* insights, reports) reads them with `show`.
|
|
9
|
+
*/
|
|
10
|
+
const fs = require('fs');
|
|
11
|
+
const path = require('path');
|
|
12
|
+
const stateRoot = require('./state-root');
|
|
13
|
+
const SR = require('./source-reads.js');
|
|
14
|
+
|
|
15
|
+
const COMMANDS = { source: ['save', 'status', 'show'] };
|
|
16
|
+
const USAGE = [
|
|
17
|
+
'usage: pmos source save|status|show — the stored read of each tool the Briefing uses',
|
|
18
|
+
' pmos source save --file <reads.json> the sources-read skill saves what it read: { "reads": [ { "source", "state", "items", … } ] }',
|
|
19
|
+
' pmos source status when each source was last read, and which were not reached',
|
|
20
|
+
' pmos source show [<source>] what the last read of a source holds; every source when none is named',
|
|
21
|
+
' every command: [--json]',
|
|
22
|
+
'This command never calls a tool. Your agent reads them with your own connections.',
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
function parseArgs(argv) {
|
|
26
|
+
const out = { _: [] };
|
|
27
|
+
for (let i = 0; i < argv.length; i++) {
|
|
28
|
+
const t = argv[i];
|
|
29
|
+
if (!t.startsWith('--')) { out._.push(t); continue; }
|
|
30
|
+
const eq = t.indexOf('=');
|
|
31
|
+
const key = eq > 0 ? t.slice(2, eq) : t.slice(2);
|
|
32
|
+
if (key === 'json' || key === 'help') out[key] = true;
|
|
33
|
+
else if (eq > 0) out[key] = t.slice(eq + 1);
|
|
34
|
+
else if (argv[i + 1] !== undefined) out[key] = argv[++i];
|
|
35
|
+
else out[key] = '';
|
|
36
|
+
}
|
|
37
|
+
return out;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const word = (r) => (r.state === 'read' ? `read ${r.read_at}, ${r.items.length} item${r.items.length === 1 ? '' : 's'}` : `${r.state}${r.why ? ' (' + r.why + ')' : ''}, ${r.read_at}`);
|
|
41
|
+
|
|
42
|
+
function run(argv, { say = console.log, env = process.env, stateDir, cwd = process.cwd(), now = () => new Date() } = {}) {
|
|
43
|
+
const a = parseArgs(argv.slice(1));
|
|
44
|
+
const sub = a._[0];
|
|
45
|
+
const out = (o, line) => { if (a.json) say(JSON.stringify(o)); else say(line); };
|
|
46
|
+
if (!sub || a.help || sub === 'help') { USAGE.forEach((l) => say(l)); return sub || a.help ? 0 : 2; }
|
|
47
|
+
if (!COMMANDS.source.includes(sub)) { say(`✗ pmos source ${sub} is not a command`); USAGE.forEach((l) => say(l)); return 2; }
|
|
48
|
+
const dir = stateDir || stateRoot.defaultRoot({ env });
|
|
49
|
+
|
|
50
|
+
if (sub === 'save') {
|
|
51
|
+
if (!a.file) { out({ ok: false, error: '--file <reads.json> is required' }, '✗ --file <reads.json> is required'); return 2; }
|
|
52
|
+
let raw;
|
|
53
|
+
try { raw = JSON.parse(fs.readFileSync(path.resolve(cwd, String(a.file)), 'utf8')); }
|
|
54
|
+
catch (e) { out({ ok: false, error: `could not read ${a.file}: ${e.message}` }, `✗ could not read ${a.file}: ${String(e.message).slice(0, 160)}`); return 1; }
|
|
55
|
+
const v = SR.validate(raw);
|
|
56
|
+
if (!v.ok) { out({ ok: false, error: v.error }, `✗ refused: ${v.error}. Nothing was saved.`); return 1; }
|
|
57
|
+
const t = now();
|
|
58
|
+
const saved = v.reads.map((r) => SR.write(dir, r, t));
|
|
59
|
+
out({ ok: true, read_at: t.toISOString(), saved: saved.map((r) => ({ source: r.source, state: r.state, items: (r.items || []).length })) },
|
|
60
|
+
`saved ${saved.length} source read${saved.length === 1 ? '' : 's'} at ${t.toISOString()}: ${saved.map((r) => r.source + ' ' + (r.state === 'read' ? (r.items || []).length + ' items' : r.state)).join(', ')}`);
|
|
61
|
+
return 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const stored = SR.all(dir);
|
|
65
|
+
if (sub === 'status') {
|
|
66
|
+
const rows = SR.SOURCES.map((s) => ({ source: s, read_at: stored[s] ? stored[s].read_at : null, state: stored[s] ? stored[s].state : 'never', why: stored[s] && stored[s].why ? stored[s].why : undefined }));
|
|
67
|
+
if (a.json) { say(JSON.stringify({ ok: true, sources: rows })); return 0; }
|
|
68
|
+
for (const r of rows) say(`${r.source.padEnd(11)} ${stored[r.source] ? word(stored[r.source]) : 'not read yet'}`);
|
|
69
|
+
return 0;
|
|
70
|
+
}
|
|
71
|
+
// show
|
|
72
|
+
const one = a._[1];
|
|
73
|
+
if (one && !SR.SOURCES.includes(one)) { out({ ok: false, error: `source must be one of ${SR.SOURCES.join(', ')}` }, `✗ source must be one of ${SR.SOURCES.join(', ')}`); return 2; }
|
|
74
|
+
const pick = one ? (stored[one] ? { [one]: stored[one] } : {}) : stored;
|
|
75
|
+
if (a.json) { say(JSON.stringify({ ok: true, reads: pick })); return 0; }
|
|
76
|
+
if (!Object.keys(pick).length) { say(one ? `${one} is not read yet` : 'no source is read yet. The sources-read skill reads them.'); return 0; }
|
|
77
|
+
for (const r of Object.values(pick)) {
|
|
78
|
+
say(`${r.source} · ${word(r)}`);
|
|
79
|
+
for (const x of r.items || []) say(` - ${x.title}${x.where ? ' · ' + x.where : ''}${x.who ? ' · ' + x.who : ''}${x.mention ? ' · mentions you' : ''}${x.link ? ' · ' + x.link : ''}`);
|
|
80
|
+
for (const d of r.digests || []) say(` digest ${d.name}: ${(d.decisions || []).length} decisions, ${(d.open || []).length} open`);
|
|
81
|
+
}
|
|
82
|
+
return 0;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
module.exports = { run, COMMANDS, USAGE };
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* source-reads.js — the stored read of each tool the Briefing uses (initiative briefing-source-flow, slice 1).
|
|
3
|
+
*
|
|
4
|
+
* validate(raw) → { ok: true, reads: [read] } | { ok: false, error } what `pmos source save` checks
|
|
5
|
+
* write(runtimeDir, read, now) → the stored record (read_at stamped here, never by the session)
|
|
6
|
+
* read(runtimeDir, source) → the record or null
|
|
7
|
+
* all(runtimeDir) → { <source>: record }
|
|
8
|
+
* summary(runtimeDir, { on }) → { as_of_ms, read: [source], missing: [{ source, state, why }] } the Sources row
|
|
9
|
+
* SOURCES · STATES · LIMITS
|
|
10
|
+
*
|
|
11
|
+
* THE RULE (PM, 2026-10-21). A source is raw data. Derived content (the brief, insights, reports) never reads a tool: it reads
|
|
12
|
+
* these stored reads, and it is built again only after they are fresh. So a read holds what the tool says (who, where, what is
|
|
13
|
+
* asked, the link) and no judgment: no priority, no confidence, no verb, no suggested answer. Those belong to the brief.
|
|
14
|
+
*
|
|
15
|
+
* A read is refused whole, with the reason, when a field is past its limit or the wrong kind. It is never repaired. Every text
|
|
16
|
+
* field is short, so a message body cannot be stored by accident. Calendar, My work and Jira status keep their own stores
|
|
17
|
+
* (calendar-import, my-work, tracker/jira) and are not read here.
|
|
18
|
+
*
|
|
19
|
+
* FILES. <runtime>/source-reads/<source>.json, one per source, replaced whole by each read (atomic rename). They stay in the
|
|
20
|
+
* per-user runtime folder and never go into a repository: they hold paraphrases of messages.
|
|
21
|
+
*/
|
|
22
|
+
const fs = require('fs');
|
|
23
|
+
const path = require('path');
|
|
24
|
+
const crypto = require('crypto');
|
|
25
|
+
|
|
26
|
+
const SOURCES = Object.freeze(['mail', 'slack', 'wispr', 'jira', 'confluence', 'github', 'drive', 'figma', 'website', 'web']);
|
|
27
|
+
const STATES = Object.freeze(['read', 'not-reached', 'off']);
|
|
28
|
+
const LIMITS = Object.freeze({ items: 60, digests: 30, places: 200, thread: 4, lines: 5, title: 140, short: 120, about: 480, ask: 240, text: 280, why: 200, link: 500 });
|
|
29
|
+
const INI_RE = /^[a-z0-9][a-z0-9._-]*$/i;
|
|
30
|
+
const ITEM_ID_RE = /^[0-9a-f]{12}$/;
|
|
31
|
+
|
|
32
|
+
const isObj = (v) => v && typeof v === 'object' && !Array.isArray(v);
|
|
33
|
+
const flat = (s) => String(s).replace(/\s+/g, ' ').trim();
|
|
34
|
+
|
|
35
|
+
/** A short text field: absent is fine, a string within `n` is kept, anything else refuses the read. */
|
|
36
|
+
function txt(v, n, what) {
|
|
37
|
+
if (v === undefined || v === null || v === '') return { ok: true };
|
|
38
|
+
if (typeof v !== 'string') return { ok: false, error: `${what} must be text` };
|
|
39
|
+
const s = flat(v);
|
|
40
|
+
if (s.length > n) return { ok: false, error: `${what} is ${s.length} characters, the limit is ${n}: write it in your own words, shorter` };
|
|
41
|
+
return { ok: true, v: s || undefined };
|
|
42
|
+
}
|
|
43
|
+
function link(v, what) {
|
|
44
|
+
if (v === undefined || v === null || v === '') return { ok: true };
|
|
45
|
+
const s = String(v);
|
|
46
|
+
let u = null; try { u = new URL(s); } catch { /* checked below */ }
|
|
47
|
+
if (!u || !/^https?:$/.test(u.protocol) || s.length > LIMITS.link) return { ok: false, error: `${what} must be an http or https link of at most ${LIMITS.link} characters` };
|
|
48
|
+
return { ok: true, v: s };
|
|
49
|
+
}
|
|
50
|
+
function lines(v, max, n, what) {
|
|
51
|
+
if (v === undefined) return { ok: true };
|
|
52
|
+
if (!Array.isArray(v) || v.length > max) return { ok: false, error: `${what} must be a list of at most ${max}` };
|
|
53
|
+
const out = [];
|
|
54
|
+
for (const [i, x] of v.entries()) { const r = txt(x, n, `${what} ${i + 1}`); if (!r.ok) return r; if (r.v) out.push(r.v); }
|
|
55
|
+
return { ok: true, v: out.length ? out : undefined };
|
|
56
|
+
}
|
|
57
|
+
/** Copy the checked fields of `src` named in `spec` ([key, check]) into an object; the first refusal wins. */
|
|
58
|
+
function fields(src, spec) {
|
|
59
|
+
const out = {};
|
|
60
|
+
for (const [k, check] of spec) {
|
|
61
|
+
const r = check(src[k], k);
|
|
62
|
+
if (!r.ok) return r;
|
|
63
|
+
if (r.v !== undefined) out[k] = r.v;
|
|
64
|
+
}
|
|
65
|
+
return { ok: true, v: out };
|
|
66
|
+
}
|
|
67
|
+
const T = (n) => (v, k) => txt(v, n, k);
|
|
68
|
+
const B = (v, k) => (v === undefined ? { ok: true } : typeof v === 'boolean' ? { ok: true, v } : { ok: false, error: `${k} must be true or false` });
|
|
69
|
+
|
|
70
|
+
function item(x, source, i) {
|
|
71
|
+
const at = `item ${i + 1} of ${source}`;
|
|
72
|
+
if (!isObj(x)) return { ok: false, error: `${at} must be an object` };
|
|
73
|
+
const r = fields(x, [['title', T(LIMITS.title)], ['link', (v) => link(v, at + ' link')], ['where', T(LIMITS.short)], ['who', T(LIMITS.short)],
|
|
74
|
+
['at', T(40)], ['about', T(LIMITS.about)], ['ask', T(LIMITS.ask)], ['due', T(40)], ['mention', B], ['reply_needed', B]]);
|
|
75
|
+
if (!r.ok) return { ok: false, error: `${at}: ${r.error}` };
|
|
76
|
+
if (!r.v.title) return { ok: false, error: `${at} has no title` };
|
|
77
|
+
if (x.initiative_id !== undefined) {
|
|
78
|
+
if (typeof x.initiative_id !== 'string' || !INI_RE.test(x.initiative_id) || x.initiative_id.length > 80) return { ok: false, error: `${at}: initiative_id must be an initiative id` };
|
|
79
|
+
r.v.initiative_id = x.initiative_id;
|
|
80
|
+
}
|
|
81
|
+
if (x.thread !== undefined) {
|
|
82
|
+
if (!Array.isArray(x.thread) || x.thread.length > LIMITS.thread) return { ok: false, error: `${at}: thread must be a list of at most ${LIMITS.thread} messages` };
|
|
83
|
+
const th = [];
|
|
84
|
+
for (const [j, m] of x.thread.entries()) {
|
|
85
|
+
if (!isObj(m)) return { ok: false, error: `${at}: thread message ${j + 1} must be an object` };
|
|
86
|
+
const q = fields(m, [['who', T(LIMITS.short)], ['at', T(40)], ['text', T(LIMITS.text)]]);
|
|
87
|
+
if (!q.ok) return { ok: false, error: `${at}: thread message ${j + 1}: ${q.error}` };
|
|
88
|
+
if (q.v.text) th.push(q.v);
|
|
89
|
+
}
|
|
90
|
+
if (th.length) r.v.thread = th;
|
|
91
|
+
}
|
|
92
|
+
// the id is the session's when it gives a valid one, else the source and the link (or the title): the same item read twice keeps its id
|
|
93
|
+
r.v.id = typeof x.id === 'string' && ITEM_ID_RE.test(x.id) ? x.id
|
|
94
|
+
: crypto.createHash('sha1').update(source + '\n' + (r.v.link || r.v.title)).digest('hex').slice(0, 12);
|
|
95
|
+
return r;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function one(x, i) {
|
|
99
|
+
const at = `read ${i + 1}`;
|
|
100
|
+
if (!isObj(x)) return { ok: false, error: `${at} must be an object` };
|
|
101
|
+
if (!SOURCES.includes(x.source)) return { ok: false, error: `${at}: source must be one of ${SOURCES.join(', ')} (calendar, My work and Jira status have their own commands)` };
|
|
102
|
+
const src = x.source;
|
|
103
|
+
if (!STATES.includes(x.state)) return { ok: false, error: `${src}: state must be one of ${STATES.join(', ')}` };
|
|
104
|
+
const out = { source: src, state: x.state };
|
|
105
|
+
const why = txt(x.why, LIMITS.why, `${src} why`); if (!why.ok) return why;
|
|
106
|
+
if (why.v) out.why = why.v;
|
|
107
|
+
if (x.state !== 'read') {
|
|
108
|
+
for (const k of ['items', 'digests', 'places']) if (Array.isArray(x[k]) && x[k].length) return { ok: false, error: `${src} is "${x.state}", so it has no ${k}` };
|
|
109
|
+
return { ok: true, v: out };
|
|
110
|
+
}
|
|
111
|
+
if (x.window !== undefined) {
|
|
112
|
+
if (!isObj(x.window) || !Date.parse(x.window.from) || !Date.parse(x.window.to)) return { ok: false, error: `${src}: window must be { from, to }, two ISO dates` };
|
|
113
|
+
out.window = { from: new Date(Date.parse(x.window.from)).toISOString(), to: new Date(Date.parse(x.window.to)).toISOString() };
|
|
114
|
+
}
|
|
115
|
+
const items = x.items === undefined ? [] : x.items;
|
|
116
|
+
if (!Array.isArray(items) || items.length > LIMITS.items) return { ok: false, error: `${src}: items must be a list of at most ${LIMITS.items}` };
|
|
117
|
+
out.items = [];
|
|
118
|
+
for (const [j, it] of items.entries()) { const r = item(it, src, j); if (!r.ok) return r; out.items.push(r.v); }
|
|
119
|
+
if (x.digests !== undefined) {
|
|
120
|
+
if (!Array.isArray(x.digests) || x.digests.length > LIMITS.digests) return { ok: false, error: `${src}: digests must be a list of at most ${LIMITS.digests}` };
|
|
121
|
+
out.digests = [];
|
|
122
|
+
for (const [j, d] of x.digests.entries()) {
|
|
123
|
+
if (!isObj(d)) return { ok: false, error: `${src}: digest ${j + 1} must be an object` };
|
|
124
|
+
const r = fields(d, [['name', T(LIMITS.short)], ['link', (v) => link(v, `${src} digest ${j + 1} link`)],
|
|
125
|
+
['decisions', (v, k) => lines(v, LIMITS.lines, LIMITS.title, k)], ['open', (v, k) => lines(v, LIMITS.lines, LIMITS.title, k)]]);
|
|
126
|
+
if (!r.ok) return { ok: false, error: `${src} digest ${j + 1}: ${r.error}` };
|
|
127
|
+
if (!r.v.name) return { ok: false, error: `${src} digest ${j + 1} has no name` };
|
|
128
|
+
out.digests.push(r.v);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (x.places !== undefined) {
|
|
132
|
+
if (!Array.isArray(x.places) || x.places.length > LIMITS.places) return { ok: false, error: `${src}: places must be a list of at most ${LIMITS.places}` };
|
|
133
|
+
out.places = [];
|
|
134
|
+
for (const [j, p] of x.places.entries()) {
|
|
135
|
+
if (!isObj(p)) return { ok: false, error: `${src}: place ${j + 1} must be an object` };
|
|
136
|
+
const r = fields(p, [['name', T(LIMITS.short)], ['link', (v) => link(v, `${src} place ${j + 1} link`)]]);
|
|
137
|
+
if (!r.ok) return { ok: false, error: `${src} place ${j + 1}: ${r.error}` };
|
|
138
|
+
if (r.v.name) out.places.push(r.v);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return { ok: true, v: out };
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** { reads: [read, …] } or one read. Refused whole on the first bad field, so a save is never half-kept. */
|
|
145
|
+
function validate(raw) {
|
|
146
|
+
if (!isObj(raw)) return { ok: false, error: 'the file must hold { "reads": [ … ] }' };
|
|
147
|
+
const list = Array.isArray(raw.reads) ? raw.reads : raw.source ? [raw] : null;
|
|
148
|
+
if (!list || !list.length) return { ok: false, error: 'the file must hold { "reads": [ … ] } with at least one read' };
|
|
149
|
+
const seen = new Set(); const reads = [];
|
|
150
|
+
for (const [i, x] of list.entries()) {
|
|
151
|
+
const r = one(x, i);
|
|
152
|
+
if (!r.ok) return r;
|
|
153
|
+
if (seen.has(r.v.source)) return { ok: false, error: `${r.v.source} is read twice in one file` };
|
|
154
|
+
seen.add(r.v.source); reads.push(r.v);
|
|
155
|
+
}
|
|
156
|
+
return { ok: true, reads };
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const dirOf = (runtimeDir) => path.join(runtimeDir, 'source-reads');
|
|
160
|
+
const fileOf = (runtimeDir, source) => path.join(dirOf(runtimeDir), source + '.json');
|
|
161
|
+
|
|
162
|
+
function write(runtimeDir, r, now = new Date()) {
|
|
163
|
+
const rec = { ...r, read_at: now.toISOString() };
|
|
164
|
+
const f = fileOf(runtimeDir, r.source);
|
|
165
|
+
fs.mkdirSync(path.dirname(f), { recursive: true });
|
|
166
|
+
const tmp = `${f}.${process.pid}.tmp`;
|
|
167
|
+
fs.writeFileSync(tmp, JSON.stringify(rec) + '\n');
|
|
168
|
+
fs.renameSync(tmp, f);
|
|
169
|
+
return rec;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function read(runtimeDir, source) {
|
|
173
|
+
if (!runtimeDir || !SOURCES.includes(source)) return null;
|
|
174
|
+
try { const r = JSON.parse(fs.readFileSync(fileOf(runtimeDir, source), 'utf8')); return r && r.source === source && r.read_at ? r : null; } catch { return null; }
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function all(runtimeDir) {
|
|
178
|
+
const out = {};
|
|
179
|
+
for (const s of SOURCES) { const r = read(runtimeDir, s); if (r) out[s] = r; }
|
|
180
|
+
return out;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** The Sources row: the oldest read among the sources that are on (so the row never looks fresher than its stalest part),
|
|
184
|
+
* which were read, and which were not and why. `on` lists the sources the PM switched on; none given = every stored one. */
|
|
185
|
+
function summary(runtimeDir, { on } = {}) {
|
|
186
|
+
const stored = all(runtimeDir);
|
|
187
|
+
const want = Array.isArray(on) ? on.filter((s) => SOURCES.includes(s)) : Object.keys(stored);
|
|
188
|
+
const readList = []; const missing = []; let oldest = 0;
|
|
189
|
+
for (const s of want) {
|
|
190
|
+
const r = stored[s];
|
|
191
|
+
if (!r) { missing.push({ source: s, state: 'never', why: 'not read yet' }); continue; }
|
|
192
|
+
const t = Date.parse(r.read_at) || 0;
|
|
193
|
+
if (t && (!oldest || t < oldest)) oldest = t;
|
|
194
|
+
if (r.state === 'read') readList.push(s);
|
|
195
|
+
else missing.push({ source: s, state: r.state, why: r.why || (r.state === 'off' ? 'off' : 'not reached') });
|
|
196
|
+
}
|
|
197
|
+
return { as_of_ms: missing.some((m) => m.state === 'never') ? 0 : oldest, read: readList, missing };
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
module.exports = { SOURCES, STATES, LIMITS, validate, write, read, all, summary, fileOf };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.364.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.364.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -63,11 +63,11 @@ const saved = async () => { const j = await (await fetch(BASE + '/api/insights-p
|
|
|
63
63
|
const open = async (sel) => { if (sel === '#pdNew' || sel === '#repNew') await p.click('#listNew'); await p.click(sel); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on') && !!document.querySelector('#oMain .stu'))); await sleep(300); };
|
|
64
64
|
const shut = async () => { for (let i = 0; i < 2 && await p.evaluate(() => document.querySelector('#dlg').classList.contains('on')); i++) { await p.keyboard.press('Escape'); await sleep(150); } };
|
|
65
65
|
|
|
66
|
-
/* O0: the rail's
|
|
66
|
+
/* O0: Chat is the rail's middle place and goes to the Chat page (premium-chat-page); the Studio opens from the page's own buttons */
|
|
67
67
|
ok('O0 the bar has no chat button; Chat is the rail\'s middle place (premium-chat-rail)', await p.evaluate(() => !document.querySelector('#crAsk') && !!document.querySelector('.rail [data-go="chat"] svg')));
|
|
68
|
-
await
|
|
69
|
-
ok('O0b Chat
|
|
70
|
-
await
|
|
68
|
+
await p.click('.rail [data-go="chat"]'); await until(() => p.evaluate(() => /premium-chat\.html/.test(location.pathname) && document.querySelector('#dlg').classList.contains('on')), 10000);
|
|
69
|
+
ok('O0b Chat goes to the Chat page, on the PM\'s own chat', await p.evaluate(() => document.querySelector('#dTitle').textContent === 'Chat'), p.url());
|
|
70
|
+
await p.goBack(); await until(() => p.evaluate(() => !!document.querySelector('#listRows .dmr')), 20000);
|
|
71
71
|
/* O: New dashboard opens the Studio */
|
|
72
72
|
await open('#pdNew');
|
|
73
73
|
const o = await p.evaluate(() => ({ eye: document.querySelector('#dEye').textContent, full: document.querySelector('#dlg').classList.contains('full'), lib: [...document.querySelectorAll('#stLb .stli b')].map((b) => b.textContent), agent: getComputedStyle(document.querySelector('#askF')).display === 'none', own: !!document.querySelector('#stF') }));
|
|
@@ -78,9 +78,9 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
|
78
78
|
s = await st(page);
|
|
79
79
|
ok('R9 the initiative link brings the open initiative tab forward, not a second one', s.on === INI && s.ids.length === 2, JSON.stringify(s));
|
|
80
80
|
await page.keyboard.press('Escape'); await until(() => page.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
|
|
81
|
-
await page.
|
|
81
|
+
await page.locator('#cIniTk .tkq', { hasText: 'UAT with five partners' }).click(); await until(() => page.evaluate(() => document.querySelector('#dlg').classList.contains('on')));
|
|
82
82
|
s = await st(page);
|
|
83
|
-
ok('R9 a new dialog starts with no extra tab; the
|
|
83
|
+
ok('R9 a new dialog starts with no extra tab; the task\'s own dialog offers Open the initiative', s.ids.length === 0 && await page.evaluate(() => /Open the initiative/.test((document.querySelector('#oMain [data-vwopen]') || {}).textContent || '')), JSON.stringify(s));
|
|
84
84
|
ok('R9 no page error', S.errors.length === 0, S.errors.join(' | '));
|
|
85
85
|
await ctx.close();
|
|
86
86
|
}
|
|
@@ -88,7 +88,7 @@ process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
|
88
88
|
/* R6 a route that is reading, then fails */
|
|
89
89
|
{
|
|
90
90
|
const { page, ctx, S } = await open({ answer: (n) => (n === 1 ? { status: 200, body: { ok: true, state: 'ready', model: MODEL } } : n <= 3 ? { status: 202, body: { ok: true, state: 'reading' } } : { status: 500, body: { ok: false, state: 'error', error: 'the board could not be read' } }) });
|
|
91
|
-
await page.
|
|
91
|
+
await page.locator('#cIniTk .tkq').first().click(); await until(() => page.evaluate(() => document.querySelector('#dlg').classList.contains('on')));
|
|
92
92
|
await page.evaluate(() => window.__premiumWorkItem.openWorkItem({ kind: 'initiative', id: 'other-two', title: 'Other' }));
|
|
93
93
|
ok('R6 while the route reads, the tab says so', await until(async () => /Reading the initiative/.test(await paneTxt(page, 'item:ini:other-two')), 3000));
|
|
94
94
|
ok('R6 a failed read says what failed and invents nothing', await until(async () => /could not be read: the board could not be read/.test(await paneTxt(page, 'item:ini:other-two')), 8000), await paneTxt(page, 'item:ini:other-two'));
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { openWorkItem, recordPress } from './premium-vw-item.js';
|
|
7
7
|
import { pmPost } from './http.js';
|
|
8
8
|
import { openBacklog } from './premium-vw-backlog.js';
|
|
9
|
-
import { $, $$, esc, openDlg, closeDlg, toast, loadThread, onScroll, wireRail, logHtml, turnA, ptx, pillOf, CHECK, AI, store, crumbHtml, wireCrumb, kv, H, openAddDoc, setPageGaps } from './premium-shell.js';
|
|
9
|
+
import { $, $$, esc, openDlg, closeDlg, toast, loadThread, onScroll, wireRail, logHtml, turnA, ptx, pillOf, CHECK, AI, store, crumbHtml, wireCrumb, chatAbout, kv, H, openAddDoc, setPageGaps } from './premium-shell.js';
|
|
10
10
|
import { issueBody } from './premium-doc-edit.js';
|
|
11
11
|
import { mountDocSheet } from './premium-doc-sheet.js';
|
|
12
12
|
import * as MT from './premium-metric-tiles.js';
|
|
@@ -33,8 +33,9 @@ function drawHead() {
|
|
|
33
33
|
if (!crumbed) {
|
|
34
34
|
crumbed = true;
|
|
35
35
|
const boards = M.board.switcher || [];
|
|
36
|
-
$('#crumbHost').innerHTML = crumbHtml({ page: 'Board', board: M.board.name || 'Board', boards
|
|
37
|
-
wireCrumb({ boards, board: M.board.id, goBoard: (ws, id) => location.assign('/premium-board.html?ws=' + encodeURIComponent(ws) + '&board=' + encodeURIComponent(id))
|
|
36
|
+
$('#crumbHost').innerHTML = crumbHtml({ page: 'Board', board: M.board.name || 'Board', boards });
|
|
37
|
+
wireCrumb({ boards, board: M.board.id, goBoard: (ws, id) => location.assign('/premium-board.html?ws=' + encodeURIComponent(ws) + '&board=' + encodeURIComponent(id)) });
|
|
38
|
+
chatAbout('board:this-board', M.board.name ? 'the ' + M.board.name + ' board' : 'this board');
|
|
38
39
|
}
|
|
39
40
|
$('#snap').textContent = M.header.text;
|
|
40
41
|
setPageGaps(((M.header && M.header.missing) || []).length);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* pm/premium-chat.js — the Chat page (initiative premium-chat-page). The rail's middle place: the session list, the conversation and the viewer
|
|
2
|
+
* as a page of their own. ?about=<key>&label=<name> is the page the PM came from (the rail's Chat carries it); without it, the PM's own chat. */
|
|
3
|
+
import { wireRail, openChatPage } from './premium-shell.js';
|
|
4
|
+
|
|
5
|
+
wireRail('chat');
|
|
6
|
+
const q = new URLSearchParams(location.search);
|
|
7
|
+
// a conversation key as the ask route takes it (lib/briefing-premium-agent.js KEY_RE); anything else is the PM's own chat
|
|
8
|
+
const about = /^(decision|blocked|waited|src|ev|work|board|init|doc|ins):[A-Za-z0-9][A-Za-z0-9._:-]{0,100}$/.test(q.get('about') || '') ? q.get('about') : null;
|
|
9
|
+
openChatPage(about || 'chat:main', about ? (q.get('label') || '').slice(0, 80) : '');
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* premium-board-actions, pm/premium-acts.js): move to the next stage or back, hold, cancel, archive, resume, reopen and restore, each with Undo. Nothing here issues a document. */
|
|
7
7
|
import { pmPost } from './http.js';
|
|
8
8
|
import { mountDocSheet } from './premium-doc-sheet.js';
|
|
9
|
-
import { $, $$, esc, openDlg, closeDlg, setMode, toast, loadThread, onScroll, wireRail, logHtml, turnA, ptx, pillOf, kv, H2, CHECK, CHEV, crumbHtml, wireCrumb, AI, openAddDoc, setPageGaps } from './premium-shell.js';
|
|
9
|
+
import { $, $$, esc, openDlg, closeDlg, setMode, toast, loadThread, onScroll, wireRail, logHtml, turnA, ptx, pillOf, kv, H2, CHECK, CHEV, crumbHtml, wireCrumb, chatAbout, AI, openAddDoc, setPageGaps } from './premium-shell.js';
|
|
10
10
|
import { barHtml, onBar, closeMenu } from './premium-acts.js';
|
|
11
11
|
import { openWorkItem, recordPress } from './premium-vw-item.js';
|
|
12
12
|
import { openTicket } from './premium-vw-jira.js';
|
|
@@ -256,11 +256,12 @@ let crumbed = false;
|
|
|
256
256
|
function draw() {
|
|
257
257
|
if (!crumbed) {
|
|
258
258
|
crumbed = true;
|
|
259
|
-
$('#crumbHost').innerHTML = crumbHtml({ board: M.board.name || 'Board', boards: M.boards, ini: M.crumbTitle, siblings: M.siblings
|
|
259
|
+
$('#crumbHost').innerHTML = crumbHtml({ board: M.board.name || 'Board', boards: M.boards, ini: M.crumbTitle, siblings: M.siblings });
|
|
260
260
|
const q = (id) => '?id=' + encodeURIComponent(id) + (M.board.ws ? '&ws=' + encodeURIComponent(M.board.ws) + '&board=' + encodeURIComponent(M.board.id) : '');
|
|
261
261
|
wireCrumb({ boards: M.boards, board: M.board.id, siblings: M.siblings, ini: M.id,
|
|
262
262
|
goBoard: (ws, id) => location.assign('/premium-board.html' + (ws ? '?ws=' + encodeURIComponent(ws) + '&board=' + encodeURIComponent(id) : '')),
|
|
263
|
-
goIni: (id) => location.assign('/premium-initiative.html' + q(id))
|
|
263
|
+
goIni: (id) => location.assign('/premium-initiative.html' + q(id)) });
|
|
264
|
+
if (M.rows[0]) chatAbout(M.rows[0].key, M.crumbTitle || M.rows[0].title);
|
|
264
265
|
}
|
|
265
266
|
$('#iH1').textContent = M.title; document.title = 'PMOS · ' + M.title;
|
|
266
267
|
$('#snap').textContent = M.header.text;
|
|
@@ -33,8 +33,8 @@ function drawHead() {
|
|
|
33
33
|
if (!crumbed) {
|
|
34
34
|
crumbed = true;
|
|
35
35
|
const boards = M.board.switcher || [];
|
|
36
|
-
$('#crumbHost').innerHTML = crumbHtml({ page: 'Insights', board: M.board.name || 'Insights', boards
|
|
37
|
-
wireCrumb({ boards, board: M.board.id, goBoard: (ws, id) => location.assign('/premium-insights.html?ws=' + encodeURIComponent(ws) + '&board=' + encodeURIComponent(id))
|
|
36
|
+
$('#crumbHost').innerHTML = crumbHtml({ page: 'Insights', board: M.board.name || 'Insights', boards });
|
|
37
|
+
wireCrumb({ boards, board: M.board.id, goBoard: (ws, id) => location.assign('/premium-insights.html?ws=' + encodeURIComponent(ws) + '&board=' + encodeURIComponent(id)) });
|
|
38
38
|
}
|
|
39
39
|
$('#snap').textContent = M.header.text;
|
|
40
40
|
setPageGaps(((M.header && M.header.missing) || []).length);
|
|
@@ -78,9 +78,11 @@ function tbTheme() {
|
|
|
78
78
|
const cur = document.documentElement.dataset.theme || 'auto';
|
|
79
79
|
$$('#tbTheme [data-th]').forEach((b) => b.setAttribute('aria-checked', String(b.dataset.th === cur)));
|
|
80
80
|
}
|
|
81
|
-
let
|
|
82
|
-
/** The rail's Chat
|
|
83
|
-
export function
|
|
81
|
+
let ABOUT = null;
|
|
82
|
+
/** The page the rail's Chat brings along (premium-chat-page): the conversation key of this page and its name. The Chat page opens that conversation. */
|
|
83
|
+
export function chatAbout(key, label) { ABOUT = key ? { key, label: label || '' } : null; }
|
|
84
|
+
/** On the Chat page the dialog is the page: it never closes, Escape does nothing, and the rail stays live. */
|
|
85
|
+
const chatPage = () => document.body.classList.contains('chatpg');
|
|
84
86
|
|
|
85
87
|
/* ── Sources: when each source was last read, and a Refresh for each (GET /api/sources, POST /api/sources/refresh, as Data freshness) ──
|
|
86
88
|
* The chip says no time: each source is read on its own schedule, so only the dialog's rows carry times. Its dot is orange when a source is
|
|
@@ -156,12 +158,18 @@ export async function openSources() {
|
|
|
156
158
|
await tbReadSrc(); draw(); poll(8);
|
|
157
159
|
}
|
|
158
160
|
|
|
159
|
-
/* ──
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
161
|
+
/* ── the Chat page (initiative premium-chat-page): the standard dialog held open as the page, beside the rail ───────────────────────────
|
|
162
|
+
* key: the conversation (the page the PM came from, or their own chat:main). The session list shows beside it on a desktop; on a phone its chip
|
|
163
|
+
* opens the list. Nothing here writes: a message goes through the same ask route as every other conversation. */
|
|
164
|
+
export function openChatPage(key, label) {
|
|
165
|
+
const say = label
|
|
166
|
+
? 'Talk to Claude about ' + label + '. It works in a real Claude Code session: it can read, change files, run commands and take slash commands.'
|
|
167
|
+
: 'Talk to Claude. It works in a real Claude Code session: it can read, change files, run commands and take slash commands. Pick another session from the list.';
|
|
168
|
+
openDlg({ eye: label ? 'Chat · ' + label : 'Chat', title: label ? 'Ask about ' + label : 'Chat', say, stream: turnA(ptx(say)), noteKey: key, pane: `<article class="paper doc"><p class="note">${esc(label ? 'This conversation is about ' + label + '. Files Claude opens show here.' : 'Files Claude opens show here.')}</p></article>`, label: label || 'Chat', sessions: true });
|
|
169
|
+
$$('.rail').forEach((x) => { x.inert = false; }); document.documentElement.style.overflow = '';
|
|
170
|
+
$('#veil').classList.remove('on');
|
|
171
|
+
$('#askIn').placeholder = label ? 'Message Claude about ' + label : 'Message Claude, or type /';
|
|
172
|
+
if (desk()) setFull(true); else setTab('chat');
|
|
165
173
|
loadThread(key);
|
|
166
174
|
}
|
|
167
175
|
tbMount(); // the top bar first: the menu holds the Settings, Sessions, Console and Search items the code below wires
|
|
@@ -217,6 +225,7 @@ $('#dOut').addEventListener('scroll', () => {
|
|
|
217
225
|
else if (p.scrollTop < 8) g.classList.remove('shrunk');
|
|
218
226
|
}, { passive: true });
|
|
219
227
|
export function closeDlg() {
|
|
228
|
+
if (chatPage()) return;
|
|
220
229
|
clearTimeout(threadTimer); S.key = null; flushPad(); railOnClose();
|
|
221
230
|
park();
|
|
222
231
|
$('#veil').classList.remove('on'); $$('.rail,main.stage,#dock').forEach((x) => { x.inert = false; });
|
|
@@ -240,7 +249,7 @@ $('#dExpand').onclick = () => setFull(!$('#dlg').classList.contains('full'));
|
|
|
240
249
|
$('#dTabs').addEventListener('click', (e) => { const b = e.target.closest('[data-t]'); if (b) setTab(b.dataset.t); });
|
|
241
250
|
addEventListener('keydown', (e) => {
|
|
242
251
|
if (e.key !== 'Escape' || !$('#dlg').classList.contains('on')) return;
|
|
243
|
-
if (document.querySelector('[data-esc-layer]')) return; // a layer open over the dialog (a viewer menu, Present) closes itself first
|
|
252
|
+
if (document.querySelector('[data-esc-layer]') || chatPage()) return; // a layer open over the dialog (a viewer menu, Present) closes itself first
|
|
244
253
|
if ($('#dlg').classList.contains('full')) { setFull(false); e.stopImmediatePropagation(); return; }
|
|
245
254
|
closeDlg();
|
|
246
255
|
}, true);
|
|
@@ -457,7 +466,7 @@ if (window.visualViewport) {
|
|
|
457
466
|
}
|
|
458
467
|
|
|
459
468
|
/* ── the rail: Briefing, My work, Board and Insights are premium pages ── */
|
|
460
|
-
const GO = { brief: '/premium.html', work: '/premium-work.html', init: '/premium-board.html', rep: '/premium-insights.html' };
|
|
469
|
+
const GO = { brief: '/premium.html', work: '/premium-work.html', chat: '/premium-chat.html', init: '/premium-board.html', rep: '/premium-insights.html' };
|
|
461
470
|
/* ── the recording chip: while a note records or is paused, every premium page says so and can stop it (initiative briefing-premium-calendar, slice 3) ───────────────
|
|
462
471
|
* It reads GET /api/notes. Only the Briefing holds a recorder; the other pages show what the server holds, and Stop there ends the meeting through POST /api/notes/stop. */
|
|
463
472
|
function mountRecChip(here) {
|
|
@@ -506,12 +515,17 @@ export function wireRail(here) {
|
|
|
506
515
|
rail.style.setProperty('--pi', String(all.indexOf(cur)));
|
|
507
516
|
const place = () => { if (cur) rail.style.setProperty('--py', (cur.offsetTop - all[0].offsetTop) + 'px'); };
|
|
508
517
|
place(); addEventListener('resize', place);
|
|
509
|
-
$$('.rail [data-go]').forEach((b) => { b.onclick = () => { if (b.dataset.go
|
|
518
|
+
$$('.rail [data-go]').forEach((b) => { b.onclick = () => { if (b.dataset.go !== here) location.assign(b.dataset.go === 'chat' ? chatHref() : GO[b.dataset.go]); }; });
|
|
519
|
+
}
|
|
520
|
+
/** The Chat page's address: the workspace the PM is in, and the page they came from as the conversation it opens (premium-chat-page). */
|
|
521
|
+
function chatHref() {
|
|
522
|
+
const q = new URLSearchParams(), ws = new URLSearchParams(location.search).get('ws');
|
|
523
|
+
if (ws) q.set('ws', ws);
|
|
524
|
+
if (ABOUT) { q.set('about', ABOUT.key); if (ABOUT.label) q.set('label', ABOUT.label); }
|
|
525
|
+
const s = q.toString(); return GO.chat + (s ? '?' + s : '');
|
|
510
526
|
}
|
|
511
|
-
/** The rail's Chat: the page's own conversation (its Sessions chip and full screen reach the other sessions); with none, the session list. */
|
|
512
|
-
function railChat() { if (PAGE_CHAT) PAGE_CHAT(); else openSessions(); }
|
|
513
527
|
|
|
514
|
-
/* ── the crumb: where you are and a menu to switch board or initiative. Its Chat moved to the rail (premium-chat-rail)
|
|
528
|
+
/* ── the crumb: where you are and a menu to switch board or initiative. Its Chat moved to the rail (premium-chat-rail) ──────────── */
|
|
515
529
|
export function crumbHtml(o) {
|
|
516
530
|
const chev = (id, label, show) => `<button id="${id}" class="cri" aria-haspopup="menu" aria-expanded="false" aria-label="${esc(label)}"${show ? '' : ' hidden'}>${CHEV}</button>`;
|
|
517
531
|
const menu = '<div id="crMenu" class="crmenu" role="menu" hidden></div>';
|
|
@@ -521,7 +535,7 @@ export function crumbHtml(o) {
|
|
|
521
535
|
: `<nav class="crumb" aria-label="Where you are">${o.page ? `<span class="crpg">${esc(o.page)}</span>` : ''}<button id="crBoard" aria-current="page" disabled>${esc(o.board)}</button>${chev('crSw', 'Switch board', o.boards && o.boards.length > 1)}${menu}</nav>`;
|
|
522
536
|
return `<div class="where">${left}</div>`;
|
|
523
537
|
}
|
|
524
|
-
/** o: { boards: [{ws,id,name}], board: id, siblings: [{id,title}], ini: id, goBoard(ws, id), goIni(id)
|
|
538
|
+
/** o: { boards: [{ws,id,name}], board: id, siblings: [{id,title}], ini: id, goBoard(ws, id), goIni(id) }. Escape and a click outside close the menu; the arrows move in it. */
|
|
525
539
|
export function wireCrumb(o) {
|
|
526
540
|
const menu = $('#crMenu'); if (!menu) return;
|
|
527
541
|
const close = () => { menu.hidden = true; $$('#crSw,#crSw2').forEach((b) => b.setAttribute('aria-expanded', 'false')); };
|
|
@@ -547,7 +561,6 @@ export function wireCrumb(o) {
|
|
|
547
561
|
if (e.key === 'Escape') { const k = menu.dataset.k === 'b' ? b1 : b2; close(); if (k) k.focus(); }
|
|
548
562
|
if (e.key === 'ArrowDown' || e.key === 'ArrowUp') { e.preventDefault(); const L = $$('button', menu), i = L.indexOf(document.activeElement); L[(i + (e.key === 'ArrowDown' ? 1 : L.length - 1)) % L.length].focus(); }
|
|
549
563
|
});
|
|
550
|
-
if (o.ask) onPageChat(o.ask);
|
|
551
564
|
}
|
|
552
565
|
|
|
553
566
|
/* ── Add a document: the dialog the Board and the initiative page share (initiative briefing-premium-adddoc) ──────────────────────────────────
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* (draft, stop, edit, post after a confirm, send back, try again), and keys and swipe on the rows. */
|
|
6
6
|
import { pmPost } from './http.js';
|
|
7
7
|
import { mdRender } from './markdown.js';
|
|
8
|
-
import { $, $$, esc, openDlg, closeDlg, setMode, toast, loadThread, onScroll, wireRail, logHtml, turnA, turnU, ptx, CHECK, RM, S, setPageGaps,
|
|
8
|
+
import { $, $$, esc, openDlg, closeDlg, setMode, toast, loadThread, onScroll, wireRail, logHtml, turnA, turnU, ptx, CHECK, RM, S, setPageGaps, chatAbout } from './premium-shell.js';
|
|
9
9
|
|
|
10
10
|
let M = null; // the model
|
|
11
11
|
let openR = null; // the row whose dialog is open
|
|
@@ -653,6 +653,6 @@ async function load() {
|
|
|
653
653
|
if (mine && dlgKind === 'item') refreshOpen(); else if (mine) drawFocusDlg();
|
|
654
654
|
}
|
|
655
655
|
setInterval(() => { if (M && M.agents && M.agents.counts.running > 0 && !document.hidden) load(); }, 15000); // an agent's state changes without a press
|
|
656
|
-
|
|
656
|
+
chatAbout('work:this-page', 'My work'); // the rail's Chat opens the Chat page on this page's conversation (premium-chat-page)
|
|
657
657
|
$('#brief').textContent = 'Reading your list.';
|
|
658
658
|
load();
|
|
@@ -2525,3 +2525,9 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
|
|
|
2525
2525
|
.pl.pchat:hover .orb{transform:translateX(-50%)}
|
|
2526
2526
|
}
|
|
2527
2527
|
@media (prefers-reduced-motion:reduce){.pchat .orb{transition:none}}
|
|
2528
|
+
|
|
2529
|
+
/* ── premium-chat-page: the Chat page is the chat dialog held open beside the rail. No veil, no close, no full-screen toggle: it is the page. ── */
|
|
2530
|
+
.chatpg .veil{display:none}
|
|
2531
|
+
.chatpg #dClose,.chatpg #dExpand,.chatpg .dlg .grab{display:none}
|
|
2532
|
+
@media (min-width:1000px){.chatpg .dlg.on{left:128px;top:16px;transform:none;width:calc(100% - 144px);height:calc(100% - 32px);max-height:none!important;border-radius:28px;padding:26px 34px 18px}}
|
|
2533
|
+
@media (max-width:999px){.chatpg .dlg.on{left:0;top:0;transform:none;width:100%;height:calc(100% - 118px - env(safe-area-inset-bottom,0px));max-height:none!important;border-radius:0 0 28px 28px;padding:16px 18px 14px}}
|
|
@@ -12,7 +12,7 @@ import { lineItems, behindOf, refreshTargets, whenRead } from './freshness-words
|
|
|
12
12
|
import { consoleReads, briefOf, needsListOf } from './premium-brief.js';
|
|
13
13
|
import { mountDocSheet } from './premium-doc-sheet.js';
|
|
14
14
|
import { momentOf, inText } from './c3-phone-model.js';
|
|
15
|
-
import { $, $$, esc, store, THEME_KEY, RM, AI, S, theme, toast, kv, H, openDlg, closeDlg, setTab, setMode, setFull, CHECK, CHEV, ptx, turnA, turnU, H1, H2, P1, UL, logHtml, loadThread, onScroll, wireRail, pvFeed, setPageGaps, sourcesHook,
|
|
15
|
+
import { $, $$, esc, store, THEME_KEY, RM, AI, S, theme, toast, kv, H, openDlg, closeDlg, setTab, setMode, setFull, CHECK, CHEV, ptx, turnA, turnU, H1, H2, P1, UL, logHtml, loadThread, onScroll, wireRail, pvFeed, setPageGaps, sourcesHook, chatAbout, pvOpenBell, ibState } from './premium-shell.js';
|
|
16
16
|
const ICON = {
|
|
17
17
|
meeting: '<rect x="4" y="5" width="16" height="15" rx="3"/><path d="M4 10h16M9 3v4M15 3v4"/>',
|
|
18
18
|
merge: '<circle cx="6" cy="6" r="2"/><circle cx="6" cy="18" r="2"/><circle cx="18" cy="9" r="2"/><path d="M6 8v8M18 11c0 4-6 3-12 5"/>',
|
|
@@ -1091,7 +1091,7 @@ async function refreshRepos() {
|
|
|
1091
1091
|
let RTIMER = null;
|
|
1092
1092
|
$('#pkw').dataset.park = 'pkPark';
|
|
1093
1093
|
sourcesHook({ html: sourcesHtml, mount: () => { const slot = $('#pkSlot'), w = $('#pkw'); if (slot && w) slot.appendChild(w); }, refresh: refreshRepos });
|
|
1094
|
-
|
|
1094
|
+
chatAbout('src:this-page', 'the Briefing');
|
|
1095
1095
|
$('#brief').textContent = 'Reading the repository.';
|
|
1096
1096
|
load();
|
|
1097
1097
|
mountFirst(); // the "Your first Briefing" card, only when the page was opened with first=<import id> (initiative premium-welcome)
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<i class="ind"></i>
|
|
16
16
|
<button class="pl" data-go="brief"><svg class="i" viewBox="0 0 24 24"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg>Briefing</button>
|
|
17
17
|
<button class="pl" data-go="work"><svg class="i" viewBox="0 0 24 24"><rect x="4" y="4" width="16" height="16" rx="3"/><path d="m8.5 12 2.5 2.5 4.5-5"/></svg>My work</button>
|
|
18
|
-
<button class="pl pchat" data-go="chat" aria-
|
|
18
|
+
<button class="pl pchat" data-go="chat" aria-label="Chat" title="Chat"><span class="orb"><svg class="i" viewBox="0 0 24 24"><path d="M4 5h16v11h-9l-5 4v-4H4z"/><path d="M12 7.6l.8 1.9 1.9.8-1.9.8-.8 1.9-.8-1.9-1.9-.8 1.9-.8z"/></svg><i class="cdot" hidden></i></span>Chat</button>
|
|
19
19
|
<button class="pl" data-go="init" aria-current="page"><svg class="i" viewBox="0 0 24 24"><path d="M12 3 3 8l9 5 9-5z"/><path d="m3 13 9 5 9-5"/></svg>Board</button>
|
|
20
20
|
<button class="pl" data-go="rep"><svg class="i" viewBox="0 0 24 24"><path d="M4 20V10M10 20V4M16 20v-8M22 20H2"/></svg>Insights</button>
|
|
21
21
|
</nav>
|