@kortix/ui 0.14.19 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (414) hide show
  1. package/README.md +1 -1
  2. package/dist/_vendor/kortix-shared.js +956 -73
  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/index.d.ts +0 -1
  6. package/dist/_vendor/shared/peer-message-prompt.d.ts +7 -1
  7. package/dist/_vendor/shared/project-glyphs.d.ts +103 -20
  8. package/dist/_vendor/shared/webhook-signing.d.ts +3 -1
  9. package/dist/access/access/access-dialog-share.d.ts +3 -28
  10. package/dist/access/access/access-dialog-share.js +3 -75
  11. package/dist/artifacts/artifact-frame.js +26 -2
  12. package/dist/artifacts/artifact-session.js +6 -2
  13. package/dist/artifacts/frame-policy.d.ts +2 -9
  14. package/dist/artifacts/frame-policy.js +2 -25
  15. package/dist/customize/agents/agents-page.js +1 -1
  16. package/dist/customize/agents/create-agent-modal.js +1 -1
  17. package/dist/customize/connectors/connector-filter.d.ts +2 -1
  18. package/dist/customize/connectors/connector-filter.js +2 -3
  19. package/dist/customize/connectors/connectors-page.js +15 -24
  20. package/dist/customize/connectors/detail/connector-status.d.ts +3 -24
  21. package/dist/customize/connectors/detail/connector-status.js +2 -42
  22. package/dist/customize/connectors/detail/use-connector-detail.d.ts +2 -6
  23. package/dist/customize/connectors/detail/use-connector-detail.js +3 -13
  24. package/dist/customize/connectors/install/install.d.ts +2 -6
  25. package/dist/customize/connectors/install/install.js +2 -16
  26. package/dist/customize/connectors/provider-label.d.ts +4 -17
  27. package/dist/customize/connectors/provider-label.js +4 -37
  28. package/dist/customize/providers/provider-connect.d.ts +6 -15
  29. package/dist/customize/providers/provider-connect.js +5 -36
  30. package/dist/customize/sections/connector-connection-form.d.ts +3 -7
  31. package/dist/customize/sections/connector-connection-form.js +2 -33
  32. package/dist/customize/sections/connector-oauth2-auto.d.ts +3 -33
  33. package/dist/customize/sections/connector-oauth2-auto.js +2 -64
  34. package/dist/customize/sections/gateway-view.d.ts +6 -5
  35. package/dist/customize/sections/gateway-view.js +31 -13
  36. package/dist/customize/sections/llm-provider/constants.d.ts +1 -2
  37. package/dist/customize/sections/llm-provider/constants.js +1 -2
  38. package/dist/customize/sections/llm-provider/utils.d.ts +1 -41
  39. package/dist/customize/sections/llm-provider/utils.js +1 -52
  40. package/dist/customize/sections/view/account-secret-resources-panel.js +4 -1
  41. package/dist/customize/sections/view/agent-editor-catalog.js +0 -5
  42. package/dist/customize/sections/view/channel-settings-patch.js +1 -1
  43. package/dist/customize/sections/view/channels-view.js +8 -8
  44. package/dist/customize/sections/view/connector-connections.d.ts +5 -85
  45. package/dist/customize/sections/view/connector-connections.js +5 -99
  46. package/dist/customize/sections/view/gateway/gateway-logs.d.ts +42 -3
  47. package/dist/customize/sections/view/gateway/gateway-logs.js +212 -15
  48. package/dist/customize/sections/view/gateway/gateway-overview.js +1 -1
  49. package/dist/customize/sections/view/gateway/gateway-routing.d.ts +3 -3
  50. package/dist/customize/sections/view/gateway/gateway-routing.js +81 -200
  51. package/dist/customize/sections/view/gateway/routing-parts.d.ts +101 -0
  52. package/dist/customize/sections/view/gateway/routing-parts.js +154 -0
  53. package/dist/customize/sections/view/gateway/routing-sentence-layout.d.ts +2 -0
  54. package/dist/customize/sections/view/gateway/routing-sentence-layout.js +82 -0
  55. package/dist/customize/sections/view/review-center-connected.js +17 -15
  56. package/dist/customize/sections/view/review-view.d.ts +7 -0
  57. package/dist/customize/sections/view/review-view.js +11 -0
  58. package/dist/customize/sections/view/secret-delivery.js +1 -1
  59. package/dist/customize/sections/view/secrets-view.js +1 -1
  60. package/dist/customize/sections/view/subscription-usage-tab.d.ts +14 -0
  61. package/dist/customize/sections/view/subscription-usage-tab.js +122 -0
  62. package/dist/customize/sections/view/subscription-usage.d.ts +34 -0
  63. package/dist/customize/sections/view/subscription-usage.js +98 -0
  64. package/dist/customize/settings/tabs/experimental-tab.js +3 -3
  65. package/dist/customize/settings/tabs/general-tab.js +65 -10
  66. package/dist/customize/shared/catalog/catalog-card.d.ts +9 -4
  67. package/dist/customize/shared/catalog/catalog-card.js +3 -3
  68. package/dist/customize/shared/channels-switch-dialog.d.ts +1 -1
  69. package/dist/customize/shared/channels-switch-dialog.js +1 -1
  70. package/dist/customize/shared/feature-gate-screen.js +1 -1
  71. package/dist/customize/triggers/schedule/post-to-field.d.ts +1 -1
  72. package/dist/customize/triggers/schedule/post-to-field.js +2 -2
  73. package/dist/customize/triggers/schedule/trigger-composer-logic.d.ts +1 -1
  74. package/dist/files/drives/conflict-marks.d.ts +28 -0
  75. package/dist/files/drives/conflict-marks.js +39 -0
  76. package/dist/files/drives/session-drives-chip.js +15 -10
  77. package/dist/files/viewer/index.d.ts +1 -1
  78. package/dist/files/viewer/index.js +1 -1
  79. package/dist/i18n/en.d.ts +451 -203
  80. package/dist/i18n/en.js +543 -295
  81. package/dist/index.d.ts +1 -1
  82. package/dist/index.js +1 -1
  83. package/dist/internal/account-hub/sections.d.ts +1 -1
  84. package/dist/internal/capture/use-capture-area.d.ts +5 -1
  85. package/dist/internal/capture/use-capture-area.js +16 -9
  86. package/dist/internal/goals/goal-meta.d.ts +50 -3
  87. package/dist/internal/goals/goal-meta.js +144 -9
  88. package/dist/internal/hooks/connectors/use-add-account.d.ts +3 -9
  89. package/dist/internal/hooks/connectors/use-add-account.js +3 -18
  90. package/dist/internal/hooks/connectors/use-connect-link.d.ts +3 -2
  91. package/dist/internal/hooks/connectors/use-connect-link.js +15 -24
  92. package/dist/internal/hooks/connectors/use-pipedream-connect-project.d.ts +3 -56
  93. package/dist/internal/hooks/connectors/use-pipedream-connect-project.js +3 -87
  94. package/dist/internal/hooks/projects/use-new-project-session.d.ts +3 -2
  95. package/dist/internal/hooks/projects/use-new-project-session.js +4 -3
  96. package/dist/internal/hooks/projects/use-project-can-run.d.ts +7 -0
  97. package/dist/internal/hooks/projects/use-project-can-run.js +12 -5
  98. package/dist/internal/hooks/projects/use-restart-project-session.d.ts +0 -1
  99. package/dist/internal/hooks/projects/use-restart-project-session.js +0 -1
  100. package/dist/internal/layout/project-capability-nav.js +6 -2
  101. package/dist/internal/layout/project-page-header.d.ts +3 -1
  102. package/dist/internal/layout/project-page-header.js +2 -2
  103. package/dist/internal/lib/account-secret-access.d.ts +1 -41
  104. package/dist/internal/lib/account-secret-access.js +3 -46
  105. package/dist/internal/lib/browser-error-noise.d.ts +1 -1
  106. package/dist/internal/lib/browser-error-noise.js +1 -1
  107. package/dist/internal/lib/browser-noise/rules/expected-states.d.ts +2 -15
  108. package/dist/internal/lib/browser-noise/rules/expected-states.js +5 -55
  109. package/dist/internal/lib/capability-tab-routes.d.ts +3 -3
  110. package/dist/internal/lib/capability-tab-routes.js +11 -3
  111. package/dist/internal/lib/llm-providers.d.ts +4 -110
  112. package/dist/internal/lib/llm-providers.js +5 -102
  113. package/dist/internal/lib/navigation/message-link.d.ts +32 -0
  114. package/dist/internal/lib/navigation/message-link.js +51 -0
  115. package/dist/internal/lib/navigation/session-href.d.ts +11 -0
  116. package/dist/internal/lib/navigation/session-href.js +20 -0
  117. package/dist/internal/lib/navigation/session-spawn-urls.d.ts +17 -0
  118. package/dist/internal/lib/navigation/session-spawn-urls.js +26 -0
  119. package/dist/internal/lib/space-scope.d.ts +3 -3
  120. package/dist/internal/lib/space-scope.js +3 -3
  121. package/dist/internal/lib/use-project-feature-flags.js +7 -7
  122. package/dist/internal/lib/web-notifications.d.ts +1 -1
  123. package/dist/internal/lib/web-notifications.js +0 -3
  124. package/dist/internal/notifications/notification-bell.js +1 -3
  125. package/dist/internal/notifications/notification-rows.d.ts +2 -2
  126. package/dist/internal/notifications/notification-rows.js +2 -3
  127. package/dist/internal/session-types/index.d.ts +5 -7
  128. package/dist/internal/session-types/index.js +5 -7
  129. package/dist/internal/stores/active-space-store.d.ts +1 -1
  130. package/dist/internal/stores/active-space-store.js +1 -1
  131. package/dist/internal/stores/kortix-computer-store.d.ts +15 -0
  132. package/dist/internal/stores/kortix-computer-store.js +12 -0
  133. package/dist/lib/routes.d.ts +17 -7
  134. package/dist/lib/routes.js +18 -2
  135. package/dist/markdown/app-link-icons.d.ts +7 -0
  136. package/dist/markdown/app-link-icons.js +20 -0
  137. package/dist/markdown/app-links.d.ts +9 -0
  138. package/dist/markdown/app-links.js +112 -0
  139. package/dist/markdown/doc-editor/doc-attrs.d.ts +28 -0
  140. package/dist/markdown/doc-editor/doc-attrs.js +156 -0
  141. package/dist/markdown/doc-editor/doc-embed.d.ts +6 -0
  142. package/dist/markdown/doc-editor/doc-embed.js +26 -8
  143. package/dist/markdown/doc-editor/doc-extensions.d.ts +10 -0
  144. package/dist/markdown/doc-editor/doc-extensions.js +55 -8
  145. package/dist/markdown/doc-editor/doc-fidelity.d.ts +72 -0
  146. package/dist/markdown/doc-editor/doc-fidelity.js +135 -0
  147. package/dist/markdown/doc-editor/doc-node-view.d.ts +9 -0
  148. package/dist/markdown/doc-editor/doc-node-view.js +29 -0
  149. package/dist/markdown/doc-editor/markdown.d.ts +20 -0
  150. package/dist/markdown/doc-editor/markdown.js +455 -18
  151. package/dist/markdown/unified-markdown.d.ts +1 -1
  152. package/dist/markdown/unified-markdown.js +129 -10
  153. package/dist/primitives/emoji-picker.js +16 -100
  154. package/dist/primitives/emoji-tint.js +12 -12
  155. package/dist/primitives/entity-avatar.js +14 -9
  156. package/dist/primitives/glyph-face.d.ts +19 -12
  157. package/dist/primitives/glyph-face.js +59 -20
  158. package/dist/primitives/glyph-paths-source.d.ts +7 -0
  159. package/dist/primitives/glyph-paths-source.js +14 -6
  160. package/dist/primitives/glyph-paths.generated.d.ts +1 -1
  161. package/dist/primitives/glyph-paths.generated.js +947 -204
  162. package/dist/primitives/glyph-picker.d.ts +6 -10
  163. package/dist/primitives/glyph-picker.js +147 -98
  164. package/dist/primitives/glyph-registry.js +1604 -1
  165. package/dist/primitives/glyph-tint.d.ts +28 -3
  166. package/dist/primitives/glyph-tint.js +41 -83
  167. package/dist/primitives/kortix-glyphs.d.ts +32 -0
  168. package/dist/primitives/kortix-glyphs.js +157 -0
  169. package/dist/primitives/project-icon-picker.d.ts +8 -1
  170. package/dist/primitives/project-icon-picker.js +13 -5
  171. package/dist/primitives/user-avatar.d.ts +8 -1
  172. package/dist/primitives/user-avatar.js +2 -2
  173. package/dist/providers/ui-provider.d.ts +1 -8
  174. package/dist/session/actions/project-session-list-helpers.js +1 -1
  175. package/dist/session/agents/agent-model.js +4 -0
  176. package/dist/session/agents/agent-state-mark.d.ts +12 -7
  177. package/dist/session/agents/agent-state-mark.js +37 -15
  178. package/dist/session/agents/agent-strip.js +8 -2
  179. package/dist/session/agents/agent-surface.d.ts +81 -0
  180. package/dist/session/agents/agent-surface.js +97 -0
  181. package/dist/session/agents/held-messages.js +7 -4
  182. package/dist/session/agents/legacy-subagent-chat.js +1 -1
  183. package/dist/session/agents/session-peek.js +24 -12
  184. package/dist/session/agents/steer-session.d.ts +2 -0
  185. package/dist/session/agents/steer-session.js +3 -2
  186. package/dist/session/agents/subagent-dialog-content.d.ts +30 -1
  187. package/dist/session/agents/subagent-dialog-content.js +147 -33
  188. package/dist/session/agents/subagent-view.d.ts +15 -5
  189. package/dist/session/agents/subagent-view.js +28 -6
  190. package/dist/session/agents/tasks-panel.js +2 -12
  191. package/dist/session/agents/workflow-run-controls.d.ts +3 -1
  192. package/dist/session/agents/workflow-run-controls.js +12 -7
  193. package/dist/session/composer/ComposerCard.d.ts +7 -1
  194. package/dist/session/composer/ComposerCard.js +74 -9
  195. package/dist/session/composer/agent-selector.d.ts +16 -0
  196. package/dist/session/composer/agent-selector.js +19 -11
  197. package/dist/session/composer/chat-input/chat-input-control.d.ts +64 -0
  198. package/dist/session/composer/chat-input/chat-input-control.js +578 -0
  199. package/dist/session/composer/chat-input/chat-input-overrides.d.ts +76 -0
  200. package/dist/session/composer/chat-input/chat-input-overrides.js +40 -0
  201. package/dist/session/composer/chat-input/chat-input-panes.d.ts +56 -0
  202. package/dist/session/composer/chat-input/chat-input-panes.js +148 -0
  203. package/dist/session/composer/chat-input/chat-input-summary.d.ts +67 -0
  204. package/dist/session/composer/chat-input/chat-input-summary.js +67 -0
  205. package/dist/session/composer/chat-queue-lines.d.ts +20 -0
  206. package/dist/session/composer/chat-queue-lines.js +20 -0
  207. package/dist/session/composer/composer-chat-input.d.ts +8 -1
  208. package/dist/session/composer/composer-chat-input.js +12 -4
  209. package/dist/session/composer/composer-focus-context.d.ts +7 -0
  210. package/dist/session/composer/composer-focus-context.js +9 -0
  211. package/dist/session/composer/composer-toolbar.d.ts +3 -1
  212. package/dist/session/composer/composer-toolbar.js +3 -3
  213. package/dist/session/composer/composer-underbar.d.ts +10 -1
  214. package/dist/session/composer/composer-underbar.js +10 -2
  215. package/dist/session/composer/composer.d.ts +12 -0
  216. package/dist/session/composer/composer.js +55 -1
  217. package/dist/session/composer/editor/composer-editor.d.ts +10 -2
  218. package/dist/session/composer/editor/composer-editor.js +22 -6
  219. package/dist/session/composer/editor/first-visual-line.d.ts +2 -0
  220. package/dist/session/composer/editor/first-visual-line.js +9 -0
  221. package/dist/session/composer/editor/mention-node.js +2 -0
  222. package/dist/session/composer/editor/serialize.js +9 -1
  223. package/dist/session/composer/hooks/use-file-search.d.ts +1 -1
  224. package/dist/session/composer/hooks/use-file-search.js +1 -1
  225. package/dist/session/composer/menus/mention-controller.d.ts +3 -11
  226. package/dist/session/composer/menus/mention-controller.js +56 -16
  227. package/dist/session/composer/menus/mention-menu.d.ts +7 -2
  228. package/dist/session/composer/menus/mention-menu.js +17 -9
  229. package/dist/session/composer/menus/menu-items.d.ts +9 -0
  230. package/dist/session/composer/menus/space-mentions.d.ts +48 -0
  231. package/dist/session/composer/menus/space-mentions.js +83 -0
  232. package/dist/session/composer/prompt-history.d.ts +9 -0
  233. package/dist/session/composer/prompt-history.js +45 -0
  234. package/dist/session/composer/queue-projection.d.ts +2 -0
  235. package/dist/session/composer/queue-projection.js +1 -0
  236. package/dist/session/composer/queued-prompt-list.js +53 -4
  237. package/dist/session/composer/reasoning-effort-selector.d.ts +20 -0
  238. package/dist/session/composer/reasoning-effort-selector.js +3 -3
  239. package/dist/session/composer/types.d.ts +2 -1
  240. package/dist/session/header/session-site-header.js +7 -3
  241. package/dist/session/header/subagent-hover-card.d.ts +7 -4
  242. package/dist/session/header/subagent-hover-card.js +62 -11
  243. package/dist/session/list/session-status-mark.d.ts +42 -0
  244. package/dist/{workspace/sidebar → session/list}/session-status-mark.js +37 -2
  245. package/dist/session/models/model-selector.d.ts +7 -2
  246. package/dist/session/models/model-selector.js +39 -31
  247. package/dist/session/overrides/provider-secret-pool-editor.d.ts +11 -0
  248. package/dist/session/overrides/provider-secret-pool-editor.js +17 -0
  249. package/dist/session/overrides/session-overrides-control.d.ts +5 -0
  250. package/dist/session/overrides/session-overrides-toolbar.js +147 -7
  251. package/dist/session/panel/model-switch-event.d.ts +8 -0
  252. package/dist/session/panel/model-switch-event.js +19 -0
  253. package/dist/session/panel/session-audit-panel.js +3 -2
  254. package/dist/session/panel/session-desktop.js +5 -1
  255. package/dist/session/panel/session-panel-provider.js +1 -1
  256. package/dist/session/panel/shared/use-panel-handoffs.d.ts +2 -2
  257. package/dist/session/panel/shared/use-panel-handoffs.js +21 -2
  258. package/dist/session/prompts/ask-deck.d.ts +21 -0
  259. package/dist/session/prompts/ask-deck.js +253 -0
  260. package/dist/session/prompts/session-permission-prompt.d.ts +7 -1
  261. package/dist/session/prompts/session-permission-prompt.js +3 -3
  262. package/dist/session/status/session-load-state.d.ts +0 -1
  263. package/dist/session/status/session-load-state.js +2 -4
  264. package/dist/session/thread/message-parsing.d.ts +0 -1
  265. package/dist/session/thread/message-parsing.js +0 -1
  266. package/dist/session/thread/session-chat.d.ts +3 -1
  267. package/dist/session/thread/session-chat.js +459 -310
  268. package/dist/session/thread/session-context-metrics.d.ts +0 -1
  269. package/dist/session/thread/session-context-metrics.js +1 -1
  270. package/dist/session/thread/session-context-sub-sessions.js +3 -1
  271. package/dist/session/thread/show-work.d.ts +38 -0
  272. package/dist/session/thread/show-work.js +115 -0
  273. package/dist/session/thread/thread-boot-rows.d.ts +2 -1
  274. package/dist/session/thread/thread-boot-rows.js +7 -3
  275. package/dist/session/thread/transcript-rows.d.ts +36 -0
  276. package/dist/session/thread/transcript.d.ts +46 -2
  277. package/dist/session/thread/transcript.js +226 -34
  278. package/dist/session/thread/typing-indicator.d.ts +21 -0
  279. package/dist/session/thread/typing-indicator.js +46 -0
  280. package/dist/session/tool/shared/infrastructure-contexts.d.ts +12 -0
  281. package/dist/session/tool/shared/infrastructure-contexts.js +6 -0
  282. package/dist/session/tool/tool-part-renderer.d.ts +2 -0
  283. package/dist/session/tool/tool-part-renderer.js +16 -2
  284. package/dist/session/tool/tools/kortix-action-tool.js +8 -1
  285. package/dist/session/tool/tools/multi-agent-tool-bodies.d.ts +19 -0
  286. package/dist/session/tool/tools/multi-agent-tool-bodies.js +34 -13
  287. package/dist/session/tool/tools/session-spawn-urls.d.ts +1 -16
  288. package/dist/session/tool/tools/session-spawn-urls.js +4 -26
  289. package/dist/session/tool/tools/task-tool.d.ts +5 -18
  290. package/dist/session/tool/tools/task-tool.js +47 -86
  291. package/dist/session/tool/tools/workflow-progress.d.ts +14 -18
  292. package/dist/session/tool/tools/workflow-progress.js +24 -179
  293. package/dist/session/tool/tools/workflow-result-text.d.ts +15 -0
  294. package/dist/session/tool/tools/workflow-result-text.js +34 -0
  295. package/dist/session/tool/tools/workflow-run-card.d.ts +35 -0
  296. package/dist/session/tool/tools/workflow-run-card.js +157 -0
  297. package/dist/session/tool/tools/workflow-tool.js +45 -58
  298. package/dist/session/turn/activity-burst.d.ts +2 -2
  299. package/dist/session/turn/activity-burst.js +11 -5
  300. package/dist/session/turn/answered-question-step.d.ts +29 -0
  301. package/dist/session/turn/answered-question-step.js +48 -3
  302. package/dist/session/turn/notice-batch-group.d.ts +4 -4
  303. package/dist/session/turn/notice-batch-group.js +5 -8
  304. package/dist/session/turn/peer-message-row.d.ts +15 -0
  305. package/dist/session/turn/peer-message-row.js +38 -47
  306. package/dist/session/turn/subagent-notice-row.d.ts +16 -1
  307. package/dist/session/turn/subagent-notice-row.js +47 -35
  308. package/dist/session/turn/throttled-markdown.js +4 -1
  309. package/dist/session/turn/turn-work-accordion.d.ts +10 -3
  310. package/dist/session/turn/turn-work-accordion.js +18 -11
  311. package/dist/session/turn/user-message.js +16 -42
  312. package/dist/session/turn/voice-turn.d.ts +22 -0
  313. package/dist/session/turn/voice-turn.js +32 -0
  314. package/dist/session/voice/call-ring.d.ts +10 -0
  315. package/dist/session/voice/call-ring.js +52 -0
  316. package/dist/session/voice/use-voice-call.d.ts +4 -4
  317. package/dist/session/voice/use-voice-call.js +6 -9
  318. package/dist/session/voice/voice-call-card.d.ts +6 -0
  319. package/dist/session/voice/voice-call-card.js +113 -0
  320. package/dist/session/voice/voice-call-state.d.ts +3 -0
  321. package/dist/session/voice/voice-call-state.js +2 -1
  322. package/dist/session/voice/voice-call-store.d.ts +16 -6
  323. package/dist/session/voice/voice-call-store.js +5 -5
  324. package/dist/session/voice/voice-call.d.ts +4 -8
  325. package/dist/session/voice/voice-call.js +33 -36
  326. package/dist/styles/components.css +33 -0
  327. package/dist/styles/theme.css +26 -0
  328. package/dist/styles.css +1 -1
  329. package/dist/workspace/admin/project-admin-dashboard.d.ts +1 -1
  330. package/dist/workspace/admin/project-admin-dashboard.js +12 -9
  331. package/dist/workspace/index.d.ts +3 -2
  332. package/dist/workspace/index.js +2 -1
  333. package/dist/workspace/layout/use-project-home-send.d.ts +2 -0
  334. package/dist/workspace/layout/use-project-home-send.js +5 -3
  335. package/dist/workspace/memory/company-memory-page.d.ts +1 -1
  336. package/dist/workspace/memory/company-memory-page.js +1 -1
  337. package/dist/workspace/new/use-creatable-accounts.js +13 -4
  338. package/dist/workspace/projects/modal/project-icon-field.js +49 -34
  339. package/dist/workspace/review/review-center.d.ts +4 -1
  340. package/dist/workspace/review/review-center.js +6 -3
  341. package/dist/workspace/sessions/project-sessions-helpers.js +1 -1
  342. package/dist/workspace/sessions/project-sessions-view.js +1 -1
  343. package/dist/workspace/sessions/session-row.js +6 -4
  344. package/dist/workspace/sessions/sessions-toolbar.d.ts +1 -1
  345. package/dist/workspace/sessions/sessions-toolbar.js +4 -4
  346. package/dist/workspace/sidebar/footer/project-memory-nav.d.ts +1 -1
  347. package/dist/workspace/sidebar/footer/project-memory-nav.js +1 -1
  348. package/dist/workspace/sidebar/project-nav-items.js +2 -5
  349. package/dist/workspace/sidebar/project-session-list.d.ts +7 -1
  350. package/dist/workspace/sidebar/project-session-list.js +63 -24
  351. package/dist/workspace/sidebar/project-sidebar.js +10 -7
  352. package/dist/workspace/sidebar/project-spaces-nav.d.ts +7 -3
  353. package/dist/workspace/sidebar/project-spaces-nav.js +77 -46
  354. package/dist/workspace/sidebar/session-brief-hover-card.d.ts +4 -2
  355. package/dist/workspace/sidebar/session-brief-hover-card.js +47 -28
  356. package/dist/workspace/sidebar/session-group-sections.js +12 -4
  357. package/dist/workspace/sidebar/sidebar-more-group.d.ts +13 -0
  358. package/dist/workspace/sidebar/sidebar-more-group.js +27 -0
  359. package/dist/workspace/space/space-blocks.d.ts +3 -1
  360. package/dist/workspace/space/space-blocks.js +4 -7
  361. package/dist/workspace/space/space-page.d.ts +4 -6
  362. package/dist/workspace/space/space-page.js +10 -24
  363. package/dist/workspace/space/space-tab-panels.d.ts +14 -1
  364. package/dist/workspace/space/space-tab-panels.js +12 -21
  365. package/dist/workspace/space/space-templates.d.ts +4 -5
  366. package/dist/workspace/space/space-templates.js +2 -7
  367. package/dist/workspace/space/use-space-filter.d.ts +1 -1
  368. package/dist/workspace/space/use-space-filter.js +1 -1
  369. package/dist/workspace/spaces/channels-onboarding.d.ts +2 -2
  370. package/dist/workspace/spaces/channels-onboarding.js +4 -3
  371. package/dist/workspace/spaces/create-channel-dialog.js +4 -2
  372. package/dist/workspace/spaces/principal-card.d.ts +71 -0
  373. package/dist/workspace/spaces/principal-card.js +246 -0
  374. package/dist/workspace/spaces/space-auto-open.d.ts +8 -0
  375. package/dist/workspace/spaces/space-auto-open.js +18 -0
  376. package/dist/workspace/spaces/space-avatar.d.ts +44 -0
  377. package/dist/workspace/spaces/space-avatar.js +41 -0
  378. package/dist/workspace/spaces/space-details-panel.d.ts +26 -0
  379. package/dist/workspace/spaces/space-details-panel.js +119 -0
  380. package/dist/workspace/spaces/space-identity.d.ts +49 -0
  381. package/dist/workspace/spaces/space-identity.js +104 -0
  382. package/dist/workspace/spaces/space-members.js +1 -1
  383. package/dist/workspace/spaces/space-mention-source.d.ts +12 -0
  384. package/dist/workspace/spaces/space-mention-source.js +78 -0
  385. package/dist/workspace/spaces/space-people.d.ts +29 -0
  386. package/dist/workspace/spaces/space-people.js +87 -0
  387. package/dist/workspace/spaces/space-roster.d.ts +3 -2
  388. package/dist/workspace/spaces/space-roster.js +7 -4
  389. package/dist/workspace/spaces/space-tab-list.d.ts +37 -0
  390. package/dist/workspace/spaces/space-tab-list.js +82 -0
  391. package/dist/workspace/spaces/space-tabs.d.ts +74 -0
  392. package/dist/workspace/spaces/space-tabs.js +199 -0
  393. package/dist/workspace/spaces/space-threads-tab.js +1 -1
  394. package/dist/workspace/spaces/space-timeline-view.js +126 -17
  395. package/dist/workspace/spaces/space-timeline.d.ts +44 -9
  396. package/dist/workspace/spaces/space-timeline.js +120 -12
  397. package/dist/workspace/spaces/space-view.d.ts +19 -12
  398. package/dist/workspace/spaces/space-view.js +201 -67
  399. package/dist/workspace/spaces/use-personal-space-name.d.ts +2 -0
  400. package/dist/workspace/spaces/use-personal-space-name.js +10 -0
  401. package/package.json +11 -7
  402. package/skills/kortix-ui/SKILL.md +1 -1
  403. package/skills/kortix-ui/references/custom-dashboard.md +2 -3
  404. package/skills/kortix-ui/references/modules.md +4 -4
  405. package/dist/_vendor/shared/room-prompt.d.ts +0 -66
  406. package/dist/session/voice/voice-call-bar.d.ts +0 -4
  407. package/dist/session/voice/voice-call-bar.js +0 -39
  408. package/dist/workspace/sidebar/footer/project-rooms-nav.d.ts +0 -9
  409. package/dist/workspace/sidebar/footer/project-rooms-nav.js +0 -32
  410. package/dist/workspace/sidebar/session-status-mark.d.ts +0 -19
  411. package/dist/workspace/space/space-room.d.ts +0 -20
  412. package/dist/workspace/space/space-room.js +0 -27
  413. /package/dist/{workspace/sidebar → session/list}/session-list-chrome.d.ts +0 -0
  414. /package/dist/{workspace/sidebar → session/list}/session-list-chrome.js +0 -0
