@kortix/ui 0.14.17 → 0.15.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 (491) hide show
  1. package/README.md +3 -3
  2. package/dist/_vendor/kortix-shared.js +993 -74
  3. package/dist/_vendor/shared/artifact-annotations.d.ts +85 -607
  4. package/dist/_vendor/shared/artifact-comments.d.ts +53 -489
  5. package/dist/_vendor/shared/channel-descriptors.d.ts +20 -1
  6. package/dist/_vendor/shared/channel-message.d.ts +1 -1
  7. package/dist/_vendor/shared/index.d.ts +0 -1
  8. package/dist/_vendor/shared/my-kortix-agent.d.ts +1 -1
  9. package/dist/_vendor/shared/peer-message-prompt.d.ts +7 -1
  10. package/dist/_vendor/shared/project-glyphs.d.ts +103 -20
  11. package/dist/_vendor/shared/space-slug.d.ts +3 -4
  12. package/dist/_vendor/shared/utils/ambiguous-write.d.ts +3 -3
  13. package/dist/_vendor/shared/webhook-signing.d.ts +3 -1
  14. package/dist/access/access/access-dialog-share.d.ts +3 -28
  15. package/dist/access/access/access-dialog-share.js +3 -75
  16. package/dist/artifacts/artifact-frame.js +26 -2
  17. package/dist/artifacts/artifact-session.js +6 -2
  18. package/dist/artifacts/frame-policy.d.ts +2 -9
  19. package/dist/artifacts/frame-policy.js +2 -25
  20. package/dist/customize/agents/agent-instructions.d.ts +8 -0
  21. package/dist/customize/agents/agent-instructions.js +38 -12
  22. package/dist/customize/agents/agent-overview.d.ts +6 -3
  23. package/dist/customize/agents/agent-overview.js +8 -2
  24. package/dist/customize/agents/agent-page-chrome.d.ts +45 -27
  25. package/dist/customize/agents/agent-page-chrome.js +60 -37
  26. package/dist/customize/agents/agent-page.js +88 -99
  27. package/dist/customize/agents/agent-tabs.d.ts +15 -14
  28. package/dist/customize/agents/agent-tabs.js +19 -16
  29. package/dist/customize/agents/agents-page.js +9 -7
  30. package/dist/customize/agents/create-agent-modal.js +1 -1
  31. package/dist/customize/connectors/connector-filter.d.ts +2 -1
  32. package/dist/customize/connectors/connector-filter.js +2 -3
  33. package/dist/customize/connectors/connectors-page.js +15 -24
  34. package/dist/customize/connectors/detail/account-info.js +1 -1
  35. package/dist/customize/connectors/detail/connector-status.d.ts +3 -24
  36. package/dist/customize/connectors/detail/connector-status.js +2 -42
  37. package/dist/customize/connectors/detail/use-connector-detail.d.ts +2 -6
  38. package/dist/customize/connectors/detail/use-connector-detail.js +3 -13
  39. package/dist/customize/connectors/install/install.d.ts +2 -6
  40. package/dist/customize/connectors/install/install.js +2 -16
  41. package/dist/customize/connectors/provider-label.d.ts +4 -17
  42. package/dist/customize/connectors/provider-label.js +4 -37
  43. package/dist/customize/project-settings/project-admin-sections.d.ts +6 -2
  44. package/dist/customize/project-settings/project-admin-sections.js +5 -3
  45. package/dist/customize/project-settings/project-settings-sections.js +1 -1
  46. package/dist/customize/providers/provider-connect.d.ts +6 -15
  47. package/dist/customize/providers/provider-connect.js +5 -36
  48. package/dist/customize/sections/component/channel-access-panel.js +16 -0
  49. package/dist/customize/sections/component/channel-mocks.d.ts +5 -0
  50. package/dist/customize/sections/component/channel-mocks.js +14 -2
  51. package/dist/customize/sections/component/discord-channel-row.d.ts +6 -0
  52. package/dist/customize/sections/component/discord-channel-row.js +48 -0
  53. package/dist/customize/sections/connector-connection-form.d.ts +3 -7
  54. package/dist/customize/sections/connector-connection-form.js +2 -33
  55. package/dist/customize/sections/connector-oauth2-auto.d.ts +3 -33
  56. package/dist/customize/sections/connector-oauth2-auto.js +2 -64
  57. package/dist/customize/sections/gateway-access-tab.js +1 -1
  58. package/dist/customize/sections/gateway-view.d.ts +6 -5
  59. package/dist/customize/sections/gateway-view.js +31 -13
  60. package/dist/customize/sections/llm-provider/constants.d.ts +1 -2
  61. package/dist/customize/sections/llm-provider/constants.js +1 -2
  62. package/dist/customize/sections/llm-provider/utils.d.ts +1 -41
  63. package/dist/customize/sections/llm-provider/utils.js +1 -52
  64. package/dist/customize/sections/view/account-secret-resources-panel.js +4 -1
  65. package/dist/customize/sections/view/agent-editor-catalog.js +0 -5
  66. package/dist/customize/sections/view/channel-settings-patch.js +1 -1
  67. package/dist/customize/sections/view/channels-view.js +26 -9
  68. package/dist/customize/sections/view/connector-connections.d.ts +5 -85
  69. package/dist/customize/sections/view/connector-connections.js +5 -99
  70. package/dist/customize/sections/view/gateway/gateway-logs.d.ts +42 -3
  71. package/dist/customize/sections/view/gateway/gateway-logs.js +212 -15
  72. package/dist/customize/sections/view/gateway/gateway-overview.js +1 -1
  73. package/dist/customize/sections/view/gateway/gateway-routing.d.ts +3 -3
  74. package/dist/customize/sections/view/gateway/gateway-routing.js +81 -200
  75. package/dist/customize/sections/view/gateway/routing-parts.d.ts +101 -0
  76. package/dist/customize/sections/view/gateway/routing-parts.js +154 -0
  77. package/dist/customize/sections/view/gateway/routing-sentence-layout.d.ts +2 -0
  78. package/dist/customize/sections/view/gateway/routing-sentence-layout.js +82 -0
  79. package/dist/customize/sections/view/git-view.js +2 -2
  80. package/dist/customize/sections/view/review-center-connected.js +17 -15
  81. package/dist/customize/sections/view/review-view.d.ts +7 -0
  82. package/dist/customize/sections/view/review-view.js +11 -0
  83. package/dist/customize/sections/view/secret-delivery.js +2 -2
  84. package/dist/customize/sections/view/secrets-view.js +1 -1
  85. package/dist/customize/sections/view/subscription-usage-tab.d.ts +14 -0
  86. package/dist/customize/sections/view/subscription-usage-tab.js +122 -0
  87. package/dist/customize/sections/view/subscription-usage.d.ts +34 -0
  88. package/dist/customize/sections/view/subscription-usage.js +98 -0
  89. package/dist/customize/settings/rail.js +2 -2
  90. package/dist/customize/settings/tabs/experimental-tab.d.ts +2 -2
  91. package/dist/customize/settings/tabs/experimental-tab.js +5 -5
  92. package/dist/customize/settings/tabs/general-tab.js +70 -14
  93. package/dist/customize/shared/capability-library.js +19 -22
  94. package/dist/customize/shared/catalog/catalog-card.d.ts +9 -4
  95. package/dist/customize/shared/catalog/catalog-card.js +3 -3
  96. package/dist/customize/shared/channels-switch-dialog.d.ts +1 -1
  97. package/dist/customize/shared/channels-switch-dialog.js +1 -1
  98. package/dist/customize/shared/customize-tab-bar.d.ts +1 -2
  99. package/dist/customize/shared/customize-tab-bar.js +10 -11
  100. package/dist/customize/shared/feature-gate-screen.js +1 -1
  101. package/dist/customize/triggers/schedule/post-to-field.d.ts +1 -1
  102. package/dist/customize/triggers/schedule/post-to-field.js +2 -2
  103. package/dist/customize/triggers/schedule/trigger-composer-logic.d.ts +1 -1
  104. package/dist/files/drives/conflict-marks.d.ts +28 -0
  105. package/dist/files/drives/conflict-marks.js +39 -0
  106. package/dist/files/drives/session-drives-chip.js +15 -10
  107. package/dist/files/project/components/drive-create-dialog.js +3 -3
  108. package/dist/files/viewer/index.d.ts +1 -1
  109. package/dist/files/viewer/index.js +1 -1
  110. package/dist/i18n/en.d.ts +502 -207
  111. package/dist/i18n/en.js +608 -313
  112. package/dist/i18n/ui-catalog/remaining-ui-translation-keys.generated.js +1 -1
  113. package/dist/index.d.ts +1 -1
  114. package/dist/index.js +1 -1
  115. package/dist/internal/account-hub/sections.d.ts +1 -1
  116. package/dist/internal/branding/branding-provider.d.ts +15 -4
  117. package/dist/internal/branding/branding-provider.js +12 -7
  118. package/dist/internal/capture/use-capture-area.d.ts +5 -1
  119. package/dist/internal/capture/use-capture-area.js +16 -9
  120. package/dist/internal/connector-logo/connector-logo.js +2 -0
  121. package/dist/internal/connector-logo/connector-mark-files.js +1 -0
  122. package/dist/internal/goals/goal-meta.d.ts +50 -3
  123. package/dist/internal/goals/goal-meta.js +144 -9
  124. package/dist/internal/hooks/channels/use-channels-installations.d.ts +7 -2
  125. package/dist/internal/hooks/channels/use-channels-installations.js +31 -1
  126. package/dist/internal/hooks/connectors/use-add-account.d.ts +3 -9
  127. package/dist/internal/hooks/connectors/use-add-account.js +3 -18
  128. package/dist/internal/hooks/connectors/use-connect-link.d.ts +3 -2
  129. package/dist/internal/hooks/connectors/use-connect-link.js +15 -24
  130. package/dist/internal/hooks/connectors/use-pipedream-connect-project.d.ts +3 -56
  131. package/dist/internal/hooks/connectors/use-pipedream-connect-project.js +3 -87
  132. package/dist/internal/hooks/projects/use-new-project-session.d.ts +9 -16
  133. package/dist/internal/hooks/projects/use-new-project-session.js +16 -100
  134. package/dist/internal/hooks/projects/use-project-can-run.d.ts +7 -0
  135. package/dist/internal/hooks/projects/use-project-can-run.js +12 -5
  136. package/dist/internal/hooks/projects/use-restart-project-session.d.ts +0 -1
  137. package/dist/internal/hooks/projects/use-restart-project-session.js +0 -1
  138. package/dist/internal/hooks/use-notification-center.d.ts +11 -8
  139. package/dist/internal/hooks/use-notification-center.js +22 -10
  140. package/dist/internal/icons/discord.d.ts +9 -0
  141. package/dist/internal/icons/discord.js +9 -0
  142. package/dist/internal/layout/connect-mcp-modal.js +1 -1
  143. package/dist/internal/layout/project-capability-nav.js +6 -2
  144. package/dist/internal/layout/project-page-header.d.ts +3 -1
  145. package/dist/internal/layout/project-page-header.js +2 -2
  146. package/dist/internal/lib/account-secret-access.d.ts +1 -41
  147. package/dist/internal/lib/account-secret-access.js +3 -46
  148. package/dist/internal/lib/browser-error-noise.d.ts +1 -1
  149. package/dist/internal/lib/browser-error-noise.js +1 -1
  150. package/dist/internal/lib/browser-noise/rules/expected-states.d.ts +2 -15
  151. package/dist/internal/lib/browser-noise/rules/expected-states.js +6 -56
  152. package/dist/internal/lib/capability-tab-routes.d.ts +3 -3
  153. package/dist/internal/lib/capability-tab-routes.js +11 -3
  154. package/dist/internal/lib/error-handler.js +1 -1
  155. package/dist/internal/lib/llm-providers.d.ts +4 -110
  156. package/dist/internal/lib/llm-providers.js +5 -102
  157. package/dist/internal/lib/navigation/message-link.d.ts +32 -0
  158. package/dist/internal/lib/navigation/message-link.js +51 -0
  159. package/dist/internal/lib/navigation/session-href.d.ts +11 -0
  160. package/dist/internal/lib/navigation/session-href.js +20 -0
  161. package/dist/internal/lib/navigation/session-spawn-urls.d.ts +17 -0
  162. package/dist/internal/lib/navigation/session-spawn-urls.js +26 -0
  163. package/dist/internal/lib/space-scope.d.ts +3 -3
  164. package/dist/internal/lib/space-scope.js +3 -3
  165. package/dist/internal/lib/use-project-feature-flags.js +11 -9
  166. package/dist/internal/lib/web-notifications.d.ts +1 -1
  167. package/dist/internal/lib/web-notifications.js +0 -3
  168. package/dist/internal/notifications/notification-bell.js +1 -3
  169. package/dist/internal/notifications/notification-rows.d.ts +2 -2
  170. package/dist/internal/notifications/notification-rows.js +2 -3
  171. package/dist/internal/session-types/index.d.ts +5 -7
  172. package/dist/internal/session-types/index.js +5 -7
  173. package/dist/internal/stores/active-space-store.d.ts +1 -1
  174. package/dist/internal/stores/active-space-store.js +1 -1
  175. package/dist/internal/stores/kortix-computer-store.d.ts +15 -0
  176. package/dist/internal/stores/kortix-computer-store.js +12 -0
  177. package/dist/lib/routes.d.ts +17 -7
  178. package/dist/lib/routes.js +18 -2
  179. package/dist/markdown/app-link-icons.d.ts +7 -0
  180. package/dist/markdown/app-link-icons.js +20 -0
  181. package/dist/markdown/app-links.d.ts +9 -0
  182. package/dist/markdown/app-links.js +112 -0
  183. package/dist/markdown/doc-editor/doc-attrs.d.ts +28 -0
  184. package/dist/markdown/doc-editor/doc-attrs.js +156 -0
  185. package/dist/markdown/doc-editor/doc-embed.d.ts +6 -0
  186. package/dist/markdown/doc-editor/doc-embed.js +26 -8
  187. package/dist/markdown/doc-editor/doc-extensions.d.ts +10 -0
  188. package/dist/markdown/doc-editor/doc-extensions.js +55 -8
  189. package/dist/markdown/doc-editor/doc-fidelity.d.ts +72 -0
  190. package/dist/markdown/doc-editor/doc-fidelity.js +135 -0
  191. package/dist/markdown/doc-editor/doc-node-view.d.ts +9 -0
  192. package/dist/markdown/doc-editor/doc-node-view.js +29 -0
  193. package/dist/markdown/doc-editor/markdown.d.ts +20 -0
  194. package/dist/markdown/doc-editor/markdown.js +455 -18
  195. package/dist/markdown/markdown-frontmatter.d.ts +0 -3
  196. package/dist/markdown/markdown-frontmatter.js +45 -5
  197. package/dist/markdown/unified-markdown.d.ts +1 -1
  198. package/dist/markdown/unified-markdown.js +129 -10
  199. package/dist/primitives/emoji-picker.js +16 -100
  200. package/dist/primitives/emoji-tint.js +12 -12
  201. package/dist/primitives/entity-avatar.js +14 -9
  202. package/dist/primitives/glyph-face.d.ts +19 -12
  203. package/dist/primitives/glyph-face.js +59 -20
  204. package/dist/primitives/glyph-paths-source.d.ts +7 -0
  205. package/dist/primitives/glyph-paths-source.js +14 -6
  206. package/dist/primitives/glyph-paths.generated.d.ts +1 -1
  207. package/dist/primitives/glyph-paths.generated.js +947 -204
  208. package/dist/primitives/glyph-picker.d.ts +6 -10
  209. package/dist/primitives/glyph-picker.js +147 -98
  210. package/dist/primitives/glyph-registry.js +1604 -1
  211. package/dist/primitives/glyph-tint.d.ts +28 -3
  212. package/dist/primitives/glyph-tint.js +41 -83
  213. package/dist/primitives/kortix-glyphs.d.ts +32 -0
  214. package/dist/primitives/kortix-glyphs.js +157 -0
  215. package/dist/primitives/project-icon-picker.d.ts +8 -1
  216. package/dist/primitives/project-icon-picker.js +13 -5
  217. package/dist/primitives/user-avatar.d.ts +8 -1
  218. package/dist/primitives/user-avatar.js +2 -2
  219. package/dist/providers/ui-provider.d.ts +1 -8
  220. package/dist/session/actions/project-session-list-helpers.d.ts +4 -14
  221. package/dist/session/actions/project-session-list-helpers.js +6 -17
  222. package/dist/session/actions/session-label.d.ts +5 -9
  223. package/dist/session/actions/session-label.js +6 -10
  224. package/dist/session/agents/agent-model.js +4 -0
  225. package/dist/session/agents/agent-state-mark.d.ts +12 -7
  226. package/dist/session/agents/agent-state-mark.js +37 -15
  227. package/dist/session/agents/agent-strip.js +8 -2
  228. package/dist/session/agents/agent-surface.d.ts +81 -0
  229. package/dist/session/agents/agent-surface.js +97 -0
  230. package/dist/session/agents/held-messages.js +7 -4
  231. package/dist/session/agents/legacy-subagent-chat.js +1 -1
  232. package/dist/session/agents/session-peek.js +24 -12
  233. package/dist/session/agents/steer-session.d.ts +2 -0
  234. package/dist/session/agents/steer-session.js +3 -2
  235. package/dist/session/agents/subagent-dialog-content.d.ts +30 -1
  236. package/dist/session/agents/subagent-dialog-content.js +147 -33
  237. package/dist/session/agents/subagent-view.d.ts +15 -5
  238. package/dist/session/agents/subagent-view.js +28 -6
  239. package/dist/session/agents/tasks-panel.js +2 -12
  240. package/dist/session/agents/workflow-run-controls.d.ts +3 -1
  241. package/dist/session/agents/workflow-run-controls.js +12 -7
  242. package/dist/session/composer/ComposerCard.d.ts +7 -1
  243. package/dist/session/composer/ComposerCard.js +74 -9
  244. package/dist/session/composer/agent-selector.d.ts +16 -0
  245. package/dist/session/composer/agent-selector.js +19 -11
  246. package/dist/session/composer/chat-input/chat-input-control.d.ts +64 -0
  247. package/dist/session/composer/chat-input/chat-input-control.js +578 -0
  248. package/dist/session/composer/chat-input/chat-input-overrides.d.ts +76 -0
  249. package/dist/session/composer/chat-input/chat-input-overrides.js +40 -0
  250. package/dist/session/composer/chat-input/chat-input-panes.d.ts +56 -0
  251. package/dist/session/composer/chat-input/chat-input-panes.js +148 -0
  252. package/dist/session/composer/chat-input/chat-input-summary.d.ts +67 -0
  253. package/dist/session/composer/chat-input/chat-input-summary.js +67 -0
  254. package/dist/session/composer/chat-queue-lines.d.ts +20 -0
  255. package/dist/session/composer/chat-queue-lines.js +20 -0
  256. package/dist/session/composer/composer-chat-input.d.ts +8 -1
  257. package/dist/session/composer/composer-chat-input.js +12 -4
  258. package/dist/session/composer/composer-focus-context.d.ts +7 -0
  259. package/dist/session/composer/composer-focus-context.js +9 -0
  260. package/dist/session/composer/composer-toolbar.d.ts +3 -1
  261. package/dist/session/composer/composer-toolbar.js +3 -3
  262. package/dist/session/composer/composer-underbar.d.ts +10 -1
  263. package/dist/session/composer/composer-underbar.js +10 -2
  264. package/dist/session/composer/composer.d.ts +12 -0
  265. package/dist/session/composer/composer.js +55 -1
  266. package/dist/session/composer/editor/composer-editor.d.ts +10 -2
  267. package/dist/session/composer/editor/composer-editor.js +22 -6
  268. package/dist/session/composer/editor/first-visual-line.d.ts +2 -0
  269. package/dist/session/composer/editor/first-visual-line.js +9 -0
  270. package/dist/session/composer/editor/mention-node.js +2 -0
  271. package/dist/session/composer/editor/serialize.js +9 -1
  272. package/dist/session/composer/hooks/use-file-search.d.ts +1 -1
  273. package/dist/session/composer/hooks/use-file-search.js +1 -1
  274. package/dist/session/composer/menus/mention-controller.d.ts +3 -11
  275. package/dist/session/composer/menus/mention-controller.js +56 -16
  276. package/dist/session/composer/menus/mention-menu.d.ts +7 -2
  277. package/dist/session/composer/menus/mention-menu.js +17 -9
  278. package/dist/session/composer/menus/menu-items.d.ts +9 -0
  279. package/dist/session/composer/menus/space-mentions.d.ts +48 -0
  280. package/dist/session/composer/menus/space-mentions.js +83 -0
  281. package/dist/session/composer/prompt-history.d.ts +9 -0
  282. package/dist/session/composer/prompt-history.js +45 -0
  283. package/dist/session/composer/queue-projection.d.ts +2 -0
  284. package/dist/session/composer/queue-projection.js +1 -0
  285. package/dist/session/composer/queued-prompt-list.js +53 -4
  286. package/dist/session/composer/reasoning-effort-selector.d.ts +20 -0
  287. package/dist/session/composer/reasoning-effort-selector.js +3 -3
  288. package/dist/session/composer/types.d.ts +2 -1
  289. package/dist/session/header/session-site-header.js +7 -3
  290. package/dist/session/header/subagent-hover-card.d.ts +7 -4
  291. package/dist/session/header/subagent-hover-card.js +62 -11
  292. package/dist/session/list/session-status-mark.d.ts +42 -0
  293. package/dist/{workspace/sidebar → session/list}/session-status-mark.js +37 -2
  294. package/dist/session/models/model-selector.d.ts +7 -2
  295. package/dist/session/models/model-selector.js +39 -31
  296. package/dist/session/overrides/provider-secret-pool-editor.d.ts +11 -0
  297. package/dist/session/overrides/provider-secret-pool-editor.js +17 -0
  298. package/dist/session/overrides/session-overrides-control.d.ts +5 -0
  299. package/dist/session/overrides/session-overrides-toolbar.js +147 -7
  300. package/dist/session/panel/model-switch-event.d.ts +8 -0
  301. package/dist/session/panel/model-switch-event.js +19 -0
  302. package/dist/session/panel/session-audit-panel.js +3 -2
  303. package/dist/session/panel/session-desktop.js +5 -1
  304. package/dist/session/panel/session-panel-provider.js +1 -1
  305. package/dist/session/panel/shared/use-panel-handoffs.d.ts +2 -2
  306. package/dist/session/panel/shared/use-panel-handoffs.js +21 -2
  307. package/dist/session/participants/session-participants.d.ts +7 -5
  308. package/dist/session/participants/session-participants.js +11 -7
  309. package/dist/session/prompts/ask-deck.d.ts +21 -0
  310. package/dist/session/prompts/ask-deck.js +253 -0
  311. package/dist/session/prompts/session-permission-prompt.d.ts +7 -1
  312. package/dist/session/prompts/session-permission-prompt.js +3 -3
  313. package/dist/session/status/provisioning-failure.d.ts +4 -5
  314. package/dist/session/status/provisioning-failure.js +4 -5
  315. package/dist/session/status/session-load-state.d.ts +0 -1
  316. package/dist/session/status/session-load-state.js +2 -4
  317. package/dist/session/thread/message-parsing.d.ts +0 -1
  318. package/dist/session/thread/message-parsing.js +0 -1
  319. package/dist/session/thread/optimistic-turn.js +11 -2
  320. package/dist/session/thread/session-chat.d.ts +3 -1
  321. package/dist/session/thread/session-chat.js +498 -301
  322. package/dist/session/thread/session-context-metrics.d.ts +0 -1
  323. package/dist/session/thread/session-context-metrics.js +1 -1
  324. package/dist/session/thread/session-context-sub-sessions.js +3 -1
  325. package/dist/session/thread/show-work.d.ts +38 -0
  326. package/dist/session/thread/show-work.js +115 -0
  327. package/dist/session/thread/thread-boot-rows.d.ts +2 -1
  328. package/dist/session/thread/thread-boot-rows.js +7 -3
  329. package/dist/session/thread/transcript-rows.d.ts +36 -0
  330. package/dist/session/thread/transcript.d.ts +55 -2
  331. package/dist/session/thread/transcript.js +264 -33
  332. package/dist/session/thread/typing-indicator.d.ts +21 -0
  333. package/dist/session/thread/typing-indicator.js +46 -0
  334. package/dist/session/tool/shared/infrastructure-contexts.d.ts +12 -0
  335. package/dist/session/tool/shared/infrastructure-contexts.js +6 -0
  336. package/dist/session/tool/tool-part-renderer.d.ts +2 -0
  337. package/dist/session/tool/tool-part-renderer.js +16 -2
  338. package/dist/session/tool/tools/channel-send-card.js +1 -0
  339. package/dist/session/tool/tools/kortix-action-tool.js +8 -1
  340. package/dist/session/tool/tools/multi-agent-tool-bodies.d.ts +19 -0
  341. package/dist/session/tool/tools/multi-agent-tool-bodies.js +34 -13
  342. package/dist/session/tool/tools/session-spawn-urls.d.ts +1 -16
  343. package/dist/session/tool/tools/session-spawn-urls.js +4 -26
  344. package/dist/session/tool/tools/task-tool.d.ts +5 -18
  345. package/dist/session/tool/tools/task-tool.js +47 -86
  346. package/dist/session/tool/tools/workflow-progress.d.ts +14 -18
  347. package/dist/session/tool/tools/workflow-progress.js +24 -179
  348. package/dist/session/tool/tools/workflow-result-text.d.ts +15 -0
  349. package/dist/session/tool/tools/workflow-result-text.js +34 -0
  350. package/dist/session/tool/tools/workflow-run-card.d.ts +35 -0
  351. package/dist/session/tool/tools/workflow-run-card.js +157 -0
  352. package/dist/session/tool/tools/workflow-tool.js +45 -58
  353. package/dist/session/turn/activity-burst.d.ts +2 -2
  354. package/dist/session/turn/activity-burst.js +11 -5
  355. package/dist/session/turn/answered-question-step.d.ts +29 -0
  356. package/dist/session/turn/answered-question-step.js +48 -3
  357. package/dist/session/turn/channel-brand.js +4 -0
  358. package/dist/session/turn/message-author.d.ts +13 -8
  359. package/dist/session/turn/message-author.js +34 -16
  360. package/dist/session/turn/notice-batch-group.d.ts +4 -4
  361. package/dist/session/turn/notice-batch-group.js +5 -8
  362. package/dist/session/turn/peer-message-row.d.ts +15 -0
  363. package/dist/session/turn/peer-message-row.js +39 -30
  364. package/dist/session/turn/subagent-notice-row.d.ts +16 -1
  365. package/dist/session/turn/subagent-notice-row.js +47 -35
  366. package/dist/session/turn/throttled-markdown.js +4 -1
  367. package/dist/session/turn/turn-work-accordion.d.ts +10 -3
  368. package/dist/session/turn/turn-work-accordion.js +18 -11
  369. package/dist/session/turn/user-message.js +17 -43
  370. package/dist/session/turn/voice-turn.d.ts +22 -0
  371. package/dist/session/turn/voice-turn.js +32 -0
  372. package/dist/session/voice/call-audio.d.ts +32 -0
  373. package/dist/session/voice/call-audio.js +146 -0
  374. package/dist/session/voice/call-ring.d.ts +10 -0
  375. package/dist/session/voice/call-ring.js +52 -0
  376. package/dist/session/voice/screen-share.d.ts +24 -0
  377. package/dist/session/voice/screen-share.js +75 -0
  378. package/dist/session/voice/use-voice-call.d.ts +15 -0
  379. package/dist/session/voice/use-voice-call.js +217 -0
  380. package/dist/session/voice/voice-call-card.d.ts +6 -0
  381. package/dist/session/voice/voice-call-card.js +113 -0
  382. package/dist/session/voice/voice-call-state.d.ts +99 -0
  383. package/dist/session/voice/voice-call-state.js +104 -0
  384. package/dist/session/voice/voice-call-store.d.ts +22 -0
  385. package/dist/session/voice/voice-call-store.js +10 -0
  386. package/dist/session/voice/voice-call-url.d.ts +24 -0
  387. package/dist/session/voice/voice-call-url.js +33 -0
  388. package/dist/session/voice/voice-call.d.ts +11 -0
  389. package/dist/session/voice/voice-call.js +51 -0
  390. package/dist/styles/components.css +33 -0
  391. package/dist/styles/theme.css +26 -0
  392. package/dist/styles.css +1 -1
  393. package/dist/workspace/admin/project-admin-dashboard.d.ts +1 -1
  394. package/dist/workspace/admin/project-admin-dashboard.js +21 -13
  395. package/dist/workspace/index.d.ts +3 -2
  396. package/dist/workspace/index.js +2 -1
  397. package/dist/workspace/layout/project-home.js +13 -14
  398. package/dist/workspace/layout/use-project-home-send.d.ts +2 -0
  399. package/dist/workspace/layout/use-project-home-send.js +5 -3
  400. package/dist/workspace/memory/company-memory-page.d.ts +1 -1
  401. package/dist/workspace/memory/company-memory-page.js +1 -1
  402. package/dist/workspace/new/use-creatable-accounts.js +13 -4
  403. package/dist/workspace/projects/modal/project-icon-field.js +49 -34
  404. package/dist/workspace/review/review-center.d.ts +4 -1
  405. package/dist/workspace/review/review-center.js +6 -3
  406. package/dist/workspace/sessions/project-sessions-helpers.js +1 -1
  407. package/dist/workspace/sessions/project-sessions-view.js +1 -1
  408. package/dist/workspace/sessions/session-row.js +6 -4
  409. package/dist/workspace/sessions/sessions-toolbar.d.ts +1 -1
  410. package/dist/workspace/sessions/sessions-toolbar.js +4 -4
  411. package/dist/workspace/sidebar/footer/project-manifest-issues-alert.d.ts +1 -1
  412. package/dist/workspace/sidebar/footer/project-manifest-issues-alert.js +4 -3
  413. package/dist/workspace/sidebar/footer/project-memory-nav.d.ts +1 -1
  414. package/dist/workspace/sidebar/footer/project-memory-nav.js +1 -1
  415. package/dist/workspace/sidebar/project-nav-items.js +2 -5
  416. package/dist/workspace/sidebar/project-session-list.d.ts +7 -1
  417. package/dist/workspace/sidebar/project-session-list.js +64 -24
  418. package/dist/workspace/sidebar/project-sidebar.js +10 -7
  419. package/dist/workspace/sidebar/project-spaces-nav.d.ts +7 -3
  420. package/dist/workspace/sidebar/project-spaces-nav.js +77 -46
  421. package/dist/workspace/sidebar/session-brief-hover-card.d.ts +4 -2
  422. package/dist/workspace/sidebar/session-brief-hover-card.js +47 -28
  423. package/dist/workspace/sidebar/session-filter-menu.js +1 -0
  424. package/dist/workspace/sidebar/session-group-sections.js +12 -4
  425. package/dist/workspace/sidebar/session-grouping.d.ts +4 -0
  426. package/dist/workspace/sidebar/session-grouping.js +2 -0
  427. package/dist/workspace/sidebar/session-source-icons.js +2 -0
  428. package/dist/workspace/sidebar/sidebar-more-group.d.ts +13 -0
  429. package/dist/workspace/sidebar/sidebar-more-group.js +27 -0
  430. package/dist/workspace/space/space-blocks.d.ts +3 -1
  431. package/dist/workspace/space/space-blocks.js +4 -7
  432. package/dist/workspace/space/space-page.d.ts +4 -6
  433. package/dist/workspace/space/space-page.js +12 -26
  434. package/dist/workspace/space/space-tab-panels.d.ts +14 -1
  435. package/dist/workspace/space/space-tab-panels.js +12 -21
  436. package/dist/workspace/space/space-templates.d.ts +4 -5
  437. package/dist/workspace/space/space-templates.js +2 -7
  438. package/dist/workspace/space/use-space-filter.d.ts +1 -1
  439. package/dist/workspace/space/use-space-filter.js +1 -1
  440. package/dist/workspace/spaces/channels-onboarding.d.ts +2 -2
  441. package/dist/workspace/spaces/channels-onboarding.js +4 -3
  442. package/dist/workspace/spaces/create-channel-dialog.js +4 -2
  443. package/dist/workspace/spaces/principal-card.d.ts +71 -0
  444. package/dist/workspace/spaces/principal-card.js +246 -0
  445. package/dist/workspace/spaces/space-auto-open.d.ts +8 -0
  446. package/dist/workspace/spaces/space-auto-open.js +18 -0
  447. package/dist/workspace/spaces/space-avatar.d.ts +44 -0
  448. package/dist/workspace/spaces/space-avatar.js +41 -0
  449. package/dist/workspace/spaces/space-details-panel.d.ts +26 -0
  450. package/dist/workspace/spaces/space-details-panel.js +119 -0
  451. package/dist/workspace/spaces/space-identity.d.ts +49 -0
  452. package/dist/workspace/spaces/space-identity.js +104 -0
  453. package/dist/workspace/spaces/space-members.js +1 -1
  454. package/dist/workspace/spaces/space-mention-source.d.ts +12 -0
  455. package/dist/workspace/spaces/space-mention-source.js +78 -0
  456. package/dist/workspace/spaces/space-people.d.ts +29 -0
  457. package/dist/workspace/spaces/space-people.js +87 -0
  458. package/dist/workspace/spaces/space-roster.d.ts +3 -2
  459. package/dist/workspace/spaces/space-roster.js +7 -4
  460. package/dist/workspace/spaces/space-tab-list.d.ts +37 -0
  461. package/dist/workspace/spaces/space-tab-list.js +82 -0
  462. package/dist/workspace/spaces/space-tabs.d.ts +74 -0
  463. package/dist/workspace/spaces/space-tabs.js +199 -0
  464. package/dist/workspace/spaces/space-threads-tab.js +1 -1
  465. package/dist/workspace/spaces/space-timeline-view.js +126 -17
  466. package/dist/workspace/spaces/space-timeline.d.ts +44 -9
  467. package/dist/workspace/spaces/space-timeline.js +120 -12
  468. package/dist/workspace/spaces/space-view.d.ts +19 -12
  469. package/dist/workspace/spaces/space-view.js +201 -67
  470. package/dist/workspace/spaces/use-personal-space-name.d.ts +2 -0
  471. package/dist/workspace/spaces/use-personal-space-name.js +10 -0
  472. package/package.json +17 -13
  473. package/skills/kortix-ui/SKILL.md +3 -3
  474. package/skills/kortix-ui/references/custom-dashboard.md +3 -4
  475. package/skills/kortix-ui/references/modules.md +4 -4
  476. package/dist/_vendor/shared/room-prompt.d.ts +0 -66
  477. package/dist/customize/agents/agent-section-rail.d.ts +0 -21
  478. package/dist/customize/agents/agent-section-rail.js +0 -23
  479. package/dist/internal/hooks/projects/use-warm-project-session.d.ts +0 -270
  480. package/dist/internal/hooks/projects/use-warm-project-session.js +0 -362
  481. package/dist/internal/hooks/projects/warm-session-seed.d.ts +0 -66
  482. package/dist/internal/hooks/projects/warm-session-seed.js +0 -80
  483. package/dist/internal/hooks/projects/warm-session-taken-registry.d.ts +0 -61
  484. package/dist/internal/hooks/projects/warm-session-taken-registry.js +0 -141
  485. package/dist/workspace/sidebar/footer/project-rooms-nav.d.ts +0 -9
  486. package/dist/workspace/sidebar/footer/project-rooms-nav.js +0 -32
  487. package/dist/workspace/sidebar/session-status-mark.d.ts +0 -19
  488. package/dist/workspace/space/space-room.d.ts +0 -20
  489. package/dist/workspace/space/space-room.js +0 -27
  490. /package/dist/{workspace/sidebar → session/list}/session-list-chrome.d.ts +0 -0
  491. /package/dist/{workspace/sidebar → session/list}/session-list-chrome.js +0 -0
