@kortix/ui 0.14.19 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (538) hide show
  1. package/README.md +1 -1
  2. package/dist/_vendor/kortix-shared.js +1188 -202
  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/code-language.d.ts +2 -2
  6. package/dist/_vendor/shared/html.d.ts +7 -0
  7. package/dist/_vendor/shared/index.d.ts +1 -1
  8. package/dist/_vendor/shared/peer-message-prompt.d.ts +7 -1
  9. package/dist/_vendor/shared/pixel-mark.d.ts +28 -0
  10. package/dist/_vendor/shared/project-glyphs.d.ts +103 -20
  11. package/dist/_vendor/shared/runtime-versions.d.ts +2 -6
  12. package/dist/_vendor/shared/tool-output/media-path.d.ts +1 -6
  13. package/dist/_vendor/shared/tool-output/scan.d.ts +2 -0
  14. package/dist/_vendor/shared/utils/string.d.ts +6 -0
  15. package/dist/_vendor/shared/webhook-signing.d.ts +3 -1
  16. package/dist/access/access/access-dialog-share.d.ts +3 -28
  17. package/dist/access/access/access-dialog-share.js +3 -75
  18. package/dist/artifacts/artifact-frame.js +26 -2
  19. package/dist/artifacts/artifact-session.js +8 -3
  20. package/dist/artifacts/frame-policy.d.ts +2 -9
  21. package/dist/artifacts/frame-policy.js +2 -25
  22. package/dist/customize/agents/agent-page.js +5 -5
  23. package/dist/customize/agents/agent-status.js +1 -1
  24. package/dist/customize/agents/agents-page.js +4 -4
  25. package/dist/customize/agents/create-agent-modal.js +1 -1
  26. package/dist/customize/connectors/connector-filter.d.ts +2 -1
  27. package/dist/customize/connectors/connector-filter.js +2 -3
  28. package/dist/customize/connectors/connectors-page.js +15 -24
  29. package/dist/customize/connectors/detail/connector-status.d.ts +3 -24
  30. package/dist/customize/connectors/detail/connector-status.js +2 -42
  31. package/dist/customize/connectors/detail/use-connector-detail.d.ts +2 -6
  32. package/dist/customize/connectors/detail/use-connector-detail.js +3 -13
  33. package/dist/customize/connectors/install/install.d.ts +2 -6
  34. package/dist/customize/connectors/install/install.js +2 -16
  35. package/dist/customize/connectors/provider-label.d.ts +4 -17
  36. package/dist/customize/connectors/provider-label.js +4 -37
  37. package/dist/customize/connectors/use-agent-access.d.ts +3 -3
  38. package/dist/customize/providers/provider-connect.d.ts +6 -15
  39. package/dist/customize/providers/provider-connect.js +5 -36
  40. package/dist/customize/sections/connector-connection-form.d.ts +3 -7
  41. package/dist/customize/sections/connector-connection-form.js +2 -33
  42. package/dist/customize/sections/connector-oauth2-auto.d.ts +3 -33
  43. package/dist/customize/sections/connector-oauth2-auto.js +2 -64
  44. package/dist/customize/sections/connectors-view.js +50 -37
  45. package/dist/customize/sections/gateway-view.d.ts +6 -5
  46. package/dist/customize/sections/gateway-view.js +31 -13
  47. package/dist/customize/sections/llm-provider/chatgpt-subscription-connect.js +21 -18
  48. package/dist/customize/sections/llm-provider/constants.d.ts +1 -2
  49. package/dist/customize/sections/llm-provider/constants.js +1 -2
  50. package/dist/customize/sections/llm-provider/device-grant.d.ts +15 -0
  51. package/dist/customize/sections/llm-provider/device-grant.js +27 -0
  52. package/dist/customize/sections/llm-provider/utils.d.ts +1 -41
  53. package/dist/customize/sections/llm-provider/utils.js +1 -52
  54. package/dist/customize/sections/view/account-secret-resources-panel.js +4 -1
  55. package/dist/customize/sections/view/agent-editor-catalog.js +0 -5
  56. package/dist/customize/sections/view/agent-editor.d.ts +2 -2
  57. package/dist/customize/sections/view/agent-editor.js +2 -2
  58. package/dist/customize/sections/view/channel-settings-patch.js +1 -1
  59. package/dist/customize/sections/view/channels-view.js +8 -8
  60. package/dist/customize/sections/view/connector-connections.d.ts +5 -85
  61. package/dist/customize/sections/view/connector-connections.js +5 -99
  62. package/dist/customize/sections/view/gateway/gateway-logs.d.ts +42 -3
  63. package/dist/customize/sections/view/gateway/gateway-logs.js +212 -15
  64. package/dist/customize/sections/view/gateway/gateway-overview.js +1 -1
  65. package/dist/customize/sections/view/gateway/gateway-routing.d.ts +3 -3
  66. package/dist/customize/sections/view/gateway/gateway-routing.js +81 -200
  67. package/dist/customize/sections/view/gateway/routing-parts.d.ts +101 -0
  68. package/dist/customize/sections/view/gateway/routing-parts.js +154 -0
  69. package/dist/customize/sections/view/gateway/routing-sentence-layout.d.ts +2 -0
  70. package/dist/customize/sections/view/gateway/routing-sentence-layout.js +82 -0
  71. package/dist/customize/sections/view/review-center-connected.js +54 -21
  72. package/dist/customize/sections/view/review-view.d.ts +7 -0
  73. package/dist/customize/sections/view/review-view.js +11 -0
  74. package/dist/customize/sections/view/secret-delivery.d.ts +4 -5
  75. package/dist/customize/sections/view/secret-delivery.js +6 -5
  76. package/dist/customize/sections/view/secrets-view.js +1 -1
  77. package/dist/customize/sections/view/subscription-usage-tab.d.ts +14 -0
  78. package/dist/customize/sections/view/subscription-usage-tab.js +122 -0
  79. package/dist/customize/sections/view/subscription-usage.d.ts +34 -0
  80. package/dist/customize/sections/view/subscription-usage.js +98 -0
  81. package/dist/customize/settings/tabs/experimental-tab.js +3 -3
  82. package/dist/customize/settings/tabs/general-tab.js +65 -10
  83. package/dist/customize/shared/catalog/catalog-card.d.ts +9 -4
  84. package/dist/customize/shared/catalog/catalog-card.js +3 -3
  85. package/dist/customize/shared/channels-switch-dialog.d.ts +1 -1
  86. package/dist/customize/shared/channels-switch-dialog.js +1 -1
  87. package/dist/customize/shared/feature-gate-screen.js +1 -1
  88. package/dist/customize/triggers/schedule/post-to-field.d.ts +1 -1
  89. package/dist/customize/triggers/schedule/post-to-field.js +2 -2
  90. package/dist/customize/triggers/schedule/trigger-composer-logic.d.ts +1 -1
  91. package/dist/customize/triggers/schedule/trigger-runs-logic.d.ts +6 -0
  92. package/dist/customize/triggers/schedule/trigger-runs-logic.js +13 -0
  93. package/dist/customize/triggers/schedule/trigger-runs-panel.js +9 -2
  94. package/dist/files/drives/conflict-marks.d.ts +28 -0
  95. package/dist/files/drives/conflict-marks.js +39 -0
  96. package/dist/files/drives/session-drives-chip.js +15 -10
  97. package/dist/files/project/api/runtime-files.d.ts +2 -2
  98. package/dist/files/project/api/runtime-files.js +2 -2
  99. package/dist/files/project/components/drive-explorer.js +1 -1
  100. package/dist/files/project/components/drive-grid-view.js +0 -1
  101. package/dist/files/project/components/drive-list-view.js +0 -1
  102. package/dist/files/project/components/file-explorer-page.js +1 -1
  103. package/dist/files/project/hooks/index.d.ts +1 -1
  104. package/dist/files/project/hooks/index.js +1 -1
  105. package/dist/files/project/hooks/use-server-health.d.ts +1 -1
  106. package/dist/files/project/hooks/use-server-health.js +1 -1
  107. package/dist/files/project/search/workspace-search-service.d.ts +1 -1
  108. package/dist/files/project/search/workspace-search-service.js +1 -1
  109. package/dist/files/runtime/hooks/index.d.ts +1 -1
  110. package/dist/files/runtime/hooks/index.js +1 -1
  111. package/dist/files/runtime/hooks/server-health-state.d.ts +2 -2
  112. package/dist/files/runtime/hooks/server-health-state.js +2 -2
  113. package/dist/files/runtime/hooks/system-dir.js +2 -2
  114. package/dist/files/runtime/hooks/use-file-content.d.ts +1 -1
  115. package/dist/files/runtime/hooks/use-file-content.js +1 -1
  116. package/dist/files/runtime/hooks/use-file-list.d.ts +1 -1
  117. package/dist/files/runtime/hooks/use-file-list.js +3 -3
  118. package/dist/files/runtime/hooks/use-server-health.d.ts +2 -2
  119. package/dist/files/runtime/hooks/use-server-health.js +3 -3
  120. package/dist/files/runtime/hooks/use-workspace-search.d.ts +1 -2
  121. package/dist/files/runtime/hooks/use-workspace-search.js +0 -1
  122. package/dist/files/runtime/index.d.ts +2 -2
  123. package/dist/files/runtime/index.js +2 -2
  124. package/dist/files/runtime/path-utils.d.ts +1 -1
  125. package/dist/files/runtime/path-utils.js +1 -1
  126. package/dist/files/runtime/sandbox-explorer-source.d.ts +1 -1
  127. package/dist/files/runtime/sandbox-explorer-source.js +1 -1
  128. package/dist/files/runtime/sandbox-file-explorer.d.ts +1 -1
  129. package/dist/files/runtime/sandbox-file-explorer.js +2 -2
  130. package/dist/files/tree/components/file-tree-item.js +0 -1
  131. package/dist/files/tree/hooks/use-file-events.d.ts +1 -1
  132. package/dist/files/tree/hooks/use-file-events.js +1 -1
  133. package/dist/files/viewer/index.d.ts +1 -1
  134. package/dist/files/viewer/index.js +1 -1
  135. package/dist/i18n/en.d.ts +513 -203
  136. package/dist/i18n/en.js +610 -300
  137. package/dist/index.d.ts +1 -1
  138. package/dist/index.js +1 -1
  139. package/dist/internal/account-hub/sections.d.ts +1 -1
  140. package/dist/internal/capture/use-capture-area.d.ts +5 -1
  141. package/dist/internal/capture/use-capture-area.js +16 -9
  142. package/dist/internal/files/file-read-retry.js +1 -1
  143. package/dist/internal/files/types.d.ts +2 -2
  144. package/dist/internal/files/types.js +2 -2
  145. package/dist/internal/goals/goal-meta.d.ts +76 -10
  146. package/dist/internal/goals/goal-meta.js +191 -14
  147. package/dist/internal/hooks/connectors/use-add-account.d.ts +3 -9
  148. package/dist/internal/hooks/connectors/use-add-account.js +3 -18
  149. package/dist/internal/hooks/connectors/use-connect-link.d.ts +3 -2
  150. package/dist/internal/hooks/connectors/use-connect-link.js +15 -24
  151. package/dist/internal/hooks/connectors/use-pipedream-connect-project.d.ts +3 -56
  152. package/dist/internal/hooks/connectors/use-pipedream-connect-project.js +3 -87
  153. package/dist/internal/hooks/projects/use-new-project-session.d.ts +3 -2
  154. package/dist/internal/hooks/projects/use-new-project-session.js +4 -3
  155. package/dist/internal/hooks/projects/use-project-can-run.d.ts +7 -0
  156. package/dist/internal/hooks/projects/use-project-can-run.js +12 -5
  157. package/dist/internal/hooks/projects/use-restart-project-session.d.ts +0 -1
  158. package/dist/internal/hooks/projects/use-restart-project-session.js +0 -1
  159. package/dist/internal/layout/nav-hover-card.d.ts +1 -1
  160. package/dist/internal/layout/nav-hover-card.js +1 -1
  161. package/dist/internal/layout/project-capability-nav.d.ts +1 -1
  162. package/dist/internal/layout/project-capability-nav.js +7 -3
  163. package/dist/internal/layout/project-page-header.d.ts +3 -1
  164. package/dist/internal/layout/project-page-header.js +2 -2
  165. package/dist/internal/lib/account-secret-access.d.ts +1 -41
  166. package/dist/internal/lib/account-secret-access.js +3 -46
  167. package/dist/internal/lib/browser-error-noise.d.ts +2 -2
  168. package/dist/internal/lib/browser-error-noise.js +2 -2
  169. package/dist/internal/lib/browser-noise/rules/expected-states.d.ts +2 -15
  170. package/dist/internal/lib/browser-noise/rules/expected-states.js +6 -56
  171. package/dist/internal/lib/browser-noise/rules/injected-scripts.js +18 -0
  172. package/dist/internal/lib/browser-noise/rules/old-browsers.d.ts +1 -0
  173. package/dist/internal/lib/browser-noise/rules/old-browsers.js +1 -1
  174. package/dist/internal/lib/browser-noise/rules/rejections.d.ts +0 -9
  175. package/dist/internal/lib/browser-noise/rules/rejections.js +0 -14
  176. package/dist/internal/lib/capability-tab-routes.d.ts +3 -3
  177. package/dist/internal/lib/capability-tab-routes.js +11 -3
  178. package/dist/internal/lib/delivered-but-disconnected.js +3 -5
  179. package/dist/internal/lib/error-handler.js +8 -3
  180. package/dist/internal/lib/llm-providers.d.ts +4 -110
  181. package/dist/internal/lib/llm-providers.js +5 -102
  182. package/dist/internal/lib/navigation/message-link.d.ts +32 -0
  183. package/dist/internal/lib/navigation/message-link.js +51 -0
  184. package/dist/internal/lib/navigation/session-href.d.ts +11 -0
  185. package/dist/internal/lib/navigation/session-href.js +20 -0
  186. package/dist/internal/lib/navigation/session-spawn-urls.d.ts +17 -0
  187. package/dist/internal/lib/navigation/session-spawn-urls.js +26 -0
  188. package/dist/internal/lib/pixel-mark.d.ts +4 -17
  189. package/dist/internal/lib/pixel-mark.js +5 -148
  190. package/dist/internal/lib/sounds.d.ts +4 -4
  191. package/dist/internal/lib/sounds.js +4 -4
  192. package/dist/internal/lib/space-scope.d.ts +3 -3
  193. package/dist/internal/lib/space-scope.js +3 -3
  194. package/dist/internal/lib/use-project-feature-flags.js +9 -7
  195. package/dist/internal/lib/web-notifications.d.ts +1 -1
  196. package/dist/internal/lib/web-notifications.js +0 -3
  197. package/dist/internal/notifications/notification-bell.js +1 -3
  198. package/dist/internal/notifications/notification-rows.d.ts +2 -2
  199. package/dist/internal/notifications/notification-rows.js +2 -3
  200. package/dist/internal/session-types/index.d.ts +5 -7
  201. package/dist/internal/session-types/index.js +5 -7
  202. package/dist/internal/stores/active-space-store.d.ts +1 -1
  203. package/dist/internal/stores/active-space-store.js +1 -1
  204. package/dist/internal/stores/composer-prefill-store.js +4 -1
  205. package/dist/internal/stores/kortix-computer-store.d.ts +15 -0
  206. package/dist/internal/stores/kortix-computer-store.js +12 -0
  207. package/dist/internal/stores/sound-store.d.ts +4 -4
  208. package/dist/internal/stores/sound-store.js +10 -0
  209. package/dist/lib/routes.d.ts +17 -7
  210. package/dist/lib/routes.js +18 -2
  211. package/dist/markdown/app-link-icons.d.ts +7 -0
  212. package/dist/markdown/app-link-icons.js +20 -0
  213. package/dist/markdown/app-links.d.ts +9 -0
  214. package/dist/markdown/app-links.js +112 -0
  215. package/dist/markdown/code/shiki-highlighter.js +14 -5
  216. package/dist/markdown/doc-editor/doc-attrs.d.ts +28 -0
  217. package/dist/markdown/doc-editor/doc-attrs.js +156 -0
  218. package/dist/markdown/doc-editor/doc-embed.d.ts +6 -0
  219. package/dist/markdown/doc-editor/doc-embed.js +26 -8
  220. package/dist/markdown/doc-editor/doc-extensions.d.ts +10 -0
  221. package/dist/markdown/doc-editor/doc-extensions.js +55 -8
  222. package/dist/markdown/doc-editor/doc-fidelity.d.ts +72 -0
  223. package/dist/markdown/doc-editor/doc-fidelity.js +135 -0
  224. package/dist/markdown/doc-editor/doc-node-view.d.ts +9 -0
  225. package/dist/markdown/doc-editor/doc-node-view.js +29 -0
  226. package/dist/markdown/doc-editor/markdown.d.ts +20 -0
  227. package/dist/markdown/doc-editor/markdown.js +455 -18
  228. package/dist/markdown/file-links.js +12 -3
  229. package/dist/markdown/markdown-frontmatter.d.ts +6 -6
  230. package/dist/markdown/markdown-frontmatter.js +3 -3
  231. package/dist/markdown/unified-markdown.d.ts +1 -1
  232. package/dist/markdown/unified-markdown.js +129 -10
  233. package/dist/primitives/button.js +2 -1
  234. package/dist/primitives/emoji-picker.js +16 -100
  235. package/dist/primitives/emoji-tint.js +12 -12
  236. package/dist/primitives/entity-avatar.js +14 -9
  237. package/dist/primitives/glyph-face.d.ts +19 -12
  238. package/dist/primitives/glyph-face.js +59 -20
  239. package/dist/primitives/glyph-paths-source.d.ts +7 -0
  240. package/dist/primitives/glyph-paths-source.js +14 -6
  241. package/dist/primitives/glyph-paths.generated.d.ts +1 -1
  242. package/dist/primitives/glyph-paths.generated.js +947 -204
  243. package/dist/primitives/glyph-picker.d.ts +6 -10
  244. package/dist/primitives/glyph-picker.js +147 -98
  245. package/dist/primitives/glyph-registry.js +1604 -1
  246. package/dist/primitives/glyph-tint.d.ts +28 -3
  247. package/dist/primitives/glyph-tint.js +41 -83
  248. package/dist/primitives/kortix-glyphs.d.ts +32 -0
  249. package/dist/primitives/kortix-glyphs.js +157 -0
  250. package/dist/primitives/project-icon-picker.d.ts +8 -1
  251. package/dist/primitives/project-icon-picker.js +13 -5
  252. package/dist/primitives/user-avatar.d.ts +8 -1
  253. package/dist/primitives/user-avatar.js +2 -2
  254. package/dist/providers/ui-provider.d.ts +1 -8
  255. package/dist/session/actions/project-session-list-helpers.js +1 -1
  256. package/dist/session/agents/agent-model.js +4 -0
  257. package/dist/session/agents/agent-state-mark.d.ts +12 -7
  258. package/dist/session/agents/agent-state-mark.js +37 -15
  259. package/dist/session/agents/agent-strip.js +8 -2
  260. package/dist/session/agents/agent-surface.d.ts +81 -0
  261. package/dist/session/agents/agent-surface.js +97 -0
  262. package/dist/session/agents/held-messages.d.ts +1 -5
  263. package/dist/session/agents/held-messages.js +8 -25
  264. package/dist/session/agents/legacy-subagent-chat.js +1 -1
  265. package/dist/session/agents/session-peek.js +24 -12
  266. package/dist/session/agents/steer-session.d.ts +2 -0
  267. package/dist/session/agents/steer-session.js +3 -2
  268. package/dist/session/agents/subagent-dialog-content.d.ts +30 -1
  269. package/dist/session/agents/subagent-dialog-content.js +147 -33
  270. package/dist/session/agents/subagent-view.d.ts +15 -5
  271. package/dist/session/agents/subagent-view.js +28 -6
  272. package/dist/session/agents/tasks-panel.js +2 -12
  273. package/dist/session/agents/workflow-run-controls.d.ts +3 -1
  274. package/dist/session/agents/workflow-run-controls.js +12 -7
  275. package/dist/session/composer/ComposerAboveCard.d.ts +4 -1
  276. package/dist/session/composer/ComposerAboveCard.js +2 -2
  277. package/dist/session/composer/ComposerCard.d.ts +7 -1
  278. package/dist/session/composer/ComposerCard.js +74 -9
  279. package/dist/session/composer/agent-selector.d.ts +16 -0
  280. package/dist/session/composer/agent-selector.js +19 -11
  281. package/dist/session/composer/chat-input/chat-input-control.d.ts +64 -0
  282. package/dist/session/composer/chat-input/chat-input-control.js +578 -0
  283. package/dist/session/composer/chat-input/chat-input-overrides.d.ts +76 -0
  284. package/dist/session/composer/chat-input/chat-input-overrides.js +40 -0
  285. package/dist/session/composer/chat-input/chat-input-panes.d.ts +56 -0
  286. package/dist/session/composer/chat-input/chat-input-panes.js +148 -0
  287. package/dist/session/composer/chat-input/chat-input-summary.d.ts +67 -0
  288. package/dist/session/composer/chat-input/chat-input-summary.js +67 -0
  289. package/dist/session/composer/chat-queue-lines.d.ts +20 -0
  290. package/dist/session/composer/chat-queue-lines.js +20 -0
  291. package/dist/session/composer/composer-chat-input.d.ts +9 -2
  292. package/dist/session/composer/composer-chat-input.js +14 -6
  293. package/dist/session/composer/composer-focus-context.d.ts +7 -0
  294. package/dist/session/composer/composer-focus-context.js +9 -0
  295. package/dist/session/composer/composer-toolbar.d.ts +3 -1
  296. package/dist/session/composer/composer-toolbar.js +3 -3
  297. package/dist/session/composer/composer-underbar.d.ts +10 -1
  298. package/dist/session/composer/composer-underbar.js +10 -2
  299. package/dist/session/composer/composer.d.ts +12 -0
  300. package/dist/session/composer/composer.js +71 -2
  301. package/dist/session/composer/editor/composer-editor.d.ts +10 -2
  302. package/dist/session/composer/editor/composer-editor.js +22 -6
  303. package/dist/session/composer/editor/first-visual-line.d.ts +2 -0
  304. package/dist/session/composer/editor/first-visual-line.js +9 -0
  305. package/dist/session/composer/editor/mention-node.js +2 -0
  306. package/dist/session/composer/editor/serialize.js +9 -1
  307. package/dist/session/composer/hooks/use-file-search.d.ts +16 -16
  308. package/dist/session/composer/hooks/use-file-search.js +17 -17
  309. package/dist/session/composer/menus/mention-controller.d.ts +3 -11
  310. package/dist/session/composer/menus/mention-controller.js +54 -16
  311. package/dist/session/composer/menus/mention-menu.d.ts +7 -2
  312. package/dist/session/composer/menus/mention-menu.js +17 -9
  313. package/dist/session/composer/menus/menu-items.d.ts +9 -0
  314. package/dist/session/composer/menus/space-mentions.d.ts +58 -0
  315. package/dist/session/composer/menus/space-mentions.js +99 -0
  316. package/dist/session/composer/prompt-history.d.ts +9 -0
  317. package/dist/session/composer/prompt-history.js +45 -0
  318. package/dist/session/composer/queue-projection.d.ts +2 -0
  319. package/dist/session/composer/queue-projection.js +1 -0
  320. package/dist/session/composer/queued-prompt-list.js +53 -4
  321. package/dist/session/composer/reasoning-effort-selector.d.ts +20 -0
  322. package/dist/session/composer/reasoning-effort-selector.js +3 -3
  323. package/dist/session/composer/types.d.ts +2 -1
  324. package/dist/session/composer/use-instant-session-send.js +2 -2
  325. package/dist/session/header/session-goal-indicator.js +4 -4
  326. package/dist/session/header/session-site-header.js +7 -3
  327. package/dist/session/header/subagent-hover-card.d.ts +7 -4
  328. package/dist/session/header/subagent-hover-card.js +62 -11
  329. package/dist/session/list/session-status-mark.d.ts +42 -0
  330. package/dist/{workspace/sidebar → session/list}/session-status-mark.js +37 -2
  331. package/dist/session/models/model-selector.d.ts +7 -2
  332. package/dist/session/models/model-selector.js +39 -31
  333. package/dist/session/overrides/provider-secret-pool-editor.d.ts +11 -0
  334. package/dist/session/overrides/provider-secret-pool-editor.js +17 -0
  335. package/dist/session/overrides/session-overrides-control.d.ts +5 -0
  336. package/dist/session/overrides/session-overrides-toolbar.js +147 -7
  337. package/dist/session/panel/easy/plan-card.d.ts +2 -2
  338. package/dist/session/panel/easy/plan-card.js +2 -2
  339. package/dist/session/panel/model-switch-event.d.ts +8 -0
  340. package/dist/session/panel/model-switch-event.js +19 -0
  341. package/dist/session/panel/session-audit-panel.js +3 -2
  342. package/dist/session/panel/session-desktop.js +11 -1
  343. package/dist/session/panel/session-panel-provider.js +1 -1
  344. package/dist/session/panel/shared/use-panel-handoffs.d.ts +2 -2
  345. package/dist/session/panel/shared/use-panel-handoffs.js +21 -2
  346. package/dist/session/panel/use-session-panel-state.js +2 -2
  347. package/dist/session/prompts/ask-deck.d.ts +21 -0
  348. package/dist/session/prompts/ask-deck.js +253 -0
  349. package/dist/session/prompts/session-permission-prompt.d.ts +7 -1
  350. package/dist/session/prompts/session-permission-prompt.js +3 -3
  351. package/dist/session/status/sandbox-loading-boundary.js +2 -2
  352. package/dist/session/status/session-load-state.d.ts +0 -1
  353. package/dist/session/status/session-load-state.js +2 -4
  354. package/dist/session/status/session-terminal-state.d.ts +47 -0
  355. package/dist/session/status/session-terminal-state.js +56 -0
  356. package/dist/session/thread/message-parsing.d.ts +0 -1
  357. package/dist/session/thread/message-parsing.js +0 -1
  358. package/dist/session/thread/plan-surface.d.ts +1 -1
  359. package/dist/session/thread/plan-surface.js +1 -1
  360. package/dist/session/thread/session-chat.d.ts +4 -2
  361. package/dist/session/thread/session-chat.js +547 -409
  362. package/dist/session/thread/session-context-metrics.d.ts +0 -1
  363. package/dist/session/thread/session-context-metrics.js +1 -1
  364. package/dist/session/thread/session-context-sub-sessions.js +3 -1
  365. package/dist/session/thread/show-work.d.ts +38 -0
  366. package/dist/session/thread/show-work.js +115 -0
  367. package/dist/session/thread/stop-sequence.d.ts +51 -0
  368. package/dist/session/thread/stop-sequence.js +55 -0
  369. package/dist/session/thread/thread-boot-rows.d.ts +2 -1
  370. package/dist/session/thread/thread-boot-rows.js +7 -3
  371. package/dist/session/thread/transcript-rows.d.ts +36 -0
  372. package/dist/session/thread/transcript.d.ts +48 -4
  373. package/dist/session/thread/transcript.js +228 -36
  374. package/dist/session/thread/typing-indicator.d.ts +21 -0
  375. package/dist/session/thread/typing-indicator.js +46 -0
  376. package/dist/session/tool/shared/infrastructure-contexts.d.ts +12 -0
  377. package/dist/session/tool/shared/infrastructure-contexts.js +6 -0
  378. package/dist/session/tool/tool-part-renderer.d.ts +2 -0
  379. package/dist/session/tool/tool-part-renderer.js +16 -2
  380. package/dist/session/tool/tools/apply-patch-tool.d.ts +1 -1
  381. package/dist/session/tool/tools/apply-patch-tool.js +1 -1
  382. package/dist/session/tool/tools/kortix-action-tool.js +8 -1
  383. package/dist/session/tool/tools/multi-agent-tool-bodies.d.ts +19 -0
  384. package/dist/session/tool/tools/multi-agent-tool-bodies.js +35 -14
  385. package/dist/session/tool/tools/multi-agent-tools.js +1 -1
  386. package/dist/session/tool/tools/pty-kill-tool.d.ts +1 -1
  387. package/dist/session/tool/tools/pty-kill-tool.js +1 -1
  388. package/dist/session/tool/tools/pty-read-tool.d.ts +2 -2
  389. package/dist/session/tool/tools/pty-read-tool.js +2 -2
  390. package/dist/session/tool/tools/pty-spawn-tool.d.ts +1 -1
  391. package/dist/session/tool/tools/pty-spawn-tool.js +1 -1
  392. package/dist/session/tool/tools/pty-write-tool.d.ts +1 -1
  393. package/dist/session/tool/tools/pty-write-tool.js +1 -1
  394. package/dist/session/tool/tools/session-spawn-urls.d.ts +1 -16
  395. package/dist/session/tool/tools/session-spawn-urls.js +4 -26
  396. package/dist/session/tool/tools/task-tool.d.ts +5 -18
  397. package/dist/session/tool/tools/task-tool.js +47 -86
  398. package/dist/session/tool/tools/todo-write-tool.d.ts +1 -1
  399. package/dist/session/tool/tools/todo-write-tool.js +1 -1
  400. package/dist/session/tool/tools/workflow-progress.d.ts +14 -18
  401. package/dist/session/tool/tools/workflow-progress.js +24 -179
  402. package/dist/session/tool/tools/workflow-result-text.d.ts +15 -0
  403. package/dist/session/tool/tools/workflow-result-text.js +34 -0
  404. package/dist/session/tool/tools/workflow-run-card.d.ts +35 -0
  405. package/dist/session/tool/tools/workflow-run-card.js +157 -0
  406. package/dist/session/tool/tools/workflow-tool.js +45 -58
  407. package/dist/session/turn/activity-burst.d.ts +2 -2
  408. package/dist/session/turn/activity-burst.js +11 -5
  409. package/dist/session/turn/answered-question-step.d.ts +29 -0
  410. package/dist/session/turn/answered-question-step.js +48 -3
  411. package/dist/session/turn/notice-batch-group.d.ts +4 -4
  412. package/dist/session/turn/notice-batch-group.js +5 -8
  413. package/dist/session/turn/peer-message-row.d.ts +14 -8
  414. package/dist/session/turn/peer-message-row.js +38 -64
  415. package/dist/session/turn/plan-anchor.d.ts +3 -3
  416. package/dist/session/turn/plan-anchor.js +3 -3
  417. package/dist/session/turn/plan-card.d.ts +7 -7
  418. package/dist/session/turn/plan-card.js +7 -7
  419. package/dist/session/turn/subagent-notice-row.d.ts +16 -1
  420. package/dist/session/turn/subagent-notice-row.js +47 -35
  421. package/dist/session/turn/throttled-markdown.js +4 -1
  422. package/dist/session/turn/turn-work-accordion.d.ts +10 -3
  423. package/dist/session/turn/turn-work-accordion.js +18 -11
  424. package/dist/session/turn/user-message.js +16 -42
  425. package/dist/session/turn/voice-turn.d.ts +22 -0
  426. package/dist/session/turn/voice-turn.js +32 -0
  427. package/dist/session/voice/call-ring.d.ts +10 -0
  428. package/dist/session/voice/call-ring.js +52 -0
  429. package/dist/session/voice/use-voice-call.d.ts +4 -4
  430. package/dist/session/voice/use-voice-call.js +6 -9
  431. package/dist/session/voice/voice-call-card.d.ts +6 -0
  432. package/dist/session/voice/voice-call-card.js +113 -0
  433. package/dist/session/voice/voice-call-state.d.ts +3 -0
  434. package/dist/session/voice/voice-call-state.js +2 -1
  435. package/dist/session/voice/voice-call-store.d.ts +16 -6
  436. package/dist/session/voice/voice-call-store.js +5 -5
  437. package/dist/session/voice/voice-call.d.ts +4 -8
  438. package/dist/session/voice/voice-call.js +33 -36
  439. package/dist/styles/components.css +33 -0
  440. package/dist/styles/theme.css +26 -0
  441. package/dist/styles.css +1 -1
  442. package/dist/terminal/terminal-card-gate.d.ts +6 -3
  443. package/dist/terminal/terminal-card-gate.js +21 -4
  444. package/dist/workspace/admin/project-admin-dashboard.d.ts +1 -1
  445. package/dist/workspace/admin/project-admin-dashboard.js +12 -9
  446. package/dist/workspace/index.d.ts +3 -2
  447. package/dist/workspace/index.js +2 -1
  448. package/dist/workspace/layout/use-project-home-send.d.ts +2 -0
  449. package/dist/workspace/layout/use-project-home-send.js +5 -3
  450. package/dist/workspace/memory/company-memory-page.d.ts +1 -1
  451. package/dist/workspace/memory/company-memory-page.js +1 -1
  452. package/dist/workspace/new/use-creatable-accounts.js +13 -4
  453. package/dist/workspace/projects/modal/project-icon-field.js +49 -34
  454. package/dist/workspace/review/review-center.d.ts +12 -3
  455. package/dist/workspace/review/review-center.js +50 -16
  456. package/dist/workspace/review/review-reducer.d.ts +7 -0
  457. package/dist/workspace/review/review-reducer.js +11 -0
  458. package/dist/workspace/sessions/project-sessions-helpers.js +1 -1
  459. package/dist/workspace/sessions/project-sessions-view.js +1 -1
  460. package/dist/workspace/sessions/session-row.js +6 -4
  461. package/dist/workspace/sessions/sessions-toolbar.d.ts +1 -1
  462. package/dist/workspace/sessions/sessions-toolbar.js +4 -4
  463. package/dist/workspace/sidebar/footer/project-artifacts-nav.d.ts +6 -1
  464. package/dist/workspace/sidebar/footer/project-artifacts-nav.js +47 -4
  465. package/dist/workspace/sidebar/footer/project-memory-nav.d.ts +1 -1
  466. package/dist/workspace/sidebar/footer/project-memory-nav.js +1 -1
  467. package/dist/workspace/sidebar/project-nav-items.js +13 -17
  468. package/dist/workspace/sidebar/project-session-list.d.ts +7 -1
  469. package/dist/workspace/sidebar/project-session-list.js +63 -24
  470. package/dist/workspace/sidebar/project-sidebar.js +10 -7
  471. package/dist/workspace/sidebar/project-spaces-nav.d.ts +7 -3
  472. package/dist/workspace/sidebar/project-spaces-nav.js +77 -46
  473. package/dist/workspace/sidebar/session-brief-hover-card.d.ts +4 -2
  474. package/dist/workspace/sidebar/session-brief-hover-card.js +47 -28
  475. package/dist/workspace/sidebar/session-group-sections.js +12 -4
  476. package/dist/workspace/sidebar/sidebar-more-group.d.ts +13 -0
  477. package/dist/workspace/sidebar/sidebar-more-group.js +27 -0
  478. package/dist/workspace/space/space-blocks.d.ts +3 -1
  479. package/dist/workspace/space/space-blocks.js +4 -7
  480. package/dist/workspace/space/space-page.d.ts +4 -6
  481. package/dist/workspace/space/space-page.js +10 -24
  482. package/dist/workspace/space/space-tab-panels.d.ts +14 -1
  483. package/dist/workspace/space/space-tab-panels.js +12 -21
  484. package/dist/workspace/space/space-templates.d.ts +4 -5
  485. package/dist/workspace/space/space-templates.js +2 -7
  486. package/dist/workspace/space/use-space-filter.d.ts +1 -1
  487. package/dist/workspace/space/use-space-filter.js +1 -1
  488. package/dist/workspace/spaces/channels-onboarding.d.ts +2 -2
  489. package/dist/workspace/spaces/channels-onboarding.js +4 -3
  490. package/dist/workspace/spaces/create-channel-dialog.js +4 -2
  491. package/dist/workspace/spaces/principal-card.d.ts +73 -0
  492. package/dist/workspace/spaces/principal-card.js +246 -0
  493. package/dist/workspace/spaces/space-agent-ask.d.ts +14 -0
  494. package/dist/workspace/spaces/space-agent-ask.js +36 -0
  495. package/dist/workspace/spaces/space-auto-open.d.ts +8 -0
  496. package/dist/workspace/spaces/space-auto-open.js +18 -0
  497. package/dist/workspace/spaces/space-avatar.d.ts +44 -0
  498. package/dist/workspace/spaces/space-avatar.js +41 -0
  499. package/dist/workspace/spaces/space-details-dialog.js +1 -1
  500. package/dist/workspace/spaces/space-details-panel.d.ts +27 -0
  501. package/dist/workspace/spaces/space-details-panel.js +173 -0
  502. package/dist/workspace/spaces/space-identity.d.ts +49 -0
  503. package/dist/workspace/spaces/space-identity.js +104 -0
  504. package/dist/workspace/spaces/space-members.js +1 -1
  505. package/dist/workspace/spaces/space-mention-source.d.ts +13 -0
  506. package/dist/workspace/spaces/space-mention-source.js +71 -0
  507. package/dist/workspace/spaces/space-people.d.ts +29 -0
  508. package/dist/workspace/spaces/space-people.js +87 -0
  509. package/dist/workspace/spaces/space-roster.d.ts +3 -2
  510. package/dist/workspace/spaces/space-roster.js +7 -4
  511. package/dist/workspace/spaces/space-tab-list.d.ts +37 -0
  512. package/dist/workspace/spaces/space-tab-list.js +82 -0
  513. package/dist/workspace/spaces/space-tabs.d.ts +74 -0
  514. package/dist/workspace/spaces/space-tabs.js +199 -0
  515. package/dist/workspace/spaces/space-threads-tab.js +1 -1
  516. package/dist/workspace/spaces/space-timeline-view.js +126 -17
  517. package/dist/workspace/spaces/space-timeline.d.ts +44 -9
  518. package/dist/workspace/spaces/space-timeline.js +120 -12
  519. package/dist/workspace/spaces/space-view.d.ts +19 -12
  520. package/dist/workspace/spaces/space-view.js +203 -68
  521. package/dist/workspace/spaces/use-personal-space-name.d.ts +2 -0
  522. package/dist/workspace/spaces/use-personal-space-name.js +10 -0
  523. package/package.json +11 -7
  524. package/skills/kortix-ui/SKILL.md +1 -1
  525. package/skills/kortix-ui/references/custom-dashboard.md +2 -3
  526. package/skills/kortix-ui/references/modules.md +4 -4
  527. package/dist/_vendor/shared/room-prompt.d.ts +0 -66
  528. package/dist/session/tool/tools/multi-agent-tool-data.d.ts +0 -63
  529. package/dist/session/tool/tools/multi-agent-tool-data.js +0 -118
  530. package/dist/session/voice/voice-call-bar.d.ts +0 -4
  531. package/dist/session/voice/voice-call-bar.js +0 -39
  532. package/dist/workspace/sidebar/footer/project-rooms-nav.d.ts +0 -9
  533. package/dist/workspace/sidebar/footer/project-rooms-nav.js +0 -32
  534. package/dist/workspace/sidebar/session-status-mark.d.ts +0 -19
  535. package/dist/workspace/space/space-room.d.ts +0 -20
  536. package/dist/workspace/space/space-room.js +0 -27
  537. /package/dist/{workspace/sidebar → session/list}/session-list-chrome.d.ts +0 -0
  538. /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';
