@agent-native/core 0.151.2 → 0.152.1

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 (259) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/templates/analytics/.agents/skills/sharing/SKILL.md +1 -1
  3. package/corpus/templates/analytics/.agents/skills/turn-into-app/SKILL.md +24 -0
  4. package/corpus/templates/analytics/actions/bigquery-query.ts +21 -0
  5. package/corpus/templates/analytics/app/components/ConnectionTestStatus.tsx +65 -0
  6. package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +3 -3
  7. package/corpus/templates/analytics/app/pages/DataSources.tsx +15 -37
  8. package/corpus/templates/analytics/app/root.tsx +0 -1
  9. package/corpus/templates/analytics/changelog/2026-08-11-analytics-custom-blocks-keep-loading-with-legacy-bigquery-action.md +6 -0
  10. package/corpus/templates/analytics/changelog/2026-08-11-analytics-routes-company-knowledge-and-slack-context-questio.md +6 -0
  11. package/corpus/templates/analytics/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
  12. package/corpus/templates/analytics/public/manifest.json +0 -1
  13. package/corpus/templates/analytics/server/lib/agent-chat-plan-mode.ts +5 -0
  14. package/corpus/templates/analytics/server/plugins/agent-chat.ts +5 -0
  15. package/corpus/templates/assets/.agents/skills/sharing/SKILL.md +1 -1
  16. package/corpus/templates/assets/.agents/skills/turn-into-app/SKILL.md +24 -0
  17. package/corpus/templates/assets/app/root.tsx +0 -1
  18. package/corpus/templates/assets/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
  19. package/corpus/templates/assets/public/manifest.json +0 -1
  20. package/corpus/templates/brain/.agents/skills/sharing/SKILL.md +1 -1
  21. package/corpus/templates/brain/.agents/skills/turn-into-app/SKILL.md +24 -0
  22. package/corpus/templates/brain/app/root.tsx +0 -1
  23. package/corpus/templates/brain/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
  24. package/corpus/templates/brain/public/manifest.json +0 -1
  25. package/corpus/templates/calendar/.agents/skills/sharing/SKILL.md +1 -1
  26. package/corpus/templates/calendar/.agents/skills/turn-into-app/SKILL.md +24 -0
  27. package/corpus/templates/calendar/app/components/calendar/GoogleConnectBanner.tsx +0 -53
  28. package/corpus/templates/calendar/app/i18n-data.ts +0 -80
  29. package/corpus/templates/calendar/app/root.tsx +0 -1
  30. package/corpus/templates/calendar/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
  31. package/corpus/templates/calendar/changelog/2026-08-11-google-calendar-connection-buttons-now-open-the-sign-in-flow.md +6 -0
  32. package/corpus/templates/calendar/public/manifest.json +0 -1
  33. package/corpus/templates/calendar/server/plugins/auth.ts +0 -10
  34. package/corpus/templates/chat/.agents/skills/sharing/SKILL.md +1 -1
  35. package/corpus/templates/chat/.agents/skills/turn-into-app/SKILL.md +24 -0
  36. package/corpus/templates/chat/app/root.tsx +0 -1
  37. package/corpus/templates/chat/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
  38. package/corpus/templates/chat/public/manifest.json +0 -1
  39. package/corpus/templates/clips/.agents/skills/turn-into-app/SKILL.md +24 -0
  40. package/corpus/templates/clips/app/components/player/playback-comment-overlay.tsx +1 -1
  41. package/corpus/templates/clips/app/components/player/share-dialog.tsx +6 -0
  42. package/corpus/templates/clips/app/components/sharing/share-ui.tsx +20 -3
  43. package/corpus/templates/clips/app/i18n/en-US.ts +4 -4
  44. package/corpus/templates/clips/app/root.tsx +0 -1
  45. package/corpus/templates/clips/app/routes/_app.meetings._index.tsx +1 -3
  46. package/corpus/templates/clips/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
  47. package/corpus/templates/clips/changelog/2026-08-11-clips-desktop-settings-are-now-easier-to-scan-with-a-wider-t.md +6 -0
  48. package/corpus/templates/clips/changelog/2026-08-11-google-calendar-connections-from-meetings-now-open-directly.md +6 -0
  49. package/corpus/templates/clips/changelog/2026-08-11-recording-viewers-can-comment-and-react.md +6 -0
  50. package/corpus/templates/clips/changelog/2026-08-11-system-audio-recording-now-lives-inside-the-microphone-menu-.md +6 -0
  51. package/corpus/templates/clips/changelog/2026-08-11-timestamped-comments-stay-on-the-video-for-three-seconds-wh.md +6 -0
  52. package/corpus/templates/clips/desktop/src/app.tsx +773 -1001
  53. package/corpus/templates/clips/desktop/src/components/MediaDeviceRow.tsx +15 -27
  54. package/corpus/templates/clips/desktop/src/styles.css +364 -5
  55. package/corpus/templates/clips/desktop/src-tauri/src/clips/mod.rs +1 -1
  56. package/corpus/templates/clips/public/manifest.json +0 -1
  57. package/corpus/templates/content/.agents/skills/sharing/SKILL.md +1 -1
  58. package/corpus/templates/content/.agents/skills/turn-into-app/SKILL.md +24 -0
  59. package/corpus/templates/content/AGENTS.md +3 -0
  60. package/corpus/templates/content/actions/resolve-content-landing.ts +120 -0
  61. package/corpus/templates/content/app/components/editor/BubbleToolbar.tsx +196 -30
  62. package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +9 -0
  63. package/corpus/templates/content/app/i18n-data.ts +58 -0
  64. package/corpus/templates/content/app/lib/content-landing.ts +22 -0
  65. package/corpus/templates/content/app/root.tsx +0 -1
  66. package/corpus/templates/content/app/routes/_app._index.tsx +36 -26
  67. package/corpus/templates/content/changelog/2026-08-03-choose-text-or-a-heading-from-one-compact-formatting-control.md +6 -0
  68. package/corpus/templates/content/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
  69. package/corpus/templates/content/changelog/2026-08-11-content-opens-your-last-page-on-return-and-gives-new-users-a.md +6 -0
  70. package/corpus/templates/content/docs/product/capabilities/content.workspace.session-restore.md +7 -1
  71. package/corpus/templates/content/docs/solutions/evidence/content-text-selector/README.md +26 -0
  72. package/corpus/templates/content/parity/matrix.md +1 -0
  73. package/corpus/templates/content/parity/matrix.ts +22 -0
  74. package/corpus/templates/content/public/manifest.json +0 -1
  75. package/corpus/templates/content/shared/content-landing.ts +17 -0
  76. package/corpus/templates/crm/.agents/skills/sharing/SKILL.md +1 -1
  77. package/corpus/templates/crm/.agents/skills/turn-into-app/SKILL.md +24 -0
  78. package/corpus/templates/crm/app/root.tsx +0 -1
  79. package/corpus/templates/crm/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
  80. package/corpus/templates/crm/public/manifest.json +0 -1
  81. package/corpus/templates/design/.agents/skills/sharing/SKILL.md +1 -1
  82. package/corpus/templates/design/.agents/skills/turn-into-app/SKILL.md +24 -0
  83. package/corpus/templates/design/app/i18n/en-US.ts +5 -0
  84. package/corpus/templates/design/app/root.tsx +0 -1
  85. package/corpus/templates/design/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
  86. package/corpus/templates/design/changelog/2026-08-11-design-sharing-now-identifies-viewers-who-can-add-review-com.md +6 -0
  87. package/corpus/templates/design/public/manifest.json +0 -1
  88. package/corpus/templates/dispatch/.agents/skills/sharing/SKILL.md +1 -1
  89. package/corpus/templates/dispatch/.agents/skills/turn-into-app/SKILL.md +24 -0
  90. package/corpus/templates/dispatch/AGENTS.md +9 -0
  91. package/corpus/templates/dispatch/actions/list-dispatch-usage-metrics.ts +5 -19
  92. package/corpus/templates/dispatch/actions/view-screen.ts +10 -3
  93. package/corpus/templates/dispatch/app/root.tsx +0 -1
  94. package/corpus/templates/dispatch/app/routes/settings.tsx +13 -1
  95. package/corpus/templates/dispatch/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
  96. package/corpus/templates/dispatch/changelog/2026-08-11-clicking-the-dispatch-logo-returns-to-the-overview-page.md +6 -0
  97. package/corpus/templates/dispatch/changelog/2026-08-11-dispatch-no-longer-links-to-itself-from-the-app-switcher.md +6 -0
  98. package/corpus/templates/dispatch/changelog/2026-08-11-dispatch-settings-now-link-directly-to-admin.md +6 -0
  99. package/corpus/templates/dispatch/changelog/2026-08-11-dispatch-shows-usage-trends-recent-prompts-and-an-agent-revi.md +6 -0
  100. package/corpus/templates/dispatch/changelog/2026-08-11-human-friendly-app-names.md +6 -0
  101. package/corpus/templates/dispatch/public/manifest.json +0 -1
  102. package/corpus/templates/dispatch/server/lib/identity-sso.ts +432 -158
  103. package/corpus/templates/dispatch/server/plugins/identity-sso.ts +204 -123
  104. package/corpus/templates/dispatch/server/plugins/setup-dispatch.ts +1 -0
  105. package/corpus/templates/factory/.agents/skills/sharing/SKILL.md +1 -1
  106. package/corpus/templates/factory/.agents/skills/turn-into-app/SKILL.md +24 -0
  107. package/corpus/templates/factory/app/root.tsx +0 -1
  108. package/corpus/templates/factory/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
  109. package/corpus/templates/factory/public/manifest.json +0 -1
  110. package/corpus/templates/forms/.agents/skills/sharing/SKILL.md +1 -1
  111. package/corpus/templates/forms/.agents/skills/turn-into-app/SKILL.md +24 -0
  112. package/corpus/templates/forms/app/root.tsx +0 -1
  113. package/corpus/templates/forms/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
  114. package/corpus/templates/forms/public/manifest.json +0 -1
  115. package/corpus/templates/macros/.agents/skills/sharing/SKILL.md +1 -1
  116. package/corpus/templates/macros/.agents/skills/turn-into-app/SKILL.md +24 -0
  117. package/corpus/templates/mail/.agents/skills/sharing/SKILL.md +1 -1
  118. package/corpus/templates/mail/.agents/skills/turn-into-app/SKILL.md +24 -0
  119. package/corpus/templates/mail/app/root.tsx +0 -1
  120. package/corpus/templates/mail/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
  121. package/corpus/templates/mail/changelog/2026-08-11-google-sign-in-now-opens-the-gmail-connection-flow-directly.md +6 -0
  122. package/corpus/templates/mail/public/manifest.json +0 -1
  123. package/corpus/templates/mail/server/plugins/auth.ts +0 -10
  124. package/corpus/templates/plan/.agents/skills/sharing/SKILL.md +1 -1
  125. package/corpus/templates/plan/.agents/skills/turn-into-app/SKILL.md +24 -0
  126. package/corpus/templates/plan/app/i18n/en-US.ts +2 -0
  127. package/corpus/templates/plan/app/pages/PlansPage.tsx +6 -0
  128. package/corpus/templates/plan/app/root.tsx +0 -1
  129. package/corpus/templates/plan/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
  130. package/corpus/templates/plan/changelog/2026-08-11-plan-sharing-now-identifies-viewers-who-can-add-comments.md +6 -0
  131. package/corpus/templates/plan/public/manifest.json +0 -1
  132. package/corpus/templates/slides/.agents/skills/sharing/SKILL.md +1 -1
  133. package/corpus/templates/slides/.agents/skills/turn-into-app/SKILL.md +24 -0
  134. package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +6 -0
  135. package/corpus/templates/slides/app/i18n/en-US.ts +2 -0
  136. package/corpus/templates/slides/app/root.tsx +0 -1
  137. package/corpus/templates/slides/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
  138. package/corpus/templates/slides/changelog/2026-08-11-share-dialog-uses-commenter-terminology.md +6 -0
  139. package/corpus/templates/slides/public/manifest.json +0 -1
  140. package/corpus/templates/tasks/.agents/skills/sharing/SKILL.md +1 -1
  141. package/corpus/templates/tasks/.agents/skills/turn-into-app/SKILL.md +24 -0
  142. package/corpus/templates/tasks/app/root.tsx +0 -1
  143. package/corpus/templates/tasks/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
  144. package/corpus/templates/tasks/public/manifest.json +0 -1
  145. package/dist/agent/production-agent.d.ts +8 -0
  146. package/dist/agent/production-agent.js +67 -22
  147. package/dist/agent/run-manager.d.ts +7 -0
  148. package/dist/agent/run-manager.js +46 -3
  149. package/dist/agent/tool-approval-migrations.d.ts +40 -0
  150. package/dist/agent/tool-approval-migrations.js +51 -0
  151. package/dist/agent/tool-approval-store.js +5 -20
  152. package/dist/cli/templates-meta.js +2 -2
  153. package/dist/client/AgentPanel.js +10 -1
  154. package/dist/client/AssistantChat.d.ts +3 -0
  155. package/dist/client/AssistantChat.js +151 -141
  156. package/dist/client/agent-page/AgentTabsPage.js +2 -2
  157. package/dist/client/chat/attachment-adapters.js +8 -2
  158. package/dist/client/chat/tool-call-display.d.ts +1 -0
  159. package/dist/client/chat/tool-call-display.js +3 -1
  160. package/dist/client/chat-first.js +11 -5
  161. package/dist/client/guided-questions.d.ts +15 -1
  162. package/dist/client/guided-questions.js +33 -15
  163. package/dist/client/hooks/index.d.ts +1 -1
  164. package/dist/client/hooks/index.js +1 -1
  165. package/dist/client/org/OrgSwitcher.d.ts +3 -1
  166. package/dist/client/org/OrgSwitcher.js +22 -16
  167. package/dist/client/org/WorkspaceNotice.js +3 -1
  168. package/dist/client/resources/index.d.ts +1 -1
  169. package/dist/client/resources/index.js +1 -1
  170. package/dist/client/resources/use-mcp-servers.d.ts +1 -0
  171. package/dist/client/resources/use-mcp-servers.js +14 -0
  172. package/dist/client/settings/AccountSettingsCard.js +8 -4
  173. package/dist/client/settings/SettingsPanel.js +46 -13
  174. package/dist/client/settings/SettingsTabsPage.js +8 -3
  175. package/dist/client/sharing/ShareButton.d.ts +7 -1
  176. package/dist/client/sharing/ShareButton.js +14 -7
  177. package/dist/client/sharing/ShareDialog.js +5 -1
  178. package/dist/client/sharing/useShareButtonController.d.ts +4 -0
  179. package/dist/client/sharing/useShareButtonController.js +15 -0
  180. package/dist/client/sharing/useShareDialogController.d.ts +7 -0
  181. package/dist/client/sharing/useShareDialogController.js +14 -0
  182. package/dist/client/sse-event-processor.js +37 -0
  183. package/dist/client/use-session.d.ts +2 -0
  184. package/dist/client/use-session.js +69 -5
  185. package/dist/deploy/build.js +1 -1
  186. package/dist/file-upload/pre-upload-attachments.d.ts +3 -4
  187. package/dist/file-upload/pre-upload-attachments.js +65 -17
  188. package/dist/ingestion/index.d.ts +1 -0
  189. package/dist/ingestion/index.js +1 -0
  190. package/dist/ingestion/office.d.ts +3 -3
  191. package/dist/ingestion/office.js +24 -2
  192. package/dist/ingestion/spreadsheet.d.ts +41 -0
  193. package/dist/ingestion/spreadsheet.js +172 -0
  194. package/dist/integrations/adapters/slack.js +7 -3
  195. package/dist/integrations/webhook-handler.js +11 -3
  196. package/dist/localization/default-messages.d.ts +3 -0
  197. package/dist/localization/default-messages.js +3 -0
  198. package/dist/mcp/embed-app.js +20 -9
  199. package/dist/notifications/routes.d.ts +3 -3
  200. package/dist/oauth-tokens/migrations.d.ts +8 -0
  201. package/dist/oauth-tokens/migrations.js +36 -0
  202. package/dist/observability/routes.d.ts +5 -5
  203. package/dist/org/workspace-url.d.ts +8 -0
  204. package/dist/org/workspace-url.js +26 -2
  205. package/dist/progress/routes.d.ts +1 -1
  206. package/dist/secrets/routes.d.ts +6 -6
  207. package/dist/server/agent-chat/context-tools.js +27 -6
  208. package/dist/server/agent-chat-plugin.js +16 -8
  209. package/dist/server/auth.d.ts +0 -11
  210. package/dist/server/auth.js +37 -20
  211. package/dist/server/better-auth-migrations.js +23 -0
  212. package/dist/server/email-template.d.ts +5 -0
  213. package/dist/server/email-template.js +9 -0
  214. package/dist/server/embed-route.js +17 -5
  215. package/dist/server/identity-sso-store.d.ts +40 -66
  216. package/dist/server/identity-sso-store.js +187 -150
  217. package/dist/server/identity-sso.d.ts +17 -73
  218. package/dist/server/identity-sso.js +294 -297
  219. package/dist/server/onboarding-html.d.ts +0 -12
  220. package/dist/server/onboarding-html.js +46 -269
  221. package/dist/server/realtime-token.d.ts +1 -1
  222. package/dist/server/release-migrations.js +8 -0
  223. package/dist/server/transcribe-voice.d.ts +1 -1
  224. package/dist/shared/index.d.ts +1 -1
  225. package/dist/shared/index.js +1 -1
  226. package/dist/shared/workspace-app-id.d.ts +2 -0
  227. package/dist/shared/workspace-app-id.js +10 -0
  228. package/dist/sharing/actions/share-resource.d.ts +1 -0
  229. package/dist/sharing/actions/share-resource.js +20 -5
  230. package/dist/templates/chat/.agents/skills/sharing/SKILL.md +1 -1
  231. package/dist/templates/chat/.agents/skills/turn-into-app/SKILL.md +24 -0
  232. package/dist/templates/chat/app/root.tsx +0 -1
  233. package/dist/templates/chat/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
  234. package/dist/templates/chat/public/manifest.json +0 -1
  235. package/dist/templates/default/.agents/skills/turn-into-app/SKILL.md +24 -0
  236. package/dist/templates/default/app/root.tsx +0 -1
  237. package/dist/templates/default/public/manifest.json +0 -1
  238. package/dist/templates/headless/.agents/skills/turn-into-app/SKILL.md +24 -0
  239. package/dist/templates/workspace-core/.agents/skills/authentication/SKILL.md +22 -11
  240. package/dist/templates/workspace-core/.agents/skills/sharing/SKILL.md +1 -1
  241. package/dist/templates/workspace-core/.agents/skills/turn-into-app/SKILL.md +24 -0
  242. package/docs/content/cross-app-sso.mdx +85 -27
  243. package/docs/content/template-mail.mdx +0 -6
  244. package/package.json +4 -3
  245. package/src/templates/chat/.agents/skills/sharing/SKILL.md +1 -1
  246. package/src/templates/chat/.agents/skills/turn-into-app/SKILL.md +24 -0
  247. package/src/templates/chat/app/root.tsx +0 -1
  248. package/src/templates/chat/changelog/2026-08-11-browser-no-longer-offers-desktop-install.md +6 -0
  249. package/src/templates/chat/public/manifest.json +0 -1
  250. package/src/templates/default/.agents/skills/turn-into-app/SKILL.md +24 -0
  251. package/src/templates/default/app/root.tsx +0 -1
  252. package/src/templates/default/public/manifest.json +0 -1
  253. package/src/templates/headless/.agents/skills/turn-into-app/SKILL.md +24 -0
  254. package/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +22 -11
  255. package/src/templates/workspace-core/.agents/skills/sharing/SKILL.md +1 -1
  256. package/src/templates/workspace-core/.agents/skills/turn-into-app/SKILL.md +24 -0
  257. package/corpus/templates/calendar/changelog/2026-06-23-added-a-heads-up-explaining-google-s-app-not-verified-screen.md +0 -6
  258. package/corpus/templates/clips/app/components/meetings/google-oauth-identity-notice.tsx +0 -51
  259. package/corpus/templates/clips/changelog/2026-07-30-google-calendar-warning.md +0 -6
