@kortix/ui 0.15.11 → 0.16.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 (404) hide show
  1. package/dist/_vendor/kortix-shared.js +485 -187
  2. package/dist/_vendor/shared/my-kortix-agent.d.ts +5 -3
  3. package/dist/_vendor/shared/session/attachment-tile.d.ts +8 -0
  4. package/dist/_vendor/shared/workspace-settings.d.ts +3 -0
  5. package/dist/access/access/copy-row.d.ts +7 -1
  6. package/dist/access/access/copy-row.js +2 -2
  7. package/dist/animated-copy-icon.js +2 -1
  8. package/dist/browser/sandbox-browser-chrome.d.ts +2 -1
  9. package/dist/browser/sandbox-browser-chrome.js +1 -1
  10. package/dist/customize/agents/agent-cover-card.d.ts +1 -1
  11. package/dist/customize/agents/agent-cover-card.js +10 -2
  12. package/dist/customize/agents/agent-filter.js +3 -1
  13. package/dist/customize/agents/agent-overview.d.ts +10 -0
  14. package/dist/customize/agents/agent-overview.js +5 -4
  15. package/dist/customize/agents/agent-page-chrome.d.ts +5 -6
  16. package/dist/customize/agents/agent-page-chrome.js +16 -13
  17. package/dist/customize/agents/agent-page.js +6 -28
  18. package/dist/customize/agents/agent-tabs.d.ts +1 -0
  19. package/dist/customize/agents/agent-tabs.js +1 -0
  20. package/dist/customize/agents/agents-page.js +3 -3
  21. package/dist/customize/agents/create-agent-modal.d.ts +9 -0
  22. package/dist/customize/agents/create-agent-modal.js +21 -3
  23. package/dist/customize/agents/use-default-agent.js +2 -2
  24. package/dist/customize/connectors/connector-identity.d.ts +11 -2
  25. package/dist/customize/connectors/connector-identity.js +16 -4
  26. package/dist/customize/connectors/connectors-page.js +10 -6
  27. package/dist/customize/connectors/detail/app-page.js +2 -2
  28. package/dist/customize/connectors/install/install-dialog.d.ts +2 -0
  29. package/dist/customize/connectors/install/install-dialog.js +6 -1
  30. package/dist/customize/connectors/use-agent-access.d.ts +1 -0
  31. package/dist/customize/evals/eval-compare-view.d.ts +10 -0
  32. package/dist/customize/evals/eval-compare-view.js +68 -0
  33. package/dist/customize/evals/eval-dataset-view.d.ts +20 -0
  34. package/dist/customize/evals/eval-dataset-view.js +81 -0
  35. package/dist/customize/evals/eval-datasets-page.d.ts +25 -0
  36. package/dist/customize/evals/eval-datasets-page.js +91 -0
  37. package/dist/customize/evals/eval-job-view.d.ts +12 -0
  38. package/dist/customize/evals/eval-job-view.js +360 -0
  39. package/dist/customize/evals/eval-jobs-page.d.ts +4 -0
  40. package/dist/customize/evals/eval-jobs-page.js +69 -0
  41. package/dist/customize/evals/eval-meta.d.ts +97 -0
  42. package/dist/customize/evals/eval-meta.js +228 -0
  43. package/dist/customize/evals/eval-task-view.d.ts +13 -0
  44. package/dist/customize/evals/eval-task-view.js +123 -0
  45. package/dist/customize/evals/eval-tasks-page.d.ts +8 -0
  46. package/dist/customize/evals/eval-tasks-page.js +56 -0
  47. package/dist/customize/evals/eval-ui.d.ts +97 -0
  48. package/dist/customize/evals/eval-ui.js +153 -0
  49. package/dist/customize/evals/evals-page.d.ts +10 -0
  50. package/dist/customize/evals/evals-page.js +56 -0
  51. package/dist/customize/evals/run-eval-modal.d.ts +28 -0
  52. package/dist/customize/evals/run-eval-modal.js +167 -0
  53. package/dist/customize/project-settings/project-admin-sections.d.ts +3 -2
  54. package/dist/customize/project-settings/project-admin-sections.js +6 -1
  55. package/dist/customize/providers/provider-connect.d.ts +13 -0
  56. package/dist/customize/providers/provider-connect.js +29 -5
  57. package/dist/customize/providers/provider-sheet.js +5 -4
  58. package/dist/customize/sections/view/gateway/gateway-overview.d.ts +5 -0
  59. package/dist/customize/sections/view/gateway/gateway-overview.js +32 -6
  60. package/dist/customize/sections/view/gateway/routing-parts.d.ts +6 -0
  61. package/dist/customize/sections/view/gateway/routing-parts.js +21 -13
  62. package/dist/customize/sections/view/git-view.d.ts +19 -1
  63. package/dist/customize/sections/view/git-view.js +7 -3
  64. package/dist/customize/sections/view/manifest-issue-list.d.ts +16 -0
  65. package/dist/customize/sections/view/manifest-issue-list.js +41 -0
  66. package/dist/customize/sections/view/manifest-issues-row.d.ts +24 -0
  67. package/dist/customize/sections/view/manifest-issues-row.js +39 -0
  68. package/dist/customize/sections/view/sandbox-provider-coverage.d.ts +7 -1
  69. package/dist/customize/sections/view/sandbox-provider-coverage.js +7 -5
  70. package/dist/customize/sections/view/secrets-view.d.ts +13 -0
  71. package/dist/customize/sections/view/secrets-view.js +10 -6
  72. package/dist/customize/sections/view/subscription-usage.d.ts +2 -7
  73. package/dist/customize/sections/view/subscription-usage.js +4 -8
  74. package/dist/customize/settings/settings-tab-header.js +12 -3
  75. package/dist/customize/settings/tabs/experimental-tab.d.ts +16 -5
  76. package/dist/customize/settings/tabs/experimental-tab.js +36 -11
  77. package/dist/customize/settings/tabs/general-tab.js +1 -1
  78. package/dist/customize/settings/tabs/sandbox-tab.d.ts +10 -0
  79. package/dist/customize/settings/tabs/sandbox-tab.js +27 -4
  80. package/dist/customize/settings/tabs/snapshots-tab.d.ts +31 -0
  81. package/dist/customize/settings/tabs/snapshots-tab.js +61 -5
  82. package/dist/customize/settings/tabs/workspace-keys.js +6 -3
  83. package/dist/customize/shared/capability-page-shell.js +9 -1
  84. package/dist/customize/shared/catalog/catalog-card.d.ts +1 -1
  85. package/dist/customize/shared/catalog/catalog-card.js +15 -5
  86. package/dist/customize/shared/customize-tab-bar.js +1 -1
  87. package/dist/customize/shared/new-entity-menu.d.ts +1 -1
  88. package/dist/customize/shared/new-entity-menu.js +38 -1
  89. package/dist/customize/triggers/runtime-triggers.d.ts +4 -0
  90. package/dist/customize/triggers/runtime-triggers.js +21 -2
  91. package/dist/customize/triggers/schedule/post-to-field.js +2 -2
  92. package/dist/customize/triggers/schedule-view.js +2 -1
  93. package/dist/files/project/components/drive-explorer.js +33 -70
  94. package/dist/files/project/components/drive-grid-view.d.ts +2 -31
  95. package/dist/files/project/components/drive-grid-view.js +12 -22
  96. package/dist/files/project/components/drive-list-view.d.ts +3 -30
  97. package/dist/files/project/components/drive-list-view.js +8 -18
  98. package/dist/files/project/components/drive-selection-bar.d.ts +4 -5
  99. package/dist/files/project/components/drive-selection-bar.js +13 -20
  100. package/dist/files/project/components/explorer-listing.d.ts +48 -0
  101. package/dist/files/project/components/explorer-listing.js +64 -0
  102. package/dist/files/project/components/file-explorer-page.js +7 -204
  103. package/dist/files/project/components/file-thumbnail.js +3 -1
  104. package/dist/files/project/components/manifest-issue-mark.d.ts +9 -0
  105. package/dist/files/project/components/manifest-issue-mark.js +26 -0
  106. package/dist/files/project/hooks/use-change-requests.d.ts +10 -0
  107. package/dist/files/project/hooks/use-change-requests.js +17 -0
  108. package/dist/files/project/manifest-annotations.d.ts +16 -0
  109. package/dist/files/project/manifest-annotations.js +19 -0
  110. package/dist/files/project/store/version-store.d.ts +1 -1
  111. package/dist/files/project/upload-batch.d.ts +20 -0
  112. package/dist/files/project/upload-batch.js +20 -0
  113. package/dist/files/runtime/hooks/use-binary-blob.js +3 -2
  114. package/dist/files/runtime/hooks/use-file-content.js +3 -2
  115. package/dist/files/runtime/hooks/use-file-list.js +1 -2
  116. package/dist/files/runtime/hooks/use-file-mutations.js +69 -6
  117. package/dist/files/runtime/hooks/use-file-refresh.d.ts +4 -0
  118. package/dist/files/runtime/hooks/use-file-refresh.js +6 -0
  119. package/dist/files/tree/components/file-tree-item.js +1 -4
  120. package/dist/files/viewer/file-annotations.d.ts +18 -0
  121. package/dist/files/viewer/file-annotations.js +21 -0
  122. package/dist/files/viewer/file-content-renderer.js +1 -1
  123. package/dist/files/viewer/file-viewer.js +2 -1
  124. package/dist/files/viewer/index.d.ts +1 -0
  125. package/dist/files/viewer/index.js +1 -0
  126. package/dist/files/viewer/use-file-content-state.js +8 -1
  127. package/dist/i18n/en.d.ts +497 -46
  128. package/dist/i18n/en.js +538 -87
  129. package/dist/i18n/ui-catalog/remaining-ui-translation-keys.generated.js +0 -4
  130. package/dist/icons/caret-right-solid.d.ts +11 -0
  131. package/dist/icons/caret-right-solid.js +15 -0
  132. package/dist/internal/auth/auth-art.d.ts +12 -0
  133. package/dist/internal/auth/auth-art.js +118 -0
  134. package/dist/internal/auth/auth-card-shell.d.ts +14 -10
  135. package/dist/internal/auth/auth-card-shell.js +20 -31
  136. package/dist/internal/auth/auth-consent.d.ts +3 -1
  137. package/dist/internal/auth/auth-consent.js +2 -2
  138. package/dist/internal/auth/auth-primitives.d.ts +26 -1
  139. package/dist/internal/auth/auth-primitives.js +37 -8
  140. package/dist/internal/connector-logo/connector-logo.d.ts +2 -1
  141. package/dist/internal/connector-logo/connector-logo.js +11 -2
  142. package/dist/internal/files/file-read-retry.d.ts +18 -2
  143. package/dist/internal/files/file-read-retry.js +42 -4
  144. package/dist/internal/hooks/projects/use-new-project-session.js +5 -10
  145. package/dist/internal/hooks/use-auto-scroll-physics.d.ts +1 -1
  146. package/dist/internal/hooks/use-auto-scroll-physics.js +2 -10
  147. package/dist/internal/hooks/use-reduced-motion.d.ts +4 -0
  148. package/dist/internal/hooks/use-reduced-motion.js +12 -0
  149. package/dist/internal/hooks/use-save-shortcut.d.ts +8 -0
  150. package/dist/internal/hooks/use-save-shortcut.js +28 -0
  151. package/dist/internal/layout/connect-mcp-modal.d.ts +1 -1
  152. package/dist/internal/layout/connect-mcp-modal.js +9 -4
  153. package/dist/internal/layout/panel-chrome.d.ts +28 -0
  154. package/dist/internal/layout/panel-chrome.js +27 -0
  155. package/dist/internal/layout/project-page-header.js +5 -1
  156. package/dist/internal/lib/browser-noise/rules/webview.js +16 -0
  157. package/dist/internal/lib/manifest-health.d.ts +25 -1
  158. package/dist/internal/lib/manifest-health.js +56 -0
  159. package/dist/internal/lib/project-preamble.js +1 -1
  160. package/dist/internal/lib/web-notifications.d.ts +1 -1
  161. package/dist/internal/lib/web-notifications.js +3 -0
  162. package/dist/internal/notifications/notification-inbox.js +2 -1
  163. package/dist/internal/notifications/notification-rows.d.ts +1 -1
  164. package/dist/internal/notifications/notification-rows.js +15 -1
  165. package/dist/internal/selection/selection-bar.d.ts +2 -8
  166. package/dist/internal/selection/selection-bar.js +15 -38
  167. package/dist/internal/stores/active-space-store.d.ts +1 -1
  168. package/dist/internal/stores/browser-recents-store.d.ts +1 -1
  169. package/dist/internal/stores/current-account-store.d.ts +1 -1
  170. package/dist/internal/stores/first-chat-store.d.ts +1 -1
  171. package/dist/internal/stores/mobile-app-promo-store.d.ts +1 -1
  172. package/dist/internal/stores/session-browser-store.d.ts +1 -1
  173. package/dist/internal/stores/session-expanded-store.d.ts +1 -1
  174. package/dist/internal/stores/session-filter-store.d.ts +1 -1
  175. package/dist/internal/stores/session-history-view-store.d.ts +1 -1
  176. package/dist/internal/stores/session-panel-memory-store.d.ts +1 -1
  177. package/dist/internal/stores/sound-store.d.ts +1 -1
  178. package/dist/internal/stores/tab-store.d.ts +1 -1
  179. package/dist/internal/stores/user-preferences-store.d.ts +9 -1
  180. package/dist/internal/stores/user-preferences-store.js +2 -0
  181. package/dist/internal/stores/web-notification-store.d.ts +1 -1
  182. package/dist/lib/base-ui-compat.js +28 -1
  183. package/dist/lib/dotmatrix-hooks.d.ts +1 -0
  184. package/dist/lib/dotmatrix-hooks.js +3 -13
  185. package/dist/lib/reduced-motion.d.ts +10 -0
  186. package/dist/lib/reduced-motion.js +104 -0
  187. package/dist/lib/routes.d.ts +9 -0
  188. package/dist/lib/routes.js +7 -4
  189. package/dist/markdown/artifact-link.d.ts +11 -0
  190. package/dist/markdown/artifact-link.js +62 -0
  191. package/dist/markdown/code/index.d.ts +1 -1
  192. package/dist/markdown/code/index.js +1 -1
  193. package/dist/markdown/code/inline-code.d.ts +1 -1
  194. package/dist/markdown/code/inline-code.js +1 -1
  195. package/dist/markdown/genui/components/map-canvas.js +2 -1
  196. package/dist/markdown/index.d.ts +3 -1
  197. package/dist/markdown/index.js +2 -1
  198. package/dist/markdown/{code/inline-chip.js → inline-chip.js} +2 -2
  199. package/dist/markdown/inline-code-text.d.ts +34 -0
  200. package/dist/markdown/inline-code-text.js +68 -0
  201. package/dist/markdown/setup-links/approval-decision.js +3 -3
  202. package/dist/markdown/soft-breaks.d.ts +21 -0
  203. package/dist/markdown/soft-breaks.js +33 -0
  204. package/dist/markdown/unified-markdown.d.ts +9 -1
  205. package/dist/markdown/unified-markdown.js +31 -9
  206. package/dist/primitives/action-bar.d.ts +50 -0
  207. package/dist/primitives/action-bar.js +87 -0
  208. package/dist/primitives/calendar.js +4 -2
  209. package/dist/primitives/inline-meta.js +2 -2
  210. package/dist/primitives/kortix-loader.js +2 -1
  211. package/dist/primitives/modal.d.ts +1 -1
  212. package/dist/primitives/paper-wallpaper-shaders.d.ts +1 -0
  213. package/dist/primitives/paper-wallpaper-shaders.js +6 -0
  214. package/dist/primitives/resizable.d.ts +1 -1
  215. package/dist/primitives/resize-seam.d.ts +3 -2
  216. package/dist/primitives/resize-seam.js +4 -3
  217. package/dist/primitives/settings-section-header.d.ts +30 -1
  218. package/dist/primitives/settings-section-header.js +37 -0
  219. package/dist/primitives/sliding-tab-indicator.js +2 -1
  220. package/dist/primitives/switch.js +15 -8
  221. package/dist/primitives/text-shimmer.js +6 -0
  222. package/dist/primitives/toast-clearance.d.ts +52 -0
  223. package/dist/primitives/toast-clearance.js +116 -0
  224. package/dist/primitives/toast.d.ts +3 -1
  225. package/dist/primitives/toast.js +2 -0
  226. package/dist/primitives/typed-title.js +1 -1
  227. package/dist/primitives/wallpaper-shaders.js +1 -1
  228. package/dist/session/actions/project-session-list-helpers.d.ts +16 -0
  229. package/dist/session/actions/project-session-list-helpers.js +18 -0
  230. package/dist/session/agents/agent-model.d.ts +1 -0
  231. package/dist/session/agents/agent-model.js +2 -1
  232. package/dist/session/agents/agent-strip.js +10 -4
  233. package/dist/session/agents/workflow-run-controls.d.ts +27 -4
  234. package/dist/session/agents/workflow-run-controls.js +63 -10
  235. package/dist/session/composer/ComposerCard.js +3 -0
  236. package/dist/session/composer/agent-selector.js +6 -4
  237. package/dist/session/composer/animated-placeholder.js +2 -1
  238. package/dist/session/composer/attachment-tile.d.ts +2 -2
  239. package/dist/session/composer/attachment-tile.js +25 -3
  240. package/dist/session/composer/composer-agent-access.d.ts +10 -1
  241. package/dist/session/composer/composer-agent-access.js +18 -4
  242. package/dist/session/composer/composer-chat-input.js +7 -2
  243. package/dist/session/composer/composer.d.ts +2 -2
  244. package/dist/session/composer/composer.js +7 -6
  245. package/dist/session/composer/hooks/use-file-search.d.ts +12 -2
  246. package/dist/session/composer/hooks/use-file-search.js +71 -7
  247. package/dist/session/composer/menus/menu-items.js +6 -2
  248. package/dist/session/composer/menus/menu-shell.d.ts +3 -1
  249. package/dist/session/composer/menus/menu-shell.js +2 -2
  250. package/dist/session/composer/menus/slash-menu.d.ts +7 -0
  251. package/dist/session/composer/menus/slash-menu.js +48 -1
  252. package/dist/session/composer/use-instant-session-send.js +7 -1
  253. package/dist/session/header/session-reminders-indicator.js +3 -2
  254. package/dist/session/header/session-site-header.js +24 -6
  255. package/dist/session/media/sandbox-url-detector.js +1 -1
  256. package/dist/session/models/model-connection-gate.js +2 -1
  257. package/dist/session/models/model-selector.js +1 -1
  258. package/dist/session/models/subscription-switcher.d.ts +7 -0
  259. package/dist/session/models/subscription-switcher.js +52 -10
  260. package/dist/session/models/subscription-windows.d.ts +2 -0
  261. package/dist/session/models/subscription-windows.js +2 -0
  262. package/dist/session/outcomes/session-outcomes-provider.js +14 -7
  263. package/dist/session/panel/action-panel.js +8 -19
  264. package/dist/session/panel/easy/app-preview.d.ts +4 -1
  265. package/dist/session/panel/easy/app-preview.js +95 -33
  266. package/dist/session/panel/easy/apps-card.js +6 -11
  267. package/dist/session/panel/easy/change-requests-card.js +1 -1
  268. package/dist/session/panel/easy/changes-card.d.ts +14 -0
  269. package/dist/session/panel/easy/changes-card.js +60 -0
  270. package/dist/session/panel/easy/context-card.d.ts +5 -1
  271. package/dist/session/panel/easy/context-card.js +13 -28
  272. package/dist/session/panel/easy/context-meter.d.ts +18 -0
  273. package/dist/session/panel/easy/context-meter.js +73 -0
  274. package/dist/session/panel/easy/detail-view.d.ts +1 -1
  275. package/dist/session/panel/easy/detail-view.js +24 -21
  276. package/dist/session/panel/easy/easy-panel.js +7 -5
  277. package/dist/session/panel/easy/file-preview.js +3 -1
  278. package/dist/session/panel/easy/frame-history.d.ts +91 -0
  279. package/dist/session/panel/easy/frame-history.js +198 -0
  280. package/dist/session/panel/easy/outputs-card.d.ts +10 -0
  281. package/dist/session/panel/easy/outputs-card.js +28 -31
  282. package/dist/session/panel/easy/panel-card.d.ts +1 -3
  283. package/dist/session/panel/easy/panel-card.js +24 -8
  284. package/dist/session/panel/easy/plan-card.js +2 -2
  285. package/dist/session/panel/easy/step-icon.d.ts +4 -1
  286. package/dist/session/panel/easy/step-icon.js +2 -2
  287. package/dist/session/panel/session-action-panel-column.d.ts +5 -0
  288. package/dist/session/panel/session-action-panel-column.js +198 -101
  289. package/dist/session/panel/session-desktop.js +5 -1
  290. package/dist/session/panel/session-diff-viewer.d.ts +3 -1
  291. package/dist/session/panel/session-diff-viewer.js +7 -4
  292. package/dist/session/panel/session-panel-provider.js +29 -5
  293. package/dist/session/panel/shared/derive-panels.js +64 -4
  294. package/dist/session/status/session-busy-indicator.js +2 -1
  295. package/dist/session/status/session-error-banner.js +1 -1
  296. package/dist/session/thread/chat-minimap.js +2 -1
  297. package/dist/session/thread/session-body.js +4 -1
  298. package/dist/session/thread/session-chat.js +18 -3
  299. package/dist/session/thread/session-turn-meta-rows.d.ts +13 -5
  300. package/dist/session/thread/session-turn-meta-rows.js +33 -5
  301. package/dist/session/thread/transcript.d.ts +1 -2
  302. package/dist/session/thread/transcript.js +26 -24
  303. package/dist/session/thread/typing-indicator.d.ts +2 -2
  304. package/dist/session/thread/typing-indicator.js +10 -3
  305. package/dist/session/tool/tools/session-spawn-tool.js +3 -3
  306. package/dist/session/tool/tools/workflow-run-card.d.ts +11 -1
  307. package/dist/session/tool/tools/workflow-run-card.js +31 -7
  308. package/dist/session/tool/tools/workflow-run-cost.d.ts +29 -0
  309. package/dist/session/tool/tools/workflow-run-cost.js +75 -0
  310. package/dist/session/tool/tools/workflow-tool.d.ts +1 -1
  311. package/dist/session/tool/tools/workflow-tool.js +40 -15
  312. package/dist/session/turn/peer-message-row.js +1 -1
  313. package/dist/session/turn/queued-prompt-bubbles.d.ts +3 -2
  314. package/dist/session/turn/queued-prompt-bubbles.js +1 -1
  315. package/dist/session/turn/throttled-markdown.js +1 -1
  316. package/dist/styles/theme.css +68 -0
  317. package/dist/styles.css +1 -1
  318. package/dist/terminal/pty-terminal.js +1 -1
  319. package/dist/terminal/session-terminal-connect-bar.js +2 -1
  320. package/dist/test-utils/intl.d.ts +497 -46
  321. package/dist/workspace/admin/project-admin-dashboard.js +21 -7
  322. package/dist/workspace/admin/settings-search-landing.js +2 -1
  323. package/dist/workspace/calendar/calendar-dates.d.ts +31 -0
  324. package/dist/workspace/calendar/calendar-dates.js +64 -0
  325. package/dist/workspace/calendar/calendar-new-item.d.ts +11 -0
  326. package/dist/workspace/calendar/calendar-new-item.js +47 -0
  327. package/dist/workspace/calendar/calendar-page.d.ts +3 -0
  328. package/dist/workspace/calendar/calendar-page.js +177 -0
  329. package/dist/workspace/calendar/calendar-panel.d.ts +13 -0
  330. package/dist/workspace/calendar/calendar-panel.js +103 -0
  331. package/dist/workspace/calendar/calendar-people.d.ts +52 -0
  332. package/dist/workspace/calendar/calendar-people.js +117 -0
  333. package/dist/workspace/calendar/calendar-scheduled.d.ts +29 -0
  334. package/dist/workspace/calendar/calendar-scheduled.js +118 -0
  335. package/dist/workspace/calendar/calendar-views.d.ts +32 -0
  336. package/dist/workspace/calendar/calendar-views.js +124 -0
  337. package/dist/workspace/calendar/calendar-when.d.ts +14 -0
  338. package/dist/workspace/calendar/calendar-when.js +81 -0
  339. package/dist/workspace/calendar/mention-textarea.d.ts +19 -0
  340. package/dist/workspace/calendar/mention-textarea.js +84 -0
  341. package/dist/workspace/home/access-requests-bell.js +2 -1
  342. package/dist/workspace/inbox/workspace-inbox.d.ts +1 -1
  343. package/dist/workspace/inbox/workspace-inbox.js +1 -1
  344. package/dist/workspace/layout/project-files-view.js +2 -1
  345. package/dist/workspace/layout/project-home.js +2 -1
  346. package/dist/workspace/memory/memory-page-list.js +1 -1
  347. package/dist/workspace/new/workspace-handoff.js +2 -1
  348. package/dist/workspace/projects/modal/project-icon-field.js +2 -1
  349. package/dist/workspace/session-workspace.js +13 -12
  350. package/dist/workspace/setup/setup-banner.d.ts +4 -0
  351. package/dist/workspace/setup/setup-banner.js +57 -0
  352. package/dist/workspace/setup/setup-steps.d.ts +57 -0
  353. package/dist/workspace/setup/setup-steps.js +53 -0
  354. package/dist/workspace/setup/use-setup-steps.d.ts +18 -0
  355. package/dist/workspace/setup/use-setup-steps.js +57 -0
  356. package/dist/workspace/setup/workspace-setup-page.d.ts +10 -0
  357. package/dist/workspace/setup/workspace-setup-page.js +91 -0
  358. package/dist/workspace/sidebar/footer/project-artifacts-nav.js +5 -1
  359. package/dist/workspace/sidebar/footer/project-calendar-nav.d.ts +8 -0
  360. package/dist/workspace/sidebar/footer/project-calendar-nav.js +31 -0
  361. package/dist/workspace/sidebar/footer/project-chrome-nav.d.ts +14 -6
  362. package/dist/workspace/sidebar/footer/project-chrome-nav.js +37 -25
  363. package/dist/workspace/sidebar/footer/project-computer-nav.d.ts +17 -9
  364. package/dist/workspace/sidebar/footer/project-computer-nav.js +36 -26
  365. package/dist/workspace/sidebar/footer/project-download-app-nav.d.ts +7 -7
  366. package/dist/workspace/sidebar/footer/project-download-app-nav.js +25 -13
  367. package/dist/workspace/sidebar/footer/project-inbox-nav.d.ts +8 -0
  368. package/dist/workspace/sidebar/footer/project-inbox-nav.js +29 -0
  369. package/dist/workspace/sidebar/footer/project-manifest-issues-alert.d.ts +3 -13
  370. package/dist/workspace/sidebar/footer/project-manifest-issues-alert.js +6 -48
  371. package/dist/workspace/sidebar/footer/project-mcp-nav.d.ts +7 -7
  372. package/dist/workspace/sidebar/footer/project-mcp-nav.js +31 -13
  373. package/dist/workspace/sidebar/footer/project-phone-app-nav.d.ts +10 -0
  374. package/dist/workspace/sidebar/footer/project-phone-app-nav.js +61 -0
  375. package/dist/workspace/sidebar/footer/project-promo-cards.d.ts +21 -0
  376. package/dist/workspace/sidebar/footer/project-promo-cards.js +33 -0
  377. package/dist/workspace/sidebar/footer/promo-card.d.ts +41 -0
  378. package/dist/workspace/sidebar/footer/promo-card.js +47 -0
  379. package/dist/workspace/sidebar/footer/sandbox-health.js +1 -1
  380. package/dist/workspace/sidebar/project-nav-items.d.ts +3 -1
  381. package/dist/workspace/sidebar/project-nav-items.js +12 -4
  382. package/dist/workspace/sidebar/project-session-list.js +58 -26
  383. package/dist/workspace/sidebar/project-sidebar.js +2 -5
  384. package/dist/workspace/sidebar/project-spaces-nav.js +2 -1
  385. package/dist/workspace/sidebar/session-brief-hover-card.d.ts +24 -0
  386. package/dist/workspace/sidebar/session-brief-hover-card.js +4 -3
  387. package/dist/workspace/sidebar/session-group-sections.d.ts +26 -7
  388. package/dist/workspace/sidebar/session-group-sections.js +121 -41
  389. package/dist/workspace/sidebar/sidebar-drill.js +6 -0
  390. package/dist/workspace/sidebar/sidebar-more-group.js +3 -2
  391. package/dist/workspace/sidebar/use-workspace-list.d.ts +7 -0
  392. package/dist/workspace/sidebar/use-workspace-list.js +11 -1
  393. package/dist/workspace/sidebar/workspace-settings-sidebar-nav.d.ts +14 -0
  394. package/dist/workspace/sidebar/workspace-settings-sidebar-nav.js +46 -2
  395. package/dist/workspace/space/space-tab-panels.js +1 -1
  396. package/dist/workspace/spaces/space-timeline.js +2 -2
  397. package/package.json +67 -10
  398. package/skills/kortix-ui/SKILL.md +2 -2
  399. package/skills/kortix-ui/references/modules.md +5 -3
  400. package/dist/session/thread/turn-share.d.ts +0 -16
  401. package/dist/session/thread/turn-share.js +0 -161
  402. package/dist/workspace/sidebar/footer/promo-nav-row.d.ts +0 -11
  403. package/dist/workspace/sidebar/footer/promo-nav-row.js +0 -7
  404. /package/dist/markdown/{code/inline-chip.d.ts → inline-chip.d.ts} +0 -0