@@ -2,97 +2,36 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useTranslations } from '../../../../i18n/index.js';
4
4
  /**
5
- * Routing — where a request goes when the project default can't take it.
5
+ * Routing — where a request goes when its model can't take it.
6
6
  *
7
- * **One axis, flat rows.** Every control on this screen sits in the same
8
- * right-hand column, one row per decision: label and explanation on the left,
9
- * the control on the right. Same shape, same column width, same row padding
10
- * as `ProviderRow` in `packages/ui/src/customize/providers/provider-connect.tsx` ("click,
11
- * paste, done") — a settings screen is scanned by running the eye straight
12
- * down the controls, and it can only be scanned that way if the controls
13
- * share one x-position and one rhythm, not just a similar-looking layout.
14
- *
15
- * **What this replaced.** Four `bg-popover` panels of equal visual weight,
16
- * one of them a `Disclosure` hiding a stack of per-model rule blocks, each of
17
- * which held ANOTHER bordered panel (`ChainEditor`) whose fallback steps were
18
- * themselves bordered `<li>` cards. Five levels of box for "try B if A
19
- * fails", with the mode select at one x-position, the condition select at
20
- * another, the model pickers at a third — and the feature the product owner
21
- * called out as "the core thing want here" (per-model overrides) was the LAST
22
- * of the four panels, behind a click that gave no hint of what was under it.
23
- *
24
- * **Two tiers, not four equal boxes.** The product feedback on the old
25
- * layout was specific: it "looks horrendous", overrides are the core feature
26
- * and should not read as a footnote, and it needs to be as simple as
27
- * possible. So the four sections split into two tiers instead of one flat
28
- * stack:
29
- *
30
- * 1. **Primary — always visible.** *Fallback* (what handles this project's
31
- * requests) and *Per-model overrides* (the exceptions to it) sit at the
32
- * top, in that order, right after each other. Overrides also gets a
33
- * full-strength `text-foreground` heading (the other three stay
34
- * `Label`'s default muted weight) and its "Add override" button lives in
35
- * the section header rather than at the bottom of a list — together that
36
- * is the visual weight the product owner asked for, without a box.
37
- * 2. **Advanced — collapsed by default.** *Vision model* (a narrow,
38
- * image-input-only override) and *Generation defaults* (four raw
39
- * parameter knobs: reasoning effort, temperature, top-p, max tokens) are
40
- * fine-tuning, not the decision someone opens this tab to make. Both
41
- * move under one "Advanced" `Disclosure` below the primary content. It
42
- * opens by default (`hasAdvancedRoutingConfig`) whenever the project
43
- * already sets a vision override or a generation parameter, so an
44
- * existing non-default config is never hidden from the person who set it.
45
- *
46
- * Nothing was cut. Every capability the panels held is still here:
47
- *
48
- * | Capability | Where it is now |
49
- * | --- | --- |
50
- * | Inherit / custom / no fallback | "When a model fails" row (primary) |
51
- * | Ordered default chain, reorder + remove, max 8 | Chain row — one line per step (primary) |
52
- * | Fallback condition (transient / any error) | "Retry on" line, inside the chain it belongs to |
53
- * | Per-model override rules, max 20 | "Per-model overrides" — one row per rule, promoted second (primary) |
54
- * | Vision (image-input) override | "Vision model" row, inside Advanced |
55
- * | Per-model generation defaults | "Generation defaults" section, inside Advanced |
56
- * | Provider-availability preview | `AvailabilityBadge`, on every chain step and override |
57
- * | Reset / dirty / validation / save | Header action + sticky footer, unchanged |
7
+ * This file owns the state: the editable draft of the project routing policy,
8
+ * the fallback mode, the debounced provider-availability preview, save, and
9
+ * reset. `routing-sentence-layout.tsx` renders the draft as plain sentences
10
+ * (All requests, Images, Exceptions, Model defaults); `routing-parts.tsx`
11
+ * holds the controls it is built from, including the floating save bar.
58
12
  *
59
13
  * The data contract is untouched: same props in, same `routing.set` /
60
14
  * `routing.reset` / `routing.preview` calls out, same exported helpers (which
61
15
  * `gateway-routing.test.ts` pins).
62
16
  */
