Skip to content

Commit aff2277

Browse files
fix(ui): preserve widget action outcomes
1 parent 3ed32f7 commit aff2277

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

‎docs/tools/show-widget.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ In Control UI sessions, a Canvas widget can also be pinned to the session dashbo
2121

2222
For browser embedding, the wrapper document injects five small host bridges around the widget code:
2323

24-
- A size reporter posts the rendered content height to the embedding chat, which clamps it and fits the iframe (160 to 1200 pixels).
24+
- A size reporter posts the rendered content height to the embedding chat, which clamps it and fits the iframe (48 to 1200 pixels).
2525
- A host bridge defines the legacy `sendPrompt(text)` helper plus the structured `openclaw.prompt`, `openclaw.state`, `openclaw.data`, and `openclaw.cron` APIs. Inline chat prompts retain their private message channel; dashboard APIs use a view-ticket-bound request channel. See [Interactive widgets](#interactive-widgets) and [Dashboard capabilities](#dashboard-capabilities).
2626
- A theme bridge listens for the Control UI's current design tokens and applies them as CSS variables, on load and again on every theme change.
2727
- A snapshot bridge renders the current widget document as a PNG when the embedding chat requests an export.

‎ui/src/pages/chat/components/chat-message.test.ts‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,9 +385,13 @@ function createAssistantCanvasBlock(params: {
385385
url?: string;
386386
preferredHeight?: number;
387387
presentationTarget?: "assistant_message" | "tool_card";
388+
mcpApp?: { viewId: string };
388389
}) {
389390
const viewId = `cv_inline_${params.suffix}`;
390-
const preview = createCanvasPreview({ ...params, viewId });
391+
const preview = {
392+
...createCanvasPreview({ ...params, viewId }),
393+
...(params.mcpApp ? { mcpApp: params.mcpApp } : {}),
394+
};
391395
return {
392396
type: "canvas",
393397
preview,
@@ -5501,8 +5505,10 @@ describe("grouped chat rendering", () => {
55015505

55025506
it("keeps MCP App raw details reachable from its widget menu", () => {
55035507
const container = document.createElement("div");
5504-
const canvas = createAssistantCanvasBlock({ suffix: "mcp-raw" });
5505-
canvas.preview.mcpApp = { viewId: "view-mcp-raw" };
5508+
const canvas = createAssistantCanvasBlock({
5509+
suffix: "mcp-raw",
5510+
mcpApp: { viewId: "view-mcp-raw" },
5511+
});
55065512
renderAssistantMessage(container, createAssistantMessage([canvas]), {
55075513
sessionKey: "agent:main:main",
55085514
});

0 commit comments

Comments
 (0)