@agent-native/core 0.154.5 → 0.157.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 (263) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/templates/analytics/.agents/skills/account-health/SKILL.md +76 -0
  3. package/corpus/templates/analytics/.agents/skills/bigquery/SKILL.md +3 -0
  4. package/corpus/templates/analytics/.agents/skills/cross-source-analysis/SKILL.md +2 -1
  5. package/corpus/templates/analytics/.agents/skills/data-querying/SKILL.md +6 -5
  6. package/corpus/templates/analytics/AGENTS.md +3 -0
  7. package/corpus/templates/analytics/actions/account-deep-dive.ts +3 -2
  8. package/corpus/templates/analytics/actions/bigquery.ts +1 -1
  9. package/corpus/templates/analytics/app/components/dashboard/SqlChart.tsx +4 -1
  10. package/corpus/templates/analytics/app/components/layout/NewDashboardDialog.tsx +1 -0
  11. package/corpus/templates/analytics/app/pages/adhoc/explorer/components/PropertyCombobox.tsx +12 -4
  12. package/corpus/templates/analytics/app/pages/adhoc/explorer/components/PropertyValueCombobox.tsx +5 -2
  13. package/corpus/templates/analytics/app/pages/adhoc/explorer/property-label.ts +32 -0
  14. package/corpus/templates/analytics/changelog/2026-08-13-account-health-readouts-verify-customer-scope-and-contract-metrics.md +7 -0
  15. package/corpus/templates/analytics/server/jobs/analytics-bigquery-backfill.ts +43 -17
  16. package/corpus/templates/analytics/server/lib/analytics-query-catalog.ts +17 -0
  17. package/corpus/templates/analytics/server/plugins/agent-chat.ts +4 -0
  18. package/corpus/templates/assets/app/components/asset/AssetPreviewDialog.tsx +3 -1
  19. package/corpus/templates/assets/app/i18n-data.ts +21 -1
  20. package/corpus/templates/assets/app/routes/brand-kits.$id.tsx +17 -13
  21. package/corpus/templates/calendar/AGENTS.md +2 -0
  22. package/corpus/templates/calendar/DEVELOPING.md +4 -4
  23. package/corpus/templates/calendar/actions/get-settings.ts +4 -11
  24. package/corpus/templates/calendar/actions/update-availability.ts +15 -4
  25. package/corpus/templates/calendar/actions/update-settings.ts +15 -4
  26. package/corpus/templates/calendar/app/components/booking/DatePicker.tsx +9 -3
  27. package/corpus/templates/calendar/app/components/calendar/CreateEventDialog.tsx +21 -19
  28. package/corpus/templates/calendar/app/components/calendar/EventDetailPopover.tsx +9 -6
  29. package/corpus/templates/calendar/app/components/calendar/FindTimePanel.tsx +25 -3
  30. package/corpus/templates/calendar/app/components/calendar/InlineEventPickers.tsx +10 -3
  31. package/corpus/templates/calendar/app/components/calendar/MonthView.tsx +9 -9
  32. package/corpus/templates/calendar/app/components/calendar/WeekView.tsx +11 -3
  33. package/corpus/templates/calendar/app/components/layout/Sidebar.tsx +10 -4
  34. package/corpus/templates/calendar/app/i18n-data.ts +30 -0
  35. package/corpus/templates/calendar/app/lib/availability-schedule.ts +53 -0
  36. package/corpus/templates/calendar/app/lib/event-form-utils.ts +5 -0
  37. package/corpus/templates/calendar/app/pages/AvailabilitySettings.tsx +90 -28
  38. package/corpus/templates/calendar/app/pages/BookingLinksPage.tsx +135 -61
  39. package/corpus/templates/calendar/app/pages/BookingPage.tsx +2 -0
  40. package/corpus/templates/calendar/app/pages/CalendarView.tsx +30 -15
  41. package/corpus/templates/calendar/app/pages/Settings.tsx +60 -1
  42. package/corpus/templates/calendar/changelog/2026-08-13-find-a-time-now-closes-from-a-clear-header-action.md +6 -0
  43. package/corpus/templates/calendar/server/handlers/bookings.ts +2 -1
  44. package/corpus/templates/calendar/server/handlers/settings.ts +12 -16
  45. package/corpus/templates/calendar/shared/api.ts +1 -0
  46. package/corpus/templates/calendar/shared/availability-schedule.ts +64 -0
  47. package/corpus/templates/calendar/shared/calendar-week.ts +21 -0
  48. package/corpus/templates/calendar/shared/settings.ts +44 -0
  49. package/corpus/templates/clips/AGENTS.md +2 -0
  50. package/corpus/templates/clips/actions/add-comment.ts +5 -2
  51. package/corpus/templates/clips/actions/finalize-recording.ts +31 -1
  52. package/corpus/templates/clips/actions/get-recording-player-data.ts +9 -0
  53. package/corpus/templates/clips/actions/lib/ensure-seekable-video.ts +21 -1
  54. package/corpus/templates/clips/actions/reply-to-comment.ts +5 -2
  55. package/corpus/templates/clips/actions/update-comment.ts +9 -2
  56. package/corpus/templates/clips/app/components/library/search-bar.tsx +26 -13
  57. package/corpus/templates/clips/app/components/meetings/share-meeting-dialog.tsx +135 -3
  58. package/corpus/templates/clips/app/components/player/comments-panel.tsx +5 -99
  59. package/corpus/templates/clips/app/components/player/playback-comment-overlay.tsx +7 -3
  60. package/corpus/templates/clips/app/components/player/share-dialog.tsx +102 -59
  61. package/corpus/templates/clips/app/components/player/video-player.tsx +84 -24
  62. package/corpus/templates/clips/app/components/workspace/notifications-list.tsx +11 -3
  63. package/corpus/templates/clips/app/i18n/en-US.ts +12 -0
  64. package/corpus/templates/clips/app/lib/public-meeting.ts +11 -3
  65. package/corpus/templates/clips/app/lib/search-focus.ts +15 -0
  66. package/corpus/templates/clips/app/root.tsx +2 -1
  67. package/corpus/templates/clips/app/routes/_app.meetings._index.tsx +94 -26
  68. package/corpus/templates/clips/app/routes/_app.settings._index.tsx +24 -7
  69. package/corpus/templates/clips/app/routes/embed.$shareId.tsx +8 -4
  70. package/corpus/templates/clips/app/routes/r.$recordingId.tsx +29 -8
  71. package/corpus/templates/clips/app/routes/share.$shareId.tsx +24 -6
  72. package/corpus/templates/clips/app/routes/share.meeting.$meetingId.tsx +72 -26
  73. package/corpus/templates/clips/changelog/2026-08-13-inline-markdown-comments.md +6 -0
  74. package/corpus/templates/clips/changelog/2026-08-13-private-meeting-agent-links.md +6 -0
  75. package/corpus/templates/clips/desktop/src/app.tsx +116 -19
  76. package/corpus/templates/clips/desktop/src/lib/recorder.ts +13 -29
  77. package/corpus/templates/clips/desktop/src/lib/recording-request.ts +39 -0
  78. package/corpus/templates/clips/desktop/src/lib/settings-navigation.ts +11 -0
  79. package/corpus/templates/clips/desktop/src/lib/whisper-model-picker.ts +7 -0
  80. package/corpus/templates/clips/desktop/src/styles.css +117 -0
  81. package/corpus/templates/clips/server/db/index.ts +10 -0
  82. package/corpus/templates/clips/server/db/schema.ts +1 -0
  83. package/corpus/templates/clips/server/lib/recordings.ts +3 -1
  84. package/corpus/templates/clips/server/lib/seekable-media-state.ts +90 -0
  85. package/corpus/templates/clips/server/plugins/db.ts +5 -0
  86. package/corpus/templates/clips/server/routes/api/public-meeting.get.ts +37 -4
  87. package/corpus/templates/clips/server/routes/api/public-recording.get.ts +16 -5
  88. package/corpus/templates/clips/shared/clips-ai-prefs.ts +3 -0
  89. package/corpus/templates/clips/shared/meeting-agent-access.ts +5 -0
  90. package/corpus/templates/content/actions/add-comment.ts +2 -1
  91. package/corpus/templates/content/actions/update-comment.ts +1 -1
  92. package/corpus/templates/content/app/components/editor/CommentsSidebar.tsx +24 -15
  93. package/corpus/templates/design/actions/generate-design.ts +10 -7
  94. package/corpus/templates/design/actions/present-design-variants.ts +35 -6
  95. package/corpus/templates/design/actions/run-design-audit.ts +33 -0
  96. package/corpus/templates/design/changelog/2026-08-13-the-design-audit-now-catches-a-screen-that-renders-behind-an.md +6 -0
  97. package/corpus/templates/design/shared/design-review.ts +1 -0
  98. package/corpus/templates/design/shared/html-integrity.ts +66 -0
  99. package/corpus/templates/dispatch/.env.example +5 -0
  100. package/corpus/templates/dispatch/AGENTS.md +24 -19
  101. package/corpus/templates/dispatch/app/i18n-data.ts +20 -0
  102. package/corpus/templates/dispatch/server/lib/identity-sso.ts +21 -90
  103. package/corpus/templates/dispatch/server/plugins/identity-sso.ts +3 -12
  104. package/corpus/templates/dispatch/shared/feature-flags.ts +4 -0
  105. package/corpus/templates/factory/AGENTS.md +5 -1
  106. package/corpus/templates/factory/README.md +23 -0
  107. package/corpus/templates/factory/actions/view-screen.ts +17 -0
  108. package/corpus/templates/factory/app/components/factory/FactoryAgentsView.tsx +239 -0
  109. package/corpus/templates/factory/app/components/factory/FactoryCanvas.tsx +2 -0
  110. package/corpus/templates/factory/app/components/factory/FactoryInspector.tsx +130 -7
  111. package/corpus/templates/factory/app/i18n/en-US.ts +20 -0
  112. package/corpus/templates/factory/app/routes/factory.tsx +41 -0
  113. package/corpus/templates/factory/package.json +1 -0
  114. package/corpus/templates/factory/server/factory-graph/contracts.ts +2 -0
  115. package/corpus/templates/factory/server/plugins/agent-chat.ts +9 -0
  116. package/corpus/templates/factory/server/plugins/dispatch-db.ts +1 -0
  117. package/corpus/templates/factory/server/plugins/setup-dispatch.ts +3 -0
  118. package/corpus/templates/mail/app/lib/native-mcp-exclusions.ts +3 -0
  119. package/corpus/templates/mail/vite.config.ts +7 -0
  120. package/corpus/templates/plan/actions/reply-to-plan-comment.ts +7 -2
  121. package/corpus/templates/plan/actions/resolve-plan-comment.ts +2 -2
  122. package/corpus/templates/plan/actions/update-visual-plan.ts +1 -1
  123. package/corpus/templates/plan/app/pages/PlansPage.tsx +29 -20
  124. package/corpus/templates/slides/actions/add-slide-comment.ts +1 -1
  125. package/corpus/templates/slides/actions/update-slide-comment.ts +1 -1
  126. package/corpus/templates/slides/app/components/comments/SlideCommentsPanel.tsx +9 -6
  127. package/corpus/templates/slides/app/components/editor/AddSlidePopover.tsx +98 -29
  128. package/corpus/templates/slides/app/components/editor/EditorActionCluster.tsx +45 -91
  129. package/corpus/templates/slides/app/components/editor/EditorSidebar.tsx +94 -2
  130. package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +17 -29
  131. package/corpus/templates/slides/app/components/editor/SlideContextToolbar.tsx +1 -1
  132. package/corpus/templates/slides/app/context/DeckContext.tsx +42 -2
  133. package/corpus/templates/slides/app/global.css +7 -40
  134. package/corpus/templates/slides/app/i18n/en-US.ts +4 -0
  135. package/corpus/templates/slides/app/pages/DeckEditor.tsx +130 -45
  136. package/dist/agent/index.d.ts +1 -1
  137. package/dist/agent/production-agent.d.ts +30 -0
  138. package/dist/agent/production-agent.js +105 -9
  139. package/dist/agent/thread-data-builder.js +17 -1
  140. package/dist/agent/types.d.ts +9 -0
  141. package/dist/cli/skills-content/help.js +6 -4
  142. package/dist/cli/skills.js +17 -2
  143. package/dist/cli/workspacify.d.ts +5 -0
  144. package/dist/cli/workspacify.js +65 -8
  145. package/dist/client/AgentPanel.d.ts +5 -0
  146. package/dist/client/AgentPanel.js +32 -13
  147. package/dist/client/AssistantChat.d.ts +36 -1
  148. package/dist/client/AssistantChat.js +175 -110
  149. package/dist/client/MultiTabAssistantChat.js +44 -27
  150. package/dist/client/active-run-state.d.ts +14 -1
  151. package/dist/client/active-run-state.js +0 -0
  152. package/dist/client/agent-chat-adapter.js +107 -5
  153. package/dist/client/analytics.js +9 -2
  154. package/dist/client/chat/markdown-renderer.js +4 -2
  155. package/dist/client/chat/message-components.d.ts +2 -2
  156. package/dist/client/chat/message-components.js +69 -35
  157. package/dist/client/chat/run-recovery.d.ts +4 -1
  158. package/dist/client/chat/run-recovery.js +62 -30
  159. package/dist/client/chat/tool-call-display.d.ts +12 -3
  160. package/dist/client/chat/tool-call-display.js +79 -40
  161. package/dist/client/chat/widgets/DataChartRenderer.js +3 -1
  162. package/dist/client/chat/widgets/DataChartWidget.js +8 -2
  163. package/dist/client/chat/widgets/DataInsightsWidget.js +3 -1
  164. package/dist/client/chat/widgets/DataTableWidget.js +23 -9
  165. package/dist/client/chat/widgets/builtin-tool-renderers.js +3 -1
  166. package/dist/client/chat-first/apps-rail.js +9 -4
  167. package/dist/client/chat-first/primary-nav.d.ts +2 -1
  168. package/dist/client/chat-first/primary-nav.js +3 -3
  169. package/dist/client/chat-first/types.d.ts +5 -1
  170. package/dist/client/components/ui/message-scroller.d.ts +1 -1
  171. package/dist/client/components/ui/message-scroller.js +7 -3
  172. package/dist/client/composer/runtime-adapters.js +3 -2
  173. package/dist/client/context-xray/ContextMeter.js +5 -1
  174. package/dist/client/context-xray/ContextXRayPanel.js +5 -5
  175. package/dist/client/error-format.d.ts +4 -0
  176. package/dist/client/error-format.js +93 -5
  177. package/dist/client/i18n.js +83 -17
  178. package/dist/client/markdown/InlineMarkdown.d.ts +23 -0
  179. package/dist/client/markdown/InlineMarkdown.js +65 -0
  180. package/dist/client/markdown/index.d.ts +1 -0
  181. package/dist/client/markdown/index.js +1 -0
  182. package/dist/client/observability/ThumbsFeedback.js +10 -8
  183. package/dist/client/review/ReviewThreadPanel.js +2 -1
  184. package/dist/client/run-stream-ownership.d.ts +39 -0
  185. package/dist/client/run-stream-ownership.js +65 -0
  186. package/dist/client/sharing/ShareButton.js +160 -54
  187. package/dist/coding-tools/run-code.js +2 -1
  188. package/dist/coding-tools/sandbox/background.d.ts +1 -0
  189. package/dist/coding-tools/sandbox/background.js +8 -1
  190. package/dist/coding-tools/sandbox/executions-store.d.ts +2 -0
  191. package/dist/coding-tools/sandbox/executions-store.js +41 -3
  192. package/dist/collab/awareness.d.ts +2 -2
  193. package/dist/collab/routes.d.ts +1 -1
  194. package/dist/collab/struct-routes.d.ts +1 -1
  195. package/dist/feature-flags/index.d.ts +1 -1
  196. package/dist/feature-flags/index.js +1 -1
  197. package/dist/feature-flags/store.d.ts +10 -0
  198. package/dist/feature-flags/store.js +112 -1
  199. package/dist/guards/no-env-credentials.js +4 -0
  200. package/dist/index.d.ts +2 -2
  201. package/dist/index.js +1 -1
  202. package/dist/integrations/adapters/slack.js +5 -1
  203. package/dist/localization/core-messages/ar-SA.d.ts +3 -0
  204. package/dist/localization/core-messages/ar-SA.js +541 -0
  205. package/dist/localization/core-messages/de-DE.d.ts +3 -0
  206. package/dist/localization/core-messages/de-DE.js +513 -0
  207. package/dist/localization/core-messages/en-US.d.ts +513 -0
  208. package/dist/localization/core-messages/en-US.js +513 -0
  209. package/dist/localization/core-messages/es-ES.d.ts +3 -0
  210. package/dist/localization/core-messages/es-ES.js +520 -0
  211. package/dist/localization/core-messages/fr-FR.d.ts +3 -0
  212. package/dist/localization/core-messages/fr-FR.js +520 -0
  213. package/dist/localization/core-messages/hi-IN.d.ts +3 -0
  214. package/dist/localization/core-messages/hi-IN.js +513 -0
  215. package/dist/localization/core-messages/ja-JP.d.ts +3 -0
  216. package/dist/localization/core-messages/ja-JP.js +506 -0
  217. package/dist/localization/core-messages/ko-KR.d.ts +3 -0
  218. package/dist/localization/core-messages/ko-KR.js +506 -0
  219. package/dist/localization/core-messages/pt-BR.d.ts +3 -0
  220. package/dist/localization/core-messages/pt-BR.js +520 -0
  221. package/dist/localization/core-messages/zh-CN.d.ts +3 -0
  222. package/dist/localization/core-messages/zh-CN.js +506 -0
  223. package/dist/localization/core-messages/zh-TW.d.ts +3 -0
  224. package/dist/localization/core-messages/zh-TW.js +506 -0
  225. package/dist/localization/core-messages.d.ts +524 -0
  226. package/dist/localization/core-messages.js +124 -0
  227. package/dist/localization/default-messages.d.ts +3 -0
  228. package/dist/localization/default-messages.js +3 -0
  229. package/dist/notifications/routes.d.ts +1 -1
  230. package/dist/observability/routes.d.ts +2 -2
  231. package/dist/progress/routes.d.ts +1 -1
  232. package/dist/provider-api/actions/custom-provider-registration.d.ts +11 -11
  233. package/dist/provider-api/actions/provider-api.d.ts +15 -15
  234. package/dist/resources/agents.js +40 -5
  235. package/dist/resources/metadata.d.ts +10 -0
  236. package/dist/resources/metadata.js +7 -3
  237. package/dist/review/actions/create-review-comment.js +1 -1
  238. package/dist/review/actions/reply-review-comment.js +1 -1
  239. package/dist/review/actions/resolve-review-thread.js +1 -1
  240. package/dist/secrets/routes.d.ts +6 -6
  241. package/dist/server/action-routes.js +32 -6
  242. package/dist/server/agent-chat/plugin-options.d.ts +7 -2
  243. package/dist/server/agent-chat-plugin.d.ts +10 -0
  244. package/dist/server/agent-chat-plugin.js +144 -41
  245. package/dist/server/agent-discovery.js +14 -3
  246. package/dist/server/agent-run-context.d.ts +7 -1
  247. package/dist/server/agent-run-context.js +9 -2
  248. package/dist/server/agent-teams-run-queue.d.ts +3 -0
  249. package/dist/server/agent-teams.js +38 -9
  250. package/dist/server/core-routes-plugin.js +1 -1
  251. package/dist/server/identity-sso-migrations.d.ts +7 -0
  252. package/dist/server/identity-sso-migrations.js +36 -0
  253. package/dist/server/identity-sso-store.d.ts +3 -2
  254. package/dist/server/identity-sso-store.js +8 -3
  255. package/dist/server/index.d.ts +1 -1
  256. package/dist/server/realtime-token.d.ts +1 -1
  257. package/dist/server/release-migrations.js +4 -0
  258. package/dist/server/request-context.d.ts +7 -0
  259. package/dist/server/request-context.js +15 -0
  260. package/dist/tracking/providers.js +13 -3
  261. package/dist/workspace-files/tool.js +1 -1
  262. package/docs/content/agent-surfaces.mdx +30 -0
  263. package/package.json +3 -2