@@ -21,7 +22,10 @@ import { AgentBusyRow, PendingPromptRows } from './thread-boot-rows.js';
21
22
  import { createPortal } from 'react-dom';
22
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';
25
+ import { createStopLatch, runStopSequence, stopLeftTurnRunning } from './stop-sequence.js';
24
26
  import { QueuedPromptList } from '../composer/queued-prompt-list.js';
27
+ import { ComposerAutoFocusContext } from '../composer/composer-focus-context.js';
28
+ import { ChatQueueLines } from '../composer/chat-queue-lines.js';
25
29
  import { runtimePermissionLocksComposer } from '../composer/send-blockers.js';
26
30
  import { SessionPrintHeader } from '../print/session-print-header.js';
27
31
  import { useSessionPrint } from '../print/use-session-print.js';
@@ -48,12 +52,15 @@ import { sessionSlashFiles } from '../composer/menus/slash-files.js';
48
52
  import { resolveFirstPromptHandover, transcriptCarriesFirstPrompt, } from './first-prompt-handover.js';
49
53
  import { CompactModal } from '../header/compact-modal.js';
50
54
  import { SessionSiteHeader } from '../header/session-site-header.js';
51
- import { VoiceCallSlot } from '../voice/voice-call.js';
52
55
  import { claimFirstTurnRow } from '../composer/inbox-row-claims.js';
