feat(ui-canvas): add hand-editable UI mockup canvas with slider inspector

Add UI Canvas: an agent writes a self-contained HTML mockup, the human edits
it directly in the browser (select, resize, reorder, nudge, edit text,
remove, restyle), checks mobile, desktop, and exact viewports, chats with the
agent, and clicks Save and Finish to export the edited markup and an edit log.

- skills/ui-canvas, commands/ui-canvas.md, bin ecc-ui-canvas
  (scripts/ui-canvas.js), a profile over the Plan Canvas server via a
  session mode of 'ui'.
- scripts/lib/ui-canvas/{editor,feedback,ui,fields}.js: in-page editor,
  feedback normalization, browser shell, and inspector field helpers.
- Inspector: grouped slider rows (size, fill, text, spacing, border,
  effects); double-click any value to type it, sanitized and clamped before
  it reaches the mockup; HSL plus alpha color sliders; per-property clear.
- ECC green accent on near-black, no gradient branding; selection overlay
  is green.
- Plan Canvas: agent identity in presence, mode-aware server and hooks.

Editing conventions credit VisBug and Onlook; the review loop credits
lavish-axi by @kunchenguid.
This commit is contained in:
haelyra committed 2026-10-25 18:21:28 -04:00
1 parent e3292b0010
commit 283c16aa4e
49 files changed
+5216 -81

No files matched your search

+24 -5
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env node
/**
* Plan Canvas undelivered-feedback guard (Stop)
* Plan Canvas and UI Canvas undelivered-feedback guard (Stop)
*
* Cross-platform (Windows, macOS, Linux)
*
@@ -193,26 +193,45 @@ function describeItem(item) {
const where = anchor.snippet || anchor.selector || 'the artifact';
return item.text ? `on "${where}": ${item.text}` : null;
}
// UI Canvas batches: the snapshot lives on disk; only paths travel here.
if (item.kind === 'finish' || item.kind === 'edits') {
const count = Number(item.editCount) || (Array.isArray(item.edits) ? item.edits.length : 0);
const label = item.kind === 'finish' ? 'SAVED AND FINISHED' : 'APPLIED EDITS TO THE PREVIEW';
const where = [item.exportPath ? `final markup: ${item.exportPath}` : null, item.editsPath ? `edit log: ${item.editsPath}` : null]
.filter(Boolean)
.join(', ');
return `${label} (${count} edit${count === 1 ? '' : 's'})${where ? ` - ${where}` : ''}${item.text ? `: ${item.text}` : ''}`;
}
if (item.kind === 'chat' && item.anchor && item.text) {
const where = item.anchor.snippet || item.anchor.selector;
return where ? `on "${where}": ${item.text}` : item.text;
}
return item.text || null;
}
function buildReason(delivered) {
const allUi = delivered.length > 0 && delivered.every(entry => entry.mode === 'ui');
const lines = [
'Plan Canvas: the human sent feedback in the browser that was never delivered to you.',
`${allUi ? 'UI Canvas' : 'Plan Canvas'}: the human sent feedback in the browser that was never delivered to you.`,
'Handle it now instead of ending the turn.',
''
];
for (const entry of delivered) {
const bin = entry.mode === 'ui' ? 'ecc-ui-canvas' : 'ecc-plan-canvas';
lines.push(`Artifact: ${entry.file}`);
for (const text of entry.messages.slice(0, MAX_ITEMS_REPORTED)) lines.push(` - ${text}`);
const extra = entry.messages.length - MAX_ITEMS_REPORTED;
if (extra > 0) lines.push(` - (+${extra} more)`);
if (entry.sessionEnded) {
if (entry.sessionEnded && entry.mode === 'ui') {
lines.push(' The user saved and finished (or ended) this preview after sending. Read the exported markup');
lines.push(' named above, reproduce that exact design in the real component, and report back in your');
lines.push(' normal reply; do not reopen the canvas.');
} else if (entry.sessionEnded) {
lines.push(' The user ended this review after sending. Address the feedback and report back in');
lines.push(' your normal reply; do not reopen the canvas.');
} else {
lines.push(' Reply IN THE CANVAS so the human sees it, and keep listening, with one command:');
lines.push(` ecc-plan-canvas await ${JSON.stringify(entry.file)} --reply "<what you did>"`);
lines.push(` ${bin} await ${JSON.stringify(entry.file)} --reply "<what you did>"`);
}
lines.push('');
}
@@ -229,7 +248,7 @@ async function collectDeliveries(sessions, port) {
if (!result) continue;
const messages = result.items.map(describeItem).filter(Boolean);
if (messages.length === 0) continue;
delivered.push({ file: session.file, messages, sessionEnded: Boolean(result.sessionEnded) });
delivered.push({ file: session.file, mode: session.mode === 'ui' ? 'ui' : 'plan', messages, sessionEnded: Boolean(result.sessionEnded) });
}
return delivered;
}
+6 -2
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env node
/**
* Plan Canvas open-session surfacing (SessionStart)
* Plan Canvas and UI Canvas open-session surfacing (SessionStart)
*
* Cross-platform (Windows, macOS, Linux)
*
@@ -58,11 +58,15 @@ function buildContext(sessions) {
];
for (const session of sessions.slice(0, 5)) {
const pending = session.pendingFeedback && session.pendingFeedback.length;
lines.push(` - ${session.file}${pending ? ` (${pending} undelivered feedback item${pending === 1 ? '' : 's'})` : ''}`);
const tag = session.mode === 'ui' ? ' [ui canvas]' : '';
lines.push(` - ${session.file}${tag}${pending ? ` (${pending} undelivered feedback item${pending === 1 ? '' : 's'})` : ''}`);
}
lines.push(
'Resume with `node scripts/plan-canvas.js await <file>` (plan-canvas skill), or `end <file>` if the review is obsolete.'
);
if (sessions.some(session => session.mode === 'ui')) {
lines.push('Sessions tagged [ui canvas] resume with `node scripts/ui-canvas.js await <file>` (ui-canvas skill) instead.');
}
return lines.join('\n');
}