@@ -1,6 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { AnimatePresence, m, useReducedMotion } from 'motion/react';
3
+ import { AnimatePresence, m } from 'motion/react';
4
+ import { useReducedMotion } from '../../internal/hooks/use-reduced-motion.js';
4
5
  import { useEffect, useState } from 'react';
5
6
  import { SessionDotMatrix } from '../../primitives/dot-matrix/session-dot-matrix.js';
6
7
  import { TextShimmer } from '../../primitives/text-shimmer.js';
@@ -210,7 +210,7 @@ function TurnErrorCheckpoint({ text, gateway, raw, defaultOpen, action, modelOpt
210
210
  const suggestion = actionableSuggestion(gateway?.suggestion && gateway.suggestion !== text ? gateway.suggestion : undefined, modelOptions);
211
211
  const failures = gateway?.attemptFailures ?? [];
212
212
  const canOpen = describeTurnErrorRow({ text, gateway, raw }).expandable;
213
- const row = (_jsxs("div", { className: "flex w-full items-center gap-3 text-left text-sm", children: [_jsx(WarningCircleIcon, { className: "text-kortix-red size-4 flex-none" }), _jsx("span", { className: "text-foreground flex-none font-medium", children: tI18nComplete.raw('text1a4f630ac1b6') }), _jsx("span", { className: cn('text-muted-foreground min-w-0 wrap-anywhere', canOpen && 'group-hover/trigger:text-foreground duration-fast transition-colors'), children: text }), canOpen ? (_jsx(CaretRightIcon, { className: cn('text-muted-foreground size-3.5 flex-none', 'transition-transform group-data-[state=open]/step:rotate-90') })) : null] }));
213
+ const row = (_jsxs("div", { className: "w-full text-left text-sm", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx(WarningCircleIcon, { className: "text-kortix-red size-4 flex-none" }), _jsx("span", { className: "text-foreground flex-none font-medium", children: tI18nComplete.raw('text1a4f630ac1b6') }), canOpen ? (_jsx(CaretRightIcon, { className: cn('text-muted-foreground size-3.5 flex-none', 'transition-transform group-data-[state=open]/step:rotate-90') })) : null] }), _jsx("p", { className: cn('text-muted-foreground mt-1 pl-7 wrap-anywhere', canOpen && 'group-hover/trigger:text-foreground duration-fast transition-colors'), children: text })] }));
214
214
  const hint = suggestion ? (_jsx("p", { className: "text-muted-foreground mt-1 pl-7 text-xs text-pretty wrap-anywhere", children: suggestion })) : null;