53
56
  import { OptimisticTurn } from './optimistic-turn.js';
54
57
  import { inboxHoldsLivePrompt } from '../composer/inbox-live-prompt.js';
55
58
  import { SessionOutcomesProvider } from '../outcomes/session-outcomes-provider.js';
59
+ import { deleteMessageLinkParams, readMessageLinkParams, resolveMessageLinkTurn } from '../../internal/lib/navigation/message-link.js';
60
+ /** How long a message link waits for the transcript's turns to mount before it jumps anyway. */
61
+ const MESSAGE_LINK_MOUNT_WAIT_MS = 8_000;
56
62
  import { SessionOverridesComposer } from '../overrides/session-overrides-composer.js';
63
+ import { inheritedModelFor } from '../composer/chat-input/chat-input-summary.js';
57
64
  import { QuestionPrompt, } from '../prompts/question-prompt.js';
58
65
  import { SESSION_TRANSCRIPT_CLASS, SessionBodyRow } from './session-body.js';
59
66
  import { SessionContextModal } from './session-context-modal.js';
@@ -74,6 +81,7 @@ import { ChatMinimap } from './chat-minimap.js';
74
81
  import { usePlanInChat } from './plan-surface.js';
75
82
  import { SessionStartingLoader } from '../status/session-starting-loader.js';
76
83
  import { ToolActivateContext } from '../tool/tool-renderers.js';
84
+ import { AgentActivateContext } from '../tool/shared/infrastructure-contexts.js';
77
85
  import { ReadOnlySessionContext } from '../tool/shared/infrastructure-contexts.js';
78
86
  import { firstPromptAttachments, retainSentAttachmentPreviews, sentAttachmentsForTurn, } from '../composer/sent-attachment-previews.js';
79
87
  import { buildOptimisticPromptTextWithUploads, promptFileParts, sentAttachmentsOf, } from '../composer/uploaded-file-refs.js';
@@ -95,7 +103,7 @@ import { getRetryInfo } from '../../internal/session-types/index.js';
95
103
  import { useModelPricingLookup } from '../../internal/lib/model-pricing.js';
96
104
  import { isAbortError, latestPromptModel, SESSION_NOTICE, turnEndNotice } from '@kortix/sdk';
97
105
  import { failureShownByTurn, failureSupersededByTurn, persistedFailureText, } from './persisted-turn-failure.js';
98
- 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';
106
+ 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';
99
107
  import { useStableCallback } from '../../internal/hooks/use-stable-callback.js';
100
108
  import { useReloadForensics } from '../status/reload-forensics.js';
101
109
  import { resolveLastTurnWorking, serverHoldsOpenTurn, sessionComposerReadiness, } from '../composer/session-composer-readiness.js';
@@ -186,10 +194,11 @@ function hostNotice(notice, notices) {
186
194
  const key = Object.keys(SESSION_NOTICE).find((candidate) => SESSION_NOTICE[candidate] === notice);
187
195
  return (key && notices[key]) || notice;
188
196
  }
189
- export function SessionChat({ sessionId, projectSessionId, sessionState, projectId, boundAgentName, headerLeadingAction, hideHeader, readOnly, composerPlaceholder, inputReplacement, initialScrollTop, savedHistoryScope, onContentReady, deferComposerFocus, hostQuote, }) {
197
+ export function SessionChat({ sessionId, projectSessionId, sessionState, projectId, boundAgentName, headerLeadingAction, hideHeader, transparent = false, readOnly, composerPlaceholder, inputReplacement, initialScrollTop, savedHistoryScope, onContentReady, deferComposerFocus, hostQuote, }) {
190
198
  const tHardcodedUi = useTranslations('hardcodedUi');
191
199
  // A channel's thread panel: turns are message rows, full width, end-anchored.
192
200
  const rowsContext = useContext(TranscriptRowsContext);
201
+ const composerAutoFocus = useContext(ComposerAutoFocusContext);
193
202
  const transcriptRows = rowsContext !== null;
194
203
  const isMobile = useIsMobile();
195
204
  const isPhone = useIsPhone();
@@ -229,6 +238,17 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
229
238
  track('panel_opened', { source: 'chat_tool' });
230
239
  }, [sessionId, setSidePanelView, focusToolCall]);
231
240
  const toolActivate = readOnly || disableToolNavigation ? null : handleToolActivate;
241
+ // Clicking an agent (a sub-agent row, its finish notice, a workflow agent, the
242
+ // agents line) opens that agent's session in the side panel, beside the chat.
243
+ const focusAgent = useKortixComputerStore((s) => s.focusAgent);
244
+ const handleAgentActivate = useCallback((agent) => {
245
+ const wasOpen = useKortixComputerStore.getState().isSidePanelOpen;
246
+ setSidePanelView(sessionId, 'actions');
247
+ focusAgent(agent);
248
+ if (!wasOpen)
249
+ track('panel_opened', { source: 'chat_agent' });
250
+ }, [sessionId, setSidePanelView, focusAgent]);
251
+ const agentActivate = readOnly || disableToolNavigation ? null : handleAgentActivate;
232
252
  // ---- Context modal ----
233
253
  const [contextModalOpen, setContextModalOpen] = useState(false);
234
254
  // The composer's `/compact` row opens this instance; the header keeps its
@@ -519,9 +539,8 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
519
539
  */
