create-pmos 0.796.0 → 0.797.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.
@@ -42,7 +42,8 @@ import { canDictate, dictate } from './home-dictate.js';
42
42
  import { adler } from './cozy-adler.js';
43
43
  import { snapOf, turnEnded } from './chat-turn-end.js'; // a finished turn re-reads what the Viewer shows (batch 25 item 3)
44
44
  import { nextPromptUi } from './next-prompt-ui.js'; // the suggested next prompt and the Sharper card above the box (batch 26 item 2)
45
- import { cardsUi } from './chat-cards.js'; // ask-cards-and-pickers: the rows an answer names, live, and a picker (canvas A2Cards, A2Ask)
45
+ import { cardsUi } from './chat-cards.js';
46
+ import { a2uiUi } from './a2ui-view.js'; // a2ui-inbound-render: another agent's A2UI v1.0 surface, drawn with PMOS's own parts; a press goes back as words // ask-cards-and-pickers: the rows an answer names, live, and a picker (canvas A2Cards, A2Ask)
46
47
  import { runAction, routeOf } from './action-run.js';
47
48
  import { tellCards } from './card-log.js'; // each answer's card list and each press to the local use log (card catalog rule 9, A511)
48
49
  /* The views a chat opens go in the Viewer: on a page with no dialog the old viewer's views draw in the cozy card (premium-viewer.js). */
