@agent-native/core 0.97.0 → 0.98.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 (844) hide show
  1. package/corpus/README.md +2 -2
  2. package/corpus/core/CHANGELOG.md +32 -0
  3. package/corpus/core/docs/content/authentication.mdx +3 -3
  4. package/corpus/core/docs/content/doctor.mdx +170 -0
  5. package/corpus/core/docs/content/external-agents.mdx +8 -7
  6. package/corpus/core/docs/content/locales/ar-SA/authentication.mdx +2 -2
  7. package/corpus/core/docs/content/locales/ar-SA/external-agents.mdx +8 -7
  8. package/corpus/core/docs/content/locales/ar-SA/mcp-protocol.mdx +1 -1
  9. package/corpus/core/docs/content/locales/ar-SA/security.mdx +2 -0
  10. package/corpus/core/docs/content/locales/de-DE/authentication.mdx +1 -1
  11. package/corpus/core/docs/content/locales/de-DE/external-agents.mdx +8 -7
  12. package/corpus/core/docs/content/locales/de-DE/mcp-protocol.mdx +1 -1
  13. package/corpus/core/docs/content/locales/de-DE/security.mdx +2 -0
  14. package/corpus/core/docs/content/locales/es-ES/authentication.mdx +2 -2
  15. package/corpus/core/docs/content/locales/es-ES/external-agents.mdx +8 -7
  16. package/corpus/core/docs/content/locales/es-ES/mcp-protocol.mdx +1 -1
  17. package/corpus/core/docs/content/locales/es-ES/security.mdx +2 -0
  18. package/corpus/core/docs/content/locales/fr-FR/authentication.mdx +1 -1
  19. package/corpus/core/docs/content/locales/fr-FR/external-agents.mdx +8 -7
  20. package/corpus/core/docs/content/locales/fr-FR/mcp-protocol.mdx +1 -1
  21. package/corpus/core/docs/content/locales/fr-FR/security.mdx +2 -0
  22. package/corpus/core/docs/content/locales/hi-IN/authentication.mdx +2 -2
  23. package/corpus/core/docs/content/locales/hi-IN/external-agents.mdx +8 -7
  24. package/corpus/core/docs/content/locales/hi-IN/mcp-protocol.mdx +1 -1
  25. package/corpus/core/docs/content/locales/hi-IN/security.mdx +2 -0
  26. package/corpus/core/docs/content/locales/ja-JP/authentication.mdx +2 -2
  27. package/corpus/core/docs/content/locales/ja-JP/external-agents.mdx +8 -7
  28. package/corpus/core/docs/content/locales/ja-JP/mcp-protocol.mdx +1 -1
  29. package/corpus/core/docs/content/locales/ja-JP/security.mdx +2 -0
  30. package/corpus/core/docs/content/locales/ko-KR/authentication.mdx +2 -2
  31. package/corpus/core/docs/content/locales/ko-KR/external-agents.mdx +8 -7
  32. package/corpus/core/docs/content/locales/ko-KR/mcp-protocol.mdx +1 -1
  33. package/corpus/core/docs/content/locales/ko-KR/security.mdx +2 -0
  34. package/corpus/core/docs/content/locales/pt-BR/authentication.mdx +2 -2
  35. package/corpus/core/docs/content/locales/pt-BR/external-agents.mdx +8 -7
  36. package/corpus/core/docs/content/locales/pt-BR/mcp-protocol.mdx +1 -1
  37. package/corpus/core/docs/content/locales/pt-BR/security.mdx +2 -0
  38. package/corpus/core/docs/content/locales/zh-CN/authentication.mdx +2 -2
  39. package/corpus/core/docs/content/locales/zh-CN/external-agents.mdx +8 -7
  40. package/corpus/core/docs/content/locales/zh-CN/mcp-protocol.mdx +1 -1
  41. package/corpus/core/docs/content/locales/zh-CN/security.mdx +2 -0
  42. package/corpus/core/docs/content/locales/zh-TW/authentication.mdx +2 -2
  43. package/corpus/core/docs/content/locales/zh-TW/external-agents.mdx +8 -7
  44. package/corpus/core/docs/content/locales/zh-TW/mcp-protocol.mdx +1 -1
  45. package/corpus/core/docs/content/locales/zh-TW/security.mdx +2 -0
  46. package/corpus/core/docs/content/mcp-protocol.mdx +1 -1
  47. package/corpus/core/docs/content/security.mdx +2 -0
  48. package/corpus/core/package.json +5 -1
  49. package/corpus/core/scripts/finalize-build.mjs +63 -3
  50. package/corpus/core/scripts/materialize-source-corpus.mjs +101 -15
  51. package/corpus/core/src/action.ts +42 -0
  52. package/corpus/core/src/agent/engine/builder-engine.ts +3 -0
  53. package/corpus/core/src/agent/engine/context-directives-transform.ts +69 -0
  54. package/corpus/core/src/agent/engine/continuation-dispatch-retry.ts +168 -0
  55. package/corpus/core/src/agent/engine/tool-call-journal-seed.ts +85 -0
  56. package/corpus/core/src/agent/production-agent.ts +129 -244
  57. package/corpus/core/src/cli/doctor.ts +9 -3
  58. package/corpus/core/src/cli/plan-local.ts +10 -2
  59. package/corpus/core/src/cli/skills-content/assets-skill.ts +83 -0
  60. package/corpus/core/src/cli/skills-content/canvas.ts +153 -0
  61. package/corpus/core/src/cli/skills-content/connection.ts +52 -0
  62. package/corpus/core/src/cli/skills-content/content-skill.ts +109 -0
  63. package/corpus/core/src/cli/skills-content/design-exploration-skill.ts +118 -0
  64. package/corpus/core/src/cli/skills-content/design-visual-edit-skill.ts +228 -0
  65. package/corpus/core/src/cli/skills-content/document-quality.ts +196 -0
  66. package/corpus/core/src/cli/skills-content/exemplar.ts +69 -0
  67. package/corpus/core/src/cli/skills-content/help.ts +77 -0
  68. package/corpus/core/src/cli/skills-content/index.ts +22 -0
  69. package/corpus/core/src/cli/skills-content/local-files.ts +95 -0
  70. package/corpus/core/src/cli/skills-content/plan-setup-auth.ts +80 -0
  71. package/corpus/core/src/cli/skills-content/visual-plan-skill.ts +470 -0
  72. package/corpus/core/src/cli/skills-content/visual-recap-skill.ts +547 -0
  73. package/corpus/core/src/cli/skills-content/visualize-repo-skill.ts +93 -0
  74. package/corpus/core/src/cli/skills-content/wireframe.ts +349 -0
  75. package/corpus/core/src/cli/skills.ts +27 -2733
  76. package/corpus/core/src/client/AgentPanel.tsx +6 -5
  77. package/corpus/core/src/client/CommandMenu.tsx +16 -5
  78. package/corpus/core/src/client/FeedbackButton.tsx +2 -2
  79. package/corpus/core/src/client/app-providers.tsx +18 -5
  80. package/corpus/core/src/client/chat/tool-call-display.tsx +3 -3
  81. package/corpus/core/src/client/composer/PastedTextChip.tsx +1 -1
  82. package/corpus/core/src/client/composer/RealtimeVoiceMode.tsx +143 -45
  83. package/corpus/core/src/client/composer/TiptapComposer.tsx +1 -1
  84. package/corpus/core/src/client/composer/VoiceButton.tsx +21 -5
  85. package/corpus/core/src/client/composer/useRealtimeVoiceMode.tsx +107 -10
  86. package/corpus/core/src/client/context-xray/ContextXRayPanel.tsx +5 -2
  87. package/corpus/core/src/client/extensions/ExtensionEditor.tsx +37 -4
  88. package/corpus/core/src/client/extensions/ExtensionQueryErrorState.tsx +47 -0
  89. package/corpus/core/src/client/extensions/ExtensionSlot.tsx +39 -10
  90. package/corpus/core/src/client/extensions/ExtensionViewer.tsx +44 -6
  91. package/corpus/core/src/client/extensions/ExtensionsListPage.tsx +12 -3
  92. package/corpus/core/src/client/extensions/ExtensionsSidebarSection.tsx +49 -11
  93. package/corpus/core/src/client/index.ts +0 -13
  94. package/corpus/core/src/client/progress/RunsTray.tsx +10 -3
  95. package/corpus/core/src/client/settings/SettingsTabsPage.tsx +7 -0
  96. package/corpus/core/src/client/settings/useBuilderStatus.ts +6 -0
  97. package/corpus/core/src/client/tool-cells/EditCell.tsx +19 -16
  98. package/corpus/core/src/client/tool-cells/FilesChangedSummary.tsx +26 -23
  99. package/corpus/core/src/client/tool-cells/WriteCell.tsx +19 -16
  100. package/corpus/core/src/client/visual-style-controls.tsx +1 -1
  101. package/corpus/core/src/deploy/build.ts +36 -14
  102. package/corpus/core/src/integrations/google-docs-poller.ts +23 -2
  103. package/corpus/core/src/integrations/plugin.ts +10 -0
  104. package/corpus/core/src/integrations/webhook-handler.ts +27 -2
  105. package/corpus/core/src/jobs/scheduler.ts +28 -2
  106. package/corpus/core/src/localization/default-messages.ts +8 -1
  107. package/corpus/core/src/mcp/oauth-token.ts +6 -1
  108. package/corpus/core/src/observability/routes.ts +36 -0
  109. package/corpus/core/src/observability/sentiment.ts +261 -0
  110. package/corpus/core/src/observability/store.ts +23 -0
  111. package/corpus/core/src/observability/traces.ts +49 -63
  112. package/corpus/core/src/observability/tracking-identity.ts +55 -0
  113. package/corpus/core/src/observability/types.ts +13 -0
  114. package/corpus/core/src/secrets/storage.ts +67 -3
  115. package/corpus/core/src/server/agent-chat/action-filters-a2a.ts +199 -0
  116. package/corpus/core/src/server/agent-chat/browser-team-tools.ts +510 -0
  117. package/corpus/core/src/server/agent-chat/context-tools.ts +595 -0
  118. package/corpus/core/src/server/agent-chat/framework-prompts.ts +470 -0
  119. package/corpus/core/src/server/agent-chat/lazy-fs.ts +11 -0
  120. package/corpus/core/src/server/agent-chat/mcp-glue.ts +91 -0
  121. package/corpus/core/src/server/agent-chat/plugin-options.ts +350 -0
  122. package/corpus/core/src/server/agent-chat/process-run-failure.ts +62 -0
  123. package/corpus/core/src/server/agent-chat/prompt-resources.ts +688 -0
  124. package/corpus/core/src/server/agent-chat/recurring-jobs-runtime.ts +80 -0
  125. package/corpus/core/src/server/agent-chat/request-surface.ts +71 -0
  126. package/corpus/core/src/server/agent-chat/run-code-tools.ts +67 -0
  127. package/corpus/core/src/server/agent-chat/script-entries.ts +779 -0
  128. package/corpus/core/src/server/agent-chat/shared-thread.ts +301 -0
  129. package/corpus/core/src/server/agent-chat/skill-frontmatter.ts +41 -0
  130. package/corpus/core/src/server/agent-chat-plugin.ts +364 -4182
  131. package/corpus/core/src/server/agent-teams.ts +26 -3
  132. package/corpus/core/src/server/auth.ts +55 -57
  133. package/corpus/core/src/server/credential-provider.ts +22 -25
  134. package/corpus/core/src/server/edge.ts +1 -0
  135. package/corpus/core/src/server/onboarding-html.ts +1 -16
  136. package/corpus/core/src/server/realtime-voice.ts +40 -5
  137. package/corpus/core/src/server/request-origin.ts +6 -2
  138. package/corpus/core/src/server/ssr-handler.ts +55 -2
  139. package/corpus/core/src/sharing/access.ts +155 -11
  140. package/corpus/core/src/sharing/registry.ts +7 -0
  141. package/corpus/core/src/styles/agent-native.css +15 -14
  142. package/corpus/core/src/templates/default/.agents/skills/frontend-design/SKILL.md +1 -1
  143. package/corpus/core/src/templates/default/app/i18n/ar-SA.ts +6 -0
  144. package/corpus/core/src/templates/default/app/i18n/de-DE.ts +6 -0
  145. package/corpus/core/src/templates/default/app/i18n/en-US.ts +6 -0
  146. package/corpus/core/src/templates/default/app/i18n/es-ES.ts +6 -0
  147. package/corpus/core/src/templates/default/app/i18n/fr-FR.ts +6 -0
  148. package/corpus/core/src/templates/default/app/i18n/hi-IN.ts +6 -0
  149. package/corpus/core/src/templates/default/app/i18n/ja-JP.ts +6 -0
  150. package/corpus/core/src/templates/default/app/i18n/ko-KR.ts +6 -0
  151. package/corpus/core/src/templates/default/app/i18n/pt-BR.ts +6 -0
  152. package/corpus/core/src/templates/default/app/i18n/zh-CN.ts +6 -0
  153. package/corpus/core/src/templates/default/app/i18n/zh-TW.ts +6 -0
  154. package/corpus/core/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +27 -29
  155. package/corpus/core/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +2 -1
  156. package/corpus/core/src/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +1 -1
  157. package/corpus/core/src/templates/workspace-core/.agents/skills/observability/SKILL.md +32 -0
  158. package/corpus/core/src/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +25 -0
  159. package/corpus/core/src/templates/workspace-core/src/server/index.ts +4 -2
  160. package/corpus/core/src/testing.ts +26 -0
  161. package/corpus/core/src/triggers/dispatcher.ts +23 -2
  162. package/corpus/core/src/vite/client.ts +126 -2
  163. package/corpus/core/tsconfig.cli.json +1 -1
  164. package/corpus/core/tsconfig.json +5 -1
  165. package/corpus/templates/analytics/.agents/skills/bigquery/SKILL.md +2 -2
  166. package/corpus/templates/analytics/.agents/skills/frontend-design/SKILL.md +1 -1
  167. package/corpus/templates/analytics/AGENTS.md +19 -6
  168. package/corpus/templates/analytics/actions/install-dashboard-template.ts +79 -43
  169. package/corpus/templates/analytics/actions/list-explorer-dashboards.ts +3 -3
  170. package/corpus/templates/analytics/actions/list-sql-dashboards.ts +8 -3
  171. package/corpus/templates/analytics/actions/rename-analysis.ts +8 -2
  172. package/corpus/templates/analytics/actions/rename-dashboard.ts +8 -7
  173. package/corpus/templates/analytics/actions/view-screen.ts +4 -23
  174. package/corpus/templates/analytics/app/components/ResourceLoadError.tsx +42 -0
  175. package/corpus/templates/analytics/app/components/layout/CommandPalette.tsx +85 -70
  176. package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +107 -89
  177. package/corpus/templates/analytics/app/components/layout/SidebarLoadError.tsx +24 -0
  178. package/corpus/templates/analytics/app/hooks/use-dashboard-views.ts +15 -5
  179. package/corpus/templates/analytics/app/i18n/zh-TW.ts +4 -0
  180. package/corpus/templates/analytics/app/i18n-data.ts +40 -0
  181. package/corpus/templates/analytics/app/pages/Settings.tsx +6 -2
  182. package/corpus/templates/analytics/app/pages/adhoc/explorer/components/SqlPreview.tsx +36 -20
  183. package/corpus/templates/analytics/app/pages/adhoc/explorer/index.tsx +34 -20
  184. package/corpus/templates/analytics/app/pages/adhoc/explorer/use-explorer-config.ts +42 -41
  185. package/corpus/templates/analytics/app/pages/adhoc/explorer-dashboard/index.tsx +43 -36
  186. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/ViewsMenu.tsx +11 -2
  187. package/corpus/templates/analytics/app/root.tsx +13 -1
  188. package/corpus/templates/analytics/app/routes/_index.tsx +14 -2
  189. package/corpus/templates/analytics/changelog/2026-07-03-agent-llm-observability-dashboard.md +1 -1
  190. package/corpus/templates/analytics/changelog/2026-07-11-agent-feedback-sentiment-dashboard.md +6 -0
  191. package/corpus/templates/analytics/changelog/2026-07-11-analytics-chats-now-start-faster-by-loading-metric-definitio.md +6 -0
  192. package/corpus/templates/analytics/changelog/2026-07-11-command-and-sql-previews-now-respond-without-lag.md +6 -0
  193. package/corpus/templates/analytics/changelog/2026-07-11-command-search-now-reports-loading-failures-and-lets-you-ret.md +6 -0
  194. package/corpus/templates/analytics/changelog/2026-07-11-dashboard-navigation-now-loads-faster-and-reports-request-fa.md +6 -0
  195. package/corpus/templates/analytics/changelog/2026-07-11-inferred-message-sentiment-dashboard.md +6 -0
  196. package/corpus/templates/analytics/changelog/2026-07-11-microphone-settings-from-realtime-voice-mode-now-open-the-vo.md +6 -0
  197. package/corpus/templates/analytics/changelog/2026-07-11-more-dashboard-edit-paths-are-now-safe-against-simultaneous-.md +6 -0
  198. package/corpus/templates/analytics/changelog/2026-07-11-renaming-a-dashboard-is-now-safe-against-simultaneous-agent-.md +6 -0
  199. package/corpus/templates/analytics/changelog/2026-07-11-renaming-an-analysis-is-now-safe-against-simultaneous-edits.md +6 -0
  200. package/corpus/templates/analytics/changelog/2026-07-11-workspace-mounted-analytics-now-opens-ask-reliably-and-route.md +6 -0
  201. package/corpus/templates/analytics/docs/schemas/first-party-analytics.md +37 -3
  202. package/corpus/templates/analytics/seeds/dashboards/agent-native-templates-first-party.json +339 -1
  203. package/corpus/templates/analytics/server/lib/dashboard-catalog.ts +1 -24
  204. package/corpus/templates/analytics/server/lib/dashboard-seeds.ts +0 -5
  205. package/corpus/templates/analytics/server/lib/dashboards-store.ts +289 -20
  206. package/corpus/templates/analytics/server/lib/data-dictionary-context.ts +106 -34
  207. package/corpus/templates/analytics/server/lib/demo-dashboards.ts +4 -1
  208. package/corpus/templates/analytics/server/plugins/agent-chat.ts +11 -39
  209. package/corpus/templates/assets/.agents/skills/frontend-design/SKILL.md +1 -1
  210. package/corpus/templates/assets/app/components/create/RecentDraftsSection.tsx +30 -4
  211. package/corpus/templates/assets/app/routes/library.tsx +49 -5
  212. package/corpus/templates/assets/changelog/2026-07-11-library-load-failures-now-show-a-retry-action.md +6 -0
  213. package/corpus/templates/brain/.agents/skills/frontend-design/SKILL.md +1 -1
  214. package/corpus/templates/calendar/.agents/skills/frontend-design/SKILL.md +1 -1
  215. package/corpus/templates/calendar/.env.example +5 -0
  216. package/corpus/templates/calendar/app/components/calendar/EventCard.tsx +2 -2
  217. package/corpus/templates/calendar/app/i18n/zh-TW.ts +2 -0
  218. package/corpus/templates/calendar/app/i18n-data.ts +20 -0
  219. package/corpus/templates/calendar/app/pages/BookingLinksPage.tsx +37 -1
  220. package/corpus/templates/calendar/app/pages/BookingsList.tsx +20 -3
  221. package/corpus/templates/calendar/changelog/2026-07-11-booking-load-failures-now-show-a-retry-action.md +6 -0
  222. package/corpus/templates/calendar/changelog/2026-07-11-event-cards-give-subtle-press-feedback-and-smoother-hover.md +6 -0
  223. package/corpus/templates/chat/.agents/skills/frontend-design/SKILL.md +1 -1
  224. package/corpus/templates/clips/.agents/skills/frontend-design/SKILL.md +1 -1
  225. package/corpus/templates/clips/actions/decline-invite.ts +8 -0
  226. package/corpus/templates/clips/app/components/library/folder-tree.tsx +209 -187
  227. package/corpus/templates/clips/app/components/meetings/meeting-card.tsx +2 -2
  228. package/corpus/templates/clips/app/components/player/reactions-tray.tsx +17 -5
  229. package/corpus/templates/clips/app/components/player/scrubber.tsx +5 -3
  230. package/corpus/templates/clips/app/components/recorder/pre-record-panel.tsx +2 -2
  231. package/corpus/templates/clips/app/components/workspace/insights-hub.tsx +119 -95
  232. package/corpus/templates/clips/app/global.css +45 -0
  233. package/corpus/templates/clips/app/root.tsx +4 -0
  234. package/corpus/templates/clips/app/routes/_app.notifications.tsx +23 -2
  235. package/corpus/templates/clips/app/routes/_app.trash.tsx +24 -2
  236. package/corpus/templates/clips/changelog/2026-07-11-controls-and-folders-now-move-more-smoothly.md +6 -0
  237. package/corpus/templates/clips/changelog/2026-07-11-declining-an-invitation-now-requires-being-its-recipient.md +6 -0
  238. package/corpus/templates/clips/changelog/2026-07-11-recording-overlays-are-lighter-weight-and-no-longer-cause-pa.md +6 -0
  239. package/corpus/templates/clips/changelog/2026-07-11-workspace-load-failures-now-show-a-retry-action.md +6 -0
  240. package/corpus/templates/clips/chrome-extension/src/overlay.css +34 -5
  241. package/corpus/templates/clips/chrome-extension/src/styles.css +2 -2
  242. package/corpus/templates/clips/desktop/src/styles.css +71 -26
  243. package/corpus/templates/content/.agents/skills/frontend-design/SKILL.md +1 -1
  244. package/corpus/templates/content/actions/move-document.ts +34 -18
  245. package/corpus/templates/content/app/components/QueryErrorState.tsx +39 -0
  246. package/corpus/templates/content/app/components/editor/LinkHoverPreview.tsx +1 -1
  247. package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +225 -1435
  248. package/corpus/templates/content/app/components/editor/database/GalleryView.tsx +368 -0
  249. package/corpus/templates/content/app/components/editor/database/ListView.tsx +353 -0
  250. package/corpus/templates/content/app/components/editor/database/TimelineView.tsx +580 -0
  251. package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +11 -2
  252. package/corpus/templates/content/app/global.css +19 -19
  253. package/corpus/templates/content/app/root.tsx +2 -2
  254. package/corpus/templates/content/app/routes/_app._index.tsx +11 -1
  255. package/corpus/templates/content/changelog/2026-07-11-document-load-failures-now-show-a-retry-action.md +6 -0
  256. package/corpus/templates/content/changelog/2026-07-11-editor-toggle-feedback-now-feels-more-responsive.md +6 -0
  257. package/corpus/templates/content/changelog/2026-07-11-moving-documents-at-the-same-time-no-longer-scrambles-their-.md +6 -0
  258. package/corpus/templates/content/changelog/2026-07-11-public-document-chats-now-start-faster-while-keeping-full-do.md +6 -0
  259. package/corpus/templates/content/changelog/2026-07-11-reopening-a-comment-now-uses-consistent-permissions-everywhe.md +6 -0
  260. package/corpus/templates/content/changelog/2026-07-11-sidebar-resizing-now-tracks-your-cursor-instantly-instead-of.md +6 -0
  261. package/corpus/templates/content/server/lib/public-documents.ts +47 -10
  262. package/corpus/templates/content/server/routes/api/comments/[id].patch.ts +24 -24
  263. package/corpus/templates/design/.agents/skills/frontend-design/SKILL.md +1 -1
  264. package/corpus/templates/design/app/components/QueryErrorState.tsx +24 -0
  265. package/corpus/templates/design/app/components/design/CanvasContextMenu.tsx +1 -1
  266. package/corpus/templates/design/app/components/design/DesignImportPanel.tsx +5 -2
  267. package/corpus/templates/design/app/components/design/EditPanel.tsx +326 -319
  268. package/corpus/templates/design/app/components/design/LayersPanel.tsx +198 -193
  269. package/corpus/templates/design/app/components/design/edit-panel/panel-primitives.tsx +11 -4
  270. package/corpus/templates/design/app/components/design/inspector/DesignColorPicker.tsx +1 -1
  271. package/corpus/templates/design/app/components/layout/Layout.tsx +1 -1
  272. package/corpus/templates/design/app/pages/DesignSystems.tsx +7 -1
  273. package/corpus/templates/design/app/pages/Index.tsx +14 -2
  274. package/corpus/templates/design/app/pages/Present.tsx +16 -3
  275. package/corpus/templates/design/app/pages/Templates.tsx +10 -4
  276. package/corpus/templates/design/app/pages/design-editor/canvas-primitive-insert.ts +484 -0
  277. package/corpus/templates/design/app/pages/design-editor/clone-and-pen-edit.ts +378 -0
  278. package/corpus/templates/design/app/pages/design-editor/design-data-geometry-utils.ts +138 -0
  279. package/corpus/templates/design/app/pages/design-editor/dom-utils.ts +15 -0
  280. package/corpus/templates/design/app/pages/design-editor/generation-prompt-directives.ts +180 -0
  281. package/corpus/templates/design/app/pages/design-editor/html-layer-positioning.ts +226 -0
  282. package/corpus/templates/design/app/pages/design-editor/png-export-render.ts +348 -0
  283. package/corpus/templates/design/app/pages/design-editor/screen-command-utils.ts +160 -0
  284. package/corpus/templates/design/app/pages/design-editor/text-edit-utils.ts +238 -0
  285. package/corpus/templates/design/app/pages/design-editor/tool-state.ts +23 -1
  286. package/corpus/templates/design/app/pages/design-editor/types.ts +25 -0
  287. package/corpus/templates/design/app/root.tsx +10 -1
  288. package/corpus/templates/design/changelog/2026-07-11-canvas-context-menus-now-open-without-motion-jitter.md +6 -0
  289. package/corpus/templates/design/changelog/2026-07-11-design-load-failures-now-show-a-retry-action.md +6 -0
  290. package/corpus/templates/design/changelog/2026-07-11-inspector-tooltips-appear-instantly-as-you-sweep-across-icon.md +6 -0
  291. package/corpus/templates/dispatch/.agents/skills/frontend-design/SKILL.md +1 -1
  292. package/corpus/templates/dispatch/app/i18n/zh-TW.ts +10 -0
  293. package/corpus/templates/dispatch/app/i18n-data.ts +123 -0
  294. package/corpus/templates/dispatch/app/routes/integrations.tsx +163 -144
  295. package/corpus/templates/dispatch/changelog/2026-07-11-dispatch-mcp-connections-now-start-with-safer-app-access-and.md +6 -0
  296. package/corpus/templates/dispatch/changelog/2026-07-11-overview-and-chat-now-share-a-cleaner-more-stable-flow.md +6 -0
  297. package/corpus/templates/dispatch/changelog/2026-07-11-query-errors-now-show-a-retry-option.md +6 -0
  298. package/corpus/templates/forms/.agents/skills/frontend-design/SKILL.md +1 -1
  299. package/corpus/templates/forms/app/components/layout/Sidebar.tsx +3 -3
  300. package/corpus/templates/forms/app/root.tsx +34 -8
  301. package/corpus/templates/macros/.agents/skills/frontend-design/SKILL.md +1 -1
  302. package/corpus/templates/macros/app/components/DailyProgress.tsx +25 -5
  303. package/corpus/templates/macros/app/components/QueryErrorState.tsx +31 -0
  304. package/corpus/templates/macros/app/components/WeightTracker.tsx +5 -1
  305. package/corpus/templates/macros/app/components/ui/button.tsx +1 -1
  306. package/corpus/templates/macros/app/components/ui/progress.tsx +1 -1
  307. package/corpus/templates/macros/app/components/ui/tabs.tsx +1 -1
  308. package/corpus/templates/macros/app/i18n/ar-SA.ts +2 -0
  309. package/corpus/templates/macros/app/i18n/de-DE.ts +2 -0
  310. package/corpus/templates/macros/app/i18n/en-US.ts +2 -0
  311. package/corpus/templates/macros/app/i18n/es-ES.ts +2 -0
  312. package/corpus/templates/macros/app/i18n/fr-FR.ts +2 -0
  313. package/corpus/templates/macros/app/i18n/hi-IN.ts +2 -0
  314. package/corpus/templates/macros/app/i18n/ja-JP.ts +2 -0
  315. package/corpus/templates/macros/app/i18n/ko-KR.ts +2 -0
  316. package/corpus/templates/macros/app/i18n/pt-BR.ts +2 -0
  317. package/corpus/templates/macros/app/i18n/zh-CN.ts +2 -0
  318. package/corpus/templates/macros/app/i18n/zh-TW.ts +2 -0
  319. package/corpus/templates/macros/app/routes/_index.tsx +22 -12
  320. package/corpus/templates/macros/app/routes/analytics.tsx +31 -10
  321. package/corpus/templates/macros/changelog/2026-07-11-daily-tracking-now-loads-and-updates-more-quickly.md +6 -0
  322. package/corpus/templates/macros/changelog/2026-07-11-data-load-failures-now-show-a-clear-error-with-a-retry-actio.md +6 -0
  323. package/corpus/templates/mail/.agents/skills/frontend-design/SKILL.md +1 -1
  324. package/corpus/templates/mail/.env.example +16 -11
  325. package/corpus/templates/mail/actions/list-emails.ts +39 -35
  326. package/corpus/templates/mail/app/components/email/ComposeModal.tsx +58 -6
  327. package/corpus/templates/mail/app/components/email/EmailListItem.tsx +35 -2
  328. package/corpus/templates/mail/app/components/layout/AppLayout.tsx +113 -104
  329. package/corpus/templates/mail/app/root.tsx +8 -10
  330. package/corpus/templates/mail/changelog/2026-07-11-compose-and-navigation-motion-now-feel-faster-and-smoother.md +6 -0
  331. package/corpus/templates/mail/changelog/2026-07-11-swipe-to-archive-or-snooze-now-responds-to-quick-flicks-not-.md +6 -0
  332. package/corpus/templates/mail/changelog/2026-07-11-the-assistant-now-sees-the-same-inbox-you-do-snoozed-mail-st.md +6 -0
  333. package/corpus/templates/mail/server/handlers/emails.ts +25 -69
  334. package/corpus/templates/mail/server/lib/list-inbox-emails.ts +169 -0
  335. package/corpus/templates/plan/.agents/skills/frontend-design/SKILL.md +1 -1
  336. package/corpus/templates/plan/.env.example +4 -0
  337. package/corpus/templates/plan/actions/create-plan-design.ts +89 -81
  338. package/corpus/templates/plan/actions/create-prototype-plan.ts +72 -59
  339. package/corpus/templates/plan/actions/create-ui-plan.ts +70 -55
  340. package/corpus/templates/plan/actions/create-visual-plan.ts +65 -51
  341. package/corpus/templates/plan/actions/update-local-plan-folder.ts +43 -30
  342. package/corpus/templates/plan/actions/update-visual-plan.ts +81 -64
  343. package/corpus/templates/plan/app/components/layout/Sidebar.tsx +17 -0
  344. package/corpus/templates/plan/app/components/ui/tabs.tsx +1 -1
  345. package/corpus/templates/plan/app/i18n/ar-SA.ts +10 -0
  346. package/corpus/templates/plan/app/i18n/de-DE.ts +10 -0
  347. package/corpus/templates/plan/app/i18n/en-US.ts +10 -0
  348. package/corpus/templates/plan/app/i18n/es-ES.ts +10 -0
  349. package/corpus/templates/plan/app/i18n/fr-FR.ts +10 -0
  350. package/corpus/templates/plan/app/i18n/hi-IN.ts +10 -0
  351. package/corpus/templates/plan/app/i18n/ja-JP.ts +10 -0
  352. package/corpus/templates/plan/app/i18n/ko-KR.ts +10 -0
  353. package/corpus/templates/plan/app/i18n/pt-BR.ts +10 -0
  354. package/corpus/templates/plan/app/i18n/zh-CN.ts +10 -0
  355. package/corpus/templates/plan/app/i18n/zh-TW.ts +10 -0
  356. package/corpus/templates/plan/app/lib/plan-local-bridge.ts +80 -1
  357. package/corpus/templates/plan/app/pages/PlansPage.tsx +152 -4
  358. package/corpus/templates/plan/app/root.tsx +11 -0
  359. package/corpus/templates/plan/changelog/2026-07-11-local-plans-now-explain-and-recover-from-browser-permission-.md +6 -0
  360. package/corpus/templates/plan/changelog/2026-07-11-plan-edits-now-save-atomically-and-can-no-longer-partially-a.md +6 -0
  361. package/corpus/templates/plan/changelog/2026-07-11-plan-lists-now-show-a-clear-error-with-a-retry-action-when-t.md +6 -0
  362. package/corpus/templates/plan/shared/plan-content.ts +546 -260
  363. package/corpus/templates/slides/.agents/skills/frontend-design/SKILL.md +1 -1
  364. package/corpus/templates/slides/actions/delete-slide-comment.ts +49 -0
  365. package/corpus/templates/slides/actions/update-slide-comment.ts +93 -0
  366. package/corpus/templates/slides/actions/view-screen.ts +14 -6
  367. package/corpus/templates/slides/app/components/comments/SlideCommentsPanel.tsx +33 -10
  368. package/corpus/templates/slides/app/components/editor/EditorSidebar.tsx +1 -1
  369. package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +1 -1
  370. package/corpus/templates/slides/app/components/editor/GenerateSlidesDialog.tsx +2 -2
  371. package/corpus/templates/slides/app/components/presentation/PresentationView.tsx +4 -2
  372. package/corpus/templates/slides/app/components/visual-editor/CanvasCommentPins.tsx +4 -3
  373. package/corpus/templates/slides/app/context/DeckContext.tsx +9 -0
  374. package/corpus/templates/slides/app/i18n/ar-SA.ts +6 -0
  375. package/corpus/templates/slides/app/i18n/de-DE.ts +6 -0
  376. package/corpus/templates/slides/app/i18n/en-US.ts +6 -0
  377. package/corpus/templates/slides/app/i18n/es-ES.ts +6 -0
  378. package/corpus/templates/slides/app/i18n/fr-FR.ts +6 -0
  379. package/corpus/templates/slides/app/i18n/hi-IN.ts +6 -0
  380. package/corpus/templates/slides/app/i18n/ja-JP.ts +6 -0
  381. package/corpus/templates/slides/app/i18n/ko-KR.ts +6 -0
  382. package/corpus/templates/slides/app/i18n/pt-BR.ts +6 -0
  383. package/corpus/templates/slides/app/i18n/zh-CN.ts +5 -0
  384. package/corpus/templates/slides/app/i18n/zh-TW.ts +5 -0
  385. package/corpus/templates/slides/app/pages/DesignSystems.tsx +23 -2
  386. package/corpus/templates/slides/app/pages/Index.tsx +29 -1
  387. package/corpus/templates/slides/changelog/2026-07-11-comment-load-failures-now-show-a-retry-action-instead-of-say.md +6 -0
  388. package/corpus/templates/slides/changelog/2026-07-11-comment-pins-now-clear-with-a-faster-smoother-confirmation.md +6 -0
  389. package/corpus/templates/slides/changelog/2026-07-11-deck-and-design-system-load-failures-now-show-a-retry-action.md +6 -0
  390. package/corpus/templates/slides/changelog/2026-07-11-editor-toggles-and-toolbar-menus-now-animate-smoothly.md +6 -0
  391. package/corpus/templates/slides/changelog/2026-07-11-the-assistant-can-now-resolve-reopen-and-delete-slide-commen.md +6 -0
  392. package/corpus/templates/slides/changelog/2026-07-11-viewing-slides-no-longer-loads-every-deck-s-full-contents-in.md +6 -0
  393. package/corpus/templates/slides/server/routes/api/comments/[id].delete.ts +29 -48
  394. package/corpus/templates/slides/server/routes/api/comments/[id].patch.ts +29 -65
  395. package/dist/action.d.ts +23 -0
  396. package/dist/action.d.ts.map +1 -1
  397. package/dist/action.js +13 -0
  398. package/dist/action.js.map +1 -1
  399. package/dist/agent/engine/builder-engine.d.ts.map +1 -1
  400. package/dist/agent/engine/builder-engine.js +3 -0
  401. package/dist/agent/engine/builder-engine.js.map +1 -1
  402. package/dist/agent/engine/context-directives-transform.d.ts +25 -0
  403. package/dist/agent/engine/context-directives-transform.d.ts.map +1 -0
  404. package/dist/agent/engine/context-directives-transform.js +53 -0
  405. package/dist/agent/engine/context-directives-transform.js.map +1 -0
  406. package/dist/agent/engine/continuation-dispatch-retry.d.ts +40 -0
  407. package/dist/agent/engine/continuation-dispatch-retry.d.ts.map +1 -0
  408. package/dist/agent/engine/continuation-dispatch-retry.js +109 -0
  409. package/dist/agent/engine/continuation-dispatch-retry.js.map +1 -0
  410. package/dist/agent/engine/tool-call-journal-seed.d.ts +46 -0
  411. package/dist/agent/engine/tool-call-journal-seed.d.ts.map +1 -0
  412. package/dist/agent/engine/tool-call-journal-seed.js +60 -0
  413. package/dist/agent/engine/tool-call-journal-seed.js.map +1 -0
  414. package/dist/agent/production-agent.d.ts +7 -0
  415. package/dist/agent/production-agent.d.ts.map +1 -1
  416. package/dist/agent/production-agent.js +102 -222
  417. package/dist/agent/production-agent.js.map +1 -1
  418. package/dist/cli/doctor.d.ts.map +1 -1
  419. package/dist/cli/doctor.js +7 -3
  420. package/dist/cli/doctor.js.map +1 -1
  421. package/dist/cli/plan-local.d.ts.map +1 -1
  422. package/dist/cli/plan-local.js +8 -2
  423. package/dist/cli/plan-local.js.map +1 -1
  424. package/dist/cli/skills-content/assets-skill.d.ts +2 -0
  425. package/dist/cli/skills-content/assets-skill.d.ts.map +1 -0
  426. package/dist/cli/skills-content/assets-skill.js +84 -0
  427. package/dist/cli/skills-content/assets-skill.js.map +1 -0
  428. package/dist/cli/skills-content/canvas.d.ts +4 -0
  429. package/dist/cli/skills-content/canvas.d.ts.map +1 -0
  430. package/dist/cli/skills-content/canvas.js +152 -0
  431. package/dist/cli/skills-content/canvas.js.map +1 -0
  432. package/dist/cli/skills-content/connection.d.ts +2 -0
  433. package/dist/cli/skills-content/connection.d.ts.map +1 -0
  434. package/dist/cli/skills-content/connection.js +53 -0
  435. package/dist/cli/skills-content/connection.js.map +1 -0
  436. package/dist/cli/skills-content/content-skill.d.ts +2 -0
  437. package/dist/cli/skills-content/content-skill.d.ts.map +1 -0
  438. package/dist/cli/skills-content/content-skill.js +110 -0
  439. package/dist/cli/skills-content/content-skill.js.map +1 -0
  440. package/dist/cli/skills-content/design-exploration-skill.d.ts +2 -0
  441. package/dist/cli/skills-content/design-exploration-skill.d.ts.map +1 -0
  442. package/dist/cli/skills-content/design-exploration-skill.js +119 -0
  443. package/dist/cli/skills-content/design-exploration-skill.js.map +1 -0
  444. package/dist/cli/skills-content/design-visual-edit-skill.d.ts +2 -0
  445. package/dist/cli/skills-content/design-visual-edit-skill.d.ts.map +1 -0
  446. package/dist/cli/skills-content/design-visual-edit-skill.js +229 -0
  447. package/dist/cli/skills-content/design-visual-edit-skill.js.map +1 -0
  448. package/dist/cli/skills-content/document-quality.d.ts +4 -0
  449. package/dist/cli/skills-content/document-quality.d.ts.map +1 -0
  450. package/dist/cli/skills-content/document-quality.js +195 -0
  451. package/dist/cli/skills-content/document-quality.js.map +1 -0
  452. package/dist/cli/skills-content/exemplar.d.ts +4 -0
  453. package/dist/cli/skills-content/exemplar.d.ts.map +1 -0
  454. package/dist/cli/skills-content/exemplar.js +68 -0
  455. package/dist/cli/skills-content/exemplar.js.map +1 -0
  456. package/dist/cli/skills-content/help.d.ts +2 -0
  457. package/dist/cli/skills-content/help.d.ts.map +1 -0
  458. package/dist/cli/skills-content/help.js +78 -0
  459. package/dist/cli/skills-content/help.js.map +1 -0
  460. package/dist/cli/skills-content/index.d.ts +23 -0
  461. package/dist/cli/skills-content/index.d.ts.map +1 -0
  462. package/dist/cli/skills-content/index.js +23 -0
  463. package/dist/cli/skills-content/index.js.map +1 -0
  464. package/dist/cli/skills-content/local-files.d.ts +2 -0
  465. package/dist/cli/skills-content/local-files.d.ts.map +1 -0
  466. package/dist/cli/skills-content/local-files.js +96 -0
  467. package/dist/cli/skills-content/local-files.js.map +1 -0
  468. package/dist/cli/skills-content/plan-setup-auth.d.ts +9 -0
  469. package/dist/cli/skills-content/plan-setup-auth.d.ts.map +1 -0
  470. package/dist/cli/skills-content/plan-setup-auth.js +81 -0
  471. package/dist/cli/skills-content/plan-setup-auth.js.map +1 -0
  472. package/dist/cli/skills-content/visual-plan-skill.d.ts +2 -0
  473. package/dist/cli/skills-content/visual-plan-skill.d.ts.map +1 -0
  474. package/dist/cli/skills-content/visual-plan-skill.js +471 -0
  475. package/dist/cli/skills-content/visual-plan-skill.js.map +1 -0
  476. package/dist/cli/skills-content/visual-recap-skill.d.ts +2 -0
  477. package/dist/cli/skills-content/visual-recap-skill.d.ts.map +1 -0
  478. package/dist/cli/skills-content/visual-recap-skill.js +548 -0
  479. package/dist/cli/skills-content/visual-recap-skill.js.map +1 -0
  480. package/dist/cli/skills-content/visualize-repo-skill.d.ts +2 -0
  481. package/dist/cli/skills-content/visualize-repo-skill.d.ts.map +1 -0
  482. package/dist/cli/skills-content/visualize-repo-skill.js +94 -0
  483. package/dist/cli/skills-content/visualize-repo-skill.js.map +1 -0
  484. package/dist/cli/skills-content/wireframe.d.ts +4 -0
  485. package/dist/cli/skills-content/wireframe.d.ts.map +1 -0
  486. package/dist/cli/skills-content/wireframe.js +347 -0
  487. package/dist/cli/skills-content/wireframe.js.map +1 -0
  488. package/dist/cli/skills.d.ts +2 -10
  489. package/dist/cli/skills.d.ts.map +1 -1
  490. package/dist/cli/skills.js +2 -2710
  491. package/dist/cli/skills.js.map +1 -1
  492. package/dist/client/AgentPanel.d.ts.map +1 -1
  493. package/dist/client/AgentPanel.js +4 -2
  494. package/dist/client/AgentPanel.js.map +1 -1
  495. package/dist/client/CommandMenu.d.ts.map +1 -1
  496. package/dist/client/CommandMenu.js +15 -3
  497. package/dist/client/CommandMenu.js.map +1 -1
  498. package/dist/client/FeedbackButton.js +2 -2
  499. package/dist/client/FeedbackButton.js.map +1 -1
  500. package/dist/client/app-providers.d.ts +13 -5
  501. package/dist/client/app-providers.d.ts.map +1 -1
  502. package/dist/client/app-providers.js +9 -6
  503. package/dist/client/app-providers.js.map +1 -1
  504. package/dist/client/chat/tool-call-display.d.ts +4 -0
  505. package/dist/client/chat/tool-call-display.d.ts.map +1 -1
  506. package/dist/client/chat/tool-call-display.js +3 -3
  507. package/dist/client/chat/tool-call-display.js.map +1 -1
  508. package/dist/client/composer/PastedTextChip.js +1 -1
  509. package/dist/client/composer/PastedTextChip.js.map +1 -1
  510. package/dist/client/composer/RealtimeVoiceMode.d.ts +3 -1
  511. package/dist/client/composer/RealtimeVoiceMode.d.ts.map +1 -1
  512. package/dist/client/composer/RealtimeVoiceMode.js +35 -14
  513. package/dist/client/composer/RealtimeVoiceMode.js.map +1 -1
  514. package/dist/client/composer/TiptapComposer.js +1 -1
  515. package/dist/client/composer/TiptapComposer.js.map +1 -1
  516. package/dist/client/composer/VoiceButton.d.ts +2 -0
  517. package/dist/client/composer/VoiceButton.d.ts.map +1 -1
  518. package/dist/client/composer/VoiceButton.js +9 -3
  519. package/dist/client/composer/VoiceButton.js.map +1 -1
  520. package/dist/client/composer/useRealtimeVoiceMode.d.ts +5 -0
  521. package/dist/client/composer/useRealtimeVoiceMode.d.ts.map +1 -1
  522. package/dist/client/composer/useRealtimeVoiceMode.js +91 -12
  523. package/dist/client/composer/useRealtimeVoiceMode.js.map +1 -1
  524. package/dist/client/context-xray/ContextXRayPanel.d.ts.map +1 -1
  525. package/dist/client/context-xray/ContextXRayPanel.js +4 -1
  526. package/dist/client/context-xray/ContextXRayPanel.js.map +1 -1
  527. package/dist/client/extensions/ExtensionEditor.d.ts.map +1 -1
  528. package/dist/client/extensions/ExtensionEditor.js +15 -5
  529. package/dist/client/extensions/ExtensionEditor.js.map +1 -1
  530. package/dist/client/extensions/ExtensionQueryErrorState.d.ts +8 -0
  531. package/dist/client/extensions/ExtensionQueryErrorState.d.ts.map +1 -0
  532. package/dist/client/extensions/ExtensionQueryErrorState.js +11 -0
  533. package/dist/client/extensions/ExtensionQueryErrorState.js.map +1 -0
  534. package/dist/client/extensions/ExtensionSlot.d.ts.map +1 -1
  535. package/dist/client/extensions/ExtensionSlot.js +17 -7
  536. package/dist/client/extensions/ExtensionSlot.js.map +1 -1
  537. package/dist/client/extensions/ExtensionViewer.d.ts.map +1 -1
  538. package/dist/client/extensions/ExtensionViewer.js +17 -7
  539. package/dist/client/extensions/ExtensionViewer.js.map +1 -1
  540. package/dist/client/extensions/ExtensionsListPage.d.ts.map +1 -1
  541. package/dist/client/extensions/ExtensionsListPage.js +5 -3
  542. package/dist/client/extensions/ExtensionsListPage.js.map +1 -1
  543. package/dist/client/extensions/ExtensionsSidebarSection.d.ts.map +1 -1
  544. package/dist/client/extensions/ExtensionsSidebarSection.js +21 -8
  545. package/dist/client/extensions/ExtensionsSidebarSection.js.map +1 -1
  546. package/dist/client/index.d.ts +0 -2
  547. package/dist/client/index.d.ts.map +1 -1
  548. package/dist/client/index.js +0 -5
  549. package/dist/client/index.js.map +1 -1
  550. package/dist/client/progress/RunsTray.d.ts.map +1 -1
  551. package/dist/client/progress/RunsTray.js +7 -3
  552. package/dist/client/progress/RunsTray.js.map +1 -1
  553. package/dist/client/settings/SettingsTabsPage.d.ts.map +1 -1
  554. package/dist/client/settings/SettingsTabsPage.js +4 -0
  555. package/dist/client/settings/SettingsTabsPage.js.map +1 -1
  556. package/dist/client/settings/useBuilderStatus.d.ts +2 -0
  557. package/dist/client/settings/useBuilderStatus.d.ts.map +1 -1
  558. package/dist/client/settings/useBuilderStatus.js +4 -0
  559. package/dist/client/settings/useBuilderStatus.js.map +1 -1
  560. package/dist/client/tool-cells/EditCell.d.ts.map +1 -1
  561. package/dist/client/tool-cells/EditCell.js +2 -1
  562. package/dist/client/tool-cells/EditCell.js.map +1 -1
  563. package/dist/client/tool-cells/FilesChangedSummary.d.ts.map +1 -1
  564. package/dist/client/tool-cells/FilesChangedSummary.js +2 -1
  565. package/dist/client/tool-cells/FilesChangedSummary.js.map +1 -1
  566. package/dist/client/tool-cells/WriteCell.d.ts.map +1 -1
  567. package/dist/client/tool-cells/WriteCell.js +2 -1
  568. package/dist/client/tool-cells/WriteCell.js.map +1 -1
  569. package/dist/client/visual-style-controls.js +1 -1
  570. package/dist/client/visual-style-controls.js.map +1 -1
  571. package/dist/collab/routes.d.ts +1 -1
  572. package/dist/deploy/build.d.ts.map +1 -1
  573. package/dist/deploy/build.js +36 -14
  574. package/dist/deploy/build.js.map +1 -1
  575. package/dist/integrations/google-docs-poller.d.ts +7 -0
  576. package/dist/integrations/google-docs-poller.d.ts.map +1 -1
  577. package/dist/integrations/google-docs-poller.js +13 -3
  578. package/dist/integrations/google-docs-poller.js.map +1 -1
  579. package/dist/integrations/plugin.d.ts.map +1 -1
  580. package/dist/integrations/plugin.js +10 -0
  581. package/dist/integrations/plugin.js.map +1 -1
  582. package/dist/integrations/webhook-handler.d.ts +11 -0
  583. package/dist/integrations/webhook-handler.d.ts.map +1 -1
  584. package/dist/integrations/webhook-handler.js +16 -4
  585. package/dist/integrations/webhook-handler.js.map +1 -1
  586. package/dist/jobs/scheduler.d.ts +12 -0
  587. package/dist/jobs/scheduler.d.ts.map +1 -1
  588. package/dist/jobs/scheduler.js +13 -3
  589. package/dist/jobs/scheduler.js.map +1 -1
  590. package/dist/localization/default-messages.d.ts +7 -0
  591. package/dist/localization/default-messages.d.ts.map +1 -1
  592. package/dist/localization/default-messages.js +8 -1
  593. package/dist/localization/default-messages.js.map +1 -1
  594. package/dist/mcp/oauth-token.d.ts +1 -1
  595. package/dist/mcp/oauth-token.d.ts.map +1 -1
  596. package/dist/mcp/oauth-token.js +6 -1
  597. package/dist/mcp/oauth-token.js.map +1 -1
  598. package/dist/notifications/routes.d.ts +2 -2
  599. package/dist/observability/routes.d.ts.map +1 -1
  600. package/dist/observability/routes.js +32 -0
  601. package/dist/observability/routes.js.map +1 -1
  602. package/dist/observability/sentiment.d.ts +42 -0
  603. package/dist/observability/sentiment.d.ts.map +1 -0
  604. package/dist/observability/sentiment.js +196 -0
  605. package/dist/observability/sentiment.js.map +1 -0
  606. package/dist/observability/store.d.ts +5 -0
  607. package/dist/observability/store.d.ts.map +1 -1
  608. package/dist/observability/store.js +17 -0
  609. package/dist/observability/store.js.map +1 -1
  610. package/dist/observability/traces.d.ts +2 -0
  611. package/dist/observability/traces.d.ts.map +1 -1
  612. package/dist/observability/traces.js +42 -57
  613. package/dist/observability/traces.js.map +1 -1
  614. package/dist/observability/tracking-identity.d.ts +3 -0
  615. package/dist/observability/tracking-identity.d.ts.map +1 -0
  616. package/dist/observability/tracking-identity.js +51 -0
  617. package/dist/observability/tracking-identity.js.map +1 -0
  618. package/dist/observability/types.d.ts +10 -0
  619. package/dist/observability/types.d.ts.map +1 -1
  620. package/dist/observability/types.js +3 -0
  621. package/dist/observability/types.js.map +1 -1
  622. package/dist/progress/routes.d.ts +1 -1
  623. package/dist/provider-api/corpus-jobs.d.ts +2 -2
  624. package/dist/resources/handlers.d.ts +1 -1
  625. package/dist/secrets/storage.d.ts +6 -0
  626. package/dist/secrets/storage.d.ts.map +1 -1
  627. package/dist/secrets/storage.js +61 -3
  628. package/dist/secrets/storage.js.map +1 -1
  629. package/dist/server/agent-chat/action-filters-a2a.d.ts +50 -0
  630. package/dist/server/agent-chat/action-filters-a2a.d.ts.map +1 -0
  631. package/dist/server/agent-chat/action-filters-a2a.js +127 -0
  632. package/dist/server/agent-chat/action-filters-a2a.js.map +1 -0
  633. package/dist/server/agent-chat/browser-team-tools.d.ts +21 -0
  634. package/dist/server/agent-chat/browser-team-tools.d.ts.map +1 -0
  635. package/dist/server/agent-chat/browser-team-tools.js +417 -0
  636. package/dist/server/agent-chat/browser-team-tools.js.map +1 -0
  637. package/dist/server/agent-chat/context-tools.d.ts +33 -0
  638. package/dist/server/agent-chat/context-tools.d.ts.map +1 -0
  639. package/dist/server/agent-chat/context-tools.js +520 -0
  640. package/dist/server/agent-chat/context-tools.js.map +1 -0
  641. package/dist/server/agent-chat/framework-prompts.d.ts +65 -0
  642. package/dist/server/agent-chat/framework-prompts.d.ts.map +1 -0
  643. package/dist/server/agent-chat/framework-prompts.js +403 -0
  644. package/dist/server/agent-chat/framework-prompts.js.map +1 -0
  645. package/dist/server/agent-chat/lazy-fs.d.ts +2 -0
  646. package/dist/server/agent-chat/lazy-fs.d.ts.map +1 -0
  647. package/dist/server/agent-chat/lazy-fs.js +11 -0
  648. package/dist/server/agent-chat/lazy-fs.js.map +1 -0
  649. package/dist/server/agent-chat/mcp-glue.d.ts +9 -0
  650. package/dist/server/agent-chat/mcp-glue.d.ts.map +1 -0
  651. package/dist/server/agent-chat/mcp-glue.js +63 -0
  652. package/dist/server/agent-chat/mcp-glue.js.map +1 -0
  653. package/dist/server/agent-chat/plugin-options.d.ts +322 -0
  654. package/dist/server/agent-chat/plugin-options.d.ts.map +1 -0
  655. package/dist/server/agent-chat/plugin-options.js +2 -0
  656. package/dist/server/agent-chat/plugin-options.js.map +1 -0
  657. package/dist/server/agent-chat/process-run-failure.d.ts +12 -0
  658. package/dist/server/agent-chat/process-run-failure.d.ts.map +1 -0
  659. package/dist/server/agent-chat/process-run-failure.js +24 -0
  660. package/dist/server/agent-chat/process-run-failure.js.map +1 -0
  661. package/dist/server/agent-chat/prompt-resources.d.ts +28 -0
  662. package/dist/server/agent-chat/prompt-resources.d.ts.map +1 -0
  663. package/dist/server/agent-chat/prompt-resources.js +514 -0
  664. package/dist/server/agent-chat/prompt-resources.js.map +1 -0
  665. package/dist/server/agent-chat/recurring-jobs-runtime.d.ts +5 -0
  666. package/dist/server/agent-chat/recurring-jobs-runtime.d.ts.map +1 -0
  667. package/dist/server/agent-chat/recurring-jobs-runtime.js +53 -0
  668. package/dist/server/agent-chat/recurring-jobs-runtime.js.map +1 -0
  669. package/dist/server/agent-chat/request-surface.d.ts +8 -0
  670. package/dist/server/agent-chat/request-surface.d.ts.map +1 -0
  671. package/dist/server/agent-chat/request-surface.js +56 -0
  672. package/dist/server/agent-chat/request-surface.js.map +1 -0
  673. package/dist/server/agent-chat/run-code-tools.d.ts +17 -0
  674. package/dist/server/agent-chat/run-code-tools.d.ts.map +1 -0
  675. package/dist/server/agent-chat/run-code-tools.js +55 -0
  676. package/dist/server/agent-chat/run-code-tools.js.map +1 -0
  677. package/dist/server/agent-chat/script-entries.d.ts +47 -0
  678. package/dist/server/agent-chat/script-entries.d.ts.map +1 -0
  679. package/dist/server/agent-chat/script-entries.js +633 -0
  680. package/dist/server/agent-chat/script-entries.js.map +1 -0
  681. package/dist/server/agent-chat/shared-thread.d.ts +33 -0
  682. package/dist/server/agent-chat/shared-thread.d.ts.map +1 -0
  683. package/dist/server/agent-chat/shared-thread.js +242 -0
  684. package/dist/server/agent-chat/shared-thread.js.map +1 -0
  685. package/dist/server/agent-chat/skill-frontmatter.d.ts +7 -0
  686. package/dist/server/agent-chat/skill-frontmatter.d.ts.map +1 -0
  687. package/dist/server/agent-chat/skill-frontmatter.js +26 -0
  688. package/dist/server/agent-chat/skill-frontmatter.js.map +1 -0
  689. package/dist/server/agent-chat-plugin.d.ts +45 -486
  690. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  691. package/dist/server/agent-chat-plugin.js +173 -3005
  692. package/dist/server/agent-chat-plugin.js.map +1 -1
  693. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  694. package/dist/server/agent-teams.d.ts +10 -0
  695. package/dist/server/agent-teams.d.ts.map +1 -1
  696. package/dist/server/agent-teams.js +13 -3
  697. package/dist/server/agent-teams.js.map +1 -1
  698. package/dist/server/auth.d.ts.map +1 -1
  699. package/dist/server/auth.js +50 -52
  700. package/dist/server/auth.js.map +1 -1
  701. package/dist/server/credential-provider.d.ts.map +1 -1
  702. package/dist/server/credential-provider.js +22 -21
  703. package/dist/server/credential-provider.js.map +1 -1
  704. package/dist/server/edge.d.ts +1 -0
  705. package/dist/server/edge.d.ts.map +1 -1
  706. package/dist/server/edge.js +1 -0
  707. package/dist/server/edge.js.map +1 -1
  708. package/dist/server/onboarding-html.d.ts.map +1 -1
  709. package/dist/server/onboarding-html.js +1 -16
  710. package/dist/server/onboarding-html.js.map +1 -1
  711. package/dist/server/realtime-voice.d.ts +3 -0
  712. package/dist/server/realtime-voice.d.ts.map +1 -1
  713. package/dist/server/realtime-voice.js +29 -5
  714. package/dist/server/realtime-voice.js.map +1 -1
  715. package/dist/server/request-origin.d.ts.map +1 -1
  716. package/dist/server/request-origin.js +6 -3
  717. package/dist/server/request-origin.js.map +1 -1
  718. package/dist/server/ssr-handler.d.ts.map +1 -1
  719. package/dist/server/ssr-handler.js +47 -2
  720. package/dist/server/ssr-handler.js.map +1 -1
  721. package/dist/sharing/access.d.ts +63 -3
  722. package/dist/sharing/access.d.ts.map +1 -1
  723. package/dist/sharing/access.js +53 -15
  724. package/dist/sharing/access.js.map +1 -1
  725. package/dist/sharing/registry.d.ts +7 -0
  726. package/dist/sharing/registry.d.ts.map +1 -1
  727. package/dist/sharing/registry.js.map +1 -1
  728. package/dist/styles/agent-native.css +15 -14
  729. package/dist/templates/default/.agents/skills/frontend-design/SKILL.md +1 -1
  730. package/dist/templates/default/app/i18n/ar-SA.ts +6 -0
  731. package/dist/templates/default/app/i18n/de-DE.ts +6 -0
  732. package/dist/templates/default/app/i18n/en-US.ts +6 -0
  733. package/dist/templates/default/app/i18n/es-ES.ts +6 -0
  734. package/dist/templates/default/app/i18n/fr-FR.ts +6 -0
  735. package/dist/templates/default/app/i18n/hi-IN.ts +6 -0
  736. package/dist/templates/default/app/i18n/ja-JP.ts +6 -0
  737. package/dist/templates/default/app/i18n/ko-KR.ts +6 -0
  738. package/dist/templates/default/app/i18n/pt-BR.ts +6 -0
  739. package/dist/templates/default/app/i18n/zh-CN.ts +6 -0
  740. package/dist/templates/default/app/i18n/zh-TW.ts +6 -0
  741. package/dist/templates/workspace-core/.agents/skills/authentication/SKILL.md +27 -29
  742. package/dist/templates/workspace-core/.agents/skills/external-agents/SKILL.md +2 -1
  743. package/dist/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +1 -1
  744. package/dist/templates/workspace-core/.agents/skills/observability/SKILL.md +32 -0
  745. package/dist/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +25 -0
  746. package/dist/templates/workspace-core/src/server/index.ts +4 -2
  747. package/dist/testing.d.ts +16 -0
  748. package/dist/testing.d.ts.map +1 -0
  749. package/dist/testing.js +16 -0
  750. package/dist/testing.js.map +1 -0
  751. package/dist/triggers/dispatcher.d.ts +7 -0
  752. package/dist/triggers/dispatcher.d.ts.map +1 -1
  753. package/dist/triggers/dispatcher.js +13 -3
  754. package/dist/triggers/dispatcher.js.map +1 -1
  755. package/dist/vite/client.d.ts +16 -1
  756. package/dist/vite/client.d.ts.map +1 -1
  757. package/dist/vite/client.js +105 -2
  758. package/dist/vite/client.js.map +1 -1
  759. package/docs/content/authentication.mdx +3 -3
  760. package/docs/content/doctor.mdx +170 -0
  761. package/docs/content/external-agents.mdx +8 -7
  762. package/docs/content/locales/ar-SA/authentication.mdx +2 -2
  763. package/docs/content/locales/ar-SA/external-agents.mdx +8 -7
  764. package/docs/content/locales/ar-SA/mcp-protocol.mdx +1 -1
  765. package/docs/content/locales/ar-SA/security.mdx +2 -0
  766. package/docs/content/locales/de-DE/authentication.mdx +1 -1
  767. package/docs/content/locales/de-DE/external-agents.mdx +8 -7
  768. package/docs/content/locales/de-DE/mcp-protocol.mdx +1 -1
  769. package/docs/content/locales/de-DE/security.mdx +2 -0
  770. package/docs/content/locales/es-ES/authentication.mdx +2 -2
  771. package/docs/content/locales/es-ES/external-agents.mdx +8 -7
  772. package/docs/content/locales/es-ES/mcp-protocol.mdx +1 -1
  773. package/docs/content/locales/es-ES/security.mdx +2 -0
  774. package/docs/content/locales/fr-FR/authentication.mdx +1 -1
  775. package/docs/content/locales/fr-FR/external-agents.mdx +8 -7
  776. package/docs/content/locales/fr-FR/mcp-protocol.mdx +1 -1
  777. package/docs/content/locales/fr-FR/security.mdx +2 -0
  778. package/docs/content/locales/hi-IN/authentication.mdx +2 -2
  779. package/docs/content/locales/hi-IN/external-agents.mdx +8 -7
  780. package/docs/content/locales/hi-IN/mcp-protocol.mdx +1 -1
  781. package/docs/content/locales/hi-IN/security.mdx +2 -0
  782. package/docs/content/locales/ja-JP/authentication.mdx +2 -2
  783. package/docs/content/locales/ja-JP/external-agents.mdx +8 -7
  784. package/docs/content/locales/ja-JP/mcp-protocol.mdx +1 -1
  785. package/docs/content/locales/ja-JP/security.mdx +2 -0
  786. package/docs/content/locales/ko-KR/authentication.mdx +2 -2
  787. package/docs/content/locales/ko-KR/external-agents.mdx +8 -7
  788. package/docs/content/locales/ko-KR/mcp-protocol.mdx +1 -1
  789. package/docs/content/locales/ko-KR/security.mdx +2 -0
  790. package/docs/content/locales/pt-BR/authentication.mdx +2 -2
  791. package/docs/content/locales/pt-BR/external-agents.mdx +8 -7
  792. package/docs/content/locales/pt-BR/mcp-protocol.mdx +1 -1
  793. package/docs/content/locales/pt-BR/security.mdx +2 -0
  794. package/docs/content/locales/zh-CN/authentication.mdx +2 -2
  795. package/docs/content/locales/zh-CN/external-agents.mdx +8 -7
  796. package/docs/content/locales/zh-CN/mcp-protocol.mdx +1 -1
  797. package/docs/content/locales/zh-CN/security.mdx +2 -0
  798. package/docs/content/locales/zh-TW/authentication.mdx +2 -2
  799. package/docs/content/locales/zh-TW/external-agents.mdx +8 -7
  800. package/docs/content/locales/zh-TW/mcp-protocol.mdx +1 -1
  801. package/docs/content/locales/zh-TW/security.mdx +2 -0
  802. package/docs/content/mcp-protocol.mdx +1 -1
  803. package/docs/content/security.mdx +2 -0
  804. package/package.json +6 -2
  805. package/src/templates/default/.agents/skills/frontend-design/SKILL.md +1 -1
  806. package/src/templates/default/app/i18n/ar-SA.ts +6 -0
  807. package/src/templates/default/app/i18n/de-DE.ts +6 -0
  808. package/src/templates/default/app/i18n/en-US.ts +6 -0
  809. package/src/templates/default/app/i18n/es-ES.ts +6 -0
  810. package/src/templates/default/app/i18n/fr-FR.ts +6 -0
  811. package/src/templates/default/app/i18n/hi-IN.ts +6 -0
  812. package/src/templates/default/app/i18n/ja-JP.ts +6 -0
  813. package/src/templates/default/app/i18n/ko-KR.ts +6 -0
  814. package/src/templates/default/app/i18n/pt-BR.ts +6 -0
  815. package/src/templates/default/app/i18n/zh-CN.ts +6 -0
  816. package/src/templates/default/app/i18n/zh-TW.ts +6 -0
  817. package/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +27 -29
  818. package/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +2 -1
  819. package/src/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +1 -1
  820. package/src/templates/workspace-core/.agents/skills/observability/SKILL.md +32 -0
  821. package/src/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +25 -0
  822. package/src/templates/workspace-core/src/server/index.ts +4 -2
  823. package/corpus/core/src/client/ProductionAgentPanel.tsx +0 -9
  824. package/corpus/core/src/client/auth-redirect-url.ts +0 -23
  825. package/corpus/core/src/client/useProductionAgent.ts +0 -253
  826. package/corpus/core/src/shared/auth-redirect-url.ts +0 -1
  827. package/corpus/templates/analytics/app/pages/Index.tsx +0 -16
  828. package/corpus/templates/analytics/seeds/dashboards/agent-observability-llm.json +0 -173
  829. package/dist/client/ProductionAgentPanel.d.ts +0 -6
  830. package/dist/client/ProductionAgentPanel.d.ts.map +0 -1
  831. package/dist/client/ProductionAgentPanel.js +0 -6
  832. package/dist/client/ProductionAgentPanel.js.map +0 -1
  833. package/dist/client/auth-redirect-url.d.ts +0 -2
  834. package/dist/client/auth-redirect-url.d.ts.map +0 -1
  835. package/dist/client/auth-redirect-url.js +0 -19
  836. package/dist/client/auth-redirect-url.js.map +0 -1
  837. package/dist/client/useProductionAgent.d.ts +0 -24
  838. package/dist/client/useProductionAgent.d.ts.map +0 -1
  839. package/dist/client/useProductionAgent.js +0 -179
  840. package/dist/client/useProductionAgent.js.map +0 -1
  841. package/dist/shared/auth-redirect-url.d.ts +0 -2
  842. package/dist/shared/auth-redirect-url.d.ts.map +0 -1
  843. package/dist/shared/auth-redirect-url.js +0 -2
  844. package/dist/shared/auth-redirect-url.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"tool-call-display.d.ts","sourceRoot":"","sources":["../../../src/client/chat/tool-call-display.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAgBpE,OAAO,KAMN,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ACvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,qBAyCA;AAKD,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
@@ -181,7 +181,7 @@ function ToolOutputPopover({ open, onOpenChange, title, payload, children, }) {
181
181
  return (_jsxs(Popover, { open: open, onOpenChange: onOpenChange, children: [_jsx(PopoverTrigger, { asChild: true, children: children }), _jsxs(PopoverContent, { align: "start", side: "bottom", sideOffset: 6, collisionPadding: 12, className: "flex max-h-[min(calc(100vh-2rem),var(--radix-popover-content-available-height,75vh))] w-[min(calc(100vw-2rem),var(--radix-popover-content-available-width,760px),760px)] flex-col gap-0 overflow-hidden p-0", children: [_jsxs("div", { className: "flex shrink-0 items-center justify-between gap-3 border-b border-border px-4 py-3", children: [_jsx("div", { className: "truncate text-sm font-medium", children: title }), _jsxs("button", { type: "button", onClick: copyValue, className: "inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs text-muted-foreground hover:bg-accent hover:text-foreground", children: [copied ? _jsx(IconCheck, { size: 13 }) : _jsx(IconCopy, { size: 13 }), copied ? "Copied" : "Copy"] })] }), _jsx("div", { className: "min-h-0 flex-1 overflow-hidden p-3", children: _jsx(SimpleCodeViewer, { text: payload.text, lang: payload.lang, maxHeightClass: "max-h-[min(70vh,calc(var(--radix-popover-content-available-height,75vh)-4.5rem))]" }) })] })] }));
182
182
  }
183
183
  // ─── Collapsible height animation ─────────────────────────────────────────────
184
- function AnimatedCollapse({ open, children, }) {
184
+ export function AnimatedCollapse({ open, children, }) {
185
185
  const ref = useRef(null);
186
186
  const [height, setHeight] = useState(open ? "auto" : 0);
187
187
  const [mounted, setMounted] = useState(open);
@@ -225,7 +225,7 @@ function AnimatedCollapse({ open, children, }) {
225
225
  }, [open]);
226
226
  if (!mounted)
227
227
  return null;
228
- return (_jsx("div", { ref: ref, className: "overflow-hidden transition-[height] duration-200 ease-out", style: { height: height === "auto" ? "auto" : `${height}px` }, onTransitionEnd: onTransitionEnd, children: children }));
228
+ return (_jsx("div", { ref: ref, className: "overflow-hidden transition-[height] duration-200 ease-[var(--ease-collapse)]", style: { height: height === "auto" ? "auto" : `${height}px` }, onTransitionEnd: onTransitionEnd, children: children }));
229
229
  }
230
230
  // ─── Human-in-the-loop approval affordance ────────────────────────────────────
231
231
  /**
@@ -368,7 +368,7 @@ function ToolCallDisplayGeneric({ toolName, argsText, args, result, mcpApp, chat
368
368
  const isExpanded = isAgentCall ? hasStreamText && expanded : expanded;
369
369
  const ToolIcon = resolveToolIcon(toolName);
370
370
  const outputTitle = `Raw ${toolName} tool call output`;
371
- return (_jsxs("div", { className: "group/tool my-0.5 w-full overflow-hidden", children: [mcpApp && _jsx(McpAppRenderer, { app: mcpApp, className: "mb-1.5" }), _jsxs("button", { type: "button", onClick: () => canExpand && setExpanded(!isExpanded), "aria-expanded": canExpand ? isExpanded : undefined, className: cn("flex w-full items-center gap-1.5 rounded-md py-0.5 text-left text-[13px] text-muted-foreground transition-colors", canExpand && "hover:text-foreground", isRunning && "text-muted-foreground"), children: [_jsx("span", { className: "relative flex size-4 shrink-0 items-center justify-center", children: isRunning ? (_jsx(IconLoader2, { className: "size-3.5 animate-spin" })) : isAgentError ? (_jsx(IconCircleX, { className: "size-3.5 text-destructive" })) : (_jsxs(_Fragment, { children: [_jsx(ToolIcon, { className: cn("size-3.5 transition-opacity", canExpand && "group-hover/tool:opacity-0") }), canExpand && (_jsx(IconChevronRight, { className: cn("absolute size-3.5 opacity-0 transition-all group-hover/tool:opacity-100", isExpanded && "rotate-90") }))] })) }), _jsx("span", { className: "min-w-0 truncate font-normal", children: displayName }), repeatCount && repeatCount > 1 && (_jsxs("span", { className: "shrink-0 rounded border border-border/60 px-1.5 py-0.5 text-[10px] leading-none text-muted-foreground", title: `Repeated ${repeatCount} times`, children: [repeatCount, "x"] }))] }), _jsx(AnimatedCollapse, { open: isExpanded && isAgentCall && hasStreamText, children: _jsx("div", { ref: streamRef, className: "mt-1 rounded-md bg-muted/50 px-3 py-2 text-xs text-muted-foreground break-words max-h-48 overflow-y-auto agent-markdown prose prose-sm prose-invert max-w-none", children: markdownModule?.default && remarkGfmFn ? (_jsx(markdownModule.default, { remarkPlugins: [remarkGfmFn], components: markdownComponents, urlTransform: markdownUrlTransform, children: agentStreamText })) : (_jsx("span", { style: { whiteSpace: "pre-wrap" }, children: agentStreamText })) }) }), _jsx(AnimatedCollapse, { open: isExpanded && !isAgentCall && (hasArgs || result !== undefined), children: _jsxs("div", { className: "mt-1 space-y-2 pl-5", children: [inputPayload && (_jsx(SimpleCodeViewer, { text: inputPayload.text, lang: inputPayload.lang })), resultPayload && (_jsx(ToolOutputPopover, { open: outputOpen, onOpenChange: setOutputOpen, title: outputTitle, payload: resultPayload, children: _jsx("button", { type: "button", "aria-label": `View ${toolName} output`, className: "inline-flex size-6 items-center justify-center rounded-md text-muted-foreground/70 transition-colors hover:bg-accent hover:text-foreground", children: _jsx(IconCode, { className: "size-3.5" }) }) }))] }) }), approval && (_jsx(ApprovalAffordance, { toolName: toolName, approval: approval }))] }));
371
+ return (_jsxs("div", { className: "group/tool my-0.5 w-full overflow-hidden", children: [mcpApp && _jsx(McpAppRenderer, { app: mcpApp, className: "mb-1.5" }), _jsxs("button", { type: "button", onClick: () => canExpand && setExpanded(!isExpanded), "aria-expanded": canExpand ? isExpanded : undefined, className: cn("flex w-full items-center gap-1.5 rounded-md py-0.5 text-left text-[13px] text-muted-foreground transition-colors", canExpand && "hover:text-foreground", isRunning && "text-muted-foreground"), children: [_jsx("span", { className: "relative flex size-4 shrink-0 items-center justify-center", children: isRunning ? (_jsx(IconLoader2, { className: "size-3.5 animate-spin" })) : isAgentError ? (_jsx(IconCircleX, { className: "size-3.5 text-destructive" })) : (_jsxs(_Fragment, { children: [_jsx(ToolIcon, { className: cn("size-3.5 transition-opacity", canExpand && "group-hover/tool:opacity-0") }), canExpand && (_jsx(IconChevronRight, { className: cn("absolute size-3.5 opacity-0 transition-[opacity,transform] group-hover/tool:opacity-100", isExpanded && "rotate-90") }))] })) }), _jsx("span", { className: "min-w-0 truncate font-normal", children: displayName }), repeatCount && repeatCount > 1 && (_jsxs("span", { className: "shrink-0 rounded border border-border/60 px-1.5 py-0.5 text-[10px] leading-none text-muted-foreground", title: `Repeated ${repeatCount} times`, children: [repeatCount, "x"] }))] }), _jsx(AnimatedCollapse, { open: isExpanded && isAgentCall && hasStreamText, children: _jsx("div", { ref: streamRef, className: "mt-1 rounded-md bg-muted/50 px-3 py-2 text-xs text-muted-foreground break-words max-h-48 overflow-y-auto agent-markdown prose prose-sm prose-invert max-w-none", children: markdownModule?.default && remarkGfmFn ? (_jsx(markdownModule.default, { remarkPlugins: [remarkGfmFn], components: markdownComponents, urlTransform: markdownUrlTransform, children: agentStreamText })) : (_jsx("span", { style: { whiteSpace: "pre-wrap" }, children: agentStreamText })) }) }), _jsx(AnimatedCollapse, { open: isExpanded && !isAgentCall && (hasArgs || result !== undefined), children: _jsxs("div", { className: "mt-1 space-y-2 pl-5", children: [inputPayload && (_jsx(SimpleCodeViewer, { text: inputPayload.text, lang: inputPayload.lang })), resultPayload && (_jsx(ToolOutputPopover, { open: outputOpen, onOpenChange: setOutputOpen, title: outputTitle, payload: resultPayload, children: _jsx("button", { type: "button", "aria-label": `View ${toolName} output`, className: "inline-flex size-6 items-center justify-center rounded-md text-muted-foreground/70 transition-colors hover:bg-accent hover:text-foreground", children: _jsx(IconCode, { className: "size-3.5" }) }) }))] }) }), approval && (_jsx(ApprovalAffordance, { toolName: toolName, approval: approval }))] }));
372
372
  }
373
373
  // ─── ToolCallFallback ──────────────────────────────────────────────────────────
374
374
  export function ToolCallFallback({ toolName, args, argsText, result, ...rest }) {
@@ -1 +1 @@
1
- {"version":3,"file":"tool-call-display.js","sourceRoot":"","sources":["../../../src/client/chat/tool-call-display.tsx"],"names":[],"mappings":";AAIA,OAAO,EACL,WAAW,EACX,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,aAAa,EACb,YAAY,E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AC,CAAC;QACH,OAAO,GAAG,EAAE,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,MAAM,KAAK,GACT,UAAU,IAAI,IAAI,IAAI,UAAU,IAAI,IAAI;QACtC,CAAC,CAAC,cAAc,oBAAoB,CAAC,UAAU,CAAC,EAAE;QAClD,CAAC,CAAC,QAAQ,CAAC;IAEf,OAAO,CACL,eAAK,SAAS,EAAC,aAAa,aAC1B,kBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,mBAClB,IAAI,EACnB,SAAS,EAAC,4GAA4G,aAEtH,yBAAO,KAAK,GAAQ,EACpB,KAAC,gBAAgB,IACf,SAAS,EAAE,EAAE,CACX,wCAAwC,EACxC,IAAI,IAAI,WAAW,CACpB,GACD,IACK,EACT,KAAC,gBAAgB,IAAC,IAAI,EAAE,IAAI,YAC1B,KAAC,yBAAyB,CAAC,QAAQ,IAAC,KAAK,kBACvC,cAAK,SAAS,EAAC,MAAM,YAAE,QAAQ,GAAO,GACH,GACpB,IACf,CACP,CAAC;AACJ,CAAC;AAED,iFAAiF;AACjF,8EAA8E;AAC9E,+DAA+D;AAC/D,OAAO,EAAE,mBAAmB,EAAE,CAAC","sourcesContent":["// Owns: tool-payload formatting helpers, ToolCallDisplay, ToolCallFallback,\n// and ReconnectStreamMessage used by AssistantChat.\n\nimport type { ToolCallMessagePartProps } from \"@assistant-ui/react\";\nimport {\n IconLoader2,\n IconCircleX,\n IconCheck,\n IconChevronRight,\n IconCopy,\n IconCode,\n IconBrandSlack,\n IconTerminal2,\n IconDatabase,\n IconSearch,\n IconFileCode,\n IconShieldCheck,\n IconX,\n} from \"@tabler/icons-react\";\nimport React, {\n useState,\n useEffect,\n useCallback,\n useLayoutEffect,\n useRef,\n} from \"react\";\n\nimport type { ActionChatUIConfig } from \"../../action-ui.js\";\nimport type { AgentMcpAppPayload } from \"../../mcp-client/app-result.js\";\nimport { AgentTaskCard } from \"../AgentTaskCard.js\";\nimport { writeClipboardText } from \"../clipboard.js\";\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"../components/ui/popover.js\";\nimport { ConnectBuilderCard } from \"../ConnectBuilderCard.js\";\nimport { McpAppRenderer } from \"../mcp-apps/McpAppRenderer.js\";\nimport type { ContentPart } from \"../sse-event-processor.js\";\nimport {\n BashCell,\n EditCell,\n WriteCell,\n FilesChangedSummary,\n} from \"../tool-cells/index.js\";\nimport { humanizeToolName } from \"../tool-display.js\";\nimport { cn } from \"../utils.js\";\nimport {\n SmoothMarkdownText,\n HighlightedCodeBlock,\n markdownComponents,\n markdownModule,\n remarkGfmFn,\n markdownUrlTransform,\n} from \"./markdown-renderer.js\";\nimport { resolveToolRenderer } from \"./tool-render-registry.js\";\nimport {\n isBuiltinDataWidgetActionRenderer,\n resolveBuiltinActionChatRenderer,\n resolveBuiltinFallbackToolRenderer,\n} from \"./widgets/builtin-tool-renderers.js\";\n\n// Exported so AssistantChatInner can provide a context value.\nexport const ChatRunningContext = React.createContext(false);\n\n/**\n * Human-in-the-loop approval bridge. `AssistantChatInner` provides a value that\n * re-issues the turn approving a specific paused tool call (opt-in\n * `needsApproval` actions). When null, the Approve button is not rendered.\n * Deny defaults to local-only (the action stays un-run) unless `onDeny` is\n * provided, and \"Always allow\" only renders when `onAlwaysAllow` is provided\n * — both are additive so existing action-approval consumers are unaffected.\n */\nexport type ApprovalContextValue = {\n /** Re-issue the turn so the server runs the approved call. */\n onApprove: (approvalKey: string) => void;\n /**\n * Optional host hook invoked in addition to the local \"denied\" state, e.g.\n * so a Code session can also resolve its own pending approval as denied.\n */\n onDeny?: (approvalKey: string) => void;\n /**\n * Optional host hook that persists this exact call so future occurrences\n * skip the approval gate. When absent, no \"Always allow\" button renders.\n */\n onAlwaysAllow?: (approvalKey: string) => void;\n};\nexport const ApprovalContext = React.createContext<ApprovalContextValue | null>(\n null,\n);\n\nexport const TOOL_LONG_RUNNING_HINT_DELAY_MS = 45_000;\n\nfunction ToolLongRunningHintShell({\n toolName,\n isRunning,\n children,\n}: {\n toolName: string;\n isRunning: boolean;\n children: React.ReactNode;\n}) {\n const [showLongRunningHint, setShowLongRunningHint] = useState(false);\n\n useEffect(() => {\n if (!isRunning) {\n setShowLongRunningHint(false);\n return;\n }\n setShowLongRunningHint(false);\n const timeout = window.setTimeout(() => {\n setShowLongRunningHint(true);\n }, TOOL_LONG_RUNNING_HINT_DELAY_MS);\n return () => window.clearTimeout(timeout);\n }, [isRunning, toolName]);\n\n return (\n <>\n {children}\n {isRunning && showLongRunningHint && (\n <div className=\"mt-0.5 px-2.5 text-[11px] leading-snug text-muted-foreground/80\">\n Still working. Large updates can take a minute or two.\n </div>\n )}\n </>\n );\n}\n\n// ─── Tool-payload formatting ──────────────────────────────────────────────────\n\ntype ToolDetailSection = \"input\" | \"result\";\nexport type ToolDetailPayload = {\n section: ToolDetailSection;\n title: string;\n text: string;\n copyText: string;\n lang: string;\n};\n\nfunction stringifyToolValue(value: unknown, pretty = false): string {\n if (typeof value === \"string\") return value;\n try {\n return JSON.stringify(value, null, pretty ? 2 : 0);\n } catch {\n return String(value ?? \"\");\n }\n}\n\nfunction looksLikeSql(text: string): boolean {\n return /^\\s*(select|with|insert|update|delete|merge|create|alter|drop|explain|declare|begin)\\b/i.test(\n text,\n );\n}\n\nfunction parseJsonText(text: string): unknown | null {\n const trimmed = text.trim();\n if (!trimmed || !/^[{[]/.test(trimmed)) return null;\n try {\n return JSON.parse(trimmed);\n } catch {\n return null;\n }\n}\n\nfunction inferToolTextLanguage(\n text: string,\n key?: string,\n toolName?: string,\n): string {\n const keyName = (key ?? \"\").toLowerCase();\n const tool = (toolName ?? \"\").toLowerCase();\n if (\n keyName === \"code\" &&\n (tool.includes(\"run-code\") || tool.includes(\"run_code\"))\n ) {\n return \"javascript\";\n }\n if (\n keyName === \"sql\" ||\n keyName.endsWith(\"sql\") ||\n keyName === \"query\" ||\n tool.includes(\"bigquery\") ||\n tool.includes(\"db-query\") ||\n looksLikeSql(text)\n ) {\n return \"sql\";\n }\n return parseJsonText(text) ? \"json\" : \"text\";\n}\n\nfunction formatToolTextValue(\n value: unknown,\n key?: string,\n toolName?: string,\n): { text: string; lang: string } {\n if (typeof value === \"string\") {\n const parsed = parseJsonText(value);\n if (parsed) {\n return { text: JSON.stringify(parsed, null, 2), lang: \"json\" };\n }\n return {\n text: value,\n lang: inferToolTextLanguage(value, key, toolName),\n };\n }\n return { text: stringifyToolValue(value, true), lang: \"json\" };\n}\n\nexport function toolInputPayload(\n toolName: string,\n args: Record<string, unknown>,\n): ToolDetailPayload | null {\n const entries = Object.entries(args);\n if (entries.length === 0) return null;\n if (entries.length === 1) {\n const [key, value] = entries[0]!;\n const formatted = formatToolTextValue(value, key, toolName);\n const normalizedKey = key.toLowerCase();\n const keyLabel =\n normalizedKey === \"sql\" || normalizedKey.endsWith(\"sql\") ? \"SQL\" : key;\n return {\n section: \"input\",\n title: `Input - ${keyLabel}`,\n text: formatted.text,\n copyText:\n typeof value === \"string\" ? value : stringifyToolValue(value, true),\n lang: formatted.lang,\n };\n }\n return {\n section: \"input\",\n title: \"Input\",\n text: JSON.stringify(args, null, 2),\n copyText: JSON.stringify(args, null, 2),\n lang: \"json\",\n };\n}\n\nexport function toolResultPayload(\n result: string | undefined,\n): ToolDetailPayload | null {\n if (result === undefined) return null;\n const formatted = formatToolTextValue(result);\n return {\n section: \"result\",\n title: \"Result\",\n text: formatted.text,\n copyText: result,\n lang: formatted.lang,\n };\n}\n\n// ─── Tool icon helpers ────────────────────────────────────────────────────────\n\ntype ToolIconComponent = React.ComponentType<{\n className?: string;\n size?: number | string;\n}>;\n\nfunction resolveToolIcon(toolName: string): ToolIconComponent {\n const name = toolName.toLowerCase();\n if (name.includes(\"slack\")) return IconBrandSlack;\n if (\n name.includes(\"bash\") ||\n name.includes(\"shell\") ||\n name.includes(\"terminal\") ||\n name.includes(\"run-code\") ||\n name.includes(\"exec\")\n ) {\n return IconTerminal2;\n }\n if (\n name.includes(\"sql\") ||\n name.includes(\"bigquery\") ||\n name.includes(\"db-query\") ||\n name.includes(\"query\")\n ) {\n return IconDatabase;\n }\n if (\n name.includes(\"search\") ||\n name.includes(\"find\") ||\n name.includes(\"grep\")\n ) {\n return IconSearch;\n }\n if (\n name.includes(\"file\") ||\n name.includes(\"read\") ||\n name.includes(\"write\") ||\n name.includes(\"edit\")\n ) {\n return IconFileCode;\n }\n return IconCode;\n}\n\n// ─── Simple code viewer (Codex-style gray box) ────────────────────────────────\n\nfunction SimpleCodeViewer({\n text,\n lang,\n className,\n maxHeightClass = \"max-h-56\",\n}: {\n text: string;\n lang: string;\n className?: string;\n maxHeightClass?: string;\n}) {\n return (\n <div\n className={cn(\n \"agent-tool-code overflow-auto rounded-md bg-muted/70 font-mono text-[11px] leading-relaxed text-foreground\",\n maxHeightClass,\n className,\n )}\n >\n {lang !== \"text\" && (\n <div className=\"sticky top-0 z-[1] flex items-center justify-between border-b border-border/40 bg-muted/90 px-2.5 py-1\">\n <span className=\"font-mono text-[10px] uppercase tracking-wide text-muted-foreground/80\">\n {lang}\n </span>\n </div>\n )}\n <HighlightedCodeBlock code={text} lang={lang} />\n </div>\n );\n}\n\nfunction ToolOutputPopover({\n open,\n onOpenChange,\n title,\n payload,\n children,\n}: {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n title: string;\n payload: ToolDetailPayload;\n children: React.ReactNode;\n}) {\n const [copied, setCopied] = useState(false);\n const copyResetRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(() => {\n return () => {\n if (copyResetRef.current) clearTimeout(copyResetRef.current);\n };\n }, []);\n\n const copyValue = useCallback(async () => {\n try {\n if (await writeClipboardText(payload.copyText)) {\n setCopied(true);\n if (copyResetRef.current) clearTimeout(copyResetRef.current);\n copyResetRef.current = setTimeout(() => setCopied(false), 1200);\n }\n } catch {\n // Clipboard failures should not interrupt chat rendering.\n }\n }, [payload.copyText]);\n\n return (\n <Popover open={open} onOpenChange={onOpenChange}>\n <PopoverTrigger asChild>{children}</PopoverTrigger>\n <PopoverContent\n align=\"start\"\n side=\"bottom\"\n sideOffset={6}\n collisionPadding={12}\n className=\"flex max-h-[min(calc(100vh-2rem),var(--radix-popover-content-available-height,75vh))] w-[min(calc(100vw-2rem),var(--radix-popover-content-available-width,760px),760px)] flex-col gap-0 overflow-hidden p-0\"\n >\n <div className=\"flex shrink-0 items-center justify-between gap-3 border-b border-border px-4 py-3\">\n <div className=\"truncate text-sm font-medium\">{title}</div>\n <button\n type=\"button\"\n onClick={copyValue}\n className=\"inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs text-muted-foreground hover:bg-accent hover:text-foreground\"\n >\n {copied ? <IconCheck size={13} /> : <IconCopy size={13} />}\n {copied ? \"Copied\" : \"Copy\"}\n </button>\n </div>\n <div className=\"min-h-0 flex-1 overflow-hidden p-3\">\n <SimpleCodeViewer\n text={payload.text}\n lang={payload.lang}\n maxHeightClass=\"max-h-[min(70vh,calc(var(--radix-popover-content-available-height,75vh)-4.5rem))]\"\n />\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n\n// ─── Collapsible height animation ─────────────────────────────────────────────\n\nfunction AnimatedCollapse({\n open,\n children,\n}: {\n open: boolean;\n children: React.ReactNode;\n}) {\n const ref = useRef<HTMLDivElement>(null);\n const [height, setHeight] = useState<number | \"auto\">(open ? \"auto\" : 0);\n const [mounted, setMounted] = useState(open);\n const reduceMotionRef = useRef(false);\n\n useEffect(() => {\n reduceMotionRef.current =\n typeof window !== \"undefined\" &&\n !!window.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches;\n }, []);\n\n useLayoutEffect(() => {\n if (open) setMounted(true);\n }, [open]);\n\n useLayoutEffect(() => {\n const el = ref.current;\n if (!el || !mounted) return;\n if (reduceMotionRef.current) {\n setHeight(open ? \"auto\" : 0);\n if (!open) setMounted(false);\n return;\n }\n if (open) {\n const full = el.scrollHeight;\n setHeight(0);\n const frame = requestAnimationFrame(() => setHeight(full));\n return () => cancelAnimationFrame(frame);\n }\n setHeight(el.scrollHeight);\n const frame = requestAnimationFrame(() => setHeight(0));\n return () => cancelAnimationFrame(frame);\n }, [open, mounted]);\n\n const onTransitionEnd = useCallback(\n (event: React.TransitionEvent<HTMLDivElement>) => {\n if (event.propertyName !== \"height\") return;\n if (open) setHeight(\"auto\");\n else setMounted(false);\n },\n [open],\n );\n\n if (!mounted) return null;\n\n return (\n <div\n ref={ref}\n className=\"overflow-hidden transition-[height] duration-200 ease-out\"\n style={{ height: height === \"auto\" ? \"auto\" : `${height}px` }}\n onTransitionEnd={onTransitionEnd}\n >\n {children}\n </div>\n );\n}\n\n// ─── Human-in-the-loop approval affordance ────────────────────────────────────\n\n/**\n * Inline Approve/Deny prompt rendered when a `needsApproval` action paused the\n * turn. Approve re-issues the turn with the call's `approvalKey`; Deny dismisses\n * the prompt locally (the action stays un-run).\n */\nfunction ApprovalAffordance({\n toolName,\n approval,\n}: {\n toolName: string;\n approval: { approvalKey: string; dismissed?: boolean };\n}) {\n const ctx = React.useContext(ApprovalContext);\n const [approved, setApproved] = useState(false);\n const [denied, setDenied] = useState(false);\n\n // Once approved, the turn is re-issued; collapse to a quiet note so the user\n // can't double-fire the approval.\n if (approved) {\n return (\n <div className=\"mt-1.5 text-xs text-muted-foreground\">\n Approved. Re-running {toolName}...\n </div>\n );\n }\n // Deny defaults to local-only (the action simply stays un-run). When the\n // host also provided `onDeny` (e.g. a Code session resolving its own\n // pending approval), it fires alongside the local state.\n if (denied) {\n return (\n <div className=\"mt-1.5 text-xs text-muted-foreground\">\n Denied. {toolName} did not run.\n </div>\n );\n }\n return (\n <div className=\"mt-1.5 flex items-center gap-2 rounded-md border border-border bg-muted/40 px-2.5 py-1.5\">\n <IconShieldCheck className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"mr-auto text-xs text-muted-foreground\">\n Approve to run {toolName}?\n </span>\n {ctx && (\n <button\n type=\"button\"\n onClick={() => {\n setApproved(true);\n ctx.onApprove(approval.approvalKey);\n }}\n className={cn(\n \"inline-flex items-center gap-1 rounded-md px-2.5 py-1 text-xs font-medium transition-colors\",\n \"bg-foreground text-background hover:bg-foreground/90\",\n )}\n >\n <IconCheck className=\"h-3.5 w-3.5\" />\n Approve\n </button>\n )}\n {ctx?.onAlwaysAllow && (\n <button\n type=\"button\"\n onClick={() => {\n setApproved(true);\n ctx.onAlwaysAllow?.(approval.approvalKey);\n }}\n title=\"Approve and always allow this exact command\"\n className={cn(\n \"inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium transition-colors\",\n \"text-foreground hover:bg-muted\",\n )}\n >\n <IconShieldCheck className=\"h-3.5 w-3.5\" />\n Always allow\n </button>\n )}\n <button\n type=\"button\"\n onClick={() => {\n setDenied(true);\n ctx?.onDeny?.(approval.approvalKey);\n }}\n className={cn(\n \"inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium transition-colors\",\n \"text-foreground hover:bg-muted\",\n )}\n >\n <IconX className=\"h-3.5 w-3.5\" />\n Deny\n </button>\n </div>\n );\n}\n\n// ─── ToolCallDisplay ──────────────────────────────────────────────────────────\n\nexport function ToolCallDisplay({\n toolName,\n argsText,\n args,\n result,\n mcpApp,\n chatUI,\n isRunning,\n structuredMeta,\n approval,\n repeatCount,\n}: {\n toolName: string;\n argsText?: string;\n args: Record<string, unknown>;\n result?: string;\n mcpApp?: AgentMcpAppPayload;\n chatUI?: ActionChatUIConfig;\n isRunning: boolean;\n structuredMeta?: Record<string, unknown>;\n approval?: { approvalKey: string; dismissed?: boolean };\n repeatCount?: number;\n}) {\n // Delegate to bespoke cells when structured metadata is present.\n // These must be separate components so hook order in ToolCallDisplayGeneric\n // is always stable (no conditional hook calls).\n const toolKind = structuredMeta?.toolKind as string | undefined;\n const wrapToolDisplay = (children: React.ReactNode) => (\n <ToolLongRunningHintShell toolName={toolName} isRunning={isRunning}>\n {children}\n </ToolLongRunningHintShell>\n );\n if (toolKind === \"bash\") {\n return wrapToolDisplay(\n <BashCell\n meta={\n structuredMeta as unknown as Parameters<typeof BashCell>[0][\"meta\"]\n }\n output={result}\n isRunning={isRunning}\n />,\n );\n }\n if (toolKind === \"edit\") {\n return wrapToolDisplay(\n <EditCell\n meta={\n structuredMeta as unknown as Parameters<typeof EditCell>[0][\"meta\"]\n }\n isRunning={isRunning}\n />,\n );\n }\n if (toolKind === \"write\") {\n return wrapToolDisplay(\n <WriteCell\n meta={\n structuredMeta as unknown as Parameters<typeof WriteCell>[0][\"meta\"]\n }\n isRunning={isRunning}\n />,\n );\n }\n return wrapToolDisplay(\n <ToolCallDisplayGeneric\n toolName={toolName}\n argsText={argsText}\n args={args}\n result={result}\n mcpApp={mcpApp}\n chatUI={chatUI}\n isRunning={isRunning}\n approval={approval}\n repeatCount={repeatCount}\n />,\n );\n}\n\nfunction ToolCallDisplayGeneric({\n toolName,\n argsText,\n args,\n result,\n mcpApp,\n chatUI,\n isRunning,\n approval,\n repeatCount,\n}: {\n toolName: string;\n argsText?: string;\n args: Record<string, unknown>;\n result?: string;\n mcpApp?: AgentMcpAppPayload;\n chatUI?: ActionChatUIConfig;\n isRunning: boolean;\n approval?: { approvalKey: string; dismissed?: boolean };\n repeatCount?: number;\n}) {\n const streamRef = useRef<HTMLDivElement>(null);\n\n const isAgentCall = toolName.startsWith(\"agent:\");\n const [expanded, setExpanded] = useState(isAgentCall);\n const [outputOpen, setOutputOpen] = useState(false);\n const agentName = isAgentCall ? toolName.slice(6) : null;\n const isAgentError = isAgentCall && result === \"Error calling agent\";\n const agentStreamText = isAgentCall ? (argsText ?? \"\") : \"\";\n const hasStreamText = agentStreamText.length > 0;\n const hasArgs = !isAgentCall && Object.keys(args).length > 0;\n\n // NOTE: All hooks must be above any conditional returns\n useEffect(() => {\n if (isAgentCall && isRunning && streamRef.current) {\n streamRef.current.scrollTop = streamRef.current.scrollHeight;\n }\n }, [agentStreamText, isAgentCall, isRunning]);\n\n // Render connect-builder as ConnectBuilderCard once the result is available\n if (toolName === \"connect-builder\" && result) {\n try {\n const parsed = JSON.parse(result);\n if (parsed?.kind === \"connect-builder-card\") {\n return (\n <ConnectBuilderCard\n configured={!!parsed.configured}\n builderEnabled={parsed.builderEnabled !== false}\n // Ignore saved cliAuthUrl values from older tool results. They\n // contain signed callback state and can expire while a chat sits\n // open; the card's hook fetches a fresh signed URL on mount/click.\n connectUrl={parsed.connectUrl || \"\"}\n orgName={parsed.orgName ?? null}\n prompt={typeof parsed.prompt === \"string\" ? parsed.prompt : \"\"}\n />\n );\n }\n } catch {\n // fall through to default pill rendering\n }\n }\n\n // Render agent-teams spawn as AgentTaskCard once the result is available\n if (\n toolName === \"agent-teams\" &&\n (args as Record<string, string>)?.action === \"spawn\" &&\n result\n ) {\n try {\n const parsed = JSON.parse(result);\n if (parsed.taskId && parsed.threadId) {\n return (\n <AgentTaskCard\n taskId={parsed.taskId}\n threadId={parsed.threadId}\n description={\n parsed.description ||\n (args as Record<string, string>)?.task ||\n \"Sub-agent task\"\n }\n onOpen={(tid) => {\n window.dispatchEvent(\n new CustomEvent(\"agent-task-open\", {\n detail: {\n threadId: tid,\n description:\n parsed.description ||\n (args as Record<string, string>)?.task ||\n \"\",\n name: parsed.name || \"\",\n },\n }),\n );\n }}\n />\n );\n }\n } catch {\n // Fall through to default pill rendering\n }\n }\n\n const parsedResult = result ? parseJsonText(result) : null;\n const nativeToolContext = {\n toolName,\n args,\n resultText: result,\n resultJson: parsedResult,\n isRunning,\n chatUI,\n };\n const skipRegistryRenderer =\n !isAgentCall && isBuiltinDataWidgetActionRenderer(nativeToolContext);\n const NativeToolRenderer = isAgentCall\n ? null\n : (resolveBuiltinActionChatRenderer(nativeToolContext) ??\n (skipRegistryRenderer ? null : resolveToolRenderer(nativeToolContext)) ??\n resolveBuiltinFallbackToolRenderer(nativeToolContext));\n if (NativeToolRenderer) {\n return <NativeToolRenderer context={nativeToolContext} />;\n }\n\n const inputPayload = hasArgs ? toolInputPayload(toolName, args) : null;\n const resultPayload = toolResultPayload(result);\n\n const displayName = isAgentCall\n ? isRunning\n ? `Asking ${agentName}...`\n : isAgentError\n ? `Error asking ${agentName}`\n : `Asked ${agentName}`\n : humanizeToolName(toolName);\n\n const canExpand = isAgentCall\n ? hasStreamText\n : hasArgs || result !== undefined;\n const isExpanded = isAgentCall ? hasStreamText && expanded : expanded;\n const ToolIcon = resolveToolIcon(toolName);\n const outputTitle = `Raw ${toolName} tool call output`;\n\n return (\n <div className=\"group/tool my-0.5 w-full overflow-hidden\">\n {mcpApp && <McpAppRenderer app={mcpApp} className=\"mb-1.5\" />}\n <button\n type=\"button\"\n onClick={() => canExpand && setExpanded(!isExpanded)}\n aria-expanded={canExpand ? isExpanded : undefined}\n className={cn(\n \"flex w-full items-center gap-1.5 rounded-md py-0.5 text-left text-[13px] text-muted-foreground transition-colors\",\n canExpand && \"hover:text-foreground\",\n isRunning && \"text-muted-foreground\",\n )}\n >\n <span className=\"relative flex size-4 shrink-0 items-center justify-center\">\n {isRunning ? (\n <IconLoader2 className=\"size-3.5 animate-spin\" />\n ) : isAgentError ? (\n <IconCircleX className=\"size-3.5 text-destructive\" />\n ) : (\n <>\n <ToolIcon\n className={cn(\n \"size-3.5 transition-opacity\",\n canExpand && \"group-hover/tool:opacity-0\",\n )}\n />\n {canExpand && (\n <IconChevronRight\n className={cn(\n \"absolute size-3.5 opacity-0 transition-all group-hover/tool:opacity-100\",\n isExpanded && \"rotate-90\",\n )}\n />\n )}\n </>\n )}\n </span>\n <span className=\"min-w-0 truncate font-normal\">{displayName}</span>\n {repeatCount && repeatCount > 1 && (\n <span\n className=\"shrink-0 rounded border border-border/60 px-1.5 py-0.5 text-[10px] leading-none text-muted-foreground\"\n title={`Repeated ${repeatCount} times`}\n >\n {repeatCount}x\n </span>\n )}\n </button>\n <AnimatedCollapse open={isExpanded && isAgentCall && hasStreamText}>\n <div\n ref={streamRef}\n className=\"mt-1 rounded-md bg-muted/50 px-3 py-2 text-xs text-muted-foreground break-words max-h-48 overflow-y-auto agent-markdown prose prose-sm prose-invert max-w-none\"\n >\n {markdownModule?.default && remarkGfmFn ? (\n <markdownModule.default\n remarkPlugins={[remarkGfmFn]}\n components={markdownComponents}\n urlTransform={markdownUrlTransform}\n >\n {agentStreamText}\n </markdownModule.default>\n ) : (\n <span style={{ whiteSpace: \"pre-wrap\" }}>{agentStreamText}</span>\n )}\n </div>\n </AnimatedCollapse>\n <AnimatedCollapse\n open={isExpanded && !isAgentCall && (hasArgs || result !== undefined)}\n >\n <div className=\"mt-1 space-y-2 pl-5\">\n {inputPayload && (\n <SimpleCodeViewer\n text={inputPayload.text}\n lang={inputPayload.lang}\n />\n )}\n {resultPayload && (\n <ToolOutputPopover\n open={outputOpen}\n onOpenChange={setOutputOpen}\n title={outputTitle}\n payload={resultPayload}\n >\n <button\n type=\"button\"\n aria-label={`View ${toolName} output`}\n className=\"inline-flex size-6 items-center justify-center rounded-md text-muted-foreground/70 transition-colors hover:bg-accent hover:text-foreground\"\n >\n <IconCode className=\"size-3.5\" />\n </button>\n </ToolOutputPopover>\n )}\n </div>\n </AnimatedCollapse>\n {approval && (\n <ApprovalAffordance toolName={toolName} approval={approval} />\n )}\n </div>\n );\n}\n\n// ─── ToolCallFallback ──────────────────────────────────────────────────────────\n\nexport function ToolCallFallback({\n toolName,\n args,\n argsText,\n result,\n ...rest\n}: ToolCallMessagePartProps & {\n mcpApp?: AgentMcpAppPayload;\n chatUI?: ActionChatUIConfig;\n structuredMeta?: Record<string, unknown>;\n activity?: boolean;\n approval?: { approvalKey: string; dismissed?: boolean };\n repeatCount?: number;\n}) {\n const chatRunning = React.useContext(ChatRunningContext);\n const isRunning =\n result === undefined && (chatRunning || rest.activity === true);\n return (\n <ToolCallDisplay\n toolName={toolName}\n args={args as Record<string, unknown>}\n argsText={argsText}\n result={\n typeof result === \"string\"\n ? result\n : result !== undefined\n ? JSON.stringify(result)\n : undefined\n }\n mcpApp={rest.mcpApp}\n chatUI={rest.chatUI}\n structuredMeta={rest.structuredMeta}\n isRunning={isRunning}\n approval={rest.approval}\n repeatCount={rest.repeatCount}\n />\n );\n}\n\n// ─── ReconnectStreamMessage ────────────────────────────────────────────────────\n// Renders the agent's in-progress response during reconnection (outside\n// assistant-ui's runtime). Uses the same visual styling as normal messages.\n\nexport function ReconnectStreamMessage({\n content,\n}: {\n content: ContentPart[];\n}) {\n const chatRunning = React.useContext(ChatRunningContext);\n const streamingTextPartIndex =\n content.at(-1)?.type === \"text\" ? content.length - 1 : -1;\n const streamingReasoningPartIndex =\n content.at(-1)?.type === \"reasoning\" ? content.length - 1 : -1;\n\n return (\n <div className=\"flex justify-start\">\n <div className=\"w-full max-w-[95%] text-sm leading-relaxed text-foreground space-y-1\">\n {content.map((part, i) => {\n if (part.type === \"text\") {\n const partStreaming = chatRunning && i === streamingTextPartIndex;\n return (\n <SmoothMarkdownText\n key={`reconnect-text-${i}`}\n text={part.text}\n streaming={partStreaming}\n resetKey={`reconnect-text-${i}`}\n statusType={partStreaming ? \"running\" : \"complete\"}\n />\n );\n }\n if (part.type === \"reasoning\") {\n return (\n <ReasoningCell\n key={`reconnect-reasoning-${i}`}\n text={part.text}\n isStreaming={chatRunning && i === streamingReasoningPartIndex}\n />\n );\n }\n if (part.type === \"tool-call\") {\n return (\n <ToolCallDisplay\n key={`reconnect-tool-${i}`}\n toolName={part.toolName}\n argsText={part.argsText}\n args={part.args}\n result={part.result}\n mcpApp={part.mcpApp}\n chatUI={part.chatUI}\n structuredMeta={part.structuredMeta}\n isRunning={\n part.result === undefined &&\n (chatRunning || part.activity === true)\n }\n approval={part.approval}\n repeatCount={part.repeatCount}\n />\n );\n }\n return null;\n })}\n </div>\n </div>\n );\n}\n\n// ─── Reasoning / Thinking cell ────────────────────────────────────────────────\n\n/**\n * Completed reasoning and tool calls share one outer \"Worked for…\"\n * disclosure. Reasoning cells inside it render their prose directly so\n * opening that summary never reveals a redundant second disclosure.\n */\nconst WorkSummaryContentContext = React.createContext(false);\n\nexport function ReasoningCell({\n text,\n isStreaming = false,\n defaultOpen,\n durationMs,\n}: {\n text: string;\n isStreaming?: boolean;\n defaultOpen?: boolean;\n /**\n * Elapsed thinking time in ms, once known. Only meaningful once streaming\n * has finished — callers that track live timing (see ReasoningMessagePart)\n * pass this so the label can read \"Thought for Xs\" instead of \"Thought\".\n * Historical messages with no live timing simply omit it.\n */\n durationMs?: number | null;\n}) {\n const embeddedInWorkSummary = React.useContext(WorkSummaryContentContext);\n const [open, setOpen] = useState(defaultOpen ?? true);\n const trimmed = text.trim();\n if (!trimmed && !isStreaming) return null;\n\n if (embeddedInWorkSummary) {\n return (\n <div className=\"pb-1 pl-5 text-[13px] leading-relaxed text-muted-foreground whitespace-pre-wrap\">\n {trimmed || (isStreaming ? \"…\" : \"\")}\n </div>\n );\n }\n\n const label = isStreaming\n ? \"Thinking\"\n : durationMs != null && durationMs >= 1000\n ? `Thought for ${formatWorkedDuration(durationMs)}`\n : \"Thought\";\n // Only clamp to a scroll-free \"tail\" view while actively streaming and\n // expanded — once the run finishes the full text is shown, unclamped.\n const showTail = isStreaming && open;\n\n return (\n <div className=\"my-0.5 w-full\">\n <button\n type=\"button\"\n onClick={() => setOpen((v) => !v)}\n aria-expanded={open}\n className=\"flex items-center gap-1.5 py-0.5 text-[13px] text-muted-foreground transition-colors hover:text-foreground\"\n >\n <IconChevronRight\n className={cn(\n \"size-3.5 shrink-0 transition-transform\",\n open && \"rotate-90\",\n )}\n />\n {isStreaming ? (\n <span className=\"agent-thinking-indicator__text\">{label}</span>\n ) : (\n <span>{label}</span>\n )}\n </button>\n <AnimatedCollapse open={open}>\n <div className={cn(\"pl-5 pb-1\", showTail && \"reasoning-cell-tail\")}>\n <div className=\"text-[13px] leading-relaxed text-muted-foreground whitespace-pre-wrap\">\n {trimmed || (isStreaming ? \"…\" : \"\")}\n </div>\n </div>\n </AnimatedCollapse>\n </div>\n );\n}\n\n// ─── Worked-for duration helpers ──────────────────────────────────────────────\n\nexport function formatWorkedDuration(ms: number): string {\n const totalSeconds = Math.max(0, Math.round(ms / 1000));\n if (totalSeconds < 60) {\n return totalSeconds <= 1 ? \"1s\" : `${totalSeconds}s`;\n }\n const minutes = Math.floor(totalSeconds / 60);\n const seconds = totalSeconds % 60;\n if (minutes < 60) {\n if (seconds === 0) return `${minutes}m`;\n return `${minutes}m ${seconds}s`;\n }\n const hours = Math.floor(minutes / 60);\n const remMinutes = minutes % 60;\n if (remMinutes === 0) return `${hours}h`;\n return `${hours}h ${remMinutes}m`;\n}\n\nexport function WorkedForSummary({\n durationMs,\n autoCollapse = false,\n children,\n}: {\n durationMs?: number | null;\n /** When true, start open then animate closed (post-run collapse). */\n autoCollapse?: boolean;\n children: React.ReactNode;\n}) {\n const [open, setOpen] = useState(autoCollapse);\n const didAutoCollapseRef = useRef(false);\n\n useEffect(() => {\n if (!autoCollapse || didAutoCollapseRef.current) return;\n didAutoCollapseRef.current = true;\n const frame = requestAnimationFrame(() => {\n setOpen(false);\n });\n return () => cancelAnimationFrame(frame);\n }, [autoCollapse]);\n\n const label =\n durationMs != null && durationMs >= 1000\n ? `Worked for ${formatWorkedDuration(durationMs)}`\n : \"Worked\";\n\n return (\n <div className=\"my-1 w-full\">\n <button\n type=\"button\"\n onClick={() => setOpen((v) => !v)}\n aria-expanded={open}\n className=\"flex items-center gap-1.5 py-0.5 text-[13px] text-muted-foreground transition-colors hover:text-foreground\"\n >\n <span>{label}</span>\n <IconChevronRight\n className={cn(\n \"size-3.5 shrink-0 transition-transform\",\n open && \"rotate-90\",\n )}\n />\n </button>\n <AnimatedCollapse open={open}>\n <WorkSummaryContentContext.Provider value>\n <div className=\"pt-1\">{children}</div>\n </WorkSummaryContentContext.Provider>\n </AnimatedCollapse>\n </div>\n );\n}\n\n// ─── Re-export for AssistantMessage ───────────────────────────────────────────\n// AssistantMessage in AssistantChat.tsx uses FilesChangedSummary directly, so\n// re-export it so AssistantChat.tsx can import from one place.\nexport { FilesChangedSummary };\n"]}
1
+ {"version":3,"file":"tool-call-display.js","sourceRoot":"","sources":["../../../src/client/chat/tool-call-display.tsx"],"names":[],"mappings":";AAIA,OAAO,EACL,WAAW,EACX,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,aAAa,EACb,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,eAAe,EACf,KAAK,GACN,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,EACZ,QAAQ,EACR,SAAS,EACT,WAAW,EACX,eAAe,EACf,MAAM,GACP,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,GACf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,oBAAoB,GACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACL,iCAAiC,EACjC,gCAAgC,EAChC,kCAAkC,GACnC,MAAM,qCAAqC,CAAC;AAE7C,8DAA8D;AAC9D,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAwB7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CAAC;IAEzC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,YAAY,IAAI,kBAAkB,CAAC,OAAO;YAAE,OAAO;QACxD,kBAAkB,CAAC,OAAO,GAAG,IAAI,CAAC;QAClC,MAAM,KAAK,GAAG,qBAAqB,CAAC,GAAG,EAAE;YACvC,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,EAAE,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,MAAM,KAAK,GACT,UAAU,IAAI,IAAI,IAAI,UAAU,IAAI,IAAI;QACtC,CAAC,CAAC,cAAc,oBAAoB,CAAC,UAAU,CAAC,EAAE;QAClD,CAAC,CAAC,QAAQ,CAAC;IAEf,OAAO,CACL,eAAK,SAAS,EAAC,aAAa,aAC1B,kBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,mBAClB,IAAI,EACnB,SAAS,EAAC,4GAA4G,aAEtH,yBAAO,KAAK,GAAQ,EACpB,KAAC,gBAAgB,IACf,SAAS,EAAE,EAAE,CACX,wCAAwC,EACxC,IAAI,IAAI,WAAW,CACpB,GACD,IACK,EACT,KAAC,gBAAgB,IAAC,IAAI,EAAE,IAAI,YAC1B,KAAC,yBAAyB,CAAC,QAAQ,IAAC,KAAK,kBACvC,cAAK,SAAS,EAAC,MAAM,YAAE,QAAQ,GAAO,GACH,GACpB,IACf,CACP,CAAC;AACJ,CAAC;AAED,iFAAiF;AACjF,8EAA8E;AAC9E,+DAA+D;AAC/D,OAAO,EAAE,mBAAmB,EAAE,CAAC","sourcesContent":["// Owns: tool-payload formatting helpers, ToolCallDisplay, ToolCallFallback,\n// and ReconnectStreamMessage used by AssistantChat.\n\nimport type { ToolCallMessagePartProps } from \"@assistant-ui/react\";\nimport {\n IconLoader2,\n IconCircleX,\n IconCheck,\n IconChevronRight,\n IconCopy,\n IconCode,\n IconBrandSlack,\n IconTerminal2,\n IconDatabase,\n IconSearch,\n IconFileCode,\n IconShieldCheck,\n IconX,\n} from \"@tabler/icons-react\";\nimport React, {\n useState,\n useEffect,\n useCallback,\n useLayoutEffect,\n useRef,\n} from \"react\";\n\nimport type { ActionChatUIConfig } from \"../../action-ui.js\";\nimport type { AgentMcpAppPayload } from \"../../mcp-client/app-result.js\";\nimport { AgentTaskCard } from \"../AgentTaskCard.js\";\nimport { writeClipboardText } from \"../clipboard.js\";\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"../components/ui/popover.js\";\nimport { ConnectBuilderCard } from \"../ConnectBuilderCard.js\";\nimport { McpAppRenderer } from \"../mcp-apps/McpAppRenderer.js\";\nimport type { ContentPart } from \"../sse-event-processor.js\";\nimport {\n BashCell,\n EditCell,\n WriteCell,\n FilesChangedSummary,\n} from \"../tool-cells/index.js\";\nimport { humanizeToolName } from \"../tool-display.js\";\nimport { cn } from \"../utils.js\";\nimport {\n SmoothMarkdownText,\n HighlightedCodeBlock,\n markdownComponents,\n markdownModule,\n remarkGfmFn,\n markdownUrlTransform,\n} from \"./markdown-renderer.js\";\nimport { resolveToolRenderer } from \"./tool-render-registry.js\";\nimport {\n isBuiltinDataWidgetActionRenderer,\n resolveBuiltinActionChatRenderer,\n resolveBuiltinFallbackToolRenderer,\n} from \"./widgets/builtin-tool-renderers.js\";\n\n// Exported so AssistantChatInner can provide a context value.\nexport const ChatRunningContext = React.createContext(false);\n\n/**\n * Human-in-the-loop approval bridge. `AssistantChatInner` provides a value that\n * re-issues the turn approving a specific paused tool call (opt-in\n * `needsApproval` actions). When null, the Approve button is not rendered.\n * Deny defaults to local-only (the action stays un-run) unless `onDeny` is\n * provided, and \"Always allow\" only renders when `onAlwaysAllow` is provided\n * — both are additive so existing action-approval consumers are unaffected.\n */\nexport type ApprovalContextValue = {\n /** Re-issue the turn so the server runs the approved call. */\n onApprove: (approvalKey: string) => void;\n /**\n * Optional host hook invoked in addition to the local \"denied\" state, e.g.\n * so a Code session can also resolve its own pending approval as denied.\n */\n onDeny?: (approvalKey: string) => void;\n /**\n * Optional host hook that persists this exact call so future occurrences\n * skip the approval gate. When absent, no \"Always allow\" button renders.\n */\n onAlwaysAllow?: (approvalKey: string) => void;\n};\nexport const ApprovalContext = React.createContext<ApprovalContextValue | null>(\n null,\n);\n\nexport const TOOL_LONG_RUNNING_HINT_DELAY_MS = 45_000;\n\nfunction ToolLongRunningHintShell({\n toolName,\n isRunning,\n children,\n}: {\n toolName: string;\n isRunning: boolean;\n children: React.ReactNode;\n}) {\n const [showLongRunningHint, setShowLongRunningHint] = useState(false);\n\n useEffect(() => {\n if (!isRunning) {\n setShowLongRunningHint(false);\n return;\n }\n setShowLongRunningHint(false);\n const timeout = window.setTimeout(() => {\n setShowLongRunningHint(true);\n }, TOOL_LONG_RUNNING_HINT_DELAY_MS);\n return () => window.clearTimeout(timeout);\n }, [isRunning, toolName]);\n\n return (\n <>\n {children}\n {isRunning && showLongRunningHint && (\n <div className=\"mt-0.5 px-2.5 text-[11px] leading-snug text-muted-foreground/80\">\n Still working. Large updates can take a minute or two.\n </div>\n )}\n </>\n );\n}\n\n// ─── Tool-payload formatting ──────────────────────────────────────────────────\n\ntype ToolDetailSection = \"input\" | \"result\";\nexport type ToolDetailPayload = {\n section: ToolDetailSection;\n title: string;\n text: string;\n copyText: string;\n lang: string;\n};\n\nfunction stringifyToolValue(value: unknown, pretty = false): string {\n if (typeof value === \"string\") return value;\n try {\n return JSON.stringify(value, null, pretty ? 2 : 0);\n } catch {\n return String(value ?? \"\");\n }\n}\n\nfunction looksLikeSql(text: string): boolean {\n return /^\\s*(select|with|insert|update|delete|merge|create|alter|drop|explain|declare|begin)\\b/i.test(\n text,\n );\n}\n\nfunction parseJsonText(text: string): unknown | null {\n const trimmed = text.trim();\n if (!trimmed || !/^[{[]/.test(trimmed)) return null;\n try {\n return JSON.parse(trimmed);\n } catch {\n return null;\n }\n}\n\nfunction inferToolTextLanguage(\n text: string,\n key?: string,\n toolName?: string,\n): string {\n const keyName = (key ?? \"\").toLowerCase();\n const tool = (toolName ?? \"\").toLowerCase();\n if (\n keyName === \"code\" &&\n (tool.includes(\"run-code\") || tool.includes(\"run_code\"))\n ) {\n return \"javascript\";\n }\n if (\n keyName === \"sql\" ||\n keyName.endsWith(\"sql\") ||\n keyName === \"query\" ||\n tool.includes(\"bigquery\") ||\n tool.includes(\"db-query\") ||\n looksLikeSql(text)\n ) {\n return \"sql\";\n }\n return parseJsonText(text) ? \"json\" : \"text\";\n}\n\nfunction formatToolTextValue(\n value: unknown,\n key?: string,\n toolName?: string,\n): { text: string; lang: string } {\n if (typeof value === \"string\") {\n const parsed = parseJsonText(value);\n if (parsed) {\n return { text: JSON.stringify(parsed, null, 2), lang: \"json\" };\n }\n return {\n text: value,\n lang: inferToolTextLanguage(value, key, toolName),\n };\n }\n return { text: stringifyToolValue(value, true), lang: \"json\" };\n}\n\nexport function toolInputPayload(\n toolName: string,\n args: Record<string, unknown>,\n): ToolDetailPayload | null {\n const entries = Object.entries(args);\n if (entries.length === 0) return null;\n if (entries.length === 1) {\n const [key, value] = entries[0]!;\n const formatted = formatToolTextValue(value, key, toolName);\n const normalizedKey = key.toLowerCase();\n const keyLabel =\n normalizedKey === \"sql\" || normalizedKey.endsWith(\"sql\") ? \"SQL\" : key;\n return {\n section: \"input\",\n title: `Input - ${keyLabel}`,\n text: formatted.text,\n copyText:\n typeof value === \"string\" ? value : stringifyToolValue(value, true),\n lang: formatted.lang,\n };\n }\n return {\n section: \"input\",\n title: \"Input\",\n text: JSON.stringify(args, null, 2),\n copyText: JSON.stringify(args, null, 2),\n lang: \"json\",\n };\n}\n\nexport function toolResultPayload(\n result: string | undefined,\n): ToolDetailPayload | null {\n if (result === undefined) return null;\n const formatted = formatToolTextValue(result);\n return {\n section: \"result\",\n title: \"Result\",\n text: formatted.text,\n copyText: result,\n lang: formatted.lang,\n };\n}\n\n// ─── Tool icon helpers ────────────────────────────────────────────────────────\n\ntype ToolIconComponent = React.ComponentType<{\n className?: string;\n size?: number | string;\n}>;\n\nfunction resolveToolIcon(toolName: string): ToolIconComponent {\n const name = toolName.toLowerCase();\n if (name.includes(\"slack\")) return IconBrandSlack;\n if (\n name.includes(\"bash\") ||\n name.includes(\"shell\") ||\n name.includes(\"terminal\") ||\n name.includes(\"run-code\") ||\n name.includes(\"exec\")\n ) {\n return IconTerminal2;\n }\n if (\n name.includes(\"sql\") ||\n name.includes(\"bigquery\") ||\n name.includes(\"db-query\") ||\n name.includes(\"query\")\n ) {\n return IconDatabase;\n }\n if (\n name.includes(\"search\") ||\n name.includes(\"find\") ||\n name.includes(\"grep\")\n ) {\n return IconSearch;\n }\n if (\n name.includes(\"file\") ||\n name.includes(\"read\") ||\n name.includes(\"write\") ||\n name.includes(\"edit\")\n ) {\n return IconFileCode;\n }\n return IconCode;\n}\n\n// ─── Simple code viewer (Codex-style gray box) ────────────────────────────────\n\nfunction SimpleCodeViewer({\n text,\n lang,\n className,\n maxHeightClass = \"max-h-56\",\n}: {\n text: string;\n lang: string;\n className?: string;\n maxHeightClass?: string;\n}) {\n return (\n <div\n className={cn(\n \"agent-tool-code overflow-auto rounded-md bg-muted/70 font-mono text-[11px] leading-relaxed text-foreground\",\n maxHeightClass,\n className,\n )}\n >\n {lang !== \"text\" && (\n <div className=\"sticky top-0 z-[1] flex items-center justify-between border-b border-border/40 bg-muted/90 px-2.5 py-1\">\n <span className=\"font-mono text-[10px] uppercase tracking-wide text-muted-foreground/80\">\n {lang}\n </span>\n </div>\n )}\n <HighlightedCodeBlock code={text} lang={lang} />\n </div>\n );\n}\n\nfunction ToolOutputPopover({\n open,\n onOpenChange,\n title,\n payload,\n children,\n}: {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n title: string;\n payload: ToolDetailPayload;\n children: React.ReactNode;\n}) {\n const [copied, setCopied] = useState(false);\n const copyResetRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(() => {\n return () => {\n if (copyResetRef.current) clearTimeout(copyResetRef.current);\n };\n }, []);\n\n const copyValue = useCallback(async () => {\n try {\n if (await writeClipboardText(payload.copyText)) {\n setCopied(true);\n if (copyResetRef.current) clearTimeout(copyResetRef.current);\n copyResetRef.current = setTimeout(() => setCopied(false), 1200);\n }\n } catch {\n // Clipboard failures should not interrupt chat rendering.\n }\n }, [payload.copyText]);\n\n return (\n <Popover open={open} onOpenChange={onOpenChange}>\n <PopoverTrigger asChild>{children}</PopoverTrigger>\n <PopoverContent\n align=\"start\"\n side=\"bottom\"\n sideOffset={6}\n collisionPadding={12}\n className=\"flex max-h-[min(calc(100vh-2rem),var(--radix-popover-content-available-height,75vh))] w-[min(calc(100vw-2rem),var(--radix-popover-content-available-width,760px),760px)] flex-col gap-0 overflow-hidden p-0\"\n >\n <div className=\"flex shrink-0 items-center justify-between gap-3 border-b border-border px-4 py-3\">\n <div className=\"truncate text-sm font-medium\">{title}</div>\n <button\n type=\"button\"\n onClick={copyValue}\n className=\"inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs text-muted-foreground hover:bg-accent hover:text-foreground\"\n >\n {copied ? <IconCheck size={13} /> : <IconCopy size={13} />}\n {copied ? \"Copied\" : \"Copy\"}\n </button>\n </div>\n <div className=\"min-h-0 flex-1 overflow-hidden p-3\">\n <SimpleCodeViewer\n text={payload.text}\n lang={payload.lang}\n maxHeightClass=\"max-h-[min(70vh,calc(var(--radix-popover-content-available-height,75vh)-4.5rem))]\"\n />\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n\n// ─── Collapsible height animation ─────────────────────────────────────────────\n\nexport function AnimatedCollapse({\n open,\n children,\n}: {\n open: boolean;\n children: React.ReactNode;\n}) {\n const ref = useRef<HTMLDivElement>(null);\n const [height, setHeight] = useState<number | \"auto\">(open ? \"auto\" : 0);\n const [mounted, setMounted] = useState(open);\n const reduceMotionRef = useRef(false);\n\n useEffect(() => {\n reduceMotionRef.current =\n typeof window !== \"undefined\" &&\n !!window.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches;\n }, []);\n\n useLayoutEffect(() => {\n if (open) setMounted(true);\n }, [open]);\n\n useLayoutEffect(() => {\n const el = ref.current;\n if (!el || !mounted) return;\n if (reduceMotionRef.current) {\n setHeight(open ? \"auto\" : 0);\n if (!open) setMounted(false);\n return;\n }\n if (open) {\n const full = el.scrollHeight;\n setHeight(0);\n const frame = requestAnimationFrame(() => setHeight(full));\n return () => cancelAnimationFrame(frame);\n }\n setHeight(el.scrollHeight);\n const frame = requestAnimationFrame(() => setHeight(0));\n return () => cancelAnimationFrame(frame);\n }, [open, mounted]);\n\n const onTransitionEnd = useCallback(\n (event: React.TransitionEvent<HTMLDivElement>) => {\n if (event.propertyName !== \"height\") return;\n if (open) setHeight(\"auto\");\n else setMounted(false);\n },\n [open],\n );\n\n if (!mounted) return null;\n\n return (\n <div\n ref={ref}\n className=\"overflow-hidden transition-[height] duration-200 ease-[var(--ease-collapse)]\"\n style={{ height: height === \"auto\" ? \"auto\" : `${height}px` }}\n onTransitionEnd={onTransitionEnd}\n >\n {children}\n </div>\n );\n}\n\n// ─── Human-in-the-loop approval affordance ────────────────────────────────────\n\n/**\n * Inline Approve/Deny prompt rendered when a `needsApproval` action paused the\n * turn. Approve re-issues the turn with the call's `approvalKey`; Deny dismisses\n * the prompt locally (the action stays un-run).\n */\nfunction ApprovalAffordance({\n toolName,\n approval,\n}: {\n toolName: string;\n approval: { approvalKey: string; dismissed?: boolean };\n}) {\n const ctx = React.useContext(ApprovalContext);\n const [approved, setApproved] = useState(false);\n const [denied, setDenied] = useState(false);\n\n // Once approved, the turn is re-issued; collapse to a quiet note so the user\n // can't double-fire the approval.\n if (approved) {\n return (\n <div className=\"mt-1.5 text-xs text-muted-foreground\">\n Approved. Re-running {toolName}...\n </div>\n );\n }\n // Deny defaults to local-only (the action simply stays un-run). When the\n // host also provided `onDeny` (e.g. a Code session resolving its own\n // pending approval), it fires alongside the local state.\n if (denied) {\n return (\n <div className=\"mt-1.5 text-xs text-muted-foreground\">\n Denied. {toolName} did not run.\n </div>\n );\n }\n return (\n <div className=\"mt-1.5 flex items-center gap-2 rounded-md border border-border bg-muted/40 px-2.5 py-1.5\">\n <IconShieldCheck className=\"h-3.5 w-3.5 shrink-0 text-muted-foreground\" />\n <span className=\"mr-auto text-xs text-muted-foreground\">\n Approve to run {toolName}?\n </span>\n {ctx && (\n <button\n type=\"button\"\n onClick={() => {\n setApproved(true);\n ctx.onApprove(approval.approvalKey);\n }}\n className={cn(\n \"inline-flex items-center gap-1 rounded-md px-2.5 py-1 text-xs font-medium transition-colors\",\n \"bg-foreground text-background hover:bg-foreground/90\",\n )}\n >\n <IconCheck className=\"h-3.5 w-3.5\" />\n Approve\n </button>\n )}\n {ctx?.onAlwaysAllow && (\n <button\n type=\"button\"\n onClick={() => {\n setApproved(true);\n ctx.onAlwaysAllow?.(approval.approvalKey);\n }}\n title=\"Approve and always allow this exact command\"\n className={cn(\n \"inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium transition-colors\",\n \"text-foreground hover:bg-muted\",\n )}\n >\n <IconShieldCheck className=\"h-3.5 w-3.5\" />\n Always allow\n </button>\n )}\n <button\n type=\"button\"\n onClick={() => {\n setDenied(true);\n ctx?.onDeny?.(approval.approvalKey);\n }}\n className={cn(\n \"inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium transition-colors\",\n \"text-foreground hover:bg-muted\",\n )}\n >\n <IconX className=\"h-3.5 w-3.5\" />\n Deny\n </button>\n </div>\n );\n}\n\n// ─── ToolCallDisplay ──────────────────────────────────────────────────────────\n\nexport function ToolCallDisplay({\n toolName,\n argsText,\n args,\n result,\n mcpApp,\n chatUI,\n isRunning,\n structuredMeta,\n approval,\n repeatCount,\n}: {\n toolName: string;\n argsText?: string;\n args: Record<string, unknown>;\n result?: string;\n mcpApp?: AgentMcpAppPayload;\n chatUI?: ActionChatUIConfig;\n isRunning: boolean;\n structuredMeta?: Record<string, unknown>;\n approval?: { approvalKey: string; dismissed?: boolean };\n repeatCount?: number;\n}) {\n // Delegate to bespoke cells when structured metadata is present.\n // These must be separate components so hook order in ToolCallDisplayGeneric\n // is always stable (no conditional hook calls).\n const toolKind = structuredMeta?.toolKind as string | undefined;\n const wrapToolDisplay = (children: React.ReactNode) => (\n <ToolLongRunningHintShell toolName={toolName} isRunning={isRunning}>\n {children}\n </ToolLongRunningHintShell>\n );\n if (toolKind === \"bash\") {\n return wrapToolDisplay(\n <BashCell\n meta={\n structuredMeta as unknown as Parameters<typeof BashCell>[0][\"meta\"]\n }\n output={result}\n isRunning={isRunning}\n />,\n );\n }\n if (toolKind === \"edit\") {\n return wrapToolDisplay(\n <EditCell\n meta={\n structuredMeta as unknown as Parameters<typeof EditCell>[0][\"meta\"]\n }\n isRunning={isRunning}\n />,\n );\n }\n if (toolKind === \"write\") {\n return wrapToolDisplay(\n <WriteCell\n meta={\n structuredMeta as unknown as Parameters<typeof WriteCell>[0][\"meta\"]\n }\n isRunning={isRunning}\n />,\n );\n }\n return wrapToolDisplay(\n <ToolCallDisplayGeneric\n toolName={toolName}\n argsText={argsText}\n args={args}\n result={result}\n mcpApp={mcpApp}\n chatUI={chatUI}\n isRunning={isRunning}\n approval={approval}\n repeatCount={repeatCount}\n />,\n );\n}\n\nfunction ToolCallDisplayGeneric({\n toolName,\n argsText,\n args,\n result,\n mcpApp,\n chatUI,\n isRunning,\n approval,\n repeatCount,\n}: {\n toolName: string;\n argsText?: string;\n args: Record<string, unknown>;\n result?: string;\n mcpApp?: AgentMcpAppPayload;\n chatUI?: ActionChatUIConfig;\n isRunning: boolean;\n approval?: { approvalKey: string; dismissed?: boolean };\n repeatCount?: number;\n}) {\n const streamRef = useRef<HTMLDivElement>(null);\n\n const isAgentCall = toolName.startsWith(\"agent:\");\n const [expanded, setExpanded] = useState(isAgentCall);\n const [outputOpen, setOutputOpen] = useState(false);\n const agentName = isAgentCall ? toolName.slice(6) : null;\n const isAgentError = isAgentCall && result === \"Error calling agent\";\n const agentStreamText = isAgentCall ? (argsText ?? \"\") : \"\";\n const hasStreamText = agentStreamText.length > 0;\n const hasArgs = !isAgentCall && Object.keys(args).length > 0;\n\n // NOTE: All hooks must be above any conditional returns\n useEffect(() => {\n if (isAgentCall && isRunning && streamRef.current) {\n streamRef.current.scrollTop = streamRef.current.scrollHeight;\n }\n }, [agentStreamText, isAgentCall, isRunning]);\n\n // Render connect-builder as ConnectBuilderCard once the result is available\n if (toolName === \"connect-builder\" && result) {\n try {\n const parsed = JSON.parse(result);\n if (parsed?.kind === \"connect-builder-card\") {\n return (\n <ConnectBuilderCard\n configured={!!parsed.configured}\n builderEnabled={parsed.builderEnabled !== false}\n // Ignore saved cliAuthUrl values from older tool results. They\n // contain signed callback state and can expire while a chat sits\n // open; the card's hook fetches a fresh signed URL on mount/click.\n connectUrl={parsed.connectUrl || \"\"}\n orgName={parsed.orgName ?? null}\n prompt={typeof parsed.prompt === \"string\" ? parsed.prompt : \"\"}\n />\n );\n }\n } catch {\n // fall through to default pill rendering\n }\n }\n\n // Render agent-teams spawn as AgentTaskCard once the result is available\n if (\n toolName === \"agent-teams\" &&\n (args as Record<string, string>)?.action === \"spawn\" &&\n result\n ) {\n try {\n const parsed = JSON.parse(result);\n if (parsed.taskId && parsed.threadId) {\n return (\n <AgentTaskCard\n taskId={parsed.taskId}\n threadId={parsed.threadId}\n description={\n parsed.description ||\n (args as Record<string, string>)?.task ||\n \"Sub-agent task\"\n }\n onOpen={(tid) => {\n window.dispatchEvent(\n new CustomEvent(\"agent-task-open\", {\n detail: {\n threadId: tid,\n description:\n parsed.description ||\n (args as Record<string, string>)?.task ||\n \"\",\n name: parsed.name || \"\",\n },\n }),\n );\n }}\n />\n );\n }\n } catch {\n // Fall through to default pill rendering\n }\n }\n\n const parsedResult = result ? parseJsonText(result) : null;\n const nativeToolContext = {\n toolName,\n args,\n resultText: result,\n resultJson: parsedResult,\n isRunning,\n chatUI,\n };\n const skipRegistryRenderer =\n !isAgentCall && isBuiltinDataWidgetActionRenderer(nativeToolContext);\n const NativeToolRenderer = isAgentCall\n ? null\n : (resolveBuiltinActionChatRenderer(nativeToolContext) ??\n (skipRegistryRenderer ? null : resolveToolRenderer(nativeToolContext)) ??\n resolveBuiltinFallbackToolRenderer(nativeToolContext));\n if (NativeToolRenderer) {\n return <NativeToolRenderer context={nativeToolContext} />;\n }\n\n const inputPayload = hasArgs ? toolInputPayload(toolName, args) : null;\n const resultPayload = toolResultPayload(result);\n\n const displayName = isAgentCall\n ? isRunning\n ? `Asking ${agentName}...`\n : isAgentError\n ? `Error asking ${agentName}`\n : `Asked ${agentName}`\n : humanizeToolName(toolName);\n\n const canExpand = isAgentCall\n ? hasStreamText\n : hasArgs || result !== undefined;\n const isExpanded = isAgentCall ? hasStreamText && expanded : expanded;\n const ToolIcon = resolveToolIcon(toolName);\n const outputTitle = `Raw ${toolName} tool call output`;\n\n return (\n <div className=\"group/tool my-0.5 w-full overflow-hidden\">\n {mcpApp && <McpAppRenderer app={mcpApp} className=\"mb-1.5\" />}\n <button\n type=\"button\"\n onClick={() => canExpand && setExpanded(!isExpanded)}\n aria-expanded={canExpand ? isExpanded : undefined}\n className={cn(\n \"flex w-full items-center gap-1.5 rounded-md py-0.5 text-left text-[13px] text-muted-foreground transition-colors\",\n canExpand && \"hover:text-foreground\",\n isRunning && \"text-muted-foreground\",\n )}\n >\n <span className=\"relative flex size-4 shrink-0 items-center justify-center\">\n {isRunning ? (\n <IconLoader2 className=\"size-3.5 animate-spin\" />\n ) : isAgentError ? (\n <IconCircleX className=\"size-3.5 text-destructive\" />\n ) : (\n <>\n <ToolIcon\n className={cn(\n \"size-3.5 transition-opacity\",\n canExpand && \"group-hover/tool:opacity-0\",\n )}\n />\n {canExpand && (\n <IconChevronRight\n className={cn(\n \"absolute size-3.5 opacity-0 transition-[opacity,transform] group-hover/tool:opacity-100\",\n isExpanded && \"rotate-90\",\n )}\n />\n )}\n </>\n )}\n </span>\n <span className=\"min-w-0 truncate font-normal\">{displayName}</span>\n {repeatCount && repeatCount > 1 && (\n <span\n className=\"shrink-0 rounded border border-border/60 px-1.5 py-0.5 text-[10px] leading-none text-muted-foreground\"\n title={`Repeated ${repeatCount} times`}\n >\n {repeatCount}x\n </span>\n )}\n </button>\n <AnimatedCollapse open={isExpanded && isAgentCall && hasStreamText}>\n <div\n ref={streamRef}\n className=\"mt-1 rounded-md bg-muted/50 px-3 py-2 text-xs text-muted-foreground break-words max-h-48 overflow-y-auto agent-markdown prose prose-sm prose-invert max-w-none\"\n >\n {markdownModule?.default && remarkGfmFn ? (\n <markdownModule.default\n remarkPlugins={[remarkGfmFn]}\n components={markdownComponents}\n urlTransform={markdownUrlTransform}\n >\n {agentStreamText}\n </markdownModule.default>\n ) : (\n <span style={{ whiteSpace: \"pre-wrap\" }}>{agentStreamText}</span>\n )}\n </div>\n </AnimatedCollapse>\n <AnimatedCollapse\n open={isExpanded && !isAgentCall && (hasArgs || result !== undefined)}\n >\n <div className=\"mt-1 space-y-2 pl-5\">\n {inputPayload && (\n <SimpleCodeViewer\n text={inputPayload.text}\n lang={inputPayload.lang}\n />\n )}\n {resultPayload && (\n <ToolOutputPopover\n open={outputOpen}\n onOpenChange={setOutputOpen}\n title={outputTitle}\n payload={resultPayload}\n >\n <button\n type=\"button\"\n aria-label={`View ${toolName} output`}\n className=\"inline-flex size-6 items-center justify-center rounded-md text-muted-foreground/70 transition-colors hover:bg-accent hover:text-foreground\"\n >\n <IconCode className=\"size-3.5\" />\n </button>\n </ToolOutputPopover>\n )}\n </div>\n </AnimatedCollapse>\n {approval && (\n <ApprovalAffordance toolName={toolName} approval={approval} />\n )}\n </div>\n );\n}\n\n// ─── ToolCallFallback ──────────────────────────────────────────────────────────\n\nexport function ToolCallFallback({\n toolName,\n args,\n argsText,\n result,\n ...rest\n}: ToolCallMessagePartProps & {\n mcpApp?: AgentMcpAppPayload;\n chatUI?: ActionChatUIConfig;\n structuredMeta?: Record<string, unknown>;\n activity?: boolean;\n approval?: { approvalKey: string; dismissed?: boolean };\n repeatCount?: number;\n}) {\n const chatRunning = React.useContext(ChatRunningContext);\n const isRunning =\n result === undefined && (chatRunning || rest.activity === true);\n return (\n <ToolCallDisplay\n toolName={toolName}\n args={args as Record<string, unknown>}\n argsText={argsText}\n result={\n typeof result === \"string\"\n ? result\n : result !== undefined\n ? JSON.stringify(result)\n : undefined\n }\n mcpApp={rest.mcpApp}\n chatUI={rest.chatUI}\n structuredMeta={rest.structuredMeta}\n isRunning={isRunning}\n approval={rest.approval}\n repeatCount={rest.repeatCount}\n />\n );\n}\n\n// ─── ReconnectStreamMessage ────────────────────────────────────────────────────\n// Renders the agent's in-progress response during reconnection (outside\n// assistant-ui's runtime). Uses the same visual styling as normal messages.\n\nexport function ReconnectStreamMessage({\n content,\n}: {\n content: ContentPart[];\n}) {\n const chatRunning = React.useContext(ChatRunningContext);\n const streamingTextPartIndex =\n content.at(-1)?.type === \"text\" ? content.length - 1 : -1;\n const streamingReasoningPartIndex =\n content.at(-1)?.type === \"reasoning\" ? content.length - 1 : -1;\n\n return (\n <div className=\"flex justify-start\">\n <div className=\"w-full max-w-[95%] text-sm leading-relaxed text-foreground space-y-1\">\n {content.map((part, i) => {\n if (part.type === \"text\") {\n const partStreaming = chatRunning && i === streamingTextPartIndex;\n return (\n <SmoothMarkdownText\n key={`reconnect-text-${i}`}\n text={part.text}\n streaming={partStreaming}\n resetKey={`reconnect-text-${i}`}\n statusType={partStreaming ? \"running\" : \"complete\"}\n />\n );\n }\n if (part.type === \"reasoning\") {\n return (\n <ReasoningCell\n key={`reconnect-reasoning-${i}`}\n text={part.text}\n isStreaming={chatRunning && i === streamingReasoningPartIndex}\n />\n );\n }\n if (part.type === \"tool-call\") {\n return (\n <ToolCallDisplay\n key={`reconnect-tool-${i}`}\n toolName={part.toolName}\n argsText={part.argsText}\n args={part.args}\n result={part.result}\n mcpApp={part.mcpApp}\n chatUI={part.chatUI}\n structuredMeta={part.structuredMeta}\n isRunning={\n part.result === undefined &&\n (chatRunning || part.activity === true)\n }\n approval={part.approval}\n repeatCount={part.repeatCount}\n />\n );\n }\n return null;\n })}\n </div>\n </div>\n );\n}\n\n// ─── Reasoning / Thinking cell ────────────────────────────────────────────────\n\n/**\n * Completed reasoning and tool calls share one outer \"Worked for…\"\n * disclosure. Reasoning cells inside it render their prose directly so\n * opening that summary never reveals a redundant second disclosure.\n */\nconst WorkSummaryContentContext = React.createContext(false);\n\nexport function ReasoningCell({\n text,\n isStreaming = false,\n defaultOpen,\n durationMs,\n}: {\n text: string;\n isStreaming?: boolean;\n defaultOpen?: boolean;\n /**\n * Elapsed thinking time in ms, once known. Only meaningful once streaming\n * has finished — callers that track live timing (see ReasoningMessagePart)\n * pass this so the label can read \"Thought for Xs\" instead of \"Thought\".\n * Historical messages with no live timing simply omit it.\n */\n durationMs?: number | null;\n}) {\n const embeddedInWorkSummary = React.useContext(WorkSummaryContentContext);\n const [open, setOpen] = useState(defaultOpen ?? true);\n const trimmed = text.trim();\n if (!trimmed && !isStreaming) return null;\n\n if (embeddedInWorkSummary) {\n return (\n <div className=\"pb-1 pl-5 text-[13px] leading-relaxed text-muted-foreground whitespace-pre-wrap\">\n {trimmed || (isStreaming ? \"…\" : \"\")}\n </div>\n );\n }\n\n const label = isStreaming\n ? \"Thinking\"\n : durationMs != null && durationMs >= 1000\n ? `Thought for ${formatWorkedDuration(durationMs)}`\n : \"Thought\";\n // Only clamp to a scroll-free \"tail\" view while actively streaming and\n // expanded — once the run finishes the full text is shown, unclamped.\n const showTail = isStreaming && open;\n\n return (\n <div className=\"my-0.5 w-full\">\n <button\n type=\"button\"\n onClick={() => setOpen((v) => !v)}\n aria-expanded={open}\n className=\"flex items-center gap-1.5 py-0.5 text-[13px] text-muted-foreground transition-colors hover:text-foreground\"\n >\n <IconChevronRight\n className={cn(\n \"size-3.5 shrink-0 transition-transform\",\n open && \"rotate-90\",\n )}\n />\n {isStreaming ? (\n <span className=\"agent-thinking-indicator__text\">{label}</span>\n ) : (\n <span>{label}</span>\n )}\n </button>\n <AnimatedCollapse open={open}>\n <div className={cn(\"pl-5 pb-1\", showTail && \"reasoning-cell-tail\")}>\n <div className=\"text-[13px] leading-relaxed text-muted-foreground whitespace-pre-wrap\">\n {trimmed || (isStreaming ? \"…\" : \"\")}\n </div>\n </div>\n </AnimatedCollapse>\n </div>\n );\n}\n\n// ─── Worked-for duration helpers ──────────────────────────────────────────────\n\nexport function formatWorkedDuration(ms: number): string {\n const totalSeconds = Math.max(0, Math.round(ms / 1000));\n if (totalSeconds < 60) {\n return totalSeconds <= 1 ? \"1s\" : `${totalSeconds}s`;\n }\n const minutes = Math.floor(totalSeconds / 60);\n const seconds = totalSeconds % 60;\n if (minutes < 60) {\n if (seconds === 0) return `${minutes}m`;\n return `${minutes}m ${seconds}s`;\n }\n const hours = Math.floor(minutes / 60);\n const remMinutes = minutes % 60;\n if (remMinutes === 0) return `${hours}h`;\n return `${hours}h ${remMinutes}m`;\n}\n\nexport function WorkedForSummary({\n durationMs,\n autoCollapse = false,\n children,\n}: {\n durationMs?: number | null;\n /** When true, start open then animate closed (post-run collapse). */\n autoCollapse?: boolean;\n children: React.ReactNode;\n}) {\n const [open, setOpen] = useState(autoCollapse);\n const didAutoCollapseRef = useRef(false);\n\n useEffect(() => {\n if (!autoCollapse || didAutoCollapseRef.current) return;\n didAutoCollapseRef.current = true;\n const frame = requestAnimationFrame(() => {\n setOpen(false);\n });\n return () => cancelAnimationFrame(frame);\n }, [autoCollapse]);\n\n const label =\n durationMs != null && durationMs >= 1000\n ? `Worked for ${formatWorkedDuration(durationMs)}`\n : \"Worked\";\n\n return (\n <div className=\"my-1 w-full\">\n <button\n type=\"button\"\n onClick={() => setOpen((v) => !v)}\n aria-expanded={open}\n className=\"flex items-center gap-1.5 py-0.5 text-[13px] text-muted-foreground transition-colors hover:text-foreground\"\n >\n <span>{label}</span>\n <IconChevronRight\n className={cn(\n \"size-3.5 shrink-0 transition-transform\",\n open && \"rotate-90\",\n )}\n />\n </button>\n <AnimatedCollapse open={open}>\n <WorkSummaryContentContext.Provider value>\n <div className=\"pt-1\">{children}</div>\n </WorkSummaryContentContext.Provider>\n </AnimatedCollapse>\n </div>\n );\n}\n\n// ─── Re-export for AssistantMessage ───────────────────────────────────────────\n// AssistantMessage in AssistantChat.tsx uses FilesChangedSummary directly, so\n// re-export it so AssistantChat.tsx can import from one place.\nexport { FilesChangedSummary };\n"]}
@@ -42,6 +42,6 @@ export function PastedTextChip({ attachment, onRemove, compact = false, }) {
42
42
  const summary = lines > 0 ? `${lines} lines` : `${chars} chars`;
43
43
  return (_jsxs(PopoverPrimitive.Root, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverPrimitive.Trigger, { asChild: true, children: _jsxs("button", { type: "button", className: cn("group relative inline-flex items-center gap-2 rounded-md border border-border/70 bg-muted/50 text-start text-foreground hover:bg-muted/70 cursor-pointer", compact
44
44
  ? "max-w-[220px] px-2 py-1.5 text-xs"
45
- : "max-w-[260px] px-2.5 py-2 text-xs", onRemove && !compact && "pe-7"), "aria-label": "Preview pasted text", children: [_jsx("span", { className: cn("flex shrink-0 items-center justify-center rounded bg-background text-muted-foreground", compact ? "h-6 w-6" : "h-8 w-8"), children: _jsx(IconClipboardText, { className: compact ? "h-3.5 w-3.5" : "h-4 w-4" }) }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: "block truncate font-medium", children: "Pasted text" }), _jsx("span", { className: "block text-[11px] text-muted-foreground", children: summary })] }), onRemove && (_jsx("span", { role: "button", tabIndex: -1, onClick: handleRemove, "aria-label": "Remove pasted text", className: cn("flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center rounded text-muted-foreground hover:text-foreground", compact ? "" : "absolute end-1.5 top-1.5"), children: _jsx(IconX, { className: "h-3 w-3" }) }))] }) }), _jsx(PopoverPrimitive.Portal, { children: _jsxs(PopoverPrimitive.Content, { side: "top", align: "start", sideOffset: 6, collisionPadding: 12, className: "z-50 w-[min(560px,calc(100vw-32px))] rounded-lg border border-border bg-popover text-popover-foreground shadow-lg animate-in fade-in-0 zoom-in-95", children: [_jsxs("div", { className: "flex items-center justify-between gap-2 border-b border-border px-3 py-2", children: [_jsxs("div", { className: "flex items-center gap-2 min-w-0", children: [_jsx(IconClipboardText, { className: "h-4 w-4 shrink-0 text-muted-foreground" }), _jsx("span", { className: "text-sm font-medium truncate", children: "Pasted text" }), _jsxs("span", { className: "text-[11px] text-muted-foreground shrink-0", children: [lines, " lines \u00B7 ", chars, " chars"] })] }), _jsx("button", { type: "button", onClick: () => setOpen(false), "aria-label": "Close preview", className: "flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded text-muted-foreground hover:text-foreground", children: _jsx(IconX, { className: "h-3.5 w-3.5" }) })] }), _jsx("pre", { className: "max-h-[60vh] overflow-auto px-3 py-2 text-[12px] leading-[1.5] whitespace-pre-wrap break-words font-mono text-foreground", children: text })] }) })] }));
45
+ : "max-w-[260px] px-2.5 py-2 text-xs", onRemove && !compact && "pe-7"), "aria-label": "Preview pasted text", children: [_jsx("span", { className: cn("flex shrink-0 items-center justify-center rounded bg-background text-muted-foreground", compact ? "h-6 w-6" : "h-8 w-8"), children: _jsx(IconClipboardText, { className: compact ? "h-3.5 w-3.5" : "h-4 w-4" }) }), _jsxs("span", { className: "min-w-0 flex-1", children: [_jsx("span", { className: "block truncate font-medium", children: "Pasted text" }), _jsx("span", { className: "block text-[11px] text-muted-foreground", children: summary })] }), onRemove && (_jsx("span", { role: "button", tabIndex: -1, onClick: handleRemove, "aria-label": "Remove pasted text", className: cn("flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center rounded text-muted-foreground hover:text-foreground", compact ? "" : "absolute end-1.5 top-1.5"), children: _jsx(IconX, { className: "h-3 w-3" }) }))] }) }), _jsx(PopoverPrimitive.Portal, { children: _jsxs(PopoverPrimitive.Content, { side: "top", align: "start", sideOffset: 6, collisionPadding: 12, className: "z-50 w-[min(560px,calc(100vw-32px))] rounded-lg border border-border bg-popover text-popover-foreground shadow-lg origin-[var(--radix-popover-content-transform-origin)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95", children: [_jsxs("div", { className: "flex items-center justify-between gap-2 border-b border-border px-3 py-2", children: [_jsxs("div", { className: "flex items-center gap-2 min-w-0", children: [_jsx(IconClipboardText, { className: "h-4 w-4 shrink-0 text-muted-foreground" }), _jsx("span", { className: "text-sm font-medium truncate", children: "Pasted text" }), _jsxs("span", { className: "text-[11px] text-muted-foreground shrink-0", children: [lines, " lines \u00B7 ", chars, " chars"] })] }), _jsx("button", { type: "button", onClick: () => setOpen(false), "aria-label": "Close preview", className: "flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded text-muted-foreground hover:text-foreground", children: _jsx(IconX, { className: "h-3.5 w-3.5" }) })] }), _jsx("pre", { className: "max-h-[60vh] overflow-auto px-3 py-2 text-[12px] leading-[1.5] whitespace-pre-wrap break-words font-mono text-foreground", children: text })] }) })] }));
46
46
  }