520
540
  const issueSessionCancel = useCallback(() => {
521
541
  // The stop's own receipt, taken before the cancel goes out and settled
522
- // when it is acknowledged. `applyOptimisticAbort` writes an idle status
523
- // frame, which invalidates the `/turn` query — and the read that comes
524
- // back still shows the turn, because the cancel needs ~1.6s to reach the
542
+ // when it is acknowledged. A `/turn` read issued inside the abort round
543
+ // trip still shows the turn, because the cancel needs ~1.6s to reach the
525
544
  // daemon. Without this the composer flipped Send back to Stop ~120ms after
526
545
  // the click and stayed there for the whole abort. See `AbortReceipt`.
527
546
  useSessionWorkingStore.getState().noteAbortReceipt(projectSessionId ?? '', Date.now());
@@ -551,7 +570,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
551
570
  const { data: projectSpaces } = useProjectSpaces(projectId, {
552
571
  enabled: !!projectId && !!projectSessionRow?.space_id,
553
572
  });
554
- const threadChannelAgents = useMemo(() => channelRunnableAgents(projectSpaces?.find((space) => space.space_id === projectSessionRow?.space_id), projectConfig?.default_agent ?? projectConfig?.open_code_default_agent), [projectSpaces, projectSessionRow?.space_id, projectConfig?.default_agent, projectConfig?.open_code_default_agent]);
573
+ const threadChannelAgents = useMemo(() => channelRunnableAgents(projectSpaces?.find((space) => space.space_id === projectSessionRow?.space_id), projectConfig?.default_agent), [projectSpaces, projectSessionRow?.space_id, projectConfig?.default_agent]);
555
574
  const agents = useMemo(() => withChannelAgents(rosterAgents, threadChannelAgents), [rosterAgents, threadChannelAgents]);
556
575
  // Edit-and-rewind only on the viewer's own message with nobody else's after it.
557
576
  const rewindable = useMemo(() => rewindableMessageIds(userMessageIds, transcriptAuthors.byMessage, viewerId, projectSessionRow?.created_by), [userMessageIds, transcriptAuthors.byMessage, viewerId, projectSessionRow?.created_by]);
@@ -565,7 +584,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
565
584
  config,
566
585
  sessionId,
567
586
  boundAgentName,
568
- defaultAgentName: projectConfig?.default_agent ?? projectConfig?.open_code_default_agent,
587
+ defaultAgentName: projectConfig?.default_agent,
569
588
  projectSession: projectSessionRow,
570
589
  lastPromptModel: latestPromptModel(messages),
571
590
  });
@@ -581,7 +600,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
581
600
  const composerAgent = resolveComposerAgent({
582
601
  agents,
583
602
  boundAgent: boundAgentName,
584
- defaultAgent: projectConfig?.default_agent ?? projectConfig?.open_code_default_agent,
603
+ defaultAgent: projectConfig?.default_agent,
585
604
  selectedAgent: local.agent.current?.name ?? null,
586
605
  });
587
606
  const composerAgentName = composerAgent.selected;
@@ -770,7 +789,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
770
789
  // every other session of the same agent, and was skipped whenever the
771
790
  // account had a default model.
772
791
  // A NEW user bubble in the transcript is a queue row that just landed —
773
- // OpenCode persisted a forwarded prompt. Re-read the inbox NOW so the row
792
+ // the runtime persisted a forwarded prompt. Re-read the inbox NOW so the row
774
793
  // leaves the strip in the same beat its bubble appears, instead of on the
775
794
  // next poll: the two were visible together for up to a poll interval.
776
795
  const newestUserBubbleId = lastUserMessage?.message_id;
@@ -822,7 +841,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
822
841
  // and send" — a send queues behind the turn.
823
842
  const canStop = sessionState?.canStop ?? true;
824
843
  // The one transcript-derived gate that survives, and the only one that
825
- // carries proof: during a provider 429 OpenCode stamps `info.error` with
844
+ // carries proof: during a provider 429 the runtime stamps `info.error` with
826
845
  // `data.isRetryable === true` and keeps writing the SAME assistant message,
827
846
  // while the status frame this tab holds can read non-busy for all of it. The
828
847
  // projection cannot substitute — a frame stamped after the last `/turn` read
@@ -860,18 +879,30 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
860
879
  // Short visual fade (300ms) — matches the reference's 260ms delay-hide.
861
880
  // Goes true immediately, stays visible briefly after going idle so the
862
881
  // UI doesn't flicker between agentic steps. NOT a 2s debounce.
863
- const [isBusy, setIsBusy] = useState(effectiveBusy);
882
+ const [debouncedBusy, setDebouncedBusy] = useState(effectiveBusy);
864
883
  const busyTimerRef = useRef(undefined);
865
884
  useEffect(() => {
866
885
  if (effectiveBusy) {
867
886
  clearTimeout(busyTimerRef.current);
868
- setIsBusy(true);
887
+ setDebouncedBusy(true);
869
888
  }
870
889
  else {
871
- busyTimerRef.current = setTimeout(() => setIsBusy(false), 300);
890
+ busyTimerRef.current = setTimeout(() => setDebouncedBusy(false), 300);
872
891
  }
873
892
  return () => clearTimeout(busyTimerRef.current);
874
893
  }, [effectiveBusy]);
894
+ // A Stop the server refused, or never confirmed (`timed-out`, `failed`).
895
+ // The abort receipt can hold `effectiveBusy` false for up to
896
+ // OPTIMISTIC_ABORT_MAX_MS while the turn runs, and Stop and Esc×3 are gated
897
+ // on `isBusy`. So the Stop control stays while the server still reports an
898
+ // open turn (`serverOpenTurnToken`), and clears when it reports none.
899
+ const [stopUnconfirmed, setStopUnconfirmed] = useState(false);
900
+ const serverHoldsTurn = working.serverOpenTurnToken !== null;
901
+ useEffect(() => {
902
+ if (stopUnconfirmed && !serverHoldsTurn)
903
+ setStopUnconfirmed(false);
904
+ }, [stopUnconfirmed, serverHoldsTurn]);
905
+ const isBusy = debouncedBusy || (stopUnconfirmed && serverHoldsTurn);
875
906
  // Read by `handleSend` for its ANCHORING decision only (a send into a running
876
907
  // turn must not yank the viewport). Refs, not the values: `handleSend` is a stable callback
877
908
  // that a dozen surfaces hold, and adding busy state to its deps would rebuild
@@ -1147,7 +1178,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
1147
1178
  undoLabel: tHardcodedUi.raw('i18nComplete.texta737e54996f8'),
1148
1179
  // The SAME `clientMessageId`, so an undo re-creates ONE row and a
1149
1180
  // double-click cannot create two. A FRESH wire id, because
1150
- // OpenCode orders by id and the original one was minted before the
1181
+ // the runtime orders by id and the original one was minted before the
1151
1182
  // turn that has been writing higher ids since. The parts and
1152
1183
  // overrides are the ORIGINALS, straight from the delete's own
1153
1184
  // response — see `createQueueUndoAction`.
@@ -1363,8 +1394,30 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
1363
1394
  // ---- Pending permissions & questions ----
1364
1395
  const allPermissions = useRuntimePendingStore((s) => s.permissions);
1365
1396
  const allQuestions = useRuntimePendingStore((s) => s.questions);
1366
- const pendingPermissions = useMemo(() => sessionState?.permissions ??
1397
+ const livePermissions = useMemo(() => sessionState?.permissions ??
1367
1398
  Object.values(allPermissions).filter((p) => p.sessionID === sessionId), [sessionState?.permissions, allPermissions, sessionId]);
1399
+ // Asks that parked: nobody answered live, the agent went on, and the ask
1400
+ // waits server-side (Review, "Needs you"). They render with the same cards
1401
+ // and are decided through the asks API, which resumes the session that
1402
+ // asked (a hidden worker's asks show here too). Live asks keep their cards.
1403
+ const parkedAsks = useSessionNeedsYou(projectId ?? '', projectSessionId ?? '', {
1404
+ enabled: Boolean(projectId && projectSessionId),
1405
+ }).asks;
1406
+ const parkedAskIdByRequest = useMemo(() => new Map(parkedAsks.filter((ask) => ask.kind !== 'approval').map((ask) => [ask.request_id, ask.id])), [parkedAsks]);
1407
+ const pendingPermissions = useMemo(() => {
1408
+ const live = new Set(livePermissions.map((p) => p.id));
1409
+ const parked = parkedAsks
1410
+ .filter((ask) => ask.kind === 'permission' && ask.permission && !live.has(ask.request_id))
1411
+ .map((ask) => ({
1412
+ id: ask.request_id,
1413
+ sessionID: sessionId,
1414
+ permission: ask.permission.permission,
1415
+ patterns: ask.permission.patterns,
1416
+ metadata: ask.permission.args && typeof ask.permission.args === 'object' ? ask.permission.args : {},
1417
+ always: ['*'],
1418
+ }));
1419
+ return parked.length ? [...livePermissions, ...parked] : livePermissions;
1420
+ }, [livePermissions, parkedAsks, sessionId]);
1368
1421
  const suppressedQuestionIdsRef = useRef(new Map());
1369
1422
  const suppressQuestionFor = useCallback((requestId, ms = 15000) => {
1370
1423
  suppressedQuestionIdsRef.current.set(requestId, Date.now() + ms);
@@ -1379,12 +1432,19 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
1379
1432
  }
1380
1433
  return true;
1381
1434
  }, []);
