fix: resolve code review issues — schema mismatch, test fixes, pop-out render

- Fix a2ui-format.md schema to match renderer: rename 'options' → 'filters' in
  filters block, replace 'active: boolean' with 'value: string' in filter options,
  update form select options from string[] to {label, value}[] objects (Critical #1)
- Fix 3 failing tests in test_researcher_agent.sh to use @mention paths without .md
  extension (Important #2)
- Complete pop-out feature in VisualBlock.handlePopOut() by posting render message
  to popup window after 500ms initialization delay (Important #3)
- Update test_context_files.sh to match new a2ui-format.md schema (filters array
  key check, value field check)
This commit is contained in:
Ken
2026-05-26 20:54:58 +00:00
parent 92df88975c
commit 2c3cfdbedc
4 changed files with 30 additions and 15 deletions
+14 -10
View File
@@ -28,20 +28,20 @@ Renders a row of toggle chips. Use for quick category or attribute filtering.
```a2ui ```a2ui
{ {
"type": "filters", "type": "filters",
"options": [ "filters": [
{ "label": "Toyota", "active": true }, { "label": "Toyota", "value": "toyota" },
{ "label": "Honda", "active": false }, { "label": "Honda", "value": "honda" },
{ "label": "Hyundai", "active": false }, { "label": "Hyundai", "value": "hyundai" },
{ "label": "Under $5K", "active": false } { "label": "Under $5K", "value": "under_5k" }
] ]
} }
``` ```
| Field | Type | Description | | Field | Type | Description |
|-------|------|-------------| |-------|------|-------------|
| `options` | array | List of filter chips | | `filters` | array | List of filter chips |
| `options[].label` | string | Display text for the chip | | `filters[].label` | string | Display text for the chip |
| `options[].active` | boolean | Whether the chip is pre-selected | | `filters[].value` | string | Machine-readable identifier for the chip |
--- ---
@@ -113,7 +113,11 @@ configure a follow-up action.
"name": "fuel_type", "name": "fuel_type",
"type": "select", "type": "select",
"label": "Fuel Type", "label": "Fuel Type",
"options": ["hybrid", "electric", "any"] "options": [
{ "label": "Hybrid", "value": "hybrid" },
{ "label": "Electric", "value": "electric" },
{ "label": "Any", "value": "any" }
]
} }
], ],
"submitLabel": "Search" "submitLabel": "Search"
@@ -127,7 +131,7 @@ configure a follow-up action.
| `fields[].type` | string | `"number"`, `"text"`, `"select"` | | `fields[].type` | string | `"number"`, `"text"`, `"select"` |
| `fields[].label` | string | Human-readable label | | `fields[].label` | string | Human-readable label |
| `fields[].value` | any | Default value (for `number`/`text` fields) | | `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 | | `submitLabel` | string | Text on the submit button |
--- ---
+11
View File
@@ -76,6 +76,17 @@ function VisualBlock({
w.document.open() w.document.open()
w.document.write(html) w.document.write(html)
w.document.close() 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(() => { .catch(() => {
w.close() w.close()
+2 -2
View File
@@ -60,12 +60,12 @@ check_contains "$A2UI" "a2ui fenced code block" '```a2ui'
echo "" echo ""
echo "=== Checking a2ui-format.md: block type 'filters' ===" echo "=== Checking a2ui-format.md: block type 'filters' ==="
check_contains "$A2UI" "filters type" '"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" "Toyota option" '"Toyota"'
check_contains "$A2UI" "Honda option" '"Honda"' check_contains "$A2UI" "Honda option" '"Honda"'
check_contains "$A2UI" "Hyundai option" '"Hyundai"' check_contains "$A2UI" "Hyundai option" '"Hyundai"'
check_contains "$A2UI" "Under \$5K option" '"Under $5K"' check_contains "$A2UI" "Under \$5K option" '"Under $5K"'
check_contains "$A2UI" "active field" '"active"' check_contains "$A2UI" "value field" '"value"'
echo "" echo ""
echo "=== Checking a2ui-format.md: block type 'table' ===" echo "=== Checking a2ui-format.md: block type 'table' ==="
+3 -3
View File
@@ -128,17 +128,17 @@ check_regex "user can take over via VNC" "VNC|vnc"
echo "" echo ""
echo "=== Checking body: A2UI section ===" echo "=== Checking body: A2UI section ==="
check_contains "A2UI section header" "A2UI" 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 ""
echo "=== Checking body: Artifacts section ===" echo "=== Checking body: Artifacts section ==="
check_contains "Artifacts section header" "Artifacts" 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 ""
echo "=== Checking body: Inline Visuals section ===" echo "=== Checking body: Inline Visuals section ==="
check_contains "Inline Visuals section header" "Inline Visuals" 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" check_regex "proactive visual generation mention" "proactive|visual.*generation|comparison.*table|chart"
echo "" echo ""