47
47
  //# sourceMappingURL=PastedTextChip.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PastedTextChip.js","sourceRoot":"","sources":["../../../src/client/composer/PastedTextChip.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAExE,SAAS,kBAAkB,CAAC,UAAsB;IAChD,IAAI,MAAM,IAAI,UAAU,IAAI,UAAU,CAAC,IAAI,YAAY,IAA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F,EACN,QAAQ,IAAI,CACX,eACE,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,CAAC,EACZ,OAAO,EAAE,YAAY,gBACV,oBAAoB,EAC/B,SAAS,EAAE,EAAE,CACX,sHAAsH,EACtH,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,0BAA0B,CAC1C,YAED,KAAC,KAAK,IAAC,SAAS,EAAC,SAAS,GAAG,GACxB,CACR,IACM,GACgB,EAC3B,KAAC,gBAAgB,CAAC,MAAM,cACtB,MAAC,gBAAgB,CAAC,OAAO,IACvB,IAAI,EAAC,KAAK,EACV,KAAK,EAAC,OAAO,EACb,UAAU,EAAE,CAAC,EACb,gBAAgB,EAAE,EAAE,EACpB,SAAS,EAAC,mJAAmJ,aAE7J,eAAK,SAAS,EAAC,0EAA0E,aACvF,eAAK,SAAS,EAAC,iCAAiC,aAC9C,KAAC,iBAAiB,IAAC,SAAS,EAAC,wCAAwC,GAAG,EACxE,eAAM,SAAS,EAAC,8BAA8B,4BAAmB,EACjE,gBAAM,SAAS,EAAC,4CAA4C,aACzD,KAAK,oBAAW,KAAK,cACjB,IACH,EACN,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,gBAClB,eAAe,EAC1B,SAAS,EAAC,sHAAsH,YAEhI,KAAC,KAAK,IAAC,SAAS,EAAC,aAAa,GAAG,GAC1B,IACL,EACN,cAAK,SAAS,EAAC,0HAA0H,YACtI,IAAI,GACD,IACmB,GACH,IACJ,CACzB,CAAC;AACJ,CAAC","sourcesContent":["import type { Attachment } from \"@assistant-ui/react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { IconClipboardText, IconX } from \"@tabler/icons-react\";\nimport { useCallback, useEffect, useState } from \"react\";\n\nimport { cn } from \"../utils.js\";\nimport { countLines, unwrapAttachmentEnvelope } from \"./pasted-text.js\";\n\nfunction readAttachmentText(attachment: Attachment): Promise<string> | string {\n if (\"file\" in attachment && attachment.file instanceof File) {\n return attachment.file.text();\n }\n const textPart = attachment.content?.find(\n (p): p is { type: \"text\"; text: string } =>\n p.type === \"text\" && \"text\" in p && typeof p.text === \"string\",\n );\n return textPart ? unwrapAttachmentEnvelope(textPart.text) : \"\";\n}\n\nfunction usePastedAttachmentText(attachment: Attachment): {\n text: string;\n lines: number;\n chars: number;\n} {\n const [text, setText] = useState(\"\");\n\n useEffect(() => {\n let cancelled = false;\n const result = readAttachmentText(attachment);\n if (typeof result === \"string\") {\n setText(result);\n return;\n }\n result\n .then((value) => {\n if (!cancelled) setText(value);\n })\n .catch(() => {});\n return () => {\n cancelled = true;\n };\n }, [attachment]);\n\n return { text, lines: countLines(text), chars: text.length };\n}\n\nexport interface PastedTextChipProps {\n attachment: Attachment;\n onRemove?: (id: string) => void;\n /** Compact variant rendered inside sent user messages. */\n compact?: boolean;\n}\n\nexport function PastedTextChip({\n attachment,\n onRemove,\n compact = false,\n}: PastedTextChipProps) {\n const [open, setOpen] = useState(false);\n const { text, lines, chars } = usePastedAttachmentText(attachment);\n\n const handleRemove = useCallback(\n (event: React.MouseEvent) => {\n event.stopPropagation();\n onRemove?.(attachment.id);\n },\n [attachment.id, onRemove],\n );\n\n const summary = lines > 0 ? `${lines} lines` : `${chars} chars`;\n\n return (\n <PopoverPrimitive.Root open={open} onOpenChange={setOpen}>\n <PopoverPrimitive.Trigger asChild>\n <button\n type=\"button\"\n className={cn(\n \"group relative inline-flex items-center gap-2 rounded-md border border-border/70 bg-muted/50 text-start text-foreground hover:bg-muted/70 cursor-pointer\",\n compact\n ? \"max-w-[220px] px-2 py-1.5 text-xs\"\n : \"max-w-[260px] px-2.5 py-2 text-xs\",\n onRemove && !compact && \"pe-7\",\n )}\n aria-label=\"Preview pasted text\"\n >\n <span\n className={cn(\n \"flex shrink-0 items-center justify-center rounded bg-background text-muted-foreground\",\n compact ? \"h-6 w-6\" : \"h-8 w-8\",\n )}\n >\n <IconClipboardText\n className={compact ? \"h-3.5 w-3.5\" : \"h-4 w-4\"}\n />\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-medium\">Pasted text</span>\n <span className=\"block text-[11px] text-muted-foreground\">\n {summary}\n </span>\n </span>\n {onRemove && (\n <span\n role=\"button\"\n tabIndex={-1}\n onClick={handleRemove}\n aria-label=\"Remove pasted text\"\n className={cn(\n \"flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center rounded text-muted-foreground hover:text-foreground\",\n compact ? \"\" : \"absolute end-1.5 top-1.5\",\n )}\n >\n <IconX className=\"h-3 w-3\" />\n </span>\n )}\n </button>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n side=\"top\"\n align=\"start\"\n sideOffset={6}\n collisionPadding={12}\n className=\"z-50 w-[min(560px,calc(100vw-32px))] rounded-lg border border-border bg-popover text-popover-foreground shadow-lg animate-in fade-in-0 zoom-in-95\"\n >\n <div className=\"flex items-center justify-between gap-2 border-b border-border px-3 py-2\">\n <div className=\"flex items-center gap-2 min-w-0\">\n <IconClipboardText className=\"h-4 w-4 shrink-0 text-muted-foreground\" />\n <span className=\"text-sm font-medium truncate\">Pasted text</span>\n <span className=\"text-[11px] text-muted-foreground shrink-0\">\n {lines} lines · {chars} chars\n </span>\n </div>\n <button\n type=\"button\"\n onClick={() => setOpen(false)}\n aria-label=\"Close preview\"\n className=\"flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded text-muted-foreground hover:text-foreground\"\n >\n <IconX className=\"h-3.5 w-3.5\" />\n </button>\n </div>\n <pre className=\"max-h-[60vh] overflow-auto px-3 py-2 text-[12px] leading-[1.5] whitespace-pre-wrap break-words font-mono text-foreground\">\n {text}\n </pre>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n );\n}\n"]}