@@ -90,7 +91,8 @@ export function mountChat(el, host) {
90
91
  const C = { t: null, th: null, conv: null, timer: null, show: 12, plOpen: false, plAll: false, open: new Set(), seq: 0, sending: false, files: [], seenAt: null, lastKey: null, picked: {}, pend: [], auto: { key: null, ctx: new Set(), rep: null, goal: null }, slashAt: 0 };
91
92
  const CU = cardsUi({ pmGet: (u) => host.pmGet(u), pmPost: (u, b) => host.pmPost(u, b), toast: (t) => host.toast(t), redraw: () => draw(), runAction, routeOf, tellCards,
92
93
  ws: () => (C.t && C.t.ws) || new URLSearchParams(location.search).get('ws') || '' });
93
- window.addEventListener('pmos:action', (e) => CU.onAction(e.detail)); // a row the chat shows follows a press or a chat write elsewhere
94
+ window.addEventListener('pmos:action', (e) => CU.onAction(e.detail));
95
+ const AU = a2uiUi({ send: (t) => send(t), redraw: () => draw() }); // a row the chat shows follows a press or a chat write elsewhere
94
96
  el.innerHTML = `<button type="button" class="hm-reopen" id="hmReopen" aria-label="Open the Viewer" title="Open the Viewer" hidden>${PANE}</button>`
95
97
  + '<div class="hm-chd" id="hmCh" hidden></div><div class="hm-sug" id="hmSug" hidden></div><div class="hm-plw" id="hmPl" hidden></div><div class="hm-log" id="hmLog" role="log" aria-live="polite"></div><div class="hm-foot" id="hmFoot"></div>';
96
98
  const log = el.querySelector('#hmLog'), foot = el.querySelector('#hmFoot'), reopen = el.querySelector('#hmReopen'), head = el.querySelector('#hmCh'), sug = el.querySelector('#hmSug'), pl = el.querySelector('#hmPl');
@@ -182,7 +184,9 @@ export function mountChat(el, host) {
182
184
  }
183
185
  const last = i === R.lastAgent;
184
186
  const asking = last && R.asking; // the message that asks before a change: no tools while the ask is open, and the name on its own line (AgChatAsk)
185
- const cd = CU.split(it.text); // the pmos-card and pmos-pick blocks (pm/chat-cards.js): drawn under the words, live
187
+ const a2 = AU.split(it.text); // a2ui blocks: another agent's surface (pm/a2ui-view.js), drawn after the words
188
+ const liveOf = { live: !((C.conv && C.conv.messages) || []).slice(it.mi + 1).some((x) => x.role === 'user') }; // its buttons work until the PM writes again
189
+ const cd = CU.split(a2.text); // the pmos-card and pmos-pick blocks (pm/chat-cards.js): drawn under the words, live
186
190
  const sr = splitSrc(cd.text); // chief-of-staff C1: the answer's sources, drawn under it (pm/chat-src.js)
187
191
  const g = splitGoal(sr.text), rp0 = splitReport(g.text), ak = splitAsk(splitChase(rp0.text).text), rp = { ...rp0, text: ak.text };
188
192
  const goal = C.th && C.th.goal, gl = it.mi === R.lastMsg && R.waiting && !!goal && goal.state === 'grilling';
@@ -190,7 +194,7 @@ export function mountChat(el, host) {
190
194
  // a run that stopped: the divider sits where it finished, over Claude's last message, and the fix sits under it (canvas XcbOptions, Routine)
191
195
  const stopAt = R.stop && i === R.lastAgent;
192
196
  const av = last && isClaude(R.role) ? adlerAvHtml(asking || ak.block ? 'needs-you' : stopAt ? 'honest' : running() ? 'thinking' : 'handled') : avHtml(R.role);
193
- return (stopAt ? dividerHtml({ tone: R.stop.tone, text: R.stop.text }) : '') + `<div class="hm-a${asking ? ' ask' : ''}${last ? ' last' : ''}">${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) : ''}${CU.html(cd, 'm' + it.mi, { live: !((C.conv && C.conv.messages) || []).slice(it.mi + 1).some((x) => x.role === 'user') })}${srcHtml(sr.src)}${goalBlockHtml(go.block, go)}${reportChipHtml(rp.block, it.mi)}${R.chips(it.mi)}`
197
+ return (stopAt ? dividerHtml({ tone: R.stop.tone, text: R.stop.text }) : '') + `<div class="hm-a${asking ? ' ask' : ''}${last ? ' last' : ''}">${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) : ''}${CU.html(cd, 'm' + it.mi, liveOf)}${AU.html(a2.blocks, 'm' + it.mi, liveOf)}${srcHtml(sr.src)}${goalBlockHtml(go.block, go)}${reportChipHtml(rp.block, it.mi)}${R.chips(it.mi)}`
194
198
  + (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 it a task</button></div>`) + '</div></div>'
195
199
  + (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>` : '')
196
200
  + blockAskHtml(ak.block, it, R);
@@ -621,6 +625,7 @@ export function mountChat(el, host) {
621
625
  if (b.dataset.hmCpt && C.cpt) { if (b.dataset.hmCpt === 'ok') host.compact(sid()); else host.dismissCompact(sid(), C.cpt.pct); C.cpt = null; sug.hidden = true; put(sug, ''); return; }
622
626
  if (b.dataset.hmSug && C.sug) { const g = C.sug; if (b.dataset.hmSug === 'link') host.linkTo(C.t.sid, g.id); else { host.dismissLink(C.t.sid); drawSug(); } return; }
623
627
  const d = b.dataset;
628
+ if (AU.owns(b)) { await AU.press(b); return; } // a press on another agent's surface goes back to it as one message (pm/a2ui-view.js)
624
629
  if (CU.owns(b)) { await CU.press(b); return; } // a row's button, a picker's choice, its ✓ or Undo (pm/chat-cards.js); any other button stays synchronous
625
630
  const ic = b.closest('.hm-icard'), card = C.t && C.t.intro && C.t.intro.card;
626
631
  if (ic && card && card.press) { if (await card.press(b)) draw(); return; }
@@ -706,6 +711,7 @@ export function mountChat(el, host) {
706
711
  if (e.key === 'Enter' && !e.shiftKey && !e.altKey && !e.ctrlKey && !e.metaKey) { e.preventDefault(); el.querySelector('#hmForm').requestSubmit(); }
707
712
  });
708
713
  el.addEventListener('input', (e) => {
714
+ if (AU.input(e.target)) return; // a field on another agent's surface: its bound value follows
709
715
  const card = C.t && C.t.intro && C.t.intro.card;
710
716
  if (card && card.input && e.target.closest('.hm-icard')) { card.input(e.target, e.target.closest('.hm-icard')); return; }
711
717
  if (e.target.id === 'hmIn') { grow(e.target); C.slashAt = 0; suggestFor(e.target.value); drawSlash(); NPU.input(e.target.value); if (C.err) { C.err = ''; const er = foot.querySelector('.hm-senderr'); if (er) er.remove(); foot.__h = null; } }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "a2ui-inbound-render (job #1752, A459b): another agent's A2UI v1.0 surface drawn in the PMOS chat with PMOS's own parts; unsafe surfaces refused whole; a press goes back as words. The page module on plain objects, cross-checked against the vendored A2UI v1.0 schemas. No browser, no network.",
3
+ "modules": [
4
+ "a2ui-inbound.test.js"
5
+ ],
6
+ "seconds": {
7
+ "a2ui-inbound.test.js": 1
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "a2ui-mcp-outbound (job #1751, A459a): pmos mcp gives PMOS rows as A2UI v1.0 over MCP and runs a pressed button as its catalog command. The real launcher on stdio, the real task writer, and the vendored A2UI v1.0 schemas. No browser, no network.",
3
+ "modules": [
4
+ "a2ui-mcp.test.js"
5
+ ],
6
+ "seconds": {
7
+ "a2ui-mcp.test.js": 4
8
+ }
9
+ }