215
215
  if (!canOpen) {
216
216
  return (_jsxs("div", { role: "alert", className: className, children: [row, hint, action] }));
@@ -7,6 +7,7 @@ import { cn } from '../../lib/utils.js';
7
7
  import { useIsSidePanelOpen } from '../../internal/stores/kortix-computer-store.js';
8
8
  import { MENU_PANEL } from '../../primitives/menu-recipe.js';
9
9
  import { DASH_ROW_HEIGHT, DASH_THICKNESS, RAIL_WIDTH, dashCenterY, dashOpacity, dashWidth, downsampleDashes, extractMinimapItem, nearestDashRow, } from './chat-minimap-items.js';
10
+ import { prefersReducedMotion } from '../../internal/hooks/use-reduced-motion.js';
10
11
  function MinimapCard({ item }) {
11
12
  const hasBody = item.segments.length > 0;
12
13
  return (_jsx("div", { className: cn(MENU_PANEL, 'w-64 rounded-md border px-3 py-2.5'), children: hasBody && (_jsx("p", { className: "text-muted-foreground line-clamp-3 text-xs leading-5", children: item.segments.map((segment, i) => segment.mention ? (_jsxs("span", { className: "text-foreground font-medium", children: [segment.mention === 'agent' ? (_jsx(CubeIcon, { className: "mr-1 inline size-3 align-[-0.15em]" })) : null, segment.text] }, i)) : (_jsx("span", { children: segment.text }, i))) })) }));
@@ -107,7 +108,7 @@ export function ChatMinimap({ turns, scrollRef, contentRef }) {
107
108
  scrollEl.getBoundingClientRect().top +
108
109
  scrollEl.scrollTop -
109
110
  24;
110
- const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
111
+ const reduceMotion = prefersReducedMotion();
111
112
  scrollEl.scrollTo({ top: Math.max(0, offset), behavior: reduceMotion ? 'auto' : 'smooth' });
112
113
  }, [contentRef, scrollRef]);
113
114
  if (items.length < 3 || sidePanelOpen)
@@ -46,5 +46,8 @@ export { SESSION_TRANSCRIPT_CLASS } from './session-transcript-class.js';
46
46
  * true, because that thread is what crossfades into `SessionChat`.
47
47
  */
48
48
  export function SessionBodyRow({ children, actionPanel = true, transient = false, }) {
49
- return (_jsxs("div", { className: "flex min-h-0 flex-1 overflow-hidden", children: [_jsx("div", { className: "relative flex min-w-0 flex-1 flex-col", children: children }), actionPanel && _jsx(SessionActionPanelColumn, { hotkey: !transient })] }));
49
+ return (
50
+ // `@container/session-body`: the action panel caps its width at half of
51
+ // this row (`50cqw`), so the chat always keeps the other half.
52
+ _jsxs("div", { className: "@container/session-body flex min-h-0 flex-1 overflow-hidden", children: [_jsx("div", { className: "relative flex min-w-0 flex-1 flex-col", "data-toast-anchor": "", children: children }), actionPanel && _jsx(SessionActionPanelColumn, { hotkey: !transient })] }));
50
53
  }
@@ -106,7 +106,7 @@ import { getRetryInfo } from '../../internal/session-types/index.js';
106
106
  import { useModelPricingLookup } from '../../internal/lib/model-pricing.js';
107
107
  import { isAbortError, latestPromptModel, SESSION_NOTICE, turnEndNotice } from '@kortix/sdk';
108
108
  import { failureShownByTurn, failureSupersededByTurn, persistedFailureText, } from './persisted-turn-failure.js';
109
- 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';
109
+ 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, useNetworkOnline, } from '@kortix/sdk/react';
110
110
  import { useStableCallback } from '../../internal/hooks/use-stable-callback.js';
