diff --git a/bundle/context/a2ui-format.md b/bundle/context/a2ui-format.md index f723710..55c6cff 100644 --- a/bundle/context/a2ui-format.md +++ b/bundle/context/a2ui-format.md @@ -28,20 +28,20 @@ Renders a row of toggle chips. Use for quick category or attribute filtering. ```a2ui { "type": "filters", - "options": [ - { "label": "Toyota", "active": true }, - { "label": "Honda", "active": false }, - { "label": "Hyundai", "active": false }, - { "label": "Under $5K", "active": false } + "filters": [ + { "label": "Toyota", "value": "toyota" }, + { "label": "Honda", "value": "honda" }, + { "label": "Hyundai", "value": "hyundai" }, + { "label": "Under $5K", "value": "under_5k" } ] } ``` | Field | Type | Description | |-------|------|-------------| -| `options` | array | List of filter chips | -| `options[].label` | string | Display text for the chip | -| `options[].active` | boolean | Whether the chip is pre-selected | +| `filters` | array | List of filter chips | +| `filters[].label` | string | Display text for the chip | +| `filters[].value` | string | Machine-readable identifier for the chip | --- @@ -113,7 +113,11 @@ configure a follow-up action. "name": "fuel_type", "type": "select", "label": "Fuel Type", - "options": ["hybrid", "electric", "any"] + "options": [ + { "label": "Hybrid", "value": "hybrid" }, + { "label": "Electric", "value": "electric" }, + { "label": "Any", "value": "any" } + ] } ], "submitLabel": "Search" @@ -127,7 +131,7 @@ configure a follow-up action. | `fields[].type` | string | `"number"`, `"text"`, `"select"` | | `fields[].label` | string | Human-readable label | | `fields[].value` | any | Default value (for `number`/`text` fields) | -| `fields[].options` | string[] | Choice list (for `select` fields) | +| `fields[].options` | `{label, value}[]` | Choice list (for `select` fields); each item has a display `label` and machine-readable `value` | | `submitLabel` | string | Text on the submit button | --- diff --git a/frontend/src/components/ChatPanel.tsx b/frontend/src/components/ChatPanel.tsx index 37d23c7..4063d6d 100644 --- a/frontend/src/components/ChatPanel.tsx +++ b/frontend/src/components/ChatPanel.tsx @@ -76,6 +76,17 @@ function VisualBlock({ w.document.open() w.document.write(html) w.document.close() + // Give the iframe time to initialize, then send the render message + setTimeout(() => { + w.postMessage( + { + jsonrpc: '2.0', + method: 'render', + params: { code: payload.code, data: payload.data ?? {} }, + }, + '*' + ) + }, 500) }) .catch(() => { w.close() diff --git a/tests/test_context_files.sh b/tests/test_context_files.sh index 56ff51e..b1a84c7 100755 --- a/tests/test_context_files.sh +++ b/tests/test_context_files.sh @@ -60,12 +60,12 @@ check_contains "$A2UI" "a2ui fenced code block" '```a2ui' echo "" echo "=== Checking a2ui-format.md: block type 'filters' ===" check_contains "$A2UI" "filters type" '"type": "filters"' -check_contains "$A2UI" "filters options array" '"options"' +check_contains "$A2UI" "filters array key" '"filters"' check_contains "$A2UI" "Toyota option" '"Toyota"' check_contains "$A2UI" "Honda option" '"Honda"' check_contains "$A2UI" "Hyundai option" '"Hyundai"' check_contains "$A2UI" "Under \$5K option" '"Under $5K"' -check_contains "$A2UI" "active field" '"active"' +check_contains "$A2UI" "value field" '"value"' echo "" echo "=== Checking a2ui-format.md: block type 'table' ===" diff --git a/tests/test_researcher_agent.sh b/tests/test_researcher_agent.sh index 156aad4..122b33e 100755 --- a/tests/test_researcher_agent.sh +++ b/tests/test_researcher_agent.sh @@ -128,17 +128,17 @@ check_regex "user can take over via VNC" "VNC|vnc" echo "" echo "=== Checking body: A2UI section ===" check_contains "A2UI section header" "A2UI" -check_contains "a2ui-format.md @mention" "bundle/context/a2ui-format.md" +check_contains "a2ui-format @mention" "bundle/context/a2ui-format" echo "" echo "=== Checking body: Artifacts section ===" check_contains "Artifacts section header" "Artifacts" -check_contains "artifact-conventions.md @mention" "bundle/context/artifact-conventions.md" +check_contains "artifact-conventions @mention" "bundle/context/artifact-conventions" echo "" echo "=== Checking body: Inline Visuals section ===" check_contains "Inline Visuals section header" "Inline Visuals" -check_contains "visual-artifacts.md @mention" "bundle/context/visual-artifacts.md" +check_contains "visual-artifacts @mention" "bundle/context/visual-artifacts" check_regex "proactive visual generation mention" "proactive|visual.*generation|comparison.*table|chart" echo ""