@@ -1,5 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { ModelSwitchHistory } from '../panel/model-switch-event.js';
3
4
  import { uiRoutes } from '../../lib/routes.js';
4
5
  import { isQuestionTool } from '@kortix/sdk';
5
6
  import { SessionApprovalPrompt } from '../prompts/session-approval-prompt.js';
@@ -10,18 +11,20 @@ import { useTranslations } from '../../i18n/index.js';
10
11
  import { errorMessageOf, isDeliveredButDisconnected } from '../../internal/lib/delivered-but-disconnected.js';
11
12
  import { useQueuedDraftStore, useQueuedDrafts } from '../composer/stores/queued-draft-store.js';
12
13
  import { SESSION_LOG_MINOR, SESSION_LOG_SCHEMA, listSessionPrompts, sessionLogOfV1Rows, sessionLogPromptMessage, sessionLogRetrying, sessionLogTurns, fetchSessionAttachment, sessionLogFullTextPlan, sessionLogHarnessSwitches, sessionLogRestoreNotice, sessionLogWithFullTexts, } from '@kortix/sdk';
13
- import { useProjectSession, useSessionLogOlder, useSessionLogRecord, useSessionLogThread, useSessionMessageAuthors, useSessionModelUsage, useSessionParticipants, } from '@kortix/sdk/react';
14
+ import { useProjectSession, useSessionLogOlder, useSessionLogRecord, useSessionLogThread, useSessionMessageAuthors, useSessionParticipants, useSessionModelUsage, } from '@kortix/sdk/react';
14
15
  import { ArrowBendUpLeftIcon, CaretDownIcon, StackIcon as Layers, } from '@phosphor-icons/react';