@@ -23,7 +23,7 @@ import { CheckpointContext, MessageActionsContext, assistantMessageRunId, UserMe
23
23
  import { repoHasAssistantMessage, getRepoMessages, getRepoMessage, shouldImportServerThreadData, dedupeRepoMessagesById, dropEmptyAssistantMessages, withLastAssistantRunDuration, } from "./chat/repo-helpers.js";
24
24
  import { BuilderSetupCard, BuilderSetupContent, LoopLimitContinueCard, RunErrorRecoveryCard, PlanModeCallout, getLoopLimitMetadata, getRunErrorMetadata, getRequestModeMetadata, runErrorKey, } from "./chat/run-recovery.js";
25
25
  import { createAgentChatRuntimeAdapter, } from "./chat/runtime.js";
26
- import { ChatRunningContext, ChatRunningRunIdContext, ChatRunningTurnIdContext, ChatRunDurationContext, ApprovalContext, ReconnectStreamMessage, } from "./chat/tool-call-display.js";
26
+ import { ChatRunningContext, ChatRunningRunIdContext, ChatRunningTurnIdContext, ChatRunDurationContext, SuppressInlineOpenAppContext, ApprovalContext, ReconnectStreamMessage, } from "./chat/tool-call-display.js";
27
27
  import { useAgentChatLifecycleTracking } from "./chat/use-agent-chat-lifecycle-tracking.js";
28
28
  import { useReconnectReaderOwner } from "./chat/use-reconnect-reader-owner.js";
29
29
  import { MessageScroller, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, } from "./components/ui/message-scroller.js";
@@ -123,6 +123,7 @@ const RECONNECT_EMPTY_RETRY_MESSAGE = "The previous attempt disconnected before
123
123
  // through transient labels ("Contacting model", "Preparing X action"); past it
124
124
  // the live label appears so a genuinely slow step reads as working, not hung.
125
125
  const ACTIVITY_LABEL_REVEAL_DELAY_MS = 6_000;
126
+ const DEFAULT_ASSISTANT_CHAT_COMPOSER_PLACEHOLDER = "Write a message...";
126
127
  function isReplayableTerminalRun(runInfo) {
127
128
  const dispatchMode = typeof runInfo.dispatchMode === "string" ? runInfo.dispatchMode : "";
128
129
  return (runInfo.status !== "running" &&
@@ -1021,6 +1022,9 @@ export function resolveAssistantChatRunningStatusLabel({ runningActivityLabel, i
1021
1022
  return "Still working";
1022
1023
  return "Thinking";
1023
1024
  }
1025
+ export function resolveAssistantChatComposerPlaceholder(composerPlaceholder) {
1026
+ return composerPlaceholder ?? DEFAULT_ASSISTANT_CHAT_COMPOSER_PLACEHOLDER;
1027
+ }
1024
1028
  function contentHasVisibleTailReasoning(content) {
1025
1029
  if (!Array.isArray(content))
1026
1030
  return false;
@@ -1037,7 +1041,7 @@ function contentHasVisibleTailReasoning(content) {
1037
1041
  }
1038
1042
  return false;
1039
1043
  }
1040
- function contentHasToolCall(content, toolName) {
1044
+ function contentHasActiveToolCall(content, toolName) {
1041
1045
  if (!Array.isArray(content))
1042
1046
  return false;
1043
1047
  return content.some((part) => {
@@ -1045,6 +1049,7 @@ function contentHasToolCall(content, toolName) {
1045
1049
  return false;
1046
1050
  const candidate = part;
1047
1051
  return (candidate.type === "tool-call" &&
1052
+ candidate.result === undefined &&
1048
1053
  (!toolName || candidate.toolName === toolName));
1049
1054
  });
1050
1055
  }
@@ -1056,36 +1061,37 @@ export function shouldShowGlobalRunningStatus({ showRunningInUI, runningActivity
1056
1061
  : null;
1057
1062
  const latestMessageHasTailReasoning = message?.role === "assistant" &&
1058
1063
  contentHasVisibleTailReasoning(message.content);
1059
- const latestMessageHasTool = message?.role === "assistant" && contentHasToolCall(message.content);
1060
- const reconnectHasTool = contentHasToolCall(reconnectContent);
1064
+ const latestMessageHasActiveTool = message?.role === "assistant" && contentHasActiveToolCall(message.content);
1065
+ const reconnectHasActiveTool = contentHasActiveToolCall(reconnectContent);
1061
1066
  const reconnectHasTailReasoning = contentHasVisibleTailReasoning(reconnectContent);
1062
1067
  const matchingActivityToolIsVisible = Boolean(runningActivityTool &&
1063
1068
  ((message?.role === "assistant" &&
1064
- contentHasToolCall(message.content, runningActivityTool)) ||
1065
- contentHasToolCall(reconnectContent, runningActivityTool)));
1069
+ contentHasActiveToolCall(message.content, runningActivityTool)) ||
1070
+ contentHasActiveToolCall(reconnectContent, runningActivityTool)));
1066
1071
  // A pending card for the same tool is already the running indicator.
1067
1072
  // Rendering its global activity label as well shows the logical call twice
1068
1073
  // (for example, `generate design` plus `Writing generate design...`).
1069
1074
  if (runningActivityLabel && matchingActivityToolIsVisible) {
1070
1075
  return false;
1071
1076
  }
1072
- if (!runningActivityLabel && (latestMessageHasTool || reconnectHasTool)) {
1077
+ if (!runningActivityLabel &&
1078
+ (latestMessageHasActiveTool || reconnectHasActiveTool)) {
1073
1079
  return false;
1074
1080
  }
1075
1081
  // The reasoning cell already owns the generic Thinking state. Activity
1076
1082
  // events can briefly reassert that same label between reasoning deltas;
1077
1083
  // rendering both makes a second Thinking row flash beneath the thought.
1078
1084
  if (runningActivityLabel === "Thinking" &&
1079
- (latestMessageHasTool ||
1080
- reconnectHasTool ||
1085
+ (latestMessageHasActiveTool ||
1086
+ reconnectHasActiveTool ||
1081
1087
  latestMessageHasTailReasoning ||
1082
1088
  reconnectHasTailReasoning)) {
1083
1089
  return false;
1084
1090
  }
1085
1091
  if (runningActivityLabel)
1086
1092
  return true;
1087
- return (!latestMessageHasTool &&
1088
- !reconnectHasTool &&
1093
+ return (!latestMessageHasActiveTool &&
1094
+ !reconnectHasActiveTool &&
1089
1095
  !latestMessageHasTailReasoning &&
1090
1096
  !reconnectHasTailReasoning);
1091
1097
  }
@@ -1359,7 +1365,7 @@ export function useAutoResumeStatus(tabId, forceStopped) {
1359
1365
  function approvalResolutionIdentity(approvalKey, toolCallId) {
1360
1366
  return `${toolCallId ?? ""}\u0000${approvalKey}`;
1361
1367
  }
1362
- const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateText, suggestions, dynamicSuggestions, threadFooterSlot, emptyStateAddon, showHeader = true, onSwitchToCli, className, apiUrl, tabId, browserTabId, threadId, contextScope, isActiveComposer = true, onMessageCountChange, onSaveThread, onGenerateTitle, composerSlot, onComposerTextChange, composerAreaClassName, composerPlaceholder, missingApiKeySetupLayout = "default", composerLayoutVariant = "default", centerComposerWhenEmpty = false, emptyStateDisplay = "default", composerToolbarSlot, composerExtraActionButton, composerDisabled = false, composerDisabledPlaceholder, isNewThread, isThreadStateLoading, onSlashCommand, execMode, onExecModeChange, approvalActions, planModeDisabled, planModeDisabledReason, selectedModel, defaultModel, selectedEngine, selectedEffort, availableModels, modelListLoading, onModelChange, onEffortChange, imageModelMenu, onForkChat, onConnectProvider, onConnectLocalRuntime, plusMenuMode = "full", providerStatusChecksEnabled = true, loadHistoryRepository, historyReloadKey, externalStreaming = false, agentChatSurface = "app", }, ref) {
1368
+ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateText, suggestions, dynamicSuggestions, threadFooterSlot, emptyStateAddon, showHeader = true, onSwitchToCli, className, apiUrl, tabId, browserTabId, threadId, contextScope, isActiveComposer = true, onMessageCountChange, onSaveThread, onGenerateTitle, composerSlot, onComposerTextChange, composerAreaClassName, composerPlaceholder, missingApiKeySetupLayout = "default", composerLayoutVariant = "default", centerComposerWhenEmpty = false, emptyStateDisplay = "default", composerToolbarSlot, composerExtraActionButton, composerDisabled = false, composerDisabledPlaceholder, isNewThread, isThreadStateLoading, onSlashCommand, execMode, onExecModeChange, approvalActions, planModeDisabled, planModeDisabledReason, selectedModel, defaultModel, selectedEngine, selectedEffort, availableModels, modelListLoading, onModelChange, onEffortChange, imageModelMenu, onForkChat, onConnectProvider, onConnectLocalRuntime, plusMenuMode = "full", providerStatusChecksEnabled = true, loadHistoryRepository, historyReloadKey, externalStreaming = false, agentChatSurface = "app", suppressInlineOpenApp = false, }, ref) {
1363
1369
  const thread = useThread();
1364
1370
  const threadRuntime = useThreadRuntime();
1365
1371
  const composerRuntime = useComposerRuntime();
@@ -4077,11 +4083,13 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
4077
4083
  // GuidedQuestionPayload to application_state under "guided-questions". The
4078
4084
  // hook polls that key, and on submit/skip composes the answer as a normal
4079
4085
  // user turn (via the shared sendToAgentChat) and clears the persisted key so
4080
- // the question does not reappear.
4086
+ // the question does not reappear. The key is per browser tab, so `threadId`
4087
+ // is what keeps a pending question in the chat that asked it.
4081
4088
  const { questions: guidedQuestions, title: guidedQuestionsTitle, description: guidedQuestionsDescription, skipLabel: guidedQuestionsSkipLabel, submitLabel: guidedQuestionsSubmitLabel, handleSubmit: handleGuidedQuestionsSubmit, handleSkip: handleGuidedQuestionsSkip, } = useGuidedQuestionFlow({
4082
4089
  stateKey: "guided-questions",
4083
4090
  queryKey: ["guided-questions"],
4084
4091
  ...(browserTabId ? { browserTabId } : {}),
4092
+ ...(threadId ? { threadId } : {}),
4085
4093
  });
4086
4094
  const hasComposerAccessoryAboveStack = Boolean(composerError ||
4087
4095
  showComposerSlot ||
@@ -4133,141 +4141,143 @@ const AssistantChatInner = forwardRef(function AssistantChatInner({ emptyStateTe
4133
4141
  approvalActions,
4134
4142
  recordApprovalResolution,
4135
4143
  ]);
4136
- return (_jsx(CheckpointContext.Provider, { value: checkpointCtx, children: _jsx(MessageActionsContext.Provider, { value: messageActionsCtx, children: _jsx(ApprovalContext.Provider, { value: approvalCtx, children: _jsx(ChatRunDurationContext.Provider, { value: lastChatRunDurationMs, children: _jsx(ServerRunActiveContext.Provider, { value: serverRunActive, children: _jsx(ChatRunningRunIdContext.Provider, { value: activeChatRunId, children: _jsx(ChatRunningTurnIdContext.Provider, { value: activeChatTurnId, children: _jsx(ChatRunningContext.Provider
4137
- // Keep the current message in a non-complete state while
4138
- // the terminal error card is visible, even if the server
4139
- // still reports the prior run for a short time while its
4140
- // claim is released. Historical messages use turn
4141
- // ownership below.
4142
- , {
4144
+ return (_jsx(SuppressInlineOpenAppContext.Provider, { value: suppressInlineOpenApp, children: _jsx(CheckpointContext.Provider, { value: checkpointCtx, children: _jsx(MessageActionsContext.Provider, { value: messageActionsCtx, children: _jsx(ApprovalContext.Provider, { value: approvalCtx, children: _jsx(ChatRunDurationContext.Provider, { value: lastChatRunDurationMs, children: _jsx(ServerRunActiveContext.Provider, { value: serverRunActive, children: _jsx(ChatRunningRunIdContext.Provider, { value: activeChatRunId, children: _jsx(ChatRunningTurnIdContext.Provider, { value: activeChatTurnId, children: _jsx(ChatRunningContext.Provider
4143
4145
  // Keep the current message in a non-complete state while
4144
4146
  // the terminal error card is visible, even if the server
4145
4147
  // still reports the prior run for a short time while its
4146
4148
  // claim is released. Historical messages use turn
4147
4149
  // ownership below.
4148
- value: showRunningInUI || runErrorInfo !== null, children: _jsx(TextStreamingContext.Provider, { value: textStreaming, children: _jsxs("div", { "data-agent-empty-state": centeredEmptyState
4149
- ? "centered"
4150
- : compactMissingKeyEmptyState
4151
- ? "compact-setup"
4152
- : undefined, className: cn("relative flex flex-1 flex-col h-full min-h-0 text-foreground", className), onDragEnter: handleChatDragEnter, onDragOver: handleChatDragOver, onDragLeave: handleChatDragLeave, onDropCapture: handleChatDropCapture, onDrop: handleChatDrop, children: [dropActive && (_jsx("div", { "aria-hidden": "true", className: "pointer-events-none absolute inset-0 z-50 flex items-center justify-center rounded-md border-2 border-dashed border-primary/70 bg-primary/5 backdrop-blur-[1px]", children: _jsx("span", { className: "rounded-md bg-background/90 px-3 py-1.5 text-xs font-medium text-foreground shadow-sm", children: "Drop to attach" }) })), showHeader && (_jsxs("div", { className: "flex h-11 shrink-0 items-center justify-between border-b border-border px-4", children: [_jsx("span", { className: "text-[13px] font-medium text-muted-foreground", children: "Agent" }), _jsx("div", { className: "flex items-center gap-1", children: onSwitchToCli && (_jsx(TooltipProvider, { delayDuration: 200, children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs("button", { onClick: onSwitchToCli, "aria-label": "Switch to CLI", className: "flex items-center gap-1 text-[12px] text-muted-foreground hover:text-foreground px-2 py-1 rounded-md hover:bg-accent", children: [_jsx(IconTerminal, { className: "h-3.5 w-3.5" }), "CLI"] }) }), _jsx(TooltipContent, { children: "Switch to CLI" })] }) })) })] })), _jsx(MessageScrollerProvider, { autoScroll: false, children: _jsxs(MessageScroller, { className: "agent-chat-scroll", children: [_jsx(MessageScrollerViewport, { ref: scrollRef, children: authError ? (_jsxs("div", { className: "flex flex-col items-center justify-center h-full px-4 gap-3", children: [_jsx("div", { className: "flex h-10 w-10 items-center justify-center rounded-full bg-muted", children: authSessionAvailable ? (_jsx(IconRefresh, { className: "h-5 w-5 text-muted-foreground" })) : (_jsx(IconMessage, { className: "h-5 w-5 text-muted-foreground" })) }), _jsxs("div", { className: "text-center max-w-[280px]", children: [_jsx("p", { className: "text-sm font-medium text-foreground mb-1", children: authSessionAvailable
4153
- ? "Chat session needs refresh"
4154
- : authError.sessionExpired
4155
- ? "Session expired"
4156
- : "Authentication required" }), _jsx("p", { className: "text-xs text-muted-foreground leading-relaxed", children: authSessionAvailable
4157
- ? "You're signed in, but this chat connection needs to reconnect."
4158
- : authError.sessionExpired
4159
- ? "Your session may have expired. Log out and log back in to reconnect."
4160
- : "You need to log in to use the agent." })] }), _jsxs("div", { className: "flex gap-2", children: [!authError.sessionExpired &&
4161
- !authSessionAvailable && (_jsx("button", { onClick: () => {
4162
- window.location.href =
4163
- buildSignInReturnHref();
4164
- }, className: "text-xs text-background bg-foreground hover:opacity-90 px-3 py-1.5 rounded-md", children: "Log in" })), authError.sessionExpired &&
4165
- !authSessionAvailable && (_jsx("button", { onClick: async () => {
4166
- try {
4167
- await fetch(agentNativePath("/_agent-native/auth/logout"), {
4168
- method: "POST",
4169
- });
4150
+ , {
4151
+ // Keep the current message in a non-complete state while
4152
+ // the terminal error card is visible, even if the server
4153
+ // still reports the prior run for a short time while its
4154
+ // claim is released. Historical messages use turn
4155
+ // ownership below.
4156
+ value: showRunningInUI || runErrorInfo !== null, children: _jsx(TextStreamingContext.Provider, { value: textStreaming, children: _jsxs("div", { "data-agent-empty-state": centeredEmptyState
4157
+ ? "centered"
4158
+ : compactMissingKeyEmptyState
4159
+ ? "compact-setup"
4160
+ : undefined, className: cn("relative flex flex-1 flex-col h-full min-h-0 text-foreground", className), onDragEnter: handleChatDragEnter, onDragOver: handleChatDragOver, onDragLeave: handleChatDragLeave, onDropCapture: handleChatDropCapture, onDrop: handleChatDrop, children: [dropActive && (_jsx("div", { "aria-hidden": "true", className: "pointer-events-none absolute inset-0 z-50 flex items-center justify-center rounded-md border-2 border-dashed border-primary/70 bg-primary/5 backdrop-blur-[1px]", children: _jsx("span", { className: "rounded-md bg-background/90 px-3 py-1.5 text-xs font-medium text-foreground shadow-sm", children: "Drop to attach" }) })), showHeader && (_jsxs("div", { className: "flex h-11 shrink-0 items-center justify-between border-b border-border px-4", children: [_jsx("span", { className: "text-[13px] font-medium text-muted-foreground", children: "Agent" }), _jsx("div", { className: "flex items-center gap-1", children: onSwitchToCli && (_jsx(TooltipProvider, { delayDuration: 200, children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs("button", { onClick: onSwitchToCli, "aria-label": "Switch to CLI", className: "flex items-center gap-1 text-[12px] text-muted-foreground hover:text-foreground px-2 py-1 rounded-md hover:bg-accent", children: [_jsx(IconTerminal, { className: "h-3.5 w-3.5" }), "CLI"] }) }), _jsx(TooltipContent, { children: "Switch to CLI" })] }) })) })] })), _jsx(MessageScrollerProvider, { autoScroll: false, children: _jsxs(MessageScroller, { className: "agent-chat-scroll", children: [_jsx(MessageScrollerViewport, { ref: scrollRef, children: authError ? (_jsxs("div", { className: "flex flex-col items-center justify-center h-full px-4 gap-3", children: [_jsx("div", { className: "flex h-10 w-10 items-center justify-center rounded-full bg-muted", children: authSessionAvailable ? (_jsx(IconRefresh, { className: "h-5 w-5 text-muted-foreground" })) : (_jsx(IconMessage, { className: "h-5 w-5 text-muted-foreground" })) }), _jsxs("div", { className: "text-center max-w-[280px]", children: [_jsx("p", { className: "text-sm font-medium text-foreground mb-1", children: authSessionAvailable
4161
+ ? "Chat session needs refresh"
4162
+ : authError.sessionExpired
4163
+ ? "Session expired"
4164
+ : "Authentication required" }), _jsx("p", { className: "text-xs text-muted-foreground leading-relaxed", children: authSessionAvailable
4165
+ ? "You're signed in, but this chat connection needs to reconnect."
4166
+ : authError.sessionExpired
4167
+ ? "Your session may have expired. Log out and log back in to reconnect."
4168
+ : "You need to log in to use the agent." })] }), _jsxs("div", { className: "flex gap-2", children: [!authError.sessionExpired &&
4169
+ !authSessionAvailable && (_jsx("button", { onClick: () => {
4170
+ window.location.href =
4171
+ buildSignInReturnHref();
4172
+ }, className: "text-xs text-background bg-foreground hover:opacity-90 px-3 py-1.5 rounded-md", children: "Log in" })), authError.sessionExpired &&
4173
+ !authSessionAvailable && (_jsx("button", { onClick: async () => {
4174
+ try {
4175
+ await fetch(agentNativePath("/_agent-native/auth/logout"), {
4176
+ method: "POST",
4177
+ });
4178
+ }
4179
+ catch (error) {
4180
+ console.error("Failed to log out before reloading the chat", error);
4181
+ }
4182
+ window.location.reload();
4183
+ }, className: "text-xs text-destructive hover:text-destructive/80 px-3 py-1.5 rounded-md border border-destructive/30 hover:bg-destructive/10", children: "Log out" })), _jsx("button", { onClick: () => {
4184
+ setAuthError(null);
4185
+ window.location.reload();
4186
+ }, className: authSessionAvailable
4187
+ ? "text-xs text-background bg-foreground hover:opacity-90 px-3 py-1.5 rounded-md"
4188
+ : "text-xs text-muted-foreground hover:text-foreground px-3 py-1.5 rounded-md border border-border hover:bg-accent", children: "Refresh chat" })] })] })) : isRestoring && centeredRestoringState ? (_jsxs("div", { className: cn("agent-empty-state", emptyStateDisplay === "hidden"
4189
+ ? "sr-only"
4190
+ : "flex h-full flex-col items-center justify-center gap-3 px-4 py-16"), "aria-busy": "true", children: [_jsx(IconMessage, { className: "h-5 w-5 text-muted-foreground/60" }), _jsx("p", { className: "sr-only", children: emptyStateText ?? "Loading chat..." })] })) : isRestoring ? (_jsxs("div", { className: "flex flex-col gap-3 p-4", children: [_jsx("div", { className: "flex justify-end", children: _jsx("div", { className: "h-8 w-32 rounded-lg bg-muted animate-pulse" }) }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx("div", { className: "h-4 w-48 rounded bg-muted animate-pulse" }), _jsx("div", { className: "h-4 w-64 rounded bg-muted animate-pulse" }), _jsx("div", { className: "h-4 w-40 rounded bg-muted animate-pulse" })] })] })) : showEmptyState ? (_jsxs("div", { className: cn("agent-empty-state", emptyStateDisplay === "hidden"
4191
+ ? "sr-only"
4192
+ : "flex h-full flex-col items-center justify-center gap-3 px-4 py-16"), children: [_jsx(IconMessage, { className: "h-5 w-5 text-muted-foreground/60" }), _jsx("p", { className: "sr-only", children: emptyStateText ?? "How can I help you?" }), emptyStateAddon, resolvedSuggestions &&
4193
+ resolvedSuggestions.length > 0 ? (_jsx("div", { className: "flex w-full max-w-[280px] flex-col gap-1", children: resolvedSuggestions.map((suggestion) => (_jsx("button", { onClick: () => {
4194
+ if (engineSetupRequired) {
4195
+ requestMissingKeySetup();
4196
+ return;
4170
4197
  }
4171
- catch (error) {
4172
- console.error("Failed to log out before reloading the chat", error);
4198
+ void addToQueue(suggestion);
4199
+ }, className: "w-full px-2 py-1 text-center text-[13px] text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", children: suggestion }, suggestion))) })) : null, showInlineEmptyThreadFooterSlot ? (_jsx("div", { className: "agent-thread-footer-slot agent-thread-footer-slot--empty", children: resolvedThreadFooterSlot })) : null] })) : (_jsxs(MessageScrollerContent, { className: "agent-thread-content gap-4 px-4 py-4", children: [_jsx(AssistantMessageListErrorBoundary, { resetKey: messageListResetKey, children: _jsx(UserStoppedRunContext.Provider, { value: wasRecentlyStoppedRun, children: _jsx(ThreadPrimitive.Messages
4200
+ // assistant-ui indexes message parts through tap resources.
4201
+ // Keep this key tied to that shape so clear/add transitions remount stale
4202
+ // lookups without remounting on every streamed text update.
4203
+ , { components: {
4204
+ UserMessage: AssistantChatUserMessageItem,
4205
+ AssistantMessage: AssistantChatAssistantMessageItem,
4206
+ } }, messageListResetKey) }) }), visibleLoopLimit && !showRunningInUI && (_jsx(MessageScrollerItem, { children: _jsx(LoopLimitContinueCard, { info: visibleLoopLimit, onContinue: () => {
4207
+ setShowContinue(false);
4208
+ setLoopLimitInfo(null);
4209
+ addToQueue("Continue from where you left off.", undefined, undefined, undefined, undefined, "queued", "continue");
4210
+ } }) })), shouldShowRunError && visibleRunError && (_jsx(MessageScrollerItem, { children: _jsx(RunErrorRecoveryCard, { info: visibleRunError, onContinue: () => {
4211
+ setRunErrorInfo(null);
4212
+ addToQueue(RECONNECT_NO_PROGRESS_CONTINUE_MESSAGE, undefined, undefined, undefined, undefined, "queued", "continue");
4213
+ }, onRetry: retryAfterRunError, onFork: onForkChat, onProviderConnected: handleBuilderConnected, onDismiss: () => {
4214
+ if (visibleRunErrorKey) {
4215
+ setDismissedRunErrorKey(visibleRunErrorKey);
4173
4216
  }
4174
- window.location.reload();
4175
- }, className: "text-xs text-destructive hover:text-destructive/80 px-3 py-1.5 rounded-md border border-destructive/30 hover:bg-destructive/10", children: "Log out" })), _jsx("button", { onClick: () => {
4176
- setAuthError(null);
4177
- window.location.reload();
4178
- }, className: authSessionAvailable
4179
- ? "text-xs text-background bg-foreground hover:opacity-90 px-3 py-1.5 rounded-md"
4180
- : "text-xs text-muted-foreground hover:text-foreground px-3 py-1.5 rounded-md border border-border hover:bg-accent", children: "Refresh chat" })] })] })) : isRestoring && centeredRestoringState ? (_jsxs("div", { className: cn("agent-empty-state", emptyStateDisplay === "hidden"
4181
- ? "sr-only"
4182
- : "flex h-full flex-col items-center justify-center gap-3 px-4 py-16"), "aria-busy": "true", children: [_jsx(IconMessage, { className: "h-5 w-5 text-muted-foreground/60" }), _jsx("p", { className: "sr-only", children: emptyStateText ?? "Loading chat..." })] })) : isRestoring ? (_jsxs("div", { className: "flex flex-col gap-3 p-4", children: [_jsx("div", { className: "flex justify-end", children: _jsx("div", { className: "h-8 w-32 rounded-lg bg-muted animate-pulse" }) }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx("div", { className: "h-4 w-48 rounded bg-muted animate-pulse" }), _jsx("div", { className: "h-4 w-64 rounded bg-muted animate-pulse" }), _jsx("div", { className: "h-4 w-40 rounded bg-muted animate-pulse" })] })] })) : showEmptyState ? (_jsxs("div", { className: cn("agent-empty-state", emptyStateDisplay === "hidden"
4183
- ? "sr-only"
4184
- : "flex h-full flex-col items-center justify-center gap-3 px-4 py-16"), children: [_jsx(IconMessage, { className: "h-5 w-5 text-muted-foreground/60" }), _jsx("p", { className: "sr-only", children: emptyStateText ?? "How can I help you?" }), emptyStateAddon, resolvedSuggestions &&
4185
- resolvedSuggestions.length > 0 ? (_jsx("div", { className: "flex w-full max-w-[280px] flex-col gap-1", children: resolvedSuggestions.map((suggestion) => (_jsx("button", { onClick: () => {
4186
- if (engineSetupRequired) {
4187
- requestMissingKeySetup();
4188
- return;
4189
- }
4190
- void addToQueue(suggestion);
4191
- }, className: "w-full px-2 py-1 text-center text-[13px] text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", children: suggestion }, suggestion))) })) : null, showInlineEmptyThreadFooterSlot ? (_jsx("div", { className: "agent-thread-footer-slot agent-thread-footer-slot--empty", children: resolvedThreadFooterSlot })) : null] })) : (_jsxs(MessageScrollerContent, { className: "agent-thread-content gap-4 px-4 py-4", children: [_jsx(AssistantMessageListErrorBoundary, { resetKey: messageListResetKey, children: _jsx(UserStoppedRunContext.Provider, { value: wasRecentlyStoppedRun, children: _jsx(ThreadPrimitive.Messages
4192
- // assistant-ui indexes message parts through tap resources.
4193
- // Keep this key tied to that shape so clear/add transitions remount stale
4194
- // lookups without remounting on every streamed text update.
4195
- , { components: {
4196
- UserMessage: AssistantChatUserMessageItem,
4197
- AssistantMessage: AssistantChatAssistantMessageItem,
4198
- } }, messageListResetKey) }) }), visibleLoopLimit && !showRunningInUI && (_jsx(MessageScrollerItem, { children: _jsx(LoopLimitContinueCard, { info: visibleLoopLimit, onContinue: () => {
4199
- setShowContinue(false);
4200
- setLoopLimitInfo(null);
4201
- addToQueue("Continue from where you left off.", undefined, undefined, undefined, undefined, "queued", "continue");
4202
- } }) })), shouldShowRunError && visibleRunError && (_jsx(MessageScrollerItem, { children: _jsx(RunErrorRecoveryCard, { info: visibleRunError, onContinue: () => {
4203
- setRunErrorInfo(null);
4204
- addToQueue(RECONNECT_NO_PROGRESS_CONTINUE_MESSAGE, undefined, undefined, undefined, undefined, "queued", "continue");
4205
- }, onRetry: retryAfterRunError, onFork: onForkChat, onProviderConnected: handleBuilderConnected, onDismiss: () => {
4206
- if (visibleRunErrorKey) {
4207
- setDismissedRunErrorKey(visibleRunErrorKey);
4208
- }
4209
- setRunErrorInfo(null);
4210
- } }) })), (isReconnecting ||
4211
- reconnectFrozen ||
4212
- adapterHandoffPending) &&
4213
- visibleReconnectContent.length > 0 && (_jsx(MessageScrollerItem, { children: _jsx(ReconnectStreamMessage, { content: visibleReconnectContent, allowActivitySpinner: !reconnectFrozen }) })), (isReconnecting ||
4214
- reconnectFrozen ||
4215
- adapterHandoffPending) &&
4216
- visibleReconnectContent.length === 0 &&
4217
- reconnectContent.length === 0 &&
4218
- reconnectActivityContent.length > 0 && (_jsx(MessageScrollerItem, { children: _jsx(ReconnectStreamMessage, { content: reconnectActivityContent, allowActivitySpinner: !reconnectFrozen }) })), showGlobalRunningStatus && (_jsx(MessageScrollerItem, { children: _jsx(RunningActivityStatus, { label: runningStatusLabel }) })), visibleQueuedMessages.length > 0 && (_jsx(MessageScrollerItem, { children: _jsxs("div", { className: "flex items-center justify-end gap-1.5 pr-0.5 text-xs text-muted-foreground", children: [_jsx(IconClock, { className: "h-3 w-3" }), _jsxs("span", { children: [visibleQueuedMessages.length, " queued"] })] }) })), visibleQueuedMessages.map((msg) => {
4219
- const displayText = displayableUserMessageText(msg.text);
4220
- const imageSources = queuedMessageImageSources(msg);
4221
- return (_jsx(MessageScrollerItem, { messageId: msg.id, children: _jsxs("div", { className: "group flex items-start justify-end gap-1.5", children: [isRunning && (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { type: "button", onClick: () => sendQueuedMessageNow(msg.id), "aria-label": "Send now", className: "mt-1.5 flex h-5 w-5 cursor-pointer items-center justify-center rounded-full border border-border bg-background text-muted-foreground opacity-0 shadow-sm transition-opacity hover:bg-accent hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100", children: _jsx(IconArrowUp, { className: "h-3 w-3" }) }) }), _jsx(TooltipContent, { children: "Send now (stops the current response)" })] })), _jsx("button", { type: "button", onClick: () => applyLocalQueuedMessages((prev) => prev.filter((m) => m.id !== msg.id)), "aria-label": "Remove from queue", className: "mt-1.5 flex h-5 w-5 cursor-pointer items-center justify-center rounded-full border border-border bg-background text-muted-foreground opacity-0 shadow-sm transition-opacity hover:bg-accent hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100", children: _jsx(IconX, { className: "h-3 w-3" }) }), _jsxs("div", { className: "max-w-[85%] rounded-lg bg-accent/50 px-3 py-2 text-sm leading-relaxed text-foreground/60 whitespace-pre-wrap break-words", children: [displayText, imageSources.length > 0 && (_jsx("div", { className: "flex flex-wrap gap-1.5 mt-1.5", children: imageSources.map((img, j) => (_jsx("img", { src: img, alt: "", className: "h-12 w-12 rounded object-cover border border-border/50" }, j))) }))] })] }) }, msg.id));
4222
- }), resolvedThreadFooterSlot ? (_jsx(MessageScrollerItem, { children: _jsx("div", { className: "agent-thread-footer-slot", children: resolvedThreadFooterSlot }) })) : null] })) }), !authError &&
4223
- !isRestoring &&
4224
- !showEmptyState &&
4225
- showScrollToBottom ? (_jsx("div", { className: "shrink-0 flex justify-center -mb-1", children: _jsx("button", { type: "button", onClick: scrollToBottom, className: "flex h-7 w-7 items-center justify-center rounded-full border border-border bg-background shadow-sm hover:bg-accent", "aria-label": "Scroll to bottom", children: _jsx(IconChevronDown, { className: "h-3.5 w-3.5 text-muted-foreground" }) }) })) : null] }) }, chatScrollResetKey), showComposerSlot ? composerSlot : null, isActiveComposer && (_jsx(McpConnectionSuggestion, { text: composerText })), showCenteredEmptyThreadFooterSlot ? (_jsx("div", { className: "agent-thread-footer-slot agent-thread-footer-slot--centered-empty", children: resolvedThreadFooterSlot })) : null, guidedQuestions && guidedQuestions.length > 0 && (_jsx("div", { className: "shrink-0 px-3 pb-2", children: _jsx(GuidedQuestionFlow, { questions: guidedQuestions, onSubmit: handleGuidedQuestionsSubmit, onSkip: handleGuidedQuestionsSkip, ...(guidedQuestionsTitle
4226
- ? { title: guidedQuestionsTitle }
4227
- : {}), ...(guidedQuestionsDescription
4228
- ? { description: guidedQuestionsDescription }
4229
- : {}), ...(guidedQuestionsSkipLabel
4230
- ? { skipLabel: guidedQuestionsSkipLabel }
4231
- : {}), ...(guidedQuestionsSubmitLabel
4232
- ? { submitLabel: guidedQuestionsSubmitLabel }
4233
- : {}), className: "h-auto items-stretch justify-stretch bg-transparent" }) })), composerError && (_jsxs("div", { role: "alert", className: "shrink-0 mx-3 mb-1.5 flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive", children: [_jsx(IconAlertTriangle, { className: "h-3.5 w-3.5 mt-0.5 shrink-0" }), _jsx("span", { className: "flex-1 leading-snug", children: composerError }), _jsx("button", { type: "button", "aria-label": "Dismiss error", onClick: () => setComposerError(null), className: "shrink-0 opacity-70 hover:opacity-100", children: _jsx(IconX, { className: "h-3 w-3" }) })] })), _jsxs("div", { className: "agent-composer-stack", "data-agent-composer-adjacent-ui": hasComposerAccessoryAboveStack ? "true" : undefined, children: [_jsx(SelectionAttachedPill, {}), showPlanModeCallout && (_jsx(PlanModeCallout, { canImplementPlan: canImplementPlan, onImplementPlan: handleImplementPlan, onSwitchToAct: handleSwitchToAct })), showInlineMissingKeySetup ? (_jsx(BuilderSetupCard, { fullWidth: true, layout: "sidebar", onConnected: handleBuilderConnected })) : null, _jsxs(Popover, { open: showMissingKeySetup &&
4234
- !showInlineMissingKeySetup &&
4235
- missingKeySetupOpen, onOpenChange: setMissingKeySetupOpen, children: [_jsx(AgentComposerFrame, { layoutVariant: composerLayoutVariant, className: cn(composerAreaClassName, isComposerDisabled &&
4236
- !showMissingKeySetup &&
4237
- "opacity-70"), rootClassName: cn(showMissingKeySetup &&
4238
- "agent-composer-root--missing-key"), children: showMissingKeySetup &&
4239
- !showInlineMissingKeySetup ? (_jsx(PopoverTrigger, { asChild: true, children: _jsx("button", { type: "button", className: "agent-composer-missing-key-trigger", "aria-label": "Connect AI to start chatting", children: _jsxs("span", { className: "agent-composer-missing-key-content", children: [_jsxs("span", { className: "agent-composer-missing-key-copy", children: [_jsx("span", { className: "agent-composer-missing-key-title", children: missingApiKeySetupLayout ===
4240
- "sidebar"
4241
- ? "Connect AI to chat"
4242
- : "Connect AI to start chatting" }), missingApiKeySetupLayout !==
4243
- "sidebar" ? (_jsx("span", { className: "agent-composer-missing-key-description", children: "Builder.io includes free credits, or use your own API key." })) : null] }), _jsx("span", { className: "agent-composer-missing-key-cta", children: "Connect AI" })] }) }) })) : (_jsxs(_Fragment, { children: [_jsx(ComposerAttachmentPreviewStrip, {}), _jsx(TiptapComposer, { focusRef: tiptapRef, onTextChange: isActiveComposer
4244
- ? handleComposerTextChange
4245
- : undefined, disabled: isComposerDisabled ||
4246
- showInlineMissingKeySetup, placeholder: showInlineMissingKeySetup
4247
- ? "Connect AI above to start chatting..."
4248
- : engineSetupRequired
4249
- ? "Connect AI to start chatting..."
4250
- : composerDisabled
4251
- ? (composerDisabledPlaceholder ??
4252
- "Open Desktop to use this chat.")
4253
- : isRunning
4254
- ? queuedMessages.length > 0
4255
- ? `${queuedMessages.length} queued — send a follow-up...`
4256
- : "Send a follow-up..."
4257
- : composerPlaceholder, onSubmit: isRunning ||
4258
- composerContextItems.length > 0
4259
- ? (text, references, attachments, options) => void addToQueue(text, undefined, references.length > 0
4260
- ? references
4261
- : undefined, attachments, undefined, resolveAssistantChatSubmitIntent({
4262
- isRunning,
4263
- requestedIntent: options?.intent,
4264
- }), undefined, true)
4265
- : undefined, willQueue: engineSetupRequired || isRunning, onSlashCommand: onSlashCommand, execMode: execMode, onExecModeChange: onExecModeChange, planModeDisabled: planModeDisabled, planModeDisabledReason: planModeDisabledReason, selectedModel: selectedModel ?? defaultModel, selectedEffort: selectedEffort, availableModels: availableModels, modelListLoading: modelListLoading, onModelChange: onModelChange, onEffortChange: onEffortChange, imageModelMenu: imageModelMenu, onConnectProvider: onConnectProvider, onConnectLocalRuntime: onConnectLocalRuntime, toolbarSlot: composerToolbarSlot, contextItems: composerContextItems, onRemoveContextItem: removeComposerContextItem, plusMenuMode: plusMenuMode, layoutVariant: composerLayoutVariant, providerConnectStatusEnabled: providerStatusChecksEnabled, voiceEnabled: true, draftScope: threadId || tabId, interceptBuildRequestsForBuilder: true, onAttachmentError: setComposerError, extraActionButton: composerExtraActionButton, stopButton: showRunningInUI ? (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { type: "button", onClick: () => stopActiveRun({
4266
- preserveQueuedMessages: true,
4267
- }), "aria-label": "Stop response", "data-agent-composer-slot": "stop-button", className: "shrink-0 flex h-7 w-7 cursor-pointer items-center justify-center rounded-full bg-primary text-primary-foreground shadow-sm transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", children: _jsx(IconPlayerStopFilled, { className: "h-3 w-3" }) }) }), _jsx(TooltipContent, { children: "Stop response" })] })) : undefined })] })) }), showMissingKeySetup &&
4268
- !showInlineMissingKeySetup ? (_jsx(PopoverContent, { side: missingApiKeySetupLayout === "sidebar"
4269
- ? "top"
4270
- : "bottom", align: "center", sideOffset: 8, collisionPadding: 12, "data-agent-native-composer-popover": "true", className: "z-[260] box-border w-[min(calc(100vw-2rem),var(--radix-popover-content-available-width,26rem),26rem)] rounded-lg border-border p-3 shadow-lg", children: _jsx(BuilderSetupContent, { onConnected: handleBuilderConnected, layout: missingApiKeySetupLayout }) })) : null] })] })] }) }) }) }) }) }) }) }) }) }));
4217
+ setRunErrorInfo(null);
4218
+ } }) })), (isReconnecting ||
4219
+ reconnectFrozen ||
4220
+ adapterHandoffPending) &&
4221
+ visibleReconnectContent.length > 0 && (_jsx(MessageScrollerItem, { children: _jsx(ReconnectStreamMessage, { content: visibleReconnectContent, allowActivitySpinner: !reconnectFrozen }) })), (isReconnecting ||
4222
+ reconnectFrozen ||
4223
+ adapterHandoffPending) &&
4224
+ visibleReconnectContent.length === 0 &&
4225
+ reconnectContent.length === 0 &&
4226
+ reconnectActivityContent.length > 0 && (_jsx(MessageScrollerItem, { children: _jsx(ReconnectStreamMessage, { content: reconnectActivityContent, allowActivitySpinner: !reconnectFrozen }) })), showGlobalRunningStatus && (_jsx(MessageScrollerItem, { children: _jsx(RunningActivityStatus, { label: runningStatusLabel }) })), visibleQueuedMessages.length > 0 && (_jsx(MessageScrollerItem, { children: _jsxs("div", { className: "flex items-center justify-end gap-1.5 pr-0.5 text-xs text-muted-foreground", children: [_jsx(IconClock, { className: "h-3 w-3" }), _jsxs("span", { children: [visibleQueuedMessages.length, " ", "queued"] })] }) })), visibleQueuedMessages.map((msg) => {
4227
+ const displayText = displayableUserMessageText(msg.text);
4228
+ const imageSources = queuedMessageImageSources(msg);
4229
+ return (_jsx(MessageScrollerItem, { messageId: msg.id, children: _jsxs("div", { className: "group flex items-start justify-end gap-1.5", children: [isRunning && (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { type: "button", onClick: () => sendQueuedMessageNow(msg.id), "aria-label": "Send now", className: "mt-1.5 flex h-5 w-5 cursor-pointer items-center justify-center rounded-full border border-border bg-background text-muted-foreground opacity-0 shadow-sm transition-opacity hover:bg-accent hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100", children: _jsx(IconArrowUp, { className: "h-3 w-3" }) }) }), _jsx(TooltipContent, { children: "Send now (stops the current response)" })] })), _jsx("button", { type: "button", onClick: () => applyLocalQueuedMessages((prev) => prev.filter((m) => m.id !== msg.id)), "aria-label": "Remove from queue", className: "mt-1.5 flex h-5 w-5 cursor-pointer items-center justify-center rounded-full border border-border bg-background text-muted-foreground opacity-0 shadow-sm transition-opacity hover:bg-accent hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100", children: _jsx(IconX, { className: "h-3 w-3" }) }), _jsxs("div", { className: "max-w-[85%] rounded-lg bg-accent/50 px-3 py-2 text-sm leading-relaxed text-foreground/60 whitespace-pre-wrap break-words", children: [displayText, imageSources.length > 0 && (_jsx("div", { className: "flex flex-wrap gap-1.5 mt-1.5", children: imageSources.map((img, j) => (_jsx("img", { src: img, alt: "", className: "h-12 w-12 rounded object-cover border border-border/50" }, j))) }))] })] }) }, msg.id));
4230
+ }), resolvedThreadFooterSlot ? (_jsx(MessageScrollerItem, { children: _jsx("div", { className: "agent-thread-footer-slot", children: resolvedThreadFooterSlot }) })) : null] })) }), !authError &&
4231
+ !isRestoring &&
4232
+ !showEmptyState &&
4233
+ showScrollToBottom ? (_jsx("div", { className: "shrink-0 flex justify-center -mb-1", children: _jsx("button", { type: "button", onClick: scrollToBottom, className: "flex h-7 w-7 items-center justify-center rounded-full border border-border bg-background shadow-sm hover:bg-accent", "aria-label": "Scroll to bottom", children: _jsx(IconChevronDown, { className: "h-3.5 w-3.5 text-muted-foreground" }) }) })) : null] }) }, chatScrollResetKey), showComposerSlot ? composerSlot : null, isActiveComposer && (_jsx(McpConnectionSuggestion, { text: composerText })), showCenteredEmptyThreadFooterSlot ? (_jsx("div", { className: "agent-thread-footer-slot agent-thread-footer-slot--centered-empty", children: resolvedThreadFooterSlot })) : null, guidedQuestions && guidedQuestions.length > 0 && (_jsx("div", { className: "shrink-0 px-3 pb-2", children: _jsx(GuidedQuestionFlow, { questions: guidedQuestions, onSubmit: handleGuidedQuestionsSubmit, onSkip: handleGuidedQuestionsSkip, ...(guidedQuestionsTitle
4234
+ ? { title: guidedQuestionsTitle }
4235
+ : {}), ...(guidedQuestionsDescription
4236
+ ? { description: guidedQuestionsDescription }
4237
+ : {}), ...(guidedQuestionsSkipLabel
4238
+ ? { skipLabel: guidedQuestionsSkipLabel }
4239
+ : {}), ...(guidedQuestionsSubmitLabel
4240
+ ? { submitLabel: guidedQuestionsSubmitLabel }
4241
+ : {}), className: "h-auto items-stretch justify-stretch bg-transparent" }) })), composerError && (_jsxs("div", { role: "alert", className: "shrink-0 mx-3 mb-1.5 flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive", children: [_jsx(IconAlertTriangle, { className: "h-3.5 w-3.5 mt-0.5 shrink-0" }), _jsx("span", { className: "flex-1 leading-snug", children: composerError }), _jsx("button", { type: "button", "aria-label": "Dismiss error", onClick: () => setComposerError(null), className: "shrink-0 opacity-70 hover:opacity-100", children: _jsx(IconX, { className: "h-3 w-3" }) })] })), _jsxs("div", { className: "agent-composer-stack", "data-agent-composer-adjacent-ui": hasComposerAccessoryAboveStack
4242
+ ? "true"
4243
+ : undefined, children: [_jsx(SelectionAttachedPill, {}), showPlanModeCallout && (_jsx(PlanModeCallout, { canImplementPlan: canImplementPlan, onImplementPlan: handleImplementPlan, onSwitchToAct: handleSwitchToAct })), showInlineMissingKeySetup ? (_jsx(BuilderSetupCard, { fullWidth: true, layout: "sidebar", onConnected: handleBuilderConnected })) : null, _jsxs(Popover, { open: showMissingKeySetup &&
4244
+ !showInlineMissingKeySetup &&
4245
+ missingKeySetupOpen, onOpenChange: setMissingKeySetupOpen, children: [_jsx(AgentComposerFrame, { layoutVariant: composerLayoutVariant, className: cn(composerAreaClassName, isComposerDisabled &&
4246
+ !showMissingKeySetup &&
4247
+ "opacity-70"), rootClassName: cn(showMissingKeySetup &&
4248
+ "agent-composer-root--missing-key"), children: showMissingKeySetup &&
4249
+ !showInlineMissingKeySetup ? (_jsx(PopoverTrigger, { asChild: true, children: _jsx("button", { type: "button", className: "agent-composer-missing-key-trigger", "aria-label": "Connect AI to start chatting", children: _jsxs("span", { className: "agent-composer-missing-key-content", children: [_jsxs("span", { className: "agent-composer-missing-key-copy", children: [_jsx("span", { className: "agent-composer-missing-key-title", children: missingApiKeySetupLayout ===
4250
+ "sidebar"
4251
+ ? "Connect AI to chat"
4252
+ : "Connect AI to start chatting" }), missingApiKeySetupLayout !==
4253
+ "sidebar" ? (_jsx("span", { className: "agent-composer-missing-key-description", children: "Builder.io includes free credits, or use your own API key." })) : null] }), _jsx("span", { className: "agent-composer-missing-key-cta", children: "Connect AI" })] }) }) })) : (_jsxs(_Fragment, { children: [_jsx(ComposerAttachmentPreviewStrip, {}), _jsx(TiptapComposer, { focusRef: tiptapRef, onTextChange: isActiveComposer
4254
+ ? handleComposerTextChange
4255
+ : undefined, disabled: isComposerDisabled ||
4256
+ showInlineMissingKeySetup, placeholder: showInlineMissingKeySetup
4257
+ ? "Connect AI above to start chatting..."
4258
+ : engineSetupRequired
4259
+ ? "Connect AI to start chatting..."
4260
+ : composerDisabled
4261
+ ? (composerDisabledPlaceholder ??
4262
+ "Open Desktop to use this chat.")
4263
+ : isRunning
4264
+ ? queuedMessages.length > 0
4265
+ ? `${queuedMessages.length} queued — send a follow-up...`
4266
+ : "Send a follow-up..."
4267
+ : resolveAssistantChatComposerPlaceholder(composerPlaceholder), onSubmit: isRunning ||
4268
+ composerContextItems.length > 0
4269
+ ? (text, references, attachments, options) => void addToQueue(text, undefined, references.length > 0
4270
+ ? references
4271
+ : undefined, attachments, undefined, resolveAssistantChatSubmitIntent({
4272
+ isRunning,
4273
+ requestedIntent: options?.intent,
4274
+ }), undefined, true)
4275
+ : undefined, willQueue: engineSetupRequired || isRunning, onSlashCommand: onSlashCommand, execMode: execMode, onExecModeChange: onExecModeChange, planModeDisabled: planModeDisabled, planModeDisabledReason: planModeDisabledReason, selectedModel: selectedModel ?? defaultModel, selectedEffort: selectedEffort, availableModels: availableModels, modelListLoading: modelListLoading, onModelChange: onModelChange, onEffortChange: onEffortChange, imageModelMenu: imageModelMenu, onConnectProvider: onConnectProvider, onConnectLocalRuntime: onConnectLocalRuntime, toolbarSlot: composerToolbarSlot, contextItems: composerContextItems, onRemoveContextItem: removeComposerContextItem, plusMenuMode: plusMenuMode, layoutVariant: composerLayoutVariant, providerConnectStatusEnabled: providerStatusChecksEnabled, voiceEnabled: true, draftScope: threadId || tabId, interceptBuildRequestsForBuilder: true, onAttachmentError: setComposerError, extraActionButton: composerExtraActionButton, stopButton: showRunningInUI ? (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { type: "button", onClick: () => stopActiveRun({
4276
+ preserveQueuedMessages: true,
4277
+ }), "aria-label": "Stop response", "data-agent-composer-slot": "stop-button", className: "shrink-0 flex h-7 w-7 cursor-pointer items-center justify-center rounded-full bg-primary text-primary-foreground shadow-sm transition-opacity hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", children: _jsx(IconPlayerStopFilled, { className: "h-3 w-3" }) }) }), _jsx(TooltipContent, { children: "Stop response" })] })) : undefined })] })) }), showMissingKeySetup &&
4278
+ !showInlineMissingKeySetup ? (_jsx(PopoverContent, { side: missingApiKeySetupLayout === "sidebar"
4279
+ ? "top"
4280
+ : "bottom", align: "center", sideOffset: 8, collisionPadding: 12, "data-agent-native-composer-popover": "true", className: "z-[260] box-border w-[min(calc(100vw-2rem),var(--radix-popover-content-available-width,26rem),26rem)] rounded-lg border-border p-3 shadow-lg", children: _jsx(BuilderSetupContent, { onConnected: handleBuilderConnected, layout: missingApiKeySetupLayout }) })) : null] })] })] }) }) }) }) }) }) }) }) }) }) }));
4271
4281
  });