@@ -12,6 +12,7 @@ import { fetchBuilderStatus, fetchEnvironmentStatus, } from "./client-status-req
12
12
  import { Popover, PopoverAnchor, PopoverContent, } from "./components/ui/popover.js";
13
13
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "./components/ui/tooltip.js";
14
14
  import { isTrustedFrameMessage } from "./frame.js";
15
+ import { DEFAULT_LOCALE, useOptionalLocale, useT } from "./i18n.js";
15
16
  import { RunStuckBanner } from "./RunStuckBanner.js";
16
17
  import { callAction } from "./use-action.js";
17
18
  import { useChangeVersion } from "./use-change-version.js";
@@ -118,20 +119,25 @@ function formatScopeType(type) {
118
119
  return type.replace(/[-_]+/g, " ");
119
120
  }
120
121
  // ─── History Popover ─────────────────────────────────────────────────────────
121
- function formatThreadTime(ts) {
122
+ function formatThreadTime(ts, locale, yesterdayLabel) {
122
123
  const d = new Date(ts);
123
124
  const now = new Date();
124
125
  const diffMs = now.getTime() - d.getTime();
125
126
  const diffDays = Math.floor(diffMs / 86400000);
126
127
  if (diffDays === 0)
127
- return d.toLocaleTimeString([], { hour: "numeric", minute: "2-digit" });
128
+ return d.toLocaleTimeString(locale, {
129
+ hour: "numeric",
130
+ minute: "2-digit",
131
+ });
128
132
  if (diffDays === 1)
129
- return "Yesterday";
133
+ return yesterdayLabel;
130
134
  if (diffDays < 7)
131
- return d.toLocaleDateString([], { weekday: "short" });
132
- return d.toLocaleDateString([], { month: "short", day: "numeric" });
135
+ return d.toLocaleDateString(locale, { weekday: "short" });
136
+ return d.toLocaleDateString(locale, { month: "short", day: "numeric" });
133
137
  }
134
138
  function HistoryPopover({ threads, openTabIds, activeThreadId, hasMoreThreads = false, isLoadingMoreThreads = false, loadError, onSelect, onClose, onLoadMore, onSearch, onTogglePin, onRename, }) {
139
+ const t = useT();
140
+ const locale = useOptionalLocale()?.locale ?? DEFAULT_LOCALE;
135
141
  const [search, setSearch] = useState("");
136
142
  const [searchResults, setSearchResults] = useState(null);
137
143
  const [isSearching, setIsSearching] = useState(false);
@@ -189,7 +195,7 @@ function HistoryPopover({ threads, openTabIds, activeThreadId, hasMoreThreads =
189
195
  const unpinnedThreads = filtered.filter((t) => t.pinnedAt == null);
190
196
  const toHistoryItem = (thread) => {
191
197
  const isActive = thread.id === activeThreadId;
192
- const title = thread.title || thread.preview || "Chat";
198
+ const title = thread.title || thread.preview || t("agentChat.history.untitledChat");
193
199
  return {
194
200
  id: thread.id,
195
201
  title,
@@ -198,10 +204,10 @@ function HistoryPopover({ threads, openTabIds, activeThreadId, hasMoreThreads =
198
204
  ? thread.preview
199
205
  : undefined,
200
206
  timestamp: isActive
201
- ? "Active"
207
+ ? t("agentChat.history.active")
202
208
  : openTabIds.has(thread.id)
203
- ? "Open"
204
- : formatThreadTime(thread.updatedAt),
209
+ ? t("agentChat.history.open")
210
+ : formatThreadTime(thread.updatedAt, locale, t("agentChat.history.yesterday")),
205
211
  pinned: thread.pinnedAt != null,
206
212
  };
207
213
  };
@@ -210,7 +216,7 @@ function HistoryPopover({ threads, openTabIds, activeThreadId, hasMoreThreads =
210
216
  ? [
211
217
  {
212
218
  id: "pinned",
213
- label: "Pinned",
219
+ label: t("agentChat.history.pinned"),
214
220
  items: pinnedThreads.map(toHistoryItem),
215
221
  },
216
222
  ]
@@ -228,10 +234,13 @@ function HistoryPopover({ threads, openTabIds, activeThreadId, hasMoreThreads =
228
234
  const isPinned = threads.find((t) => t.id === id)?.pinnedAt != null;
229
235
  onTogglePin(id, !isPinned);
230
236
  }
231
- : undefined, onRename: onRename, searchValue: search, onSearchChange: setSearch, searchPlaceholder: "Search chats...", searchInputRef: inputRef, loading: isSearching, loadingLabel: "Searching...", error: loadError && !search.trim() ? loadError : undefined, emptyLabel: "No chats yet", emptySearchLabel: "No matching chats", footer: !search.trim() && hasMoreThreads ? (_jsx("button", { type: "button", onClick: () => onLoadMore?.(), disabled: isLoadingMoreThreads, className: "mx-1 mt-1 flex w-[calc(100%-0.5rem)] items-center justify-center rounded-md px-3 py-2 text-xs text-muted-foreground hover:bg-accent hover:text-foreground disabled:cursor-default disabled:opacity-60", children: isLoadingMoreThreads ? "Loading..." : "Load older chats" })) : undefined }) })] }));
237
+ : undefined, onRename: onRename, searchValue: search, onSearchChange: setSearch, searchPlaceholder: t("agentChat.history.search"), searchInputRef: inputRef, loading: isSearching, loadingLabel: t("agentChat.history.searching"), error: loadError && !search.trim() ? loadError : undefined, emptyLabel: t("agentChat.history.empty"), emptySearchLabel: t("agentChat.history.noMatches"), footer: !search.trim() && hasMoreThreads ? (_jsx("button", { type: "button", onClick: () => onLoadMore?.(), disabled: isLoadingMoreThreads, className: "mx-1 mt-1 flex w-[calc(100%-0.5rem)] items-center justify-center rounded-md px-3 py-2 text-xs text-muted-foreground hover:bg-accent hover:text-foreground disabled:cursor-default disabled:opacity-60", children: isLoadingMoreThreads
238
+ ? t("agentChat.common.loading")
239
+ : t("agentChat.history.loadOlder") })) : undefined }) })] }));
232
240
  }