1382
- const pendingQuestions = useMemo(() => (sessionState?.questions ??
1435
+ const liveQuestions = useMemo(() => (sessionState?.questions ??
1383
1436
  Object.values(allQuestions).filter((q) => q.sessionID === sessionId)).filter((q) => !isQuestionSuppressed(q.id)), [sessionState?.questions, allQuestions, sessionId, isQuestionSuppressed]);
1437
+ const pendingQuestions = useMemo(() => {
1438
+ const live = new Set(liveQuestions.map((q) => q.id));
1439
+ const parked = parkedAsks
1440
+ .filter((ask) => ask.kind === 'question' && ask.question && !live.has(ask.request_id) && !isQuestionSuppressed(ask.request_id))
1441
+ .map((ask) => ({ id: ask.request_id, sessionID: sessionId, questions: ask.question.questions }));
1442
+ return parked.length ? [...liveQuestions, ...parked] : liveQuestions;
1443
+ }, [liveQuestions, parkedAsks, sessionId, isQuestionSuppressed]);
1384
1444
  /**
1385
1445
  * The runtime is parked on an answer only the user can give.
1386
1446
  *
1387
- * Both lists are already session-scoped above. Either one means OpenCode has
1447
+ * Both lists are already session-scoped above. Either one means the runtime has
1388
1448
  * stopped inside the turn and is blocked on a reply — the `question` tool, or
1389
1449
  * a tool asking for permission — so the turn row stays `active` and every
1390
1450
  * observer keeps reporting `working` with nothing to bound it but the reader.
@@ -1396,7 +1456,8 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
1396
1456
  * come back the instant the agent is running again, not a third of a second
1397
1457
  * later.
1398
1458
  */
1399
- const awaitingUserInput = pendingQuestions.length > 0 || pendingPermissions.length > 0;
1459
+ // Live asks only: a parked ask no longer holds the turn.
1460
+ const awaitingUserInput = liveQuestions.length > 0 || livePermissions.length > 0;
1400
1461
  const QUESTION_PROMPT_ANIMATION_MS = 320;
1401
1462
  const activePendingQuestion = pendingQuestions[0] ?? null;
1402
1463
  // A new question docks over the bottom of the transcript, and answering it
@@ -1954,7 +2015,15 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
1954
2015
  // ---- Permission/question reply handlers ----
1955
2016
  const removePermission = useRuntimePendingStore((s) => s.removePermission);
1956
2017
  const removeQuestion = useRuntimePendingStore((s) => s.removeQuestion);
2018
+ const answerParkedAsk = useAnswerSessionAsk(projectId ?? '');
1957
2019
  const handlePermissionReply = useCallback(async (requestId, reply) => {
2020
+ // A parked ask: the call no longer waits, so the decision goes through
2021
+ // the asks API (it reaches the agent as a message).
2022
+ const parkedAskId = livePermissions.some((p) => p.id === requestId) ? undefined : parkedAskIdByRequest.get(requestId);
2023
+ if (parkedAskId) {
2024
+ await answerParkedAsk.mutateAsync({ askId: parkedAskId, answer: { reply } });
2025
+ return;
2026
+ }
1958
2027
  // No optimistic remove: only drop the card once the runtime accepted the
1959
2028
  // reply — a failed reply must stay answerable. Rethrow so callers
1960
2029
  // (prompt buttons) reset their busy state and surface the error.
@@ -1965,7 +2034,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
1965
2034
  await replyToPermission(requestId, reply);
1966
2035
  removePermission(requestId);
1967
2036
  }
1968
- }, [sessionState, removePermission]);
2037
+ }, [sessionState, removePermission, livePermissions, parkedAskIdByRequest, answerParkedAsk]);
1969
2038
  const handleQuestionReply = useCallback(async (requestId, answers) => {
1970
2039
  // Snapshot the question BEFORE removing it so we can cache the
1971
2040
  // answer against the tool part's ID.
@@ -1974,6 +2043,12 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
1974
2043
  suppressQuestionFor(requestId);
1975
2044
  // Optimistically remove the question so the textarea shows immediately
1976
2045
  removeQuestion(requestId);
2046
+ const parkedAskId = liveQuestions.some((q) => q.id === requestId) ? undefined : parkedAskIdByRequest.get(requestId);
2047
+ if (parkedAskId) {
2048
+ // Parked: the answer reaches the agent as a message that quotes the question.
2049
+ answerParkedAsk.mutate({ askId: parkedAskId, answer: { answers } });
2050
+ return;
2051
+ }
1977
2052
  // Save the answers in the optimistic cache keyed by the question call's
1978
2053
  // block id. This cache survives updates that may overwrite the call
1979
2054
  // before the server includes its answers; the transcript's answered
@@ -2000,11 +2075,17 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
2000
2075
  catch {
2001
2076
  // ignore — SSE "question.replied" event will also remove it
2002
2077
  }
2003
- }, [sessionState, removeQuestion, suppressQuestionFor]);
2078
+ }, [sessionState, removeQuestion, suppressQuestionFor, liveQuestions, parkedAskIdByRequest, answerParkedAsk]);
2004
2079
  const handleQuestionReject = useCallback(async (requestId) => {
2005
2080
  suppressQuestionFor(requestId);
2006
2081
  // Optimistically remove the question so the textarea shows immediately
2007
2082
  removeQuestion(requestId);
2083
+ const parkedAskId = liveQuestions.some((q) => q.id === requestId) ? undefined : parkedAskIdByRequest.get(requestId);
2084
+ if (parkedAskId) {
2085
+ // Dismissing a parked question closes it; nothing runs, so nothing is stopped.
2086
+ answerParkedAsk.mutate({ askId: parkedAskId, answer: { dismiss: true } });
2087
+ return;
2088
+ }
2008
2089
  try {
2009
2090
  if (sessionState)
2010
2091
  await sessionState.rejectQuestion(requestId);
@@ -2067,7 +2148,8 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
2067
2148
  useEffect(() => {
2068
2149
  outcomeJumpRef.current = { sessionId, hasOlder, isLoadingOlder, loadOlder };
2069
2150
  }, [sessionId, hasOlder, isLoadingOlder, loadOlder]);
2070
- const handleJumpToOutcome = useCallback(async (resolveTurn, createdAt) => {
2151
+ // `quiet`: a jump the reader did not click (a `?m=` link) fails silently, without the change-request toasts.
2152
+ const handleJumpToOutcome = useCallback(async (resolveTurn, createdAt, quiet = false) => {
2071
2153
  if (jumpingToOutcome)
2072
2154
  return;
2073
2155
  setJumpingToOutcome(true);
@@ -2084,9 +2166,12 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
2084
2166
  settle,
2085
2167
  },
2086
2168
  resolve: () => outcomeJumpRef.current.sessionId === currentSession ? resolveTurn() : undefined,
2087
- loadError: () => errorToast(tChangeRequests('loadError')),
2169
+ loadError: () => {
2170
+ if (!quiet)
2171
+ errorToast(tChangeRequests('loadError'));
2172
+ },
2088
2173
  unavailable: () => {
2089
- if (outcomeJumpRef.current.sessionId === currentSession)
2174
+ if (!quiet && outcomeJumpRef.current.sessionId === currentSession)
2090
2175
  errorToast(tChangeRequests('unavailable'));
2091
2176
  },
2092
2177
  scroll: async (key) => {
@@ -2116,7 +2201,8 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
2116
2201
  });
2117
2202
  }
2118
2203
  catch {
2119
- errorToast(tChangeRequests('loadError'));
2204
+ if (!quiet)
2205
+ errorToast(tChangeRequests('loadError'));
2120
2206
  }
2121
2207
  finally {
2122
2208
  setJumpingToOutcome(false);
@@ -2130,7 +2216,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
2130
2216
  // ============================================================================
2131
2217
  // Billing: DISABLED — billing is handled server-side by the LLM gateway
2132
2218
  // (it deducts credits per LLM call).
2133
- // This frontend useEffect was causing double-billing once opencode.jsonc
2219
+ // This frontend useEffect was causing double-billing once the runtime config
2134
2220
  // got cost config and step-finish.cost became non-zero.
2135
2221
  // ============================================================================
2136
2222
  // No composer-draft side effect any more: the old flow prefilled the
@@ -2454,13 +2540,13 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
2454
2540
  // actual response body still arrives via the sync store.
2455
2541
  //
2456
2542
  // Don't send part IDs. `ascendingId` encodes the HIGH bits of the id
2457
- // clock where opencode encodes the LOW 48 (see the warning on it in the
2543
+ // clock where the wire id encodes the LOW 48 (see the warning on it in the
2458
2544
  // SDK), so a client id of that shape sorts before EVERY server id: the
2459
2545
  // server's "has this prompt already been answered?" ordering check reads
2460
2546
  // a stale assistant reply as the answer and the turn never runs.
2461
2547
  //
2462
2548
  // The `messageID` is a different matter and IS sent — by the SDK, not
2463
- // from here. `promptOpenCodeMessage` mints it in opencode's own wire
2549
+ // from here. `promptRuntimeMessage` mints it in the Kortix message id
2464
2550
  // format and places it above everything already in this session's
2465
2551
  // transcript, which is what makes it safe; without one, two identical
2466
2552
  // prompts inside 60s hash to a single proxy delivery and the second is
@@ -2505,7 +2591,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
2505
2591
  const selectedModel = sendOpts?.model ? sendOpts.model : null;
2506
2592
  // THE ONE SEND PATH: the server-side prompt inbox.
2507
2593
  //
2508
- // This used to POST straight into the sandbox's OpenCode server, and
2594
+ // This used to POST straight into the sandbox's runtime server, and
2509
2595
  // anything the user typed while the agent was busy went into a browser
2510
2596
  // queue instead — which meant a closed tab, a second device, or a crash
2511
2597
  // lost it silently, and two tabs on one session disagreed about what was
@@ -2515,7 +2601,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
2515
2601
  // guess whether a turn is in flight.
2516
2602
  //
2517
2603
  // The WIRE id is minted here, by the SDK, and never by the control plane:
2518
- // OpenCode resolves "has this prompt already been answered?" by id ORDER,
2604
+ // The runtime resolves "has this prompt already been answered?" by id ORDER,
2519
2605
  // and only this process holds the transcript to place one against. It is
2520
2606
  // `messageID` above. `clientMessageId` is only the inbox idempotency key.
2521
2607
  // The prompt is out of this tab's hands the moment the row lands, so the
@@ -2537,9 +2623,9 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
2537
2623
  // the two, and the server orders racing sends by THIS.
2538
2624
  clientSentAtMs: sentAtMs,
2539
2625
  overrides: {
2540
- // Pass the session's directory so opencode resolves project-scoped
2541
- // agents (.opencode/agent/*.md under the project) and applies them
2542
- // when the user picked a project agent from the picker.
2626
+ // Pass the session's directory so the runtime resolves project-scoped
2627
+ // agents and applies them when the user picked a project agent
2628
+ // from the picker.
2543
2629
  ...(session?.directory ? { directory: session.directory } : {}),
2544
2630
  ...(selectedAgent ? { agent: selectedAgent } : {}),
2545
2631
  ...(selectedModel ? { model: formatPromptModel(selectedModel) } : {}),
@@ -2573,7 +2659,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
2573
2659
  if (keepsPainted)
2574
2660
  return { ok: false, cause, error: null };
2575
2661
  // Ask the INBOX, not the runtime. This prompt's home is a durable
2576
- // control-plane row; OpenCode's transcript cannot see it until the
2662
+ // control-plane row; the runtime's transcript cannot see it until the
2577
2663
  // admission gate delivers it, so a rehydrate always reports it
2578
2664
  // missing and the recovery used to delete the bubble on that answer —
2579
2665
  // while the row was already running. Reported from a live self-host:
@@ -2663,7 +2749,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
2663
2749
  // "Changes" side panel's "Ask agent to open a change request" button) can
2664
2750
  // drive the agent through the SAME robust path the input uses — optimistic
2665
2751
  // message, SSE wiring, error propagation — instead of copying a prompt to the
2666
- // clipboard. Keyed by the OpenCode chat session id (`sessionId`).
2752
+ // clipboard. Keyed by the runtime chat session id (`sessionId`).
2667
2753
  const registerSender = useChatSendStore((s) => s.registerSender);
2668
2754
  const unregisterSender = useChatSendStore((s) => s.unregisterSender);
2669
2755
  useEffect(() => {
@@ -2774,82 +2860,59 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
2774
2860
  setEditSendPending(false);
2775
2861
  }
2776
2862
  }, [sessionState, promptInbox.prompts, promptInbox.remove, handleSend, tHardcodedUi]);
2863
+ // One Stop = one inbox hold + one abort. `runStopSequence` (stop-sequence.ts)
2864
+ // owns the order: with `sessionState` the SDK's `cancel()` holds the inbox
2865
+ // and aborts; without it the host holds, then aborts. `stopLatch` is the
2866
+ // synchronous double-Stop guard: a click, then Esc×3, then a click sends one
2867
+ // stop, not three. It stays closed until the abort settles.
2868
+ const [stopLatch] = useState(createStopLatch);
2777
2869
  const handleStop = useCallback(async () => {
2778
- // Guard against rapid clicks — ignore if an abort is already in flight
2779
- if (abortSession.isPending) {
2780
- console.log(`[handleStop] Ignoring - abort already in flight for session ${sessionId}`);
2870
+ if (stopLatch.inFlight)
2781
2871
  return;
2782
- }
2783
- // Stop means stop: a held command would otherwise start a new turn the
2784
- // moment this one ends.
2785
- setHeldCommands([]);
2786
- console.log(`[handleStop] Stopping session ${sessionId}`);
2787
- // Optimistically mark the session idle + patch an abort error onto the
2788
- // last assistant message (so the turn reads as stopped instantly — no
2789
- // waiting for the SSE session.error round-trip, and no error row in the
2790
- // gap: `TurnErrorDisplay` renders nothing for an abort). Also clear the
2791
- // busy debounce timer to bypass the 2s delay.
2792
- applyOptimisticAbort(sessionId);
2793
- clearTimeout(busyTimerRef.current);
2794
- setIsBusy(false);
2795
- // Stop means the send this tab was still waiting on is over too.
2796
- clearSendReceipt();
2797
- // Stopping means stop doing things, and that includes the queue. Without
2798
- // this the interrupt is followed a beat later by exactly the message the
2799
- // user was trying to get ahead of.
2800
- //
2801
- // ONE hold, on the server, because the queue is not in this tab any more.
2802
- // Pausing a browser drain left every OTHER tab's view of the queue running
2803
- // and never reached the server at all.
2804
- //
2805
- // AWAITED, and BEFORE the abort. A prompt is now forwarded to OpenCode the
2806
- // moment it is admitted, so at stop time the session's queue can hold rows
2807
- // that OpenCode already has. The abort drops OpenCode's in-memory queue,
2808
- // and the reaper then sees those messages unanswered and hands them back —
2809
- // due now — unless the hold has already marked them stop-paused. Ordering
2810
- // the two calls makes "the hold precedes the abort" a fact instead of an
2811
- // argument about reaper cadence. The user sees no delay: the optimistic
2812
- // paint above already ran, so only the network abort moves one hop later.
2813
- //
2814
- // BOUNDED, because the abort is now sequenced behind a network call and
2815
- // `holdSessionPrompts` carries no client timeout of its own. A stalled
2816
- // socket can hang for minutes, and every one of those is the agent still
2817
- // running, still calling tools and still spending tokens under a UI that
2818
- // says it stopped. Past the bound the abort goes out anyway and the hold
2819
- // finishes on its own — the ordering is a preference, the abort is not.
2820
- let refusal = null;
2821
- await Promise.race([
2822
- promptInbox.hold(true).catch((error) => {
2823
- // The server refused the stop: this viewer did not start the run and
2824
- // does not own or manage the session. The abort would be refused for
2825
- // the same reason, so none goes out; the run goes on.
2826
- refusal = stopRefusalMessage(error);
2827
- if (refusal)
2828
- return;
2829
- // Caught, never rethrown: a failed hold must not also cost the user
2830
- // their abort. The cost of that path is the one this ordering removes —
2831
- // a stopped prompt can still come back a reaper pass later.
2832
- //
2833
- // SURFACED, not swallowed. A failed hold means the queue is NOT paused,
2834
- // so a prompt the user pressed Stop to get ahead of can still be
2835
- // delivered a reaper pass later — silently. The user has to know the
2836
- // stop did not also pause the queue, and that pressing Stop again (or
2837
- // Resume/Send-now) is how they recover.
2838
- console.warn('[session-chat] failed to hold the prompt inbox on stop', error);
2839
- errorToast(tHardcodedUi.raw('i18nComplete.text57a524b52549'), {
2840
- description: tHardcodedUi.raw('i18nComplete.text45eca4a01ff2'),
2841
- });
2842
- }),
2843
- new Promise((resolve) => setTimeout(resolve, STOP_HOLD_DEADLINE_MS)),
2844
- ]);
2845
- if (refusal) {
2846
- errorToast(refusal);
2847
- setIsBusy(isBusyRef.current);
2848
- return;
2849
- }
2850
- issueSessionCancel();
2872
+ await stopLatch.run(async () => {
2873
+ // Stop means stop: a held command would otherwise start a new turn the
2874
+ // moment this one ends.
2875
+ setHeldCommands([]);
2876
+ // The composer reads idle at once; `stopUnconfirmed` brings Stop back
2877
+ // if the server never confirms the abort.
2878
+ clearTimeout(busyTimerRef.current);
2879
+ setDebouncedBusy(false);
2880
+ setStopUnconfirmed(false);
2881
+ // Why the hold goes out before the abort, and why it is bounded: a
2882
+ // prompt admitted mid-turn is already on the wire, the abort drops the
2883
+ // runtime's queue, and the reaper redelivers it unless the hold marked
2884
+ // it stop-paused first. A stalled hold must not delay the abort by more
2885
+ // than STOP_HOLD_DEADLINE_MS.
2886
+ const outcome = await runStopSequence({
2887
+ ...(sessionState ? { sdkCancel: issueSessionCancel } : {}),
2888
+ holdInbox: () => promptInbox.hold(true),
2889
+ fallbackCancel: issueSessionCancel,
2890
+ paintOptimisticAbort: () => {
2891
+ // "Interrupted" on the newest assistant message, before the
2892
+ // round trip. The SDK path paints it inside `cancel()`.
2893
+ applyOptimisticAbort(sessionId);
2894
+ clearSendReceipt();
2895
+ },
2896
+ refusalOf: stopRefusalMessage,
2897
+ onHoldFailed: (error) => {
2898
+ // The queue is NOT paused: a prompt the user stopped to get ahead
2899
+ // of can still go out. Say so; Stop again or Resume recovers.
2900
+ console.warn('[session-chat] failed to hold the prompt inbox on stop', error);
2901
+ errorToast(tHardcodedUi.raw('i18nComplete.text57a524b52549'), {
2902
+ description: tHardcodedUi.raw('i18nComplete.text45eca4a01ff2'),
2903
+ });
2904
+ },
2905
+ holdDeadlineMs: STOP_HOLD_DEADLINE_MS,
2906
+ });
2907
+ if (outcome.kind === 'refused')
2908
+ errorToast(outcome.message);
2909
+ // A refused, failed or timed-out stop leaves the turn running: keep
2910
+ // Stop and Esc×3 on screen while the server still holds the turn.
2911
+ if (stopLeftTurnRunning(outcome))
2912
+ setStopUnconfirmed(true);
2913
+ });
2851
2914
  // eslint-disable-next-line react-hooks/exhaustive-deps
2852
- }, [sessionId, abortSession, issueSessionCancel, promptInbox.hold]);
2915
+ }, [sessionId, sessionState, stopLatch, issueSessionCancel, promptInbox.hold]);
2853
2916
  // Release the Stop hold for the WHOLE queue at once. `hold(false)` un-pauses
2854
2917
  // every held row on the server (shared across tabs), and the hook clears the
2855
2918
  // paused state on the click (`releaseHeldPrompts`). `resumePending` disables
@@ -3045,7 +3108,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
3045
3108
  const handleCommandError = (err) => {
3046
3109
  // A command that was DELIVERED and then lost its connection is not a
3047
3110
  // failed command. `/command` blocks for the whole turn, so both proxy
3048
- // hops routinely stop waiting while opencode is still working — and the
3111
+ // hops routinely stop waiting while the runtime is still working — and the
3049
3112
  // request was already on the wire when they did. Clearing the session
3050
3113
  // to `idle` and painting an error here told the user their message had
3051
3114
  // not sent while the agent was actively answering it, and invited the
@@ -3231,7 +3294,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
3231
3294
  /**
3232
3295
  * Where this session's unsent draft is persisted.
3233
3296
  *
3234
- * `projectSessionId` — the KORTIX session id — not the OpenCode `sessionId`:
3297
+ * `projectSessionId` — the KORTIX session id — not the runtime `sessionId`:
3235
3298
  * it is the id the boot shell also keys on, so a draft typed in the instant
3236
3299
  * shell is still there after the crossfade into this component, and it is
3237
3300
  * the same id every other per-session handoff store uses
@@ -3319,10 +3382,14 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
3319
3382
  // (Claude Code's agent panel). It reads its own lists and never holds the composer.
3320
3383
  const agentsLineCompact = !!transcriptRows && !isPhone;
3321
3384
  const chatUnderbarSlot = useMemo(() => _jsx(AgentsLine, { projectId: projectId, sessionId: projectSessionId, compact: agentsLineCompact }), [projectId, projectSessionId, agentsLineCompact]);
3385
+ // A space's thread lists only the queue's live messages in its card: failed
3386
+ // ones and a Stop hold read as calm lines (`ChatQueueLines`), reports wait behind Resume.
3387
+ const calmRest = useMemo(() => [...queueRows.rows, ...heldCommandRows(heldCommands)].filter((row) => row.state !== 'failed' && !row.synthetic), [queueRows.rows, heldCommands]);
3322
3388
  // The queued messages and the one Resume while a Stop holds the queue: their
3323
- // own full-width card above the composer stack, not inside the strip. A live
3324
- // voice call is the card above them (nothing unless a call is open).
3325
- const chatAboveSlot = useMemo(() => (_jsxs(_Fragment, { children: [_jsx(VoiceCallSlot, { sessionId: projectSessionId }), _jsx(QueuedPromptList, { rows: heldCommands.length > 0 ? [...queueRows.rows, ...heldCommandRows(heldCommands)] : queueRows.rows, heldCount: queueRows.heldCount, resumePending: resumePending, onResume: () => void handleResumeQueue(), onEdit: (id) => {
3389
+ // own full-width card above the composer stack, not inside the strip.
3390
+ const chatAboveSlot = useMemo(() => (_jsx(_Fragment, { children: rowsContext?.messagesOnly ? (
3391
+ // A space's thread: calm lines ("Not sent · Retry", "Stopped · Resume"), the card only for queued messages.
3392
+ _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) => {
3326
3393
  queueEdit.takeBack(id);
3327
3394
  }, onRemove: (id) => {
3328
3395
  if (id.startsWith(HELD_COMMAND_ROW_PREFIX)) {
@@ -3331,8 +3398,18 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
3331
3398
  return;
3332
3399
  }
3333
3400
  void handleRemoveQueuedMessage(id);
3334
- }, onRetry: handleRetryQueuedMessage, onStopAndSend: effectiveBusy && canStop ? handleStopAndSendQueuedMessage : undefined, editing: queueEdit.editing, onCancelEdit: queueEdit.cancel })] })), [
3335
- projectSessionId,
3401
+ }, 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) => {
3402
+ queueEdit.takeBack(id);
3403
+ }, onRemove: (id) => {
3404
+ if (id.startsWith(HELD_COMMAND_ROW_PREFIX)) {
3405
+ const heldId = id.slice(HELD_COMMAND_ROW_PREFIX.length);
3406
+ setHeldCommands((held) => held.filter((entry) => entry.id !== heldId));
3407
+ return;
3408
+ }
3409
+ void handleRemoveQueuedMessage(id);
3410
+ }, onRetry: handleRetryQueuedMessage, onStopAndSend: effectiveBusy && canStop ? handleStopAndSendQueuedMessage : undefined, editing: queueEdit.editing, onCancelEdit: queueEdit.cancel })) })), [
3411
+ rowsContext?.messagesOnly,
3412
+ calmRest,
3336
3413
  heldCommands,
3337
3414
  queueEdit.editing,
3338
3415
  queueEdit.cancel,
@@ -3408,7 +3485,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
3408
3485
  // `SessionComposerReadiness`.
3409
3486
  const runtimePhase = useRuntimePhase();
3410
3487
  // Covers the one gap `unreachable` can't: a sandbox proxy that keeps
3411
- // answering with a 503 (OpenCode wedged mid-boot) resets the probe's
3488
+ // answering with a 503 (a runtime wedged mid-boot) resets the probe's
3412
3489
  // failure counter every tick, so `unreachable` never fires no matter how
3413
3490
  // long it stays wedged. See `useRuntimeBootStalled`.
3414
3491
  const runtimeStalled = useRuntimeBootStalled();
@@ -3521,6 +3598,65 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
3521
3598
  if (crParam)
3522
3599
  setOpenCrIdState(crParam);
3523
3600
  }, [crParam]);
3601
+ // ---- Message link: `?m=<message_id>&at=<ms>` (the gateway request log's "Open in session") ----
3602
+ // Once per link, after the transcript first paints: page back until the turn
3603
+ // is loaded, scroll to it, flash it, then drop `m`/`at` so a reload stays put.
3604
+ const messageLink = readOnly ? null : readMessageLinkParams(searchParams);
3605
+ const messageLinkKey = messageLink ? `${sessionId}|${messageLink.messageId ?? ''}|${messageLink.at ?? ''}` : null;
3606
+ const linkTurnsRef = useRef(turns);
3607
+ useEffect(() => {
3608
+ linkTurnsRef.current = turns;
3609
+ }, [turns]);
3610
+ const jumpedLinkRef = useRef(null);
3611
+ useEffect(() => {
3612
+ if (!messageLink || !messageLinkKey || isDataLoading || turns.length === 0)
3613
+ return;
3614
+ if (jumpedLinkRef.current === messageLinkKey)
3615
+ return;
3616
+ jumpedLinkRef.current = messageLinkKey;
3617
+ const resolve = () => resolveMessageLinkTurn(linkTurnsRef.current, messageLink);
3618
+ // An in-app navigation has the transcript cached: `turns` exist frames before
3619
+ // their `[data-turn-id]` nodes mount, and the first paint scrolls to the
3620
+ // bottom. Jump only once the turns are in the DOM and that scroll has run,
3621
+ // else the scroll finds no node and the link lands at the bottom.
3622
+ let cancelled = false;
3623
+ let jumped = false;
3624
+ const startedAt = Date.now();
3625
+ const jump = () => {
3626
+ jumped = true;
3627
+ // Already on screen: no history to load. Else `at`, or NaN (load it all) for an id alone.
3628
+ const createdAt = resolve() ? Number.MAX_SAFE_INTEGER : (messageLink.at ?? Number.NaN);
3629
+ void handleJumpToOutcome(resolve, createdAt, true).finally(() => {
3630
+ const params = new URLSearchParams(searchParams?.toString());
3631
+ deleteMessageLinkParams(params);
3632
+ const qs = params.toString();
3633
+ shallowNavigate(qs ? `${pathname}?${qs}` : pathname, { replace: true });
3634
+ });
3635
+ };
3636
+ const waitForTurns = () => {
3637
+ if (cancelled)
3638
+ return;
3639
+ const mounted = !!contentRef.current?.querySelector('[data-turn-id]');
3640
+ if (!mounted && Date.now() - startedAt < MESSAGE_LINK_MOUNT_WAIT_MS) {
3641
+ window.setTimeout(waitForTurns, 100);
3642
+ return;
3643
+ }
3644
+ // Two frames: the first paint's bottom scroll lands before the jump, never after it.
3645
+ requestAnimationFrame(() => requestAnimationFrame(() => {
3646
+ if (!cancelled)
3647
+ jump();
3648
+ }));
3649
+ };
3650
+ waitForTurns();
3651
+ return () => {
3652
+ cancelled = true;
3653
+ // A wait cancelled before it jumped runs again on the next pass; a jump in flight is not repeated.
3654
+ if (!jumped && jumpedLinkRef.current === messageLinkKey)
3655
+ jumpedLinkRef.current = null;
3656
+ };
3657
+ // `messageLinkKey` stands for `messageLink`, which is a new object every render.
3658
+ // eslint-disable-next-line react-hooks/exhaustive-deps
3659
+ }, [messageLinkKey, isDataLoading, turns.length, handleJumpToOutcome, searchParams, pathname, shallowNavigate, contentRef]);
3524
3660
  const handleOpenOutcome = useCallback((outcome) => {
3525
3661
  // Change requests are the only kind a turn produces. `external` exists on
3526
3662
  // the union for `setup-links/setup-link-button.tsx`, which renders this
@@ -3544,304 +3680,306 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
3544
3680
  // an eternal loader. Only with nothing to paint: once any message is on
3545
3681
  // screen, staleness is repaired in the background instead.
3546
3682
  if (transcriptFreshness === 'error' && !hasMessages) {
3547
- 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') })] }) }));
3683
+ 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') })] }) }));
3548
3684
  }
3549
- return (_jsx("div", { className: "bg-background relative flex h-full flex-col", "data-testid": "session-chat", children: _jsx(SessionStartingLoader, { projectId: projectId, sessionId: projectSessionId }) }));
3685
+ 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 }) }));
3550
3686
  }
3551
3687
  return (
3552
3688
  // A read-only view (the sub-session modal) offers no fix inside a tool card.
3553
- _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',
3554
- // Transparent in the welcome state so the root-level full-bleed wallpaper
3555
- // (portaled into SessionLayout) reads through; solid once real content
3556
- // takes over. Same base color either way, so non-welcome is unchanged.
3557
- 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
3558
- ? welcomeWallpaper && createPortal(welcomeWallpaper, wallpaperLayer)
3559
- : welcomeWallpaper, !hideHeader && (_jsx(SessionSiteHeader, { sessionId: sessionId, sessionTitle: session?.title || 'Untitled', leadingAction: headerLeadingAction, parent: parentCrumb })), _jsx(SessionContextModal, { open: contextModalOpen, onOpenChange: setContextModalOpen,
3560
- // A chat with no `useSession` source: the raw explorer lists the
3561
- // rows `useSessionSync` read for it.
3562
- 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: () => {
3563
- try {
3564
- if (sessionId)
3565
- useTabStore.getState().closeTab?.(sessionId);
3566
- }
3567
- catch { }
3568
- }, 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(
3569
- // overflow-anchor:none — this scroll area does ALL of its own
3570
- // anchoring (useAutoScroll's spacer + RAF follow, the send-path
3571
- // turn anchor, and the history-prepend content-space restore in
3572
- // session-history-scroll.ts). The browser's native scroll
3573
- // anchoring (default `overflow-anchor: auto`) tries to
3574
- // compensate for the SAME prepends independently, and the two
3575
- // corrections stacking is the other half of the scroll-up
3576
- // teleport: ours restores the reader's position, then the
3577
- // native one nudges it again.
3578
- '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",
3579
- // Width and gutters live in `SESSION_TRANSCRIPT_CLASS`: the
3580
- // instant shell draws this same column and the two crossfade
3581
- // into each other, so a difference here is a sideways jump on
3582
- // screen, not a style opinion. See session-body.tsx.
3583
- //
3584
- // No bottom padding, there or here: the space under the last
3585
- // message is the auto-scroll spacer's job alone. The `pb-32`
3586
- // that used to sit here stacked 128px of dead space on top of
3587
- // it — the "extra inset at the bottom of the session".
3588
- // Rows run edge to edge: each row owns its gutters and its hover fill.
3589
- 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 &&
3590
- !olderPullFailed &&
3591
- 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 &&
3592
- firstPromptSource &&
3593
- queuedSyntheticMessages.length === 0 &&
3594
- rowsContext && (
3595
- // A channel thread draws the stand-in as rows, the same
3596
- // rows its boot body drew (`ThreadBootRows`).
3597
- _jsx(PendingPromptRows, { text: buildOptimisticPromptTextWithUploads(firstPromptSource.text, firstPromptSource.files), author: rowsContext.owner, sessionId: sessionId, busy: turns.length === 0 && (lastTurnWorking || promptInbox.prompts.some(isFirstPromptRow)) })), showFirstPromptPreview &&
3598
- firstPromptSource &&
3599
- queuedSyntheticMessages.length === 0 &&
3600
- !rowsContext && (_jsx(OptimisticTurn, { text: buildOptimisticPromptTextWithUploads(firstPromptSource.text, firstPromptSource.files),
3601
- // Preserve a real failed-send status through the
3602
- // boot-shell handover without inventing upload progress.
3603
- // A first prompt held on its uploads carries its own.
3604
- uploadStatus: firstPromptSource.uploadStatus ?? firstPromptUploadStatus, agentNames: agentNames, onFileClick: openFileInComputer, sessionId: sessionId,
3605
- // The first item of the conversation, like turn 0, which has no
3606
- // top margin. `first:mt-0` misses here: the list opens with a
3607
- // zero-height <header>, so the stand-in sat 44px lower than turn 0
3608
- // and every swap between the two jumped the bubble (KRTX-2931).
3609
- className: "mt-0",
3610
- // An undelivered first prompt is a turn about to start, as the
3611
- // shell above this chat shows it: busy from the first frame,
3612
- // before the working projection has read the inbox (KRTX-2931).
3613
- busy: turns.length === 0 && (lastTurnWorking || promptInbox.prompts.some(isFirstPromptRow)) })), turns.map((turn, turnIndex) => {
3614
- // Check if this turn is a compaction summary — and
3615
- // whether it actually PRODUCED one. A failed/aborted
3616
- // attempt (compaction-flagged, no content, not the
3617
- // working turn) renders as one slim row, draws no
3618
- // divider, and stacks tight against a neighbouring
3619
- // failed attempt.
3620
- const compaction = turn.compaction;
3621
- const hasCompaction = compaction !== null;
3622
- const isTurnWorking = turn.live;
3623
- // `inFlight` (message state) alongside the projection:
3624
- // classifying by projection alone flipped a streaming
3625
- // compaction to "failed" for the frames where the two
3626
- // disagree, popping the divider in and out — a layout
3627
- // bounce right where the reader is looking.
3628
- const isFailedCompaction = compaction !== null &&
3629
- !compaction.hasContent &&
3630
- !compaction.inFlight &&
3631
- !isTurnWorking;
3632
- // Retries collapse to ONE visible row, GLOBALLY: a
3633
- // failed attempt with ANY later compaction turn (a
3634
- // retry, or the one that finally landed) is history —
3635
- // it keeps its TurnViewport (stable keys, scroll
3636
- // anchors) but renders no content, and an empty
3637
- // TurnViewport costs 0px (turn-viewport.tsx RULE 2).
3638
- // Adjacency was not enough: attempts whose error landed
3639
- // on a plain assistant message used to interleave as
3640
- // unclassified turns, breaking every consecutive run.
3641
- const suppressedFailedCompaction = isFailedCompaction && turnIndex < lastCompactionTurnIndex;
3642
- // Notification-only early-return removed: it rendered the
3643
- // user's pty_* card but skipped the turn's replies,
3644
- // hiding every subsequent assistant response in that turn.
3645
- // Fall through to the normal turn renderer instead.
3646
- const confirmedActive = turnIsConfirmedActive({
3647
- isTurnWorking,
3648
- turnId: turn.id,
3649
- activeTurnId,
3650
- pendingDelivery: !!working.pendingDelivery,
3651
- });
3652
- const pendingPrompt = !confirmedActive && turn.assistant.length === 0
3653
- ? pendingPromptsByMessageId.get(turn.id)
3654
- : undefined;
3655
- // A queued prompt is not in the runtime transcript yet;
3656
- // its author still shows (`authorForTurn`).
3657
- const promptAuthorId = pendingPromptsByMessageId.get(turn.id)?.author_user_id;
3658
- const turnAuthor = authorForTurn(transcriptAuthors, messageAuthors, turn.id, pendingPrompt?.wire_message_id) ??
3659
- participantAuthor(sessionParticipants, promptAuthorId) ??
3660
- (sentHereIds.current.has(turn.id) ||
3661
- sentHereIds.current.has(turnRenderKeys.get(turn.id) ?? '') ||
3662
- (viewerId !== undefined && promptAuthorId === viewerId) ||
3663
- // The first prompt of a session the viewer started,
3664
- // sent from another surface (project home), before
3665
- // the first authors read lands.
3666
- (messageAuthorsLoading &&
3667
- viewerId !== undefined &&
3668
- projectSessionRow?.created_by === viewerId &&
3669
- turn.id === userMessageIds[0])
3670
- ? viewerAsAuthor
3671
- : undefined);
3672
- return (_jsx(TranscriptTurnRow
3673
- // ONE element per prompt: keyed by the id the
3674
- // bubble was FIRST painted under, so the swap to a
3675
- // re-minted echo id re-renders this node instead
3676
- // of mounting a new one (opacity keeps animating,
3677
- // hover state survives, nothing jumps).
3678
- , { turnId: turn.id, modelOptions: modelOptions, suppressed: suppressedFailedCompaction, continuedWith: harnessSwitches.get(turn.id)?.harness, fullTextState: loaded.state[turn.id] ?? 'idle', onLoadFullText: loadFullTexts, showBusyRow: showFallbackBusyRow &&
3679
- fallbackBusyRowTurnId === turn.id,
3680
- // Queued bubbles STACK: a pending turn right after
3681
- // another pending turn sits close to it, like a
3682
- // list of what is waiting — not a turn's width
3683
- // apart as if each had been answered in between.
3684
- // (Failed compaction rows need no stacking rule any
3685
- // more — at most one is visible at a time.)
3686
- viewportClassName: turnIndex === 0 || transcriptRows
3687
- ? ''
3688
- : // A compaction, the work after it and another agent's notice continue the turn above.
3689
- turn.compaction || turn.continues || agentNoticeTurnIds.has(turn.id)
3690
- ? 'mt-6'
3691
- : lastTurnWorking &&
3692
- pendingTurnIds.has(turn.id) &&
3693
- pendingTurnIds.has(turns[turnIndex - 1].id)
3694
- ? 'mt-3'
3695
- : 'mt-12', turn: turn, author: turnAuthor,
3696
- // Reserve the sender row while the authors load,
3697
- // for a queued prompt whose sender is known, and
3698
- // for a live message until its author resolves.
3699
- showAuthor: !!turnAuthor ||
3700
- messageAuthorsLoading ||
3701
- !!promptAuthorId ||
3702
- (loadedUserIds?.sessionId === sessionId &&
3703
- !loadedUserIds.ids.has(turn.id) &&
3704
- 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,
3705
- // Handed over only once the stand-in has stepped
3706
- // aside — while it is up it draws these itself.
3707
- pendingText: turnIndex === 0 ? firstTurnHandover?.text : undefined, pendingAttachments: sentAttachmentsForTurn({
3708
- sentByMessage: sentAttachmentsByMessage,
3709
- messageId: turn.id,
3710
- originId: optimisticOriginOf(sessionId, turn.id),
3711
- isFirstTurn: turnIndex === 0,
3712
- firstTurnHandover: firstTurnHandover?.attachments,
3713
- firstTurnSent: firstPromptAttachments(projectSessionId),
3714
- queuedRowAttachments: inboxRowsByMessageId.get(turn.id)?.attachments,
3715
- }), uploadStatus: heldSendFailures?.[turn.id]
3716
- ? {
3717
- state: 'failed',
3718
- message: heldSendFailures[turn.id].message,
3719
- onRetry: () => retryHeldSend(sessionId, turn.id, resendHeldSend, (error) => classifySessionError(error).message),
3720
- }
3721
- : turnIndex === 0 && firstTurnHandover?.attachments.length
3722
- ? firstPromptUploadStatus
3723
- : undefined, sessionWorking: lastTurnWorking, isWorkingTurn: turn.live, suppressBusyIndicator: suppressWorkingTurnBusy, awaitingUser: awaitingUserInput,
3724
- // An idle send stays in the inbox until delivery,
3725
- // but nothing runs ahead of it: queued only while
3726
- // it waits behind a turn (`turnRendersQueued`).
3727
- // The first turn, with no turn working, has
3728
- // nothing ahead of it: a session's first prompt is
3729
- // starting, not queued, while the computer comes up
3730
- // and before the turn layer marks it queued or live.
3731
- pending: turnIndex === 0 && workingTurn.workingTurnId === null && !confirmedActive
3732
- ? pendingPrompt?.state === 'waiting' || pendingPrompt?.state === 'failed'
3733
- : turnRendersQueued({
3734
- turnId: turn.id,
3735
- resolution: workingTurn,
3736
- sessionWorking: lastTurnWorking,
3737
- confirmedActive,
3738
- inboxPrompt: pendingPrompt,
3739
- }), 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
3740
- ? rewindTarget.text
3741
- : null, editPending: editSendPending || !!sessionState?.rewindPending, onEditCancel: stableEditCancel, onEditSend: stableEditSend, rewindDisabled: !!readOnly ||
3742
- (rewindable !== null && !rewindable.has(turn.id)) ||
3743
- !runtimeCanRewind ||
3744
- !sessionState ||
3745
- isBusy ||
3746
- sessionState.rewindPending ||
3747
- // The runtime is not idle while queued prompts
3748
- // are still on their way to it — a rewind mid-
3749
- // delivery fails downstream with "Session is
3750
- // busy" (measured); refuse it up front instead.
3751
- promptInbox.prompts.length > 0 }, turnRenderKeys.get(turn.id)));
3752
- })] }) }), isOptimisticCompacting && !hasCompactionTurn && (_jsx("div", { className: turns.length > 0 ? 'mt-12' : 'mt-2', children: _jsx(CompactionMarker, { running: true }) })), [
3753
- ...(turnOutcome.recent_failures ?? []),
3754
- ...(turnOutcome.last_ended?.end_reason === 'failed' &&
3755
- !turnOutcome.recent_failures?.some((failure) => failure.message_id === turnOutcome.last_ended?.message_id)
3756
- ? [turnOutcome.last_ended]
3757
- : []),
3758
- ].filter((failure) => !isAbortError(failure.error) &&
3759
- !failureShownByTurn(failure, turns) &&
3760
- !failureSupersededByTurn(failure, turns) &&
3761
- (!failure.error?.message || failure.error.message !== commandError?.message)).map((failure) => {
3762
- const messageId = failure.message_id ?? 'persisted-turn-failure';
3763
- // Use the SDK's settle window for a cause that may arrive
3764
- // one frame later, including an unnamed failed last turn.
3765
- const notice = turnEndNotice({
3766
- ...turnOutcome,
3767
- recent_failures: [{ ...failure, message_id: messageId, error: failure.error ?? null }],
3768
- }, messageId, { hasError: false, isAbort: false });
3769
- return notice ? (_jsx(TurnErrorDisplay, { errorText: notice.kind === 'unexplained'
3770
- ? tHardcodedUi.raw('i18nComplete.text73112526c03a')
3771
- : persistedFailureText(failure.error), className: "mt-2" }, messageId)) : null;
3772
- }), commandError && (_jsx(TurnErrorDisplay, { error: commandError, isAbort: isAbortError(commandError.cause), modelOptions: modelOptions, className: "mt-2" })), showFallbackBusyRow && fallbackBusyRowTurnId === null && (rowsContext ? (
3773
- // A channel thread waits in the agent's answer row.
3774
- _jsx(AgentBusyRow, { sessionId: sessionId })) : (_jsx(SessionBusyIndicator, { sessionId: sessionId,
3775
- // Matches the stand-in's row spacing under a bubble
3776
- // (`OptimisticTurn`), so the crossfade into the real
3777
- // transcript does not move it. Nothing above it when
3778
- // the transcript is empty, so no margin there.
3779
- 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: {
3780
- left: `${selectionPopup.x}px`,
3781
- top: `${selectionPopup.y}px`,
3782
- transform: 'translate(-50%, -100%)',
3783
- }, 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
3784
- ? 'duration-normal scale-100 opacity-100'
3785
- : '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
3786
- // `undefined`, not `true`, once released: the composer's own
3787
- // viewport rule (>= 640px) still decides, so this never forces
3788
- // focus onto a phone keyboard.
3789
- , {
3689
+ _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',
3690
+ // Transparent in the welcome state so the root-level full-bleed wallpaper
3691
+ // (portaled into SessionLayout) reads through; solid once real content
3692
+ // takes over. Same base color either way, so non-welcome is unchanged.
3693
+ 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
3694
+ ? welcomeWallpaper && createPortal(welcomeWallpaper, wallpaperLayer)
3695
+ : 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,
3696
+ // A chat with no `useSession` source: the raw explorer lists the
3697
+ // rows `useSessionSync` read for it.
3698
+ 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: () => {
3699
+ try {
3700
+ if (sessionId)
3701
+ useTabStore.getState().closeTab?.(sessionId);
3702
+ }
3703
+ catch { }
3704
+ }, 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(
3705
+ // overflow-anchor:none — this scroll area does ALL of its own
3706
+ // anchoring (useAutoScroll's spacer + RAF follow, the send-path
3707
+ // turn anchor, and the history-prepend content-space restore in
3708
+ // session-history-scroll.ts). The browser's native scroll
3709
+ // anchoring (default `overflow-anchor: auto`) tries to
3710
+ // compensate for the SAME prepends independently, and the two
3711
+ // corrections stacking is the other half of the scroll-up
3712
+ // teleport: ours restores the reader's position, then the
3713
+ // native one nudges it again.
3714
+ '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",
3715
+ // Width and gutters live in `SESSION_TRANSCRIPT_CLASS`: the
3716
+ // instant shell draws this same column and the two crossfade
3717
+ // into each other, so a difference here is a sideways jump on
3718
+ // screen, not a style opinion. See session-body.tsx.
3719
+ //
3720
+ // No bottom padding, there or here: the space under the last
3721
+ // message is the auto-scroll spacer's job alone. The `pb-32`
3722
+ // that used to sit here stacked 128px of dead space on top of
3723
+ // it — the "extra inset at the bottom of the session".
3724
+ // Rows run edge to edge: each row owns its gutters and its hover fill.
3725
+ 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 &&
3726
+ !olderPullFailed &&
3727
+ 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 &&
3728
+ firstPromptSource &&
3729
+ queuedSyntheticMessages.length === 0 &&
3730
+ rowsContext && (
3731
+ // A channel thread draws the stand-in as rows, the same
3732
+ // rows its boot body drew (`ThreadBootRows`).
3733
+ _jsx(PendingPromptRows, { text: buildOptimisticPromptTextWithUploads(firstPromptSource.text, firstPromptSource.files), author: rowsContext.owner, sessionId: sessionId, busy: turns.length === 0 && (lastTurnWorking || promptInbox.prompts.some(isFirstPromptRow)) })), showFirstPromptPreview &&
3734
+ firstPromptSource &&
3735
+ queuedSyntheticMessages.length === 0 &&
3736
+ !rowsContext && (_jsx(OptimisticTurn, { text: buildOptimisticPromptTextWithUploads(firstPromptSource.text, firstPromptSource.files),
3737
+ // Preserve a real failed-send status through the
3738
+ // boot-shell handover without inventing upload progress.
3739
+ // A first prompt held on its uploads carries its own.
3740
+ uploadStatus: firstPromptSource.uploadStatus ?? firstPromptUploadStatus, agentNames: agentNames, onFileClick: openFileInComputer, sessionId: sessionId,
3741
+ // The first item of the conversation, like turn 0, which has no
3742
+ // top margin. `first:mt-0` misses here: the list opens with a
3743
+ // zero-height <header>, so the stand-in sat 44px lower than turn 0
3744
+ // and every swap between the two jumped the bubble (KRTX-2931).
3745
+ className: "mt-0",
3746
+ // An undelivered first prompt is a turn about to start, as the
3747
+ // shell above this chat shows it: busy from the first frame,
3748
+ // before the working projection has read the inbox (KRTX-2931).
3749
+ busy: turns.length === 0 && (lastTurnWorking || promptInbox.prompts.some(isFirstPromptRow)) })), turns.map((turn, turnIndex) => {
3750
+ // Check if this turn is a compaction summary — and
3751
+ // whether it actually PRODUCED one. A failed/aborted
3752
+ // attempt (compaction-flagged, no content, not the
3753
+ // working turn) renders as one slim row, draws no
3754
+ // divider, and stacks tight against a neighbouring
3755
+ // failed attempt.
3756
+ const compaction = turn.compaction;
3757
+ const hasCompaction = compaction !== null;
3758
+ const isTurnWorking = turn.live;
3759
+ // `inFlight` (message state) alongside the projection:
3760
+ // classifying by projection alone flipped a streaming
3761
+ // compaction to "failed" for the frames where the two
3762
+ // disagree, popping the divider in and out — a layout
3763
+ // bounce right where the reader is looking.
3764
+ const isFailedCompaction = compaction !== null &&
3765
+ !compaction.hasContent &&
3766
+ !compaction.inFlight &&
3767
+ !isTurnWorking;
3768
+ // Retries collapse to ONE visible row, GLOBALLY: a
3769
+ // failed attempt with ANY later compaction turn (a
3770
+ // retry, or the one that finally landed) is history —
3771
+ // it keeps its TurnViewport (stable keys, scroll
3772
+ // anchors) but renders no content, and an empty
3773
+ // TurnViewport costs 0px (turn-viewport.tsx RULE 2).
3774
+ // Adjacency was not enough: attempts whose error landed
3775
+ // on a plain assistant message used to interleave as
3776
+ // unclassified turns, breaking every consecutive run.
3777
+ const suppressedFailedCompaction = isFailedCompaction && turnIndex < lastCompactionTurnIndex;
3778
+ // Notification-only early-return removed: it rendered the
3779
+ // user's pty_* card but skipped the turn's replies,
3780
+ // hiding every subsequent assistant response in that turn.
3781
+ // Fall through to the normal turn renderer instead.
3782
+ const confirmedActive = turnIsConfirmedActive({
3783
+ isTurnWorking,
3784
+ turnId: turn.id,
3785
+ activeTurnId,
3786
+ pendingDelivery: !!working.pendingDelivery,
3787
+ });
3788
+ const pendingPrompt = !confirmedActive && turn.assistant.length === 0
3789
+ ? pendingPromptsByMessageId.get(turn.id)
3790
+ : undefined;
3791
+ // A queued prompt is not in the runtime transcript yet;
3792
+ // its author still shows (`authorForTurn`).
3793
+ const promptAuthorId = pendingPromptsByMessageId.get(turn.id)?.author_user_id;
3794
+ const turnAuthor = authorForTurn(transcriptAuthors, messageAuthors, turn.id, pendingPrompt?.wire_message_id) ??
3795
+ participantAuthor(sessionParticipants, promptAuthorId) ??
3796
+ (sentHereIds.current.has(turn.id) ||
3797
+ sentHereIds.current.has(turnRenderKeys.get(turn.id) ?? '') ||
3798
+ (viewerId !== undefined && promptAuthorId === viewerId) ||
3799
+ // The first prompt of a session the viewer started,
3800
+ // sent from another surface (project home), before
3801
+ // the first authors read lands.
3802
+ (messageAuthorsLoading &&
3803
+ viewerId !== undefined &&
3804
+ projectSessionRow?.created_by === viewerId &&
3805
+ turn.id === userMessageIds[0])
3806
+ ? viewerAsAuthor
3807
+ : undefined);
3808
+ return (_jsx(TranscriptTurnRow
3809
+ // ONE element per prompt: keyed by the id the
3810
+ // bubble was FIRST painted under, so the swap to a
3811
+ // re-minted echo id re-renders this node instead
3812
+ // of mounting a new one (opacity keeps animating,
3813
+ // hover state survives, nothing jumps).
3814
+ , { turnId: turn.id, modelOptions: modelOptions, suppressed: suppressedFailedCompaction, continuedWith: harnessSwitches.get(turn.id)?.harness, fullTextState: loaded.state[turn.id] ?? 'idle', onLoadFullText: loadFullTexts, showBusyRow: showFallbackBusyRow &&
3815
+ fallbackBusyRowTurnId === turn.id,
3816
+ // Queued bubbles STACK: a pending turn right after
3817
+ // another pending turn sits close to it, like a
3818
+ // list of what is waiting — not a turn's width
3819
+ // apart as if each had been answered in between.
3820
+ // (Failed compaction rows need no stacking rule any
3821
+ // more — at most one is visible at a time.)
3822
+ viewportClassName: turnIndex === 0 || transcriptRows
3823
+ ? ''
3824
+ : // A compaction, the work after it and another agent's notice continue the turn above.
3825
+ turn.compaction || turn.continues || agentNoticeTurnIds.has(turn.id)
3826
+ ? 'mt-6'
3827
+ : lastTurnWorking &&
3828
+ pendingTurnIds.has(turn.id) &&
3829
+ pendingTurnIds.has(turns[turnIndex - 1].id)
3830
+ ? 'mt-3'
3831
+ : 'mt-12', turn: turn, author: turnAuthor,
3832
+ // Reserve the sender row while the authors load,
3833
+ // for a queued prompt whose sender is known, and
3834
+ // for a live message until its author resolves.
3835
+ showAuthor: !!turnAuthor ||
3836
+ messageAuthorsLoading ||
3837
+ !!promptAuthorId ||
3838
+ (loadedUserIds?.sessionId === sessionId &&
3839
+ !loadedUserIds.ids.has(turn.id) &&
3840
+ 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,
3841
+ // Handed over only once the stand-in has stepped
3842
+ // aside — while it is up it draws these itself.
3843
+ pendingText: turnIndex === 0 ? firstTurnHandover?.text : undefined, pendingAttachments: sentAttachmentsForTurn({
3844
+ sentByMessage: sentAttachmentsByMessage,
3845
+ messageId: turn.id,
3846
+ originId: optimisticOriginOf(sessionId, turn.id),
3847
+ isFirstTurn: turnIndex === 0,
3848
+ firstTurnHandover: firstTurnHandover?.attachments,
3849
+ firstTurnSent: firstPromptAttachments(projectSessionId),
3850
+ queuedRowAttachments: inboxRowsByMessageId.get(turn.id)?.attachments,
3851
+ }), uploadStatus: heldSendFailures?.[turn.id]
3852
+ ? {
3853
+ state: 'failed',
3854
+ message: heldSendFailures[turn.id].message,
3855
+ onRetry: () => retryHeldSend(sessionId, turn.id, resendHeldSend, (error) => classifySessionError(error).message),
3856
+ }
3857
+ : turnIndex === 0 && firstTurnHandover?.attachments.length
3858
+ ? firstPromptUploadStatus
3859
+ : undefined, sessionWorking: lastTurnWorking, isWorkingTurn: turn.live, suppressBusyIndicator: suppressWorkingTurnBusy, awaitingUser: awaitingUserInput,
3860
+ // An idle send stays in the inbox until delivery,
3861
+ // but nothing runs ahead of it: queued only while
3862
+ // it waits behind a turn (`turnRendersQueued`).
3863
+ // The first turn, with no turn working, has
3864
+ // nothing ahead of it: a session's first prompt is
3865
+ // starting, not queued, while the computer comes up
3866
+ // and before the turn layer marks it queued or live.
3867
+ pending: turnIndex === 0 && workingTurn.workingTurnId === null && !confirmedActive
3868
+ ? pendingPrompt?.state === 'waiting' || pendingPrompt?.state === 'failed'
3869
+ : turnRendersQueued({
3870
+ turnId: turn.id,
3871
+ resolution: workingTurn,
3872
+ sessionWorking: lastTurnWorking,
3873
+ confirmedActive,
3874
+ inboxPrompt: pendingPrompt,
3875
+ }), 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
3876
+ ? rewindTarget.text
3877
+ : null, editPending: editSendPending || !!sessionState?.rewindPending, onEditCancel: stableEditCancel, onEditSend: stableEditSend, rewindDisabled: !!readOnly ||
3878
+ (rewindable !== null && !rewindable.has(turn.id)) ||
3879
+ !runtimeCanRewind ||
3880
+ !sessionState ||
3881
+ isBusy ||
3882
+ sessionState.rewindPending ||
3883
+ // The runtime is not idle while queued prompts
3884
+ // are still on their way to it — a rewind mid-
3885
+ // delivery fails downstream with "Session is
3886
+ // busy" (measured); refuse it up front instead.
3887
+ promptInbox.prompts.length > 0 }, turnRenderKeys.get(turn.id)));
3888
+ })] }) }), isOptimisticCompacting && !hasCompactionTurn && (_jsx("div", { className: turns.length > 0 ? 'mt-12' : 'mt-2', children: _jsx(CompactionMarker, { running: true }) })), [
3889
+ ...(turnOutcome.recent_failures ?? []),
3890
+ ...(turnOutcome.last_ended?.end_reason === 'failed' &&
3891
+ !turnOutcome.recent_failures?.some((failure) => failure.message_id === turnOutcome.last_ended?.message_id)
3892
+ ? [turnOutcome.last_ended]
3893
+ : []),
3894
+ ].filter((failure) => !isAbortError(failure.error) &&
3895
+ !failureShownByTurn(failure, turns) &&
3896
+ !failureSupersededByTurn(failure, turns) &&
3897
+ (!failure.error?.message || failure.error.message !== commandError?.message)).map((failure) => {
3898
+ const messageId = failure.message_id ?? 'persisted-turn-failure';
3899
+ // Use the SDK's settle window for a cause that may arrive
3900
+ // one frame later, including an unnamed failed last turn.
3901
+ const notice = turnEndNotice({
3902
+ ...turnOutcome,
3903
+ recent_failures: [{ ...failure, message_id: messageId, error: failure.error ?? null }],
3904
+ }, messageId, { hasError: false, isAbort: false });
3905
+ return notice ? (_jsx(TurnErrorDisplay, { errorText: notice.kind === 'unexplained'
3906
+ ? tHardcodedUi.raw('i18nComplete.text73112526c03a')
3907
+ : persistedFailureText(failure.error), className: "mt-2" }, messageId)) : null;
3908
+ }), commandError && (_jsx(TurnErrorDisplay, { error: commandError, isAbort: isAbortError(commandError.cause), modelOptions: modelOptions, className: "mt-2" })), showFallbackBusyRow && fallbackBusyRowTurnId === null && (rowsContext ? (
3909
+ // A channel thread waits in the agent's answer row.
3910
+ _jsx(AgentBusyRow, { sessionId: sessionId })) : (_jsx(SessionBusyIndicator, { sessionId: sessionId,
3911
+ // Matches the stand-in's row spacing under a bubble
3912
+ // (`OptimisticTurn`), so the crossfade into the real
3913
+ // transcript does not move it. Nothing above it when
3914
+ // the transcript is empty, so no margin there.
3915
+ 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: {
3916
+ left: `${selectionPopup.x}px`,
3917
+ top: `${selectionPopup.y}px`,
3918
+ transform: 'translate(-50%, -100%)',
3919
+ }, 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
3920
+ ? 'duration-normal scale-100 opacity-100'
3921
+ : '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
3790
3922
  // `undefined`, not `true`, once released: the composer's own
3791
3923
  // viewport rule (>= 640px) still decides, so this never forces
3792
3924
  // focus onto a phone keyboard.
3793
- autoFocus: deferComposerFocus ? false : undefined, onSend: async (text, files, mentions, attachments, placement) => {
3794
- if (await queueEdit.save(text))
3795
- return;
3796
- // Enter while a turn runs steers it (D9.1); Cmd/Ctrl+Enter is Queue List.
3797
- await handleSend(text, files, mentions, attachments, composerSendDelivery(placement ?? 'transcript', isBusyRef.current));
3798
- }, prefill: composerPrefill, onPrefillApplied: (id) => {
3799
- useSessionComposerPrefillStore.getState().clearPrefill(sessionId, id);
3800
- },
3801
- // Up from the first row takes the queue back; the placeholder
3802
- // says so while there is something to take.
3803
- onArrowUpAtStart: () => queueEdit.takeBack(),
3804
- // A host placeholder ("Reply…") is static: the rotating tips would replace it.
3805
- hint: canTakeBackQueue ? tHardcodedUi.raw('i18nComplete.text03a01dd53ffa') : composerPlaceholder,
3806
- // Editing a queued message: the send saves it back into the
3807
- // queue, so the control says Submit, never Stop.
3808
- submitLabel: queueEdit.editing ? tQueue('submitEdit') : null, draftScope: composerDraftScope, draftActive: !deferComposerFocus, attachRequestId: attachRequestId, isBusy: isBusy,
3809
- // The ONE projection, not the 300 ms busy fade: it is what
3810
- // decides whether a `/` command may be dispatched, and a fade
3811
- // timer that has already lapsed would let one abort a live turn.
3812
- // `effectiveBusy` folds in optimistic compaction (not a turn, so
3813
- // not in `working`) and the retrying-turn predicate, so this
3814
- // site reads one value instead of re-OR-ing a term onto it.
3815
- sessionWorking: effectiveBusy,
3816
- // Gates `/` COMMANDS only. A prompt typed at a sleeping box is
3817
- // an inbox row and goes out when the box answers; a command has
3818
- // no row, and `runCommand` swallows it silently until the
3819
- // runtime is switched.
3820
- 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,
3821
- // Only lock the input into question-answer mode while the session is
3822
- // actually busy (a live question keeps the run busy). If a question
3823
- // chip is ever showing while the session is idle — e.g. a dead /
3824
- // abandoned question the agent left behind — the input stays unlocked
3825
- // so a typed message is sent to the agent instead of being swallowed
3826
- // as a custom answer.
3827
- lockForQuestion: !!renderedQuestion && isBusy,
3828
- // Same dead-prompt guard as questions: only lock while the agent is
3829
- // actually paused on the decision (isBusy), so a stale card can't
3830
- // swallow the composer on an idle session.
3831
- 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,
3832
- // The shell can now render on a cached transcript alone, i.e. before
3833
- // the sandbox answers — so sending has to be gated separately from
3834
- // reading. See sessionComposerReadiness.
3835
- notice: hostNotice(composerReadiness.notice, rowsContext?.notices),
3836
- // Inside the thread panel's bordered box, as the channel composer.
3837
- // A phone keeps the row under the card; a 720px desktop window does not.
3838
- underbarPlacement: transcriptRows && !isPhone ? 'inline' : undefined,
3839
- // The panel's toolbar is narrow: the agent is its tile, the model keeps its name.
3840
- agentPickerCompact: transcriptRows && !isPhone,
3841
- // A thread panel's rows run `px-5`, and the channel composer
3842
- // beside it sits `pb-4` off the window's bottom edge: the same
3843
- // margins, so the two boxes line up.
3844
- parentClassName: transcriptRows ? 'max-w-none px-5 pb-4' : undefined, onNoticeRetry: composerReadiness.notice && composerReadiness.retryable
3845
- ? requestRuntimeReconnect
3846
- : 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 }) })] }))] })] }) }) }) }));
3925
+ // A thread a space's chat opened by itself does not take the focus (`ComposerAutoFocusContext`).
3926
+ , {
3927
+ // `undefined`, not `true`, once released: the composer's own
3928
+ // viewport rule (>= 640px) still decides, so this never forces
3929
+ // focus onto a phone keyboard.
3930
+ // A thread a space's chat opened by itself does not take the focus (`ComposerAutoFocusContext`).
3931
+ autoFocus: deferComposerFocus || !composerAutoFocus ? false : undefined, onSend: async (text, files, mentions, attachments, placement) => {
3932
+ if (await queueEdit.save(text))
3933
+ return;
3934
+ // Enter while a turn runs steers it (D9.1); Cmd/Ctrl+Enter is Queue List.
3935
+ await handleSend(text, files, mentions, attachments, composerSendDelivery(placement ?? 'transcript', isBusyRef.current));
3936
+ }, prefill: composerPrefill, onPrefillApplied: (id) => {
3937
+ useSessionComposerPrefillStore.getState().clearPrefill(sessionId, id);
3938
+ },
3939
+ // Up from the first row takes the queue back; the placeholder
3940
+ // says so while there is something to take.
3941
+ onArrowUpAtStart: () => queueEdit.takeBack(),
3942
+ // A host placeholder ("Reply…") is static: the rotating tips would replace it.
3943
+ hint: canTakeBackQueue ? tHardcodedUi.raw('i18nComplete.text03a01dd53ffa') : composerPlaceholder,
3944
+ // Editing a queued message: the send saves it back into the
3945
+ // queue, so the control says Submit, never Stop.
3946
+ submitLabel: queueEdit.editing ? tQueue('submitEdit') : null, draftScope: composerDraftScope, draftActive: !deferComposerFocus, attachRequestId: attachRequestId, isBusy: isBusy,
3947
+ // The ONE projection, not the 300 ms busy fade: it is what
3948
+ // decides whether a `/` command may be dispatched, and a fade
3949
+ // timer that has already lapsed would let one abort a live turn.
3950
+ // `effectiveBusy` folds in optimistic compaction (not a turn, so
3951
+ // not in `working`) and the retrying-turn predicate, so this
3952
+ // site reads one value instead of re-OR-ing a term onto it.
3953
+ sessionWorking: effectiveBusy,
3954
+ // Gates `/` COMMANDS only. A prompt typed at a sleeping box is
3955
+ // an inbox row and goes out when the box answers; a command has
3956
+ // no row, and `runCommand` swallows it silently until the
3957
+ // runtime is switched.
3958
+ 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,
3959
+ // Only lock the input into question-answer mode while the session is
3960
+ // actually busy (a live question keeps the run busy). If a question
3961
+ // chip is ever showing while the session is idle — e.g. a dead /
3962
+ // abandoned question the agent left behind — the input stays unlocked
3963
+ // so a typed message is sent to the agent instead of being swallowed
3964
+ // as a custom answer.
3965
+ lockForQuestion: !!renderedQuestion && isBusy,
3966
+ // Same dead-prompt guard as questions: only lock while the agent is
3967
+ // actually paused on the decision (isBusy), so a stale card can't
3968
+ // swallow the composer on an idle session.
3969
+ 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,
3970
+ // The shell can now render on a cached transcript alone, i.e. before
3971
+ // the sandbox answers — so sending has to be gated separately from
3972
+ // reading. See sessionComposerReadiness.
3973
+ notice: hostNotice(composerReadiness.notice, rowsContext?.notices),
3974
+ // Inside the thread panel's bordered box, as the channel composer.
3975
+ // A phone keeps the row under the card; a 720px desktop window does not.
3976
+ underbarPlacement: transcriptRows && !isPhone ? 'inline' : undefined,
3977
+ // The panel's toolbar is narrow: the agent is its tile, the model keeps its name.
3978
+ agentPickerCompact: transcriptRows && !isPhone,
3979
+ // A thread panel's rows run `px-5`, and the channel composer
3980
+ // beside it sits `pb-4` off the window's bottom edge: the same
3981
+ // margins, so the two boxes line up.
3982
+ parentClassName: transcriptRows ? 'max-w-none px-5 pb-4' : undefined, onNoticeRetry: composerReadiness.notice && composerReadiness.retryable
3983
+ ? requestRuntimeReconnect
3984
+ : 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 }) })] }))] })] }) }) }) }) }));
3847
3985
  }