create-pmos 0.436.0 → 0.437.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +13 -13
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +12 -0
- package/workspace/guide/home.md +21 -10
- package/workspace/home-rows-test.js +188 -115
- package/workspace/lib/mention-cli.js +45 -21
- package/workspace/lib/mention-store.js +196 -27
- package/workspace/lib/news-for-you.js +8 -16
- package/workspace/lib/routes-mentions.js +7 -2
- package/workspace/lib/routes-news.js +5 -11
- package/workspace/lib/source-reads.js +1 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-briefing-depth-test.js +2 -2
- package/workspace/public/pm/cozy-home-rows.css +88 -62
- package/workspace/public/pm/cozy-news.js +8 -27
- package/workspace/public/pm/home-day.js +4 -6
- package/workspace/public/pm/home-mentions.js +327 -193
- package/workspace/skills/morning-brief.skill +2 -1
- package/workspace/skills/sources-read.skill +1 -0
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
/* mention-cli.js — `pmos mention …`: Home's Mentions from a terminal (canvas XmsDeskRefine, agreed A
|
|
3
|
-
* pmos mention list [--json]
|
|
2
|
+
/* mention-cli.js — `pmos mention …`: Home's Mentions from a terminal (canvas XmsDeskRefine, agreed A+; Mentions, calm: MnA1 to MnA6).
|
|
3
|
+
* pmos mention list [--json] the conversations: Your move (oldest first), To read, Answered this week
|
|
4
4
|
* pmos mention draft <id> --text "<reply>" | --file <path|-> [--json] change the proposed reply the Mentions Viewer shows
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* mention is
|
|
5
|
+
* pmos mention gist <id> --text "<one line>" the row's line: where the conversation stands, in Claude's words
|
|
6
|
+
* pmos mention nodraft <id> --text "<why>" Claude cannot draft this reply: why, in one line (the row says it)
|
|
7
|
+
* pmos mention stands <id> --settled "<line>"… [--open "<line>"…] "Where it stands": what is settled and what is still open
|
|
8
|
+
* pmos mention watch <id> --what "<Samuel’s tag>" --text "<the offer>" [--due <ISO>] offer to watch for a dated promise (the PM ✓ or ×)
|
|
9
|
+
* pmos mention landed <id> --text "<Samuel’s tag landed.>" the watched promise landed: the opening line says so once
|
|
10
|
+
* <id> is a conversation's id (pmos mention list prints it). Claude runs `draft` from the chat where the PM changes a reply ("Reply to
|
|
11
|
+
* Arif"), and the rest after a source read: the Viewer shows each on its next read. Every mark is one line in
|
|
12
|
+
* <runtime>/mentions/marks.jsonl with by: agent. This command posts nothing: the PM sends the reply where the mention is. */
|
|
8
13
|
const fs = require('fs');
|
|
9
14
|
const path = require('path');
|
|
10
15
|
const stateRoot = require('./state-root');
|
|
11
16
|
const store = require('./mention-store.js');
|
|
12
17
|
|
|
13
|
-
const COMMANDS = { mention: ['list', 'draft'] };
|
|
18
|
+
const COMMANDS = { mention: ['list', 'draft', 'gist', 'nodraft', 'stands', 'watch', 'landed'] };
|
|
14
19
|
const USAGE = [
|
|
15
|
-
'usage: pmos mention list|draft — Home\'s Mentions',
|
|
16
|
-
' pmos mention list
|
|
17
|
-
' pmos mention draft <id> --text "<reply>" change the proposed reply of one
|
|
20
|
+
'usage: pmos mention list|draft|gist|nodraft|stands|watch|landed — Home\'s Mentions',
|
|
21
|
+
' pmos mention list the conversations: Your move, To read, Answered this week',
|
|
22
|
+
' pmos mention draft <id> --text "<reply>" change the proposed reply of one conversation (or --file <path|->)',
|
|
23
|
+
' pmos mention gist <id> --text "<one line>" the row\'s line: where the conversation stands',
|
|
24
|
+
' pmos mention nodraft <id> --text "<why>" you cannot draft the reply: say why in one line',
|
|
25
|
+
' pmos mention stands <id> --settled "<line>" [--settled …] [--open "<line>" …] what is settled and what is open',
|
|
26
|
+
' pmos mention watch <id> --what "<Samuel’s tag>" --text "<the offer>" [--due <ISO>] offer to watch for a dated promise',
|
|
27
|
+
' pmos mention landed <id> --text "<Samuel’s tag landed.>" the watched promise landed',
|
|
18
28
|
' every command: [--json]',
|
|
19
29
|
'This command never posts. You send the reply where the mention is.',
|
|
20
30
|
];
|
|
@@ -26,6 +36,7 @@ function parseArgs(argv) {
|
|
|
26
36
|
if (!t.startsWith('--')) { out._.push(t); continue; }
|
|
27
37
|
const key = t.slice(2);
|
|
28
38
|
if (key === 'json' || key === 'help') out[key] = true;
|
|
39
|
+
else if ((key === 'settled' || key === 'open') && argv[i + 1] !== undefined) (out[key] = out[key] || []).push(argv[++i]);
|
|
29
40
|
else if (argv[i + 1] !== undefined) out[key] = argv[++i];
|
|
30
41
|
else out[key] = '';
|
|
31
42
|
}
|
|
@@ -40,30 +51,43 @@ function run(argv, { say = console.log, env = process.env, stateDir, cwd = proce
|
|
|
40
51
|
if (!COMMANDS.mention.includes(sub)) { say(`✗ pmos mention ${sub} is not a command`); USAGE.forEach((l) => say(l)); return 2; }
|
|
41
52
|
const dir = stateDir || stateRoot.defaultRoot({ env });
|
|
42
53
|
|
|
54
|
+
const answer = () => require('./routes-mentions.js').answer(dir, { now: now().getTime(), cwd });
|
|
43
55
|
if (sub === 'list') {
|
|
44
|
-
const v =
|
|
56
|
+
const v = answer();
|
|
45
57
|
if (a.json) { say(JSON.stringify(v)); return 0; }
|
|
46
58
|
if (!v.waiting.length && !v.recent.length) { say('Nobody mentioned you in the last 7 days.'); return 0; }
|
|
59
|
+
const row = (m) => ` ${m.id} ${(m.people || [m.who]).join(', ') || m.source} · ${m.where || m.source} · ${m.messages || 1} message${(m.messages || 1) === 1 ? '' : 's'}`
|
|
60
|
+
+ (m.status ? ' · ' + m.status : '') + (m.since_reply ? ' · new since your reply' : '') + ': ' + (m.gist || '“' + (m.text || '') + '”');
|
|
47
61
|
say(v.waiting.length ? `${v.waiting.length} wait on your reply` : 'Nothing waits on you');
|
|
48
|
-
for (const m of v.waiting) say(
|
|
49
|
-
if (v.
|
|
50
|
-
for (const m of v.
|
|
62
|
+
for (const m of v.waiting) say(row(m) + `${m.since ? ' · since ' + m.since : ''}${m.draft ? ' · reply drafted' : m.nodraft ? ' · no draft: ' + m.nodraft : ''}`);
|
|
63
|
+
if (v.toread.length) say('To read');
|
|
64
|
+
for (const m of v.toread) say(row(m));
|
|
65
|
+
if (v.answered.length) say('Answered this week');
|
|
66
|
+
for (const m of v.answered) say(row(m));
|
|
51
67
|
return 0;
|
|
52
68
|
}
|
|
53
|
-
// draft
|
|
54
69
|
const id = a._[1];
|
|
55
|
-
if (!id || !/^[0-9a-f]{12}$/.test(id)) { out({ ok: false, error: 'the
|
|
70
|
+
if (!id || !/^[0-9a-f]{12}$/.test(id)) { out({ ok: false, error: 'the conversation id is 12 hex characters (pmos mention list shows it)' }, '✗ the conversation id is 12 hex characters (pmos mention list shows it)'); return 2; }
|
|
56
71
|
let text = a.text;
|
|
57
|
-
if (text === undefined && a.file !== undefined) {
|
|
72
|
+
if (sub === 'draft' && text === undefined && a.file !== undefined) {
|
|
58
73
|
try { text = a.file === '-' ? (stdin !== undefined ? stdin : fs.readFileSync(0, 'utf8')) : fs.readFileSync(path.resolve(cwd, a.file), 'utf8'); }
|
|
59
74
|
catch (e) { out({ ok: false, error: `could not read ${a.file}: ${e.message}` }, `✗ could not read ${a.file}`); return 1; }
|
|
60
75
|
}
|
|
61
|
-
if (typeof text !== 'string' || !text.trim()) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
76
|
+
if (sub !== 'stands' && (typeof text !== 'string' || !text.trim())) {
|
|
77
|
+
const need = sub === 'draft' ? '--text "<reply>" or --file <path|->' : '--text "<one line>"';
|
|
78
|
+
out({ ok: false, error: need + ' is required' }, '✗ ' + need + ' is required'); return 2;
|
|
79
|
+
}
|
|
80
|
+
// a conversation's id, or the id of one of its mentions (an older list printed those)
|
|
81
|
+
const known = JSON.parse(JSON.stringify(answer()));
|
|
82
|
+
const conv = [...known.waiting, ...known.recent].find((m) => m.id === id || (m.members || []).includes(id));
|
|
83
|
+
if (!conv) { out({ ok: false, error: `no conversation ${id}` }, `✗ no conversation ${id}. pmos mention list shows them.`); return 1; }
|
|
84
|
+
const body = { id: conv.id, act: sub === 'watch' ? 'offer' : sub, text };
|
|
85
|
+
if (sub === 'watch') { body.what = a.what; if (a.due) body.due = a.due; }
|
|
86
|
+
if (sub === 'stands') { body.settled = a.settled || []; body.open = a.open || []; }
|
|
87
|
+
const r = store.mark(dir, body, now(), 'agent');
|
|
65
88
|
if (!r.ok) { out(r, `✗ refused: ${r.error}`); return 1; }
|
|
66
|
-
|
|
89
|
+
const SAID = { draft: 'the proposed reply', gist: 'the gist', nodraft: 'why there is no draft', stands: 'Where it stands', watch: 'the watch offer', landed: 'that the promise landed' };
|
|
90
|
+
out({ ok: true, id: conv.id }, `saved ${SAID[sub]} of ${conv.id}. The Mentions Viewer shows it${sub === 'draft' ? '; you send it where the mention is' : ''}.`);
|
|
67
91
|
return 0;
|
|
68
92
|
}
|
|
69
93
|
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
* ingestBrief(runtimeDir, brief, { me }?) a brief's mention items: they add what the brief judged (found, draft, initiative)
|
|
10
10
|
* mark(runtimeDir, { id, act, until?, task?, text?, to? }, now, by) one appended line in <runtime>/mentions/marks.jsonl; by: 'pm' | 'agent'
|
|
11
11
|
* view(runtimeDir, { now, me, missing }) → { ok, waiting, recent, count, gaps, as_of } what GET /api/mentions answers
|
|
12
|
-
* build(entries, marks, { now, me }) → { waiting, recent } the pure part of view
|
|
12
|
+
* build(entries, marks, { now, me }) → { waiting, toread, answered, recent, watching, landed } the pure part of view
|
|
13
|
+
* convKeyOf(entry) → the conversation a mention belongs to · convIdOf(entry) → its 12-hex id
|
|
13
14
|
* isMention(item, source, me) → '' | 'at' | 'dm' | 'name' how an item reaches the PM, '' when it does not
|
|
14
15
|
* ACTS · MENTION_SOURCES · VIAS · keyOf(source, link, title)
|
|
15
16
|
*
|
|
@@ -23,6 +24,15 @@
|
|
|
23
24
|
* Mark answered, Not an ask, or Make it a task. A new ask after any of these makes it wait again; its age counts from that ask.
|
|
24
25
|
* Remind me tomorrow hides it until 09:00 the next morning. Nothing here posts anywhere: PMOS never replies for the PM.
|
|
25
26
|
*
|
|
27
|
+
* ONE CONVERSATION PER THREAD (batch 16 item 12, canvas MnA1 to MnA6, MnGrill). The view groups the mentions into conversations: a Slack
|
|
28
|
+
* thread (channel + thread_ts), a Slack DM, an email thread, a Jira issue or a document. A conversation is one thread, not one person: the
|
|
29
|
+
* same person in a channel and in a DM is two conversations. Three folds come out of it: Your move (an open ask, oldest first), To read
|
|
30
|
+
* (FYIs, and a conversation that came back with a new message after the PM answered: "New since your reply") and Answered this week.
|
|
31
|
+
* The marks of a conversation are kept under its own id; the marks an older page wrote under one mention's id still count for its
|
|
32
|
+
* conversation. Claude adds what a read cannot say, as marks by: agent (`pmos mention …`): the one-line gist, why it cannot draft a reply,
|
|
33
|
+
* "Where it stands" (what is settled and what is open), and an offer to watch for a dated promise; the PM accepts or declines the watch.
|
|
34
|
+
* Bots never show.
|
|
35
|
+
*
|
|
26
36
|
* FILES (per-user runtime folder, never a repository): mentions/store.json (replaced whole, atomic rename) and mentions/marks.jsonl
|
|
27
37
|
* (append-only; the last line for an id and act wins; 'undo' takes back that id's last mark). mentions/read.jsonl (routes-mentions.js)
|
|
28
38
|
* still says which FYIs the PM opened. */
|
|
@@ -33,8 +43,12 @@ const crypto = require('crypto');
|
|
|
33
43
|
const MENTION_SOURCES = Object.freeze(['slack', 'jira', 'confluence', 'mail']);
|
|
34
44
|
const VIAS = Object.freeze(['at', 'dm', 'name']);
|
|
35
45
|
const NAME_SOURCES = new Set(['slack', 'mail']); // where a plain name, with no @, counts (Jira and Confluence mention by handle)
|
|
36
|
-
const ACTS = Object.freeze(['answered', 'notask', 'snooze', 'task', 'keep', 'drafted', 'draft', 'read', 'closed', 'undo'
|
|
37
|
-
|
|
46
|
+
const ACTS = Object.freeze(['answered', 'notask', 'snooze', 'task', 'keep', 'drafted', 'draft', 'read', 'closed', 'undo',
|
|
47
|
+
'gist', 'nodraft', 'stands', 'offer', 'watch', 'nowatch', 'landed']);
|
|
48
|
+
// what Undo never takes back: opening, a task closed by a reply, and what Claude wrote (the reply, the gist, why no draft, Where it stands,
|
|
49
|
+
// the watch offer and its landing)
|
|
50
|
+
const NOT_UNDONE = new Set(['read', 'draft', 'closed', 'gist', 'nodraft', 'stands', 'offer', 'landed']);
|
|
51
|
+
const AGENT_ACTS = new Set(['draft', 'gist', 'nodraft', 'stands', 'offer', 'landed']);
|
|
38
52
|
const DAY = 86400000;
|
|
39
53
|
const KEEP_DAYS = 14; // a mention that stopped waiting is kept this long (Last 7 days shows 7 of them)
|
|
40
54
|
const MAX_WAIT_DAYS = 365; // an ask older than this is dropped, waiting or not
|
|
@@ -90,6 +104,9 @@ function entryOf(x, source, ref, o = {}) {
|
|
|
90
104
|
at: timeOf(x.at, ref), seen: new Date(ref).toISOString(), reply_needed: x.reply_needed === true,
|
|
91
105
|
broadcast: x.broadcast === true || x.bot === true, thread,
|
|
92
106
|
};
|
|
107
|
+
if (x.bot === true) e.bot = true;
|
|
108
|
+
if (typeof x.gist === 'string' && x.gist.trim()) e.gist = clip(x.gist, 200);
|
|
109
|
+
if (typeof x.conversation === 'string' && x.conversation.trim()) e.conversation = clip(x.conversation, 200);
|
|
93
110
|
if (/^https:\/\/\S+$/i.test(String(x.link || '')) && String(x.link).length <= 500) e.link = x.link;
|
|
94
111
|
if (typeof x.initiative_id === 'string' && x.initiative_id) e.initiative = x.initiative_id;
|
|
95
112
|
if (x.replied === true) { e.replied = true; e.replied_seen = e.seen; }
|
|
@@ -197,12 +214,17 @@ function ingestBrief(rt, brief, o = {}) {
|
|
|
197
214
|
|
|
198
215
|
/* ── marks ── */
|
|
199
216
|
function mark(rt, b, now = new Date(), by = 'pm') {
|
|
217
|
+
if (b && Array.isArray(b.ids)) { // ✓✓ in To read: every conversation it shows, read at once
|
|
218
|
+
if (b.act !== 'read') return { ok: false, error: 'ids is for act read only (✓✓ marks all read)' };
|
|
219
|
+
if (!b.ids.length || b.ids.length > 300 || !b.ids.every((x) => ID_RE.test(String(x)))) return { ok: false, error: 'ids must be 1 to 300 mention ids (12 hex characters)' };
|
|
220
|
+
return { ok: true, marks: b.ids.map((id) => mark(rt, { id, act: 'read' }, now, by).mark) };
|
|
221
|
+
}
|
|
200
222
|
if (!b || !ID_RE.test(String(b.id || ''))) return { ok: false, error: 'id must be a mention id (12 hex characters)' };
|
|
201
223
|
if (!ACTS.includes(b.act)) return { ok: false, error: 'act must be one of ' + ACTS.join(', ') };
|
|
202
224
|
const line = { id: b.id, act: b.act, by: by === 'agent' ? 'agent' : 'pm', at: now.toISOString() };
|
|
203
225
|
if (b.act === 'snooze') {
|
|
204
226
|
const u = b.until ? Date.parse(b.until) : NaN;
|
|
205
|
-
line.until = Number.isFinite(u) ? new Date(u).toISOString() :
|
|
227
|
+
line.until = Number.isFinite(u) ? new Date(u).toISOString() : nextNine(now).toISOString();
|
|
206
228
|
}
|
|
207
229
|
if (b.act === 'task') {
|
|
208
230
|
if (!b.task || typeof b.task !== 'object') return { ok: false, error: 'task must say where the task is: { id, ws?, board?, initiative?, kind }' };
|
|
@@ -215,11 +237,32 @@ function mark(rt, b, now = new Date(), by = 'pm') {
|
|
|
215
237
|
line.text = b.text.trim();
|
|
216
238
|
}
|
|
217
239
|
if (b.act === 'drafted' && b.to) line.to = clip(b.to, 120);
|
|
240
|
+
if (b.act === 'gist' || b.act === 'nodraft' || b.act === 'landed' || b.act === 'offer') {
|
|
241
|
+
if (typeof b.text !== 'string' || !b.text.trim()) return { ok: false, error: 'text is required: one line, at most 200 characters' };
|
|
242
|
+
if (b.text.trim().length > 200) return { ok: false, error: 'text is over 200 characters: say it in one line' };
|
|
243
|
+
line.text = b.text.trim();
|
|
244
|
+
if (b.act === 'offer') {
|
|
245
|
+
if (typeof b.what !== 'string' || !b.what.trim()) return { ok: false, error: 'what is required: what to watch for, as the opening line says it ("Samuel’s tag")' };
|
|
246
|
+
line.what = clip(b.what, 80);
|
|
247
|
+
const d = b.due ? Date.parse(b.due) : NaN;
|
|
248
|
+
if (Number.isFinite(d)) line.due = new Date(d).toISOString();
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if (b.act === 'stands') {
|
|
252
|
+
const list = (v) => (Array.isArray(v) ? v : v == null ? [] : [v]).map((t) => (typeof t === 'string' ? t.replace(/\s+/g, ' ').trim() : '')).filter(Boolean);
|
|
253
|
+
const settled = list(b.settled), open = list(b.open);
|
|
254
|
+
if (!settled.length && !open.length) return { ok: false, error: 'stands needs settled or open: one line each, what is agreed and what is still open' };
|
|
255
|
+
if (settled.length > 5 || open.length > 5) return { ok: false, error: 'at most 5 settled and 5 open lines' };
|
|
256
|
+
if ([...settled, ...open].some((t) => t.length > 200)) return { ok: false, error: 'a line is over 200 characters: say it shorter' };
|
|
257
|
+
line.settled = settled; line.open = open;
|
|
258
|
+
}
|
|
218
259
|
fs.mkdirSync(dirOf(rt), { recursive: true });
|
|
219
260
|
fs.appendFileSync(marksFile(rt), JSON.stringify(line) + '\n');
|
|
220
261
|
return { ok: true, mark: line };
|
|
221
262
|
}
|
|
222
263
|
function nineTomorrow(now) { const d = new Date(now); d.setDate(d.getDate() + 1); d.setHours(9, 0, 0, 0); return d; }
|
|
264
|
+
/** Remind me at 09:00: today's 09:00 while it is earlier, else tomorrow's (MnA3). */
|
|
265
|
+
function nextNine(now) { const d = new Date(now); if (d.getHours() < 9) { d.setHours(9, 0, 0, 0); return d; } return nineTomorrow(now); }
|
|
223
266
|
|
|
224
267
|
/** The marks per id: the last of each act, after the undos took theirs back. Pure. */
|
|
225
268
|
function foldMarks(list) {
|
|
@@ -268,45 +311,169 @@ function judge(e, mk, now, me) {
|
|
|
268
311
|
return { ask, waiting, snoozed: !!snoozed, since, count: pending.length, last, how: ask && !pending.length ? how : '', lastMe };
|
|
269
312
|
}
|
|
270
313
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
314
|
+
/* ── conversations (batch 16 item 12) ── */
|
|
315
|
+
const subjectOf = (t) => { let x = String(t || '').trim(); for (let i = 0; i < 5 && /^(re|fwd?|aw|tr|sv)\s*:\s*/i.test(x); i++) x = x.replace(/^(re|fwd?|aw|tr|sv)\s*:\s*/i, ''); return x.toLowerCase().replace(/\s+/g, ' '); };
|
|
316
|
+
/** The conversation a mention belongs to: the read's own `conversation` when it gives one; else a Slack thread (channel + thread_ts), a
|
|
317
|
+
* Slack DM (the whole DM), an email thread (its thread id, else its subject), a Jira issue, a Confluence page; else its link; else the
|
|
318
|
+
* place and the person. Pure. */
|
|
319
|
+
function convKeyOf(e) {
|
|
320
|
+
const s = e.source, l = String(e.link || ''), w = String(e.where || '').trim().toLowerCase(), who = String(e.who || '').trim().toLowerCase();
|
|
321
|
+
if (e.conversation) return s + ':c:' + String(e.conversation).trim().toLowerCase();
|
|
322
|
+
if (s === 'slack') {
|
|
323
|
+
const a = /\/archives\/([A-Z0-9]+)(?:\/p(\d{10})(\d{6}))?/i.exec(l);
|
|
324
|
+
const th = /[?&]thread_ts=(\d+(?:\.\d+)?)/.exec(l);
|
|
325
|
+
if (a) {
|
|
326
|
+
const ch = a[1].toUpperCase();
|
|
327
|
+
if (/^D/.test(ch) || (e.via === 'dm' && !th)) return 'slack:' + ch;
|
|
328
|
+
if (th) return 'slack:' + ch + ':' + th[1];
|
|
329
|
+
return a[2] ? 'slack:' + ch + ':' + a[2] + '.' + a[3] : 'slack:' + ch;
|
|
330
|
+
}
|
|
331
|
+
if (e.via === 'dm' || DM_RE.test(w)) return 'slack:dm:' + who;
|
|
332
|
+
}
|
|
333
|
+
if (s === 'jira') { const k = /\b([A-Z][A-Z0-9]+-\d+)\b/.exec(l + ' ' + (e.where || '') + ' ' + (e.title || '')); if (k) return 'jira:' + k[1]; }
|
|
334
|
+
if (s === 'mail') {
|
|
335
|
+
const g = /#[a-z]+\/([A-Za-z0-9]{12,})/.exec(l); if (g) return 'mail:' + g[1];
|
|
336
|
+
const subj = subjectOf(e.title); if (subj) return 'mail:s:' + subj;
|
|
337
|
+
}
|
|
338
|
+
if (s === 'confluence') { const pg = /[?&]pageId=(\d+)|\/pages\/(\d+)/.exec(l); if (pg) return 'confluence:' + (pg[1] || pg[2]); }
|
|
339
|
+
if (l) return s + ':l:' + l.split('#')[0];
|
|
340
|
+
return s + ':' + w + ':' + who;
|
|
341
|
+
}
|
|
342
|
+
const convIdOf = (e) => keyOf('conversation', convKeyOf(e));
|
|
343
|
+
|
|
344
|
+
/** The marks of a conversation: its own id's and the ones an older page wrote under a member mention's id; the newest of each act wins. */
|
|
345
|
+
function marksFor(ids, mks) {
|
|
346
|
+
const o = {};
|
|
347
|
+
for (const id of ids) { const m = mks.get(id); if (!m) continue; for (const [k, v] of Object.entries(m)) if (!o[k] || T(v.at) >= T(o[k].at)) o[k] = v; }
|
|
348
|
+
return o;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/** One conversation judged: waiting or not, since when, how many asks, what covered them, and whether a message came after the cover. Pure. */
|
|
352
|
+
function judgeConv(list, mk, now, me) {
|
|
353
|
+
const askT = [], meT = [], other = [];
|
|
354
|
+
let repSeen = 0, ask = false;
|
|
355
|
+
for (const e of list) {
|
|
356
|
+
const th = e.thread || [];
|
|
357
|
+
for (const m of th) { const t = T(m.at); if (!t) continue; (isMe(m.who, me) ? meT : other).push(t); }
|
|
358
|
+
// the mention's own time; the time it was first read only when nothing in it carries a time
|
|
359
|
+
const own = T(e.at) || (th.some((m) => T(m.at)) ? 0 : T(e.first_seen) || T(e.seen));
|
|
360
|
+
if (own && !isMe(e.who, me)) other.push(own);
|
|
361
|
+
if (e.reply_needed && !e.broadcast) {
|
|
362
|
+
ask = true;
|
|
363
|
+
const by = th.filter((m) => m.at && !isMe(m.who, me) && (!e.who || !m.who || m.who === e.who)).map((m) => T(m.at)).filter(Boolean);
|
|
364
|
+
if (by.length) askT.push(...by); else if (own) askT.push(own);
|
|
365
|
+
}
|
|
366
|
+
if (e.replied) repSeen = Math.max(repSeen, T(e.replied_seen));
|
|
367
|
+
}
|
|
368
|
+
askT.sort((a, b) => a - b);
|
|
369
|
+
const lastMe = meT.length ? Math.max(...meT) : 0;
|
|
370
|
+
// the read's replied: true covers every ask the store knew when that read came
|
|
371
|
+
const before = repSeen ? askT.filter((t) => t <= repSeen + 1) : [];
|
|
372
|
+
const repliedUpto = before.length ? Math.max(...before) : 0;
|
|
373
|
+
const cover = [['replied', Math.max(lastMe, repliedUpto)], ['answered', mk.answered ? T(mk.answered.at) : 0], ['notask', mk.notask ? T(mk.notask.at) : 0], ['task', mk.task ? T(mk.task.at) : 0]];
|
|
374
|
+
const upto = Math.max(...cover.map((c) => c[1]));
|
|
375
|
+
const how = upto ? cover.filter((c) => c[1] === upto)[0][0] : '';
|
|
376
|
+
const pending = askT.filter((t) => t > upto);
|
|
377
|
+
const snoozed = mk.snooze && T(mk.snooze.until) > now && T(mk.snooze.at) >= (pending[pending.length - 1] || 0);
|
|
378
|
+
const waiting = ask && pending.length > 0 && !snoozed;
|
|
379
|
+
const lastOther = other.length ? Math.max(...other) : 0;
|
|
380
|
+
const last = Math.max(lastOther, lastMe, ...['answered', 'notask', 'task'].map((k) => (mk[k] ? T(mk[k].at) : 0)));
|
|
381
|
+
// answered, and someone wrote since without asking again: it comes back to To read, "New since your reply"
|
|
382
|
+
const sinceReply = ask && !pending.length && upto > 0 && lastOther > upto;
|
|
383
|
+
return { ask, waiting, snoozed: !!snoozed, since: pending.length ? pending[0] : 0, count: pending.length, last, lastOther, how: ask && !pending.length ? how : '', sinceReply };
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/** The newest of an entry field and a mark by Claude: { text, at } or null. */
|
|
387
|
+
function newest(list, field, atField, m) {
|
|
388
|
+
let best = null;
|
|
389
|
+
for (const e of list) if (e[field]) { const at = T(e[atField] || e.seen); if (!best || at >= best.at) best = { text: e[field], at }; }
|
|
390
|
+
if (m && (!best || T(m.at) >= best.at)) best = { text: m.text, at: T(m.at) };
|
|
391
|
+
return best;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
function convRow(id, list, j, mk, reads, now, me) {
|
|
395
|
+
const tOf = (e) => T(e.at) || T(e.first_seen) || T(e.seen);
|
|
396
|
+
const byT = list.slice().sort((a, b) => tOf(a) - tOf(b));
|
|
397
|
+
const lead = byT[byT.length - 1];
|
|
398
|
+
const asks = byT.filter((e) => e.reply_needed && !e.broadcast);
|
|
399
|
+
const askE = asks[asks.length - 1] || null;
|
|
400
|
+
// every message once, in time order: the threads, and a mention's own words when its thread does not hold them
|
|
401
|
+
const seen = new Set(), msgs = [];
|
|
402
|
+
for (const e of byT) {
|
|
403
|
+
const th = e.thread && e.thread.length ? e.thread : [{ who: e.who, at: e.at, text: e.text }];
|
|
404
|
+
for (const m of th) { if (!m || !m.text) continue; const k = (m.who || '') + '|' + (m.at || '') + '|' + m.text; if (seen.has(k)) continue; seen.add(k); msgs.push({ who: m.who || '', at: m.at || null, text: m.text, ...(isMe(m.who, me) ? { me: true } : {}) }); }
|
|
405
|
+
}
|
|
406
|
+
msgs.sort((a, b) => T(a.at) - T(b.at));
|
|
407
|
+
const people = [];
|
|
408
|
+
for (const w of [...byT.map((e) => e.who), ...msgs.map((m) => m.who)]) { const n = String(w || '').trim(); if (n && !isMe(n, me) && !people.includes(n)) people.push(n); }
|
|
409
|
+
const theirs = msgs.filter((m) => !isMe(m.who, me));
|
|
410
|
+
const latest = theirs[theirs.length - 1] || null;
|
|
411
|
+
const r = { id, members: byT.map((e) => e.id), source: lead.source, who: people[0] || lead.who, people, where: lead.where, title: lead.title || undefined,
|
|
412
|
+
text: latest ? latest.text : lead.text, ask: (askE && askE.ask) || undefined, about: lead.about || undefined, link: (askE && askE.link) || lead.link || byT.find((e) => e.link)?.link,
|
|
413
|
+
initiative: (byT.find((e) => e.initiative) || {}).initiative, waiting: j.waiting, since: j.since ? new Date(j.since).toISOString() : null,
|
|
414
|
+
last: j.last ? new Date(j.last).toISOString() : null, first: msgs.length && msgs[0].at ? msgs[0].at : (byT[0].at || null),
|
|
415
|
+
count: j.count, messages: Math.max(msgs.length, 1), fyi: !j.ask, broadcast: byT.every((e) => e.broadcast),
|
|
416
|
+
via: byT.some((e) => e.via === 'dm') ? 'dm' : lead.via || undefined, thread: msgs.length ? msgs.slice(-12) : undefined };
|
|
275
417
|
if (!j.waiting && j.how) r.status = j.how; // replied | answered | notask | task
|
|
418
|
+
if (j.sinceReply) r.since_reply = true;
|
|
276
419
|
if (mk.task) r.task = mk.task.task;
|
|
277
420
|
if (mk.closed) r.task_closed = true;
|
|
278
|
-
const
|
|
279
|
-
if (
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
if (
|
|
421
|
+
const gist = newest(byT, 'gist', 'seen', mk.gist);
|
|
422
|
+
if (gist) r.gist = gist.text;
|
|
423
|
+
const d = newest(byT, 'draft', 'draft_at', mk.draft);
|
|
424
|
+
const nd = mk.nodraft && (!d || T(mk.nodraft.at) > d.at) ? mk.nodraft.text : '';
|
|
425
|
+
if (nd) r.nodraft = nd; else if (d) r.draft = d.text;
|
|
426
|
+
for (const k of ['found', 'why', 'send_to']) { const e = [...byT].reverse().find((x) => x[k]); if (e) r[k] = e[k]; }
|
|
283
427
|
if (mk.drafted && T(mk.drafted.at) >= j.since) r.drafted = mk.drafted.to || true;
|
|
284
428
|
if (j.waiting && j.since && now - j.since >= 30 * DAY && !(mk.keep && now - T(mk.keep.at) < 30 * DAY)) r.check = true; // asks once: "Did you answer this already?"
|
|
285
|
-
|
|
429
|
+
if (mk.stands && mk.stands.settled && mk.stands.settled.length) r.stands = { settled: mk.stands.settled, open: mk.stands.open || [] };
|
|
430
|
+
// the watch: Claude offers it (✓ ×); accepted, the opening line says so until the promise lands, then once that it landed
|
|
431
|
+
const off = mk.offer || null, at = (k) => (mk[k] ? T(mk[k].at) : 0);
|
|
432
|
+
if (off && at('watch') < T(off.at) && at('nowatch') < T(off.at)) r.offer = { text: off.text, what: off.what, due: off.due || undefined };
|
|
433
|
+
if (off && at('watch') >= T(off.at) && at('watch') > at('nowatch')) {
|
|
434
|
+
if (mk.landed && at('landed') >= at('watch')) r.landed = { text: mk.landed.text, at: mk.landed.at };
|
|
435
|
+
else r.watch = { what: off.what, text: off.text, due: off.due || undefined };
|
|
436
|
+
}
|
|
437
|
+
const rd = mk.read ? T(mk.read.at) : 0;
|
|
438
|
+
r.read = (!!rd && rd >= j.lastOther) || (!j.sinceReply && byT.every((e) => reads && reads.get(e.id) === true)) || r.broadcast;
|
|
286
439
|
return r;
|
|
287
440
|
}
|
|
288
441
|
|
|
289
|
-
/** The pure view. entries: the store's mentions; marks: marks.jsonl lines; o: { now, me: [lower-case names], reads: Map id → read }.
|
|
442
|
+
/** The pure view. entries: the store's mentions; marks: marks.jsonl lines; o: { now, me: [lower-case names], reads: Map id → read }.
|
|
443
|
+
* → { waiting (Your move, oldest first), toread (newest first), answered (newest first), recent (toread + answered, newest first),
|
|
444
|
+
* watching, landed } */
|
|
290
445
|
function build(entries, marks, o = {}) {
|
|
291
446
|
const now = o.now || Date.now();
|
|
292
447
|
const me = (o.me || []).map((n) => String(n).toLowerCase());
|
|
293
448
|
const mks = foldMarks(marks);
|
|
294
449
|
const start = new Date(now); start.setHours(0, 0, 0, 0); start.setDate(start.getDate() - 6);
|
|
295
|
-
const
|
|
450
|
+
const groups = new Map();
|
|
296
451
|
for (const e of entries || []) {
|
|
297
|
-
if (!e || !ID_RE.test(String(e.id || ''))) continue;
|
|
298
|
-
const
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
452
|
+
if (!e || !ID_RE.test(String(e.id || '')) || e.bot) continue; // bots never show
|
|
453
|
+
const id = convIdOf(e);
|
|
454
|
+
if (!groups.has(id)) groups.set(id, []);
|
|
455
|
+
groups.get(id).push(e);
|
|
456
|
+
}
|
|
457
|
+
const waiting = [], toread = [], answered = [];
|
|
458
|
+
for (const [id, list] of groups) {
|
|
459
|
+
const mk = marksFor([...list.map((e) => e.id), id], mks);
|
|
460
|
+
const j = judgeConv(list, mk, now, me);
|
|
461
|
+
if (j.snoozed) continue; // Remind me at 09:00: hidden until then
|
|
462
|
+
const r = convRow(id, list, j, mk, o.reads, now, me);
|
|
302
463
|
if (j.waiting) waiting.push(r);
|
|
303
|
-
else if (j.last
|
|
464
|
+
else if (j.last < start.getTime() && !r.watch && !r.landed) continue;
|
|
465
|
+
else if (j.ask && !j.sinceReply) answered.push(r);
|
|
466
|
+
else toread.push(r);
|
|
304
467
|
}
|
|
305
468
|
// oldest first; a tie: a direct message or a ticket first, then by time
|
|
306
469
|
const direct = (r) => (r.via === 'dm' || /\bDM\b|direct/i.test(r.where || '') || r.source === 'jira' ? 0 : 1);
|
|
307
470
|
waiting.sort((a, b) => T(a.since) - T(b.since) || direct(a) - direct(b) || T(a.last) - T(b.last));
|
|
308
|
-
|
|
309
|
-
|
|
471
|
+
const nf = (a, b) => T(b.last) - T(a.last);
|
|
472
|
+
toread.sort(nf); answered.sort(nf);
|
|
473
|
+
const all = [...waiting, ...toread, ...answered];
|
|
474
|
+
return { waiting, toread, answered, recent: [...toread, ...answered].sort(nf),
|
|
475
|
+
watching: all.filter((r) => r.watch).map((r) => ({ id: r.id, who: r.who, what: r.watch.what, due: r.watch.due })),
|
|
476
|
+
landed: all.filter((r) => r.landed && now - T(r.landed.at) < 7 * DAY).map((r) => ({ id: r.id, who: r.who, text: r.landed.text, at: r.landed.at })) };
|
|
310
477
|
}
|
|
311
478
|
|
|
312
479
|
/** Drop what nobody needs: stopped waiting and quiet for KEEP_DAYS, or older than MAX_WAIT_DAYS. Keeps at most MAX. */
|
|
@@ -329,7 +496,7 @@ function view(rt, o = {}) {
|
|
|
329
496
|
if (o.brief) { try { ingestBrief(rt, o.brief, { me: o.me }); } catch { /* the same */ } }
|
|
330
497
|
const reads = new Map();
|
|
331
498
|
for (const l of lines(readsFile(rt))) if (l && ID_RE.test(String(l.id || '')) && typeof l.read === 'boolean') reads.set(l.id, l.read);
|
|
332
|
-
const
|
|
499
|
+
const B = build(Object.values(load(rt)), lines(marksFile(rt)), { now, me: o.me, reads });
|
|
333
500
|
// honest gaps, said once at the end: a mention source not reached, and a check that has not run today
|
|
334
501
|
const gaps = [];
|
|
335
502
|
for (const m of o.missing || []) if (MENTION_SOURCES.includes(m.source) && m.state !== 'off') gaps.push({ kind: 'source', source: m.source, state: m.state });
|
|
@@ -337,7 +504,9 @@ function view(rt, o = {}) {
|
|
|
337
504
|
const as_of = readAt.length ? new Date(Math.max(...readAt)).toISOString() : null;
|
|
338
505
|
const day0 = new Date(now); day0.setHours(0, 0, 0, 0);
|
|
339
506
|
if (as_of && T(as_of) < day0.getTime()) gaps.push({ kind: 'stale', upto: as_of });
|
|
340
|
-
|
|
507
|
+
// the sources a read reached, so the opening line can say "Nothing waits on you in Slack or Jira" when one is missing (MnA6)
|
|
508
|
+
const sources = Object.values(o.reads || {}).filter((r) => r && MENTION_SOURCES.includes(r.source) && r.state === 'read').map((r) => r.source);
|
|
509
|
+
return { ok: true, ...B, count: B.waiting.length, gaps, as_of, sources, now: new Date(now).toISOString() };
|
|
341
510
|
}
|
|
342
511
|
|
|
343
|
-
module.exports = { MENTION_SOURCES, ACTS, VIAS, keyOf, isMention, namesMe, timeOf, entryOf, briefExtras, merge, ingestRead, ingestBrief, mark, foldMarks, judge, build, prune, view, nineTomorrow, _files: { storeFile, marksFile } };
|
|
512
|
+
module.exports = { MENTION_SOURCES, ACTS, AGENT_ACTS, VIAS, keyOf, convKeyOf, convIdOf, judgeConv, nextNine, isMention, namesMe, timeOf, entryOf, briefExtras, merge, ingestRead, ingestBrief, mark, foldMarks, judge, build, prune, view, nineTomorrow, _files: { storeFile, marksFile } };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/* news-for-you.js — New for you, which replaces the Inbox (initiative premium-uncovered-features, E2; canvas EvInbox, HmAround).
|
|
3
3
|
*
|
|
4
|
-
* build({ inbox,
|
|
4
|
+
* build({ inbox, work, seen }) → { count, groups: [{ key, label, items }] } PURE
|
|
5
5
|
* readSeen(runtimeDir) → Set of ids · appendSeen(runtimeDir, ids, now) · badSeen(body) → null | the reason
|
|
6
6
|
*
|
|
7
|
-
* New for you holds items for the PM's information only, in
|
|
8
|
-
* mentions someone named the PM (today's brief, GET /api/brief-page mentions): unread, and not already a next step (in_needs)
|
|
7
|
+
* New for you holds items for the PM's information only, in two groups (EvInbox):
|
|
9
8
|
* given a task given to the PM: an open Work item that came from a source (Jira, the work breakdown), not one the PM typed
|
|
10
9
|
* finished what the agents finished while the PM was away: the new items of the agent inbox (GET /api/inbox items)
|
|
11
|
-
* An item leaves once it is seen: its id is in <runtime>/news-seen.jsonl. A
|
|
12
|
-
*
|
|
10
|
+
* An item leaves once it is seen: its id is in <runtime>/news-seen.jsonl. A passed review or a proposal is its initiative's next step, so it
|
|
11
|
+
* is never only here: the inbox item is the news that it finished, and the next step stays on Home. Mentions owns every mention (batch 16
|
|
12
|
+
* item 12, "Mentions, calm"): New for you shows none, so a mention is said once.
|
|
13
13
|
* Every word comes from the record. Nothing here decides, replies or sends anything. */
|
|
14
14
|
const fs = require('fs');
|
|
15
15
|
const path = require('path');
|
|
@@ -22,13 +22,6 @@ const srcName = (s) => SRC[s] || (s ? String(s)[0].toUpperCase() + String(s).sli
|
|
|
22
22
|
const FIN = { 'work-draft': 'Draft ready', 'work-stopped': 'Agent stopped', proposal: 'Proposal ready', draft: 'Draft ready', 'goal-waiting': 'Goal needs you', 'goal-done': 'Goal finished', 'goal-stopped': 'Goal stopped' };
|
|
23
23
|
const at = (x) => { const t = Date.parse(x || ''); return Number.isFinite(t) ? t : null; };
|
|
24
24
|
|
|
25
|
-
function mentionItems(list, seen) {
|
|
26
|
-
return (Array.isArray(list) ? list : []).filter((m) => m && m.id && !m.read && !m.in_needs && !seen.has('men:' + m.id)).map((m) => ({
|
|
27
|
-
id: 'men:' + m.id, kind: 'mention', mid: m.id, who: clip(m.who || srcName(m.source) || 'Someone', 80), source: m.source || '', where: clip(m.where || '', 80),
|
|
28
|
-
title: clip((m.who || srcName(m.source) || 'Someone') + ' mentioned you' + (m.where ? ' in ' + m.where : ''), 160), text: clip(m.text, 280),
|
|
29
|
-
at: at(m.at), link: m.link || null, initiative: m.initiative || null, asks: !!m.reply,
|
|
30
|
-
}));
|
|
31
|
-
}
|
|
32
25
|
/** The open Work items that came from a source, from GET /api/pm-items' answer (its five lists). */
|
|
33
26
|
function givenItems(v, seen) {
|
|
34
27
|
const w = (v && v.work) || {}, out = [], had = new Set();
|
|
@@ -51,15 +44,14 @@ function finishedItems(inbox, seen) {
|
|
|
51
44
|
}));
|
|
52
45
|
}
|
|
53
46
|
|
|
54
|
-
/** The groups, newest first in each; an empty group is left out. inbox: GET /api/inbox;
|
|
55
|
-
function build({ inbox = null,
|
|
47
|
+
/** The groups, newest first in each; an empty group is left out. inbox: GET /api/inbox; work: GET /api/pm-items. */
|
|
48
|
+
function build({ inbox = null, work = null, seen = new Set() } = {}) {
|
|
56
49
|
const by = (a, b) => (b.at || 0) - (a.at || 0);
|
|
57
50
|
const groups = [
|
|
58
|
-
{ key: 'mentions', label: 'Mentions', items: mentionItems(mentions, seen).sort(by) },
|
|
59
51
|
{ key: 'given', label: 'Given to you', items: givenItems(work, seen).sort(by) },
|
|
60
52
|
{ key: 'finished', label: 'Finished while you were away', items: finishedItems(inbox, seen).sort(by) },
|
|
61
53
|
].filter((g) => g.items.length);
|
|
62
|
-
return { count: groups.reduce((n, g) => n + g.items.length, 0), groups, read: {
|
|
54
|
+
return { count: groups.reduce((n, g) => n + g.items.length, 0), groups, read: { inbox: !!(inbox && inbox.ok !== false), work: !!(work && work.ok !== false) } };
|
|
63
55
|
}
|
|
64
56
|
|
|
65
57
|
function readSeen(runtimeDir) {
|
|
@@ -3,8 +3,12 @@
|
|
|
3
3
|
*
|
|
4
4
|
* GET /api/mentions[?now=ISO] → { ok, waiting, recent, count, gaps, as_of, now } lib/mention-store.js view: every ask that waits
|
|
5
5
|
* on the PM (any age, oldest first) and the last 7 days of what does not wait (newest first)
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* GET /api/mentions answers conversations (batch 16 item 12): waiting (Your move), toread, answered, recent (toread +
|
|
7
|
+
* answered), watching, landed, sources (the mention sources a read reached)
|
|
8
|
+
* POST /api/mentions/act { id, act, until?, task?, to? } → { ok, mark } act: answered | notask | snooze | task | keep | drafted | closed |
|
|
9
|
+
* read | watch | nowatch | undo (undo takes back the id's last mark, so every one-tap act has its
|
|
10
|
+
* Undo). { ids, act: 'read' } marks many read at once (✓✓). What Claude writes (draft, gist,
|
|
11
|
+
* nodraft, stands, offer, landed) is `pmos mention …` only, never a page press.
|
|
8
12
|
* POST /api/mentions/read { id, read } → { ok } the PM opened an FYI (read: false undoes it); one line in <runtime>/mentions/read.jsonl
|
|
9
13
|
*
|
|
10
14
|
* The writes are the page press only (pm-guard requirePagePress). `pmos mention draft` is how Claude changes a proposed reply from a chat
|
|
@@ -77,6 +81,7 @@ module.exports = {
|
|
|
77
81
|
if (!g.ok) { ctx.json(res, { ok: false, error: g.error }, g.status); return true; }
|
|
78
82
|
if (!ctx.runtimeDir) { ctx.json(res, { ok: false, error: 'no runtime folder' }, 500); return true; }
|
|
79
83
|
if (p === '/api/mentions/act') {
|
|
84
|
+
if (store.AGENT_ACTS.has(b.act)) { ctx.json(res, { ok: false, error: b.act + ' is what Claude writes: pmos mention ' + (b.act === 'offer' ? 'watch' : b.act) }, 400); return true; }
|
|
80
85
|
const r = store.mark(ctx.runtimeDir, b, new Date(), 'pm');
|
|
81
86
|
ctx.json(res, r, r.ok ? 200 : 400);
|
|
82
87
|
return true;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/* routes-news.js — New for you (initiative premium-uncovered-features, E2; lib/news-for-you.js).
|
|
3
3
|
*
|
|
4
|
-
* GET /api/news-for-you → { ok, count, groups, read } the FYI items not seen yet:
|
|
4
|
+
* GET /api/news-for-you → { ok, count, groups, read } the FYI items not seen yet: tasks given to you, finished work (Mentions
|
|
5
|
+
* owns every mention, batch 16 item 12)
|
|
5
6
|
* POST /api/news-for-you/seen { ids } → { ok } one line in <runtime>/news-seen.jsonl; the agent inbox's own ids also go to its seen file,
|
|
6
7
|
* so its count agrees. A page press only (pm-guard requirePagePress).
|
|
7
8
|
*
|
|
8
|
-
* The read asks the routes the pages already read, answered by their own handlers: GET /api/inbox
|
|
9
|
-
* GET /api/pm-items (the Work lists). A route that cannot be read gives no items and says so in `read`. Nothing here sends anything. */
|
|
9
|
+
* The read asks the routes the pages already read, answered by their own handlers: GET /api/inbox and GET /api/pm-items (the Work lists). A route that cannot be read gives no items and says so in `read`. Nothing here sends anything. */
|
|
10
10
|
const guard = require('./pm-guard.js');
|
|
11
11
|
const News = require('./news-for-you.js');
|
|
12
12
|
|
|
@@ -40,17 +40,11 @@ module.exports = {
|
|
|
40
40
|
}
|
|
41
41
|
if (p !== '/api/news-for-you') return false;
|
|
42
42
|
if (req.method !== 'GET') { ctx.json(res, { ok: false, error: 'GET only' }, 405); return true; }
|
|
43
|
-
const
|
|
44
|
-
const [inbox, brief, work] = await Promise.all([
|
|
43
|
+
const [inbox, work] = await Promise.all([
|
|
45
44
|
ask('./routes-inbox.js', req, ctx, '/api/inbox'),
|
|
46
|
-
ask('./routes-brief-page.js', req, ctx, '/api/brief-page' + (ws ? '?ws=' + encodeURIComponent(ws) : '')),
|
|
47
45
|
ask('./routes-pm-items.js', req, ctx, '/api/pm-items'),
|
|
48
46
|
]);
|
|
49
|
-
const out = News.build({
|
|
50
|
-
inbox, mentions: brief && brief.ok !== false ? brief.mentions : null, work: work && work.ok !== false ? work : null,
|
|
51
|
-
seen: ctx.runtimeDir ? News.readSeen(ctx.runtimeDir) : new Set(),
|
|
52
|
-
});
|
|
53
|
-
out.read.mentions = !!(brief && brief.ok !== false); // no brief for today is read too: it has no mentions
|
|
47
|
+
const out = News.build({ inbox, work: work && work.ok !== false ? work : null, seen: ctx.runtimeDir ? News.readSeen(ctx.runtimeDir) : new Set() });
|
|
54
48
|
ctx.json(res, { ok: true, ...out });
|
|
55
49
|
return true;
|
|
56
50
|
},
|
|
@@ -72,7 +72,7 @@ function item(x, source, i) {
|
|
|
72
72
|
if (!isObj(x)) return { ok: false, error: `${at} must be an object` };
|
|
73
73
|
const r = fields(x, [['title', T(LIMITS.title)], ['link', (v) => link(v, at + ' link')], ['where', T(LIMITS.short)], ['who', T(LIMITS.short)],
|
|
74
74
|
['at', T(40)], ['about', T(LIMITS.about)], ['ask', T(LIMITS.ask)], ['due', T(40)], ['mention', B], ['reply_needed', B],
|
|
75
|
-
['replied', B], ['broadcast', B]]);
|
|
75
|
+
['replied', B], ['broadcast', B], ['bot', B], ['gist', T(200)], ['conversation', T(200)]]);
|
|
76
76
|
if (!r.ok) return { ok: false, error: `${at}: ${r.error}` };
|
|
77
77
|
if (!r.v.title) return { ok: false, error: `${at} has no title` };
|
|
78
78
|
// how a mention reaches the PM: an @handle, a Slack direct message, or the PM's name with no @ (mention-store.js isMention)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.437.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.437.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
/* premium-briefing-depth-test.js — Around you (initiative premium-briefing-depth; planning/prd/premium-briefing-depth-prd.md R1 to R9).
|
|
4
4
|
* Re-pointed by premium-agreed-design: the Briefing card and its dialogs are gone. Re-pointed again by premium-uncovered-features (canvas
|
|
5
|
-
* HmAround): Around you is gone too. New for you (cozy-news.js) holds the
|
|
5
|
+
* HmAround): Around you is gone too. New for you (cozy-news.js) holds the digests (Mentions owns the mentions, batch 16 item 12); the old views (home-around.js) still open,
|
|
6
6
|
* each with Back to New for you. Re-pointed again by feedback batch 16 item 5 (canvas FmAudit, FmA3Settings): New for you opens from the
|
|
7
7
|
* New for you fold of Your day and its "Where the rest went" rows and meetings ring are gone, so this suite opens the views by their key;
|
|
8
8
|
* data freshness is Settings › Connectors.
|
|
@@ -122,7 +122,7 @@ const GANTT = [
|
|
|
122
122
|
/* R: New for you, in place of the card */
|
|
123
123
|
const R0 = await p.evaluate(() => ({ chrome: [...document.querySelectorAll('#czViewer .ev-news [data-ev-rest], #czViewer .ev-news .ev-two, #czViewer .ev-news .ev-foot, #czViewer .ev-news .ar-prep')].length, list: !!document.querySelector('#aroundBody, #aroundCap'), text: document.querySelector('#czViewer').textContent }));
|
|
124
124
|
ok('R1 New for you draws its items only: no Where the rest went, no legend, no Not here note, no meetings ring, no Around you list (FmAudit)', R0.chrome === 0 && !R0.list && !/Where the rest went|Not here, so nothing shows twice/.test(R0.text), JSON.stringify(R0).slice(0, 300));
|
|
125
|
-
ok('R3
|
|
125
|
+
ok('R3 no mention is a row of New for you: Mentions owns every mention (batch 16 item 12, Mentions, calm)', !/Dana/.test(R0.text) && !/Mentions/.test(R0.text), R0.text.slice(0, 300));
|
|
126
126
|
ok('R8 opening New for you wrote nothing', posts.length === 0, JSON.stringify(posts));
|
|
127
127
|
ok('R9 New for you is drawn to its design: no Waiting for design marker', !/Waiting for design/.test(R0.text));
|
|
128
128
|
await shot('card-1280-light');
|