@agent-native/core 0.129.2 → 0.130.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (589) hide show
  1. package/corpus/README.md +2 -2
  2. package/corpus/core/CHANGELOG.md +72 -0
  3. package/corpus/core/docs/content/cloneable-saas.mdx +114 -0
  4. package/corpus/core/docs/content/creating-templates.mdx +28 -2
  5. package/corpus/core/docs/content/syncing-template-changes.mdx +7 -0
  6. package/corpus/core/docs/content/template-clips-developers.mdx +12 -5
  7. package/corpus/core/docs/content/template-dispatch-developers.mdx +1 -1
  8. package/corpus/core/docs/content/template-dispatch.mdx +1 -1
  9. package/corpus/core/package.json +1 -1
  10. package/corpus/core/src/action-ui.ts +1 -0
  11. package/corpus/core/src/action.ts +5 -1
  12. package/corpus/core/src/agent/engine/ai-sdk-engine.ts +15 -5
  13. package/corpus/core/src/agent/harness/runner.ts +5 -0
  14. package/corpus/core/src/agent/production-agent.ts +33 -0
  15. package/corpus/core/src/agent/run-loop-with-resume.ts +5 -0
  16. package/corpus/core/src/agent/run-manager.ts +126 -1
  17. package/corpus/core/src/agent/thread-data-builder.ts +47 -2
  18. package/corpus/core/src/agent/types.ts +2 -0
  19. package/corpus/core/src/chat-threads/store.ts +4 -5
  20. package/corpus/core/src/cli/create.ts +1139 -65
  21. package/corpus/core/src/cli/design-connect.ts +3 -7
  22. package/corpus/core/src/cli/index.ts +5 -3
  23. package/corpus/core/src/cli/skills-content/design-visual-edit-skill.ts +83 -47
  24. package/corpus/core/src/client/AssistantChat.tsx +27 -16
  25. package/corpus/core/src/client/agent-chat-adapter.ts +24 -0
  26. package/corpus/core/src/client/blocks/library/wireframe-kit.tsx +17 -2
  27. package/corpus/core/src/client/chat/index.ts +1 -0
  28. package/corpus/core/src/client/chat/message-components.tsx +104 -1
  29. package/corpus/core/src/client/chat/run-recovery.tsx +15 -3
  30. package/corpus/core/src/client/chat/widgets/DataTableWidget.tsx +10 -29
  31. package/corpus/core/src/client/chat/widgets/WorkspaceFileWidget.tsx +71 -0
  32. package/corpus/core/src/client/chat/widgets/builtin-tool-renderers.tsx +22 -0
  33. package/corpus/core/src/client/chat/widgets/workspace-file-result.ts +49 -0
  34. package/corpus/core/src/client/embed-auth.ts +2 -0
  35. package/corpus/core/src/client/org/InvitationBanner.tsx +14 -1
  36. package/corpus/core/src/client/org/OrgSwitcher.tsx +23 -0
  37. package/corpus/core/src/client/org/TeamPage.tsx +130 -0
  38. package/corpus/core/src/client/org/WorkspaceNotice.tsx +85 -0
  39. package/corpus/core/src/client/org/hooks.ts +14 -0
  40. package/corpus/core/src/client/org/index.ts +2 -0
  41. package/corpus/core/src/client/resources/McpIntegrationDialog.tsx +27 -40
  42. package/corpus/core/src/client/resources/ResourcesPanel.tsx +134 -51
  43. package/corpus/core/src/client/resources/mcp-integration-catalog.ts +7 -0
  44. package/corpus/core/src/client/resources/use-resources.ts +6 -0
  45. package/corpus/core/src/client/use-action.ts +3 -1
  46. package/corpus/core/src/client/widgets/index.ts +1 -0
  47. package/corpus/core/src/coding-tools/run-code.ts +2 -1
  48. package/corpus/core/src/db/client.ts +28 -4
  49. package/corpus/core/src/deploy/build.ts +31 -3
  50. package/corpus/core/src/eject/remote-mcp-presets.ts +1 -1
  51. package/corpus/core/src/index.browser.ts +1 -0
  52. package/corpus/core/src/index.ts +1 -0
  53. package/corpus/core/src/integrations/google-docs-poller.ts +3 -0
  54. package/corpus/core/src/integrations/webhook-handler.ts +28 -11
  55. package/corpus/core/src/jobs/scheduler.ts +4 -0
  56. package/corpus/core/src/localization/default-messages.ts +3 -2
  57. package/corpus/core/src/observability/traces.ts +48 -12
  58. package/corpus/core/src/org/handlers.ts +52 -1
  59. package/corpus/core/src/org/migrations.ts +4 -0
  60. package/corpus/core/src/org/plugin.ts +14 -0
  61. package/corpus/core/src/org/schema.ts +1 -0
  62. package/corpus/core/src/org/types.ts +8 -0
  63. package/corpus/core/src/org/workspace-url.ts +74 -0
  64. package/corpus/core/src/resources/handlers.ts +35 -5
  65. package/corpus/core/src/scripts/runner.ts +183 -5
  66. package/corpus/core/src/server/action-routes.ts +32 -2
  67. package/corpus/core/src/server/agent-chat-plugin.ts +29 -0
  68. package/corpus/core/src/server/agent-teams.ts +10 -1
  69. package/corpus/core/src/server/auth.ts +33 -7
  70. package/corpus/core/src/server/embed-route.ts +9 -0
  71. package/corpus/core/src/server/embed-session.ts +62 -3
  72. package/corpus/core/src/server/open-route.ts +20 -6
  73. package/corpus/core/src/server/prompts/framework-core-compact.ts +1 -1
  74. package/corpus/core/src/server/prompts/framework-core.ts +1 -0
  75. package/corpus/core/src/server/request-context.ts +36 -1
  76. package/corpus/core/src/shared/embed-auth.ts +1 -0
  77. package/corpus/core/src/shared/html-document.ts +115 -0
  78. package/corpus/core/src/shared/index.ts +1 -0
  79. package/corpus/core/src/sharing/access.ts +8 -1
  80. package/corpus/core/src/sharing/registry.ts +11 -2
  81. package/corpus/core/src/workspace-files/actions.ts +100 -0
  82. package/corpus/core/src/workspace-files/tool.ts +4 -0
  83. package/corpus/templates/analytics/.agents/skills/analysis-workspace/SKILL.md +4 -0
  84. package/corpus/templates/analytics/.agents/skills/hubspot/SKILL.md +9 -1
  85. package/corpus/templates/analytics/AGENTS.md +17 -24
  86. package/corpus/templates/analytics/actions/data-source-status.ts +11 -1
  87. package/corpus/templates/analytics/app/i18n-data.ts +34 -0
  88. package/corpus/templates/analytics/app/lib/data-source-status.ts +86 -0
  89. package/corpus/templates/analytics/app/lib/native-mcp-exclusions.ts +9 -0
  90. package/corpus/templates/analytics/app/pages/DataSources.tsx +184 -20
  91. package/corpus/templates/analytics/changelog/2026-07-28-native-analytics-data-sources-no-longer-show-duplicate-mc.md +6 -0
  92. package/corpus/templates/analytics/changelog/2026-07-29-exports-now-appear-in-chat-with-a-direct-download-instead-of.md +6 -0
  93. package/corpus/templates/analytics/changelog/2026-07-29-queued-chat-prompts-no-longer-resend-after-analytics-navigat.md +6 -0
  94. package/corpus/templates/analytics/changelog/2026-07-29-scheduled-dashboard-emails-load-every-panel-reliably-without.md +6 -0
  95. package/corpus/templates/analytics/scripts/emit-netlify-dashboard-report-cron.ts +6 -3
  96. package/corpus/templates/analytics/server/lib/credential-keys.ts +1 -1
  97. package/corpus/templates/analytics/server/lib/hubspot.ts +1 -1
  98. package/corpus/templates/analytics/server/lib/provider-credentials.ts +55 -1
  99. package/corpus/templates/analytics/server/plugins/agent-chat.ts +123 -27
  100. package/corpus/templates/analytics/server/routes/[...page].get.ts +2 -7
  101. package/corpus/templates/analytics/vite.config.ts +7 -0
  102. package/corpus/templates/brain/actions/list-connection-providers.ts +100 -2
  103. package/corpus/templates/brain/app/lib/brain.ts +10 -0
  104. package/corpus/templates/brain/app/routes/sources.tsx +15 -4
  105. package/corpus/templates/brain/changelog/2026-07-29-brain-automatically-retries-failed-source-syncs-and-guides-y.md +6 -0
  106. package/corpus/templates/brain/jobs/process-ingest-queue.ts +13 -0
  107. package/corpus/templates/brain/server/jobs/sync-sources.ts +27 -22
  108. package/corpus/templates/brain/server/plugins/agent-chat.ts +2 -1
  109. package/corpus/templates/brain/server/routes/api/brain/queue/run.post.ts +7 -1
  110. package/corpus/templates/clips/AGENTS.md +1 -1
  111. package/corpus/templates/clips/actions/create-recording-agent-link.ts +11 -1
  112. package/corpus/templates/clips/actions/update-comment.ts +68 -0
  113. package/corpus/templates/clips/app/components/editor/editor-layout.tsx +0 -1
  114. package/corpus/templates/clips/app/components/player/comments-panel.tsx +221 -65
  115. package/corpus/templates/clips/app/components/player/video-player.tsx +101 -27
  116. package/corpus/templates/clips/app/i18n/en-US.ts +2 -1
  117. package/corpus/templates/clips/app/routes/bug-report.done.tsx +48 -27
  118. package/corpus/templates/clips/app/routes/bug-report.tsx +43 -4
  119. package/corpus/templates/clips/app/routes/record.tsx +2 -0
  120. package/corpus/templates/clips/changelog/2026-07-29-clip-playback-now-recovers-instead-of-getting-stuck-when-a-b.md +6 -0
  121. package/corpus/templates/clips/changelog/2026-07-29-comments-can-now-be-edited-after-posting.md +6 -0
  122. package/corpus/templates/clips/changelog/2026-07-29-download-actions-now-use-a-shorter-clearer-label.md +6 -0
  123. package/corpus/templates/clips/changelog/2026-07-29-embedded-bug-reports-now-return-a-temporary-agent-readable.md +6 -0
  124. package/corpus/templates/clips/shared/bug-report.ts +99 -0
  125. package/corpus/templates/content/actions/_content-database-personal-view.ts +7 -1
  126. package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +5 -2
  127. package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +20 -8
  128. package/corpus/templates/content/changelog/2026-07-29-missing-databases-no-longer-trigger-repeated-personal-view-e.md +6 -0
  129. package/corpus/templates/design/.agents/skills/visual-edit/SKILL.md +83 -47
  130. package/corpus/templates/design/.generated/bridge/editor-chrome.generated.ts +474 -55
  131. package/corpus/templates/design/.generated/bridge/embedded-wheel.generated.ts +3 -0
  132. package/corpus/templates/design/.generated/bridge/hit-test.generated.ts +18 -1
  133. package/corpus/templates/design/.generated/bridge/source-location.generated.ts +348 -0
  134. package/corpus/templates/design/actions/add-localhost-screens.ts +2 -7
  135. package/corpus/templates/design/actions/apply-visual-edit.ts +7 -1
  136. package/corpus/templates/design/actions/connect-localhost.ts +5 -9
  137. package/corpus/templates/design/actions/create-component.ts +16 -13
  138. package/corpus/templates/design/actions/grant-localhost-write-consent.ts +2 -7
  139. package/corpus/templates/design/actions/list-design-source-capabilities.ts +4 -7
  140. package/corpus/templates/design/actions/list-local-files.ts +26 -50
  141. package/corpus/templates/design/actions/list-localhost-connections.ts +2 -7
  142. package/corpus/templates/design/actions/migrate-board-objects-to-file.ts +2 -2
  143. package/corpus/templates/design/actions/open-visual-edit.ts +234 -135
  144. package/corpus/templates/design/actions/read-local-file.ts +26 -50
  145. package/corpus/templates/design/actions/request-localhost-write-consent.ts +2 -7
  146. package/corpus/templates/design/actions/write-local-file.ts +31 -73
  147. package/corpus/templates/design/app/components/design/DesignCanvas.tsx +307 -133
  148. package/corpus/templates/design/app/components/design/EditPanel.tsx +94 -22
  149. package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +137 -60
  150. package/corpus/templates/design/app/components/design/ResponsiveInteractBar.tsx +75 -14
  151. package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +755 -97
  152. package/corpus/templates/design/app/components/design/bridge/embedded-wheel.bridge.ts +8 -0
  153. package/corpus/templates/design/app/components/design/bridge/hit-test.bridge.ts +24 -1
  154. package/corpus/templates/design/app/components/design/bridge/source-location.bridge.ts +530 -0
  155. package/corpus/templates/design/app/components/design/code-workbench/CodeWorkbenchLoader.tsx +278 -0
  156. package/corpus/templates/design/app/components/design/code-workbench/editor/MonacoHost.tsx +32 -12
  157. package/corpus/templates/design/app/components/design/code-workbench/editor/monaco-setup.ts +14 -3
  158. package/corpus/templates/design/app/components/design/code-workbench/explorer/ExplorerView.tsx +87 -24
  159. package/corpus/templates/design/app/components/design/code-workbench/explorer/FileTree.tsx +36 -0
  160. package/corpus/templates/design/app/components/design/code-workbench/store.tsx +2 -1
  161. package/corpus/templates/design/app/components/design/code-workbench/workspace/localhost-provider.ts +48 -8
  162. package/corpus/templates/design/app/components/design/design-canvas/content-size-report.ts +3 -13
  163. package/corpus/templates/design/app/components/design/design-canvas/embedded-frame.ts +4 -2
  164. package/corpus/templates/design/app/components/design/design-canvas/hit-test.ts +3 -13
  165. package/corpus/templates/design/app/components/design/edit-panel/element-classification.ts +3 -1
  166. package/corpus/templates/design/app/components/design/edit-panel/inspect-code-source.ts +93 -0
  167. package/corpus/templates/design/app/components/design/multi-screen/board-surface-html.ts +4 -2
  168. package/corpus/templates/design/app/components/design/multi-screen/cross-screen-drop.ts +35 -0
  169. package/corpus/templates/design/app/components/design/multi-screen/iframe-targeting.ts +24 -0
  170. package/corpus/templates/design/app/components/design/multi-screen/types.ts +9 -0
  171. package/corpus/templates/design/app/components/design/types.ts +29 -0
  172. package/corpus/templates/design/app/components/layout/Layout.tsx +7 -4
  173. package/corpus/templates/design/app/hooks/use-navigation-state.ts +3 -0
  174. package/corpus/templates/design/app/i18n-data.ts +153 -46
  175. package/corpus/templates/design/app/i18n-responsive-interact.ts +12 -12
  176. package/corpus/templates/design/app/lib/design-editor-route.ts +23 -0
  177. package/corpus/templates/design/app/pages/VisualEdit.tsx +19 -6
  178. package/corpus/templates/design/app/pages/design-editor/action-error.ts +19 -0
  179. package/corpus/templates/design/app/pages/design-editor/canvas-primitive-insert.ts +29 -0
  180. package/corpus/templates/design/app/pages/design-editor/clone-and-pen-edit.ts +6 -0
  181. package/corpus/templates/design/app/pages/design-editor/code-layer-state.ts +277 -15
  182. package/corpus/templates/design/app/pages/design-editor/editor-state.ts +75 -9
  183. package/corpus/templates/design/app/pages/design-editor/layer-state-scope.ts +28 -0
  184. package/corpus/templates/design/app/pages/design-editor/live-screen-layer-drop.ts +41 -0
  185. package/corpus/templates/design/app/pages/design-editor/pending-edits.ts +496 -41
  186. package/corpus/templates/design/app/pages/design-editor/pending-live-edit-unload-guard.ts +27 -0
  187. package/corpus/templates/design/app/pages/design-editor/pending-structure-verification.ts +10 -0
  188. package/corpus/templates/design/app/pages/design-editor/react-semantic-handoff.ts +168 -9
  189. package/corpus/templates/design/app/pages/design-editor/responsive-interact.ts +41 -3
  190. package/corpus/templates/design/app/pages/design-editor/screen-command-utils.ts +5 -0
  191. package/corpus/templates/design/app/pages/design-editor/selection-state.ts +42 -13
  192. package/corpus/templates/design/app/pages/design-editor/source-location.ts +180 -0
  193. package/corpus/templates/design/app/pages/design-editor/tool-state.ts +17 -0
  194. package/corpus/templates/design/app/public-routes.ts +1 -0
  195. package/corpus/templates/design/app/routes/visual-edit.$id.tsx +15 -0
  196. package/corpus/templates/design/changelog/2026-06-29-screen-overview-is-easier-to-find-and-named-screens-open-dir.md +1 -1
  197. package/corpus/templates/design/changelog/2026-07-28-deleting-a-selected-element-now-removes-it-from-the-live-pre.md +6 -0
  198. package/corpus/templates/design/changelog/2026-07-28-deleting-an-element-on-a-connected-localhost-screen-now-queu.md +6 -0
  199. package/corpus/templates/design/changelog/2026-07-28-interact-mode-now-shows-a-responsive-device-preview-with-pre.md +6 -0
  200. package/corpus/templates/design/changelog/2026-07-28-layer-hide-and-lock-now-apply-to-the-live-preview-instead-of.md +6 -0
  201. package/corpus/templates/design/changelog/2026-07-28-layers-panel-selections-on-a-connected-localhost-screen-can-.md +6 -0
  202. package/corpus/templates/design/changelog/2026-07-28-locked-layers-now-show-a-subtle-dashed-outline-in-the-live-p.md +6 -0
  203. package/corpus/templates/design/changelog/2026-07-28-the-apply-design-updates-button-now-counts-pending-live-text.md +6 -0
  204. package/corpus/templates/design/changelog/2026-07-28-the-design-canvas-no-longer-stalls-on-a-render-loop-while-a-.md +6 -0
  205. package/corpus/templates/design/changelog/2026-07-28-visual-edit-on-a-local-dev-server-no-longer-requires-signing.md +6 -0
  206. package/corpus/templates/design/changelog/2026-07-28-visual-edits-on-a-react-19-app-no-longer-report-a-source-lin.md +6 -0
  207. package/corpus/templates/design/changelog/2026-07-29-an-edit-that-cannot-be-written-to-source-now-names-the-reaso.md +6 -0
  208. package/corpus/templates/design/changelog/2026-07-29-applying-a-primitive-dropped-onto-a-connected-localhost-scre.md +6 -0
  209. package/corpus/templates/design/changelog/2026-07-29-changing-a-style-in-the-inspector-now-updates-a-connected-lo.md +6 -0
  210. package/corpus/templates/design/changelog/2026-07-29-choosing-edit-or-annotate-from-a-focused-screen-now-returns-.md +6 -0
  211. package/corpus/templates/design/changelog/2026-07-29-concurrent-source-edits-now-return-a-clear-conflict-response.md +6 -0
  212. package/corpus/templates/design/changelog/2026-07-29-creating-a-component-from-an-element-that-repeats-in-the-sou.md +6 -0
  213. package/corpus/templates/design/changelog/2026-07-29-deleting-an-element-you-just-dropped-onto-a-live-screen-no-l.md +6 -0
  214. package/corpus/templates/design/changelog/2026-07-29-dragging-a-layer-across-screens-no-longer-dies-when-the-poin.md +6 -0
  215. package/corpus/templates/design/changelog/2026-07-29-dragging-an-element-from-a-stored-screen-into-a-live-localho.md +6 -0
  216. package/corpus/templates/design/changelog/2026-07-29-drawing-a-box-on-the-canvas-and-dragging-it-into-a-connected.md +6 -0
  217. package/corpus/templates/design/changelog/2026-07-29-fixed-a-loading-screen-flicker-when-reopening-designs-with-a.md +6 -0
  218. package/corpus/templates/design/changelog/2026-07-29-interact-mode-has-edit-and-annotate-buttons-again-so-you-can.md +6 -0
  219. package/corpus/templates/design/changelog/2026-07-29-layer-groups-can-be-dropped-onto-live-localhost-screens.md +6 -0
  220. package/corpus/templates/design/changelog/2026-07-29-localhost-source-errors-now-say-what-actually-went-wrong-whi.md +6 -0
  221. package/corpus/templates/design/changelog/2026-07-29-opening-or-refreshing-a-live-localhost-screen-in-single-scre.md +6 -0
  222. package/corpus/templates/design/changelog/2026-07-29-redo-after-undoing-a-drop-onto-a-live-screen-puts-the-elemen.md +6 -0
  223. package/corpus/templates/design/changelog/2026-07-29-shapes-can-be-drawn-directly-onto-live-localhost-screens.md +6 -0
  224. package/corpus/templates/design/changelog/2026-07-29-shapes-drawn-on-the-canvas-board-now-appear-immediately-inst.md +6 -0
  225. package/corpus/templates/design/changelog/2026-07-29-style-edits-on-a-running-localhost-screen-now-preview-live-a.md +6 -0
  226. package/corpus/templates/design/changelog/2026-07-29-the-apply-design-updates-control-now-appears-as-a-clean-conn.md +6 -0
  227. package/corpus/templates/design/changelog/2026-07-29-visual-edits-on-a-mapped-component-instance-now-tell-the-age.md +6 -0
  228. package/corpus/templates/design/server/lib/design-data-access.ts +21 -7
  229. package/corpus/templates/design/server/lib/localhost-connection.ts +240 -0
  230. package/corpus/templates/design/server/routes/[...page].get.ts +2 -5
  231. package/corpus/templates/design/server/source-workspace.ts +2 -0
  232. package/corpus/templates/design/shared/code-layer.ts +43 -0
  233. package/corpus/templates/design/shared/html-content.ts +26 -0
  234. package/corpus/templates/design/shared/html-integrity.ts +21 -1
  235. package/corpus/templates/design/shared/local-jsx-visual-edit.ts +15 -0
  236. package/corpus/templates/design/shared/source-mode.ts +76 -0
  237. package/corpus/templates/dispatch/changelog/2026-07-29-workspace-members-without-admin-access-now-see-a-clear-permi.md +6 -0
  238. package/corpus/templates/dispatch/server/lib/usage-metrics.ts +2 -1
  239. package/corpus/templates/plan/app/lib/plan-annotation-runtime.ts +3 -4
  240. package/corpus/templates/plan/server/routes/[...page].get.ts +2 -5
  241. package/corpus/templates/slides/actions/patch-deck.ts +29 -17
  242. package/corpus/toolkit/CHANGELOG.md +6 -0
  243. package/corpus/toolkit/package.json +1 -1
  244. package/corpus/toolkit/src/composer/ComposerPlusMenu.tsx +3 -2
  245. package/dist/action-ui.d.ts +1 -0
  246. package/dist/action-ui.d.ts.map +1 -1
  247. package/dist/action-ui.js +1 -0
  248. package/dist/action-ui.js.map +1 -1
  249. package/dist/action.d.ts +5 -1
  250. package/dist/action.d.ts.map +1 -1
  251. package/dist/action.js.map +1 -1
  252. package/dist/agent/engine/ai-sdk-engine.d.ts.map +1 -1
  253. package/dist/agent/engine/ai-sdk-engine.js +13 -5
  254. package/dist/agent/engine/ai-sdk-engine.js.map +1 -1
  255. package/dist/agent/harness/runner.d.ts.map +1 -1
  256. package/dist/agent/harness/runner.js +5 -0
  257. package/dist/agent/harness/runner.js.map +1 -1
  258. package/dist/agent/production-agent.d.ts +16 -0
  259. package/dist/agent/production-agent.d.ts.map +1 -1
  260. package/dist/agent/production-agent.js +18 -1
  261. package/dist/agent/production-agent.js.map +1 -1
  262. package/dist/agent/run-loop-with-resume.d.ts.map +1 -1
  263. package/dist/agent/run-loop-with-resume.js +6 -0
  264. package/dist/agent/run-loop-with-resume.js.map +1 -1
  265. package/dist/agent/run-manager.d.ts +14 -0
  266. package/dist/agent/run-manager.d.ts.map +1 -1
  267. package/dist/agent/run-manager.js +91 -1
  268. package/dist/agent/run-manager.js.map +1 -1
  269. package/dist/agent/thread-data-builder.d.ts +3 -0
  270. package/dist/agent/thread-data-builder.d.ts.map +1 -1
  271. package/dist/agent/thread-data-builder.js +35 -3
  272. package/dist/agent/thread-data-builder.js.map +1 -1
  273. package/dist/agent/types.d.ts +2 -0
  274. package/dist/agent/types.d.ts.map +1 -1
  275. package/dist/agent/types.js.map +1 -1
  276. package/dist/chat-threads/store.d.ts.map +1 -1
  277. package/dist/chat-threads/store.js +4 -6
  278. package/dist/chat-threads/store.js.map +1 -1
  279. package/dist/cli/create.d.ts +66 -6
  280. package/dist/cli/create.d.ts.map +1 -1
  281. package/dist/cli/create.js +765 -66
  282. package/dist/cli/create.js.map +1 -1
  283. package/dist/cli/design-connect.d.ts.map +1 -1
  284. package/dist/cli/design-connect.js +2 -7
  285. package/dist/cli/design-connect.js.map +1 -1
  286. package/dist/cli/index.js +5 -3
  287. package/dist/cli/index.js.map +1 -1
  288. package/dist/cli/skills-content/design-visual-edit-skill.d.ts +1 -1
  289. package/dist/cli/skills-content/design-visual-edit-skill.d.ts.map +1 -1
  290. package/dist/cli/skills-content/design-visual-edit-skill.js +83 -47
  291. package/dist/cli/skills-content/design-visual-edit-skill.js.map +1 -1
  292. package/dist/client/AssistantChat.d.ts.map +1 -1
  293. package/dist/client/AssistantChat.js +16 -9
  294. package/dist/client/AssistantChat.js.map +1 -1
  295. package/dist/client/agent-chat-adapter.d.ts.map +1 -1
  296. package/dist/client/agent-chat-adapter.js +21 -0
  297. package/dist/client/agent-chat-adapter.js.map +1 -1
  298. package/dist/client/blocks/library/wireframe-kit.d.ts +2 -0
  299. package/dist/client/blocks/library/wireframe-kit.d.ts.map +1 -1
  300. package/dist/client/blocks/library/wireframe-kit.js +8 -2
  301. package/dist/client/blocks/library/wireframe-kit.js.map +1 -1
  302. package/dist/client/chat/index.d.ts +1 -1
  303. package/dist/client/chat/index.d.ts.map +1 -1
  304. package/dist/client/chat/index.js +1 -1
  305. package/dist/client/chat/index.js.map +1 -1
  306. package/dist/client/chat/message-components.d.ts +17 -0
  307. package/dist/client/chat/message-components.d.ts.map +1 -1
  308. package/dist/client/chat/message-components.js +24 -2
  309. package/dist/client/chat/message-components.js.map +1 -1
  310. package/dist/client/chat/run-recovery.d.ts +6 -0
  311. package/dist/client/chat/run-recovery.d.ts.map +1 -1
  312. package/dist/client/chat/run-recovery.js +13 -3
  313. package/dist/client/chat/run-recovery.js.map +1 -1
  314. package/dist/client/chat/widgets/DataTableWidget.d.ts.map +1 -1
  315. package/dist/client/chat/widgets/DataTableWidget.js +2 -3
  316. package/dist/client/chat/widgets/DataTableWidget.js.map +1 -1
  317. package/dist/client/chat/widgets/WorkspaceFileWidget.d.ts +5 -0
  318. package/dist/client/chat/widgets/WorkspaceFileWidget.d.ts.map +1 -0
  319. package/dist/client/chat/widgets/WorkspaceFileWidget.js +34 -0
  320. package/dist/client/chat/widgets/WorkspaceFileWidget.js.map +1 -0
  321. package/dist/client/chat/widgets/builtin-tool-renderers.d.ts.map +1 -1
  322. package/dist/client/chat/widgets/builtin-tool-renderers.js +13 -1
  323. package/dist/client/chat/widgets/builtin-tool-renderers.js.map +1 -1
  324. package/dist/client/chat/widgets/workspace-file-result.d.ts +12 -0
  325. package/dist/client/chat/widgets/workspace-file-result.d.ts.map +1 -0
  326. package/dist/client/chat/widgets/workspace-file-result.js +34 -0
  327. package/dist/client/chat/widgets/workspace-file-result.js.map +1 -0
  328. package/dist/client/embed-auth.d.ts.map +1 -1
  329. package/dist/client/embed-auth.js +2 -1
  330. package/dist/client/embed-auth.js.map +1 -1
  331. package/dist/client/org/InvitationBanner.d.ts +5 -2
  332. package/dist/client/org/InvitationBanner.d.ts.map +1 -1
  333. package/dist/client/org/InvitationBanner.js +9 -2
  334. package/dist/client/org/InvitationBanner.js.map +1 -1
  335. package/dist/client/org/OrgSwitcher.d.ts.map +1 -1
  336. package/dist/client/org/OrgSwitcher.js +3 -2
  337. package/dist/client/org/OrgSwitcher.js.map +1 -1
  338. package/dist/client/org/TeamPage.d.ts.map +1 -1
  339. package/dist/client/org/TeamPage.js +27 -3
  340. package/dist/client/org/TeamPage.js.map +1 -1
  341. package/dist/client/org/WorkspaceNotice.d.ts +18 -0
  342. package/dist/client/org/WorkspaceNotice.d.ts.map +1 -0
  343. package/dist/client/org/WorkspaceNotice.js +56 -0
  344. package/dist/client/org/WorkspaceNotice.js.map +1 -0
  345. package/dist/client/org/hooks.d.ts +1 -0
  346. package/dist/client/org/hooks.d.ts.map +1 -1
  347. package/dist/client/org/hooks.js +12 -0
  348. package/dist/client/org/hooks.js.map +1 -1
  349. package/dist/client/org/index.d.ts +2 -1
  350. package/dist/client/org/index.d.ts.map +1 -1
  351. package/dist/client/org/index.js +2 -1
  352. package/dist/client/org/index.js.map +1 -1
  353. package/dist/client/resources/McpIntegrationDialog.d.ts.map +1 -1
  354. package/dist/client/resources/McpIntegrationDialog.js +8 -12
  355. package/dist/client/resources/McpIntegrationDialog.js.map +1 -1
  356. package/dist/client/resources/ResourcesPanel.d.ts +3 -0
  357. package/dist/client/resources/ResourcesPanel.d.ts.map +1 -1
  358. package/dist/client/resources/ResourcesPanel.js +49 -20
  359. package/dist/client/resources/ResourcesPanel.js.map +1 -1
  360. package/dist/client/resources/mcp-integration-catalog.d.ts +1 -0
  361. package/dist/client/resources/mcp-integration-catalog.d.ts.map +1 -1
  362. package/dist/client/resources/mcp-integration-catalog.js +3 -0
  363. package/dist/client/resources/mcp-integration-catalog.js.map +1 -1
  364. package/dist/client/resources/use-resources.d.ts +1 -0
  365. package/dist/client/resources/use-resources.d.ts.map +1 -1
  366. package/dist/client/resources/use-resources.js +3 -0
  367. package/dist/client/resources/use-resources.js.map +1 -1
  368. package/dist/client/use-action.d.ts +3 -1
  369. package/dist/client/use-action.d.ts.map +1 -1
  370. package/dist/client/use-action.js +3 -1
  371. package/dist/client/use-action.js.map +1 -1
  372. package/dist/client/widgets/index.d.ts +1 -1
  373. package/dist/client/widgets/index.d.ts.map +1 -1
  374. package/dist/client/widgets/index.js +1 -1
  375. package/dist/client/widgets/index.js.map +1 -1
  376. package/dist/coding-tools/run-code.js +2 -1
  377. package/dist/coding-tools/run-code.js.map +1 -1
  378. package/dist/collab/awareness.d.ts +2 -2
  379. package/dist/collab/awareness.d.ts.map +1 -1
  380. package/dist/db/client.d.ts +1 -0
  381. package/dist/db/client.d.ts.map +1 -1
  382. package/dist/db/client.js +24 -3
  383. package/dist/db/client.js.map +1 -1
  384. package/dist/deploy/build.d.ts.map +1 -1
  385. package/dist/deploy/build.js +25 -3
  386. package/dist/deploy/build.js.map +1 -1
  387. package/dist/eject/remote-mcp-presets.js +1 -1
  388. package/dist/eject/remote-mcp-presets.js.map +1 -1
  389. package/dist/index.browser.d.ts +1 -1
  390. package/dist/index.browser.d.ts.map +1 -1
  391. package/dist/index.browser.js +1 -1
  392. package/dist/index.browser.js.map +1 -1
  393. package/dist/index.d.ts +1 -1
  394. package/dist/index.d.ts.map +1 -1
  395. package/dist/index.js +1 -1
  396. package/dist/index.js.map +1 -1
  397. package/dist/integrations/google-docs-poller.d.ts.map +1 -1
  398. package/dist/integrations/google-docs-poller.js +4 -1
  399. package/dist/integrations/google-docs-poller.js.map +1 -1
  400. package/dist/integrations/webhook-handler.d.ts.map +1 -1
  401. package/dist/integrations/webhook-handler.js +23 -11
  402. package/dist/integrations/webhook-handler.js.map +1 -1
  403. package/dist/jobs/scheduler.js +4 -0
  404. package/dist/jobs/scheduler.js.map +1 -1
  405. package/dist/localization/default-messages.d.ts +3 -2
  406. package/dist/localization/default-messages.d.ts.map +1 -1
  407. package/dist/localization/default-messages.js +3 -2
  408. package/dist/localization/default-messages.js.map +1 -1
  409. package/dist/notifications/routes.d.ts +1 -1
  410. package/dist/observability/routes.d.ts +3 -3
  411. package/dist/observability/traces.d.ts.map +1 -1
  412. package/dist/observability/traces.js +27 -7
  413. package/dist/observability/traces.js.map +1 -1
  414. package/dist/org/handlers.d.ts +15 -0
  415. package/dist/org/handlers.d.ts.map +1 -1
  416. package/dist/org/handlers.js +45 -1
  417. package/dist/org/handlers.js.map +1 -1
  418. package/dist/org/migrations.d.ts.map +1 -1
  419. package/dist/org/migrations.js +4 -0
  420. package/dist/org/migrations.js.map +1 -1
  421. package/dist/org/plugin.d.ts +1 -0
  422. package/dist/org/plugin.d.ts.map +1 -1
  423. package/dist/org/plugin.js +10 -1
  424. package/dist/org/plugin.js.map +1 -1
  425. package/dist/org/schema.d.ts +19 -0
  426. package/dist/org/schema.d.ts.map +1 -1
  427. package/dist/org/schema.js +1 -0
  428. package/dist/org/schema.js.map +1 -1
  429. package/dist/org/types.d.ts +8 -0
  430. package/dist/org/types.d.ts.map +1 -1
  431. package/dist/org/types.js.map +1 -1
  432. package/dist/org/workspace-url.d.ts +32 -0
  433. package/dist/org/workspace-url.d.ts.map +1 -0
  434. package/dist/org/workspace-url.js +63 -0
  435. package/dist/org/workspace-url.js.map +1 -0
  436. package/dist/progress/routes.d.ts +1 -1
  437. package/dist/provider-api/actions/custom-provider-registration.d.ts +11 -11
  438. package/dist/provider-api/actions/provider-api.d.ts +7 -7
  439. package/dist/resources/handlers.d.ts +2 -3
  440. package/dist/resources/handlers.d.ts.map +1 -1
  441. package/dist/resources/handlers.js +25 -5
  442. package/dist/resources/handlers.js.map +1 -1
  443. package/dist/scripts/runner.d.ts +17 -0
  444. package/dist/scripts/runner.d.ts.map +1 -1
  445. package/dist/scripts/runner.js +130 -5
  446. package/dist/scripts/runner.js.map +1 -1
  447. package/dist/server/action-routes.d.ts.map +1 -1
  448. package/dist/server/action-routes.js +24 -2
  449. package/dist/server/action-routes.js.map +1 -1
  450. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  451. package/dist/server/agent-chat-plugin.js +26 -1
  452. package/dist/server/agent-chat-plugin.js.map +1 -1
  453. package/dist/server/agent-teams.d.ts.map +1 -1
  454. package/dist/server/agent-teams.js +10 -1
  455. package/dist/server/agent-teams.js.map +1 -1
  456. package/dist/server/auth.d.ts +22 -0
  457. package/dist/server/auth.d.ts.map +1 -1
  458. package/dist/server/auth.js +33 -7
  459. package/dist/server/auth.js.map +1 -1
  460. package/dist/server/embed-route.d.ts.map +1 -1
  461. package/dist/server/embed-route.js +6 -1
  462. package/dist/server/embed-route.js.map +1 -1
  463. package/dist/server/embed-session.d.ts +7 -0
  464. package/dist/server/embed-session.d.ts.map +1 -1
  465. package/dist/server/embed-session.js +46 -4
  466. package/dist/server/embed-session.js.map +1 -1
  467. package/dist/server/open-route.d.ts.map +1 -1
  468. package/dist/server/open-route.js +17 -7
  469. package/dist/server/open-route.js.map +1 -1
  470. package/dist/server/prompts/framework-core-compact.js +1 -1
  471. package/dist/server/prompts/framework-core-compact.js.map +1 -1
  472. package/dist/server/prompts/framework-core.d.ts.map +1 -1
  473. package/dist/server/prompts/framework-core.js +1 -0
  474. package/dist/server/prompts/framework-core.js.map +1 -1
  475. package/dist/server/realtime-token.d.ts +1 -1
  476. package/dist/server/request-context.d.ts +26 -0
  477. package/dist/server/request-context.d.ts.map +1 -1
  478. package/dist/server/request-context.js +18 -1
  479. package/dist/server/request-context.js.map +1 -1
  480. package/dist/server/transcribe-voice.d.ts +1 -1
  481. package/dist/shared/embed-auth.d.ts +1 -0
  482. package/dist/shared/embed-auth.d.ts.map +1 -1
  483. package/dist/shared/embed-auth.js +1 -0
  484. package/dist/shared/embed-auth.js.map +1 -1
  485. package/dist/shared/html-document.d.ts +12 -0
  486. package/dist/shared/html-document.d.ts.map +1 -0
  487. package/dist/shared/html-document.js +92 -0
  488. package/dist/shared/html-document.js.map +1 -0
  489. package/dist/shared/index.d.ts +1 -0
  490. package/dist/shared/index.d.ts.map +1 -1
  491. package/dist/shared/index.js +1 -0
  492. package/dist/shared/index.js.map +1 -1
  493. package/dist/sharing/access.d.ts +1 -0
  494. package/dist/sharing/access.d.ts.map +1 -1
  495. package/dist/sharing/access.js +8 -2
  496. package/dist/sharing/access.js.map +1 -1
  497. package/dist/sharing/registry.d.ts +3 -0
  498. package/dist/sharing/registry.d.ts.map +1 -1
  499. package/dist/sharing/registry.js.map +1 -1
  500. package/dist/workspace-files/actions.d.ts +28 -0
  501. package/dist/workspace-files/actions.d.ts.map +1 -0
  502. package/dist/workspace-files/actions.js +75 -0
  503. package/dist/workspace-files/actions.js.map +1 -0
  504. package/dist/workspace-files/tool.d.ts.map +1 -1
  505. package/dist/workspace-files/tool.js +4 -0
  506. package/dist/workspace-files/tool.js.map +1 -1
  507. package/docs/content/cloneable-saas.mdx +114 -0
  508. package/docs/content/creating-templates.mdx +28 -2
  509. package/docs/content/syncing-template-changes.mdx +7 -0
  510. package/docs/content/template-clips-developers.mdx +12 -5
  511. package/docs/content/template-dispatch-developers.mdx +1 -1
  512. package/docs/content/template-dispatch.mdx +1 -1
  513. package/package.json +2 -2
  514. package/src/action-ui.ts +1 -0
  515. package/src/action.ts +5 -1
  516. package/src/agent/engine/ai-sdk-engine.ts +15 -5
  517. package/src/agent/harness/runner.ts +5 -0
  518. package/src/agent/production-agent.ts +33 -0
  519. package/src/agent/run-loop-with-resume.ts +5 -0
  520. package/src/agent/run-manager.ts +126 -1
  521. package/src/agent/thread-data-builder.ts +47 -2
  522. package/src/agent/types.ts +2 -0
  523. package/src/chat-threads/store.ts +4 -5
  524. package/src/cli/create.ts +1139 -65
  525. package/src/cli/design-connect.ts +3 -7
  526. package/src/cli/index.ts +5 -3
  527. package/src/cli/skills-content/design-visual-edit-skill.ts +83 -47
  528. package/src/client/AssistantChat.tsx +27 -16
  529. package/src/client/agent-chat-adapter.ts +24 -0
  530. package/src/client/blocks/library/wireframe-kit.tsx +17 -2
  531. package/src/client/chat/index.ts +1 -0
  532. package/src/client/chat/message-components.tsx +104 -1
  533. package/src/client/chat/run-recovery.tsx +15 -3
  534. package/src/client/chat/widgets/DataTableWidget.tsx +10 -29
  535. package/src/client/chat/widgets/WorkspaceFileWidget.tsx +71 -0
  536. package/src/client/chat/widgets/builtin-tool-renderers.tsx +22 -0
  537. package/src/client/chat/widgets/workspace-file-result.ts +49 -0
  538. package/src/client/embed-auth.ts +2 -0
  539. package/src/client/org/InvitationBanner.tsx +14 -1
  540. package/src/client/org/OrgSwitcher.tsx +23 -0
  541. package/src/client/org/TeamPage.tsx +130 -0
  542. package/src/client/org/WorkspaceNotice.tsx +85 -0
  543. package/src/client/org/hooks.ts +14 -0
  544. package/src/client/org/index.ts +2 -0
  545. package/src/client/resources/McpIntegrationDialog.tsx +27 -40
  546. package/src/client/resources/ResourcesPanel.tsx +134 -51
  547. package/src/client/resources/mcp-integration-catalog.ts +7 -0
  548. package/src/client/resources/use-resources.ts +6 -0
  549. package/src/client/use-action.ts +3 -1
  550. package/src/client/widgets/index.ts +1 -0
  551. package/src/coding-tools/run-code.ts +2 -1
  552. package/src/db/client.ts +28 -4
  553. package/src/deploy/build.ts +31 -3
  554. package/src/eject/remote-mcp-presets.ts +1 -1
  555. package/src/index.browser.ts +1 -0
  556. package/src/index.ts +1 -0
  557. package/src/integrations/google-docs-poller.ts +3 -0
  558. package/src/integrations/webhook-handler.ts +28 -11
  559. package/src/jobs/scheduler.ts +4 -0
  560. package/src/localization/default-messages.ts +3 -2
  561. package/src/observability/traces.ts +48 -12
  562. package/src/org/handlers.ts +52 -1
  563. package/src/org/migrations.ts +4 -0
  564. package/src/org/plugin.ts +14 -0
  565. package/src/org/schema.ts +1 -0
  566. package/src/org/types.ts +8 -0
  567. package/src/org/workspace-url.ts +74 -0
  568. package/src/resources/handlers.ts +35 -5
  569. package/src/scripts/runner.ts +183 -5
  570. package/src/server/__snapshots__/agent-chat-plugin.surface.spec.ts.snap +2 -1
  571. package/src/server/action-routes.ts +32 -2
  572. package/src/server/agent-chat-plugin.ts +29 -0
  573. package/src/server/agent-teams.ts +10 -1
  574. package/src/server/auth.ts +33 -7
  575. package/src/server/embed-route.ts +9 -0
  576. package/src/server/embed-session.ts +62 -3
  577. package/src/server/open-route.ts +20 -6
  578. package/src/server/prompts/framework-core-compact.ts +1 -1
  579. package/src/server/prompts/framework-core.ts +1 -0
  580. package/src/server/request-context.ts +36 -1
  581. package/src/shared/embed-auth.ts +1 -0
  582. package/src/shared/html-document.ts +115 -0
  583. package/src/shared/index.ts +1 -0
  584. package/src/sharing/access.ts +8 -1
  585. package/src/sharing/registry.ts +11 -2
  586. package/src/workspace-files/actions.ts +100 -0
  587. package/src/workspace-files/tool.ts +4 -0
  588. package/corpus/templates/design/changelog/2026-07-28-interact-mode-can-preview-designs-in-responsive-device-sizes.md +0 -6
  589. package/corpus/templates/design/changelog/2026-07-28-interact-mode-now-opens-a-full-screen-responsive-preview-wit.md +0 -6