63
- import { WarningIcon as AlertTriangle, ArrowDownIcon as ArrowDown, ArrowUpIcon as ArrowUp, CaretDownIcon, PlusIcon as Plus, ArrowCounterClockwiseIcon as RotateCcw, TrashIcon as Trash2, } from '@phosphor-icons/react';
17
+ import { ArrowCounterClockwiseIcon as RotateCcw } from '@phosphor-icons/react';
64
18
  import { useEffect, useMemo, useRef, useState } from 'react';
65
19
  import { Badge } from '../../../../primitives/badge.js';
66
20
  import { Button } from '../../../../primitives/button.js';
67
21
  import { ConfirmDialog } from '../../../../primitives/confirm-dialog.js';
68
- import { Disclosure, DisclosureContent, DisclosureTrigger } from '../../../../primitives/disclosure.js';
69
- import Hint from '../../../../primitives/hint.js';
70
- import { Label } from '../../../../primitives/label.js';
71
- import Loading from '../../../../primitives/loading.js';
72
- import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from '../../../../primitives/select.js';
73
22
  import { Skeleton } from '../../../../primitives/skeleton.js';
74
23
  import { errorToast, successToast } from '../../../../primitives/toast.js';
75
- import { ModelSelector } from '../../../../session/models/model-selector.js';
76
- import { cn } from '../../../../internal/lib/utils.js';
77
- import { modelKeyToWire, qk, useGatewayRoutingPolicy, useModelDefaults, useProjectModelPickerCatalog, useProjectModels, wireToModelKey, } from '@kortix/sdk/react';
24
+ import { modelKeyToWire, qk, useGatewayRoutingPolicy, useModelDefaults, useProjectModelPickerCatalog, useProjectModels, } from '@kortix/sdk/react';
78
25
  import { useQueryClient } from '@tanstack/react-query';