4272
4282
  export const AssistantChat = forwardRef(function AssistantChat({ apiUrl = agentNativePath("/_agent-native/agent-chat"), tabId, browserTabId, threadId, contextScope, isActiveComposer, ...props }, ref) {
4273
4283
  const modelRef = useRef(props.selectedModel);
@@ -10,7 +10,7 @@ import { McpIntegrationDialog,
10
10
  // host for the existing MCP management flow.
11
11
  } from "../resources/McpIntegrationDialog.js";
12
12
  import { McpServerDetail } from "../resources/McpServerDetail.js";
13
- import { useCreateMcpServer, useDeleteMcpServer, useMcpServers, } from "../resources/use-mcp-servers.js";
13
+ import { useCreateMcpServer, useDeleteMcpServer, useMcpServers, formatMcpServersLoadError, } from "../resources/use-mcp-servers.js";
14
14
  import { AGENT_SETTINGS_SECTIONS, buildSectionSearchEntries, } from "../settings/agent-settings-search.js";
15
15
  import { AgentSettingsContent } from "../settings/SettingsPanel.js";
16
16
  import { cn } from "../utils.js";
@@ -160,7 +160,7 @@ export function ConnectionsTab({ canManageOrg, } = {}) {
160
160
  return (_jsx(AgentTabFrame, { title: "Agent integrations", description: "Tools and services this agent can reach, grouped by where they are configured.", actions: _jsx("button", { type: "button", onClick: () => {
161
161
  setError(null);
162
162
  setDialogOpen(true);
163
- }, className: "cursor-pointer rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90", children: t("mcpIntegrations.connect") }), children: _jsxs("section", { className: "space-y-4", children: [error && (_jsx("p", { className: "rounded-md border border-destructive/20 bg-destructive/5 px-3 py-2 text-xs text-destructive", children: error })), serversQuery.isLoading ? (_jsx(TabLoading, {})) : serversQuery.isError ? (_jsx("p", { className: "rounded-md border border-destructive/20 bg-destructive/5 px-3 py-2 text-xs text-destructive", children: "Could not load agent integrations." })) : (_jsx("div", { className: "space-y-6", children: [
163
+ }, className: "cursor-pointer rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90", children: t("mcpIntegrations.connect") }), children: _jsxs("section", { className: "space-y-4", children: [error && (_jsx("p", { className: "rounded-md border border-destructive/20 bg-destructive/5 px-3 py-2 text-xs text-destructive", children: error })), serversQuery.isLoading ? (_jsx(TabLoading, {})) : serversQuery.isError ? (_jsxs("div", { role: "alert", className: "rounded-md border border-destructive/20 bg-destructive/5 px-3 py-2 text-xs text-destructive", children: [_jsx("p", { children: formatMcpServersLoadError(serversQuery.error) }), _jsx("button", { type: "button", onClick: () => void serversQuery.refetch(), disabled: serversQuery.isFetching, className: "mt-2 font-medium underline underline-offset-2 hover:text-foreground disabled:cursor-wait disabled:opacity-60", children: serversQuery.isFetching ? "Retrying…" : "Retry" })] })) : (_jsx("div", { className: "space-y-6", children: [
164
164
  { label: "Personal", servers: data?.user ?? [] },
165
165
  { label: "Organization", servers: data?.org ?? [] },
166
166
  ].map((section) => (_jsxs("section", { className: "space-y-2", children: [_jsx("h2", { className: "text-xs font-semibold uppercase tracking-[0.14em] text-muted-foreground/70", children: section.label }), section.servers.length > 0 ? (_jsx("div", { className: "divide-y divide-border/60 border-y border-border/60", children: section.servers.map(renderServer) })) : (_jsx(AgentEmptyState, { icon: IconPlugConnected, title: `No ${section.label.toLowerCase()} agent integrations yet`, description: section.label === "Personal"
@@ -1,6 +1,6 @@
1
1
  // Owns: image/document/text attachment adapters and attachment serialization helpers.
2
2
  import { CHAT_DOCUMENT_ATTACHMENT_ACCEPT, IMAGE_ATTACHMENT_ACCEPT, } from "@agent-native/toolkit/composer/attachment-accept";
3
- // Maximum PDF/document size (4 MB). Larger PDFs would bloat the JSON POST
3
+ // Maximum document size (4 MB). Larger files would bloat the JSON POST
4
4
  // body past Vercel's ~4.5 MB limit after base64 encoding (+33% overhead).
5
5
  export const MAX_PDF_BYTES = 4 * 1024 * 1024;
6
6
  // Anthropic / OpenAI vision inputs choke on multi-megabyte images, and
@@ -28,6 +28,12 @@ export function inferDocumentContentType(file) {
28
28
  return file.type;
29
29
  if (file.name.toLowerCase().endsWith(".pdf"))
30
30
  return "application/pdf";
31
+ if (file.name.toLowerCase().endsWith(".xlsx")) {
32
+ return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
33
+ }
34
+ if (file.name.toLowerCase().endsWith(".xls")) {
35
+ return "application/vnd.ms-excel";
36
+ }
31
37
  if (file.name.toLowerCase().endsWith(".svg"))
32
38
  return "image/svg+xml";
33
39
  return "application/octet-stream";
@@ -43,7 +49,7 @@ export function getFileDataURL(file) {
43
49
  function formatOversizedDocumentError(name, size) {
44
50
  const mb = (size / 1024 / 1024).toFixed(1);
45
51
  const maxMb = (MAX_PDF_BYTES / 1024 / 1024).toFixed(0);
46
- return `"${name}" is ${mb} MB — PDFs are capped at ${maxMb} MB to stay within message limits. Please reduce the file size or split it into smaller parts.`;
52
+ return `"${name}" is ${mb} MB - documents are capped at ${maxMb} MB to stay within message limits. Please reduce the file size or split it into smaller parts.`;
47
53
  }
48
54
  function loadImage(url) {
49
55
  return new Promise((resolve, reject) => {
@@ -8,6 +8,7 @@ export declare const ChatRunningContext: React.Context<boolean>;
8
8
  export declare const ChatRunningRunIdContext: React.Context<string | null>;
9
9
  export declare const ChatRunningTurnIdContext: React.Context<string | null>;
10
10
  export declare const ChatRunDurationContext: React.Context<number | null>;
11
+ export declare const SuppressInlineOpenAppContext: React.Context<boolean>;
11
12
  export declare const ASSISTANT_VISIBLE_TOOL_CALL_LIMIT = 3;
12
13
  /**
13
14
  * Keeps the tool-call stack layout-transparent. Tool-entry motion is disabled
@@ -22,6 +22,7 @@ export const ChatRunningContext = React.createContext(false);
22
22
  export const ChatRunningRunIdContext = React.createContext(null);
23
23
  export const ChatRunningTurnIdContext = React.createContext(null);
24
24
  export const ChatRunDurationContext = React.createContext(null);
25
+ export const SuppressInlineOpenAppContext = React.createContext(false);
25
26
  export const ASSISTANT_VISIBLE_TOOL_CALL_LIMIT = 3;
26
27
  /**
27
28
  * Keeps the tool-call stack layout-transparent. Tool-entry motion is disabled
@@ -291,6 +292,7 @@ export function ToolCallDisplay({ toolName, toolCallId, argsText, args, result,
291
292
  return wrapToolDisplay(_jsx(ToolCallDisplayGeneric, { toolName: toolName, toolCallId: toolCallId, argsText: argsText, args: args, result: result, mcpApp: mcpApp, chatUI: chatUI, isRunning: isRunning, outcome: outcome, isActiveTail: showActiveTail, structuredMeta: structuredMeta, approval: approval, repeatCount: repeatCount }));
292
293
  }
293
294
  function ToolCallDisplayGeneric({ toolName, toolCallId, argsText, args, result, mcpApp, chatUI, isRunning, outcome, isActiveTail, structuredMeta, approval, repeatCount, }) {
295
+ const suppressInlineOpenApp = React.useContext(SuppressInlineOpenAppContext);
294
296
  const isRawCallAgent = toolName === "call-agent";
295
297
  const isAgentCall = toolName.startsWith("agent:") || isRawCallAgent;
296
298
  const [expanded, setExpanded] = useState(isAgentCall);
@@ -405,7 +407,7 @@ function ToolCallDisplayGeneric({ toolName, toolCallId, argsText, args, result,
405
407
  ? structuredMeta.agentDurationMs
406
408
  : agentActivity?.durationMs }));
407
409
  }
408
- 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" })) : isUnknownOutcome ? (_jsx(IconAlertTriangle, { className: "size-3.5 text-muted-foreground" })) : (_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: cn("min-w-0 truncate font-normal", isActiveTail && "agent-running-shimmer"), 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 && (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" }) }) }))] }) }), isUnknownOutcome && (_jsx("p", { role: "status", className: "ps-5 text-xs text-muted-foreground", children: "Interrupted before this finished reporting \u2014 it may or may not have completed. Check before retrying." })), approval && (_jsx(ApprovalAffordance, { toolName: toolName, toolCallId: toolCallId, approval: approval }))] }));
410
+ return (_jsxs("div", { className: "group/tool my-0.5 w-full overflow-hidden", children: [mcpApp && !(suppressInlineOpenApp && toolName === "open_app") && (_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" })) : isUnknownOutcome ? (_jsx(IconAlertTriangle, { className: "size-3.5 text-muted-foreground" })) : (_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: cn("min-w-0 truncate font-normal", isActiveTail && "agent-running-shimmer"), 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 && (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" }) }) }))] }) }), isUnknownOutcome && (_jsx("p", { role: "status", className: "ps-5 text-xs text-muted-foreground", children: "Interrupted before this finished reporting \u2014 it may or may not have completed. Check before retrying." })), approval && (_jsx(ApprovalAffordance, { toolName: toolName, toolCallId: toolCallId, approval: approval }))] }));
409
411
  }
410
412
  function AgentCallCell({ agentName, activity, progress, responseText, isRunning, isError, durationMs, }) {
411
413
  const t = useT();