15
16
  import { jumpToOutcome } from '../outcomes/jump-to-outcome.js';
16
17
  import { useIsMobile, useIsPhone } from '../../hooks/use-mobile.js';
17
- import { useUiLink, useUiPathname, useUiRouter, useUiShallowNavigate, useUiSearchParams, useUiViewerId, } from '../../providers/ui-provider.js';
18
+ import { useUiLink, useUiPathname, useUiRouter, useUiShallowNavigate, useUiSearchParams, useUiViewer, useUiViewerId, } from '../../providers/ui-provider.js';
18
19
  import { useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
19
20
  import { TranscriptRowsContext } from './transcript-rows.js';
20
21
  import { AgentBusyRow, PendingPromptRows } from './thread-boot-rows.js';
21
22
  import { createPortal } from 'react-dom';
22
- import { AUTHOR_RETRY_DELAYS_MS, authorForTurn, awaitsAgent, missingAuthorKey, resolveTranscriptAuthors, rewindableMessageIds, showAuthorName, stoppedByName, } from '../turn/message-author.js';
23
+ import { AUTHOR_RETRY_DELAYS_MS, authorForTurn, awaitsAgent, missingAuthorKey, participantAuthor, resolveTranscriptAuthors, rewindableMessageIds, stoppedByName, viewerAuthor, } from '../turn/message-author.js';
23
24
  import { stopRefusalMessage } from '../status/stop-refusal.js';
24
25
  import { QueuedPromptList } from '../composer/queued-prompt-list.js';
26
+ import { ComposerAutoFocusContext } from '../composer/composer-focus-context.js';
27
+ import { ChatQueueLines } from '../composer/chat-queue-lines.js';
25
28
  import { runtimePermissionLocksComposer } from '../composer/send-blockers.js';
26
29
  import { SessionPrintHeader } from '../print/session-print-header.js';
27
30
  import { useSessionPrint } from '../print/use-session-print.js';
@@ -52,7 +55,11 @@ import { claimFirstTurnRow } from '../composer/inbox-row-claims.js';
52
55
  import { OptimisticTurn } from './optimistic-turn.js';
53
56
  import { inboxHoldsLivePrompt } from '../composer/inbox-live-prompt.js';
54
57
  import { SessionOutcomesProvider } from '../outcomes/session-outcomes-provider.js';
58
+ import { deleteMessageLinkParams, readMessageLinkParams, resolveMessageLinkTurn } from '../../internal/lib/navigation/message-link.js';
59
+ /** How long a message link waits for the transcript's turns to mount before it jumps anyway. */
60
+ const MESSAGE_LINK_MOUNT_WAIT_MS = 8_000;
55
61
  import { SessionOverridesComposer } from '../overrides/session-overrides-composer.js';
62
+ import { inheritedModelFor } from '../composer/chat-input/chat-input-summary.js';
56
63
  import { QuestionPrompt, } from '../prompts/question-prompt.js';
57
64
  import { SESSION_TRANSCRIPT_CLASS, SessionBodyRow } from './session-body.js';
58
65
  import { SessionContextModal } from './session-context-modal.js';
@@ -73,6 +80,7 @@ import { ChatMinimap } from './chat-minimap.js';
73
80
  import { usePlanInChat } from './plan-surface.js';
74
81
  import { SessionStartingLoader } from '../status/session-starting-loader.js';
75
82
  import { ToolActivateContext } from '../tool/tool-renderers.js';
83
+ import { AgentActivateContext } from '../tool/shared/infrastructure-contexts.js';
76
84
  import { ReadOnlySessionContext } from '../tool/shared/infrastructure-contexts.js';
77
85
  import { firstPromptAttachments, retainSentAttachmentPreviews, sentAttachmentsForTurn, } from '../composer/sent-attachment-previews.js';
78
86
  import { buildOptimisticPromptTextWithUploads, promptFileParts, sentAttachmentsOf, } from '../composer/uploaded-file-refs.js';
@@ -94,7 +102,7 @@ import { getRetryInfo } from '../../internal/session-types/index.js';
94
102
  import { useModelPricingLookup } from '../../internal/lib/model-pricing.js';
95
103
  import { isAbortError, latestPromptModel, SESSION_NOTICE, turnEndNotice } from '@kortix/sdk';
96
104
  import { failureShownByTurn, failureSupersededByTurn, persistedFailureText, } from './persisted-turn-failure.js';
97
- import { abandonOptimisticSend, applyOptimisticAbort, ascendingId, awaitAbortSettlement, beginOptimisticSend, classifySendError, clearStartStash, formatModelString, formatPromptModel, markOptimisticSendDispatched, markOptimisticSendInboxBacked, mintSessionWireMessageId, readStartStash, recoverFromSendFailure, rejectQuestion, replyToPermission, replyToQuestion, requestRuntimeReconnect, startSessionWithPrompt, useAbortRuntimeSession, useExecuteRuntimeCommand, useProjectConfig, useRuntimeAgents, useProjectSpaces, useRuntimeBootStalled, useRuntimeCommands, useRuntimeConfig, useRuntimeConnectionStore, useRuntimePendingStore, useRuntimePhase, useRuntimeProviders, useRuntimeReady, useRuntimeSession, useRuntimeSessions, useRuntimeSupports, useSessionModelSelection, useSessionPrompts, useSessionStateStore, useSessionSync, useSessionTurnOutcome, useSessionWorking, useSessionWorkingStore, } from '@kortix/sdk/react';
105
+ import { abandonOptimisticSend, applyOptimisticAbort, ascendingId, awaitAbortSettlement, beginOptimisticSend, classifySendError, clearStartStash, formatModelString, formatPromptModel, markOptimisticSendDispatched, markOptimisticSendInboxBacked, mintSessionWireMessageId, readStartStash, recoverFromSendFailure, rejectQuestion, replyToPermission, replyToQuestion, requestRuntimeReconnect, startSessionWithPrompt, useAbortRuntimeSession, useExecuteRuntimeCommand, useProjectConfig, useRuntimeAgents, useProjectSpaces, useRuntimeBootStalled, useRuntimeCommands, useRuntimeConfig, useRuntimeConnectionStore, useRuntimePendingStore, useRuntimePhase, useRuntimeProviders, useRuntimeReady, useRuntimeSession, useRuntimeSessions, useRuntimeSupports, useSessionModelSelection, useSessionPrompts, useSessionStateStore, useSessionSync, useSessionTurnOutcome, useSessionWorking, useSessionWorkingStore, useAnswerSessionAsk, useSessionNeedsYou, } from '@kortix/sdk/react';
98
106
  import { useStableCallback } from '../../internal/hooks/use-stable-callback.js';
99
107
  import { useReloadForensics } from '../status/reload-forensics.js';
100
108
  import { resolveLastTurnWorking, serverHoldsOpenTurn, sessionComposerReadiness, } from '../composer/session-composer-readiness.js';
@@ -106,7 +114,7 @@ import { HELD_COMMAND_ROW_PREFIX, canReleaseHeldCommand, heldCommandRows, } from
106
114
  import { useSessionHistoryViewStore } from '../../internal/stores/session-history-view-store.js';
107
115
  import { downloadBlob } from '../../internal/lib/utils/download.js';
108
116
  import { RestoreNotice, hasOutOfContext } from './session-history.js';
109
- import { TranscriptTurnRow, strandedPromptIds, optimisticAnswersCache, promptTexts, resolveTurnError, } from './transcript.js';
117
+ import { TranscriptTurnRow, isAgentNoticeTurn, strandedPromptIds, optimisticAnswersCache, promptTexts, resolveTurnError, } from './transcript.js';
110
118
  export { SessionReportCard, deriveTurnErrorAbortState, deriveTurnErrorPresentation } from './transcript.js';
111
119
  // ============================================================================
112
120
  // Sub-Session Breadcrumb
@@ -185,10 +193,11 @@ function hostNotice(notice, notices) {
185
193
  const key = Object.keys(SESSION_NOTICE).find((candidate) => SESSION_NOTICE[candidate] === notice);
186
194
  return (key && notices[key]) || notice;
187
195
  }
188
- export function SessionChat({ sessionId, projectSessionId, sessionState, projectId, boundAgentName, headerLeadingAction, hideHeader, readOnly, composerPlaceholder, inputReplacement, initialScrollTop, savedHistoryScope, onContentReady, deferComposerFocus, hostQuote, }) {
196
+ export function SessionChat({ sessionId, projectSessionId, sessionState, projectId, boundAgentName, headerLeadingAction, hideHeader, transparent = false, readOnly, composerPlaceholder, inputReplacement, initialScrollTop, savedHistoryScope, onContentReady, deferComposerFocus, hostQuote, }) {
189
197
  const tHardcodedUi = useTranslations('hardcodedUi');
190
198
  // A channel's thread panel: turns are message rows, full width, end-anchored.
191
199
  const rowsContext = useContext(TranscriptRowsContext);
200
+ const composerAutoFocus = useContext(ComposerAutoFocusContext);
192
201
  const transcriptRows = rowsContext !== null;
193
202
  const isMobile = useIsMobile();
194
203
  const isPhone = useIsPhone();
@@ -228,6 +237,17 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
228
237
  track('panel_opened', { source: 'chat_tool' });
229
238
  }, [sessionId, setSidePanelView, focusToolCall]);
230
239
  const toolActivate = readOnly || disableToolNavigation ? null : handleToolActivate;
240
+ // Clicking an agent (a sub-agent row, its finish notice, a workflow agent, the
241
+ // agents line) opens that agent's session in the side panel, beside the chat.
242
+ const focusAgent = useKortixComputerStore((s) => s.focusAgent);
243
+ const handleAgentActivate = useCallback((agent) => {
244
+ const wasOpen = useKortixComputerStore.getState().isSidePanelOpen;
245
+ setSidePanelView(sessionId, 'actions');
246
+ focusAgent(agent);
247
+ if (!wasOpen)
248
+ track('panel_opened', { source: 'chat_agent' });
249
+ }, [sessionId, setSidePanelView, focusAgent]);
250
+ const agentActivate = readOnly || disableToolNavigation ? null : handleAgentActivate;
231
251
  // ---- Context modal ----
232
252
  const [contextModalOpen, setContextModalOpen] = useState(false);
233
253
  // The composer's `/compact` row opens this instance; the header keeps its
@@ -412,8 +432,15 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
412
432
  threadRef.current = thread;
413
433
  }, [thread]);
414
434
  const messagesLoading = syncMessagesLoading;
415
- // Who wrote each user message. A one-person session stays unlabelled.
435
+ // Who wrote each user message: every member message shows its sender's
436
+ // avatar from the first frame, one-person session included, so nothing
437
+ // moves when a second person joins.
416
438
  const viewerId = useUiViewerId();
439
+ const viewer = useUiViewer();
440
+ const viewerAsAuthor = useMemo(() => viewerAuthor(viewer), [viewer]);
441
+ // Wire ids this tab sent. Their recorded author arrives a moment after the
442
+ // bubble paints, so the viewer's avatar stands in until then.
443
+ const sentHereIds = useRef(new Set());
417
444
  const Link = useUiLink();