79
26
  import { GenerationControlsPanel } from './generation-controls.js';
80
- const MAX_FALLBACKS = 8;
81
- const MAX_RULES = 20;
27
+ import { isSelectableModel, MAX_FALLBACKS, MAX_RULES, RoutingSaveBar, } from './routing-parts.js';
28
+ import { RoutingSentenceLayout } from './routing-sentence-layout.js';
29
+ export { moveFallback } from './routing-parts.js';
82
30
  export function fallbackModeForPolicy(fallback) {
83
31
  if (fallback === null)
84
32
  return 'inherit';
85
33
  return fallback.models.length === 0 ? 'disabled' : 'custom';
86
34
  }
87
- export function moveFallback(models, index, delta) {
88
- const target = index + delta;
89
- if (index < 0 || index >= models.length || target < 0 || target >= models.length) {
90
- return models;
91
- }
92
- const next = [...models];
93
- [next[index], next[target]] = [next[target], next[index]];
94
- return next;
95
- }
96
35
  export function validateRoutingDraft(draft, fallbackMode = fallbackModeForPolicy(draft.defaultFallback)) {
97
36
  const validateChain = (primary, models) => {
98
37
  if (models.length > MAX_FALLBACKS)
@@ -187,77 +126,6 @@ export function hasAdvancedRoutingConfig(policy) {
187
126
  return false;
188
127
  return Object.values(config).some((entry) => entry && Object.keys(entry).length > 0);
189
128
  }
190
- /**
191
- * One decision, one line: what it is on the left, the control on the right.
192
- *
193
- * The whole screen is a stack of these, so every control — mode select, model
194
- * picker, condition select, chain — starts at the same x. That is the entire
195
- * layout system here; there is no card, no panel and no nesting to hold, which
196
- * is what the four `bg-popover` boxes were doing.
197
- *
198
- * Column width, row padding, and gaps match `ProviderRow` in
199
- * `packages/ui/src/customize/providers/provider-connect.tsx` exactly (`13rem` label column,
200
- * `py-1.5` row, `gap-4` between columns) — same list-row rhythm the rest of
201
- * Customize already uses, not a lookalike with its own spacing.
202
- */
203
- function RoutingRow({ label, hint, children, align = 'center', }) {
204
- return (_jsxs("div", { className: cn('grid gap-1.5 py-1.5 sm:grid-cols-[minmax(0,13rem)_minmax(0,1fr)] sm:gap-4', align === 'start' ? 'sm:items-start' : 'sm:items-center'), children: [_jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "text-foreground text-sm", children: label }), hint ? _jsx("p", { className: "text-muted-foreground mt-0.5 text-xs text-pretty", children: hint }) : null] }), _jsx("div", { className: "min-w-0", children: children })] }));
205
- }
206
- function RoutingModelSelector({ value, models, onChange, disabled, unsetLabel = 'Choose model', exclude = [], }) {
207
- const excluded = new Set(exclude);
208
- const options = models.filter((model) => {
209
- const wire = modelKeyToWire(model);
210
- return !excluded.has(wire) || wire === value;
211
- });
212
- if (value && !options.some((model) => modelKeyToWire(model) === value)) {
213
- options.push({
214
- providerID: 'kortix',
215
- providerName: 'Kortix',
216
- modelID: value,
217
- modelName: value,
218
- });
219
- }
220
- return (_jsx(ModelSelector, { models: options, selectedModel: value ? wireToModelKey(value) : null, unsetLabel: unsetLabel, disabled: disabled, onSelect: (model) => onChange(model ? modelKeyToWire(model) : null) }));
221
- }
222
- /** Warns inline when the routing-policy preview reports a model's provider isn't connected. */
223
- function AvailabilityBadge({ available }) {
224
- const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
225
- if (available !== false)
226
- return null;
227
- return (_jsx(Hint, { label: tI18nComplete.raw('text7031306d3dd8'), children: _jsxs(Badge, { variant: "warning", size: "xs", className: "shrink-0 gap-1", children: [_jsx(AlertTriangle, { className: "size-3" }), tI18nComplete.raw('text0303e1824670')] }) }));
228
- }
229
- function ConditionSelect({ value, onChange, disabled, }) {
230
- const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
231
- return (_jsxs(Select, { value: value, onValueChange: (next) => onChange(next), disabled: disabled, children: [_jsx(SelectTrigger, { className: "w-40", size: "sm", "aria-label": tI18nComplete.raw('text5970362b52d5'), children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "transient", description: tI18nComplete.raw('text4b8a51b32252'), children: tI18nComplete.raw('text91721aa63069') }), _jsx(SelectItem, { value: "any-error", description: tI18nComplete.raw('textc1e4a1169ac8'), children: tI18nComplete.raw('text6e2097e246af') })] })] }));
232
- }
233
- /**
234
- * One fallback chain as plain lines — a numbered step per model, an add line,
235
- * and the condition the chain triggers on.
236
- *
237
- * Every step used to be a bordered `<li>` inside a bordered panel inside
238
- * (for a rule) another bordered block. A step carries one model and three
239
- * controls; it does not need a box of its own to say so, and forty pixels of
240
- * border per step is what made eight of them unreadable.
241
- */
242
- function ChainRows({ primary, chain, models, onChange, disabled, availability, }) {
243
- const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
244
- const taken = [primary ?? '', ...chain.models];
245
- const takenSet = new Set(taken);
246
- const canAdd = models.some((model) => !takenSet.has(modelKeyToWire(model)));
247
- return (_jsxs("div", { className: "flex flex-col gap-0.5", children: [chain.models.map((model, index) => (_jsxs("div", { className: "flex min-w-0 items-center gap-1", children: [_jsx("span", { className: "text-muted-foreground/60 w-4 shrink-0 text-xs tabular-nums", children: index + 1 }), _jsx("div", { className: "min-w-0 flex-1", children: _jsx(RoutingModelSelector, { value: model, models: models, exclude: [
248
- primary ?? '',
249
- ...chain.models.filter((_, itemIndex) => itemIndex !== index),
250
- ], onChange: (next) => {
251
- if (!next)
252
- return;
253
- const updated = [...chain.models];
254
- updated[index] = next;
255
- onChange({ ...chain, models: updated });
256
- }, disabled: disabled }) }), _jsx(AvailabilityBadge, { available: availability?.[model] }), _jsx(Hint, { label: tI18nComplete.raw('textc66feb5eb8f2'), children: _jsx(Button, { type: "button", size: "icon-sm", variant: "ghost", "aria-label": tI18nComplete.raw('textdfea74d6d58d'), disabled: disabled || index === 0, onClick: () => onChange({ ...chain, models: moveFallback(chain.models, index, -1) }), children: _jsx(ArrowUp, { className: "size-3.5" }) }) }), _jsx(Hint, { label: tI18nComplete.raw('text40bb50da160c'), children: _jsx(Button, { type: "button", size: "icon-sm", variant: "ghost", "aria-label": tI18nComplete.raw('text54e22a5335af'), disabled: disabled || index === chain.models.length - 1, onClick: () => onChange({ ...chain, models: moveFallback(chain.models, index, 1) }), children: _jsx(ArrowDown, { className: "size-3.5" }) }) }), _jsx(Hint, { label: tI18nComplete.raw('textc3812fc4acb8'), children: _jsx(Button, { type: "button", size: "icon-sm", variant: "ghost", "aria-label": tI18nComplete.raw('textb4e437b00de3'), disabled: disabled, onClick: () => onChange({
257
- ...chain,
258
- models: chain.models.filter((_, itemIndex) => itemIndex !== index),
259
- }), children: _jsx(Trash2, { className: "size-3.5" }) }) })] }, model))), !disabled ? (_jsxs("div", { className: "flex min-w-0 items-center gap-1", children: [_jsx(Plus, { className: "text-muted-foreground/60 ml-0.5 size-3 shrink-0" }), _jsx(RoutingModelSelector, { value: null, models: models, exclude: taken, unsetLabel: canAdd ? tI18nComplete.raw('text5b660045c015') : tI18nComplete.raw('text82e4b64f1673'), disabled: !canAdd || chain.models.length >= MAX_FALLBACKS, onChange: (next) => next && onChange({ ...chain, models: [...chain.models, next] }) })] })) : null, chain.models.length === 0 && disabled ? (_jsx("p", { className: "text-muted-foreground text-xs", children: tI18nComplete.raw('text545403adb9e5') })) : null, _jsxs("div", { className: "mt-1.5 flex items-center gap-2", children: [_jsx("span", { className: "text-muted-foreground shrink-0 text-xs", children: tI18nComplete.raw('textbb68ff20e011') }), _jsx(ConditionSelect, { value: chain.fallbackOn, onChange: (fallbackOn) => onChange({ ...chain, fallbackOn }), disabled: disabled })] })] }));
260
- }
261
129
  /**
262
130
  * Routing's heading band — a SECTION heading, in the page's own column.
263
131
  *
@@ -277,6 +145,7 @@ function RoutingSection({ action, children }) {
277
145
  }
278
146
  export function GatewayRouting({ projectId, canWrite, projectDefaultPending, }) {
279
147
  const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
148
+ const t = useTranslations('gatewayRouting');
280
149
  const queryClient = useQueryClient();
281
150
  const routing = useGatewayRoutingPolicy(projectId);
282
151
  const modelDefaults = useModelDefaults(projectId);
@@ -284,7 +153,6 @@ export function GatewayRouting({ projectId, canWrite, projectDefaultPending, })
284
153
  const pickerCatalog = useProjectModelPickerCatalog(projectId);
285
154
  const [draft, setDraft] = useState(null);
286
155
  const [fallbackMode, setFallbackMode] = useState('inherit');
287
- const [advancedOpen, setAdvancedOpen] = useState(false);
288
156
  const [resetOpen, setResetOpen] = useState(false);
289
157
  const [availability, setAvailability] = useState({});
290
158
  const [hydratedPolicySignature, setHydratedPolicySignature] = useState(null);
@@ -298,7 +166,6 @@ export function GatewayRouting({ projectId, canWrite, projectDefaultPending, })
298
166
  setHydratedPolicySignature(persistedSignature);
299
167
  setDraft(clonePolicy(persistedProject));
300
168
  setFallbackMode(fallbackModeForPolicy(persistedProject.defaultFallback));
301
- setAdvancedOpen((current) => current || hasAdvancedRoutingConfig(persistedProject));
302
169
  }
303
170
  const previewRoute = routing.preview.mutateAsync;
304
171
  // Debounced availability preview: whenever the draft's referenced models
@@ -387,7 +254,10 @@ export function GatewayRouting({ projectId, canWrite, projectDefaultPending, })
387
254
  rules: policy.rules,
388
255
  modelGenerationConfig: policy.modelGenerationConfig ?? {},
389
256
  });
390
- const dirty = JSON.stringify(editableState(draft)) !== JSON.stringify(editableState(routing.data.project));
257
+ // The mode counts too: "try backups" with an empty chain serializes like
258
+ // "show the error", but it is an unsaved (and invalid) choice.
259
+ const dirty = fallbackMode !== fallbackModeForPolicy(routing.data.project.defaultFallback) ||
260
+ JSON.stringify(editableState(draft)) !== JSON.stringify(editableState(routing.data.project));
391
261
  const projectDefaultWire = modelDefaults.projectDefault
392
262
  ? modelKeyToWire(modelDefaults.projectDefault)
393
263
  : null;
@@ -395,11 +265,12 @@ export function GatewayRouting({ projectId, canWrite, projectDefaultPending, })
395
265
  const validation = validateRoutingDraft({ ...draft, defaultModel: primaryModel }, fallbackMode);
396
266
  const usedRuleModels = draft.rules.map((rule) => rule.model);
397
267
  const usedRuleModelSet = new Set(usedRuleModels);
398
- const newRuleModel = models.find((model) => !usedRuleModelSet.has(modelKeyToWire(model)));
268
+ const selectableModels = models.filter(isSelectableModel);
269
+ const newRuleModel = selectableModels.find((model) => modelKeyToWire(model) !== primaryModel && !usedRuleModelSet.has(modelKeyToWire(model)));
399
270
  const inheritedRoute = [
400
271
  routing.data.effective.defaultModel,
401
272
  ...routing.data.effective.defaultFallback.models,
402
- ].join(' → ');
273
+ ];
403
274
  const setRule = (index, rule) => {
404
275
  setDraft((current) => {
405
276
  if (!current)
@@ -421,10 +292,11 @@ export function GatewayRouting({ projectId, canWrite, projectDefaultPending, })
421
292
  }
422
293
  if (current.defaultFallback?.models.length)
423
294
  return current;
424
- const inherited = routing.data.effective.defaultFallback.models.filter((model) => model !== primaryModel);
295
+ const runnable = new Set(selectableModels.map((model) => modelKeyToWire(model)));
296
+ const inherited = routing.data.effective.defaultFallback.models.filter((model) => model !== primaryModel && runnable.has(model));
425
297
  // No model id is hardcoded: the platform fallback already follows the
426
298
  // served lineup (`inherited`); otherwise take the first other model.
427
- const preferred = models.find((model) => modelKeyToWire(model) !== primaryModel);
299
+ const preferred = selectableModels.find((model) => modelKeyToWire(model) !== primaryModel);
428
300
  return {
429
301
  ...current,
430
302
  defaultFallback: {
@@ -438,56 +310,65 @@ export function GatewayRouting({ projectId, canWrite, projectDefaultPending, })
438
310
  };
439
311
  });
440
312
  };
441
- return (_jsxs(RoutingSection, { action: writable ? (_jsxs(Button, { type: "button", variant: "outline", size: "sm", disabled: controlsDisabled, onClick: () => setResetOpen(true), children: [_jsx(RotateCcw, { className: "size-3.5" }), " ", tI18nComplete.raw('textdaee7606b339')] })) : (_jsx(Badge, { variant: "muted", size: "sm", children: tI18nComplete.raw('text8ac767353080') })), children: [_jsxs("div", { className: "space-y-8", children: [_jsxs("section", { className: "space-y-1", children: [_jsx(Label, { className: "text-foreground", children: tI18nComplete.raw('text325e84939c64') }), _jsxs("div", { className: "flex flex-col", children: [_jsx(RoutingRow, { label: tI18nComplete.raw('text146b38e7fa80'), hint: tI18nComplete.raw('textd48d1b0dbdd6'), children: _jsxs(Select, { value: fallbackMode, disabled: controlsDisabled, onValueChange: (mode) => changeFallbackMode(mode), children: [_jsx(SelectTrigger, { className: "w-48 max-w-full", "aria-label": tI18nComplete.raw('textdf33a10e5579'), children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "inherit", children: tI18nComplete.raw('text975aa2ab538e') }), _jsx(SelectItem, { value: "custom", children: tI18nComplete.raw('texta913ec01bd04') }), _jsx(SelectItem, { value: "disabled", children: tI18nComplete.raw('text3822b0412ed7') })] })] }) }), fallbackMode === 'custom' && draft.defaultFallback ? (_jsx(RoutingRow, { align: "start", label: tI18nComplete.raw('texte75d99a42dba'), hint: tI18nComplete.raw('textc3ecd3cd791b'), children: _jsx("div", { className: "space-y-1.5", children: _jsx(ChainRows, { primary: primaryModel, chain: draft.defaultFallback, models: models, disabled: controlsDisabled, availability: availability, onChange: (defaultFallback) => setDraft({ ...draft, defaultFallback }) }) }) })) : fallbackMode === 'inherit' ? (_jsx(RoutingRow, { label: tI18nComplete.raw('text74a1a0f65906'), children: _jsx("p", { className: "text-muted-foreground truncate font-mono text-xs", children: inheritedRoute }) })) : (_jsx(RoutingRow, { label: tI18nComplete.raw('text0af465ef42c0'), children: _jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: tI18nComplete.raw('texta3df3f9e4422') }) }))] })] }), _jsxs("section", { className: "space-y-1", children: [_jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Label, { className: "text-foreground", children: tI18nComplete.raw('text5c63c15261bb') }), draft.rules.length > 0 ? (_jsx(Badge, { variant: "secondary", size: "sm", children: draft.rules.length })) : null] }), writable ? (_jsxs(Button, { type: "button", size: "sm", variant: "secondary", disabled: controlsDisabled || !newRuleModel || draft.rules.length >= MAX_RULES, onClick: () => newRuleModel &&
442
- setDraft({
443
- ...draft,
444
- rules: [
445
- ...draft.rules,
446
- {
447
- model: modelKeyToWire(newRuleModel),
448
- fallbackModels: [],
449
- fallbackOn: 'transient',
450
- },
451
- ],
452
- }), children: [_jsx(Plus, { className: "size-3.5 shrink-0" }), " ", tI18nComplete.raw('textfafc22c398f0')] })) : null] }), _jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: tI18nComplete.raw('text335e692111a5') }), draft.rules.length === 0 ? (_jsx("p", { className: "text-muted-foreground pt-3 text-xs", children: tI18nComplete.raw('textd4c5e9c25176') })) : (_jsx("div", { className: "flex flex-col", children: draft.rules.map((rule, index) => (_jsx(RoutingRow, { align: "start", label: _jsxs("div", { className: "flex min-w-0 items-center gap-1", children: [_jsx("div", { className: "min-w-0 flex-1", children: _jsx(RoutingModelSelector, { value: rule.model, models: models, exclude: usedRuleModels.filter((_, itemIndex) => itemIndex !== index), disabled: controlsDisabled, onChange: (model) => model && setRule(index, { ...rule, model }) }) }), writable ? (_jsx(Hint, { label: tI18nComplete.raw('text6d43eea1425f'), children: _jsx(Button, { type: "button", size: "icon-sm", variant: "ghost", "aria-label": tI18nComplete.raw('texta0e2582b4c3a'), disabled: controlsDisabled, onClick: () => setDraft({
453
- ...draft,
454
- rules: draft.rules.filter((_, itemIndex) => itemIndex !== index),
455
- }), children: _jsx(Trash2, { className: "size-3.5" }) }) })) : null] }), children: _jsxs("div", { className: "space-y-1.5", children: [_jsx(AvailabilityBadge, { available: availability[rule.model] }), _jsx(ChainRows, { primary: rule.model, chain: { models: rule.fallbackModels, fallbackOn: rule.fallbackOn }, models: models, disabled: controlsDisabled, availability: availability, onChange: (chain) => setRule(index, {
456
- ...rule,
457
- fallbackModels: chain.models,
458
- fallbackOn: chain.fallbackOn,
459
- }) })] }) }, rule.model))) }))] }), _jsxs(Disclosure, { open: advancedOpen, onOpenChange: setAdvancedOpen, children: [_jsx(DisclosureTrigger, { children: _jsxs("button", { type: "button", className: "text-muted-foreground hover:text-foreground -mx-1 flex cursor-pointer items-center gap-1.5 rounded-md px-1 py-1 text-xs font-medium transition-colors", children: [_jsx(CaretDownIcon, { className: cn('size-3.5 shrink-0 transition-transform', advancedOpen && 'rotate-180') }), tI18nComplete.raw('text9f088dbebd6c'), _jsx("span", { className: "text-muted-foreground/60 font-normal", children: tI18nComplete.raw('text022bfb219bea') })] }) }), _jsx(DisclosureContent, { children: _jsxs("div", { className: "space-y-8 pt-5", children: [_jsxs("section", { className: "space-y-1", children: [_jsx(Label, { children: tI18nComplete.raw('text0a15fd3848fa') }), _jsx("div", { className: "flex flex-col", children: _jsx(RoutingRow, { label: tI18nComplete.raw('text3efdd4ec1a82'), hint: draft.visionModel
460
- ? tI18nComplete.raw('textc916a6a191c1')
461
- : routing.data.effective.visionModel
462
- ? tI18nComplete('text8375520a8316', {
463
- value0: routing.data.effective.visionModel,
464
- })
465
- : tI18nComplete.raw('text59e7c0aa6df1'), children: _jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx(RoutingModelSelector, { value: draft.visionModel, models: models, disabled: controlsDisabled, unsetLabel: tI18nComplete.raw('text975aa2ab538e'), onChange: (visionModel) => setDraft({ ...draft, visionModel }) }), _jsx(AvailabilityBadge, { available: draft.visionModel ? availability[draft.visionModel] : undefined })] }) }) })] }), _jsxs("section", { className: "space-y-1", children: [_jsx(Label, { children: tI18nComplete.raw('textea942b85faac') }), _jsxs("p", { className: "text-muted-foreground text-xs text-pretty", children: [tI18nComplete.raw('text45583b07c7c8'), ' ', _jsx("span", { className: "font-mono", children: primaryModel }), ' ', tI18nComplete.raw('textb6b6f5c32995')] }), _jsx("div", { className: "pt-3", children: _jsx(GenerationControlsPanel, { model: primaryModel, catalogModel: pickerCatalog?.models?.[primaryModel], value: draft.modelGenerationConfig?.[primaryModel], disabled: controlsDisabled, onChange: (next) => setDraft({
466
- ...draft,
467
- modelGenerationConfig: {
468
- ...draft.modelGenerationConfig,
469
- [primaryModel]: next,
470
- },
471
- }) }) })] })] }) })] })] }), writable ? (_jsxs("div", { className: "bg-background/95 sticky bottom-0 -mx-4 mt-8 flex items-center justify-between gap-4 border-t px-4 py-4 backdrop-blur", children: [_jsx("div", { className: "text-muted-foreground text-xs", children: validation ??
472
- (dirty
473
- ? tI18nComplete.raw('texta710c2b90913')
474
- : tI18nComplete.raw('text634cfb4b6bfd')) }), _jsxs(Button, { type: "button", disabled: !dirty || !!validation || controlsDisabled, onClick: () => {
475
- const defaultModel = modelDefaults.data ? projectDefaultWire : draft.defaultModel;
476
- routing.set.mutate({ ...draft, defaultModel }, {
477
- onSuccess: async () => {
478
- await Promise.all([
479
- queryClient.invalidateQueries({ queryKey: ['model-defaults', projectId] }),
480
- queryClient.invalidateQueries({
481
- queryKey: qk.project.modelPicker(projectId),
482
- }),
483
- ]);
484
- successToast(tI18nComplete.raw('text538f96979be7'));
485
- },
486
- onError: (error) => errorToast(error instanceof Error
487
- ? error.message
488
- : tI18nComplete.raw('text4501be681694')),
489
- });
490
- }, children: [routing.set.isPending ? _jsx(Loading, { className: "size-4 shrink-0" }) : null, tI18nComplete.raw('text1509f561f241')] })] })) : null, _jsx(ConfirmDialog, { open: resetOpen, onOpenChange: setResetOpen, title: tI18nComplete.raw('text7918f9e61a56'), description: tI18nComplete.raw('textaf87e03f3626'), confirmLabel: tI18nComplete.raw('textf665e07f2a78'), confirmVariant: "destructive", isPending: routing.reset.isPending, onConfirm: () => routing.reset.mutate(undefined, {
313
+ const removeRule = (index) => setDraft({ ...draft, rules: draft.rules.filter((_, itemIndex) => itemIndex !== index) });
314
+ const addRule = newRuleModel && draft.rules.length < MAX_RULES
315
+ ? () => {
316
+ const model = modelKeyToWire(newRuleModel);
317
+ setDraft({
318
+ ...draft,
319
+ rules: [...draft.rules, { model, fallbackModels: [], fallbackOn: 'transient' }],
320
+ });
321
+ return model;
322
+ }
323
+ : null;
324
+ const generationControls = (_jsx(GenerationControlsPanel, { model: primaryModel, catalogModel: pickerCatalog?.models?.[primaryModel], value: draft.modelGenerationConfig?.[primaryModel], disabled: controlsDisabled, onChange: (next) => setDraft({
325
+ ...draft,
326
+ modelGenerationConfig: {
327
+ ...draft.modelGenerationConfig,
328
+ [primaryModel]: next,
329
+ },
330
+ }) }));
331
+ const layoutProps = {
332
+ draft,
333
+ setDraft,
334
+ setRule,
335
+ removeRule,
336
+ addRule,
337
+ fallbackMode,
338
+ changeFallbackMode,
339
+ models,
340
+ selectableModels,
341
+ availability,
342
+ primaryModel,
343
+ inheritedRoute,
344
+ inheritedFallbackOn: routing.data.effective.defaultFallback.fallbackOn,
345
+ // What "Auto" resolves to: the inherited model, not this project's own
346
+ // override (choosing Auto clears that override).
347
+ effectiveVisionModel: (routing.data.project.visionModel
348
+ ? routing.data.platform.visionModel
349
+ : routing.data.effective.visionModel) ?? null,
350
+ generationControls,
351
+ controlsDisabled,
352
+ writable: Boolean(writable),
353
+ };
354
+ return (_jsxs(RoutingSection, { action: writable ? (_jsxs(Button, { type: "button", variant: "outline", size: "sm", disabled: controlsDisabled, onClick: () => setResetOpen(true), children: [_jsx(RotateCcw, { className: "size-3.5" }), " ", tI18nComplete.raw('textdaee7606b339')] })) : (_jsx(Badge, { variant: "muted", size: "sm", children: tI18nComplete.raw('text8ac767353080') })), children: [_jsx(RoutingSentenceLayout, { ...layoutProps }), writable && (dirty || routing.set.isPending) ? (_jsx(RoutingSaveBar, { message: validation ?? t('unsaved'), saving: routing.set.isPending, canSave: dirty && !validation && !controlsDisabled, onDiscard: () => {
355
+ setDraft(clonePolicy(routing.data.project));
356
+ setFallbackMode(fallbackModeForPolicy(routing.data.project.defaultFallback));
357
+ }, onSave: () => {
358
+ const defaultModel = modelDefaults.data ? projectDefaultWire : draft.defaultModel;
359
+ routing.set.mutate({ ...draft, defaultModel }, {
360
+ onSuccess: async () => {
361
+ await Promise.all([
362
+ queryClient.invalidateQueries({ queryKey: ['model-defaults', projectId] }),
363
+ queryClient.invalidateQueries({
364
+ queryKey: qk.project.modelPicker(projectId),
365
+ }),
366
+ ]);
367
+ successToast(tI18nComplete.raw('text538f96979be7'));
368
+ },
369
+ onError: (error) => errorToast(error instanceof Error ? error.message : tI18nComplete.raw('text4501be681694')),
370
+ });
371
+ } })) : null, _jsx(ConfirmDialog, { open: resetOpen, onOpenChange: setResetOpen, title: tI18nComplete.raw('text7918f9e61a56'), description: tI18nComplete.raw('textaf87e03f3626'), confirmLabel: tI18nComplete.raw('textf665e07f2a78'), confirmVariant: "destructive", isPending: routing.reset.isPending, onConfirm: () => routing.reset.mutate(undefined, {
491
372
  onSuccess: () => {
492
373
  setResetOpen(false);
493
374
  void queryClient.invalidateQueries({ queryKey: ['model-defaults', projectId] });
@@ -0,0 +1,101 @@
1
+ import { type ComponentProps, type ReactNode } from 'react';
2
+ import { Button } from '../../../../primitives/button.js';
3
+ import type { GatewayFallbackChain, GatewayProjectRoutingPolicy, GatewayRoutingRule } from '@kortix/sdk';
4
+ import { useProjectModels } from '@kortix/sdk/react';
5
+ export declare const MAX_FALLBACKS = 8;
6
+ export declare const MAX_RULES = 20;
7
+ export type FallbackMode = 'inherit' | 'custom' | 'disabled';
8
+ export type RoutingModel = ReturnType<typeof useProjectModels>[number];
9
+ /**
10
+ * Everything the Routing layout reads and writes. The state lives in
11
+ * `GatewayRouting`; the layout is a pure view over it.
12
+ */
13
+ export interface RoutingLayoutProps {
14
+ draft: GatewayProjectRoutingPolicy;
15
+ setDraft: (draft: GatewayProjectRoutingPolicy) => void;
16
+ setRule: (index: number, rule: GatewayRoutingRule) => void;
17
+ removeRule: (index: number) => void;
18
+ /** Adds a rule for the first runnable model without one. `null` when none is left or the cap is hit. */
19
+ addRule: (() => string) | null;
20
+ fallbackMode: FallbackMode;
21
+ changeFallbackMode: (mode: FallbackMode) => void;
22
+ /** Every model the draft can name, including ones that are no longer runnable. */
23
+ models: RoutingModel[];
24
+ /** The models a person may pick: offered by the project and runnable for the caller. */
25
+ selectableModels: RoutingModel[];
26
+ availability: Record<string, boolean>;
27
+ primaryModel: string;
28
+ /** The platform route this project inherits: primary first. */
29
+ inheritedRoute: string[];
30
+ /** The condition the inherited route switches on. */
31
+ inheritedFallbackOn: GatewayFallbackChain['fallbackOn'];
32
+ effectiveVisionModel: string | null;
33
+ /** Generation controls for the primary model, rendered by the host. */
34
+ generationControls: ReactNode;
35
+ controlsDisabled: boolean;
36
+ writable: boolean;
37
+ }
38
+ /**
39
+ * A model the project can choose: the project offers it (`enabled`) and its
40
+ * provider is connected for the caller (`available`). Undefined means the
41
+ * catalog does not say, which counts as yes.
42
+ */
43
+ export declare function isSelectableModel(model: RoutingModel): boolean;
44
+ export declare function findModel(models: RoutingModel[], wire: string | null): RoutingModel | undefined;
45
+ /** A model's display name for a wire id, falling back to the id. */
46
+ export declare function modelLabel(models: RoutingModel[], wire: string | null): string;
47
+ export declare function moveFallback(models: string[], index: number, delta: -1 | 1): string[];
48
+ /**
49
+ * A model in a sentence: provider logo and name, read-only or removable.
50
+ * The same pill shape the pickers use, so a chain reads as one row of things.
51
+ */
52
+ export declare function ModelChip({ wire, models, unavailable, onRemove, }: {
53
+ wire: string;
54
+ models: RoutingModel[];
55
+ unavailable?: boolean;
56
+ onRemove?: () => void;
57
+ }): import("react").JSX.Element;
58
+ /**
59
+ * Searchable model list in a popover. `multiple` keeps the popover open and
60
+ * numbers the picked models in pick order, so a whole backup chain is built
61
+ * in one visit; single mode closes on pick. `leading` is an extra first row
62
+ * (for example "Auto").
63
+ */
64
+ export declare function ModelPicker({ models, selected, onToggle, multiple, exclude, trigger, leading, disabled, }: {
65
+ models: RoutingModel[];
66
+ /** Picked wire ids, in order. */
67
+ selected: string[];
68
+ onToggle: (wire: string) => void;
69
+ multiple?: boolean;
70
+ exclude?: string[];
71
+ trigger: ReactNode;
72
+ leading?: {
73
+ label: string;
74
+ active: boolean;
75
+ onSelect: () => void;
76
+ };
77
+ disabled?: boolean;
78
+ }): import("react").JSX.Element;
79
+ /** A picker trigger that shows the chosen model as a chip with a caret. */
80
+ export declare function ModelPickerButton({ wire, models, placeholder, unavailable, className, ...props }: {
81
+ wire: string | null;
82
+ models: RoutingModel[];
83
+ placeholder: string;
84
+ unavailable?: boolean;
85
+ } & ComponentProps<typeof Button>): import("react").JSX.Element;
86
+ /** The dashed "+" that opens the multi-select backup picker. */
87
+ export declare function AddModelButton({ label, className, ...props }: {
88
+ label: string;
89
+ } & ComponentProps<typeof Button>): import("react").JSX.Element;
90
+ export declare function ConditionSelect({ value, onChange, disabled, }: {
91
+ value: GatewayFallbackChain['fallbackOn'];
92
+ onChange: (value: GatewayFallbackChain['fallbackOn']) => void;
93
+ disabled?: boolean;
94
+ }): import("react").JSX.Element;
95
+ export declare function RoutingSaveBar({ message, saving, canSave, onDiscard, onSave, }: {
96
+ message: string;
97
+ saving: boolean;
98
+ canSave: boolean;
99
+ onDiscard: () => void;
100
+ onSave: () => void;
101
+ }): import("react").JSX.Element;