stack/apps/dashboard
Mantra 10df9b2b7b
Fix dashboard sandbox compile errors and switch smart model to Grok (#1476)
## Summary
- Forward Babel/JSX compile errors, runtime throws, and unhandled
rejections from the AI dashboard sandbox iframe to the parent composer
via `postMessage`, so users see actionable errors instead of a blank
preview
- Compile AI-generated dashboard source explicitly with
`Babel.transform` + try/catch (stored in `text/plain` to avoid Babel's
auto-handler swallowing parse errors) and add `crossorigin="anonymous"`
on the Babel script for readable cross-origin error messages
- Switch authenticated smart-tier model from
`moonshotai/kimi-k2.6:nitro` to `x-ai/grok-build-0.1`

## Test plan
- [ ] Generate a dashboard with valid AI code and confirm the preview
still renders
- [ ] Generate a dashboard with invalid JSX and confirm the composer
shows the compile error (not a blank iframe)
- [ ] Trigger a runtime error in generated dashboard code and confirm it
reaches the parent error boundary
- [ ] Verify authenticated smart-tier requests route to
`x-ai/grok-build-0.1`


Made with [Cursor](https://cursor.com)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
* Embedded dashboards now show a clear “Dashboard failed to compile”
message on compilation errors instead of a blank iframe.
* Dashboard runtime errors and unhandled promise rejections are captured
earlier and forwarded to the parent for improved visibility.

* **Updates**
* The authenticated AI model used for the "smart" quality has been
changed, affecting model selection for authenticated requests.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/hexclave/stack-auth/pull/1476?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-05-23 12:34:37 -07:00
..
public Managed email domain deletion and Cloudflare DNS import UX (#1442) 2026-05-23 09:22:29 -07:00
scripts Custom dashboards and unified ai no playground (#1243) 2026-03-13 20:24:40 +00:00
src Fix dashboard sandbox compile errors and switch smart model to Grok (#1476) 2026-05-23 12:34:37 -07:00
.env Local emulator base (#1233) 2026-03-10 15:15:06 -07:00
.env.development Add Mintlify docs to pnpm run dev 2026-04-06 13:47:53 -07:00
.eslintrc.cjs Config sources (#1083) 2026-01-21 18:08:35 -08:00
.gitignore Custom dashboards and unified ai no playground (#1243) 2026-03-13 20:24:40 +00:00
.npmrc Split backend and dashboard (#83) 2024-06-18 15:49:31 +02:00
components.json Split backend and dashboard (#83) 2024-06-18 15:49:31 +02:00
DESIGN-GUIDE.md Auth app redesign (#1367) 2026-05-19 23:03:46 -07:00
instrumentation-client.ts re-enable posthog recordings (#1404) 2026-05-03 23:38:46 -07:00
LICENSE Split backend and dashboard (#83) 2024-06-18 15:49:31 +02:00
next.config.mjs Remote dev envs (#1435) 2026-05-19 15:54:18 -07:00
package.json chore: update package versions 2026-05-23 18:13:12 +00:00
postcss.config.js Split backend and dashboard (#83) 2024-06-18 15:49:31 +02:00
tailwind.config.ts Overview revamp (#1238) 2026-04-15 09:36:00 -07:00
tsconfig.json fix flaky typecheck test (#1072) 2025-12-17 12:26:12 -08:00
vitest.config.ts In-source unit tests (#429) 2025-02-14 11:47:52 -08:00