111
111
  import { useReloadForensics } from '../status/reload-forensics.js';
112
112
  import { resolveLastTurnWorking, serverHoldsOpenTurn, sessionComposerReadiness, } from '../composer/session-composer-readiness.js';
@@ -734,6 +734,12 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
734
734
  * it — a refused send, Stop, and leaving the session.
735
735
  */
736
736
  const receiptSessionId = projectSessionId ?? '';
737
+ // The browser reports no network: a send waits for it (the SDK holds the
738
+ // POST), so it takes no receipt until it goes out, and the composer shows
739
+ // the offline line instead of a turn that never started (finding 07).
740
+ const networkOnline = useNetworkOnline();
741
+ const networkOnlineRef = useRef(networkOnline);
742
+ networkOnlineRef.current = networkOnline;
737
743
  const noteSendReceipt = useCallback((messageId, turnId = messageId) => useSessionWorkingStore
738
744
  .getState()
739
745
  .noteSendReceipt(receiptSessionId, { messageId, turnId, atMs: Date.now() }), [receiptSessionId]);
@@ -2653,7 +2659,12 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
2653
2659
  // The prompt is out of this tab's hands the moment the row lands, so the
2654
2660
  // receipt is taken BEFORE the POST: it is what holds the composer on
2655
2661
  // "working" until `GET .../turn` reports the turn the inbox admitted.