418
445
  // Only a user message adds an author, so only user messages key the refetch.
419
446
  const userMessageIds = useMemo(() => (messages ?? []).filter((m) => m.role === 'user').map((m) => m.message_id), [messages]);
@@ -422,12 +449,18 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
422
449
  const turnOutcome = useSessionTurnOutcome(projectId ?? '', projectSessionId ?? '');
423
450
  // A stop adds no message but does add a name ("Stopped by"): the turn that
424
451
  // ended keys the read too, so the stopper shows when that turn ends.
425
- const { data: messageAuthors, refetch: refetchMessageAuthors } = useSessionMessageAuthors(projectId, projectSessionId, `${newestUserMessageId}|${turnOutcome.last_ended?.turn_token ?? ''}`);
452
+ const { data: messageAuthors, isLoading: messageAuthorsLoading, refetch: refetchMessageAuthors, } = useSessionMessageAuthors(projectId, projectSessionId, `${newestUserMessageId}|${turnOutcome.last_ended?.turn_token ?? ''}`);
426
453
  const transcriptAuthors = useMemo(() => resolveTranscriptAuthors(userMessageIds, messageAuthors), [userMessageIds, messageAuthors]);
427
- // A session two or more people can open reads as a group chat from its first
428
- // prompt: every author shows, the viewer included. Same cache as the header.
454
+ // The user messages on screen when this session's first authors read
455
+ // landed. A message after them arrived live: the drain may re-mint its id
456
+ // and the ledger records it a moment later, so its avatar slot is held.
457
+ const [loadedUserIds, setLoadedUserIds] = useState(null);
458
+ if (messageAuthors && loadedUserIds?.sessionId !== sessionId) {
459
+ setLoadedUserIds({ sessionId, ids: new Set(userMessageIds) });
460
+ }
461
+ // Names a queued prompt's sender before the authors read lists it. Same
462
+ // cache as the header.
429
463
  const { data: sessionParticipants } = useSessionParticipants(projectId, projectSessionId);
430
- const groupChat = transcriptAuthors.multiAuthor || !!sessionParticipants?.multi_user;
431
464
  // Project sessions use the server-side project agent roster. A sub-agent's
432
465
  // chat has no projectId, but runs inside the parent scope's project: its
433
466
  // roster is that project's. Only a chat with neither falls back to the
@@ -460,14 +493,19 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
460
493
  ...promptInbox.prompts.flatMap((prompt) => [prompt.message_id, prompt.wire_message_id ?? '']),
461
494
  ]);
462
495
  const authorRetry = useRef({ key: '', count: 0 });