1
+ {"version":3,"file":"PastedTextChip.js","sourceRoot":"","sources":["../../../src/client/composer/PastedTextChip.tsx"],"names":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AAS,EAAC,sHAAsH,YAEhI,KAAC,KAAK,IAAC,SAAS,EAAC,aAAa,GAAG,GAC1B,IACL,EACN,cAAK,SAAS,EAAC,0HAA0H,YACtI,IAAI,GACD,IACmB,GACH,IACJ,CACzB,CAAC;AACJ,CAAC","sourcesContent":["import type { Attachment } from \"@assistant-ui/react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { IconClipboardText, IconX } from \"@tabler/icons-react\";\nimport { useCallback, useEffect, useState } from \"react\";\n\nimport { cn } from \"../utils.js\";\nimport { countLines, unwrapAttachmentEnvelope } from \"./pasted-text.js\";\n\nfunction readAttachmentText(attachment: Attachment): Promise<string> | string {\n if (\"file\" in attachment && attachment.file instanceof File) {\n return attachment.file.text();\n }\n const textPart = attachment.content?.find(\n (p): p is { type: \"text\"; text: string } =>\n p.type === \"text\" && \"text\" in p && typeof p.text === \"string\",\n );\n return textPart ? unwrapAttachmentEnvelope(textPart.text) : \"\";\n}\n\nfunction usePastedAttachmentText(attachment: Attachment): {\n text: string;\n lines: number;\n chars: number;\n} {\n const [text, setText] = useState(\"\");\n\n useEffect(() => {\n let cancelled = false;\n const result = readAttachmentText(attachment);\n if (typeof result === \"string\") {\n setText(result);\n return;\n }\n result\n .then((value) => {\n if (!cancelled) setText(value);\n })\n .catch(() => {});\n return () => {\n cancelled = true;\n };\n }, [attachment]);\n\n return { text, lines: countLines(text), chars: text.length };\n}\n\nexport interface PastedTextChipProps {\n attachment: Attachment;\n onRemove?: (id: string) => void;\n /** Compact variant rendered inside sent user messages. */\n compact?: boolean;\n}\n\nexport function PastedTextChip({\n attachment,\n onRemove,\n compact = false,\n}: PastedTextChipProps) {\n const [open, setOpen] = useState(false);\n const { text, lines, chars } = usePastedAttachmentText(attachment);\n\n const handleRemove = useCallback(\n (event: React.MouseEvent) => {\n event.stopPropagation();\n onRemove?.(attachment.id);\n },\n [attachment.id, onRemove],\n );\n\n const summary = lines > 0 ? `${lines} lines` : `${chars} chars`;\n\n return (\n <PopoverPrimitive.Root open={open} onOpenChange={setOpen}>\n <PopoverPrimitive.Trigger asChild>\n <button\n type=\"button\"\n className={cn(\n \"group relative inline-flex items-center gap-2 rounded-md border border-border/70 bg-muted/50 text-start text-foreground hover:bg-muted/70 cursor-pointer\",\n compact\n ? \"max-w-[220px] px-2 py-1.5 text-xs\"\n : \"max-w-[260px] px-2.5 py-2 text-xs\",\n onRemove && !compact && \"pe-7\",\n )}\n aria-label=\"Preview pasted text\"\n >\n <span\n className={cn(\n \"flex shrink-0 items-center justify-center rounded bg-background text-muted-foreground\",\n compact ? \"h-6 w-6\" : \"h-8 w-8\",\n )}\n >\n <IconClipboardText\n className={compact ? \"h-3.5 w-3.5\" : \"h-4 w-4\"}\n />\n </span>\n <span className=\"min-w-0 flex-1\">\n <span className=\"block truncate font-medium\">Pasted text</span>\n <span className=\"block text-[11px] text-muted-foreground\">\n {summary}\n </span>\n </span>\n {onRemove && (\n <span\n role=\"button\"\n tabIndex={-1}\n onClick={handleRemove}\n aria-label=\"Remove pasted text\"\n className={cn(\n \"flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center rounded text-muted-foreground hover:text-foreground\",\n compact ? \"\" : \"absolute end-1.5 top-1.5\",\n )}\n >\n <IconX className=\"h-3 w-3\" />\n </span>\n )}\n </button>\n </PopoverPrimitive.Trigger>\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n side=\"top\"\n align=\"start\"\n sideOffset={6}\n collisionPadding={12}\n className=\"z-50 w-[min(560px,calc(100vw-32px))] rounded-lg border border-border bg-popover text-popover-foreground shadow-lg origin-[var(--radix-popover-content-transform-origin)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95\"\n >\n <div className=\"flex items-center justify-between gap-2 border-b border-border px-3 py-2\">\n <div className=\"flex items-center gap-2 min-w-0\">\n <IconClipboardText className=\"h-4 w-4 shrink-0 text-muted-foreground\" />\n <span className=\"text-sm font-medium truncate\">Pasted text</span>\n <span className=\"text-[11px] text-muted-foreground shrink-0\">\n {lines} lines · {chars} chars\n </span>\n </div>\n <button\n type=\"button\"\n onClick={() => setOpen(false)}\n aria-label=\"Close preview\"\n className=\"flex h-6 w-6 shrink-0 cursor-pointer items-center justify-center rounded text-muted-foreground hover:text-foreground\"\n >\n <IconX className=\"h-3.5 w-3.5\" />\n </button>\n </div>\n <pre className=\"max-h-[60vh] overflow-auto px-3 py-2 text-[12px] leading-[1.5] whitespace-pre-wrap break-words font-mono text-foreground\">\n {text}\n </pre>\n </PopoverPrimitive.Content>\n </PopoverPrimitive.Portal>\n </PopoverPrimitive.Root>\n );\n}\n"]}
@@ -18,6 +18,7 @@ export interface RealtimeVoiceModeCopy {
18
18
  showChat: string;
19
19
  hideChat: string;
20
20
  endVoiceMode: string;
21
+ microphoneSettings: string;
21
22
  status: Record<RealtimeVoiceModeState, string>;
22
23
  errors: {
23
24
  unsupported: string;
@@ -55,6 +56,7 @@ export interface RealtimeVoiceModeDockProps {
55
56
  audioLevels?: RealtimeVoiceAudioLevelStore;
56
57
  onToggleChat: () => void;
57
58
  onEndVoiceMode: () => void;
59
+ onOpenMicrophoneSettings?: () => void;
58
60
  errorMessage?: string | null;
59
61
  className?: string;
60
62
  }
@@ -62,5 +64,5 @@ export interface RealtimeVoiceModeDockProps {
62
64
  * Persistent voice-session control. Toggling the main orb only changes chat
63
65
  * visibility; ending the realtime session is intentionally a separate action.
64
66
  */
65
- export declare function RealtimeVoiceModeDock({ state, copy, chatVisible, audioLevels, onToggleChat, onEndVoiceMode, errorMessage, className, }: RealtimeVoiceModeDockProps): import("react").JSX.Element;
67
+ export declare function RealtimeVoiceModeDock({ state, copy, chatVisible, audioLevels, onToggleChat, onEndVoiceMode, onOpenMicrophoneSettings, errorMessage, className, }: RealtimeVoiceModeDockProps): import("react").JSX.Element;
66
68
  //# sourceMappingURL=RealtimeVoiceMode.d.ts.map
@@ -1 +1 @@
1
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CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,IAAI,EACJ,QAAQ,EACR,IAAI,EAAE,cAAc,EACpB,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,aAAqB,EACrB,gBAAwB,EACxB,iBAAyB,EACzB,gBAAgB,EAChB,cAAc,EACd,SAAS,GACV,EAAE,2BAA2B,+BAmH7B;AAED,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,sBAAsB,CAAC;IAC9B,IAAI,EAAE,qBAAqB,CAAC;IAC5B,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,4BAA4B,CAAC;IAC3C,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,wBAAwB,CAAC,EAAE,MAAM,IAAI,CAAC;IACtC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAiFD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,KAAK,EACL,IAAI,EACJ,WAAW,EACX,WAAiC,EACjC,YAAY,EACZ,cAAc,EACd,wBAAwB,EACxB,YAAY,EACZ,SAAS,GACV,EAAE,0BAA0B,+BAgL5B"}
@@ -1,7 +1,7 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Button } from "@agent-native/toolkit/ui/button";
3
- import { IconAlertTriangle, IconLoader2, IconMicrophone, IconPhoneOff, IconVolume, } from "@tabler/icons-react";
4
- import { useEffect, useId, useState, useSyncExternalStore } from "react";
3
+ import { IconAlertTriangle, IconLoader2, IconMicrophone, IconPhoneOff, IconSettings, IconVolume, } from "@tabler/icons-react";
4
+ import { useEffect, useId, useState, useSyncExternalStore, } from "react";
5
5
  import { Popover, PopoverContent, PopoverTrigger, } from "../components/ui/popover.js";
6
6
  import { Tooltip, TooltipContent, TooltipTrigger, } from "../components/ui/tooltip.js";
7
7
  import { cn } from "../utils.js";
@@ -25,9 +25,11 @@ export function RealtimeVoiceModeEntry({ copy, disabled, open: controlledOpen, o
25
25
  setOpen(false);
26
26
  callback();
27
27
  };
28
- return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(PopoverTrigger, { asChild: true, children: _jsx(Button, { type: "button", variant: "ghost", size: "icon", disabled: disabled, "aria-label": copy.entryButtonLabel, "aria-expanded": open, className: cn("size-7 shrink-0 text-muted-foreground hover:text-foreground", className), children: _jsx(IconMicrophone, {}) }) }) }), _jsx(TooltipContent, { children: copy.entryButtonLabel })] }), _jsx(PopoverContent, { side: "top", align: "end", sideOffset: 10, className: "w-[min(22rem,calc(100vw-2rem))] p-4", "aria-labelledby": titleId, "aria-describedby": descriptionId, children: _jsxs("div", { className: "grid gap-3", children: [_jsxs("div", { className: "grid gap-1", children: [_jsx("h2", { id: titleId, className: "text-sm font-semibold text-foreground", children: setupRequired ? copy.setupTitle : copy.promptTitle }), _jsx("p", { id: descriptionId, className: "text-sm leading-relaxed text-muted-foreground", children: setupRequired ? copy.setupDescription : copy.promptDescription })] }), _jsxs("div", { className: "flex flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:justify-end", children: [_jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: () => choose(onKeepDictating), children: copy.keepDictating }), setupRequired ? (_jsxs(_Fragment, { children: [_jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => choose(onUseOpenAiKey ?? onStartVoiceMode), children: openAiConfigured
28
+ return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(PopoverTrigger, { asChild: true, children: _jsx(Button, { type: "button", variant: "ghost", size: "icon", disabled: disabled, "aria-label": copy.entryButtonLabel, "aria-expanded": open, className: cn("size-7 shrink-0 text-muted-foreground hover:text-foreground", className), children: _jsx(IconMicrophone, {}) }) }) }), _jsx(TooltipContent, { children: copy.entryButtonLabel })] }), _jsx(PopoverContent, { side: "top", align: "end", sideOffset: 10, className: cn("p-4", setupRequired
29
+ ? "w-[min(30rem,calc(100vw-2rem))]"
30
+ : "w-[min(22rem,calc(100vw-2rem))]"), "aria-labelledby": titleId, "aria-describedby": descriptionId, children: _jsxs("div", { className: "grid gap-3", children: [_jsxs("div", { className: "grid gap-1", children: [_jsx("h2", { id: titleId, className: "text-sm font-semibold text-foreground", children: setupRequired ? copy.setupTitle : copy.promptTitle }), _jsx("p", { id: descriptionId, className: "text-sm leading-relaxed text-muted-foreground", children: setupRequired ? copy.setupDescription : copy.promptDescription })] }), _jsxs("div", { className: "flex flex-col-reverse gap-2 sm:flex-row sm:flex-nowrap sm:justify-end", children: [_jsx(Button, { type: "button", variant: "ghost", size: "sm", onClick: () => choose(onKeepDictating), children: copy.keepDictating }), setupRequired ? (_jsxs(_Fragment, { children: [_jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => choose(onUseOpenAiKey ?? onStartVoiceMode), children: openAiConfigured
29
31
  ? copy.startWithOpenAiKey
30
- : copy.useOpenAiKey }), _jsxs(Button, { type: "button", size: "sm", disabled: connectingBuilder, onClick: () => choose(onConnectBuilder ?? onStartVoiceMode), children: [connectingBuilder ? (_jsx(IconLoader2, { className: "animate-spin" })) : null, copy.connectBuilder] })] })) : (_jsxs(Button, { type: "button", size: "sm", onClick: () => choose(onStartVoiceMode), children: [_jsx(IconMicrophone, {}), copy.startVoiceMode] }))] })] }) })] }));
32
+ : copy.useOpenAiKey }), _jsxs(Button, { type: "button", size: "sm", className: "whitespace-nowrap", disabled: connectingBuilder, onClick: () => choose(onConnectBuilder ?? onStartVoiceMode), children: [connectingBuilder ? (_jsx(IconLoader2, { className: "animate-spin" })) : null, copy.connectBuilder] })] })) : (_jsxs(Button, { type: "button", size: "sm", onClick: () => choose(onStartVoiceMode), children: [_jsx(IconMicrophone, {}), copy.startVoiceMode] }))] })] }) })] }));
31
33
  }