233
241
  // ─── Help Popover ────────────────────────────────────────────────────────────
234
242
  function HelpPopover({ onClose }) {
243
+ const t = useT();
235
244
  useEffect(() => {
236
245
  const handler = (e) => {
237
246
  if (e.key === "Escape")
@@ -243,16 +252,16 @@ function HelpPopover({ onClose }) {
243
252
  const commands = [
244
253
  {
245
254
  name: "/clear",
246
- description: "Start a new chat (keeps current chat in history)",
255
+ description: t("agentChat.commands.clear"),
247
256
  },
248
- { name: "/new", description: "Same as /clear" },
249
- { name: "/history", description: "Browse all chats" },
250
- { name: "/plan", description: "Switch to read-only planning" },
251
- { name: "/act", description: "Switch back to acting" },
252
- { name: "/help", description: "Show this list of commands" },
253
- { name: "@", description: "Mention files, agents, or resources" },
257
+ { name: "/new", description: t("agentChat.commands.new") },
258
+ { name: "/history", description: t("agentChat.commands.history") },
259
+ { name: "/plan", description: t("agentChat.commands.plan") },
260
+ { name: "/act", description: t("agentChat.commands.act") },
261
+ { name: "/help", description: t("agentChat.commands.help") },
262
+ { name: "@", description: t("agentChat.commands.mention") },
254
263
  ];
255
- return (_jsxs(_Fragment, { children: [_jsx("div", { className: "fixed inset-0 z-40", onClick: onClose }), _jsxs("div", { className: "absolute end-2 top-0 z-50 w-72 rounded-lg border border-border bg-popover shadow-lg", children: [_jsxs("div", { className: "flex items-center justify-between px-3 py-2 border-b border-border", children: [_jsx("span", { className: "text-xs font-medium text-foreground", children: "Available Commands" }), _jsx("button", { onClick: onClose, "aria-label": "Close help", className: "flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:text-foreground", children: _jsx(IconX, { size: 12 }) })] }), _jsx("div", { className: "py-1", children: commands.map((cmd) => (_jsxs("div", { className: "px-3 py-1.5", children: [_jsx("div", { className: "text-xs font-medium text-foreground", children: cmd.name }), _jsx("div", { className: "text-[11px] text-muted-foreground", children: cmd.description })] }, cmd.name))) })] })] }));
264
+ return (_jsxs(_Fragment, { children: [_jsx("div", { className: "fixed inset-0 z-40", onClick: onClose }), _jsxs("div", { className: "absolute end-2 top-0 z-50 w-72 rounded-lg border border-border bg-popover shadow-lg", children: [_jsxs("div", { className: "flex items-center justify-between px-3 py-2 border-b border-border", children: [_jsx("span", { className: "text-xs font-medium text-foreground", children: t("agentChat.commands.available") }), _jsx("button", { onClick: onClose, "aria-label": t("agentChat.commands.closeHelp"), className: "flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:text-foreground", children: _jsx(IconX, { size: 12 }) })] }), _jsx("div", { className: "py-1", children: commands.map((cmd) => (_jsxs("div", { className: "px-3 py-1.5", children: [_jsx("div", { className: "text-xs font-medium text-foreground", children: cmd.name }), _jsx("div", { className: "text-[11px] text-muted-foreground", children: cmd.description })] }, cmd.name))) })] })] }));
256
265
  }
257
266
  function readString(value) {
258
267
  return typeof value === "string" ? value.trim() : "";
@@ -376,6 +385,7 @@ function runToAgentTeamTabInfo(run) {
376
385
  };
377
386
  }
378
387
  export function MultiTabAssistantChat({ showTabBar = true, renderHeader, renderOverlay, contentHidden = false, apiUrl = agentNativePath("/_agent-native/agent-chat"), storageKey, restoreActiveThread = true, browserTabId, threadUrlSync = false, scope = null, agentTeamPollMs = DEFAULT_AGENT_TEAM_POLL_MS, ...props }) {
388
+ const translate = useT();
379
389
  const { enabled: threadUrlSyncEnabled, paramName: threadUrlParamName, routeThreadId, getPath: getThreadPath, navigate: navigateThreadUrl, } = resolveThreadUrlSync(threadUrlSync);
380
390
  const threadRouteControlsActiveThread = threadUrlSyncEnabled &&
381
391
  threadUrlSync !== true &&
@@ -1661,7 +1671,9 @@ export function MultiTabAssistantChat({ showTabBar = true, renderHeader, renderO
1661
1671
  const agentTeamStatus = chatTabStatusFromAgentTeamStatus(subAgentStatuses[id]);
1662
1672
  return {
1663
1673
  id,
1664
- label: t?.title || t?.preview?.slice(0, 30) || "New chat",
1674
+ label: t?.title ||
1675
+ t?.preview?.slice(0, 30) ||
1676
+ translate("agentChat.tabs.newChat"),
1665
1677
  status: agentTeamStatus ??
1666
1678
  (runningThreads.has(id)
1667
1679
  ? "running"
@@ -1677,7 +1689,10 @@ export function MultiTabAssistantChat({ showTabBar = true, renderHeader, renderO
1677
1689
  if (!tabs.some((t) => t.id === id)) {
1678
1690
  tabs.push({
1679
1691
  id,
1680
- label: subAgentNames[id] || (parentMap[id] ? "Sub-agent..." : "New chat"),
1692
+ label: subAgentNames[id] ||
1693
+ (parentMap[id]
1694
+ ? translate("agentChat.tabs.subAgent")
1695
+ : translate("agentChat.tabs.newChat")),
1681
1696
  status: chatTabStatusFromAgentTeamStatus(subAgentStatuses[id]) ??
1682
1697
  "running",
1683
1698
  parentThreadId: parentMap[id],
@@ -1726,7 +1741,7 @@ export function MultiTabAssistantChat({ showTabBar = true, renderHeader, renderO
1726
1741
  activeTab?.parentThreadId === tab.id);
1727
1742
  return (_jsxs("div", { ref: isActive ? activeTabRefCb : undefined, className: cn("agent-tab relative flex items-center rounded-md text-[11px] font-medium shrink-0 max-w-[130px]", isActive
1728
1743
  ? "bg-accent text-foreground ring-1 ring-inset ring-border/60 shadow-sm"
1729
- : "text-muted-foreground hover:text-foreground hover:bg-accent/50"), children: [_jsxs("button", { type: "button", onClick: () => switchThread(tab.id), className: "flex items-center gap-1 px-2.5 py-1.5 min-w-0 flex-1 text-start", children: [_jsx("span", { className: "truncate pe-1", children: tab.label }), tab.status === "running" && (_jsx("span", { className: "w-1.5 h-1.5 rounded-full bg-muted-foreground/50 shrink-0 animate-pulse" }))] }), _jsx("button", { type: "button", "aria-label": "Close tab", onClick: (e) => {
1744
+ : "text-muted-foreground hover:text-foreground hover:bg-accent/50"), children: [_jsxs("button", { type: "button", onClick: () => switchThread(tab.id), className: "flex items-center gap-1 px-2.5 py-1.5 min-w-0 flex-1 text-start", children: [_jsx("span", { className: "truncate pe-1", children: tab.label }), tab.status === "running" && (_jsx("span", { className: "w-1.5 h-1.5 rounded-full bg-muted-foreground/50 shrink-0 animate-pulse" }))] }), _jsx("button", { type: "button", "aria-label": translate("agentChat.tabs.closeTab"), onClick: (e) => {
1730
1745
  e.stopPropagation();
1731
1746
  e.preventDefault();
1732
1747
  closeTab(tab.id);
@@ -1740,13 +1755,13 @@ export function MultiTabAssistantChat({ showTabBar = true, renderHeader, renderO
1740
1755
  borderRadius: "0 6px 6px 0",
1741
1756
  background: "linear-gradient(to right, transparent, hsl(var(--accent)) 40%)",
1742
1757
  }, children: _jsx(IconX, { size: 12 }) })] }, tab.id));
1743
- }) }), _jsx(TooltipProvider, { delayDuration: 200, children: _jsxs("div", { className: "flex items-center gap-px shrink-0 ms-auto", children: [_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { onClick: addTab, "aria-label": "New chat", className: "flex h-6 w-6 items-center justify-center rounded text-muted-foreground/60 hover:text-foreground hover:bg-accent/50", children: _jsx(IconPlus, { size: 12 }) }) }), _jsx(TooltipContent, { children: "New chat" })] }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { onClick: () => setShowHistory(!showHistory), "aria-label": "All chats", className: cn("flex h-6 w-6 items-center justify-center rounded text-muted-foreground/60 hover:text-foreground hover:bg-accent/50", showHistory && "bg-accent text-foreground"), children: _jsx(IconHistory, { size: 12 }) }) }), _jsx(TooltipContent, { children: "All chats" })] })] }) })] }), hasSubTabs && (_jsx("div", { className: "flex items-center px-1 py-0.5 border-b border-border shrink-0 gap-0.5 bg-muted/30", children: _jsxs("div", { className: "agent-tabs-scroll flex items-center gap-0.5 min-w-0 overflow-x-auto flex-1", children: [_jsx("button", { onClick: () => switchThread(focusParentId), className: cn("flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium cursor-pointer", activeThreadId === focusParentId
1758
+ }) }), _jsx(TooltipProvider, { delayDuration: 200, children: _jsxs("div", { className: "flex items-center gap-px shrink-0 ms-auto", children: [_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { onClick: addTab, "aria-label": translate("agentChat.tabs.newChat"), className: "flex h-6 w-6 items-center justify-center rounded text-muted-foreground/60 hover:text-foreground hover:bg-accent/50", children: _jsx(IconPlus, { size: 12 }) }) }), _jsx(TooltipContent, { children: translate("agentChat.tabs.newChat") })] }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { onClick: () => setShowHistory(!showHistory), "aria-label": translate("agentChat.tabs.allChats"), className: cn("flex h-6 w-6 items-center justify-center rounded text-muted-foreground/60 hover:text-foreground hover:bg-accent/50", showHistory && "bg-accent text-foreground"), children: _jsx(IconHistory, { size: 12 }) }) }), _jsx(TooltipContent, { children: translate("agentChat.tabs.allChats") })] })] }) })] }), hasSubTabs && (_jsx("div", { className: "flex items-center px-1 py-0.5 border-b border-border shrink-0 gap-0.5 bg-muted/30", children: _jsxs("div", { className: "agent-tabs-scroll flex items-center gap-0.5 min-w-0 overflow-x-auto flex-1", children: [_jsx("button", { onClick: () => switchThread(focusParentId), className: cn("flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-[10px] font-medium cursor-pointer", activeThreadId === focusParentId
1744
1759
  ? "bg-accent text-foreground"
1745
- : "text-muted-foreground hover:bg-accent hover:text-foreground"), children: "Main" }), childTabs.map((tab) => (_jsxs("div", { ref: tab.id === activeThreadId
1760
+ : "text-muted-foreground hover:bg-accent hover:text-foreground"), children: translate("agentChat.tabs.main") }), childTabs.map((tab) => (_jsxs("div", { ref: tab.id === activeThreadId
1746
1761
  ? activeTabRefCb
1747
1762
  : undefined, className: cn("agent-tab relative flex shrink-0 items-center rounded-md text-[10px] font-medium max-w-[130px]", tab.id === activeThreadId
1748
1763
  ? "bg-accent text-foreground"
1749
- : "text-muted-foreground hover:bg-accent hover:text-foreground"), children: [_jsxs("button", { type: "button", onClick: () => switchThread(tab.id), className: "flex items-center gap-1 px-2 py-1 min-w-0 flex-1 text-start", children: [_jsx("span", { className: "truncate pe-1", children: tab.subAgentName || tab.label }), tab.status === "running" && (_jsx("span", { className: "w-1 h-1 rounded-full bg-muted-foreground/50 shrink-0 animate-pulse" }))] }), _jsx("button", { type: "button", "aria-label": "Close tab", onClick: (e) => {
1764
+ : "text-muted-foreground hover:bg-accent hover:text-foreground"), children: [_jsxs("button", { type: "button", onClick: () => switchThread(tab.id), className: "flex items-center gap-1 px-2 py-1 min-w-0 flex-1 text-start", children: [_jsx("span", { className: "truncate pe-1", children: tab.subAgentName || tab.label }), tab.status === "running" && (_jsx("span", { className: "w-1 h-1 rounded-full bg-muted-foreground/50 shrink-0 animate-pulse" }))] }), _jsx("button", { type: "button", "aria-label": translate("agentChat.tabs.closeTab"), onClick: (e) => {
1750
1765
  e.stopPropagation();
1751
1766
  e.preventDefault();
1752
1767
  closeTab(tab.id);
@@ -1772,7 +1787,9 @@ export function MultiTabAssistantChat({ showTabBar = true, renderHeader, renderO
1772
1787
  display: contentHidden || tabId !== activeThreadId ? "none" : "flex",
1773
1788
  }, children: [_jsx(RunStuckBanner, { threadId: tabId, enabled: tabId === activeThreadId, apiUrl: apiUrl, autoRetry: true, autoRetryOwnerId: browserTabId, hasInFlightWork: () => chatRefs.current.get(tabId)?.hasInFlightWork() ?? false, isAwaitingResponse: () => chatRefs.current.get(tabId)?.isRunning() ?? false, onRetry: () => {
1774
1789
  const handle = chatRefs.current.get(tabId);
1775
- handle?.sendRecoveryMessage("Continue from where you left off and finish my last request. Do not repeat completed work.", "continue");
1790
+ handle?.sendRecoveryMessage(
1791
+ // i18n-ignore -- stable hidden agent instruction.
1792
+ "Continue from where you left off and finish my last request. Do not repeat completed work.", "continue");
1776
1793
  } }), _jsx(AssistantChat, { ...props, dynamicSuggestions: tabDynamicSuggestions, ref: (handle) => {
1777
1794
  if (handle) {
1778
1795
  chatRefs.current.set(tabId, handle);
@@ -1788,7 +1805,7 @@ export function MultiTabAssistantChat({ showTabBar = true, renderHeader, renderO
1788
1805
  // the in-flight team chunk. Disable the composer and show a
1789
1806
  // hint so users know to send via the orchestrator chat instead.
1790
1807
  composerDisabled: Boolean(parentMap[tabId]), composerDisabledPlaceholder: parentMap[tabId]
1791
- ? "Send messages to the orchestrator chat — this sub-agent runs automatically"
1808
+ ? translate("agentChat.composer.subAgentReadOnly")
1792
1809
  : undefined })] }, tabId));
1793
1810
  })] })] }));
1794
1811
  }
@@ -17,11 +17,24 @@ export interface PendingTurnState {
17
17
  }
18
18
  export declare function setActiveRun(state: ActiveRunState): void;
19
19
  export declare function getActiveRun(): ActiveRunState | null;
20
- export declare function updateActiveRunSeq(seq: number, isProgress?: boolean): void;
20
+ /**
21
+ * Advance one run's resume cursor. Identity is required: the previous
22
+ * signature took only `seq` and wrote into whichever run happened to occupy
23
+ * the shared slot, so a second concurrent run silently corrupted the first
24
+ * run's cursor. An unknown run is ignored rather than created — a cursor with
25
+ * no matching stream is indistinguishable from a real one at replay time.
26
+ */
27
+ export declare function updateActiveRunSeq(threadId: string, runId: string, seq: number, isProgress?: boolean): void;
21
28
  /** Whether this browser has received real progress for the matching run recently. */
22
29
  export declare function hasRecentActiveRunProgress(threadId: string | null | undefined, runId: string | null | undefined, thresholdMs: number, now?: number): boolean;
23
30
  export declare function updateActiveRunActivity(toolName: string | null | undefined): void;
24
31
  export declare function getActiveRunActivityTool(threadId: string, runId: string): string | null;
32
+ /**
33
+ * Drop the focused-run pointer. The run's resume cursor is intentionally kept:
34
+ * callers fire this from many unrelated teardown paths, and deleting the
35
+ * cursor here is what previously made a later reconnect replay the run from
36
+ * its first event.
37
+ */
25
38
  export declare function clearActiveRun(): void;
26
39
  export declare function clearActiveRunIfMatches(threadId: string, runId: string): void;
27
40
  export declare function setPendingTurn(state: PendingTurnState): void;
Binary file
@@ -6,6 +6,7 @@ import { getOrCreateAnalyticsSessionId } from "./analytics-session.js";
6
6
  import { captureError } from "./analytics.js";
7
7
  import { agentNativePath } from "./api-path.js";
8
8
  import { formatChatErrorText, normalizeChatError } from "./error-format.js";
9
+ import { createRunStreamToken, preemptRunStream, releaseRunStream, } from "./run-stream-ownership.js";
9
10
  import { AgentAutoContinueSignal, INTERRUPTED_TOOL_RESULT, appendMissingFinalResponseWarning, readSSEStream, settleInterruptedToolCalls, } from "./sse-event-processor.js";
10
11
  import { isDelegatedAgentToolCall, isToolCallInFlight, } from "./tool-display.js";
11
12
  const TEXT_ATTACHMENT_CONTENT_TYPES = new Set([
@@ -1006,6 +1007,26 @@ function snapshotContent(content) {
1006
1007
  ? { ...part }
1007
1008
  : { ...part, args: { ...part.args } });
1008
1009
  }
1010
+ function hasMissingFinalResponseAfterTool(content) {
1011
+ const warning = appendMissingFinalResponseWarning(snapshotContent(content));
1012
+ return warning?.errorCode === "final_response_missing_after_tool";
1013
+ }
1014
+ function missingFinalResponseWarningFromResult(result) {
1015
+ const metadata = result.metadata;
1016
+ const custom = metadata?.custom;
1017
+ if (!custom || typeof custom !== "object")
1018
+ return null;
1019
+ const warning = custom.runWarning;
1020
+ if (!warning || typeof warning !== "object")
1021
+ return null;
1022
+ const warningRecord = warning;
1023
+ if (warningRecord.errorCode !== "final_response_missing_after_tool") {
1024
+ return null;
1025
+ }
1026
+ return {
1027
+ message: typeof warningRecord.message === "string" ? warningRecord.message : "",
1028
+ };
1029
+ }
1009
1030
  function stableJson(value) {
1010
1031
  try {
1011
1032
  return JSON.stringify(value);
@@ -1618,7 +1639,19 @@ export function createAgentChatAdapter(options) {
1618
1639
  activeRun.threadId === threadId &&
1619
1640
  activeRun.runId === runId));
1620
1641
  };
1642
+ // The adapter's own stream outranks AssistantChat's reconnect fallback:
1643
+ // when it attaches to a run, any reconnect reader folding the same run
1644
+ // must stop writing UI state or both folds render at once.
1645
+ const streamOwnershipToken = createRunStreamToken(`adapter:${turnId}`);
1646
+ const takeRunStreamOwnership = () => {
1647
+ if (threadId && runId) {
1648
+ preemptRunStream(threadId, runId, streamOwnershipToken);
1649
+ }
1650
+ };
1621
1651
  const settleTerminalChatRun = () => {
1652
+ if (threadId && runId) {
1653
+ releaseRunStream(threadId, runId, streamOwnershipToken);
1654
+ }
1622
1655
  if (!ownsActiveRunState())
1623
1656
  return;
1624
1657
  if (threadId && runId) {
@@ -1972,10 +2005,12 @@ export function createAgentChatAdapter(options) {
1972
2005
  break;
1973
2006
  }
1974
2007
  updateCurrentRunDispatchMode(reconnectRes.headers.get("X-Dispatch-Mode"));
2008
+ takeRunStreamOwnership();
1975
2009
  for await (const result of readSSEStream(reconnectRes.body, content, toolCallCounter, tabId, (seq, isProgress) => {
1976
2010
  rememberRunSeq(seq);
1977
- if (threadId)
1978
- updateActiveRunSeq(seq, isProgress);
2011
+ if (threadId && runId) {
2012
+ updateActiveRunSeq(threadId, runId, seq, isProgress);
2013
+ }
1979
2014
  }, runId, currentSSEOptions())) {
1980
2015
  const nextResult = withRequestModeMetadata(result);
1981
2016
  if (isTerminalChatModelRunResult(nextResult)) {
@@ -2311,20 +2346,45 @@ export function createAgentChatAdapter(options) {
2311
2346
  }
2312
2347
  attached = true;
2313
2348
  updateCurrentRunDispatchMode(eventsRes.headers.get("X-Dispatch-Mode"));
2349
+ takeRunStreamOwnership();
2350
+ let missingFinalResponseResult = null;
2314
2351
  for await (const result of readSSEStream(eventsRes.body, content, toolCallCounter, tabId, (seq, isProgress) => {
2315
2352
  rememberRunSeq(seq);
2316
- if (threadId)
2317
- updateActiveRunSeq(seq, isProgress);
2353
+ if (threadId && runId) {
2354
+ updateActiveRunSeq(threadId, runId, seq, isProgress);
2355
+ }
2318
2356
  }, runId, currentSSEOptions({
2319
2357
  noProgressTimeoutMs: BACKGROUND_FOLLOW_ATTACH_WATCHDOG_MS,
2320
2358
  actionPreparationStallTimeoutMs: BACKGROUND_FOLLOW_ATTACH_WATCHDOG_MS,
2321
2359
  }))) {
2322
2360
  const nextResult = withRequestModeMetadata(result);
2361
+ if (isDurableBackgroundDispatch() &&
2362
+ missingFinalResponseWarningFromResult(nextResult)) {
2363
+ missingFinalResponseResult = nextResult;
2364
+ continue;
2365
+ }
2323
2366
  if (isTerminalChatModelRunResult(nextResult)) {
2324
2367
  settleTerminalChatRun();
2325
2368
  }
2326
2369
  yield nextResult;
2327
2370
  }
2371
+ if (missingFinalResponseResult) {
2372
+ const warning = missingFinalResponseWarningFromResult(missingFinalResponseResult);
2373
+ const lastContentPart = content.at(-1);
2374
+ if (warning?.message &&
2375
+ lastContentPart?.type === "text" &&
2376
+ lastContentPart.text === warning.message) {
2377
+ content.pop();
2378
+ }
2379
+ if (continueAfterMissingFinalResponse()) {
2380
+ await delay(250, abortSignal);
2381
+ return "client_continue";
2382
+ }
2383
+ settleTerminalChatRun();
2384
+ yield missingFinalResponseResult;
2385
+ clearActiveRun();
2386
+ return "completed";
2387
+ }
2328
2388
  // readSSEStream returned normally: a terminal done/error was
2329
2389
  // consumed and rendered — the turn is over.
2330
2390
  clearActiveRun();
@@ -2614,6 +2674,11 @@ export function createAgentChatAdapter(options) {
2614
2674
  continue;
2615
2675
  }
2616
2676
  }
2677
+ if (hasMissingFinalResponseAfterTool(content) &&
2678
+ continueAfterMissingFinalResponse()) {
2679
+ await delay(250, abortSignal);
2680
+ return "client_continue";
2681
+ }
2617
2682
  yield* emitBackgroundTerminalOutcome(active);
2618
2683
  return "completed";
2619
2684
  }
@@ -2642,6 +2707,9 @@ export function createAgentChatAdapter(options) {
2642
2707
  }
2643
2708
  const seqBeforeAttach = lastSeq;
2644
2709
  const attach = yield* followAttachOnce();
2710
+ if (attach === "client_continue") {
2711
+ return "client_continue";
2712
+ }
2645
2713
  if (attach === "completed" || attach === "aborted") {
2646
2714
  return "completed";
2647
2715
  }
@@ -2964,6 +3032,17 @@ export function createAgentChatAdapter(options) {
2964
3032
  nonAdvancing: !advanced,
2965
3033
  };
2966
3034
  };
3035
+ const continueAfterMissingFinalResponse = () => {
3036
+ const continuation = prepareAutoContinuation(new AgentAutoContinueSignal({ reason: "stream_ended" }));
3037
+ if (!continuation.ok)
3038
+ return false;
3039
+ if (typeof window !== "undefined") {
3040
+ window.dispatchEvent(new CustomEvent("agent-chat:auto-continue", {
3041
+ detail: { tabId },
3042
+ }));
3043
+ }
3044
+ return true;
3045
+ };
2967
3046
  while (true) {
2968
3047
  try {
2969
3048
  runId = null;
@@ -3221,18 +3300,41 @@ export function createAgentChatAdapter(options) {
3221
3300
  clearPendingTurnIfMatches(threadId, turnId);
3222
3301
  setActiveRun({ threadId, runId, turnId, lastSeq: -1 });
3223
3302
  }
3303
+ takeRunStreamOwnership();
3304
+ let missingFinalResponseResult = null;
3224
3305
  for await (const result of readSSEStream(res.body, content, toolCallCounter, tabId, (seq, isProgress) => {
3225
3306
  rememberRunSeq(seq);
3226
3307
  if (runId && threadId) {
3227
- updateActiveRunSeq(seq, isProgress);
3308
+ updateActiveRunSeq(threadId, runId, seq, isProgress);
3228
3309
  }
3229
3310
  }, runId, currentSSEOptions())) {
3230
3311
  const nextResult = withRequestModeMetadata(result);
3312
+ if (isDurableBackgroundDispatch() &&
3313
+ missingFinalResponseWarningFromResult(nextResult)) {
3314
+ missingFinalResponseResult = nextResult;
3315
+ continue;
3316
+ }
3231
3317
  if (isTerminalChatModelRunResult(nextResult)) {
3232
3318
  settleTerminalChatRun();
3233
3319
  }
3234
3320
  yield nextResult;
3235
3321
  }
3322
+ if (isDurableBackgroundDispatch() && missingFinalResponseResult) {
3323
+ const warning = missingFinalResponseWarningFromResult(missingFinalResponseResult);
3324
+ const lastContentPart = content.at(-1);
3325
+ if (warning?.message &&
3326
+ lastContentPart?.type === "text" &&
3327
+ lastContentPart.text === warning.message) {
3328
+ content.pop();
3329
+ }
3330
+ if (continueAfterMissingFinalResponse()) {
3331
+ continue;
3332
+ }
3333
+ settleTerminalChatRun();
3334
+ yield missingFinalResponseResult;
3335
+ clearActiveRun();
3336
+ return;
3337
+ }
3236
3338
  // Run completed normally — clear active run state
3237
3339
  clearActiveRun();
3238
3340
  return;
@@ -1030,6 +1030,12 @@ function exceptionEventProperties(event) {
1030
1030
  ...(event.extra ? { exceptionExtra: event.extra } : {}),
1031
1031
  };
1032
1032
  }
1033
+ function amplitudeEventProperties(name, properties) {
1034
+ if (name !== AGENT_NATIVE_EXCEPTION_EVENT_NAME)
1035
+ return properties;
1036
+ const { exceptionTags: _exceptionTags, exceptionExtra: _exceptionExtra, ...stableProperties } = properties;
1037
+ return stableProperties;
1038
+ }
1033
1039
  /**
1034
1040
  * Resolve browser PostHog config, or `undefined` when error capture should not
1035
1041
  * reach PostHog. Reads the SSR-injected shell config first, then Vite env for
@@ -1557,13 +1563,14 @@ export function trackEvent(name, params) {
1557
1563
  return;
1558
1564
  ensureSentry();
1559
1565
  const props = resolveProps(name, params);
1566
+ const amplitudeProps = amplitudeEventProperties(name, props);
1560
1567
  window.gtag?.("event", name.replace(/\s+/g, "_"), props);
1561
1568
  if (ensureAmplitude()) {
1562
- _amplitudeModule?.track(name, props);
1569
+ _amplitudeModule?.track(name, amplitudeProps);
1563
1570
  }
1564
1571
  else if (_amplitudeApiKey) {
1565
1572
  if (_pendingAmplitudeEvents.length < 100) {
1566
- _pendingAmplitudeEvents.push([name, props]);
1573
+ _pendingAmplitudeEvents.push([name, amplitudeProps]);
1567
1574
  }
1568
1575
  }
1569
1576
  sendAgentNativeAnalytics(name, props);
@@ -7,8 +7,9 @@ import { IconPlus, IconExternalLink } from "@tabler/icons-react";
7
7
  import React, { useState, useEffect, useCallback, useMemo, useRef, } from "react";
8
8
  import { splitMarkdownBlocks } from "../../shared/markdown-block-split.js";
9
9
  import { initialSmoothStreamingGraphemeCount, SMOOTH_STREAMING_COMMIT_INTERVAL_MS, smoothStreamingPunctuationDelayMs, smoothStreamingRevealCount, splitStreamingTextGraphemes, } from "../../shared/streaming-text-smoothing.js";
10
- import { NEW_CHAT_ACTION_HREF } from "../error-format.js";
10
+ import { localizeKnownChatErrorText, NEW_CHAT_ACTION_HREF, } from "../error-format.js";
11
11
  import { HighlightedCodeBlock as SharedHighlightedCodeBlock } from "../HighlightedCodeBlock.js";
12
+ import { useT } from "../i18n.js";
12
13
  import { IframeEmbed, parseEmbedBody } from "../IframeEmbed.js";
13
14
  import { cn } from "../utils.js";
14
15
  import { LEGACY_CHART_SHORTHAND_LANG, LegacyChartShorthandChart, LegacyChartShorthandFallback, parseLegacyChartShorthand, wrapLegacyChartShorthandLines, } from "./legacy-chart-shorthand.js";
@@ -485,11 +486,12 @@ export function SmoothMarkdownText({ text, streaming, resetKey, statusType = "co
485
486
  }
486
487
  // ─── MarkdownText ──────────────────────────────────────────────────────────────
487
488
  export function MarkdownText() {
489
+ const t = useT();
488
490
  const textPart = useMessagePartText();
489
491
  const messageRuntime = useMessageRuntime();
490
492
  const message = messageRuntime.getState();
491
493
  const textStreaming = React.useContext(TextStreamingContext);
492
494
  const isLastAssistantMessage = message.role === "assistant" && message.isLast;
493
495
  const statusType = textPart.status?.type ?? message.status?.type ?? "complete";
494
- return (_jsx(SmoothMarkdownText, { text: textPart.text, streaming: textStreaming && isLastAssistantMessage, resetKey: message.id, statusType: statusType }));
496
+ return (_jsx(SmoothMarkdownText, { text: localizeKnownChatErrorText(textPart.text, t), streaming: textStreaming && isLastAssistantMessage, resetKey: message.id, statusType: statusType }));
495
497
  }
@@ -9,7 +9,7 @@ interface FormattedMessageTimestamp {
9
9
  short: string;
10
10
  full: string;
11
11
  }
12
- export declare function formatMessageTimestamp(value: unknown): FormattedMessageTimestamp | null;
12
+ export declare function formatMessageTimestamp(value: unknown, locale?: string, yesterdayLabel?: string): FormattedMessageTimestamp | null;
13
13
  export declare function MessageTimestamp({ timestamp, className, }: {
14
14
  timestamp: FormattedMessageTimestamp;
15
15
  className?: string;
@@ -184,6 +184,6 @@ export declare function AssistantMessage(): React.JSX.Element | null;
184
184
  export declare function RunningActivityStatus({ label }: {
185
185
  label: string;
186
186
  }): React.JSX.Element;
187
- export declare function ThinkingIndicator({ label, }?: {
187
+ export declare function ThinkingIndicator({ label }?: {
188
188
  label?: string;
189
189
  }): React.JSX.Element;