496
+ // The missing set the retries gave up on: a live message still unattributed
497
+ // then stops holding its avatar slot.
498
+ const [authorsGaveUp, setAuthorsGaveUp] = useState('');
463
499
  useEffect(() => {
464
500
  if (!missingAuthors)
465
501
  return;
466
502
  if (authorRetry.current.key !== missingAuthors)
467
503
  authorRetry.current = { key: missingAuthors, count: 0 };
468
504
  const delay = AUTHOR_RETRY_DELAYS_MS[authorRetry.current.count];
469
- if (delay === undefined)
505
+ if (delay === undefined) {
506
+ setAuthorsGaveUp(missingAuthors);
470
507
  return;
508
+ }
471
509
  const timer = setTimeout(() => {
472
510
  authorRetry.current.count += 1;
473
511
  void refetchMessageAuthors();
@@ -1344,8 +1382,30 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
1344
1382
  // ---- Pending permissions & questions ----
1345
1383
  const allPermissions = useRuntimePendingStore((s) => s.permissions);
1346
1384
  const allQuestions = useRuntimePendingStore((s) => s.questions);
1347
- const pendingPermissions = useMemo(() => sessionState?.permissions ??
1385
+ const livePermissions = useMemo(() => sessionState?.permissions ??
1348
1386
  Object.values(allPermissions).filter((p) => p.sessionID === sessionId), [sessionState?.permissions, allPermissions, sessionId]);
1387
+ // Asks that parked: nobody answered live, the agent went on, and the ask
1388
+ // waits server-side (Review, "Needs you"). They render with the same cards
1389
+ // and are decided through the asks API, which resumes the session that
1390
+ // asked (a hidden worker's asks show here too). Live asks keep their cards.
1391
+ const parkedAsks = useSessionNeedsYou(projectId ?? '', projectSessionId ?? '', {
1392
+ enabled: Boolean(projectId && projectSessionId),
1393
+ }).asks;
1394
+ const parkedAskIdByRequest = useMemo(() => new Map(parkedAsks.filter((ask) => ask.kind !== 'approval').map((ask) => [ask.request_id, ask.id])), [parkedAsks]);
1395
+ const pendingPermissions = useMemo(() => {
1396
+ const live = new Set(livePermissions.map((p) => p.id));
1397
+ const parked = parkedAsks
1398
+ .filter((ask) => ask.kind === 'permission' && ask.permission && !live.has(ask.request_id))
1399
+ .map((ask) => ({
1400
+ id: ask.request_id,
1401
+ sessionID: sessionId,
1402
+ permission: ask.permission.permission,
1403
+ patterns: ask.permission.patterns,
1404
+ metadata: ask.permission.args && typeof ask.permission.args === 'object' ? ask.permission.args : {},
1405
+ always: ['*'],
1406
+ }));
1407
+ return parked.length ? [...livePermissions, ...parked] : livePermissions;
1408
+ }, [livePermissions, parkedAsks, sessionId]);
1349
1409
  const suppressedQuestionIdsRef = useRef(new Map());
1350
1410
  const suppressQuestionFor = useCallback((requestId, ms = 15000) => {
1351
1411
  suppressedQuestionIdsRef.current.set(requestId, Date.now() + ms);
@@ -1360,8 +1420,15 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
1360
1420
  }
1361
1421
  return true;
1362
1422
  }, []);
1363
- const pendingQuestions = useMemo(() => (sessionState?.questions ??
1423
+ const liveQuestions = useMemo(() => (sessionState?.questions ??
1364
1424
  Object.values(allQuestions).filter((q) => q.sessionID === sessionId)).filter((q) => !isQuestionSuppressed(q.id)), [sessionState?.questions, allQuestions, sessionId, isQuestionSuppressed]);
1425
+ const pendingQuestions = useMemo(() => {
1426
+ const live = new Set(liveQuestions.map((q) => q.id));
1427
+ const parked = parkedAsks
1428
+ .filter((ask) => ask.kind === 'question' && ask.question && !live.has(ask.request_id) && !isQuestionSuppressed(ask.request_id))
1429
+ .map((ask) => ({ id: ask.request_id, sessionID: sessionId, questions: ask.question.questions }));
1430
+ return parked.length ? [...liveQuestions, ...parked] : liveQuestions;
1431
+ }, [liveQuestions, parkedAsks, sessionId, isQuestionSuppressed]);
1365
1432
  /**
1366
1433
  * The runtime is parked on an answer only the user can give.
1367
1434
  *
@@ -1377,7 +1444,8 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
1377
1444
  * come back the instant the agent is running again, not a third of a second
1378
1445
  * later.
1379
1446
  */
1380
- const awaitingUserInput = pendingQuestions.length > 0 || pendingPermissions.length > 0;
1447
+ // Live asks only: a parked ask no longer holds the turn.
1448
+ const awaitingUserInput = liveQuestions.length > 0 || livePermissions.length > 0;
1381
1449
  const QUESTION_PROMPT_ANIMATION_MS = 320;
1382
1450
  const activePendingQuestion = pendingQuestions[0] ?? null;
1383
1451
  // A new question docks over the bottom of the transcript, and answering it
@@ -1867,6 +1935,9 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
1867
1935
  * 1.5k "two children with the same key" errors in one churn). The origin
1868
1936
  * key goes to the FIRST claimant; any other turn falls back to its own id.
1869
1937
  */
1938
+ // Turns whose prompt is another agent's notice: the work continues across
1939
+ // them, so they sit a continuation's distance below the turn above.
1940
+ const agentNoticeTurnIds = useMemo(() => new Set(turns.filter((turn) => isAgentNoticeTurn(turn)).map((turn) => turn.id)), [turns]);
1870
1941
  const turnRenderKeys = useMemo(() => {
1871
1942
  const keys = new Map();
1872
1943
  const used = new Set();
@@ -1932,7 +2003,15 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
1932
2003
  // ---- Permission/question reply handlers ----
1933
2004
  const removePermission = useRuntimePendingStore((s) => s.removePermission);
1934
2005
  const removeQuestion = useRuntimePendingStore((s) => s.removeQuestion);
2006
+ const answerParkedAsk = useAnswerSessionAsk(projectId ?? '');
1935
2007
  const handlePermissionReply = useCallback(async (requestId, reply) => {
2008
+ // A parked ask: the call no longer waits, so the decision goes through
2009
+ // the asks API (it reaches the agent as a message).
2010
+ const parkedAskId = livePermissions.some((p) => p.id === requestId) ? undefined : parkedAskIdByRequest.get(requestId);
2011
+ if (parkedAskId) {
2012
+ await answerParkedAsk.mutateAsync({ askId: parkedAskId, answer: { reply } });
2013
+ return;
2014
+ }
1936
2015
  // No optimistic remove: only drop the card once the runtime accepted the
1937
2016
  // reply — a failed reply must stay answerable. Rethrow so callers
1938
2017
  // (prompt buttons) reset their busy state and surface the error.
@@ -1943,7 +2022,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
1943
2022
  await replyToPermission(requestId, reply);
1944
2023
  removePermission(requestId);
1945
2024
  }
1946
- }, [sessionState, removePermission]);
2025
+ }, [sessionState, removePermission, livePermissions, parkedAskIdByRequest, answerParkedAsk]);
1947
2026
  const handleQuestionReply = useCallback(async (requestId, answers) => {
1948
2027
  // Snapshot the question BEFORE removing it so we can cache the
1949
2028
  // answer against the tool part's ID.
@@ -1952,6 +2031,12 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
1952
2031
  suppressQuestionFor(requestId);
1953
2032
  // Optimistically remove the question so the textarea shows immediately
1954
2033
  removeQuestion(requestId);
2034
+ const parkedAskId = liveQuestions.some((q) => q.id === requestId) ? undefined : parkedAskIdByRequest.get(requestId);
2035
+ if (parkedAskId) {
2036
+ // Parked: the answer reaches the agent as a message that quotes the question.
2037
+ answerParkedAsk.mutate({ askId: parkedAskId, answer: { answers } });
2038
+ return;
2039
+ }
1955
2040
  // Save the answers in the optimistic cache keyed by the question call's
1956
2041
  // block id. This cache survives updates that may overwrite the call
1957
2042
  // before the server includes its answers; the transcript's answered
@@ -1978,11 +2063,17 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
1978
2063
  catch {
1979
2064
  // ignore — SSE "question.replied" event will also remove it
1980
2065
  }
1981
- }, [sessionState, removeQuestion, suppressQuestionFor]);
2066
+ }, [sessionState, removeQuestion, suppressQuestionFor, liveQuestions, parkedAskIdByRequest, answerParkedAsk]);
1982
2067
  const handleQuestionReject = useCallback(async (requestId) => {
1983
2068
  suppressQuestionFor(requestId);
1984
2069
  // Optimistically remove the question so the textarea shows immediately
1985
2070
  removeQuestion(requestId);
2071
+ const parkedAskId = liveQuestions.some((q) => q.id === requestId) ? undefined : parkedAskIdByRequest.get(requestId);
2072
+ if (parkedAskId) {
2073
+ // Dismissing a parked question closes it; nothing runs, so nothing is stopped.
2074
+ answerParkedAsk.mutate({ askId: parkedAskId, answer: { dismiss: true } });
2075
+ return;
2076
+ }
1986
2077
  try {
1987
2078
  if (sessionState)
1988
2079
  await sessionState.rejectQuestion(requestId);
@@ -2045,7 +2136,8 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
2045
2136
  useEffect(() => {
2046
2137
  outcomeJumpRef.current = { sessionId, hasOlder, isLoadingOlder, loadOlder };
2047
2138
  }, [sessionId, hasOlder, isLoadingOlder, loadOlder]);
2048
- const handleJumpToOutcome = useCallback(async (resolveTurn, createdAt) => {
2139
+ // `quiet`: a jump the reader did not click (a `?m=` link) fails silently, without the change-request toasts.
2140
+ const handleJumpToOutcome = useCallback(async (resolveTurn, createdAt, quiet = false) => {
2049
2141
  if (jumpingToOutcome)
2050
2142
  return;
2051
2143
  setJumpingToOutcome(true);
@@ -2062,9 +2154,12 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
2062
2154
  settle,
2063
2155
  },
2064
2156
  resolve: () => outcomeJumpRef.current.sessionId === currentSession ? resolveTurn() : undefined,
2065
- loadError: () => errorToast(tChangeRequests('loadError')),
2157
+ loadError: () => {
2158
+ if (!quiet)
2159
+ errorToast(tChangeRequests('loadError'));
2160
+ },
2066
2161
  unavailable: () => {
2067
- if (outcomeJumpRef.current.sessionId === currentSession)
2162
+ if (!quiet && outcomeJumpRef.current.sessionId === currentSession)
2068
2163
  errorToast(tChangeRequests('unavailable'));
2069
2164
  },
2070
2165
  scroll: async (key) => {
@@ -2094,7 +2189,8 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
2094
2189
  });
2095
2190
  }
2096
2191
  catch {
2097
- errorToast(tChangeRequests('loadError'));
2192
+ if (!quiet)
2193
+ errorToast(tChangeRequests('loadError'));
2098
2194
  }
2099
2195
  finally {
2100
2196
  setJumpingToOutcome(false);
@@ -2182,6 +2278,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
2182
2278
  const clientMessageId = overrides?.clientMessageId ?? ascendingId('msg');
2183
2279
  const sentAtMs = Date.now();
2184
2280
  const messageID = mintSessionWireMessageId(sessionId, clientMessageId);
2281
+ sentHereIds.current.add(messageID);
2185
2282
  // Generate part IDs upfront so the optimistic message and the server
2186
2283
  // request use the SAME IDs. When the server echoes parts via
2187
2284
  // message.part.updated, the sync store's upsertPart will UPDATE
@@ -3296,18 +3393,34 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
3296
3393
  // (Claude Code's agent panel). It reads its own lists and never holds the composer.
3297
3394
  const agentsLineCompact = !!transcriptRows && !isPhone;
3298
3395
  const chatUnderbarSlot = useMemo(() => _jsx(AgentsLine, { projectId: projectId, sessionId: projectSessionId, compact: agentsLineCompact }), [projectId, projectSessionId, agentsLineCompact]);
3396
+ // A space's thread lists only the queue's live messages in its card: failed
3397
+ // ones and a Stop hold read as calm lines (`ChatQueueLines`), reports wait behind Resume.
3398
+ const calmRest = useMemo(() => [...queueRows.rows, ...heldCommandRows(heldCommands)].filter((row) => row.state !== 'failed' && !row.synthetic), [queueRows.rows, heldCommands]);
3299
3399
  // The queued messages and the one Resume while a Stop holds the queue: their
3300
3400
  // own full-width card above the composer stack, not inside the strip.
3301
- const chatAboveSlot = useMemo(() => (_jsx(QueuedPromptList, { rows: heldCommands.length > 0 ? [...queueRows.rows, ...heldCommandRows(heldCommands)] : queueRows.rows, heldCount: queueRows.heldCount, resumePending: resumePending, onResume: () => void handleResumeQueue(), onEdit: (id) => {
3302
- queueEdit.takeBack(id);
3303
- }, onRemove: (id) => {
3304
- if (id.startsWith(HELD_COMMAND_ROW_PREFIX)) {
3305
- const heldId = id.slice(HELD_COMMAND_ROW_PREFIX.length);
3306
- setHeldCommands((held) => held.filter((entry) => entry.id !== heldId));
3307
- return;
3308
- }
3309
- void handleRemoveQueuedMessage(id);
3310
- }, onRetry: handleRetryQueuedMessage, onStopAndSend: effectiveBusy && canStop ? handleStopAndSendQueuedMessage : undefined, editing: queueEdit.editing, onCancelEdit: queueEdit.cancel })), [
3401
+ const chatAboveSlot = useMemo(() => (_jsx(_Fragment, { children: rowsContext?.messagesOnly ? (
3402
+ // A space's thread: calm lines ("Not sent · Retry", "Stopped · Resume"), the card only for queued messages.
3403
+ _jsx(ChatQueueLines, { rows: queueRows.rows, heldCount: queueRows.heldCount, resumePending: resumePending, onResume: () => void handleResumeQueue(), onRetry: handleRetryQueuedMessage, children: calmRest.length > 0 ? (_jsx(QueuedPromptList, { rows: calmRest, heldCount: 0, resumePending: resumePending, onResume: () => void handleResumeQueue(), onEdit: (id) => {
3404
+ queueEdit.takeBack(id);
3405
+ }, onRemove: (id) => {
3406
+ if (id.startsWith(HELD_COMMAND_ROW_PREFIX)) {
3407
+ const heldId = id.slice(HELD_COMMAND_ROW_PREFIX.length);
3408
+ setHeldCommands((held) => held.filter((entry) => entry.id !== heldId));
3409
+ return;
3410
+ }
3411
+ void handleRemoveQueuedMessage(id);
3412
+ }, onRetry: handleRetryQueuedMessage, onStopAndSend: effectiveBusy && canStop ? handleStopAndSendQueuedMessage : undefined, editing: queueEdit.editing, onCancelEdit: queueEdit.cancel })) : null })) : (_jsx(QueuedPromptList, { rows: heldCommands.length > 0 ? [...queueRows.rows, ...heldCommandRows(heldCommands)] : queueRows.rows, heldCount: queueRows.heldCount, resumePending: resumePending, onResume: () => void handleResumeQueue(), onEdit: (id) => {
3413
+ queueEdit.takeBack(id);
3414
+ }, onRemove: (id) => {
3415
+ if (id.startsWith(HELD_COMMAND_ROW_PREFIX)) {
3416
+ const heldId = id.slice(HELD_COMMAND_ROW_PREFIX.length);
3417
+ setHeldCommands((held) => held.filter((entry) => entry.id !== heldId));
3418
+ return;
3419
+ }
3420
+ void handleRemoveQueuedMessage(id);
3421
+ }, onRetry: handleRetryQueuedMessage, onStopAndSend: effectiveBusy && canStop ? handleStopAndSendQueuedMessage : undefined, editing: queueEdit.editing, onCancelEdit: queueEdit.cancel })) })), [
3422
+ rowsContext?.messagesOnly,
3423
+ calmRest,
3311
3424
  heldCommands,
3312
3425
  queueEdit.editing,
3313
3426
  queueEdit.cancel,
@@ -3496,6 +3609,65 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
3496
3609
  if (crParam)
3497
3610
  setOpenCrIdState(crParam);
3498
3611
  }, [crParam]);
3612
+ // ---- Message link: `?m=<message_id>&at=<ms>` (the gateway request log's "Open in session") ----
3613
+ // Once per link, after the transcript first paints: page back until the turn
3614
+ // is loaded, scroll to it, flash it, then drop `m`/`at` so a reload stays put.
3615
+ const messageLink = readOnly ? null : readMessageLinkParams(searchParams);
3616
+ const messageLinkKey = messageLink ? `${sessionId}|${messageLink.messageId ?? ''}|${messageLink.at ?? ''}` : null;
3617
+ const linkTurnsRef = useRef(turns);
3618
+ useEffect(() => {
3619
+ linkTurnsRef.current = turns;
3620
+ }, [turns]);
3621
+ const jumpedLinkRef = useRef(null);
3622
+ useEffect(() => {
3623
+ if (!messageLink || !messageLinkKey || isDataLoading || turns.length === 0)
3624
+ return;
3625
+ if (jumpedLinkRef.current === messageLinkKey)
3626
+ return;
3627
+ jumpedLinkRef.current = messageLinkKey;
3628
+ const resolve = () => resolveMessageLinkTurn(linkTurnsRef.current, messageLink);
3629
+ // An in-app navigation has the transcript cached: `turns` exist frames before
3630
+ // their `[data-turn-id]` nodes mount, and the first paint scrolls to the
3631
+ // bottom. Jump only once the turns are in the DOM and that scroll has run,
3632
+ // else the scroll finds no node and the link lands at the bottom.
3633
+ let cancelled = false;
3634
+ let jumped = false;
3635
+ const startedAt = Date.now();
3636
+ const jump = () => {
3637
+ jumped = true;
3638
+ // Already on screen: no history to load. Else `at`, or NaN (load it all) for an id alone.
3639
+ const createdAt = resolve() ? Number.MAX_SAFE_INTEGER : (messageLink.at ?? Number.NaN);
3640
+ void handleJumpToOutcome(resolve, createdAt, true).finally(() => {
3641
+ const params = new URLSearchParams(searchParams?.toString());
3642
+ deleteMessageLinkParams(params);
3643
+ const qs = params.toString();
3644
+ shallowNavigate(qs ? `${pathname}?${qs}` : pathname, { replace: true });
3645
+ });
3646
+ };
3647
+ const waitForTurns = () => {
3648
+ if (cancelled)
3649
+ return;
3650
+ const mounted = !!contentRef.current?.querySelector('[data-turn-id]');
3651
+ if (!mounted && Date.now() - startedAt < MESSAGE_LINK_MOUNT_WAIT_MS) {
3652
+ window.setTimeout(waitForTurns, 100);
3653
+ return;
3654
+ }
3655
+ // Two frames: the first paint's bottom scroll lands before the jump, never after it.
3656
+ requestAnimationFrame(() => requestAnimationFrame(() => {
3657
+ if (!cancelled)
3658
+ jump();
3659
+ }));
3660
+ };
3661
+ waitForTurns();
3662
+ return () => {
3663
+ cancelled = true;
3664
+ // A wait cancelled before it jumped runs again on the next pass; a jump in flight is not repeated.
3665
+ if (!jumped && jumpedLinkRef.current === messageLinkKey)
3666
+ jumpedLinkRef.current = null;
3667
+ };
3668
+ // `messageLinkKey` stands for `messageLink`, which is a new object every render.
3669
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3670
+ }, [messageLinkKey, isDataLoading, turns.length, handleJumpToOutcome, searchParams, pathname, shallowNavigate, contentRef]);
3499
3671
  const handleOpenOutcome = useCallback((outcome) => {
3500
3672
  // Change requests are the only kind a turn produces. `external` exists on
3501
3673
  // the union for `setup-links/setup-link-button.tsx`, which renders this
@@ -3519,281 +3691,306 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
3519
3691
  // an eternal loader. Only with nothing to paint: once any message is on
3520
3692
  // screen, staleness is repaired in the background instead.
3521
3693
  if (transcriptFreshness === 'error' && !hasMessages) {
3522
- return (_jsx("div", { className: "bg-background relative flex h-full flex-col", "data-testid": "session-chat", children: _jsxs("div", { className: "flex flex-1 flex-col items-center justify-center gap-3 p-6", "data-testid": "session-transcript-error", children: [_jsx("p", { className: "text-muted-foreground text-sm", children: tHardcodedUi.raw('i18nComplete.text8d0cef2d3405') }), _jsx(Button, { variant: "outline", size: "sm", onClick: () => retryTranscript(), children: tHardcodedUi.raw('i18nComplete.text942087cc2d41') })] }) }));
3694
+ return (_jsx("div", { className: cn('relative flex h-full flex-col', !transparent && 'bg-background'), "data-testid": "session-chat", children: _jsxs("div", { className: "flex flex-1 flex-col items-center justify-center gap-3 p-6", "data-testid": "session-transcript-error", children: [_jsx("p", { className: "text-muted-foreground text-sm", children: tHardcodedUi.raw('i18nComplete.text8d0cef2d3405') }), _jsx(Button, { variant: "outline", size: "sm", onClick: () => retryTranscript(), children: tHardcodedUi.raw('i18nComplete.text942087cc2d41') })] }) }));
3523
3695
  }
3524
- return (_jsx("div", { className: "bg-background relative flex h-full flex-col", "data-testid": "session-chat", children: _jsx(SessionStartingLoader, { projectId: projectId, sessionId: projectSessionId }) }));
3696
+ return (_jsx("div", { className: cn('relative flex h-full flex-col', !transparent && 'bg-background'), "data-testid": "session-chat", children: _jsx(SessionStartingLoader, { projectId: projectId, sessionId: projectSessionId }) }));
3525
3697
  }
3526
3698
  return (
3527
3699
  // A read-only view (the sub-session modal) offers no fix inside a tool card.
3528
- _jsx(ReadOnlySessionContext.Provider, { value: !!readOnly, children: _jsx(SessionPromptContext.Provider, { value: readOnly ? null : sendSessionPrompt, children: _jsx(ProjectFilesProvider, { value: { projectId: projectId ?? '', ref: outcomesBaseRef, defaultBranch: outcomesBaseRef }, children: _jsxs(ComposerDropZone, { className: cn('relative flex h-full flex-col',
3529
- // Transparent in the welcome state so the root-level full-bleed wallpaper
3530
- // (portaled into SessionLayout) reads through; solid once real content
3531
- // takes over. Same base color either way, so non-welcome is unchanged.
3532
- shouldShowWelcomeOverlay ? 'bg-transparent' : 'bg-background'), "data-testid": "session-chat", children: [isPreparingPrint && (_jsxs("div", { "data-print-hide": true, role: "status", className: "bg-popover text-muted-foreground fixed bottom-6 left-1/2 z-50 flex -translate-x-1/2 items-center gap-2 rounded-lg border px-4 py-2 text-xs shadow-lg", children: [_jsx(Loading, { className: "size-3.5 shrink-0" }), tHardcodedUi.raw('i18nComplete.text7dac2ca010fe')] })), wallpaperLayer
3533
- ? welcomeWallpaper && createPortal(welcomeWallpaper, wallpaperLayer)
3534
- : welcomeWallpaper, !hideHeader && (_jsx(SessionSiteHeader, { sessionId: sessionId, sessionTitle: session?.title || 'Untitled', leadingAction: headerLeadingAction, parent: parentCrumb })), _jsx(SessionContextModal, { open: contextModalOpen, onOpenChange: setContextModalOpen,
3535
- // A chat with no `useSession` source: the raw explorer lists the
3536
- // rows `useSessionSync` read for it.
3537
- detachedRows: sessionState ? undefined : hookMessages, source: sessionState ?? DETACHED_SESSION_MESSAGES, session: session, sessionRow: projectSessionRow, providers: providers, allSessions: allSessions, servedModel: sessionServedModel, billedCost: sessionBilledCost(modelUsage) }), _jsx(CompactModal, { sessionId: sessionId, open: compactModalOpen, onOpenChange: setCompactModalOpen }), _jsx(ChangeRequestDetailDialog, { crId: openCrId, onClose: () => setOpenCrId(null), onOpenChangeRequest: setOpenCrId }), _jsxs(SessionBodyRow, { actionPanel: !hideHeader && !readOnly, children: [isNotFound ? (_jsxs("div", { className: "flex min-h-0 flex-1 flex-col items-center justify-center gap-3 px-6 text-center", children: [_jsx("div", { className: "text-muted-foreground text-sm", children: tHardcodedUi.raw('componentsSessionSessionChat.line5821JsxTextThisSessionIsNotAccessibleRightNow') }), _jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsx(Link, { href: "/", prefetch: true, onClick: () => {
3538
- try {
3539
- if (sessionId)
3540
- useTabStore.getState().closeTab?.(sessionId);
3541
- }
3542
- catch { }
3543
- }, children: tHardcodedUi.raw('componentsSessionSessionChat.line5833JsxTextGoToHome') }) })] })) : (_jsxs("div", { ref: chatAreaRef, className: "relative z-10 min-h-0 flex-1", children: [_jsx("div", { ref: scrollContainerCallbackRef, className: cn(
3544
- // overflow-anchor:none — this scroll area does ALL of its own
3545
- // anchoring (useAutoScroll's spacer + RAF follow, the send-path
3546
- // turn anchor, and the history-prepend content-space restore in
3547
- // session-history-scroll.ts). The browser's native scroll
3548
- // anchoring (default `overflow-anchor: auto`) tries to
3549
- // compensate for the SAME prepends independently, and the two
3550
- // corrections stacking is the other half of the scroll-up
3551
- // teleport: ours restores the reader's position, then the
3552
- // native one nudges it again.
3553
- 'scrollbar-hide relative z-10 h-full flex-1 overflow-y-auto [scroll-behavior:auto] [overflow-anchor:none]', shouldShowWelcomeOverlay ? 'bg-transparent' : 'bg-background'), onMouseUp: handleChatMouseUp, onMouseDown: handleChatMouseDown, onScroll: handleChatScroll, children: _jsxs("div", { ref: contentRef, role: "log",
3554
- // Width and gutters live in `SESSION_TRANSCRIPT_CLASS`: the
3555
- // instant shell draws this same column and the two crossfade
3556
- // into each other, so a difference here is a sideways jump on
3557
- // screen, not a style opinion. See session-body.tsx.
3558
- //
3559
- // No bottom padding, there or here: the space under the last
3560
- // message is the auto-scroll spacer's job alone. The `pb-32`
3561
- // that used to sit here stacked 128px of dead space on top of
3562
- // it — the "extra inset at the bottom of the session".
3563
- // Rows run edge to edge: each row owns its gutters and its hover fill.
3564
- className: transcriptRows ? 'w-full min-w-0 pt-4' : SESSION_TRANSCRIPT_CLASS, children: [_jsxs("div", { className: "flex min-w-0 flex-col", children: [_jsx(SessionPrintHeader, { title: session?.title || 'Untitled', agentName: composerAgentName }), (hasOlder || showOlderLoading) && (_jsxs("div", { className: "mb-6 flex flex-col items-center gap-2", children: [hasOlder && (_jsx("div", { ref: olderSentinelRef, "aria-hidden": true, className: "h-px w-full" })), showOlderLoading && (_jsxs("div", { role: "status", className: "text-muted-foreground flex items-center gap-2 py-1 text-xs", children: [_jsx(Loading, { className: "size-3.5 shrink-0" }), tHardcodedUi.raw('i18nComplete.text85bf890776a7')] })), !showOlderLoading &&
3565
- !olderPullFailed &&
3566
- olderAutoloadExhausted({ hasOlder, autoLoadedPages }) && (_jsx(Button, { type: "button", variant: "outline-ghost", size: "sm", onClick: () => void handleLoadOlder(), children: tHardcodedUi.raw('i18nComplete.textf17671d83db0') })), olderPullFailed && !showOlderLoading && (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-muted-foreground text-xs", children: tHardcodedUi.raw('i18nComplete.textb03a0041ce33') }), _jsx(Button, { type: "button", variant: "outline-ghost", size: "sm", onClick: () => void handleLoadOlder(), children: tHardcodedUi.raw('i18nComplete.text942087cc2d41') })] }))] })), restoreNotice && !restoreDismissed && (_jsx(RestoreNotice, { notice: restoreNotice, onDismiss: () => dismissRestore(historyKey, restoreNotice.generation) })), _jsx(SessionOutcomesProvider, { projectSessionId: projectSessionId, turnSpans: turnSpans, busy: effectiveBusy, onOpen: handleOpenOutcome, onJump: handleJumpToOutcome, jumping: jumpingToOutcome, children: _jsxs(ToolActivateContext.Provider, { value: toolActivate, children: [showFirstPromptPreview &&
3567
- firstPromptSource &&
3568
- queuedSyntheticMessages.length === 0 &&
3569
- rowsContext && (
3570
- // A channel thread draws the stand-in as rows, the same
3571
- // rows its boot body drew (`ThreadBootRows`).
3572
- _jsx(PendingPromptRows, { text: buildOptimisticPromptTextWithUploads(firstPromptSource.text, firstPromptSource.files), author: rowsContext.owner, sessionId: sessionId, busy: turns.length === 0 && (lastTurnWorking || promptInbox.prompts.some(isFirstPromptRow)) })), showFirstPromptPreview &&
3573
- firstPromptSource &&
3574
- queuedSyntheticMessages.length === 0 &&
3575
- !rowsContext && (_jsx(OptimisticTurn, { text: buildOptimisticPromptTextWithUploads(firstPromptSource.text, firstPromptSource.files),
3576
- // Preserve a real failed-send status through the
3577
- // boot-shell handover without inventing upload progress.
3578
- // A first prompt held on its uploads carries its own.
3579
- uploadStatus: firstPromptSource.uploadStatus ?? firstPromptUploadStatus, agentNames: agentNames, onFileClick: openFileInComputer, sessionId: sessionId,
3580
- // The first item of the conversation, like turn 0, which has no
3581
- // top margin. `first:mt-0` misses here: the list opens with a
3582
- // zero-height <header>, so the stand-in sat 44px lower than turn 0
3583
- // and every swap between the two jumped the bubble (KRTX-2931).
3584
- className: "mt-0",
3585
- // An undelivered first prompt is a turn about to start, as the
3586
- // shell above this chat shows it: busy from the first frame,
3587
- // before the working projection has read the inbox (KRTX-2931).
3588
- busy: turns.length === 0 && (lastTurnWorking || promptInbox.prompts.some(isFirstPromptRow)) })), turns.map((turn, turnIndex) => {
3589
- // Check if this turn is a compaction summary — and
3590
- // whether it actually PRODUCED one. A failed/aborted
3591
- // attempt (compaction-flagged, no content, not the
3592
- // working turn) renders as one slim row, draws no
3593
- // divider, and stacks tight against a neighbouring
3594
- // failed attempt.
3595
- const compaction = turn.compaction;
3596
- const hasCompaction = compaction !== null;
3597
- const isTurnWorking = turn.live;
3598
- // `inFlight` (message state) alongside the projection:
3599
- // classifying by projection alone flipped a streaming
3600
- // compaction to "failed" for the frames where the two
3601
- // disagree, popping the divider in and out — a layout
3602
- // bounce right where the reader is looking.
3603
- const isFailedCompaction = compaction !== null &&
3604
- !compaction.hasContent &&
3605
- !compaction.inFlight &&
3606
- !isTurnWorking;
3607
- // Retries collapse to ONE visible row, GLOBALLY: a
3608
- // failed attempt with ANY later compaction turn (a
3609
- // retry, or the one that finally landed) is history —
3610
- // it keeps its TurnViewport (stable keys, scroll
3611
- // anchors) but renders no content, and an empty
3612
- // TurnViewport costs 0px (turn-viewport.tsx RULE 2).
3613
- // Adjacency was not enough: attempts whose error landed
3614
- // on a plain assistant message used to interleave as
3615
- // unclassified turns, breaking every consecutive run.
3616
- const suppressedFailedCompaction = isFailedCompaction && turnIndex < lastCompactionTurnIndex;
3617
- // Notification-only early-return removed: it rendered the
3618
- // user's pty_* card but skipped the turn's replies,
3619
- // hiding every subsequent assistant response in that turn.
3620
- // Fall through to the normal turn renderer instead.
3621
- const confirmedActive = turnIsConfirmedActive({
3622
- isTurnWorking,
3623
- turnId: turn.id,
3624
- activeTurnId,
3625
- pendingDelivery: !!working.pendingDelivery,
3626
- });
3627
- const pendingPrompt = !confirmedActive && turn.assistant.length === 0
3628
- ? pendingPromptsByMessageId.get(turn.id)
3629
- : undefined;
3630
- // A queued prompt is not in the runtime transcript yet;
3631
- // its author still shows (`authorForTurn`).
3632
- const turnAuthor = authorForTurn(transcriptAuthors, messageAuthors, turn.id, pendingPrompt?.wire_message_id);
3633
- return (_jsx(TranscriptTurnRow
3634
- // ONE element per prompt: keyed by the id the
3635
- // bubble was FIRST painted under, so the swap to a
3636
- // re-minted echo id re-renders this node instead
3637
- // of mounting a new one (opacity keeps animating,
3638
- // hover state survives, nothing jumps).
3639
- , { turnId: turn.id, modelOptions: modelOptions, suppressed: suppressedFailedCompaction, continuedWith: harnessSwitches.get(turn.id)?.harness, fullTextState: loaded.state[turn.id] ?? 'idle', onLoadFullText: loadFullTexts, showBusyRow: showFallbackBusyRow &&
3640
- fallbackBusyRowTurnId === turn.id,
3641
- // Queued bubbles STACK: a pending turn right after
3642
- // another pending turn sits close to it, like a
3643
- // list of what is waiting — not a turn's width
3644
- // apart as if each had been answered in between.
3645
- // (Failed compaction rows need no stacking rule any
3646
- // more — at most one is visible at a time.)
3647
- viewportClassName: turnIndex === 0 || transcriptRows
3648
- ? ''
3649
- : // A compaction and the work after it continue the turn above.
3650
- turn.compaction || turn.continues
3651
- ? 'mt-6'
3652
- : lastTurnWorking &&
3653
- pendingTurnIds.has(turn.id) &&
3654
- pendingTurnIds.has(turns[turnIndex - 1].id)
3655
- ? 'mt-3'
3656
- : 'mt-12', turn: turn, author: turnAuthor, showAuthor: showAuthorName(turnAuthor, groupChat, viewerId), stoppedBy: stoppedByName(messageAuthors, turn.id, viewerId), servedModel: servedModelOfTurn(modelUsage, turn.id, turns[turnIndex - 1]?.id), turnOutcome: turnOutcome, isLast: turn.id === lastUserMessageId, ownsPlan: turn.id === planAnchorId, sessionId: sessionId, projectId: projectId, projectSessionId: projectSessionId, sessionStatus: sessionStatus, permissions: pendingPermissions, questions: pendingQuestions, agentNames: agentNames, isFirstTurn: turnIndex === 0,
3657
- // Handed over only once the stand-in has stepped
3658
- // aside — while it is up it draws these itself.
3659
- pendingText: turnIndex === 0 ? firstTurnHandover?.text : undefined, pendingAttachments: sentAttachmentsForTurn({
3660
- sentByMessage: sentAttachmentsByMessage,
3661
- messageId: turn.id,
3662
- originId: optimisticOriginOf(sessionId, turn.id),
3663
- isFirstTurn: turnIndex === 0,
3664
- firstTurnHandover: firstTurnHandover?.attachments,
3665
- firstTurnSent: firstPromptAttachments(projectSessionId),
3666
- queuedRowAttachments: inboxRowsByMessageId.get(turn.id)?.attachments,
3667
- }), uploadStatus: heldSendFailures?.[turn.id]
3668
- ? {
3669
- state: 'failed',
3670
- message: heldSendFailures[turn.id].message,
3671
- onRetry: () => retryHeldSend(sessionId, turn.id, resendHeldSend, (error) => classifySessionError(error).message),
3672
- }
3673
- : turnIndex === 0 && firstTurnHandover?.attachments.length
3674
- ? firstPromptUploadStatus
3675
- : undefined, sessionWorking: lastTurnWorking, isWorkingTurn: turn.live, suppressBusyIndicator: suppressWorkingTurnBusy, awaitingUser: awaitingUserInput,
3676
- // An idle send stays in the inbox until delivery,
3677
- // but nothing runs ahead of it: queued only while
3678
- // it waits behind a turn (`turnRendersQueued`).
3679
- // The first turn, with no turn working, has
3680
- // nothing ahead of it: a session's first prompt is
3681
- // starting, not queued, while the computer comes up
3682
- // and before the turn layer marks it queued or live.
3683
- pending: turnIndex === 0 && workingTurn.workingTurnId === null && !confirmedActive
3684
- ? pendingPrompt?.state === 'waiting' || pendingPrompt?.state === 'failed'
3685
- : turnRendersQueued({
3686
- turnId: turn.id,
3687
- resolution: workingTurn,
3688
- sessionWorking: lastTurnWorking,
3689
- confirmedActive,
3690
- inboxPrompt: pendingPrompt,
3691
- }), pendingPrompt: pendingPrompt, onRetryQueued: stableRetryQueued, onRemoveQueued: stableRemoveQueued, queuedPromptViewer: queuedPromptViewer, interruptedBeforeRun: interruptedTurnIds.has(turn.id), isCompaction: hasCompaction, onOpenCompactionSummary: panel ? stableOpenCompactionSummary : undefined, onOpenPastedContent: panel ? stableOpenPastedContent : undefined, providers: providers, commandMessages: commandMessagesRef.current, commands: commands, disableToolNavigation: disableToolNavigation, onPermissionReply: stablePermissionReply, onRewind: stableRewind, editingText: rewindTarget?.messageId === turn.id
3692
- ? rewindTarget.text
3693
- : null, editPending: editSendPending || !!sessionState?.rewindPending, onEditCancel: stableEditCancel, onEditSend: stableEditSend, rewindDisabled: !!readOnly ||
3694
- (rewindable !== null && !rewindable.has(turn.id)) ||
3695
- !runtimeCanRewind ||
3696
- !sessionState ||
3697
- isBusy ||
3698
- sessionState.rewindPending ||
3699
- // The runtime is not idle while queued prompts
3700
- // are still on their way to it — a rewind mid-
3701
- // delivery fails downstream with "Session is
3702
- // busy" (measured); refuse it up front instead.
3703
- promptInbox.prompts.length > 0 }, turnRenderKeys.get(turn.id)));
3704
- })] }) }), isOptimisticCompacting && !hasCompactionTurn && (_jsx("div", { className: turns.length > 0 ? 'mt-12' : 'mt-2', children: _jsx(CompactionMarker, { running: true }) })), [
3705
- ...(turnOutcome.recent_failures ?? []),
3706
- ...(turnOutcome.last_ended?.end_reason === 'failed' &&
3707
- !turnOutcome.recent_failures?.some((failure) => failure.message_id === turnOutcome.last_ended?.message_id)
3708
- ? [turnOutcome.last_ended]
3709
- : []),
3710
- ].filter((failure) => !isAbortError(failure.error) &&
3711
- !failureShownByTurn(failure, turns) &&
3712
- !failureSupersededByTurn(failure, turns) &&
3713
- (!failure.error?.message || failure.error.message !== commandError?.message)).map((failure) => {
3714
- const messageId = failure.message_id ?? 'persisted-turn-failure';
3715
- // Use the SDK's settle window for a cause that may arrive
3716
- // one frame later, including an unnamed failed last turn.
3717
- const notice = turnEndNotice({
3718
- ...turnOutcome,
3719
- recent_failures: [{ ...failure, message_id: messageId, error: failure.error ?? null }],
3720
- }, messageId, { hasError: false, isAbort: false });
3721
- return notice ? (_jsx(TurnErrorDisplay, { errorText: notice.kind === 'unexplained'
3722
- ? tHardcodedUi.raw('i18nComplete.text73112526c03a')
3723
- : persistedFailureText(failure.error), className: "mt-2" }, messageId)) : null;
3724
- }), commandError && (_jsx(TurnErrorDisplay, { error: commandError, isAbort: isAbortError(commandError.cause), modelOptions: modelOptions, className: "mt-2" })), showFallbackBusyRow && fallbackBusyRowTurnId === null && (rowsContext ? (
3725
- // A channel thread waits in the agent's answer row.
3726
- _jsx(AgentBusyRow, { sessionId: sessionId })) : (_jsx(SessionBusyIndicator, { sessionId: sessionId,
3727
- // Matches the stand-in's row spacing under a bubble
3728
- // (`OptimisticTurn`), so the crossfade into the real
3729
- // transcript does not move it. Nothing above it when
3730
- // the transcript is empty, so no margin there.
3731
- className: turns.length === 0 ? undefined : 'mt-6' })))] }), _jsx("div", { ref: spacerElRef, "data-scroll-spacer": true })] }) }), selectionPopup && (_jsx("div", { "data-reply-popup": true, className: "absolute z-50", style: {
3732
- left: `${selectionPopup.x}px`,
3733
- top: `${selectionPopup.y}px`,
3734
- transform: 'translate(-50%, -100%)',
3735
- }, children: _jsxs(Button, { onClick: handleSelectionReply, size: "sm", className: "animate-in fade-in-0 zoom-in-95 duration-normal origin-bottom px-3 text-xs ease-out has-[>svg]:px-3", children: [tHardcodedUi.raw('i18nComplete.textc253f451bdd5'), _jsx(ArrowBendUpLeftIcon, { className: "size-4 shrink-0" })] }) })), transcriptRows ? null : (_jsx(ChatMinimap, { turns: turns, scrollRef: scrollRef, contentRef: contentRef })), _jsx("div", { className: cn('absolute inset-x-0 bottom-4 z-20 flex justify-center', !showScrollButton && 'pointer-events-none'), children: _jsx(Button, { variant: "outline", size: "icon-md", "aria-hidden": !showScrollButton, tabIndex: showScrollButton ? undefined : -1, className: cn('hit-area-2 bg-background hover:bg-muted rounded-full', 'transition-[opacity,scale] ease-[cubic-bezier(0.23,1,0.32,1)] active:scale-[0.96] motion-reduce:scale-100 motion-reduce:transition-opacity', showScrollButton
3736
- ? 'duration-normal scale-100 opacity-100'
3737
- : 'duration-fast scale-[0.97] opacity-0'), onClick: smoothScrollToAbsoluteBottom, children: _jsx(CaretDownIcon, { className: "size-4" }) }) })] })), readOnly && inputReplacement ? (_jsx("div", { className: cn(COMPOSER_SHELL_CLASS, 'pb-4'), children: inputReplacement })) : null, !readOnly && (_jsxs(_Fragment, { children: [_jsx(SessionChatInput
3738
- // `undefined`, not `true`, once released: the composer's own
3739
- // viewport rule (>= 640px) still decides, so this never forces
3740
- // focus onto a phone keyboard.
3741
- , {
3700
+ _jsx(ReadOnlySessionContext.Provider, { value: !!readOnly, children: _jsx(AgentActivateContext.Provider, { value: agentActivate, children: _jsx(SessionPromptContext.Provider, { value: readOnly ? null : sendSessionPrompt, children: _jsx(ProjectFilesProvider, { value: { projectId: projectId ?? '', ref: outcomesBaseRef, defaultBranch: outcomesBaseRef }, children: _jsxs(ComposerDropZone, { className: cn('relative flex h-full flex-col',
3701
+ // Transparent in the welcome state so the root-level full-bleed wallpaper
3702
+ // (portaled into SessionLayout) reads through; solid once real content
3703
+ // takes over. Same base color either way, so non-welcome is unchanged.
3704
+ shouldShowWelcomeOverlay || transparent ? 'bg-transparent' : 'bg-background'), "data-testid": "session-chat", children: [isPreparingPrint && (_jsxs("div", { "data-print-hide": true, role: "status", className: "bg-popover text-muted-foreground fixed bottom-6 left-1/2 z-50 flex -translate-x-1/2 items-center gap-2 rounded-lg border px-4 py-2 text-xs shadow-lg", children: [_jsx(Loading, { className: "size-3.5 shrink-0" }), tHardcodedUi.raw('i18nComplete.text7dac2ca010fe')] })), wallpaperLayer
3705
+ ? welcomeWallpaper && createPortal(welcomeWallpaper, wallpaperLayer)
3706
+ : welcomeWallpaper, !hideHeader && (_jsx(SessionSiteHeader, { sessionId: sessionId, sessionTitle: session?.title || 'Untitled', leadingAction: headerLeadingAction, parent: parentCrumb })), _jsx(ModelSwitchHistory, { history: projectSessionRow?.metadata?.model_switches, current: projectSessionRow?.metadata?.model }), _jsx(SessionContextModal, { open: contextModalOpen, onOpenChange: setContextModalOpen,
3707
+ // A chat with no `useSession` source: the raw explorer lists the
3708
+ // rows `useSessionSync` read for it.
3709
+ detachedRows: sessionState ? undefined : hookMessages, source: sessionState ?? DETACHED_SESSION_MESSAGES, session: session, sessionRow: projectSessionRow, providers: providers, allSessions: allSessions, servedModel: sessionServedModel, billedCost: sessionBilledCost(modelUsage) }), _jsx(CompactModal, { sessionId: sessionId, open: compactModalOpen, onOpenChange: setCompactModalOpen }), _jsx(ChangeRequestDetailDialog, { crId: openCrId, onClose: () => setOpenCrId(null), onOpenChangeRequest: setOpenCrId }), _jsxs(SessionBodyRow, { actionPanel: !hideHeader && !readOnly, children: [isNotFound ? (_jsxs("div", { className: "flex min-h-0 flex-1 flex-col items-center justify-center gap-3 px-6 text-center", children: [_jsx("div", { className: "text-muted-foreground text-sm", children: tHardcodedUi.raw('componentsSessionSessionChat.line5821JsxTextThisSessionIsNotAccessibleRightNow') }), _jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsx(Link, { href: "/", prefetch: true, onClick: () => {
3710
+ try {
3711
+ if (sessionId)
3712
+ useTabStore.getState().closeTab?.(sessionId);
3713
+ }
3714
+ catch { }
3715
+ }, children: tHardcodedUi.raw('componentsSessionSessionChat.line5833JsxTextGoToHome') }) })] })) : (_jsxs("div", { ref: chatAreaRef, className: "relative z-10 min-h-0 flex-1", children: [_jsx("div", { ref: scrollContainerCallbackRef, className: cn(
3716
+ // overflow-anchor:none — this scroll area does ALL of its own
3717
+ // anchoring (useAutoScroll's spacer + RAF follow, the send-path
3718
+ // turn anchor, and the history-prepend content-space restore in
3719
+ // session-history-scroll.ts). The browser's native scroll
3720
+ // anchoring (default `overflow-anchor: auto`) tries to
3721
+ // compensate for the SAME prepends independently, and the two
3722
+ // corrections stacking is the other half of the scroll-up
3723
+ // teleport: ours restores the reader's position, then the
3724
+ // native one nudges it again.
3725
+ 'scrollbar-hide relative z-10 h-full flex-1 overflow-y-auto [scroll-behavior:auto] [overflow-anchor:none]', shouldShowWelcomeOverlay || transparent ? 'bg-transparent' : 'bg-background'), onMouseUp: handleChatMouseUp, onMouseDown: handleChatMouseDown, onScroll: handleChatScroll, children: _jsxs("div", { ref: contentRef, role: "log",
3726
+ // Width and gutters live in `SESSION_TRANSCRIPT_CLASS`: the
3727
+ // instant shell draws this same column and the two crossfade
3728
+ // into each other, so a difference here is a sideways jump on
3729
+ // screen, not a style opinion. See session-body.tsx.
3730
+ //
3731
+ // No bottom padding, there or here: the space under the last
3732
+ // message is the auto-scroll spacer's job alone. The `pb-32`
3733
+ // that used to sit here stacked 128px of dead space on top of
3734
+ // it — the "extra inset at the bottom of the session".
3735
+ // Rows run edge to edge: each row owns its gutters and its hover fill.
3736
+ className: transcriptRows ? 'w-full min-w-0 pt-4' : SESSION_TRANSCRIPT_CLASS, children: [_jsxs("div", { className: "flex min-w-0 flex-col", children: [_jsx(SessionPrintHeader, { title: session?.title || 'Untitled', agentName: composerAgentName }), (hasOlder || showOlderLoading) && (_jsxs("div", { className: "mb-6 flex flex-col items-center gap-2", children: [hasOlder && (_jsx("div", { ref: olderSentinelRef, "aria-hidden": true, className: "h-px w-full" })), showOlderLoading && (_jsxs("div", { role: "status", className: "text-muted-foreground flex items-center gap-2 py-1 text-xs", children: [_jsx(Loading, { className: "size-3.5 shrink-0" }), tHardcodedUi.raw('i18nComplete.text85bf890776a7')] })), !showOlderLoading &&
3737
+ !olderPullFailed &&
3738
+ olderAutoloadExhausted({ hasOlder, autoLoadedPages }) && (_jsx(Button, { type: "button", variant: "outline-ghost", size: "sm", onClick: () => void handleLoadOlder(), children: tHardcodedUi.raw('i18nComplete.textf17671d83db0') })), olderPullFailed && !showOlderLoading && (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-muted-foreground text-xs", children: tHardcodedUi.raw('i18nComplete.textb03a0041ce33') }), _jsx(Button, { type: "button", variant: "outline-ghost", size: "sm", onClick: () => void handleLoadOlder(), children: tHardcodedUi.raw('i18nComplete.text942087cc2d41') })] }))] })), restoreNotice && !restoreDismissed && (_jsx(RestoreNotice, { notice: restoreNotice, onDismiss: () => dismissRestore(historyKey, restoreNotice.generation) })), _jsx(SessionOutcomesProvider, { projectSessionId: projectSessionId, turnSpans: turnSpans, busy: effectiveBusy, onOpen: handleOpenOutcome, onJump: handleJumpToOutcome, jumping: jumpingToOutcome, children: _jsxs(ToolActivateContext.Provider, { value: toolActivate, children: [showFirstPromptPreview &&
3739
+ firstPromptSource &&
3740
+ queuedSyntheticMessages.length === 0 &&
3741
+ rowsContext && (
3742
+ // A channel thread draws the stand-in as rows, the same
3743
+ // rows its boot body drew (`ThreadBootRows`).
3744
+ _jsx(PendingPromptRows, { text: buildOptimisticPromptTextWithUploads(firstPromptSource.text, firstPromptSource.files), author: rowsContext.owner, sessionId: sessionId, busy: turns.length === 0 && (lastTurnWorking || promptInbox.prompts.some(isFirstPromptRow)) })), showFirstPromptPreview &&
3745
+ firstPromptSource &&
3746
+ queuedSyntheticMessages.length === 0 &&
3747
+ !rowsContext && (_jsx(OptimisticTurn, { text: buildOptimisticPromptTextWithUploads(firstPromptSource.text, firstPromptSource.files),
3748
+ // Preserve a real failed-send status through the
3749
+ // boot-shell handover without inventing upload progress.
3750
+ // A first prompt held on its uploads carries its own.
3751
+ uploadStatus: firstPromptSource.uploadStatus ?? firstPromptUploadStatus, agentNames: agentNames, onFileClick: openFileInComputer, sessionId: sessionId,
3752
+ // The first item of the conversation, like turn 0, which has no
3753
+ // top margin. `first:mt-0` misses here: the list opens with a
3754
+ // zero-height <header>, so the stand-in sat 44px lower than turn 0
3755
+ // and every swap between the two jumped the bubble (KRTX-2931).
3756
+ className: "mt-0",
3757
+ // An undelivered first prompt is a turn about to start, as the
3758
+ // shell above this chat shows it: busy from the first frame,
3759
+ // before the working projection has read the inbox (KRTX-2931).
3760
+ busy: turns.length === 0 && (lastTurnWorking || promptInbox.prompts.some(isFirstPromptRow)) })), turns.map((turn, turnIndex) => {
3761
+ // Check if this turn is a compaction summary — and
3762
+ // whether it actually PRODUCED one. A failed/aborted
3763
+ // attempt (compaction-flagged, no content, not the
3764
+ // working turn) renders as one slim row, draws no
3765
+ // divider, and stacks tight against a neighbouring
3766
+ // failed attempt.
3767
+ const compaction = turn.compaction;
3768
+ const hasCompaction = compaction !== null;
3769
+ const isTurnWorking = turn.live;
3770
+ // `inFlight` (message state) alongside the projection:
3771
+ // classifying by projection alone flipped a streaming
3772
+ // compaction to "failed" for the frames where the two
3773
+ // disagree, popping the divider in and out — a layout
3774
+ // bounce right where the reader is looking.
3775
+ const isFailedCompaction = compaction !== null &&
3776
+ !compaction.hasContent &&
3777
+ !compaction.inFlight &&
3778
+ !isTurnWorking;
3779
+ // Retries collapse to ONE visible row, GLOBALLY: a
3780
+ // failed attempt with ANY later compaction turn (a
3781
+ // retry, or the one that finally landed) is history —
3782
+ // it keeps its TurnViewport (stable keys, scroll
3783
+ // anchors) but renders no content, and an empty
3784
+ // TurnViewport costs 0px (turn-viewport.tsx RULE 2).
3785
+ // Adjacency was not enough: attempts whose error landed
3786
+ // on a plain assistant message used to interleave as
3787
+ // unclassified turns, breaking every consecutive run.
3788
+ const suppressedFailedCompaction = isFailedCompaction && turnIndex < lastCompactionTurnIndex;
3789
+ // Notification-only early-return removed: it rendered the
3790
+ // user's pty_* card but skipped the turn's replies,
3791
+ // hiding every subsequent assistant response in that turn.
3792
+ // Fall through to the normal turn renderer instead.
3793
+ const confirmedActive = turnIsConfirmedActive({
3794
+ isTurnWorking,
3795
+ turnId: turn.id,
3796
+ activeTurnId,
3797
+ pendingDelivery: !!working.pendingDelivery,
3798
+ });
3799
+ const pendingPrompt = !confirmedActive && turn.assistant.length === 0
3800
+ ? pendingPromptsByMessageId.get(turn.id)
3801
+ : undefined;
3802
+ // A queued prompt is not in the runtime transcript yet;
3803
+ // its author still shows (`authorForTurn`).
3804
+ const promptAuthorId = pendingPromptsByMessageId.get(turn.id)?.author_user_id;
3805
+ const turnAuthor = authorForTurn(transcriptAuthors, messageAuthors, turn.id, pendingPrompt?.wire_message_id) ??
3806
+ participantAuthor(sessionParticipants, promptAuthorId) ??
3807
+ (sentHereIds.current.has(turn.id) ||
3808
+ sentHereIds.current.has(turnRenderKeys.get(turn.id) ?? '') ||
3809
+ (viewerId !== undefined && promptAuthorId === viewerId) ||
3810
+ // The first prompt of a session the viewer started,
3811
+ // sent from another surface (project home), before
3812
+ // the first authors read lands.
3813
+ (messageAuthorsLoading &&
3814
+ viewerId !== undefined &&
3815
+ projectSessionRow?.created_by === viewerId &&
3816
+ turn.id === userMessageIds[0])
3817
+ ? viewerAsAuthor
3818
+ : undefined);
3819
+ return (_jsx(TranscriptTurnRow
3820
+ // ONE element per prompt: keyed by the id the
3821
+ // bubble was FIRST painted under, so the swap to a
3822
+ // re-minted echo id re-renders this node instead
3823
+ // of mounting a new one (opacity keeps animating,
3824
+ // hover state survives, nothing jumps).
3825
+ , { turnId: turn.id, modelOptions: modelOptions, suppressed: suppressedFailedCompaction, continuedWith: harnessSwitches.get(turn.id)?.harness, fullTextState: loaded.state[turn.id] ?? 'idle', onLoadFullText: loadFullTexts, showBusyRow: showFallbackBusyRow &&
3826
+ fallbackBusyRowTurnId === turn.id,
3827
+ // Queued bubbles STACK: a pending turn right after
3828
+ // another pending turn sits close to it, like a
3829
+ // list of what is waiting — not a turn's width
3830
+ // apart as if each had been answered in between.
3831
+ // (Failed compaction rows need no stacking rule any
3832
+ // more — at most one is visible at a time.)
3833
+ viewportClassName: turnIndex === 0 || transcriptRows
3834
+ ? ''
3835
+ : // A compaction, the work after it and another agent's notice continue the turn above.
3836
+ turn.compaction || turn.continues || agentNoticeTurnIds.has(turn.id)
3837
+ ? 'mt-6'
3838
+ : lastTurnWorking &&
3839
+ pendingTurnIds.has(turn.id) &&
3840
+ pendingTurnIds.has(turns[turnIndex - 1].id)
3841
+ ? 'mt-3'
3842
+ : 'mt-12', turn: turn, author: turnAuthor,
3843
+ // Reserve the sender row while the authors load,
3844
+ // for a queued prompt whose sender is known, and
3845
+ // for a live message until its author resolves.
3846
+ showAuthor: !!turnAuthor ||
3847
+ messageAuthorsLoading ||
3848
+ !!promptAuthorId ||
3849
+ (loadedUserIds?.sessionId === sessionId &&
3850
+ !loadedUserIds.ids.has(turn.id) &&
3851
+ authorsGaveUp !== missingAuthors), stoppedBy: stoppedByName(messageAuthors, turn.id, viewerId), servedModel: servedModelOfTurn(modelUsage, turn.id, turns[turnIndex - 1]?.id), turnOutcome: turnOutcome, isLast: turn.id === lastUserMessageId, ownsPlan: turn.id === planAnchorId, sessionId: sessionId, projectId: projectId, projectSessionId: projectSessionId, sessionStatus: sessionStatus, permissions: pendingPermissions, questions: pendingQuestions, agentNames: agentNames, isFirstTurn: turnIndex === 0,
3852
+ // Handed over only once the stand-in has stepped
3853
+ // aside — while it is up it draws these itself.
3854
+ pendingText: turnIndex === 0 ? firstTurnHandover?.text : undefined, pendingAttachments: sentAttachmentsForTurn({
3855
+ sentByMessage: sentAttachmentsByMessage,
3856
+ messageId: turn.id,
3857
+ originId: optimisticOriginOf(sessionId, turn.id),
3858
+ isFirstTurn: turnIndex === 0,
3859
+ firstTurnHandover: firstTurnHandover?.attachments,
3860
+ firstTurnSent: firstPromptAttachments(projectSessionId),
3861
+ queuedRowAttachments: inboxRowsByMessageId.get(turn.id)?.attachments,
3862
+ }), uploadStatus: heldSendFailures?.[turn.id]
3863
+ ? {
3864
+ state: 'failed',
3865
+ message: heldSendFailures[turn.id].message,
3866
+ onRetry: () => retryHeldSend(sessionId, turn.id, resendHeldSend, (error) => classifySessionError(error).message),
3867
+ }
3868
+ : turnIndex === 0 && firstTurnHandover?.attachments.length
3869
+ ? firstPromptUploadStatus
3870
+ : undefined, sessionWorking: lastTurnWorking, isWorkingTurn: turn.live, suppressBusyIndicator: suppressWorkingTurnBusy, awaitingUser: awaitingUserInput,
3871
+ // An idle send stays in the inbox until delivery,
3872
+ // but nothing runs ahead of it: queued only while
3873
+ // it waits behind a turn (`turnRendersQueued`).
3874
+ // The first turn, with no turn working, has
3875
+ // nothing ahead of it: a session's first prompt is
3876
+ // starting, not queued, while the computer comes up
3877
+ // and before the turn layer marks it queued or live.
3878
+ pending: turnIndex === 0 && workingTurn.workingTurnId === null && !confirmedActive
3879
+ ? pendingPrompt?.state === 'waiting' || pendingPrompt?.state === 'failed'
3880
+ : turnRendersQueued({
3881
+ turnId: turn.id,
3882
+ resolution: workingTurn,
3883
+ sessionWorking: lastTurnWorking,
3884
+ confirmedActive,
3885
+ inboxPrompt: pendingPrompt,
3886
+ }), pendingPrompt: pendingPrompt, onRetryQueued: stableRetryQueued, onRemoveQueued: stableRemoveQueued, queuedPromptViewer: queuedPromptViewer, interruptedBeforeRun: interruptedTurnIds.has(turn.id), isCompaction: hasCompaction, onOpenCompactionSummary: panel ? stableOpenCompactionSummary : undefined, onOpenPastedContent: panel ? stableOpenPastedContent : undefined, providers: providers, commandMessages: commandMessagesRef.current, commands: commands, disableToolNavigation: disableToolNavigation, onPermissionReply: stablePermissionReply, onRewind: stableRewind, editingText: rewindTarget?.messageId === turn.id
3887
+ ? rewindTarget.text
3888
+ : null, editPending: editSendPending || !!sessionState?.rewindPending, onEditCancel: stableEditCancel, onEditSend: stableEditSend, rewindDisabled: !!readOnly ||
3889
+ (rewindable !== null && !rewindable.has(turn.id)) ||
3890
+ !runtimeCanRewind ||
3891
+ !sessionState ||
3892
+ isBusy ||
3893
+ sessionState.rewindPending ||
3894
+ // The runtime is not idle while queued prompts
3895
+ // are still on their way to it — a rewind mid-
3896
+ // delivery fails downstream with "Session is
3897
+ // busy" (measured); refuse it up front instead.
3898
+ promptInbox.prompts.length > 0 }, turnRenderKeys.get(turn.id)));
3899
+ })] }) }), isOptimisticCompacting && !hasCompactionTurn && (_jsx("div", { className: turns.length > 0 ? 'mt-12' : 'mt-2', children: _jsx(CompactionMarker, { running: true }) })), [
3900
+ ...(turnOutcome.recent_failures ?? []),
3901
+ ...(turnOutcome.last_ended?.end_reason === 'failed' &&
3902
+ !turnOutcome.recent_failures?.some((failure) => failure.message_id === turnOutcome.last_ended?.message_id)
3903
+ ? [turnOutcome.last_ended]
3904
+ : []),
3905
+ ].filter((failure) => !isAbortError(failure.error) &&
3906
+ !failureShownByTurn(failure, turns) &&
3907
+ !failureSupersededByTurn(failure, turns) &&
3908
+ (!failure.error?.message || failure.error.message !== commandError?.message)).map((failure) => {
3909
+ const messageId = failure.message_id ?? 'persisted-turn-failure';
3910
+ // Use the SDK's settle window for a cause that may arrive
3911
+ // one frame later, including an unnamed failed last turn.
3912
+ const notice = turnEndNotice({
3913
+ ...turnOutcome,
3914
+ recent_failures: [{ ...failure, message_id: messageId, error: failure.error ?? null }],
3915
+ }, messageId, { hasError: false, isAbort: false });
3916
+ return notice ? (_jsx(TurnErrorDisplay, { errorText: notice.kind === 'unexplained'
3917
+ ? tHardcodedUi.raw('i18nComplete.text73112526c03a')
3918
+ : persistedFailureText(failure.error), className: "mt-2" }, messageId)) : null;
3919
+ }), commandError && (_jsx(TurnErrorDisplay, { error: commandError, isAbort: isAbortError(commandError.cause), modelOptions: modelOptions, className: "mt-2" })), showFallbackBusyRow && fallbackBusyRowTurnId === null && (rowsContext ? (
3920
+ // A channel thread waits in the agent's answer row.
3921
+ _jsx(AgentBusyRow, { sessionId: sessionId })) : (_jsx(SessionBusyIndicator, { sessionId: sessionId,
3922
+ // Matches the stand-in's row spacing under a bubble
3923
+ // (`OptimisticTurn`), so the crossfade into the real
3924
+ // transcript does not move it. Nothing above it when
3925
+ // the transcript is empty, so no margin there.
3926
+ className: turns.length === 0 ? undefined : 'mt-6' })))] }), _jsx("div", { ref: spacerElRef, "data-scroll-spacer": true })] }) }), selectionPopup && (_jsx("div", { "data-reply-popup": true, className: "absolute z-50", style: {
3927
+ left: `${selectionPopup.x}px`,
3928
+ top: `${selectionPopup.y}px`,
3929
+ transform: 'translate(-50%, -100%)',
3930
+ }, children: _jsxs(Button, { onClick: handleSelectionReply, size: "sm", className: "animate-in fade-in-0 zoom-in-95 duration-normal origin-bottom px-3 text-xs ease-out has-[>svg]:px-3", children: [tHardcodedUi.raw('i18nComplete.textc253f451bdd5'), _jsx(ArrowBendUpLeftIcon, { className: "size-4 shrink-0" })] }) })), transcriptRows ? null : (_jsx(ChatMinimap, { turns: turns, scrollRef: scrollRef, contentRef: contentRef })), _jsx("div", { className: cn('absolute inset-x-0 bottom-4 z-20 flex justify-center', !showScrollButton && 'pointer-events-none'), children: _jsx(Button, { variant: "outline", size: "icon-md", "aria-hidden": !showScrollButton, tabIndex: showScrollButton ? undefined : -1, className: cn('hit-area-2 bg-background hover:bg-muted rounded-full', 'transition-[opacity,scale] ease-[cubic-bezier(0.23,1,0.32,1)] active:scale-[0.96] motion-reduce:scale-100 motion-reduce:transition-opacity', showScrollButton
3931
+ ? 'duration-normal scale-100 opacity-100'
3932
+ : 'duration-fast scale-[0.97] opacity-0'), onClick: smoothScrollToAbsoluteBottom, children: _jsx(CaretDownIcon, { className: "size-4" }) }) })] })), readOnly && inputReplacement ? (_jsx("div", { className: cn(COMPOSER_SHELL_CLASS, 'pb-4'), children: inputReplacement })) : null, !readOnly && (_jsxs(_Fragment, { children: [_jsx(SessionChatInput
3742
3933
  // `undefined`, not `true`, once released: the composer's own
3743
3934
  // viewport rule (>= 640px) still decides, so this never forces
3744
3935
  // focus onto a phone keyboard.
3745
- autoFocus: deferComposerFocus ? false : undefined, onSend: async (text, files, mentions, attachments, placement) => {
3746
- if (await queueEdit.save(text))
3747
- return;
3748
- // Enter while a turn runs steers it (D9.1); Cmd/Ctrl+Enter is Queue List.
3749
- await handleSend(text, files, mentions, attachments, composerSendDelivery(placement ?? 'transcript', isBusyRef.current));
3750
- }, prefill: composerPrefill, onPrefillApplied: (id) => {
3751
- useSessionComposerPrefillStore.getState().clearPrefill(sessionId, id);
3752
- },
3753
- // Up from the first row takes the queue back; the placeholder
3754
- // says so while there is something to take.
3755
- onArrowUpAtStart: () => queueEdit.takeBack(),
3756
- // A host placeholder ("Reply…") is static: the rotating tips would replace it.
3757
- hint: canTakeBackQueue ? tHardcodedUi.raw('i18nComplete.text03a01dd53ffa') : composerPlaceholder,
3758
- // Editing a queued message: the send saves it back into the
3759
- // queue, so the control says Submit, never Stop.
3760
- submitLabel: queueEdit.editing ? tQueue('submitEdit') : null, draftScope: composerDraftScope, draftActive: !deferComposerFocus, attachRequestId: attachRequestId, isBusy: isBusy,
3761
- // The ONE projection, not the 300 ms busy fade: it is what
3762
- // decides whether a `/` command may be dispatched, and a fade
3763
- // timer that has already lapsed would let one abort a live turn.
3764
- // `effectiveBusy` folds in optimistic compaction (not a turn, so
3765
- // not in `working`) and the retrying-turn predicate, so this
3766
- // site reads one value instead of re-OR-ing a term onto it.
3767
- sessionWorking: effectiveBusy,
3768
- // Gates `/` COMMANDS only. A prompt typed at a sleeping box is
3769
- // an inbox row and goes out when the box answers; a command has
3770
- // no row, and `runCommand` swallows it silently until the
3771
- // runtime is switched.
3772
- runtimeReady: runtimeReady, rewind: composerRewind, onStop: handleStop, canStop: canStop, escCount: escCount, agents: local.agent.list, selectedAgent: composerAgentName, onAgentChange: handleAgentChange, noAccessibleAgents: noAccessibleAgents, commands: chatCommands, commandsResolved: agentCommands !== undefined, slashFiles: chatSlashFiles, onOpenPastedContent: panel ? stableOpenPastedContent : undefined, onCommand: handleCommand, onHoldCommand: handleHoldCommand, models: local.model.list, selectedModel: local.model.currentKey ?? null, onModelChange: handleModelChange, modelDefaultControls: chatModelDefaultControls, variants: local.model.variant.list, selectedVariant: local.model.variant.current ?? null, onVariantChange: handleVariantChange, messages: messages, sessionId: sessionId, projectId: projectId, providers: providers, modelRequired: true, modelsLoading: providersLoading, onContextClick: handleContextClick, onCompactClick: runtimeCanCompact ? handleCompactClick : undefined, quoteRequests: quoteRequests, onQuoteRequestsApplied: handleQuoteRequestsApplied,
3773
- // Only lock the input into question-answer mode while the session is
3774
- // actually busy (a live question keeps the run busy). If a question
3775
- // chip is ever showing while the session is idle — e.g. a dead /
3776
- // abandoned question the agent left behind — the input stays unlocked
3777
- // so a typed message is sent to the agent instead of being swallowed
3778
- // as a custom answer.
3779
- lockForQuestion: !!renderedQuestion && isBusy,
3780
- // Same dead-prompt guard as questions: only lock while the agent is
3781
- // actually paused on the decision (isBusy), so a stale card can't
3782
- // swallow the composer on an idle session.
3783
- lockForApproval: runtimePermissionLocksComposer(pendingPermissions.length, isBusy), onCustomAnswer: handleCustomAnswer, questionButtonLabel: renderedQuestion ? questionAction.label : null, questionActive: !!renderedQuestion || approvalDocked, questionCanAct: questionAction.canAct, onQuestionAction: handleQuestionAction, aboveSlot: chatAboveSlot, inputSlot: chatInputSlot, toolbarSlot: chatToolbarSlot, underbarSlot: chatUnderbarSlot,
3784
- // The shell can now render on a cached transcript alone, i.e. before
3785
- // the sandbox answers — so sending has to be gated separately from
3786
- // reading. See sessionComposerReadiness.
3787
- notice: hostNotice(composerReadiness.notice, rowsContext?.notices),
3788
- // Inside the thread panel's bordered box, as the channel composer.
3789
- // A phone keeps the row under the card; a 720px desktop window does not.
3790
- underbarPlacement: transcriptRows && !isPhone ? 'inline' : undefined,
3791
- // The panel's toolbar is narrow: the agent is its tile, the model keeps its name.
3792
- agentPickerCompact: transcriptRows && !isPhone,
3793
- // A thread panel's rows run `px-5`, and the channel composer
3794
- // beside it sits `pb-4` off the window's bottom edge: the same
3795
- // margins, so the two boxes line up.
3796
- parentClassName: transcriptRows ? 'max-w-none px-5 pb-4' : undefined, onNoticeRetry: composerReadiness.notice && composerReadiness.retryable
3797
- ? requestRuntimeReconnect
3798
- : undefined }), _jsx("div", { className: cn(COMPOSER_SHELL_CLASS, 'pb-3 empty:hidden', transcriptRows && 'max-w-none px-5'), children: _jsx(HeldMessages, { projectId: projectId, sessionId: projectSessionId }) })] }))] })] }) }) }) }));
3936
+ // A thread a space's chat opened by itself does not take the focus (`ComposerAutoFocusContext`).
3937
+ , {
3938
+ // `undefined`, not `true`, once released: the composer's own
3939
+ // viewport rule (>= 640px) still decides, so this never forces
3940
+ // focus onto a phone keyboard.
3941
+ // A thread a space's chat opened by itself does not take the focus (`ComposerAutoFocusContext`).
3942
+ autoFocus: deferComposerFocus || !composerAutoFocus ? false : undefined, onSend: async (text, files, mentions, attachments, placement) => {
3943
+ if (await queueEdit.save(text))
3944
+ return;
3945
+ // Enter while a turn runs steers it (D9.1); Cmd/Ctrl+Enter is Queue List.
3946
+ await handleSend(text, files, mentions, attachments, composerSendDelivery(placement ?? 'transcript', isBusyRef.current));
3947
+ }, prefill: composerPrefill, onPrefillApplied: (id) => {
3948
+ useSessionComposerPrefillStore.getState().clearPrefill(sessionId, id);
3949
+ },
3950
+ // Up from the first row takes the queue back; the placeholder
3951
+ // says so while there is something to take.
3952
+ onArrowUpAtStart: () => queueEdit.takeBack(),
3953
+ // A host placeholder ("Reply…") is static: the rotating tips would replace it.
3954
+ hint: canTakeBackQueue ? tHardcodedUi.raw('i18nComplete.text03a01dd53ffa') : composerPlaceholder,
3955
+ // Editing a queued message: the send saves it back into the
3956
+ // queue, so the control says Submit, never Stop.
3957
+ submitLabel: queueEdit.editing ? tQueue('submitEdit') : null, draftScope: composerDraftScope, draftActive: !deferComposerFocus, attachRequestId: attachRequestId, isBusy: isBusy,
3958
+ // The ONE projection, not the 300 ms busy fade: it is what
3959
+ // decides whether a `/` command may be dispatched, and a fade
3960
+ // timer that has already lapsed would let one abort a live turn.
3961
+ // `effectiveBusy` folds in optimistic compaction (not a turn, so
3962
+ // not in `working`) and the retrying-turn predicate, so this
3963
+ // site reads one value instead of re-OR-ing a term onto it.
3964
+ sessionWorking: effectiveBusy,
3965
+ // Gates `/` COMMANDS only. A prompt typed at a sleeping box is
3966
+ // an inbox row and goes out when the box answers; a command has
3967
+ // no row, and `runCommand` swallows it silently until the
3968
+ // runtime is switched.
3969
+ runtimeReady: runtimeReady, rewind: composerRewind, onStop: handleStop, canStop: canStop, escCount: escCount, agents: local.agent.list, selectedAgent: composerAgentName, onAgentChange: handleAgentChange, noAccessibleAgents: noAccessibleAgents, commands: chatCommands, commandsResolved: agentCommands !== undefined, slashFiles: chatSlashFiles, onOpenPastedContent: panel ? stableOpenPastedContent : undefined, onCommand: handleCommand, onHoldCommand: handleHoldCommand, models: local.model.list, selectedModel: local.model.currentKey ?? null, onModelChange: handleModelChange, modelDefaultControls: chatModelDefaultControls, inheritedModel: inheritedModelFor(local.model, composerAgentName), variants: local.model.variant.list, selectedVariant: local.model.variant.current ?? null, onVariantChange: handleVariantChange, messages: messages, sessionId: sessionId, projectId: projectId, providers: providers, modelRequired: true, modelsLoading: providersLoading, onContextClick: handleContextClick, onCompactClick: runtimeCanCompact ? handleCompactClick : undefined, quoteRequests: quoteRequests, onQuoteRequestsApplied: handleQuoteRequestsApplied,
3970
+ // Only lock the input into question-answer mode while the session is
3971
+ // actually busy (a live question keeps the run busy). If a question
3972
+ // chip is ever showing while the session is idle — e.g. a dead /
3973
+ // abandoned question the agent left behind — the input stays unlocked
3974
+ // so a typed message is sent to the agent instead of being swallowed
3975
+ // as a custom answer.
3976
+ lockForQuestion: !!renderedQuestion && isBusy,
3977
+ // Same dead-prompt guard as questions: only lock while the agent is
3978
+ // actually paused on the decision (isBusy), so a stale card can't
3979
+ // swallow the composer on an idle session.
3980
+ lockForApproval: runtimePermissionLocksComposer(livePermissions.length, isBusy), onCustomAnswer: handleCustomAnswer, questionButtonLabel: renderedQuestion ? questionAction.label : null, questionActive: !!renderedQuestion || approvalDocked, questionCanAct: questionAction.canAct, onQuestionAction: handleQuestionAction, aboveSlot: chatAboveSlot, inputSlot: chatInputSlot, toolbarSlot: chatToolbarSlot, underbarSlot: chatUnderbarSlot,
3981
+ // The shell can now render on a cached transcript alone, i.e. before
3982
+ // the sandbox answers — so sending has to be gated separately from
3983
+ // reading. See sessionComposerReadiness.
3984
+ notice: hostNotice(composerReadiness.notice, rowsContext?.notices),
3985
+ // Inside the thread panel's bordered box, as the channel composer.
3986
+ // A phone keeps the row under the card; a 720px desktop window does not.
3987
+ underbarPlacement: transcriptRows && !isPhone ? 'inline' : undefined,
3988
+ // The panel's toolbar is narrow: the agent is its tile, the model keeps its name.
3989
+ agentPickerCompact: transcriptRows && !isPhone,
3990
+ // A thread panel's rows run `px-5`, and the channel composer
3991
+ // beside it sits `pb-4` off the window's bottom edge: the same
3992
+ // margins, so the two boxes line up.
3993
+ parentClassName: transcriptRows ? 'max-w-none px-5 pb-4' : undefined, onNoticeRetry: composerReadiness.notice && composerReadiness.retryable
3994
+ ? requestRuntimeReconnect
3995
+ : undefined }), _jsx("div", { className: cn(COMPOSER_SHELL_CLASS, 'pb-3 empty:hidden', transcriptRows && 'max-w-none px-5'), children: _jsx(HeldMessages, { projectId: projectId, sessionId: projectSessionId }) })] }))] })] }) }) }) }) }));
3799
3996
  }