@@ -11,6 +11,8 @@ import http, {
11
11
  import https from "node:https";
12
12
  import path from "node:path";
13
13
 
14
+ import { injectDocumentMarkup } from "../shared/html-document.js";
15
+
14
16
  const DEFAULT_BRIDGE_PORT = 7331;
15
17
  const ROUTE_MANIFEST_FILE = path.join(".agent-native", "design-routes.json");
16
18
  const DEFAULT_DEV_SERVER_CANDIDATES = [
@@ -1338,13 +1340,7 @@ function injectLiveEditBridge(
1338
1340
  targetPath,
1339
1341
  );
1340
1342
  if (!script) return withBase;
1341
- if (withBase.includes("</body>")) {
1342
- return withBase.replace("</body>", `${script}</body>`);
1343
- }
1344
- if (withBase.includes("</html>")) {
1345
- return withBase.replace("</html>", `${script}</html>`);
1346
- }
1347
- return `${withBase}${script}`;
1343
+ return injectDocumentMarkup(withBase, script);
1348
1344
  }
1349
1345
 
1350
1346
  /** Read the full request body as a UTF-8 string. */
@@ -1225,7 +1225,8 @@ Usage:
1225
1225
  agent-native typecheck Run TypeScript type checking
1226
1226
  agent-native create [name] Scaffold a new agent-native workspace with a
1227
1227
  multi-select template picker. Use --standalone
1228
- for a single-app scaffold.
1228
+ for a single-app scaffold, or choose Community
1229
+ template to install a public GitHub repository.
1229
1230
  agent-native code Launch Agent-Native Code workspace. Type a task or
1230
1231
  use goals like /migrate and /audit.
1231
1232
  agent-native code serve Run the Agent-Native Code remote connector.
@@ -1310,8 +1311,9 @@ Options:
1310
1311
  -h, --help Show this help message
1311
1312
  -v, --version Show version number
1312
1313
  --template <names> Comma-separated templates to pre-select
1313
- (mail,calendar,analytics,...) or
1314
- github:user/repo for community templates
1314
+ (mail,calendar,analytics,...), or install a
1315
+ community repo from a plain GitHub URL or
1316
+ community:owner/repo[?app=id][#ref]
1315
1317
  --headless Create the primitive-first action-only scaffold
1316
1318
  --standalone Scaffold a single standalone app (no workspace)
1317
1319
  --emit [dir] With migrate, emit an own-agent dossier
@@ -33,18 +33,15 @@ host renders it. The user gets the Design canvas beside the conversation, and
33
33
  current host conversation through the standard MCP Apps message bridge. The
34
34
  host may ask the user to confirm the current conversation or choose a new one.
35
35
 
36
- Otherwise, after \`open-visual-edit\` returns \`openUrl\`, open that URL in the
37
- coding host's inline browser when one is available. This still keeps Design
38
- beside the conversation, but an ordinary browser page has no trusted path into
39
- the host's current composer. In that fallback surface, **Apply design updates**
40
- uses Design's local agent; use **Copy prompt to your agent** to hand the same
41
- structured edit batch to the coding agent.
42
-
43
- - In Codex Desktop, use the in-app Browser tool to open \`openUrl\`. The built-in
44
- browser is the right surface for localhost and public pages that should stay
45
- inside the app.
46
- - In Claude Code Desktop's Code tab, open or preview \`openUrl\` in the Browser
47
- pane. Ask Claude to preview it rather than opening the system browser.
36
+ Otherwise, \`openUrl\` is a credential-free, read-only fallback that is safe to
37
+ show in model text or retain in logs. Do not claim that fallback is editable:
38
+ the edit capability is intentionally available only to the host-managed MCP App
39
+ launcher, where it is hidden from the model and redeemed once.
40
+
41
+ - In Codex Desktop, prefer the rendered MCP App. Use the in-app Browser for the
42
+ credential-free \`openUrl\` only when a read-only fallback is acceptable.
43
+ - In Claude Code Desktop's Code tab, prefer the rendered MCP App. Preview
44
+ \`openUrl\` in the Browser pane only as the read-only fallback.
48
45
  - In VS Code, use the Agent Native Design webview/deep link described below.
49
46
  - Inline browser availability is host-dependent. CLI, remote, or restricted
50
47
  sessions may not expose one. If the inline surface is unavailable or disabled,
@@ -68,24 +65,41 @@ The same action is available from Design's empty-canvas context menu.
68
65
  static DOM snapshot. Editing is direct DOM manipulation against that live
69
66
  document; the parallel \`/snapshot\` fetch feeds the editable source model only
70
67
  and must never be rendered in the frame.
71
- - A viewer holding the connection's \`previewToken\` gets the proxied
72
- \`/live-edit\` document with editor chrome. A viewer without one — a signed-out
73
- session, a public link, or an inline browser with no cookies — gets the plain
74
- dev-server URL: still live, but with no editor chrome, no layers, and no
75
- editing. If the canvas looks right but selection and the layers panel do
76
- nothing, the frame is unbridged; sign in rather than assuming Design is broken.
68
+ - **The \`/visual-edit\` skill needs no Design account sign-in.**
69
+ \`open-visual-edit\` mints a five-minute, single-use capability for the exact
70
+ \`/visual-edit/:designId\` local-editor route. The MCP host redeems it outside
71
+ model-visible text, then opens the existing editor with localhost edit access.
72
+ This capability is not an account session: \`/_agent-native/session\` remains
73
+ signed out, and account-backed save/share/generate actions remain denied.
74
+ - The skill enters through local \`pnpm action open-visual-edit\`. When that CLI
75
+ has no account session, the action uses a stable, workspace-scoped local
76
+ principal to register the bridge, create/reuse the local design, and place
77
+ screens. That principal exists only inside the in-process CLI call; it is not
78
+ a browser login and cannot be selected by an HTTP, MCP, or tunneled caller.
79
+ - Public links are always read-only, including on loopback. Loopback peer
80
+ identity is not an authentication boundary because a tunnel or reverse proxy
81
+ can make a remote request appear local. A bare \`/visual-edit/:designId\` or
82
+ \`/design/:designId\` URL carries no capability and must never release the
83
+ connection's \`previewToken\`.
77
84
  - The live editor is same-origin through the local bridge proxy. This boots
78
85
  CSR apps and root-relative assets, but it is still a localhost editing proxy:
79
86
  app-origin cookies, WebSockets/HMR, SSE, and non-GET app API calls may need a
80
87
  future dev-server/plugin integration for perfect parity with the app's own
81
88
  origin.
82
- - Interact mode renders the app's normal URL so app navigation, scrolling,
83
- links, and form controls behave as they would in the browser.
89
+ - **There are exactly two views.** The infinite canvas is where all editing
90
+ happens, and the responsive interactive view (Interact) is where the app runs
91
+ for real. There is no third "full view"/focused-edit state — clicking a screen
92
+ in the Screens list, or the view toggle, opens the responsive view, and
93
+ closing it returns to the canvas.
94
+ - Interact keeps the left and right rails and adds a device bar above the canvas
95
+ (device preset, editable width/height, zoom, close). It renders the app's
96
+ normal URL so navigation, scrolling, links, and form controls behave as they
97
+ would in the browser, and the wheel scrolls the app rather than panning the
98
+ canvas. The canvas view is the opposite: the wheel pans and zooms it, and
99
+ native interaction inside the frame is suppressed.
84
100
  - While a localhost screen has pending live visual edits, do not switch back to
85
101
  Interact until the user either applies the edits to source or explicitly
86
102
  aborts/discards the preview.
87
- - Start in Design's screen overview mode. In overview, screens are static
88
- design frames; full-screen focus is for scrolling and app interaction.
89
103
  - Alt-drag duplicates a screen. For localhost screens, duplication copies the
90
104
  iframe frame and URL metadata; change the copy's path/query for a new state.
91
105
  - Flow visualization is multiple URL states: \`/checkout?step=shipping\`,
@@ -147,18 +161,26 @@ content. For conversational resolution such as "apply the second one," call
147
161
 
148
162
  ## Account And Sharing Model
149
163
 
150
- - The \`/visual-edit\` entry route can open before the viewer signs in. Public
151
- \`/design/:id\` editor links can also render read-only public designs without a
152
- session.
164
+ - \`/visual-edit/:id\` is the dedicated local-editor surface. The one-time
165
+ handoff returned by \`open-visual-edit\` opens it with edit access without a
166
+ Design login. A copied or bare \`/visual-edit/:id\` URL is read-only because it
167
+ does not carry the capability.
168
+ - The capability permits live iframe inspection and session-local edits,
169
+ undo/redo, **Apply design updates** through the connected host/local agent,
170
+ and **Copy prompt**. Those flows hand bounded source instructions back to the
171
+ coding agent; they do not silently persist account-owned Design data.
172
+ - Public \`/design/:id\` links stay read-only without a signed-in owner/editor
173
+ session. Never use the local capability to upgrade that ordinary sharing
174
+ surface.
153
175
  - Prefer links returned by Design actions or \`/_agent-native/open\` deep links.
154
- Do not surface URLs with \`_session=\` tokens. Query sessions are only a
155
- fallback after normal cookie resolution, so an existing browser session can
156
- still open the design as a different user and show "Design not found".
157
- - Do not attempt anonymous write actions. Bridge registration, design creation,
158
- screen placement, generation, saving, and sharing are account-backed. If a
159
- signed-out visitor wants to save or share, send them through the framework
160
- sign-in return flow, then save or copy the design into that account before
161
- opening the share dialog.
176
+ Do not surface URLs with \`_session=\` tokens or hand-build capability URLs.
177
+ - Do not attempt account-backed write actions with the browser capability. The
178
+ trusted local \`open-visual-edit\` CLI call may register its bridge, create or
179
+ reuse its workspace-owned local design, and place screens without an account.
180
+ Direct source-file action writes, generation, saving into an account, and
181
+ sharing still require an authenticated action caller. If a signed-out visitor
182
+ wants those durable account operations, send them through the framework
183
+ sign-in return flow first.
162
184
 
163
185
  ## Required Local Bridge
164
186
 
@@ -166,7 +188,7 @@ The live-edit bridge is unlocked by a shared secret (the "bridge token") that
166
188
  must match on two sides: the local bridge process, and the user's connection row
167
189
  in Design (which the browser reads to authorize \`/live-edit-bridge\`,
168
190
  \`/read-file\`, \`/write-file\`). Get them to match by letting the
169
- **authenticated** \`open-visual-edit\` action mint the token, then starting the
191
+ \`open-visual-edit\` action mint the token, then starting the
170
192
  bridge with it. This is the only ordering that works for the remote-MCP flow —
171
193
  the bridge cannot push its own token to the server without a CLI auth token, so
172
194
  the server mints instead and the bridge adopts.
@@ -228,7 +250,7 @@ a timeout, check for a stale process (\`lsof -ti:7331\`) before retrying.
228
250
 
229
251
  ## Action Flow
230
252
 
231
- Prefer the single authenticated \`open-visual-edit\` action. It registers or
253
+ Prefer the single \`open-visual-edit\` action. It registers or
232
254
  refreshes the localhost bridge connection, mints and stores the bridge token,
233
255
  creates or reuses a Design project, places URL-backed screens, stores the active
234
256
  visual-edit context, and navigates to overview mode in one call. This avoids
@@ -252,11 +274,13 @@ pnpm action open-visual-edit '{
252
274
  \`\`\`
253
275
 
254
276
  The action returns \`designId\`, \`connectionId\`, \`bridgeToken\`, \`screens\`,
255
- \`urlPath\`, and \`openUrl\`. Keep \`designId\`/\`connectionId\` in the chat context
256
- for follow-ups, and pass \`bridgeToken\` to \`design connect\` (step 3) to start
257
- the bridge. On follow-up calls reusing an existing \`connectionId\`, the same
258
- token is returned (it is minted once and reused), so the running bridge stays
259
- valid.
277
+ \`urlPath\`, and a credential-free \`openUrl\`. Its MCP App metadata separately
278
+ carries the one-time editor launcher so the host can redeem it without showing
279
+ the capability to the model or retaining it in the action link. Keep
280
+ \`designId\`/\`connectionId\` in the chat context for follow-ups, and pass
281
+ \`bridgeToken\` to \`design connect\` (step 3) to start the bridge. On follow-up
282
+ calls reusing an existing \`connectionId\`, the same token is returned (it is
283
+ minted once and reused), so the running bridge stays valid.
260
284
 
261
285
  ### Desktop and mobile side by side
262
286
 
@@ -334,10 +358,11 @@ Fallback, only when \`open-visual-edit\` is unavailable:
334
358
 
335
359
  - Use the \`link\`, \`deepLink\`, or MCP App embed returned by Design actions so
336
360
  the user sees the canvas. Follow **Put Design Beside The Chat**: prefer the
337
- host's inline Browser, preview, or webview panel; otherwise surface the
338
- **Open design** link.
339
- - Return or open the \`openUrl\` / action link, not a hand-built
340
- \`/design/:id?_session=...\` URL.
361
+ MCP App; otherwise surface the credential-free **Open design** link.
362
+ - Return or open the MCP App first. Its host-managed launcher carries the
363
+ one-time local-editor capability. The credential-free \`openUrl\` / action link
364
+ is the safe read-only fallback; never build a capability URL yourself.
365
+ - Never return or open a hand-built \`/design/:id?_session=...\` URL.
341
366
  - If the user is working in VS Code, the Agent Native extension can open the
342
367
  same URL via
343
368
  \`vscode://builder.agent-native/open?url=<encoded-design-url>\`. Its
@@ -407,13 +432,24 @@ the connected app's text/code files through the bridge
407
432
  - Use compiler/debug provenance (project-relative file, line, column,
408
433
  component, and runtime multiplicity) to locate React/TSX source. Treat it as
409
434
  evidence, not as permission for a generic AST structural transform.
435
+ - Read \`positionPrecision\` on every anchor before you trust \`line\`/\`column\`.
436
+ \`authored\` means those are the real JSX coordinates. \`transformed\` means they
437
+ are the dev server's own output coordinates — React 19 removed \`_debugSource\`
438
+ and exposes only an owner stack, so this is the normal case on a Vite/Next
439
+ dev server, and the line will not match the file. \`unknown\` means no tier was
440
+ reported. On anything but \`authored\`, use the file and component to find the
441
+ element by its JSX shape and re-derive the line from the file you read; never
442
+ edit at the reported line.
410
443
  - A single-instance leaf text edit, literal \`className\`/\`class\` edit, or flat
411
444
  literal \`style={{ ... }}\` property may use \`apply-visual-edit\` with a
412
- \`local-file\` source and exact \`target.sourceAnchor\`. Preview first (omit
413
- \`persist\`), inspect \`proposedDiff\`, then call with \`persist: true\`.
445
+ \`local-file\` source and a complete \`target.sourceAnchor\`. Forward the
446
+ anchor's \`positionPrecision\` with it the action refuses a \`transformed\`
447
+ anchor with \`status: "needsAgent"\` instead of seeking to a line that means
448
+ something else in the authored file. Preview first (omit \`persist\`), inspect
449
+ \`proposedDiff\`, then call with \`persist: true\`.
414
450
  - Reparenting, grouping/ungrouping, wrappers, dynamic expressions, repeated
415
451
  \`.map()\` instances, shared components, breakpoint-scoped edits, and
416
- cross-file changes go through the coding agent with exact subject/target
452
+ cross-file changes go through the coding agent with complete subject/target
417
453
  anchors and their runtime relationship. \`apply-visual-edit\` refuses these
418
454
  with \`status: "needsAgent"\` rather than guessing.
419
455
  - Before each write, read the file and pass its exact \`versionHash\` to
@@ -125,6 +125,7 @@ import {
125
125
  getLoopLimitMetadata,
126
126
  getRunErrorMetadata,
127
127
  getRequestModeMetadata,
128
+ runErrorKey,
128
129
  type BuilderSetupCardLayout,
129
130
  type LoopLimitInfo,
130
131
  type RunErrorInfo,
@@ -5118,7 +5119,6 @@ const AssistantChatInner = forwardRef<
5118
5119
  () => ({ apiUrl, devMode: cpDevMode, threadId, checkpointRunIds }),
5119
5120
  [apiUrl, cpDevMode, threadId, checkpointRunIds],
5120
5121
  );
5121
- const messageActionsCtx = useMemo(() => ({ onForkChat }), [onForkChat]);
5122
5122
  const lastMessageLoopLimit = useMemo(() => {
5123
5123
  const last = messages[messages.length - 1];
5124
5124
  if (!last || last.role !== "assistant") return null;
@@ -5133,6 +5133,20 @@ const AssistantChatInner = forwardRef<
5133
5133
  () => latestNonRecoveryUserMessageText(messages),
5134
5134
  [messages],
5135
5135
  );
5136
+ const retryAfterRunError = useCallback(() => {
5137
+ setRunErrorInfo(null);
5138
+ addToQueue(
5139
+ lastUserText
5140
+ ? `Retry the previous request from a clean approach. Do not rerun the exact same failed tool input unless the failure was transient or the user explicitly asked for an exact rerun. If a provider query failed because of schema, syntax, or type mismatch, diagnose the error and adjust the query first.\n\nOriginal request:\n\n${lastUserText}`
5141
+ : "Retry the previous request from a clean approach. Do not rerun the exact same failed tool input unless the failure was transient or the user explicitly asked for an exact rerun. If a provider query failed because of schema, syntax, or type mismatch, diagnose the error and adjust the query first.",
5142
+ undefined,
5143
+ undefined,
5144
+ undefined,
5145
+ undefined,
5146
+ "queued",
5147
+ "retry",
5148
+ );
5149
+ }, [addToQueue, lastUserText]);
5136
5150
  const latestMessageRole = latestMessage?.role;
5137
5151
  const latestAssistantWasPlan =
5138
5152
  latestMessageRole === "assistant" &&
@@ -5166,7 +5180,7 @@ const AssistantChatInner = forwardRef<
5166
5180
  : lastMessageLoopLimit;
5167
5181
  const visibleRunError = runErrorInfo ?? lastMessageRunError;
5168
5182
  const visibleRunErrorKey = visibleRunError
5169
- ? `${visibleRunError.runId ?? ""}:${visibleRunError.errorCode ?? ""}:${visibleRunError.message}`
5183
+ ? runErrorKey(visibleRunError)
5170
5184
  : null;
5171
5185
  const shouldShowRunError =
5172
5186
  !!visibleRunError &&
@@ -5179,6 +5193,16 @@ const AssistantChatInner = forwardRef<
5179
5193
  !visibleRunError.runId ||
5180
5194
  userStoppedRunRef.current.runId === visibleRunError.runId)
5181
5195
  );
5196
+ // The banner covers one run; every failed turn it does not cover keeps its own
5197
+ // inline marker, so a failure stays visible after the next prompt.
5198
+ const messageActionsCtx = useMemo(
5199
+ () => ({
5200
+ onForkChat,
5201
+ onRetryRunError: retryAfterRunError,
5202
+ bannerRunErrorKey: shouldShowRunError ? visibleRunErrorKey : null,
5203
+ }),
5204
+ [onForkChat, retryAfterRunError, shouldShowRunError, visibleRunErrorKey],
5205
+ );
5182
5206
  const hasActiveChatWork =
5183
5207
  showRunningInUI ||
5184
5208
  isAutoResuming ||
@@ -5549,20 +5573,7 @@ const AssistantChatInner = forwardRef<
5549
5573
  "continue",
5550
5574
  );
5551
5575
  }}
5552
- onRetry={() => {
5553
- setRunErrorInfo(null);
5554
- addToQueue(
5555
- lastUserText
5556
- ? `Retry the previous request from a clean approach. Do not rerun the exact same failed tool input unless the failure was transient or the user explicitly asked for an exact rerun. If a provider query failed because of schema, syntax, or type mismatch, diagnose the error and adjust the query first.\n\nOriginal request:\n\n${lastUserText}`
5557
- : "Retry the previous request from a clean approach. Do not rerun the exact same failed tool input unless the failure was transient or the user explicitly asked for an exact rerun. If a provider query failed because of schema, syntax, or type mismatch, diagnose the error and adjust the query first.",
5558
- undefined,
5559
- undefined,
5560
- undefined,
5561
- undefined,
5562
- "queued",
5563
- "retry",
5564
- );
5565
- }}
5576
+ onRetry={retryAfterRunError}
5566
5577
  onFork={onForkChat}
5567
5578
  onDismiss={() => {
5568
5579
  if (visibleRunErrorKey) {
@@ -1611,6 +1611,14 @@ export function createAgentChatAdapter(
1611
1611
  typeof runConfig.custom === "object" &&
1612
1612
  (runConfig.custom as { trackInRunsTray?: unknown }).trackInRunsTray ===
1613
1613
  true;
1614
+ const queuedMessageId = (() => {
1615
+ const raw =
1616
+ runConfig?.custom && typeof runConfig.custom === "object"
1617
+ ? (runConfig.custom as { agentNativeQueuedMessageId?: unknown })
1618
+ .agentNativeQueuedMessageId
1619
+ : undefined;
1620
+ return typeof raw === "string" && raw.trim() ? raw.trim() : undefined;
1621
+ })();
1614
1622
  // Human-in-the-loop approval keys (opt-in `needsApproval` actions). When
1615
1623
  // the user approves a paused tool call, the turn is re-issued with the
1616
1624
  // approval key so the server lets that specific call run.
@@ -1753,6 +1761,12 @@ export function createAgentChatAdapter(
1753
1761
  let lastPreparingToolName: string | undefined;
1754
1762
  let repeatedActionPreparationCount = 0;
1755
1763
  let recoveryGaveUpOnActionPreparation = false;
1764
+ // Set when the turn is stopped by MAX_TOTAL_TRANSIENT_CONTINUATIONS —
1765
+ // the whole-turn continuation ceiling, not a dropped connection. This
1766
+ // can trip on a turn that was making real progress the entire time, so
1767
+ // it needs its own honest message instead of falling through to the
1768
+ // generic "connection kept failing" copy below.
1769
+ let recoveryGaveUpOnTransientBudget = false;
1756
1770
  const continuationHistoryFragments: string[] = [];
1757
1771
  const structuredContinuationFragments: AgentChatStructuredMessage[] = [];
1758
1772
  let visibleContinuationPrefix: ContentPart[] = [];
@@ -1832,6 +1846,9 @@ export function createAgentChatAdapter(
1832
1846
  : " the same action";
1833
1847
  return `The agent got stuck preparing${tool} input and never started the tool, so I stopped the automatic retries. Try a smaller first step or a more compact version of the request.`;
1834
1848
  }
1849
+ if (recoveryGaveUpOnTransientBudget) {
1850
+ return "This turn reached the limit on how many times it can be automatically continued, so I stopped it here. It may have still been making progress — retry as a single, narrower request so it can finish within fewer continuations.";
1851
+ }
1835
1852
  if (
1836
1853
  content.length === 0 &&
1837
1854
  (reason === "run_timeout" ||
@@ -3100,6 +3117,12 @@ export function createAgentChatAdapter(
3100
3117
  stalledTransientContinuationAttempts = madeProgress
3101
3118
  ? 0
3102
3119
  : stalledTransientContinuationAttempts + 1;
3120
+ if (
3121
+ totalTransientContinuationAttempts >
3122
+ MAX_TOTAL_TRANSIENT_CONTINUATIONS
3123
+ ) {
3124
+ recoveryGaveUpOnTransientBudget = true;
3125
+ }
3103
3126
  if (
3104
3127
  stalledTransientContinuationAttempts >
3105
3128
  MAX_STALLED_TRANSIENT_CONTINUATIONS ||
@@ -3190,6 +3213,7 @@ export function createAgentChatAdapter(
3190
3213
  body: JSON.stringify({
3191
3214
  message: currentMessageText,
3192
3215
  displayMessage: userMessageText,
3216
+ ...(queuedMessageId ? { queuedMessageId } : {}),
3193
3217
  history: currentHistory,
3194
3218
  structuredHistory: currentStructuredHistory,
3195
3219
  turnId,
@@ -1496,7 +1496,7 @@ function roundedRectPath(
1496
1496
  h: number,
1497
1497
  r: number,
1498
1498
  ): string {
1499
- const rad = Math.max(0, Math.min(r, w / 2, h / 2));
1499
+ const rad = Math.max(0, Math.min(Number.isFinite(r) ? r : 0, w / 2, h / 2));
1500
1500
  return [
1501
1501
  `M${x + rad},${y}`,
1502
1502
  `H${x + w - rad}`,
@@ -1525,6 +1525,21 @@ export function hasDrawableRoughBounds(
1525
1525
  );
1526
1526
  }
1527
1527
 
1528
+ /** Rough.js recursively flattens paths, so every coordinate must be finite. */
1529
+ export function hasDrawableRoughGeometry(
1530
+ x: number,
1531
+ y: number,
1532
+ width: number,
1533
+ height: number,
1534
+ inset: number,
1535
+ ): boolean {
1536
+ return (
1537
+ Number.isFinite(x) &&
1538
+ Number.isFinite(y) &&
1539
+ hasDrawableRoughBounds(width, height, inset)
1540
+ );
1541
+ }
1542
+
1528
1543
  function elementStroke(node: Element, fallback: string): string {
1529
1544
  const explicit = readVar(node, "--rough-stroke");
1530
1545
  if (explicit) return explicit;
@@ -1661,7 +1676,7 @@ function build(
1661
1676
  const y = (r.top - base.top) / zoom;
1662
1677
  const w = r.width / zoom;
1663
1678
  const h = r.height / zoom;
1664
- if (!hasDrawableRoughBounds(w, h, 1)) return;
1679
+ if (!hasDrawableRoughGeometry(x, y, w, h, 1)) return;
1665
1680
  const kind = inferRoughKind(node);
1666
1681
  const rawStroke = elementStroke(node, sketch);
1667
1682
  const stroke =
@@ -101,6 +101,7 @@ export {
101
101
  ACTION_CHAT_UI_DATA_TABLE_RENDERER,
102
102
  ACTION_CHAT_UI_DATA_WIDGET_RENDERER,
103
103
  ACTION_CHAT_UI_INLINE_EXTENSION_RENDERER,
104
+ ACTION_CHAT_UI_WORKSPACE_FILE_RENDERER,
104
105
  type ActionChatUIConfig,
105
106
  } from "../../action-ui.js";
106
107
  export {
@@ -75,6 +75,12 @@ import {
75
75
  renderMarkdownToClipboardHtml,
76
76
  } from "./markdown-renderer.js";
77
77
  import { getAssistantRunDurationMs } from "./repo-helpers.js";
78
+ import {
79
+ getRunErrorMetadata,
80
+ runErrorHeadline,
81
+ runErrorKey,
82
+ type RunErrorInfo,
83
+ } from "./run-recovery.js";
78
84
  import {
79
85
  ToolCallFallback,
80
86
  ToolActivityPresentation,
@@ -82,6 +88,7 @@ import {
82
88
  ASSISTANT_VISIBLE_TOOL_CALL_LIMIT,
83
89
  ChatRunningContext,
84
90
  ChatRunDurationContext,
91
+ formatWorkedDuration,
85
92
  RanToolsSummary,
86
93
  ReasoningCell,
87
94
  WorkedForSummary,
@@ -294,6 +301,13 @@ export const CheckpointContext = React.createContext<{
294
301
 
295
302
  export const MessageActionsContext = React.createContext<{
296
303
  onForkChat?: () => void | boolean | Promise<void | boolean>;
304
+ onRetryRunError?: () => void;
305
+ /**
306
+ * Key of the run error the transient recovery banner is already showing. The
307
+ * turn that owns that run stays quiet so one failure is never announced
308
+ * twice; every other failed turn keeps its own inline marker.
309
+ */
310
+ bannerRunErrorKey?: string | null;
297
311
  } | null>(null);
298
312
 
299
313
  /**
@@ -1275,6 +1289,78 @@ function isAssistantToolSummaryPart(
1275
1289
  .some((candidate) => candidate.type === "tool-call");
1276
1290
  }
1277
1291
 
1292
+ export function shouldShowInlineRunError({
1293
+ runError,
1294
+ bannerRunErrorKey,
1295
+ }: {
1296
+ runError: RunErrorInfo | null;
1297
+ bannerRunErrorKey: string | null | undefined;
1298
+ }): boolean {
1299
+ if (!runError) return false;
1300
+ return runErrorKey(runError) !== bannerRunErrorKey;
1301
+ }
1302
+
1303
+ export function InlineRunErrorNotice({
1304
+ info,
1305
+ durationMs,
1306
+ onRetry,
1307
+ }: {
1308
+ info: RunErrorInfo;
1309
+ durationMs?: number | null;
1310
+ onRetry?: (() => void) | undefined;
1311
+ }) {
1312
+ const [open, setOpen] = useState(false);
1313
+ const headline = runErrorHeadline(info);
1314
+ const label =
1315
+ durationMs != null && durationMs >= 1000
1316
+ ? `${headline} after ${formatWorkedDuration(durationMs)}`
1317
+ : headline;
1318
+
1319
+ return (
1320
+ <div className="my-1 w-full">
1321
+ <button
1322
+ type="button"
1323
+ onClick={() => setOpen((v) => !v)}
1324
+ aria-expanded={open}
1325
+ className="flex cursor-pointer items-center gap-1.5 py-0.5 text-[13px] text-muted-foreground transition-colors hover:text-foreground"
1326
+ >
1327
+ <IconAlertTriangle className="size-3.5 shrink-0 text-amber-500" />
1328
+ <span className="truncate">{label}</span>
1329
+ <IconChevronRight
1330
+ className={cn(
1331
+ "size-3.5 shrink-0 transition-transform",
1332
+ open && "rotate-90",
1333
+ )}
1334
+ />
1335
+ </button>
1336
+ {open && (
1337
+ <div className="mt-1 rounded-md border border-border/60 bg-background/70 p-2 text-[11px] leading-relaxed text-muted-foreground">
1338
+ <p className="whitespace-pre-wrap break-words">{info.message}</p>
1339
+ {info.errorCode && (
1340
+ <div className="mt-1 font-mono">code: {info.errorCode}</div>
1341
+ )}
1342
+ {info.runId && <div className="font-mono">run: {info.runId}</div>}
1343
+ {info.details && (
1344
+ <pre className="mt-1 max-h-28 overflow-auto whitespace-pre-wrap break-words font-mono">
1345
+ {info.details}
1346
+ </pre>
1347
+ )}
1348
+ {onRetry && (
1349
+ <button
1350
+ type="button"
1351
+ onClick={onRetry}
1352
+ className="mt-2 inline-flex h-7 cursor-pointer items-center gap-1.5 rounded-md border border-border bg-background px-2.5 text-[11px] font-medium text-foreground hover:bg-accent"
1353
+ >
1354
+ <IconRefresh className="size-3" />
1355
+ Retry
1356
+ </button>
1357
+ )}
1358
+ </div>
1359
+ )}
1360
+ </div>
1361
+ );
1362
+ }
1363
+
1278
1364
  export function AssistantMessage() {
1279
1365
  const [restoreState, setRestoreState] = useState<
1280
1366
  "idle" | "confirming" | "restoring" | "error"
@@ -1299,6 +1385,12 @@ export function AssistantMessage() {
1299
1385
  );
1300
1386
  const hasCustomUi = assistantMessageHasCustomUi(msg.content);
1301
1387
  const serverRunActive = React.useContext(ServerRunActiveContext);
1388
+ const messageRunError = getRunErrorMetadata(msg);
1389
+ const messageActions = React.useContext(MessageActionsContext);
1390
+ const showInlineRunError = shouldShowInlineRunError({
1391
+ runError: messageRunError,
1392
+ bannerRunErrorKey: messageActions?.bannerRunErrorKey,
1393
+ });
1302
1394
  const showMissingFinalResponse = useSettledFlag(
1303
1395
  shouldShowMissingFinalResponse({
1304
1396
  isCurrentTurnRunning: isLast && chatRunning,
@@ -1504,7 +1596,18 @@ export function AssistantMessage() {
1504
1596
  }
1505
1597
  }}
1506
1598
  </MessagePrimitive.GroupedParts>
1507
- {showMissingFinalResponse && (
1599
+ {showInlineRunError && messageRunError && (
1600
+ <InlineRunErrorNotice
1601
+ info={messageRunError}
1602
+ durationMs={capturedDurationMs ?? persistedDurationMs}
1603
+ onRetry={
1604
+ isLast && messageRunError.recoverable
1605
+ ? messageActions?.onRetryRunError
1606
+ : undefined
1607
+ }
1608
+ />
1609
+ )}
1610
+ {showMissingFinalResponse && !showInlineRunError && (
1508
1611
  <p role="status" className="text-muted-foreground">
1509
1612
  The agent stopped without sending a final message. Ask it to
1510
1613
  continue or retry.
@@ -108,6 +108,20 @@ export function getRunErrorMetadata(message: unknown): RunErrorInfo | null {
108
108
  };
109
109
  }
110
110
 
111
+ /**
112
+ * Identity of one failure, shared by the banner and the inline turn marker so
113
+ * the same run is never announced twice.
114
+ */
115
+ export function runErrorKey(info: RunErrorInfo): string {
116
+ return `${info.runId ?? ""}:${info.errorCode ?? ""}:${info.message}`;
117
+ }
118
+
119
+ export function runErrorHeadline(info: RunErrorInfo): string {
120
+ return info.recoverable === true
121
+ ? "The agent stopped before finishing"
122
+ : "The agent hit an error";
123
+ }
124
+
111
125
  export function getRequestModeMetadata(
112
126
  message: unknown,
113
127
  ): "act" | "plan" | null {
@@ -610,9 +624,7 @@ export function RunErrorRecoveryCard({
610
624
  </span>
611
625
  <div className="min-w-0 flex-1">
612
626
  <div className="font-medium text-foreground">
613
- {canRecover
614
- ? "The agent stopped before finishing"
615
- : "The agent hit an error"}
627
+ {runErrorHeadline(info)}
616
628
  </div>
617
629
  <p className="mt-1 text-xs leading-relaxed text-muted-foreground">
618
630
  {info.message}