You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HAPI chat can render inline images via the generated-image message type (web fetches bytes from CLI via hub RPC). PR #700 added the display_image MCP tool and wired prompts for some flavors, but image display is not reliable for all agents today.
CLI MCP tooldisplay_image in startHappyServer.ts — reads local file, registers in generatedImages, emits type: 'generated-image' agent message
Codex: stdio MCP bridge forwards display_image; system prompt hint; plus native generated_image app-server events in codexRemoteLauncher.ts
Claude: MCP via startHappyServer + system prompt hint
OpenCode: system prompt hint + buildHapiMcpBridge MCP
Web: flavor-agnostic — ToolMessage.tsxGeneratedImageCard, normalizeAgent.ts, hub route GET /sessions/:id/generated-images/:imageId
Gaps (why "all agents" still fails)
1. MCP wired but agents not told to use it
These flavors start buildHapiMcpBridge() (which uses startHappyServer — tool exists) but have no system prompt hint to call display_image:
Cursor (ACP)
Gemini (ACP)
Kimi (ACP)
Pi
buildHapiMcpBridge also only sets explicit tool approval for change_title; display_image should be auto-approved (yolo-safe read-only display).
2. ACP agent-native image blocks dropped
cli/src/agent/backends/acp/AcpMessageHandler.ts returns null for inner content { type: 'image', ... } — Cursor/Gemini/Kimi/OpenCode ACP responses that include image blocks never reach the hub/web.
web/src/components/ToolCard/views/_results.tsx extracts text blocks only. Read/bash/chart outputs with embedded image content are invisible even when the agent did produce image data.
Summary
HAPI chat can render inline images via the
generated-imagemessage type (web fetches bytes from CLI via hub RPC). PR #700 added thedisplay_imageMCP tool and wired prompts for some flavors, but image display is not reliable for all agents today.Parent: #697. Related: #508 (tool-result image blocks), #511 (composer thumbnails).
What PR #700 actually shipped (merged 2026-05-27)
Not Claude-only. Partial cross-flavor wiring:
display_imageinstartHappyServer.ts— reads local file, registers ingeneratedImages, emitstype: 'generated-image'agent messagedisplay_image; system prompt hint; plus nativegenerated_imageapp-server events incodexRemoteLauncher.tsstartHappyServer+ system prompt hintbuildHapiMcpBridgeMCPToolMessage.tsxGeneratedImageCard,normalizeAgent.ts, hub routeGET /sessions/:id/generated-images/:imageIdGaps (why "all agents" still fails)
1. MCP wired but agents not told to use it
These flavors start
buildHapiMcpBridge()(which usesstartHappyServer— tool exists) but have no system prompt hint to calldisplay_image:buildHapiMcpBridgealso only sets explicit tool approval forchange_title;display_imageshould be auto-approved (yolo-safe read-only display).2. ACP agent-native image blocks dropped
cli/src/agent/backends/acp/AcpMessageHandler.tsreturnsnullfor inner content{ type: 'image', ... }— Cursor/Gemini/Kimi/OpenCode ACP responses that include image blocks never reach the hub/web.3. Tool results still text-only (#508)
web/src/components/ToolCard/views/_results.tsxextracts text blocks only. Read/bash/chart outputs with embedded image content are invisible even when the agent did produce image data.4. User attachment previews (#511)
MessageAttachments.tsxcan renderpreviewUrlthumbnails but many attachment paths still show filename chips only.Proposed fix (v1 — cross-flavor parity)
CLI (all remote flavors using MCP bridge):
display_imagesystem prompt snippet; inject into Cursor, Gemini, Kimi, Pi launchers (match Claude/Codex/OpenCode pattern)buildHapiMcpBridgetools config:display_image: { approval_mode: 'approve' }(or auto where flavor supports it)ACP path:
AcpMessageHandlerto convert ACPimagecontent blocks intogenerated-imagesession messages (register bytes/path viageneratedImageshelper)Web (optional v1.1 or same PR if small):
ImagePreview/ lightbox)Acceptance criteria
display_image(or ACP emits image block) → image visible inline in web chatgenerated-imagepipelineNon-goals (v1)
auto-promotion from assistant text (follow-up)References
cli/src/claude/utils/startHappyServer.ts—display_imageimplementationcli/src/codex/utils/buildHapiMcpBridge.ts— shared MCP bridge (missing prompt + tool approval)cli/src/agent/backends/acp/AcpMessageHandler.ts:326— image blocks droppedweb/src/components/AssistantChat/messages/ToolMessage.tsx— existing inline renderer