32
34
  const SILENT_AUDIO_LEVELS = createRealtimeVoiceAudioLevelStore();
33
35
  const WAVEFORM_WEIGHTS = [0.55, 0.82, 1, 0.82, 0.55];
@@ -45,17 +47,17 @@ function usePrefersReducedMotion() {
45
47
  }, []);
46
48
  return reduced;
47
49
  }
48
- function VoiceWaveform({ level, reducedMotion, }) {
50
+ function VoiceWaveform({ level, reducedMotion, activity, }) {
49
51
  const visibleLevel = reducedMotion ? 0.45 : level;
50
- return (_jsx("span", { "aria-hidden": "true", className: "flex h-6 items-center justify-center gap-0.5", "data-realtime-voice-waveform": "true", children: WAVEFORM_WEIGHTS.map((weight, index) => (_jsx("span", { className: "w-0.5 rounded-full bg-current transition-[height] duration-75 ease-out motion-reduce:transition-none", style: { height: `${4 + visibleLevel * 16 * weight}px` } }, index))) }));
52
+ return (_jsx("span", { "aria-hidden": "true", className: "flex h-6 items-center justify-center gap-0.5", "data-realtime-voice-waveform": "true", "data-realtime-voice-waveform-activity": activity, children: WAVEFORM_WEIGHTS.map((weight, index) => (_jsx("span", { className: "h-5 w-0.5 origin-center rounded-full bg-current transition-transform duration-75 ease-out motion-reduce:transition-none", style: { transform: `scaleY(${0.2 + visibleLevel * 0.8 * weight})` } }, index))) }));
51
53
  }
52
54
  const ORB_STATE_CLASSES = {
53
- connecting: "bg-secondary text-secondary-foreground ring-4 ring-secondary/40 hover:bg-secondary/80",
54
- listening: "bg-primary text-primary-foreground ring-4 ring-primary/15 hover:bg-primary/90",
55
- speaking: "bg-foreground text-background ring-4 ring-foreground/15 hover:bg-foreground/90",
56
- working: "bg-secondary text-secondary-foreground ring-4 ring-secondary/40 hover:bg-secondary/80",
57
- error: "bg-destructive text-destructive-foreground ring-4 ring-destructive/15 hover:bg-destructive/90",
58
- ending: "bg-muted text-muted-foreground ring-4 ring-muted/40 cursor-wait",
55
+ connecting: "bg-secondary text-secondary-foreground ring-secondary/40 hover:bg-secondary/80",
56
+ listening: "bg-primary text-primary-foreground ring-primary/20 hover:bg-primary/90",
57
+ speaking: "bg-foreground text-background ring-foreground/20 hover:bg-foreground/90",
58
+ working: "bg-secondary text-secondary-foreground ring-secondary/40 hover:bg-secondary/80",
59
+ error: "bg-destructive text-destructive-foreground ring-destructive/20 hover:bg-destructive/90",
60
+ ending: "cursor-wait bg-muted text-muted-foreground ring-muted/40",
59
61
  };
60
62
  function VoiceStateIcon({ state }) {
61
63
  switch (state) {
@@ -76,8 +78,10 @@ function VoiceStateIcon({ state }) {
76
78
  * Persistent voice-session control. Toggling the main orb only changes chat
77
79
  * visibility; ending the realtime session is intentionally a separate action.
78
80
  */
79
- export function RealtimeVoiceModeDock({ state, copy, chatVisible, audioLevels = SILENT_AUDIO_LEVELS, onToggleChat, onEndVoiceMode, errorMessage, className, }) {
81
+ export function RealtimeVoiceModeDock({ state, copy, chatVisible, audioLevels = SILENT_AUDIO_LEVELS, onToggleChat, onEndVoiceMode, onOpenMicrophoneSettings, errorMessage, className, }) {
80
82
  const statusId = useId();
83
+ const controlsId = useId();
84
+ const [controlsOpen, setControlsOpen] = useState(false);
81
85
  const levels = useSyncExternalStore(audioLevels.subscribe, audioLevels.getSnapshot, audioLevels.getSnapshot);
82
86
  const reducedMotion = usePrefersReducedMotion();
83
87
  const activity = levels.output > AUDIO_ACTIVITY_THRESHOLD
@@ -89,6 +93,23 @@ export function RealtimeVoiceModeDock({ state, copy, chatVisible, audioLevels =
89
93
  const toggleLabel = chatVisible ? copy.hideChat : copy.showChat;
90
94
  const ending = state === "ending";
91
95
  const errorDetailVisible = state === "error" && Boolean(errorMessage);
92
- return (_jsxs("div", { className: cn("pointer-events-none fixed bottom-4 end-4 flex max-w-[calc(100vw-2rem)] flex-col items-end gap-2", className), style: { zIndex: 270 }, "data-realtime-voice-state": state, "data-realtime-voice-activity": activity, children: [errorDetailVisible ? (_jsx("div", { role: "alert", className: "pointer-events-auto max-w-xs rounded-lg border border-destructive/30 bg-background px-3 py-2 text-sm text-destructive shadow-md", children: errorMessage })) : null, _jsx("div", { id: statusId, role: state === "error" && !errorDetailVisible ? "alert" : "status", "aria-live": state === "error" && !errorDetailVisible ? "assertive" : "polite", className: "rounded-full border border-border bg-background px-3 py-1.5 text-xs font-medium text-foreground shadow-sm", children: copy.status[state] }), _jsxs("div", { className: "pointer-events-auto flex items-center gap-2", children: [_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { type: "button", variant: "outline", size: "icon", disabled: ending, onClick: onEndVoiceMode, "aria-label": copy.endVoiceMode, className: "size-10 rounded-full bg-background shadow-md", children: _jsx(IconPhoneOff, {}) }) }), _jsx(TooltipContent, { children: copy.endVoiceMode })] }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { type: "button", size: "icon", disabled: ending, onClick: onToggleChat, "aria-label": toggleLabel, "aria-pressed": chatVisible, "aria-describedby": statusId, className: cn("size-14 rounded-full shadow-lg", ORB_STATE_CLASSES[state]), children: activity === "idle" ? (_jsx(VoiceStateIcon, { state: state })) : (_jsx(VoiceWaveform, { level: activityLevel, reducedMotion: reducedMotion })) }) }), _jsx(TooltipContent, { children: toggleLabel })] })] })] }));
96
+ const orbScale = reducedMotion ? 1 : 1 + Math.min(activityLevel, 1) * 0.07;
97
+ const closeControlsUnlessFocused = (event) => {
98
+ if (!event.currentTarget.contains(document.activeElement)) {
99
+ setControlsOpen(false);
100
+ }
101
+ };
102
+ return (_jsxs("div", { className: cn("pointer-events-none fixed bottom-4 end-4 flex max-w-[calc(100vw-2rem)] flex-col items-end gap-2", className), style: { zIndex: 270 }, "data-realtime-voice-state": state, "data-realtime-voice-activity": activity, children: [errorDetailVisible ? (_jsx("div", { role: "alert", className: "pointer-events-auto max-w-xs rounded-lg border border-destructive/30 bg-background px-3 py-2 text-sm text-destructive shadow-md", children: errorMessage })) : null, _jsxs("div", { className: "group pointer-events-auto flex items-center gap-2", onMouseEnter: () => setControlsOpen(true), onMouseLeave: closeControlsUnlessFocused, onFocusCapture: () => setControlsOpen(true), onBlurCapture: (event) => {
103
+ if (!event.currentTarget.contains(event.relatedTarget)) {
104
+ setControlsOpen(false);
105
+ }
106
+ }, children: [_jsxs("div", { id: controlsId, "data-realtime-voice-controls": controlsOpen ? "open" : "closed", className: cn("flex items-center gap-1 rounded-full border border-border/70 bg-background/95 p-1 ps-3 shadow-lg backdrop-blur-md transition-[transform,opacity] duration-150 ease-out motion-reduce:transition-none", controlsOpen
107
+ ? "pointer-events-auto translate-x-0 opacity-100"
108
+ : "pointer-events-none opacity-0 ltr:translate-x-2 rtl:-translate-x-2 group-hover:pointer-events-auto group-hover:translate-x-0 group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:translate-x-0 group-focus-within:opacity-100"), children: [_jsx("div", { id: statusId, role: state === "error" && !errorDetailVisible ? "alert" : "status", "aria-live": state === "error" && !errorDetailVisible ? "assertive" : "polite", className: "me-1 whitespace-nowrap text-xs font-medium text-foreground", children: copy.status[state] }), onOpenMicrophoneSettings ? (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { type: "button", variant: "ghost", size: "icon", disabled: ending, onClick: onOpenMicrophoneSettings, "aria-label": copy.microphoneSettings, className: "size-8 rounded-full text-muted-foreground transition-transform duration-150 ease-out active:scale-[0.97]", children: _jsx(IconSettings, {}) }) }), _jsx(TooltipContent, { children: copy.microphoneSettings })] })) : null, _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { type: "button", variant: "ghost", size: "icon", disabled: ending, onClick: onEndVoiceMode, "aria-label": copy.endVoiceMode, className: "size-8 rounded-full text-destructive transition-transform duration-150 ease-out hover:bg-destructive/10 hover:text-destructive active:scale-[0.97]", children: _jsx(IconPhoneOff, {}) }) }), _jsx(TooltipContent, { children: copy.endVoiceMode })] })] }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs(Button, { type: "button", size: "icon", disabled: ending, onClick: () => {
109
+ setControlsOpen(true);
110
+ onToggleChat();
111
+ }, "aria-label": toggleLabel, "aria-pressed": chatVisible, "aria-describedby": statusId, "aria-controls": controlsId, "aria-expanded": controlsOpen, className: cn("relative isolate size-16 overflow-visible rounded-full ring-4 shadow-xl transition-transform duration-150 ease-out focus-visible:ring-offset-2 active:scale-[0.97] motion-reduce:transition-none", ORB_STATE_CLASSES[state]), children: [_jsx("span", { "aria-hidden": "true", className: cn("pointer-events-none absolute -inset-2 -z-10 rounded-full bg-current opacity-0 blur-md transition-[transform,opacity] duration-150 ease-out motion-reduce:transition-none", activity !== "idle" && "opacity-20"), style: { transform: `scale(${orbScale})` } }), _jsxs("span", { "aria-hidden": "true", className: "pointer-events-none absolute inset-1 overflow-hidden rounded-full bg-gradient-to-br from-background/70 via-background/15 to-transparent opacity-70", children: [_jsx("span", { className: "absolute start-2.5 top-2 size-3 rounded-full bg-background/70 blur-[1px]" }), _jsx("span", { className: "absolute -bottom-2 -end-1 h-8 w-10 rounded-full bg-background/25 blur-md transition-transform duration-150 ease-out motion-reduce:transition-none", style: {
112
+ transform: `scale(${reducedMotion ? 1 : 1 + activityLevel * 0.25})`,
113
+ } })] }), _jsx("span", { className: "relative z-10 flex items-center justify-center", children: activity === "idle" ? (_jsx(VoiceStateIcon, { state: state })) : (_jsx(VoiceWaveform, { level: activityLevel, reducedMotion: reducedMotion, activity: activity })) })] }) }), _jsx(TooltipContent, { children: toggleLabel })] })] })] }));
93
114
  }
94
115
  //# sourceMappingURL=RealtimeVoiceMode.js.map