Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .memory/inline-generative-ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ Round 17 (2026-11-19): security (rev43) and correctness (rev44) reviews of 91ab5
## Smarter artifacts Phase E2 (2026-11-19)

- Item 32, visuals on `aiden serve` (b9cb9bec0, `packages/cli/src/server-visuals.ts`): `render_artifact` draws the visual once as a still PNG (2x, 720 or 1024 px wide) with an installed Chrome or Chromium found only at fixed paths (no `PATH` lookup, no override, no snap), headless, sandbox on, throwaway profile, offline with every request refused, bounded time and size; looked for only when a visual is drawn. The PNG goes out as the desktop's ordinary visual snapshot, so there is no Remote protocol change. `render_ui` sends its fallback text with each chart's data under its summary line (`compileAum(..., { fallback: { chartTables: true, plainTables: true } })` in `packages/cli/src/extensions/artifacts.ts`): since Phase E fix round 2, each table row is one plain line of labelled values (`Customer: Acme · Revenue: $1.2M`, cells clipped to 40 characters and stripped of control and bidi characters), not Markdown pipes or space-padded columns, because the phone's visual row shows the text as-is in a proportional font; sparklines list their values (all up to 32, else the first, `…`, the latest 30 and the count, so `…` always hides two or more; 2026-11-19), chart/sparkline/heatmap labels go through `cleanCell` (one line, max 120), plain rows are cut at 400 characters, heatmaps their cells as `row · column: value` lines, and scatter charts every numeric field when no `x` is named. Each tool result starts with what the person sees ("Shown as an image" / "Shown as text" / "Not shown" with the reason). Running as root or without a browser: not shown, said so. The server does not offer `chat-visual-viewer-v1`. A paired Mac never drew a server's native visual (Remote projects no markup); since Phase E fix round 2 `mapRemoteMessage` (`renderer/lib/hosts/remote-chat-mapper.ts`) turns each projected `ui` visual that has `fallbackText` and no `snapshotAttachmentId` into a text-only `ChatUiVisualV1` (`Visual` root, one `Text` per line, at most 400 lines, no data or state) placed by its `toolCallId`, so a paired Mac shows the same text as a phone; the tool result says "phones and Macs paired to this server show … as the text below".
- Test (2026-11-24): the real-Chrome test in `packages/cli/tests/server-visuals.test.mjs` draws one untimed warm-up first. A CI trace showed the first Chrome launch on a fresh hosted Linux runner takes 8-14 s to answer `Target.createTarget` (cold disk; nothing on stderr for ~7.5 s), against the 15 s render limit, while warm launches answer in ~170 ms and draw in ~1 s. Its D-Bus errors are noise: disabling D-Bus and running the file outside the parallel pool were both tried and changed nothing. This had been failing `renderer-other` on many branches (#906 runs 45337184177, 45352616175, 45356021801).
- Idea 4, the visual's Actions menu: with extra actions, a visual caption's Copy (native) or Export (HTML) button becomes one `MoreHorizontal` "Actions for {title}" menu (`renderer/components/visual-actions-menu.tsx`, `VisualCaptionActions`) that lists the visual's own action first, so no new always-visible control. With no extras it is still the plain button. The expanded HTML view keeps a plain Export: a portalled Radix menu sits behind the top-layer popover and light-dismisses it.
- Native visuals get **Keep in Artifacts** (settled messages only; `KeepVisualChatContext` from `chat-pane.tsx`, set only for a local non-Bot, non-routine chat in a non-Assistant workspace; the remote chat view never provides it). IPC `workspaces:artifacts:keepVisual(chatId, messageId, visualId)`; main re-checks every case and reads the visual from the stored chat, never from the renderer.
- HTML visuals get **Send to canvas** only when `useDesignModeControls(chatId)` is non-null. IPC `designCanvas:placeArtifact(chatId, mediaId)` places it as an artifact frame (sized to the open canvas's viewSize) through the existing placement path (unsafe-HTML scan, size limits, frame cap); placed or already turns design mode on, an error result (`missing`, `unsafe`, `full`) toasts and leaves design mode alone. Messages live in `renderer/lib/visual-menu-actions.ts`.
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/tests/server-visuals.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ test("an installed browser draws a chart offline into a picture and leaves no pr
t.after(() => { if (previous === undefined) delete process.env.AIDEN_CLI_ENTRY; else process.env.AIDEN_CLI_ENTRY = previous; });
const profiles = () => readdirSync(tmpdir()).filter((name) => name.startsWith("aiden-visual-")).length;
const before = profiles();
// The first launch of Chrome on a fresh CI machine reads the browser from a
// cold disk and has taken 8-14 s to answer; later launches answer in under
// 200 ms. Draw once without the limit, so the limit below times the drawing.
await api.renderServerVisualImage({ browserPath: browser.path, hostPage: api.serverVisualHostPage("<p>Warm-up</p>", "Warm-up", 720, () => ""), width: 720, timeoutMs: 120_000 });
Comment thread
sambitcreate marked this conversation as resolved.
Resolved
const visuals = api.createServerVisualCollector();
const html = `<div style="height:240px"><canvas id="c"></canvas></div><script>new Chart(document.getElementById("c"), {type:"bar",data:{labels:["Q1","Q2"],datasets:[{label:"Sales",data:[3,5]}]},options:{animation:false,maintainAspectRatio:false}})</script>`;
const started = Date.now();
Expand Down
Loading