2656
- noteSendReceipt(messageID, receiptTurnId);
2662
+ // Offline: no receipt yet. The POST waits for the network; the receipt is
2663
+ // taken when the server has the prompt, so no Thinking row stands for a
2664
+ // send that has not left the page.
2665
+ const heldOffline = !networkOnlineRef.current;
2666
+ if (!heldOffline)
2667
+ noteSendReceipt(messageID, receiptTurnId);
2657
2668
  const result = await (async () => {
2658
2669
  try {
2659
2670
  if (!projectId || !projectSessionId) {
@@ -2692,6 +2703,8 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
2692
2703
  // for it. `useSessionPrompts` raises the inbox floor at the same
2693
2704
  // moment, which is what covers the window before the row is
2694
2705
  // delivered and becomes a turn.
2706
+ if (heldOffline)
2707
+ noteSendReceipt(messageID, receiptTurnId);
2695
2708
  acceptSendReceipt(messageID);
2696
2709
  attachments?.release();
2697
2710
  // The durable row now carries this prompt, so the tab-local draft
@@ -2705,6 +2718,8 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
2705
2718
  // Resolve that verdict before the composer can restore its draft:
2706
2719
  // recoverFromSendFailure checks asynchronously and returns an error now.
2707
2720
  if (!keepsPainted && (await inboxRowExists().catch(() => false))) {
2721
+ if (heldOffline)
2722
+ noteSendReceipt(messageID, receiptTurnId);
2708
2723
  acceptSendReceipt(messageID);
2709
2724
  attachments?.release();
2710
2725
  if (!paintTranscript)
@@ -3979,7 +3994,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
3979
3994
  transform: 'translate(-50%, -100%)',
3980
3995
  }, 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
3981
3996
  ? 'duration-normal scale-100 opacity-100'
3982
- : '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
3997
+ : '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: [!networkOnline && (_jsx("div", { className: cn(COMPOSER_SHELL_CLASS, 'pb-1.5'), children: _jsx("p", { role: "status", "aria-live": "polite", className: "text-muted-foreground text-xs", children: tQueue('offlineReconnecting') }) })), _jsx(SessionChatInput
3983
3998
  // `undefined`, not `true`, once released: the composer's own
3984
3999
  // viewport rule (>= 640px) still decides, so this never forces
3985
4000
  // focus onto a phone keyboard.
@@ -6,7 +6,7 @@ import type { UiTranslator } from '../../i18n/index.js';
6
6
  * the whole set from one clock read rather than each row racing its own.
7
7
  */
8
8
  import type { TurnCostInfo } from '../../internal/session-types/index.js';
9
- import type { SessionLogTurn } from '@kortix/sdk';
9
+ import { type SessionLogTurn } from '@kortix/sdk';
10
10
  import type { TurnServedModel } from '../turn/served-model.js';
11
11
  export interface SessionTurnSpan {
12
12
  startedAt: number | null;
@@ -19,10 +19,18 @@ export interface SessionTurnSpan {
19
19
  * interrupted before finishing). */
20
20
  export declare function sessionTurnSpan(turn: Pick<SessionLogTurn, 'user' | 'assistant'>): SessionTurnSpan;
21
21
  export declare function sessionTurnEndedAt(turn: Pick<SessionLogTurn, 'user' | 'assistant'>): number | null;
22
- /** How long the turn took. `null` whenever that isn't knowable, INCLUDING
23
- * `endedAt === startedAt`: one timestamp says WHEN a turn ended and says
24
- * nothing about how long it took to get there, so a same-instant span is
25
- * treated the same as no span at all rather than rendered as "0s". */
22
+ /**
23
+ * How long the turn waited for the person: each answered question's
24
+ * open→answered interval (a `question` call's `started_at` → `ended_at`), and
25
+ * each workflow approval (the run document's `approvalWaitMs`). Waiting is
26
+ * not work, so "Worked for" leaves it out. 0 for a turn that asked nothing.
27
+ */
28
+ export declare function sessionTurnWaitMs(turn: Pick<SessionLogTurn, 'assistant'>): number;
29
+ /** How long the turn took, its waits for the person left out (`sessionTurnWaitMs`).
30
+ * `null` whenever that isn't knowable, INCLUDING `endedAt === startedAt`: one
31
+ * timestamp says WHEN a turn ended and says nothing about how long it took to
32
+ * get there, so a same-instant span is treated the same as no span at all
33
+ * rather than rendered as "0s". */
26
34
  export declare function sessionTurnDurationMs(turn: Pick<SessionLogTurn, 'user' | 'assistant'>): number | null;
27
35
  export interface SessionTurnMetaRow {
28
36
  label: string;
@@ -1,4 +1,5 @@
1
1
  import { formatDuration, formatTokens } from '../../internal/session-types/index.js';
2
+ import { isQuestionTool, isWorkflowTool, parseWorkflowRun, toolCallMetadata } from '@kortix/sdk';
2
3
  import { formatUsdAsCredits } from '../../_vendor/kortix-shared.js';
3
4
  import { formatDistanceStrict } from 'date-fns';
4
5
  /** A record time (`created_at` / `completed_at`, ISO) as epoch ms; null when absent. */
@@ -20,15 +21,42 @@ export function sessionTurnSpan(turn) {
20
21
  export function sessionTurnEndedAt(turn) {
21
22
  return sessionTurnSpan(turn).endedAt;
22
23
  }
23
- /** How long the turn took. `null` whenever that isn't knowable, INCLUDING
24
- * `endedAt === startedAt`: one timestamp says WHEN a turn ended and says
25
- * nothing about how long it took to get there, so a same-instant span is
26
- * treated the same as no span at all rather than rendered as "0s". */
24
+ /**
25
+ * How long the turn waited for the person: each answered question's
26
+ * open→answered interval (a `question` call's `started_at` → `ended_at`), and
27
+ * each workflow approval (the run document's `approvalWaitMs`). Waiting is
28
+ * not work, so "Worked for" leaves it out. 0 for a turn that asked nothing.
29
+ */
30
+ export function sessionTurnWaitMs(turn) {
31
+ let wait = 0;
32
+ for (const message of turn.assistant) {
33
+ for (const block of message.blocks ?? []) {
34
+ if (block.type !== 'tool_call')
35
+ continue;
36
+ if (isQuestionTool(block.name)) {
37
+ const start = msOf(block.started_at);
38
+ const end = msOf(block.ended_at);
39
+ if (start != null && end != null && end > start)
40
+ wait += end - start;
41
+ }
42
+ else if (isWorkflowTool(block.name)) {
43
+ wait += parseWorkflowRun(toolCallMetadata(block))?.approvalWaitMs ?? 0;
44
+ }
45
+ }
46
+ }
47
+ return wait;
48
+ }
49
+ /** How long the turn took, its waits for the person left out (`sessionTurnWaitMs`).
50
+ * `null` whenever that isn't knowable, INCLUDING `endedAt === startedAt`: one
51
+ * timestamp says WHEN a turn ended and says nothing about how long it took to
52
+ * get there, so a same-instant span is treated the same as no span at all
53
+ * rather than rendered as "0s". */
27
54
  export function sessionTurnDurationMs(turn) {
28
55
  const { startedAt, endedAt } = sessionTurnSpan(turn);
29
56
  if (startedAt == null || endedAt == null || endedAt <= startedAt)
30
57
  return null;
31
- return endedAt - startedAt;
58
+ const worked = endedAt - startedAt - sessionTurnWaitMs(turn);
59
+ return worked > 0 ? worked : null;
32
60
  }
33
61
  /**
34
62
  * The turn's meta as labelled rows, in display order. A row is omitted
@@ -87,8 +87,7 @@ interface SessionTurnProps {
87
87
  isLast: boolean;
88
88
  ownsPlan: boolean;
89
89
  sessionId: string;
90
- /** The Kortix project and project-session ids. With both, a settled turn
91
- * offers Share (`TurnShareButton`). Absent (a child session): no Share. */
90
+ /** The Kortix project and project-session ids. */
92
91
  projectId?: string;
93
92
  projectSessionId?: string;
94
93
  sessionStatus: import('../../internal/session-types/index.js').SessionStatus | undefined;
@@ -49,7 +49,6 @@ import { showTurnBusyIndicator } from '@kortix/sdk';
49
49
  import { SessionBusyIndicator } from '../status/session-busy-indicator.js';
50
50
  import { useAnswerStreaming } from '../turn/answer-streaming.js';
51
51
  import { SessionTurnMeta } from './session-turn-meta.js';
52
- import { TurnShareButton } from './turn-share.js';
53
52
  import { sessionTurnDurationMs, sessionTurnEndedAt, sessionTurnSpan, } from './session-turn-meta-rows.js';
54
53
  import { Button } from '../../primitives/button.js';
55
54
  import { Disclosure, DisclosureContent, DisclosureTrigger } from '../../primitives/disclosure.js';
@@ -71,7 +70,7 @@ import { extractKortixSystemMessages, extractSessionReport, stripKortixSystemTag
71
70
  import { Copy } from '../../icons/copy.js';
72
71
  import { extractGatewayErrorDetails, formatDuration, getPermissionForTool, getRetryInfo, getRetryMessage, shouldShowToolPart, } from '../../internal/session-types/index.js';
73
72
  import { isAbortError, turnEndNotice, } from '@kortix/sdk';
74
- import { isOptimisticSessionPrompt, useRuntimeReady, useSessionPrompts } from '@kortix/sdk/react';
73
+ import { isOptimisticSessionPrompt, useRuntimeReady, useSessionPrompts, useSessionUnsentPrompts } from '@kortix/sdk/react';
75
74
  import { CodeBlockEndpoints, SandboxUrlDetector } from '../media/sandbox-url-detector.js';
76
75
  import { HarnessSwitchMarker, RestoreNoteMarker, TurnFullText } from './session-history.js';
77
76
  /** The agent whose mark stands in when a row does not name its agent. */
@@ -431,7 +430,11 @@ function isStepBlock(block) {
431
430
  }
432
431
  /** The queue tone of the turn's user bubble: interrupted, queued, held or
433
432
  * sending — what the dimmed bubble and its status chip render. */
434
- function useTurnQueueTone({ pending, pendingPrompt, interruptedBeforeRun, }) {
433
+ function useTurnQueueTone({ pending, pendingPrompt, interruptedBeforeRun, sessionId, projectSessionId, }) {
434
+ // A prompt sent while offline: its POST waits for the network, so it is not
435
+ // "sending" yet (finding 07). The SDK keys unsent sends by the project session
436
+ // (the id the prompt was posted to), not the runtime `ses_…` id of the turn.
437
+ const unsentIds = useSessionUnsentPrompts(projectSessionId ?? sessionId);
435
438
  // A Stop ended the turn before a step opened under this message, or the
436
439
  // prompt still waits for delivery. Both keep the queue tone on the bubble;
437
440
  // only a delivery failure adds text.
@@ -444,9 +447,14 @@ function useTurnQueueTone({ pending, pendingPrompt, interruptedBeforeRun, }) {
444
447
  : pendingPrompt?.reason === 'held'
445
448
  ? 'held'
446
449
  : pendingPrompt &&
447
- (isOptimisticSessionPrompt(pendingPrompt) || pendingPrompt.state === 'delivering')
448
- ? 'sending'
449
- : statusState;
450
+ isOptimisticSessionPrompt(pendingPrompt) &&
451
+ // The SDK lists a held send by its wire message id, else its client id.
452
+ unsentIds.includes(pendingPrompt.message_id ?? pendingPrompt.client_message_id)
453
+ ? 'unsent'
454
+ : pendingPrompt &&
455
+ (isOptimisticSessionPrompt(pendingPrompt) || pendingPrompt.state === 'delivering')
456
+ ? 'sending'
457
+ : statusState;
450
458
  return { queueState, statusState, queuedStatus };
451
459
  }
452
460
  /** Everything the turn's error row shows: the error text, whether it is an
@@ -1083,7 +1091,7 @@ function TurnUserBubble(props) {
1083
1091
  ? () => onRetryQueued(pendingPrompt.prompt_id)
1084
1092
  : undefined, onRemove: pendingPrompt && onRemoveQueued && promptActions.removable
1085
1093
  ? () => onRemoveQueued(pendingPrompt.prompt_id)
1086
- : undefined })) : queuedStatus === 'sending' || queuedStatus === 'queued' || queuedStatus === 'interrupted' ? (_jsx(QueuedPromptProgress, { state: queuedStatus })) : undefined }) })) }));
1094
+ : undefined })) : queuedStatus === 'sending' || queuedStatus === 'queued' || queuedStatus === 'interrupted' || queuedStatus === 'unsent' ? (_jsx(QueuedPromptProgress, { state: queuedStatus })) : undefined }) })) }));
1087
1095
  }
1088
1096
  /** One shared empty set: a live turn has no recovered calls yet. */
1089
1097
  const NO_RECOVERED_CALLS = new Set();
@@ -1353,16 +1361,7 @@ function TurnFooter(props) {
1353
1361
  const { turnEndedAt, turnDurationMs, costInfo } = meta;
1354
1362
  return (_jsxs(_Fragment, { children: [_jsx(TurnBusyRow, { ...props, working: working, turnError: turnError, tHardcodedUi: tHardcodedUi, hasText: model.response.trim() !== '', openText: model.openText?.block.text }), turnErrorRow.text && !turn.autoRetry?.continued && (
1355
1363
  // A space's thread (messages only): one calm line with Retry; a stop has its own "Stopped" line.
1356
- props.quietBusy ? (turnErrorRow.isAbort ? null : (_jsx(TurnFailedLine, { projectId: projectId, projectSessionId: projectSessionId, turn: turn, errorText: turnErrorRow.text }))) : (_jsx(TurnErrorDisplay, { errorText: turnErrorRow.text, errorDetails: turnErrorRowDetails, errorRaw: turnErrorRaw, isAbort: turnErrorRow.isAbort, modelOptions: modelOptions }))), turnErrorRow.text && !turnErrorRow.isAbort && !turn.autoRetry?.continued && !!turn.autoRetry?.retries && (_jsx(TurnAutoRetryNote, { count: turn.autoRetry.retries })), !working && !turn.autoRetry?.continued && (stoppedBy || errors.turnErrorIsAbort) && _jsx(TurnStoppedBy, { name: stoppedBy ?? undefined }), !working && _jsx(TurnOutcomes, { turnKey: turn.id }), !working && !props.hideActionBar && hasCopyableResponse(response, answered.inlineContentParts) && (_jsx(TurnActionBar, { response: response, inlineContentParts: answered.inlineContentParts, turnEndedAt: turnEndedAt, turnDurationMs: turnDurationMs, costInfo: costInfo, servedModel: servedModel, tHardcodedUi: tHardcodedUi,
1357
- // A continuation turn's id names a compaction marker, not a user
1358
- // message, so it has no response of its own to share.
1359
- share: turn.continues
1360
- ? undefined
1361
- : {
1362
- projectId,
1363
- sessionId: projectSessionId,
1364
- turnId: turn.id,
1365
- } })), _jsx(ConnectProviderDialog, { open: connectProviderOpen, onOpenChange: onConnectProviderOpenChange, providers: providers })] }));
1364
+ props.quietBusy ? (turnErrorRow.isAbort ? null : (_jsx(TurnFailedLine, { projectId: projectId, projectSessionId: projectSessionId, turn: turn, errorText: turnErrorRow.text }))) : (_jsx(TurnErrorDisplay, { errorText: turnErrorRow.text, errorDetails: turnErrorRowDetails, errorRaw: turnErrorRaw, isAbort: turnErrorRow.isAbort, modelOptions: modelOptions }))), turnErrorRow.text && !turnErrorRow.isAbort && !turn.autoRetry?.continued && !!turn.autoRetry?.retries && (_jsx(TurnAutoRetryNote, { count: turn.autoRetry.retries })), !working && !turn.autoRetry?.continued && (stoppedBy || errors.turnErrorIsAbort) && _jsx(TurnStoppedBy, { name: stoppedBy ?? undefined }), !working && _jsx(TurnOutcomes, { turnKey: turn.id }), !working && !props.hideActionBar && hasCopyableResponse(response, answered.inlineContentParts) && (_jsx(TurnActionBar, { response: response, inlineContentParts: answered.inlineContentParts, turnEndedAt: turnEndedAt, turnDurationMs: turnDurationMs, costInfo: costInfo, servedModel: servedModel, tHardcodedUi: tHardcodedUi })), _jsx(ConnectProviderDialog, { open: connectProviderOpen, onOpenChange: onConnectProviderOpenChange, providers: providers })] }));
1366
1365
  }
1367
1366
  /**
1368
1367
  * A failed turn in a messages-only thread: "Something went wrong · Retry".
@@ -1418,7 +1417,7 @@ function hasCopyableResponse(response, inlineContentParts) {
1418
1417
  return true;
1419
1418
  return !!inlineContentParts?.some((item) => item.type === 'text' && item.block.text.trim());
1420
1419
  }
1421
- function TurnActionBar({ response, inlineContentParts, turnEndedAt, turnDurationMs, costInfo, servedModel, tHardcodedUi, inToolbar = false, share, }) {
1420
+ function TurnActionBar({ response, inlineContentParts, turnEndedAt, turnDurationMs, costInfo, servedModel, tHardcodedUi, inToolbar = false, }) {
1422
1421
  const [copied, setCopied] = useState(false);
1423
1422
  // ---- Copy response ----
1424
1423
  const handleCopy = async () => {
@@ -1444,8 +1443,13 @@ function TurnActionBar({ response, inlineContentParts, turnEndedAt, turnDuration
1444
1443
  // The browser refused the write; `copied` stays false.
1445
1444
  }
1446
1445
  };
1447
- return (_jsxs("div", { className: cn('flex items-center gap-0.5', !inToolbar &&
1448
- 'duration-normal opacity-0 transition-opacity group-hover/turn:opacity-100 focus-within:opacity-100 has-[[data-state=open]]:opacity-100 max-md:opacity-100'), children: [response ? (_jsx(Button, { variant: "ghost", size: "icon-sm", onClick: handleCopy, "aria-label": copied ? 'Copied' : tHardcodedUi.raw('i18nComplete.textf0f755afea88'), className: "hit-area-3", children: _jsx("span", { className: "relative inline-flex shrink-0 items-center justify-center", children: _jsx(AnimatePresence, { initial: false, mode: "popLayout", children: _jsx(m.span, { initial: { scale: 0.25, opacity: 0, filter: 'blur(4px)' }, animate: { scale: 1, opacity: 1, filter: 'blur(0px)' }, exit: { scale: 0.25, opacity: 0, filter: 'blur(4px)' }, transition: { type: 'spring', duration: 0.3, bounce: 0 }, className: "absolute inset-0 inline-flex items-center justify-center", children: copied ? (_jsx(CheckIcon, { className: cn('text-muted-foreground', inToolbar ? 'size-3.5' : 'size-[1.05rem]') })) : (_jsx(Copy, { className: cn('text-muted-foreground', inToolbar ? 'size-3.5' : 'size-[1.05rem]') })) }, copied ? 'check' : 'copy') }) }) })) : null, response && share ? (_jsx(TurnShareButton, { projectId: share.projectId, sessionId: share.sessionId, turnId: share.turnId })) : null, _jsx(SessionTurnMeta, { endedAt: turnEndedAt, durationMs: turnDurationMs, cost: costInfo, served: servedModel,
1446
+ return (_jsxs("div", { className: cn('flex items-center gap-0.5',
1447
+ // Under the answer, the first glyph sits on the text's left edge: each
1448
+ // icon is centred in a `size-7` button, so pull the row left by the
1449
+ // glyph's inset, (button − 1.05rem icon) / 2 ≈ 4.5px.
1450
+ !inToolbar && '-ml-[calc((var(--spacing)*7-1.05rem)/2)]', // audit:allow optical alignment: icon inset inside its hit area
1451
+ !inToolbar &&
1452
+ 'duration-normal opacity-0 transition-opacity group-hover/turn:opacity-100 focus-within:opacity-100 has-[[data-state=open]]:opacity-100 max-md:opacity-100'), children: [response ? (_jsx(Button, { variant: "ghost", size: "icon-sm", onClick: handleCopy, "aria-label": copied ? 'Copied' : tHardcodedUi.raw('i18nComplete.textf0f755afea88'), className: "hit-area-3", children: _jsx("span", { className: "relative inline-flex shrink-0 items-center justify-center", children: _jsx(AnimatePresence, { initial: false, mode: "popLayout", children: _jsx(m.span, { initial: { scale: 0.25, opacity: 0, filter: 'blur(4px)' }, animate: { scale: 1, opacity: 1, filter: 'blur(0px)' }, exit: { scale: 0.25, opacity: 0, filter: 'blur(4px)' }, transition: { type: 'spring', duration: 0.3, bounce: 0 }, className: "absolute inset-0 inline-flex items-center justify-center", children: copied ? (_jsx(CheckIcon, { className: cn('text-muted-foreground', inToolbar ? 'size-3.5' : 'size-[1.05rem]') })) : (_jsx(Copy, { className: cn('text-muted-foreground', inToolbar ? 'size-3.5' : 'size-[1.05rem]') })) }, copied ? 'check' : 'copy') }) }) })) : null, _jsx(SessionTurnMeta, { endedAt: turnEndedAt, durationMs: turnDurationMs, cost: costInfo, served: servedModel,
1449
1453
  // `icon-sm`, the same as the copy button beside it; in a row's
1450
1454
  // toolbar its dots match the 14px icons of the toolbar.
1451
1455
  className: cn('flex items-center justify-center', inToolbar && '[&_svg]:size-4!') })] }));
@@ -1473,7 +1477,7 @@ function SessionTurnImpl(props) {
1473
1477
  // as every `panelMode` read site).
1474
1478
  const conversationDensity = useUserPreferencesStore((s) => s.preferences.conversationDensity ?? 'normal');
1475
1479
  const model = useTurnModelState({ turn, isWorkingTurn, sessionWorking, awaitingUser });
1476
- const queueTone = useTurnQueueTone({ pending, pendingPrompt, interruptedBeforeRun });
1480
+ const queueTone = useTurnQueueTone({ pending, pendingPrompt, interruptedBeforeRun, sessionId, projectSessionId: props.projectSessionId });
1477
1481
  const errors = useTurnErrorState({ turn, turnOutcome });
1478
1482
  const answered = useAnsweredQuestionState({ turn, questions, sessionId, blocks: model.blocks, hasSteps: model.hasSteps });
1479
1483
  const userContent = useTurnUserContent({ turn, commandMessages, commands });
@@ -1615,9 +1619,7 @@ function SessionTurnImpl(props) {
1615
1619
  // A space's thread keys the colour on the user id, as the space's timeline does.
1616
1620
  colorKey: userAuthor?.kind === 'person' ? userAuthor.userId : null, size: "lg" })), 'avatar'), name: wrap(userAuthor, sender ?? (spacePost ? userContent.peerMessage.from : personName || rows.unknownAuthor)), time: rowTime(userAt, locale), children: messagesOnly && spacePost ? (
1617
1621
  // The agent's post as its own words, without the "Message from" frame.
1618
- _jsx("p", { className: cn(MESSAGE_TEXT_CLASS, 'text-pretty whitespace-pre-wrap wrap-anywhere'), children: userContent.peerMessage.text })) : messagesOnly ? (_jsx(TurnUserBubble, { ...props, queueTone: queueTone, userContent: userContent })) : (_jsx(TurnUserBlock, { ...props, model: model, queueTone: queueTone, userContent: userContent })) })) : null, props.isFirstTurn ? afterFirstPrompt : null, showAnswer ? (_jsx(MessageRow, { className: "group/turn", avatar: wrap(agentAuthor, _jsx(AgentMark, { slug: rows.agentSlug ?? DEFAULT_AGENT_SLUG, size: 28, tile: 36, label: rows.agent }), 'avatar'), name: wrap(agentAuthor, rows.agent), time: rowTime(answerAt, locale), toolbar: model.working ? null : (_jsx(TurnActionBar, { inToolbar: true, response: model.response, inlineContentParts: answered.inlineContentParts, turnEndedAt: meta.turnEndedAt, turnDurationMs: meta.turnDurationMs, costInfo: meta.costInfo, servedModel: props.servedModel, tHardcodedUi: tHardcodedUi, share: turn.continues
1619
- ? undefined
1620
- : { projectId: props.projectId, sessionId: props.projectSessionId, turnId: turn.id } })), children: _jsxs("div", { className: "mt-0.5 space-y-2.5", children: [messagesOnly ? null : _jsx(TurnFallbackRows, { working: model.working, events: props.servedModel?.fallbacks }), _jsxs(GenuiTelemetryContext.Provider, { value: genuiTelemetry, children: [messagesOnly && !model.hasSteps && shownSegments.every((segment) => segment.kind === 'text') ? null : (_jsx(TurnToolBlocks, { ...props, model: model, segments: shownSegments, conversationDensity: conversationDensity,
1622
+ _jsx("p", { className: cn(MESSAGE_TEXT_CLASS, 'text-pretty whitespace-pre-wrap wrap-anywhere'), children: userContent.peerMessage.text })) : messagesOnly ? (_jsx(TurnUserBubble, { ...props, queueTone: queueTone, userContent: userContent })) : (_jsx(TurnUserBlock, { ...props, model: model, queueTone: queueTone, userContent: userContent })) })) : null, props.isFirstTurn ? afterFirstPrompt : null, showAnswer ? (_jsx(MessageRow, { className: "group/turn", avatar: wrap(agentAuthor, _jsx(AgentMark, { slug: rows.agentSlug ?? DEFAULT_AGENT_SLUG, size: 28, tile: 36, label: rows.agent }), 'avatar'), name: wrap(agentAuthor, rows.agent), time: rowTime(answerAt, locale), toolbar: model.working ? null : (_jsx(TurnActionBar, { inToolbar: true, response: model.response, inlineContentParts: answered.inlineContentParts, turnEndedAt: meta.turnEndedAt, turnDurationMs: meta.turnDurationMs, costInfo: meta.costInfo, servedModel: props.servedModel, tHardcodedUi: tHardcodedUi })), children: _jsxs("div", { className: "mt-0.5 space-y-2.5", children: [messagesOnly ? null : _jsx(TurnFallbackRows, { working: model.working, events: props.servedModel?.fallbacks }), _jsxs(GenuiTelemetryContext.Provider, { value: genuiTelemetry, children: [messagesOnly && !model.hasSteps && shownSegments.every((segment) => segment.kind === 'text') ? null : (_jsx(TurnToolBlocks, { ...props, model: model, segments: shownSegments, conversationDensity: conversationDensity,
1621
1623
  // The segments are already the message's: nothing is left to fold.
1622
1624
  fold: !messagesOnly && !answered.shouldUseInlineContent, durationMs: meta.turnDurationMs })), _jsx(TurnAssistantBlock, { ...props, model: model, answered: answered, userContent: userContent, tHardcodedUi: tHardcodedUi })] }), messagesOnly && !model.working && errors.turnErrorIsAbort && model.response.trim() === '' && shownSegments.length === 0 ? (_jsx("p", { className: "text-muted-foreground text-sm", children: tTurnRows('stopped') })) : null, _jsx(TurnFooter, { ...props, hideActionBar: true, quietBusy: messagesOnly, model: model, errors: errors, answered: answered, status: status, retry: retry, meta: meta, tHardcodedUi: tHardcodedUi, connectProviderOpen: connectProviderOpen, onConnectProviderOpenChange: setConnectProviderOpen }), messagesOnly && !model.working ? (_jsx(TurnMessageWork, { ...props, model: model, segments: segments, shown: shownSegments, userContent: userContent, conversationDensity: conversationDensity, front: rows.front === true })) : null] }) })) : null] }));
1623
1625
  }
@@ -3,8 +3,8 @@ export declare function useElapsedLabel(sinceIso: string | null | undefined, for
3
3
  /**
4
4
  * The agent's busy line in a messages-only thread (`TranscriptRows.messagesOnly`):
5
5
  * three dots that pulse one after another under the agent's name, the way a
6
- * person's chat reads; "Kortix is typing…" is only its accessible label. It never names a tool or a step. Opacity only, so the
7
- * reduced-motion variant is the same animation (`kortix-brand` motion.md).
6
+ * person's chat reads; "Kortix is typing…" is only its accessible label. It never names a tool or a step. Opacity only
7
+ * (`kortix-brand` motion.md); the "Reduce motion" switch holds the dots still.
8
8
  * The offset between dots is a loader's wave, not an entrance stagger: it
9
9
  * delays no content, and the three dots read as one moving thing.
10
10
  */
@@ -4,6 +4,7 @@ import { m } from 'motion/react';
4
4
  import { useEffect, useState } from 'react';
5
5
  import { useTranslations } from '../../i18n/index.js';
6
6
  import { cn } from '../../lib/utils.js';
7
+ import { useReduceMotionActive } from '../../internal/hooks/use-reduced-motion.js';
7
8
  /** The clock of a wait since `sinceIso` ("0:42"), ticking each second; null without a start. */
8
9
  export function useElapsedLabel(sinceIso, format) {
9
10
  const since = sinceIso ? Date.parse(sinceIso) : NaN;
@@ -22,13 +23,17 @@ const DOTS = [0, 1, 2];
22
23
  /**
23
24
  * The agent's busy line in a messages-only thread (`TranscriptRows.messagesOnly`):
24
25
  * three dots that pulse one after another under the agent's name, the way a
25
- * person's chat reads; "Kortix is typing…" is only its accessible label. It never names a tool or a step. Opacity only, so the
26
- * reduced-motion variant is the same animation (`kortix-brand` motion.md).
26
+ * person's chat reads; "Kortix is typing…" is only its accessible label. It never names a tool or a step. Opacity only
27
+ * (`kortix-brand` motion.md); the "Reduce motion" switch holds the dots still.
27
28
  * The offset between dots is a loader's wave, not an entrance stagger: it
28
29
  * delays no content, and the three dots read as one moving thing.
29
30
  */
30
31
  export function TypingIndicator({ name, className, detail, detailDelayMs = 0, }) {
31
32
  const t = useTranslations('sessionUi.turn');
33
+ // An infinite Motion loop already running ignores `skipAnimations`, so the
34
+ // "Reduce motion" switch stops the dots here, held at a mid opacity. The OS
35
+ // setting alone keeps the pulse: it is opacity only (`kortix-brand` motion.md).
36
+ const reduceMotion = useReduceMotionActive();
32
37
  const label = t('typing', { name });
33
38
  const [late, setLate] = useState(detailDelayMs <= 0);
34
39
  useEffect(() => {
@@ -40,7 +45,9 @@ export function TypingIndicator({ name, className, detail, detailDelayMs = 0, })
40
45
  const shownDetail = detail && late ? detail : null;
41
46
  return (
42
47
  // Three dots under the name the row already shows: the label is for screen readers only.
43
- _jsxs("div", { role: "status", "aria-live": "polite", "aria-label": label, "data-testid": "typing-indicator", className: cn('flex h-6 items-center', className), children: [_jsx("span", { "aria-hidden": true, className: "flex items-center gap-1", children: DOTS.map((dot) => (_jsx(m.span, { className: "bg-muted-foreground size-1 rounded-full", initial: { opacity: 0.3 }, animate: { opacity: [0.3, 1, 0.3] }, transition: { duration: DOT_CYCLE_S, repeat: Infinity, ease: 'easeInOut', delay: (dot * DOT_CYCLE_S) / 3 } }, dot))) }), shownDetail ? (
48
+ _jsxs("div", { role: "status", "aria-live": "polite", "aria-label": label, "data-testid": "typing-indicator", className: cn('flex h-6 items-center', className), children: [_jsx("span", { "aria-hidden": true, className: "flex items-center gap-1", children: DOTS.map((dot) => (_jsx(m.span, { className: "bg-muted-foreground size-1 rounded-full", initial: { opacity: 0.3 }, animate: reduceMotion ? { opacity: 0.6 } : { opacity: [0.3, 1, 0.3] }, transition: reduceMotion
49
+ ? { duration: 0 }
50
+ : { duration: DOT_CYCLE_S, repeat: Infinity, ease: 'easeInOut', delay: (dot * DOT_CYCLE_S) / 3 } }, dot))) }), shownDetail ? (
44
51
  // Plain text, no motion: it changes once a second while the clock runs.
45
52
  _jsx("span", { className: "text-muted-foreground ml-2 text-xs tabular-nums", children: shownDetail })) : null] }));
46
53
  }
@@ -8,7 +8,7 @@ import { SubAgentActivity, SubAgentStatusBanner, useSubAgentThread, } from '../s
8
8
  import { useTranslations } from '../../../i18n/index.js';
9
9
  import { cn } from '../../../lib/utils.js';
10
10
  import { getChildSessionId, getToolInfo } from '../../../internal/session-types/index.js';
11
- import { capitalizeWords } from '../../../_vendor/kortix-shared.js';
11
+ import { agentDisplayName } from '../../../_vendor/kortix-shared.js';
12
12
  import { CpuIcon as Cpu, ArrowSquareOutIcon as ExternalLink } from '@phosphor-icons/react';
13
13
  import { useSessionIds } from '../../../providers/session-ids.js';
14
14
  import { useUiLink } from '../../../providers/ui-provider.js';
@@ -23,8 +23,8 @@ export function SessionSpawnTool({ call, forceOpen }) {
23
23
  const Link = useUiLink();
24
24
  // Tool input is the model's JSON (`unknown` at runtime): read each field by
25
25
  // type, so a non-string takes the absent-field fallback instead of throwing
26
- // in `capitalizeWords` or `split` (KRTX-4511).
27
- const agentName = capitalizeWords((typeof input.agent === 'string' && input.agent) || 'kortix');
26
+ // in `agentDisplayName` or `split` (KRTX-4511).
27
+ const agentName = agentDisplayName((typeof input.agent === 'string' && input.agent) || 'kortix');
28
28
  const description = typeof input.description === 'string' ? input.description : '';
29
29
  const projectName = typeof input.project === 'string' ? input.project : '';
30
30
  const fullPrompt = typeof input.prompt === 'string' ? input.prompt : '';
@@ -1,12 +1,22 @@
1
1
  import { type ReactNode } from 'react';
2
2
  import { type AgentStopState } from './workflow-progress.js';
3
3
  import { type WorkflowRun, type WorkflowRunAgent } from './workflow-run.js';
4
- export declare function WorkflowRunCard({ run, title, subtitle, live, now, actions, chips, result, onOpen, stop, }: {
4
+ /** A working agent whose session log has not changed for this long reads "Quiet for N min". */
5
+ export declare const QUIET_AFTER_MS: number;
6
+ /** How long a working agent has written nothing, in ms, once that is {@link QUIET_AFTER_MS} or more; else null. */
7
+ export declare function quietForMs(agent: WorkflowRunAgent, now: number): number | null;
8
+ /** The working agents that have been quiet that long: the run header counts them. */
9
+ export declare function quietAgents(agents: readonly WorkflowRunAgent[], now: number): number;
10
+ export declare function WorkflowRunCard({ run, title, subtitle, meta, live, now, actions, chips, result, onOpen, stop, bare, }: {
5
11
  run: WorkflowRun;
6
12
  title: string;
7
13
  subtitle?: string;
14
+ /** Inline after the subtitle, on its line: "· Spent N credits". Never in the actions, which must not squeeze the title. */
15
+ meta?: ReactNode;
8
16
  live: boolean;
9
17
  now: number;
18
+ /** The header alone, muted: a run that never ran (declined at its approval) has no rows. */
19
+ bare?: boolean;
10
20
  /** The header's words on the right: Pause, Stop, Open run. */
11
21
  actions?: ReactNode;
12
22
  /** Warnings beside the title: "Large workflow", "Resumed". */
@@ -31,14 +31,29 @@ const ORDER = { failed: 0, running: 1, starting: 2, stopped: 3, done: 4 };
31
31
  /** A run longer than this lists its first rows and a "Show all". */
32
32
  const CAP_FROM = 25;
33
33
  const CAP = 20;
34
- export function WorkflowRunCard({ run, title, subtitle, live, now, actions, chips, result, onOpen, stop, }) {
34
+ /** A working agent whose session log has not changed for this long reads "Quiet for N min". */
35
+ export const QUIET_AFTER_MS = 2 * 60_000;
36
+ /** How long a working agent has written nothing, in ms, once that is {@link QUIET_AFTER_MS} or more; else null. */
37
+ export function quietForMs(agent, now) {
38
+ if ((agent.status !== 'running' && agent.status !== 'starting') || agent.quietSince === undefined)
39
+ return null;
40
+ const quiet = now - agent.quietSince;
41
+ return quiet >= QUIET_AFTER_MS ? quiet : null;
42
+ }
43
+ /** The working agents that have been quiet that long: the run header counts them. */
44
+ export function quietAgents(agents, now) {
45
+ return agents.filter((agent) => quietForMs(agent, now) !== null).length;
46
+ }
47
+ export function WorkflowRunCard({ run, title, subtitle, meta, live, now, actions, chips, result, onOpen, stop, bare = false, }) {
35
48
  const t = useTranslations('tools.workflow');
36
49
  const [showResult, setShowResult] = useState(false);
37
50
  const resultId = useId();
38
51
  const counts = countAgents(run.agents);
39
52
  return (_jsxs("section", { "data-testid": "workflow-card", "aria-label": title,
40
53
  // Flush with the reply's text column: the card is the turn's content, not a tool row's body.
41
- className: "border-border mt-1.5 flex min-w-0 flex-col rounded-lg border text-xs", children: [_jsxs("header", { className: "border-border flex min-w-0 items-start gap-2.5 border-b px-4 py-3", children: [_jsx("span", { className: "flex h-5 shrink-0 items-center", children: counts.total > 0 ? (_jsx(RunProgressRing, { size: 16, done: counts.done, failed: counts.failed, total: counts.total, ended: run.status === 'done' ? 'done' : run.status === 'stopped' ? 'stopped' : undefined })) : (_jsx(SessionStatusMark, { status: runGlyphStatus(run.status === 'running' ? 'starting' : run.status) })) }), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [_jsx("h3", { className: "text-foreground min-w-0 truncate text-sm font-medium", title: title, children: title }), chips] }), subtitle && (_jsx("p", { className: "text-muted-foreground min-w-0 truncate tabular-nums", title: subtitle, children: subtitle }))] }), (actions || result) && (_jsxs("div", { className: "-my-1 flex shrink-0 items-center", children: [actions, result && (_jsxs("button", { type: "button", "aria-expanded": showResult, "aria-controls": resultId, onClick: () => setShowResult((open) => !open), className: "text-foreground hover:bg-muted/60 flex h-7 cursor-pointer items-center gap-1 rounded-md px-2 text-xs", children: [t('result'), _jsx(CaretDownIcon, { "aria-hidden": true, className: cn('size-3 transition-transform duration-(--duration-fast) motion-reduce:transition-none', showResult && 'rotate-180') })] }))] }))] }), result && showResult && (_jsx("div", { id: resultId, className: "border-border max-h-96 overflow-y-auto border-b px-4 py-3 text-sm", children: result })), _jsx(WorkflowRunRows, { run: run, live: live, now: now, onOpen: onOpen, stop: stop })] }));
54
+ className: "border-border mt-1.5 flex min-w-0 flex-col rounded-lg border text-xs", children: [_jsxs("header", { className: cn('border-border flex min-w-0 flex-wrap items-start gap-x-2.5 gap-y-1.5 px-4 py-3', !bare && 'border-b'), children: [_jsx("span", { className: "flex h-5 shrink-0 items-center", children: counts.total > 0 ? (_jsx(RunProgressRing, { size: 16, done: counts.done, failed: counts.failed, total: counts.total, ended: run.status === 'done' ? 'done' : run.status === 'stopped' ? 'stopped' : undefined })) : (_jsx(SessionStatusMark, { status: runGlyphStatus(run.status === 'running' ? 'starting' : run.status) })) }), _jsxs("div", { className: "flex min-w-0 flex-1 basis-64 flex-col gap-0.5", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [_jsx("h3", { className: cn('min-w-0 truncate text-sm font-medium', bare ? 'text-muted-foreground' : 'text-foreground'), title: title, children: title }), chips] }), (subtitle || meta) && (_jsxs("p", { className: "text-muted-foreground flex min-w-0 items-center tabular-nums", children: [subtitle && (
55
+ // Progress outranks cost: the state keeps its width up to the line, the cost truncates first.
56
+ _jsx("span", { className: "max-w-full shrink-0 truncate", title: subtitle, children: subtitle })), meta] }))] }), (actions || result) && (_jsxs("div", { className: "-my-1 ml-auto flex shrink-0 items-center", children: [actions, result && (_jsxs("button", { type: "button", "aria-expanded": showResult, "aria-controls": resultId, onClick: () => setShowResult((open) => !open), className: "text-foreground hover:bg-muted/60 flex h-7 cursor-pointer items-center gap-1 rounded-md px-2 text-xs", children: [t('result'), _jsx(CaretDownIcon, { "aria-hidden": true, className: cn('size-3 transition-transform duration-(--duration-fast) motion-reduce:transition-none', showResult && 'rotate-180') })] }))] }))] }), result && showResult && (_jsx("div", { id: resultId, className: "border-border max-h-96 overflow-y-auto border-b px-4 py-3 text-sm", children: result })), !bare && _jsx(WorkflowRunRows, { run: run, live: live, now: now, onOpen: onOpen, stop: stop })] }));
42
57
  }
43
58
  /**
44
59
  * A run's agents under their phases. Each phase is one row: its progress ring
@@ -81,7 +96,8 @@ function PhaseRow({ phase, agents, waits, defaultOpen, live, now, onOpen, stop,
81
96
  const opens = agents.length > 0;
82
97
  const pending = !opens && phase.status === 'pending';
83
98
  // A closed phase still says it is at work: "4 running · 1 failed".
84
- const running = agents.filter((agent) => agent.status === 'running' || agent.status === 'starting').length;
99
+ // An agent queued for a slot or held (`starting`, no session yet) is not running.
100
+ const running = agents.filter((agent) => agent.status === 'running' || (agent.status === 'starting' && !!agent.sessionId)).length;
85
101
  const meta = waits ??
86
102
  ([running > 0 ? t('runningCount', { count: running }) : null, tally.failed > 0 ? t('failedSuffix', { count: tally.failed }) : null]
87
103
  .filter(Boolean)
@@ -142,20 +158,28 @@ function AgentRow({ agent, live, now, onOpen, stop, trunk, }) {
142
158
  const t = useTranslations('tools.workflow');
143
159
  const working = agent.status === 'running' || agent.status === 'starting';
144
160
  const elapsed = elapsedMs(agent, live && working, now);
161
+ const quiet = live ? quietForMs(agent, now) : null;
145
162
  const state = agent.status === 'failed'
146
163
  ? t('didntFinish')
147
164
  : agent.status === 'starting'
148
165
  ? t('status.starting')
149
166
  : agent.status === 'stopped'
150
- ? t('status.stopped')
151
- : null;
167
+ ? // A person's Stop is their decision, never a failure.
168
+ agent.stoppedBy === 'person'
169
+ ? t('stoppedByYou')
170
+ : t('status.stopped')
171
+ : quiet !== null
172
+ ? t('quietFor', { minutes: Math.floor(quiet / 60_000) })
173
+ : null;
174
+ // A restart or a stall starts a new attempt in a new session, with its own clock: the row says which one.
175
+ const attempt = (agent.attempt ?? 1) > 1 ? t('attempt', { count: agent.attempt }) : null;
152
176
  // Working and finished rows are one line: status, name, time. Only a failure says why.
153
177
  const detail = agent.status === 'failed' ? (agent.summary ?? null) : null;
154
178
  const canRetry = agent.status === 'failed' && live && !!agent.sessionId && !!stop.restart;
155
179
  const retrying = !!agent.sessionId && stop.restart?.pending === agent.sessionId;
156
180
  const stopping = !!agent.sessionId && stop.pending.has(agent.sessionId);
157
181
  const tm = useTranslations('multiAgent.workflow');
158
- const body = (_jsxs(_Fragment, { children: [_jsx("span", { className: "flex h-5 shrink-0 items-center", children: _jsx(SessionStatusMark, { status: runGlyphStatus(agent.status) }) }), _jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5 text-left", children: [_jsxs("span", { className: "flex min-w-0 items-center gap-2.5", children: [_jsx("span", { className: cn('text-foreground min-w-0 flex-1 truncate text-sm', agent.status !== 'done' && 'font-medium'), title: agent.label, children: agent.label }), state && _jsx("span", { className: "text-muted-foreground shrink-0", children: state }), elapsed !== undefined && agent.status !== 'failed' && (_jsx("span", { className: "text-muted-foreground min-w-9 shrink-0 text-right tabular-nums", children: formatElapsed(elapsed) }))] }), detail && (_jsx("span", { className: "text-muted-foreground min-w-0 whitespace-normal wrap-anywhere", children: detail }))] })] }));
182
+ const body = (_jsxs(_Fragment, { children: [_jsx("span", { className: "flex h-5 shrink-0 items-center", children: _jsx(SessionStatusMark, { status: runGlyphStatus(agent.status) }) }), _jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5 text-left", children: [_jsxs("span", { className: "flex min-w-0 items-center gap-2.5", children: [_jsx("span", { className: cn('text-foreground min-w-0 flex-1 truncate text-sm', agent.status !== 'done' && 'font-medium'), title: agent.label, children: agent.label }), attempt && _jsx("span", { className: "text-muted-foreground shrink-0", children: attempt }), state && _jsx("span", { className: "text-muted-foreground shrink-0", children: state }), elapsed !== undefined && agent.status !== 'failed' && (_jsx("span", { className: "text-muted-foreground min-w-9 shrink-0 text-right tabular-nums", children: formatElapsed(elapsed) }))] }), detail && (_jsx("span", { className: "text-muted-foreground min-w-0 whitespace-normal wrap-anywhere", children: detail }))] })] }));
159
183
  const rowClass = cn('flex min-h-9 min-w-0 flex-1 items-start gap-2.5 rounded-md px-2.5 py-2', agent.sessionId && 'hover:bg-muted/40');
160
- return (_jsxs("li", { className: cn('relative flex min-w-0 items-start', trunk && 'pl-3.5'), children: [trunk && _jsx(TrunkLines, { continues: trunk.continues }), agent.sessionId ? (_jsx("button", { type: "button", "data-workflow-row": true, "aria-label": [t('openAgent', { label: agent.label }), state ?? t(`status.${agent.status === 'done' ? 'done' : agent.status === 'running' ? 'running' : 'starting'}`), elapsed !== undefined && agent.status !== 'failed' ? formatElapsed(elapsed) : null].filter(Boolean).join(', '), onClick: () => onOpen(agent), className: cn(rowClass, 'cursor-pointer'), children: body })) : (_jsx("div", { className: rowClass, children: body })), live && working && !!agent.sessionId && stop.enabled && (_jsxs("span", { className: "flex shrink-0 items-center py-1.5", children: [stop.restart && (_jsx(Hint, { label: tm('restartHint'), side: "top", children: _jsx(Button, { type: "button", variant: "ghost", size: "icon-xs", "aria-label": tm('restartAgent', { label: agent.label }), disabled: retrying || stopping, "aria-busy": retrying, onClick: () => stop.restart?.run(agent), className: "text-muted-foreground hover:text-foreground", children: _jsx(ArrowClockwiseIcon, { className: "size-3" }) }) })), _jsx(Hint, { label: t('stopHint'), side: "top", children: _jsx(Button, { type: "button", variant: "ghost", size: "icon-xs", "aria-label": t('stopAgent', { label: agent.label }), disabled: stopping, "aria-busy": stopping, onClick: () => stop.stop(agent), className: "text-muted-foreground hover:text-foreground", children: _jsx(SquareIcon, { weight: "fill", className: "size-2.5" }) }) })] })), canRetry && (_jsx("button", { type: "button", "aria-label": t('retryAgent', { label: agent.label }), disabled: retrying, onClick: () => stop.restart?.run(agent), className: "text-foreground hover:bg-muted/60 my-1 flex h-7 shrink-0 cursor-pointer items-center rounded-md px-2 disabled:opacity-50", children: t('retryNow') }))] }));
184
+ return (_jsxs("li", { className: cn('relative flex min-w-0 items-start', trunk && 'pl-3.5'), children: [trunk && _jsx(TrunkLines, { continues: trunk.continues }), agent.sessionId ? (_jsx("button", { type: "button", "data-workflow-row": true, "aria-label": [t('openAgent', { label: agent.label }), state ?? t(`status.${agent.status === 'done' ? 'done' : agent.status === 'running' ? 'running' : 'starting'}`), attempt, elapsed !== undefined && agent.status !== 'failed' ? formatElapsed(elapsed) : null].filter(Boolean).join(', '), onClick: () => onOpen(agent), className: cn(rowClass, 'cursor-pointer'), children: body })) : (_jsx("div", { className: rowClass, children: body })), live && working && !!agent.sessionId && stop.enabled && (_jsxs("span", { className: "flex shrink-0 items-center py-1.5", children: [stop.restart && (_jsx(Hint, { label: tm('restartHint'), side: "top", children: _jsx(Button, { type: "button", variant: "ghost", size: "icon-xs", "aria-label": tm('restartAgent', { label: agent.label }), disabled: retrying || stopping, "aria-busy": retrying, onClick: () => stop.restart?.run(agent), className: "text-muted-foreground hover:text-foreground", children: _jsx(ArrowClockwiseIcon, { className: "size-3" }) }) })), _jsx(Hint, { label: t('stopHint'), side: "top", children: _jsx(Button, { type: "button", variant: "ghost", size: "icon-xs", "aria-label": t('stopAgent', { label: agent.label }), disabled: stopping, "aria-busy": stopping, onClick: () => stop.stop(agent), className: "text-muted-foreground hover:text-foreground", children: _jsx(SquareIcon, { weight: "fill", className: "size-2.5" }) }) })] })), canRetry && (_jsx("button", { type: "button", "aria-label": t('retryAgent', { label: agent.label }), disabled: retrying, onClick: () => stop.restart?.run(agent), className: "text-foreground hover:bg-muted/60 my-1 flex h-7 shrink-0 cursor-pointer items-center rounded-md px-2 disabled:opacity-50", children: t('retryNow') }))] }));
161
185
  }
@@ -0,0 +1,29 @@
1
+ import type { SessionUsage } from '@kortix/sdk';
2
+ /**
3
+ * What a workflow run cost so far, in USD, from the session usage tree
4
+ * (`GET …/sessions/:id/usage`): model calls and box time that Kortix billed.
5
+ *
6
+ * - A background run: its runner session and every agent session under it
7
+ * (`total`), which is the whole run.
8
+ * - A run in the calling session: only its agents' sessions and their
9
+ * descendants. The caller's own turns are not part of the run.
10
+ *
11
+ * Own-key (BYOK) model spend is not in it: Kortix did not bill it. Exported for tests.
12
+ */
13
+ export declare function runSpentUsd(usage: Pick<SessionUsage, 'total' | 'sessions'>, agentSessionIds?: readonly string[]): number;
14
+ /**
15
+ * "Spent N credits" for a workflow run card: the actual spend, never an
16
+ * estimate. Renders nothing until the read answers, and nothing for a run that
17
+ * has cost nothing yet. Refreshed every 30 s while the run works, and twice as
18
+ * it ends (at once, then 10 s later), so the final number is the final spend.
19
+ * Inline text for the card's status line: `separated` puts a " · " before it.
20
+ */
21
+ export declare function WorkflowRunCost({ projectId, rootSessionId, agentSessionIds, live, separated, }: {
22
+ projectId: string | undefined;
23
+ /** The runner of a background run, else the session that called `workflow`. */
24
+ rootSessionId: string | undefined;
25
+ /** A run in the calling session: its agents' session ids. Omit for a background run. */
26
+ agentSessionIds?: readonly string[];
27
+ live: boolean;
28
+ separated?: boolean;
29
+ }): import("react").JSX.Element | null;