create-pmos 0.591.0 → 0.593.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 +27 -27
- package/payload/KIT-VERSION +2 -2
- 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/payload/state/log.md +1 -1
- package/workspace/changelog.json +26 -0
- package/workspace/guide/agent-capabilities.md +24 -12
- package/workspace/guide/cli.md +2 -2
- package/workspace/lib/autonomy.js +3 -0
- package/workspace/lib/idle-lab.js +17 -5
- package/workspace/lib/lab-cli.js +8 -6
- package/workspace/lib/live-round.js +351 -68
- package/workspace/lib/proposals.js +46 -2
- package/workspace/lib/proto-runtime.js +104 -0
- package/workspace/lib/routes-briefing-premium.js +33 -16
- package/workspace/lib/routes-lab.js +73 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-home.css +8 -0
- package/workspace/public/pm/cozy-lab.js +15 -7
- package/workspace/public/pm/cozy-proto.css +143 -0
- package/workspace/public/pm/cozy-proto.js +474 -0
- package/workspace/public/pm/home-app.js +2 -0
- package/workspace/public/pm/home-chat.js +39 -5
- package/workspace/server.js +2 -0
|
@@ -50,6 +50,22 @@ const PANE = '<svg aria-hidden="true" width="18" height="18" viewBox="0 0 24 24"
|
|
|
50
50
|
const INTERRUPT = /^\[Request interrupted by user/;
|
|
51
51
|
const POLL = 2000, IDLE_POLL = 9000;
|
|
52
52
|
|
|
53
|
+
/* Prototype by chatting (pm/cozy-proto.js): the element the PM pointed at and "Continue from version n" go before the words as marks
|
|
54
|
+
* ("[On: Screen list · screen-list]", "[From version 2]", lib/live-round.js marksOf); a bubble shows them as chips. A reply that starts
|
|
55
|
+
* "Version n:" shows a Version n tag; a tap shows that version in the Viewer. */
|
|
56
|
+
const MARK_RE = /^\s*\[(On: ([^\]·]{1,80}?)(?: · [A-Za-z0-9_-]{1,60})?|From version (\d{1,3}))\]\s*/;
|
|
57
|
+
const PT = 'M5 3l14 7-6 2-2 6z';
|
|
58
|
+
function marksHtml(text) {
|
|
59
|
+
let t = String(text || ''), chips = '', m;
|
|
60
|
+
while ((m = MARK_RE.exec(t))) { chips += `<span class="hm-mark">${m[2] ? SVG(PT, 12) + esc(m[2]) : 'From version ' + esc(m[3])}</span>`; t = t.slice(m[0].length); }
|
|
61
|
+
return (chips ? `<span class="hm-marks">${chips}</span>` : '') + (t ? userHtml(t) : '');
|
|
62
|
+
}
|
|
63
|
+
const VER_RE = /^\s*\**Version (\d{1,3})\**\s*[:·—-]\s*/;
|
|
64
|
+
function verHtml(text) {
|
|
65
|
+
const m = VER_RE.exec(text);
|
|
66
|
+
return m ? `<button type="button" class="hm-ver" data-hm-ver="${m[1]}" aria-label="Show version ${m[1]} in the Viewer">Version ${m[1]}</button>${mdHtml(text.slice(m[0].length))}` : mdHtml(text);
|
|
67
|
+
}
|
|
68
|
+
|
|
53
69
|
export function avHtml(role, size = 28, cls = '') {
|
|
54
70
|
const k = (role && role.initial) || 'P';
|
|
55
71
|
return `<span class="hm-av t-${tintOf(k)} s${size}${k.length > 1 ? ' two' : ''}${cls ? ' ' + cls : ''}" aria-hidden="true">${k}</span>`;
|
|
@@ -136,7 +152,7 @@ export function mountChat(el, host) {
|
|
|
136
152
|
if (it.t === 'user') {
|
|
137
153
|
if (INTERRUPT.test(it.text)) return '<p class="hm-stopped">Stopped</p>';
|
|
138
154
|
const a = splitFiles(shownUser(it.text));
|
|
139
|
-
return `<div class="hm-u"><div class="hm-bub">${filesHtml(a.files)}${a.text ?
|
|
155
|
+
return `<div class="hm-u"><div class="hm-bub">${filesHtml(a.files)}${a.text ? marksHtml(a.text) : ''}</div>${it.at ? `<span class="hm-you">You · ${esc(hm(it.at))}</span>` : ''}</div>`;
|
|
140
156
|
}
|
|
141
157
|
if (it.t === 'worked') {
|
|
142
158
|
const id = 'w' + i, on = C.open.has(id);
|
|
@@ -154,7 +170,7 @@ export function mountChat(el, host) {
|
|
|
154
170
|
// a run that stopped: the divider sits where it finished, over Claude's last message, and the fix sits under it (canvas XcbOptions, Routine)
|
|
155
171
|
const stopAt = R.stop && i === R.lastAgent;
|
|
156
172
|
const av = last && isClaude(R.role) ? adlerAvHtml(asking || ak.block ? 'needs-you' : stopAt ? 'honest' : running() ? 'thinking' : 'handled') : avHtml(R.role);
|
|
157
|
-
return (stopAt ? dividerHtml({ tone: R.stop.tone, text: R.stop.text }) : '') + `<div class="hm-a${asking ? ' ask' : ''}">${av}<div class="hm-ab"><p class="hm-who">${esc(R.role.name)} <span>${esc(hm(it.at))}</span></p>${rp.text ?
|
|
173
|
+
return (stopAt ? dividerHtml({ tone: R.stop.tone, text: R.stop.text }) : '') + `<div class="hm-a${asking ? ' ask' : ''}">${av}<div class="hm-ab"><p class="hm-who">${esc(R.role.name)} <span>${esc(hm(it.at))}</span></p>${rp.text ? verHtml(rp.text) : ''}${srcHtml(sr.src)}${goalBlockHtml(go.block, go)}${reportChipHtml(rp.block, it.mi)}${R.chips(it.mi)}`
|
|
158
174
|
+ (asking ? '' : `<div class="hm-tools" role="group" aria-label="Message actions"><button type="button" data-hm-copy="${i}">Copy</button>${last && !running() && !(stopAt && R.stop.actions.length) ? `<button type="button" data-hm-retry>Retry</button>` : ''}<button type="button" data-hm-wi="${i}">Make a work-item</button></div>`) + '</div></div>'
|
|
159
175
|
+ (stopAt && R.stop.actions.length ? `<div class="hm-fix" role="group" aria-label="What to do next">${R.stop.actions.map((a, k) => iconBtn({ icon: a.icon, label: a.label, attr: a.data, pri: k === 0 })).join('')}</div>` : '')
|
|
160
176
|
+ blockAskHtml(ak.block, it, R);
|
|
@@ -228,7 +244,7 @@ export function mountChat(el, host) {
|
|
|
228
244
|
}
|
|
229
245
|
function pendHtml() {
|
|
230
246
|
settlePend();
|
|
231
|
-
return C.pend.map((p) => `<div class="hm-u hm-pend${p.sent ? '' : ' sending'}"><div class="hm-bub">${filesHtml(p.files)}${p.text ?
|
|
247
|
+
return C.pend.map((p) => `<div class="hm-u hm-pend${p.sent ? '' : ' sending'}"><div class="hm-bub">${filesHtml(p.files)}${p.text ? marksHtml(p.text) : ''}</div>`
|
|
232
248
|
+ `<span class="hm-you" role="status">${p.sent ? 'You · ' + esc(hm(p.at)) : 'Sending…'}</span></div>`).join('');
|
|
233
249
|
}
|
|
234
250
|
// A loose chat that reads like one initiative gets one quiet chip at its top: "Looks like <initiative> · Link it ×" (XvALinkSuggest).
|
|
@@ -457,7 +473,7 @@ export function mountChat(el, host) {
|
|
|
457
473
|
+ `<div class="hm-tb">${add}`
|
|
458
474
|
+ to + wait + scope + `<span class="sp"></span>${host.viewerClosed() ? '<span class="hm-key">Enter sends · Shift+Enter for a new line</span>' : ''}`
|
|
459
475
|
+ `${NPU.undoHtml()}${mic}<button type="submit" class="hm-send" aria-label="Send" title="Send">${SVG(UP, 18)}</button></div>`
|
|
460
|
-
+ filesRow()
|
|
476
|
+
+ marksRow() + filesRow()
|
|
461
477
|
+ '</form>';
|
|
462
478
|
if (foot.__h !== html) {
|
|
463
479
|
const focused = document.activeElement && document.activeElement.id === 'hmIn';
|
|
@@ -470,6 +486,12 @@ export function mountChat(el, host) {
|
|
|
470
486
|
const filesRow = () => (C.files.length ? `<div class="hm-files" id="hmFiles">${C.files.map((f, i) => `<span class="hm-att${f.state === 'saving' ? ' saving' : ''}">`
|
|
471
487
|
+ (f.url ? `<img class="hm-ath" src="${esc(f.url)}" alt="">` : '') + `<b>${esc(f.name)}</b><em>${f.state === 'saving' ? 'Saving…' : f.note ? 'Note' : esc(sizeText(f.size || 0))}</em>`
|
|
472
488
|
+ `<button type="button" data-hm-unfile="${i}" aria-label="Remove ${esc(f.name)}">×</button></span>`).join('')}</div>` : '');
|
|
489
|
+
const marksRow = () => {
|
|
490
|
+
const k = C.mark || {}, x = (w, label) => `<button type="button" data-hm-unmark="${w}" aria-label="Remove ${esc(label)}">×</button>`;
|
|
491
|
+
const a = k.point ? `<span class="hm-att hm-markc">${SVG(PT, 12)}<b>${esc(k.point.label || k.point.el)}</b>${x('point', k.point.label || k.point.el)}</span>` : '';
|
|
492
|
+
const b = k.from ? `<span class="hm-att hm-markc"><b>From version ${esc(k.from)}</b>${x('from', 'from version ' + k.from)}</span>` : '';
|
|
493
|
+
return a || b ? `<div class="hm-files hm-marksr">${a}${b}</div>` : '';
|
|
494
|
+
};
|
|
473
495
|
const grow = (ta) => { ta.rows = 1; while (ta.rows < 9 && ta.scrollHeight > ta.clientHeight + 1) ta.rows += 1; }; // the box grows with its text, up to 9 lines (rows, not geometry)
|
|
474
496
|
|
|
475
497
|
/* ── writing ── */
|
|
@@ -477,6 +499,10 @@ export function mountChat(el, host) {
|
|
|
477
499
|
const t = C.t; text = String(text || '').trim();
|
|
478
500
|
if (!t || (!text && !C.files.length) || C.sending) return false;
|
|
479
501
|
if (t.key && C.files.some((f) => f.state === 'saving')) { host.toast('A file is still being saved. Send again in a moment.'); return false; }
|
|
502
|
+
// the canvas's marks go before the words (lib/live-round.js marksOf reads them), then they are used up
|
|
503
|
+
const mk = C.mark || {};
|
|
504
|
+
if (text && (mk.point || mk.from)) text = (mk.from ? `[From version ${mk.from}] ` : '') + (mk.point ? `[On: ${String(mk.point.label || mk.point.el).replace(/[\]·]/g, ' ').trim()}${mk.point.el ? ' · ' + mk.point.el : ''}] ` : '') + text;
|
|
505
|
+
if (text) C.mark = null;
|
|
480
506
|
C.sending = true;
|
|
481
507
|
let r;
|
|
482
508
|
const was = running();
|
|
@@ -549,6 +575,8 @@ export function mountChat(el, host) {
|
|
|
549
575
|
const ic = b.closest('.hm-icard'), card = C.t && C.t.intro && C.t.intro.card;
|
|
550
576
|
if (ic && card && card.press) { if (await card.press(b)) draw(); return; }
|
|
551
577
|
if ('hmMic' in d) { mic(); return; }
|
|
578
|
+
if (d.hmVer && C.t && C.t.ini) { import('./cozy-proto.js').then((M) => M.openVersion({ ws: C.t.ws, ini: C.t.ini, n: Number(d.hmVer) })).catch(() => {}); return; }
|
|
579
|
+
if (d.hmUnmark) { if (C.mark) C.mark[d.hmUnmark] = null; drawFoot({ role: role() }); return; }
|
|
552
580
|
if (d.utSpeak) { speakPress(d.utSpeak); return; }
|
|
553
581
|
if ('hmAdd' in d) { C.addOpen = !C.addOpen; drawFoot({ role: role() }); const f = C.addOpen && foot.querySelector('.hm-addm [role=menuitem]'); if (f) f.focus(); return; }
|
|
554
582
|
if (C.addOpen && b.closest('.hm-addm')) { C.addOpen = false; drawFoot({ role: role() }); } // a press in the + menu closes it, then does its part
|
|
@@ -691,6 +719,12 @@ export function mountChat(el, host) {
|
|
|
691
719
|
C.files.push({ name: f.name, size: f.size, state: 'saved', saved: f.saved, path: f.path, note: !!f.note }); drawFoot({ role: role() });
|
|
692
720
|
});
|
|
693
721
|
function openNotesHere(id) { notesLib().then((M) => M.openNotes(id)); }
|
|
722
|
+
// the canvas beside an initiative's chat (pm/cozy-proto.js): Point puts the element in the box, Continue from version n marks the next
|
|
723
|
+
// message, Send to PMOS and Make this change send a comment as the next change
|
|
724
|
+
const mine = (e) => C.t && C.t.ini && e.detail && e.detail.ini === C.t.ini;
|
|
725
|
+
window.addEventListener('pmos:point', (e) => { if (!mine(e)) return; C.mark = { ...(C.mark || {}), point: e.detail.el || e.detail.label ? { el: e.detail.el || '', label: e.detail.label || '' } : null }; drawFoot({ role: role() }); const ta = foot.querySelector('textarea'); if (ta && C.mark.point) ta.focus(); });
|
|
726
|
+
window.addEventListener('pmos:from', (e) => { if (!mine(e)) return; C.mark = { ...(C.mark || {}), from: Number(e.detail.n) || null }; drawFoot({ role: role() }); const ta = foot.querySelector('textarea'); if (ta) ta.focus(); });
|
|
727
|
+
window.addEventListener('pmos:say', (e) => { if (!mine(e) || !e.detail.text) return; send(String(e.detail.text)); });
|
|
694
728
|
el.addEventListener('change', (e) => { if (e.target.id === 'hmFile') { upload([...e.target.files]); e.target.value = ''; } });
|
|
695
729
|
// a pasted file, or one dropped on the conversation, is attached like a picked one
|
|
696
730
|
el.addEventListener('paste', (e) => { if (e.target.id !== 'hmIn' || !C.t || !C.t.key) return; const fs = e.clipboardData ? [...e.clipboardData.files] : []; if (!fs.length) return; e.preventDefault(); upload(fs); });
|
|
@@ -703,7 +737,7 @@ export function mountChat(el, host) {
|
|
|
703
737
|
if (notesM) notesM.then((M) => setTimeout(() => M.syncNotes(), 0)); // the Notes open in the Viewer belonged to the conversation before
|
|
704
738
|
const same = C.t && t && C.t.key === t.key && C.t.sid === t.sid;
|
|
705
739
|
C.t = t;
|
|
706
|
-
if (!same) { NPU.open(); C.addOpen = false; C.th = null; C.conv = null; C.show = 12; C.open = new Set(); C.files = []; C.marked = null; C.touched = null; C.picked = {}; C.pend = []; C.plOpen = false; C.plAll = false; C.seenAt = t.key ? host.seen(t.key) : null; put(log, introHtml(t.intro)); put(pl, ''); pl.hidden = true; C.jump = true; peek(null); }
|
|
740
|
+
if (!same) { C.mark = null; NPU.open(); C.addOpen = false; C.th = null; C.conv = null; C.show = 12; C.open = new Set(); C.files = []; C.marked = null; C.touched = null; C.picked = {}; C.pend = []; C.plOpen = false; C.plAll = false; C.seenAt = t.key ? host.seen(t.key) : null; put(log, introHtml(t.intro)); put(pl, ''); pl.hidden = true; C.jump = true; peek(null); }
|
|
707
741
|
draw(); read();
|
|
708
742
|
},
|
|
709
743
|
refresh() { if (C.t) draw(); },
|
package/workspace/server.js
CHANGED
|
@@ -3460,6 +3460,8 @@ const liveRound = require('./lib/live-round.js').install({
|
|
|
3460
3460
|
writePaths: spec.writePaths, addDirs: spec.addDirs, autoDelete: undefined, onDone: spec.onDone }),
|
|
3461
3461
|
stop: (s) => { if (s && s.child) stopHeadless(s); },
|
|
3462
3462
|
artefact: (dir, line, by) => { const AF = require('./lib/artefacts.js'); return AF.set(AF.file(dir), line, { by }); },
|
|
3463
|
+
// the chat explains the change (initiative live-round-iterative): a line typed into the initiative's chat session, when one is open
|
|
3464
|
+
tell: (ws, ini, text) => { const id = require('./lib/briefing-premium-agent.js').chatSessionOf(STATE, 'init:' + ini); return id ? sendToSession(id, text) : false; },
|
|
3463
3465
|
warn: (what, e) => warnWriteFail(what, e),
|
|
3464
3466
|
});
|
|
3465
3467
|
// live round before a meeting (lib/live-round-meeting.js, initiative live-round-meeting): step 2 of the queue. A meeting in the next hour
|