advanced-visualization
Interactive answer implementation
Use this guidance after choosing a custom UI because it helps the task. Follow Jev’s renderer and visualization decision. A2UI handles basic tables; this sandbox handles charts, diagrams and custom interaction. Do not turn every answer into a dashboard. Use multiple sections when needed, including headings, assumptions, units, sources, and instructions inside the UI.
Streaming and execution
For generateSandboxedUi emit initialHeight, placeholderMessages, css, html, jsFunctions, jsExpressions in that exact order. The placeholder remains until css is complete; put all styles in the css parameter. Keep html meaningful before scripts run. jsFunctions holds named declarations; jsExpressions holds small synchronous invocations. There is no API to append expressions to prior calls.
No localStorage, sessionStorage, cookies, IndexedDB, same-origin fetch, parent DOM, or invented service endpoints. The pre-injected importmap supports bare imports for three, gsap, d3, and chart.js. jsFunctions/jsExpressions are classic scripts; top-level await is invalid. Import inside an async function and handle failure: