@kortix/ui 0.15.2 → 0.15.4

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 (455) hide show
  1. package/dist/_vendor/kortix-shared.js +243 -30
  2. package/dist/_vendor/shared/channel-descriptors.d.ts +1 -1
  3. package/dist/_vendor/shared/index.d.ts +1 -0
  4. package/dist/_vendor/shared/markdown-math.d.ts +6 -0
  5. package/dist/_vendor/shared/workspace-actions.d.ts +155 -0
  6. package/dist/_vendor/shared/workspace-settings.d.ts +62 -0
  7. package/dist/access/access/access-dialog-share.js +6 -6
  8. package/dist/access/access/access-dialog.d.ts +44 -1
  9. package/dist/access/access/access-dialog.js +8 -8
  10. package/dist/access/access/agent-principals.d.ts +3 -3
  11. package/dist/access/access/agent-principals.js +5 -4
  12. package/dist/access/access/invite-people-dialog.d.ts +37 -0
  13. package/dist/access/access/invite-people-dialog.js +140 -0
  14. package/dist/access/access/principal-picker.js +3 -2
  15. package/dist/access/access/project-select.js +2 -2
  16. package/dist/access/access/role-select.d.ts +9 -8
  17. package/dist/access/access/role-select.js +22 -25
  18. package/dist/access/access/workspace-role-dialog.d.ts +27 -0
  19. package/dist/access/access/workspace-role-dialog.js +48 -0
  20. package/dist/access/iam/add-github-account-dialog.d.ts +1 -1
  21. package/dist/access/iam/add-github-account-dialog.js +1 -1
  22. package/dist/access/iam/api-key-expiry.d.ts +18 -0
  23. package/dist/access/iam/api-key-expiry.js +47 -0
  24. package/dist/access/iam/api-key-rows.d.ts +6 -0
  25. package/dist/access/iam/api-key-rows.js +3 -0
  26. package/dist/access/iam/workspace-key-acts-as.d.ts +41 -0
  27. package/dist/access/iam/workspace-key-acts-as.js +48 -0
  28. package/dist/access/sharing-intent.js +1 -1
  29. package/dist/access/sharing-picker.js +1 -1
  30. package/dist/animated-copy-icon.d.ts +2 -2
  31. package/dist/animated-copy-icon.js +7 -4
  32. package/dist/apps/app-shared.js +2 -2
  33. package/dist/artifacts/artifact-session.js +1 -1
  34. package/dist/customize/agents/agent-drives-section.d.ts +1 -3
  35. package/dist/customize/agents/agent-drives-section.js +5 -6
  36. package/dist/customize/agents/agent-page-chrome.js +1 -1
  37. package/dist/customize/agents/agent-page.js +6 -7
  38. package/dist/customize/agents/agent-tabs.d.ts +1 -1
  39. package/dist/customize/agents/agent-tabs.js +1 -2
  40. package/dist/customize/agents/agents-page.js +2 -3
  41. package/dist/customize/connectors/connector-identity.d.ts +1 -1
  42. package/dist/customize/connectors/connector-identity.js +1 -1
  43. package/dist/customize/connectors/connector-moves-banner.js +2 -2
  44. package/dist/customize/connectors/connectors-page.d.ts +10 -2
  45. package/dist/customize/connectors/connectors-page.js +38 -5
  46. package/dist/customize/connectors/detail/app-page.js +1 -1
  47. package/dist/customize/connectors/detail/connector-page.d.ts +1 -1
  48. package/dist/customize/connectors/detail/connector-page.js +1 -1
  49. package/dist/customize/connectors/detail/connector-policy-sets.js +2 -2
  50. package/dist/customize/connectors/detail/connector-tools.js +7 -7
  51. package/dist/customize/connectors/detail/connector-triggers.js +2 -3
  52. package/dist/customize/connectors/detail/email-inboxes.js +2 -2
  53. package/dist/customize/models/models-page.d.ts +1 -1
  54. package/dist/customize/models/models-page.js +1 -1
  55. package/dist/customize/project-settings/project-admin-sections.d.ts +53 -17
  56. package/dist/customize/project-settings/project-admin-sections.js +80 -31
  57. package/dist/customize/project-settings/project-settings-page.d.ts +2 -2
  58. package/dist/customize/project-settings/project-settings-page.js +6 -4
  59. package/dist/customize/project-settings/project-settings-sections.d.ts +2 -3
  60. package/dist/customize/project-settings/project-settings-sections.js +9 -4
  61. package/dist/customize/providers/provider-accordion.d.ts +3 -1
  62. package/dist/customize/providers/provider-accordion.js +2 -2
  63. package/dist/customize/secrets/secrets-page.d.ts +1 -1
  64. package/dist/customize/secrets/secrets-page.js +1 -1
  65. package/dist/customize/sections/component/email-connect-form.js +2 -2
  66. package/dist/customize/sections/component/slack-byo-wizard.js +3 -3
  67. package/dist/customize/sections/connectors-view.js +17 -17
  68. package/dist/customize/sections/gateway-view.d.ts +7 -5
  69. package/dist/customize/sections/gateway-view.js +28 -17
  70. package/dist/customize/sections/llm-provider/chatgpt-subscription-connect.js +2 -2
  71. package/dist/customize/sections/llm-provider/custom-provider-form.js +2 -2
  72. package/dist/customize/sections/llm-provider/llm-provider-modal.d.ts +1 -1
  73. package/dist/customize/sections/llm-provider/llm-provider-modal.js +4 -4
  74. package/dist/customize/sections/llm-provider/models-tab-row.js +5 -3
  75. package/dist/customize/sections/llm-provider/types.d.ts +2 -0
  76. package/dist/customize/sections/view/agent-editor-access-fields.js +1 -3
  77. package/dist/customize/sections/view/agent-editor-catalog.d.ts +5 -6
  78. package/dist/customize/sections/view/agent-editor-catalog.js +33 -14
  79. package/dist/customize/sections/view/agent-editor.js +1 -1
  80. package/dist/customize/sections/view/channels-view.js +13 -13
  81. package/dist/customize/sections/view/gateway/gateway-budgets.js +12 -10
  82. package/dist/customize/sections/view/gateway/gateway-logs.d.ts +1 -1
  83. package/dist/customize/sections/view/gateway/gateway-logs.js +3 -3
  84. package/dist/customize/sections/view/gateway/gateway-overview.js +1 -1
  85. package/dist/customize/sections/view/gateway/gateway-routing.js +1 -1
  86. package/dist/customize/sections/view/git-view.js +3 -3
  87. package/dist/customize/sections/view/grant-mode-field.js +2 -2
  88. package/dist/customize/sections/view/review-center-connected.js +1 -1
  89. package/dist/customize/sections/view/review-view.d.ts +0 -15
  90. package/dist/customize/sections/view/review-view.js +1 -23
  91. package/dist/customize/sections/view/secret-delivery.js +2 -2
  92. package/dist/customize/sections/view/secrets-view.js +16 -16
  93. package/dist/customize/sections/view/subscription-usage-tab.d.ts +12 -1
  94. package/dist/customize/sections/view/subscription-usage-tab.js +71 -72
  95. package/dist/customize/settings/rail-copy-context.js +1 -1
  96. package/dist/customize/settings/rail.d.ts +1 -1
  97. package/dist/customize/settings/rail.js +11 -18
  98. package/dist/customize/settings/settings-tab-header.d.ts +1 -1
  99. package/dist/customize/settings/settings-tab-header.js +1 -1
  100. package/dist/customize/settings/settings-tabs.d.ts +5 -12
  101. package/dist/customize/settings/settings-tabs.js +31 -44
  102. package/dist/customize/settings/tabs/experimental-tab.js +4 -4
  103. package/dist/customize/settings/tabs/general-tab.d.ts +29 -11
  104. package/dist/customize/settings/tabs/general-tab.js +55 -25
  105. package/dist/customize/settings/tabs/project-edit-patch.d.ts +0 -13
  106. package/dist/customize/settings/tabs/project-edit-patch.js +0 -28
  107. package/dist/customize/settings/tabs/sandbox-tab.js +2 -2
  108. package/dist/customize/settings/tabs/tokens-tab.d.ts +32 -2
  109. package/dist/customize/settings/tabs/tokens-tab.js +157 -32
  110. package/dist/customize/settings/tabs/workspace-keys.d.ts +6 -0
  111. package/dist/customize/settings/tabs/workspace-keys.js +240 -0
  112. package/dist/customize/shared/capability-library.js +3 -1
  113. package/dist/customize/shared/catalog/catalog-space-tabs.js +2 -2
  114. package/dist/customize/shared/customize-tab-bar.d.ts +6 -2
  115. package/dist/customize/shared/customize-tab-bar.js +36 -35
  116. package/dist/customize/shared/standalone-settings-nav.js +2 -2
  117. package/dist/customize/triggers/schedule/schedule-copy.d.ts +1 -1
  118. package/dist/customize/triggers/schedule/trigger-composer.js +5 -6
  119. package/dist/customize/triggers/schedule/trigger-list.js +2 -2
  120. package/dist/customize/triggers/schedule/trigger-session-access-copy.d.ts +6 -6
  121. package/dist/customize/triggers/schedule/trigger-session-access-copy.js +3 -3
  122. package/dist/customize/triggers/schedule/when-event.js +4 -4
  123. package/dist/customize/triggers/schedule/when-webhook-address.js +2 -2
  124. package/dist/customize/triggers/schedule/when-webhook.js +2 -2
  125. package/dist/customize/triggers/schedule-view.js +4 -5
  126. package/dist/customize/triggers/triggers-page.d.ts +1 -1
  127. package/dist/customize/triggers/triggers-page.js +1 -1
  128. package/dist/files/drives/drive-storage.d.ts +2 -2
  129. package/dist/files/drives/drive-storage.js +13 -6
  130. package/dist/files/project/components/change-request-detail-dialog.js +6 -6
  131. package/dist/files/project/components/change-requests-panel.js +2 -2
  132. package/dist/files/project/components/diff-preview-banner.d.ts +1 -1
  133. package/dist/files/project/components/diff-preview-banner.js +1 -1
  134. package/dist/files/project/components/drive-explorer.js +64 -43
  135. package/dist/files/project/components/drive-grid-view.js +1 -1
  136. package/dist/files/project/components/drive-list-view.js +1 -1
  137. package/dist/files/project/components/drive-upload-tray.d.ts +2 -1
  138. package/dist/files/project/components/drive-upload-tray.js +9 -4
  139. package/dist/files/project/context.d.ts +1 -1
  140. package/dist/files/project/context.js +1 -1
  141. package/dist/files/project/drop-tree.d.ts +16 -0
  142. package/dist/files/project/drop-tree.js +39 -0
  143. package/dist/files/project/upload-batch.d.ts +15 -0
  144. package/dist/files/project/upload-batch.js +12 -0
  145. package/dist/files/renderers/image-renderer.js +1 -1
  146. package/dist/files/runtime/hooks/use-binary-blob.js +12 -2
  147. package/dist/files/runtime/hooks/use-file-content.js +18 -2
  148. package/dist/files/viewer/file-content-renderer.js +2 -2
  149. package/dist/files/viewer/preview-fit.d.ts +1 -1
  150. package/dist/files/viewer/preview-fit.js +1 -1
  151. package/dist/i18n/en.d.ts +317 -31
  152. package/dist/i18n/en.js +882 -596
  153. package/dist/i18n/ui-catalog/account-hub-translation-keys.generated.js +9 -9
  154. package/dist/i18n/ui-catalog/app-registry-translation-keys.generated.js +12 -6
  155. package/dist/i18n/ui-catalog/product-catalog-translation-keys.generated.js +5 -5
  156. package/dist/i18n/ui-catalog/remaining-ui-translation-keys.generated.js +67 -60
  157. package/dist/icons/index.d.ts +1 -0
  158. package/dist/icons/index.js +1 -0
  159. package/dist/icons/solid-right-arrow.d.ts +8 -0
  160. package/dist/icons/solid-right-arrow.js +11 -0
  161. package/dist/index.d.ts +1 -1
  162. package/dist/index.js +1 -1
  163. package/dist/internal/account-hub/account-hub-entry.js +9 -8
  164. package/dist/internal/account-hub/account-hub-location.d.ts +20 -3
  165. package/dist/internal/account-hub/account-hub-location.js +16 -7
  166. package/dist/internal/account-hub/hub-sheet.d.ts +1 -1
  167. package/dist/internal/account-hub/hub-sheet.js +1 -1
  168. package/dist/internal/account-hub/sections.d.ts +2 -2
  169. package/dist/internal/account-hub/sections.js +10 -10
  170. package/dist/internal/account-hub/use-account-hub-access.d.ts +2 -0
  171. package/dist/internal/account-hub/use-account-hub-access.js +13 -5
  172. package/dist/internal/account-hub/workspace-settings-route.d.ts +27 -0
  173. package/dist/internal/account-hub/workspace-settings-route.js +51 -0
  174. package/dist/internal/billing/use-cost-explorer.d.ts +19 -1
  175. package/dist/internal/billing/use-cost-explorer.js +27 -1
  176. package/dist/internal/components/nav-rail.d.ts +3 -1
  177. package/dist/internal/components/nav-rail.js +2 -0
  178. package/dist/internal/components/repository-disconnected.js +2 -2
  179. package/dist/internal/desktop/desktop-back-button.d.ts +1 -1
  180. package/dist/internal/files/file-read-retry.d.ts +13 -0
  181. package/dist/internal/files/file-read-retry.js +53 -1
  182. package/dist/internal/goals/goal-meta.d.ts +2 -1
  183. package/dist/internal/goals/goal-meta.js +4 -2
  184. package/dist/internal/hooks/account/use-accounts-list.d.ts +2 -12
  185. package/dist/internal/hooks/account/use-accounts-list.js +1 -14
  186. package/dist/internal/hooks/account/use-my-invites.d.ts +1 -1
  187. package/dist/internal/hooks/account/use-my-invites.js +1 -1
  188. package/dist/internal/hooks/use-review-session-summary.d.ts +7 -0
  189. package/dist/internal/hooks/use-review-session-summary.js +12 -1
  190. package/dist/internal/layout/project-capability-nav.d.ts +6 -17
  191. package/dist/internal/layout/project-capability-nav.js +7 -79
  192. package/dist/internal/layout/project-settings-nav.d.ts +2 -2
  193. package/dist/internal/layout/project-settings-nav.js +3 -3
  194. package/dist/internal/lib/billing/billing-gate-state.d.ts +10 -0
  195. package/dist/internal/lib/billing/billing-gate-state.js +20 -3
  196. package/dist/internal/lib/browser-error-noise.d.ts +1 -1
  197. package/dist/internal/lib/browser-error-noise.js +1 -1
  198. package/dist/internal/lib/browser-noise/rules/expected-states.js +2 -3
  199. package/dist/internal/lib/browser-noise/rules/extensions.js +18 -0
  200. package/dist/internal/lib/browser-noise/rules/injected-scripts.d.ts +5 -1
  201. package/dist/internal/lib/browser-noise/rules/injected-scripts.js +141 -5
  202. package/dist/internal/lib/capability-tab-routes.d.ts +16 -40
  203. package/dist/internal/lib/capability-tab-routes.js +25 -54
  204. package/dist/internal/lib/desktop.d.ts +1 -1
  205. package/dist/internal/lib/desktop.js +1 -1
  206. package/dist/internal/lib/github-installations.d.ts +1 -1
  207. package/dist/internal/lib/github-installations.js +1 -1
  208. package/dist/internal/lib/mermaid-utils.js +2 -24
  209. package/dist/internal/lib/model-pricing.js +1 -1
  210. package/dist/internal/lib/navigation/session-href.d.ts +1 -1
  211. package/dist/internal/lib/navigation/session-href.js +1 -1
  212. package/dist/internal/lib/onboarding/landing-destination.d.ts +12 -4
  213. package/dist/internal/lib/onboarding/landing-destination.js +17 -5
  214. package/dist/internal/lib/onboarding/last-project-cookie.d.ts +1 -1
  215. package/dist/internal/lib/onboarding/last-project-cookie.js +1 -1
  216. package/dist/internal/lib/project-actions.d.ts +1 -4
  217. package/dist/internal/lib/project-actions.js +2 -5
  218. package/dist/internal/lib/provider-branding.js +11 -3
  219. package/dist/internal/lib/use-project-can.d.ts +1 -3
  220. package/dist/internal/lib/use-project-can.js +0 -5
  221. package/dist/internal/lib/web-notifications.js +5 -5
  222. package/dist/internal/notifications/notification-inbox.d.ts +8 -2
  223. package/dist/internal/notifications/notification-inbox.js +8 -5
  224. package/dist/internal/notifications/use-inbox-summary.d.ts +8 -4
  225. package/dist/internal/notifications/use-inbox-summary.js +12 -6
  226. package/dist/internal/reminders/use-refetch-after-fire.d.ts +0 -2
  227. package/dist/internal/reminders/use-refetch-after-fire.js +1 -10
  228. package/dist/internal/stores/account-panel-store.d.ts +17 -1
  229. package/dist/internal/stores/account-panel-store.js +19 -2
  230. package/dist/internal/stores/project-switch-store.d.ts +2 -2
  231. package/dist/internal/stores/project-switch-store.js +4 -4
  232. package/dist/internal/stores/settings-panel-store.d.ts +6 -0
  233. package/dist/internal/stores/settings-panel-store.js +4 -1
  234. package/dist/internal/stores/workspace-settings-rail-store.d.ts +67 -0
  235. package/dist/internal/stores/workspace-settings-rail-store.js +11 -0
  236. package/dist/lib/routes.js +19 -18
  237. package/dist/lib/z-stack.d.ts +7 -0
  238. package/dist/lib/z-stack.js +13 -0
  239. package/dist/markdown/copy-button.d.ts +2 -2
  240. package/dist/markdown/copy-button.js +22 -20
  241. package/dist/markdown/setup-links/setup-link-button.js +1 -1
  242. package/dist/primitives/emoji-tint.d.ts +1 -1
  243. package/dist/primitives/emoji-tint.js +1 -1
  244. package/dist/primitives/error-state.js +8 -1
  245. package/dist/primitives/inline-meta.d.ts +12 -1
  246. package/dist/primitives/inline-meta.js +38 -5
  247. package/dist/primitives/mermaid-render.js +3 -20
  248. package/dist/primitives/page-search-bar.js +6 -6
  249. package/dist/primitives/section.d.ts +3 -3
  250. package/dist/primitives/section.js +9 -9
  251. package/dist/primitives/status.d.ts +5 -5
  252. package/dist/primitives/status.js +33 -33
  253. package/dist/primitives/tabs.d.ts +14 -26
  254. package/dist/primitives/tabs.js +103 -105
  255. package/dist/primitives/tag.d.ts +1 -1
  256. package/dist/primitives/toast.d.ts +6 -6
  257. package/dist/primitives/toast.js +55 -48
  258. package/dist/providers/session-ids.d.ts +1 -1
  259. package/dist/providers/ui-provider.d.ts +2 -0
  260. package/dist/session/agents/agent-strip.js +6 -6
  261. package/dist/session/agents/subagent-dialog-content.js +3 -4
  262. package/dist/session/agents/workflow-run-controls.d.ts +0 -2
  263. package/dist/session/agents/workflow-run-controls.js +1 -12
  264. package/dist/session/composer/ComposerCard.d.ts +1 -1
  265. package/dist/session/composer/ComposerCard.js +2 -2
  266. package/dist/session/composer/animated-placeholder.js +1 -1
  267. package/dist/session/composer/chat-input/chat-input-control.js +1 -8
  268. package/dist/session/composer/composer-chat-input.d.ts +14 -1
  269. package/dist/session/composer/composer-chat-input.js +4 -2
  270. package/dist/session/composer/composer-toolbar.d.ts +22 -17
  271. package/dist/session/composer/composer-toolbar.js +12 -3
  272. package/dist/session/composer/composer.d.ts +8 -0
  273. package/dist/session/composer/composer.js +5 -13
  274. package/dist/session/composer/reasoning-effort-selector.d.ts +21 -0
  275. package/dist/session/composer/reasoning-effort-selector.js +46 -1
  276. package/dist/session/composer/send-stop-control.d.ts +15 -1
  277. package/dist/session/composer/send-stop-control.js +30 -5
  278. package/dist/session/header/session-embed-menu-item.d.ts +12 -0
  279. package/dist/session/header/session-embed-menu-item.js +30 -0
  280. package/dist/{workspace/sidebar/modal/session-embed-section.d.ts → session/header/session-embed-snippet.d.ts} +2 -11
  281. package/dist/session/header/session-embed-snippet.js +21 -0
  282. package/dist/session/header/session-goal-indicator.js +2 -3
  283. package/dist/session/header/session-reminders-indicator.js +3 -3
  284. package/dist/session/header/session-site-header.js +10 -3
  285. package/dist/session/index.d.ts +1 -1
  286. package/dist/session/models/ask-owner-for-credits-button.d.ts +7 -1
  287. package/dist/session/models/ask-owner-for-credits-button.js +3 -2
  288. package/dist/session/models/model-availability.d.ts +11 -0
  289. package/dist/session/models/model-availability.js +12 -0
  290. package/dist/session/models/model-connection-gate.d.ts +11 -26
  291. package/dist/session/models/model-connection-gate.js +22 -35
  292. package/dist/session/models/model-grouping.d.ts +30 -0
  293. package/dist/session/models/model-grouping.js +46 -0
  294. package/dist/session/models/model-picker-panel.d.ts +62 -0
  295. package/dist/session/models/model-picker-panel.js +181 -0
  296. package/dist/session/models/model-selector.d.ts +28 -4
  297. package/dist/session/models/model-selector.js +59 -15
  298. package/dist/session/models/model-tags.d.ts +4 -8
  299. package/dist/session/models/model-tags.js +20 -13
  300. package/dist/session/models/subscription-offer.d.ts +35 -0
  301. package/dist/session/models/subscription-offer.js +91 -0
  302. package/dist/session/models/use-model-connection-gate.d.ts +3 -3
  303. package/dist/session/models/use-model-connection-gate.js +8 -6
  304. package/dist/session/overrides/session-overrides-toolbar.js +8 -5
  305. package/dist/session/panel/open-session-quick-view.js +1 -1
  306. package/dist/session/panel/session-detail-panel.js +5 -1
  307. package/dist/session/panel/session-panel-provider.js +2 -2
  308. package/dist/session/panel/session-reminders-panel.js +2 -2
  309. package/dist/session/panel/shared/use-panel-derivations.d.ts +1 -0
  310. package/dist/session/panel/shared/use-panel-derivations.js +1 -1
  311. package/dist/session/panel/shared/use-panel-handoffs.d.ts +2 -2
  312. package/dist/session/panel/shared/use-panel-handoffs.js +22 -3
  313. package/dist/session/panel/use-session-panel-state.js +1 -1
  314. package/dist/session/prompts/ask-deck.d.ts +5 -3
  315. package/dist/session/prompts/ask-deck.js +30 -10
  316. package/dist/session/prompts/session-access-prompt.d.ts +61 -0
  317. package/dist/session/prompts/session-access-prompt.js +88 -0
  318. package/dist/session/prompts/session-permission-prompt.js +1 -1
  319. package/dist/session/scope/session-scope-control.js +2 -2
  320. package/dist/session/status/session-notice-banner.js +3 -3
  321. package/dist/session/status/session-route-prefetch.d.ts +2 -2
  322. package/dist/session/thread/optimistic-turn.js +1 -1
  323. package/dist/session/thread/session-chat.js +51 -19
  324. package/dist/session/thread/session-context-message-explorer.js +2 -2
  325. package/dist/session/thread/session-history.js +3 -3
  326. package/dist/session/tool/render-static.d.ts +11 -0
  327. package/dist/session/tool/render-static.js +16 -0
  328. package/dist/session/tool/shared/session-helpers.js +2 -2
  329. package/dist/session/tool/tool-part-renderer.d.ts +6 -1
  330. package/dist/session/tool/tool-part-renderer.js +9 -5
  331. package/dist/session/tool/tools/kortix-action-tool.js +4 -25
  332. package/dist/session/tool/tools/task-tool.js +9 -2
  333. package/dist/session/tool/tools/workflow-run-card.js +5 -1
  334. package/dist/session/tool/tools/workflow-tool.js +3 -14
  335. package/dist/session/turn/user-message.js +1 -1
  336. package/dist/session/voice/composer-call.d.ts +31 -0
  337. package/dist/session/voice/composer-call.js +46 -0
  338. package/dist/session/voice/voice-call-card.js +2 -0
  339. package/dist/session/voice/voice-call-store.d.ts +8 -0
  340. package/dist/session/voice/voice-call-store.js +5 -0
  341. package/dist/session/voice/voice-call.d.ts +2 -2
  342. package/dist/session/voice/voice-call.js +6 -6
  343. package/dist/styles.css +1 -1
  344. package/dist/test-utils/intl.d.ts +10103 -0
  345. package/dist/test-utils/intl.js +27 -0
  346. package/dist/test-utils/strip-tags.d.ts +24 -0
  347. package/dist/test-utils/strip-tags.js +32 -0
  348. package/dist/workspace/admin/project-admin-dashboard.d.ts +51 -33
  349. package/dist/workspace/admin/project-admin-dashboard.js +269 -81
  350. package/dist/workspace/admin/settings-search-landing.d.ts +11 -0
  351. package/dist/workspace/admin/settings-search-landing.js +103 -0
  352. package/dist/workspace/admin/settings-search.d.ts +69 -0
  353. package/dist/workspace/admin/settings-search.js +393 -0
  354. package/dist/workspace/home/existing-repo-setup-prompt.d.ts +22 -0
  355. package/dist/workspace/home/existing-repo-setup-prompt.js +57 -0
  356. package/dist/workspace/home/no-agent-home.d.ts +25 -0
  357. package/dist/workspace/home/no-agent-home.js +44 -0
  358. package/dist/workspace/home/welcome-body.js +2 -1
  359. package/dist/workspace/inbox/workspace-inbox.d.ts +21 -0
  360. package/dist/workspace/inbox/workspace-inbox.js +52 -0
  361. package/dist/workspace/instant-session-shell.js +11 -1
  362. package/dist/workspace/layout/project-files-view.js +1 -1
  363. package/dist/workspace/layout/project-home.js +84 -11
  364. package/dist/workspace/layout/use-project-home-call.d.ts +24 -0
  365. package/dist/workspace/layout/use-project-home-call.js +56 -0
  366. package/dist/workspace/memory/memory-body.js +2 -2
  367. package/dist/workspace/new/account-param.d.ts +1 -1
  368. package/dist/workspace/new/account-param.js +4 -4
  369. package/dist/workspace/new/advanced-fields.js +3 -3
  370. package/dist/workspace/new/clone-param.d.ts +1 -1
  371. package/dist/workspace/new/clone-param.js +1 -1
  372. package/dist/workspace/new/create-workspace-key.js +1 -1
  373. package/dist/workspace/new/github-source.d.ts +6 -6
  374. package/dist/workspace/new/github-source.js +6 -6
  375. package/dist/workspace/new/new-workspace-form.d.ts +11 -141
  376. package/dist/workspace/new/new-workspace-form.js +9 -195
  377. package/dist/workspace/new/provision-new-workspace.d.ts +14 -0
  378. package/dist/workspace/new/provision-new-workspace.js +14 -0
  379. package/dist/workspace/new/repository-options.d.ts +2 -2
  380. package/dist/workspace/new/repository-options.js +2 -2
  381. package/dist/workspace/new/source-param.d.ts +2 -2
  382. package/dist/workspace/new/source-param.js +2 -2
  383. package/dist/workspace/new/use-create-workspace.d.ts +43 -102
  384. package/dist/workspace/new/use-create-workspace.js +77 -136
  385. package/dist/workspace/new/use-project-quota.d.ts +1 -1
  386. package/dist/workspace/new/use-project-quota.js +1 -1
  387. package/dist/workspace/new/workspace-handoff.d.ts +2 -2
  388. package/dist/workspace/new/workspace-handoff.js +2 -2
  389. package/dist/workspace/new/workspace-name.d.ts +14 -1
  390. package/dist/workspace/new/workspace-name.js +21 -1
  391. package/dist/workspace/project-selector/project-selector-model.d.ts +115 -57
  392. package/dist/workspace/project-selector/project-selector-model.js +157 -111
  393. package/dist/workspace/projects/modal/project-icon-field.d.ts +5 -5
  394. package/dist/workspace/projects/modal/project-icon-field.js +4 -4
  395. package/dist/workspace/projects/policies-panel.js +3 -3
  396. package/dist/workspace/sessions/board-grouping.js +1 -1
  397. package/dist/workspace/sessions/project-sessions-view.js +2 -2
  398. package/dist/workspace/sessions/session-detail.js +2 -2
  399. package/dist/workspace/sessions/sessions-board.d.ts +1 -1
  400. package/dist/workspace/sessions/sessions-board.js +1 -1
  401. package/dist/workspace/settings/split-notice-banner.d.ts +13 -0
  402. package/dist/workspace/settings/split-notice-banner.js +59 -0
  403. package/dist/workspace/settings/use-leave-workspace.d.ts +16 -0
  404. package/dist/workspace/settings/use-leave-workspace.js +60 -0
  405. package/dist/workspace/sidebar/footer/project-balance-warning.js +9 -6
  406. package/dist/workspace/sidebar/footer/project-files-nav.js +2 -2
  407. package/dist/workspace/sidebar/footer/sandbox-health.js +1 -1
  408. package/dist/workspace/sidebar/footer/sidebar-alert.d.ts +1 -1
  409. package/dist/workspace/sidebar/invitations-menu-group.d.ts +2 -2
  410. package/dist/workspace/sidebar/invitations-menu-group.js +4 -4
  411. package/dist/workspace/sidebar/modal/share-session-access.js +1 -1
  412. package/dist/workspace/sidebar/modal/share-session-modal.js +4 -5
  413. package/dist/workspace/sidebar/project-nav-items.js +14 -25
  414. package/dist/workspace/sidebar/project-sidebar.js +17 -2
  415. package/dist/workspace/sidebar/project-spaces-nav.js +6 -15
  416. package/dist/workspace/sidebar/sidebar-drill.d.ts +37 -0
  417. package/dist/workspace/sidebar/sidebar-drill.js +110 -0
  418. package/dist/workspace/sidebar/use-workspace-directory.d.ts +24 -0
  419. package/dist/workspace/sidebar/use-workspace-directory.js +24 -0
  420. package/dist/workspace/sidebar/use-workspace-list.d.ts +37 -0
  421. package/dist/workspace/sidebar/use-workspace-list.js +71 -0
  422. package/dist/workspace/sidebar/workspace-grouping.d.ts +6 -67
  423. package/dist/workspace/sidebar/workspace-grouping.js +4 -107
  424. package/dist/workspace/sidebar/workspace-menu-model.d.ts +30 -12
  425. package/dist/workspace/sidebar/workspace-menu-model.js +13 -107
  426. package/dist/workspace/sidebar/workspace-menu-section.d.ts +7 -1
  427. package/dist/workspace/sidebar/workspace-menu-section.js +65 -100
  428. package/dist/workspace/sidebar/workspace-settings-sidebar-nav.d.ts +34 -0
  429. package/dist/workspace/sidebar/workspace-settings-sidebar-nav.js +282 -0
  430. package/dist/workspace/space/space-filter-tabs.js +2 -2
  431. package/dist/workspace/space/space-page.d.ts +1 -1
  432. package/dist/workspace/space/space-page.js +1 -1
  433. package/package.json +55 -51
  434. package/skills/kortix-ui/SKILL.md +66 -66
  435. package/skills/kortix-ui/references/custom-dashboard.md +15 -15
  436. package/skills/kortix-ui/references/modules.md +15 -15
  437. package/dist/customize/agents/agent-pin-button.d.ts +0 -10
  438. package/dist/customize/agents/agent-pin-button.js +0 -20
  439. package/dist/customize/settings/tabs/transfer-workspace-dialog.d.ts +0 -4
  440. package/dist/customize/settings/tabs/transfer-workspace-dialog.js +0 -82
  441. package/dist/internal/account-hub/account-settings-shell.d.ts +0 -7
  442. package/dist/internal/account-hub/account-settings-shell.js +0 -87
  443. package/dist/internal/account-hub/account-settings-sidebar.d.ts +0 -2
  444. package/dist/internal/account-hub/account-settings-sidebar.js +0 -169
  445. package/dist/internal/lib/use-project-feature-flags.d.ts +0 -28
  446. package/dist/internal/lib/use-project-feature-flags.js +0 -76
  447. package/dist/internal/stores/pinned-agents-store.d.ts +0 -26
  448. package/dist/internal/stores/pinned-agents-store.js +0 -20
  449. package/dist/primitives/info-banner.d.ts +0 -14
  450. package/dist/primitives/info-banner.js +0 -72
  451. package/dist/workspace/new/account-picker.d.ts +0 -71
  452. package/dist/workspace/new/account-picker.js +0 -92
  453. package/dist/workspace/new/use-creatable-accounts.d.ts +0 -8
  454. package/dist/workspace/new/use-creatable-accounts.js +0 -33
  455. package/dist/workspace/sidebar/modal/session-embed-section.js +0 -71
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useProjectSessions, useProjectSpaces, useSessionAsks } from '@kortix/sdk/react';
4
- import { useReviewSessionSummary } from '../../internal/hooks/use-review-session-summary.js';
3
+ import { useProjectSessions, useProjectSpaces } from '@kortix/sdk/react';
4
+ import { useReviewNeedsYouCount } from '../../internal/hooks/use-review-session-summary.js';
5
5
  import { MY_KORTIX_AGENT_NAME } from '../../_vendor/kortix-shared.js';
6
6
  import { CheckIcon, LockSimpleIcon, PlusIcon } from '@phosphor-icons/react';
7
7
  import { useMemo, useState } from 'react';
@@ -32,19 +32,10 @@ function moveFocus(event) {
32
32
  event.preventDefault();
33
33
  rows[Math.max(0, Math.min(rows.length - 1, index + (event.key === 'ArrowDown' ? 1 : -1)))]?.focus();
34
34
  }
35
- /** `href`, or a page under it. */
35
+ /** `href`, or a page under it. A query (`/inbox?view=review`) is not part of the match. */
36
36
  function isAt(pathname, href) {
37
- return !!pathname && (pathname === href || pathname.startsWith(`${href}/`));
38
- }
39
- /**
40
- * What waits on the person across the project, the Customize nav's number:
41
- * the review summary's "needs you", plus the agents' questions and permission
42
- * asks (`useSessionAsks`). Connector approvals are already in the summary.
43
- */
44
- function useReviewBadgeCount(projectId) {
45
- const reviewNeedsYou = useReviewSessionSummary(projectId, { enabled: true }).totalNeedsYou;
46
- const asks = useSessionAsks(projectId).data?.asks;
47
- return reviewNeedsYou + (asks?.filter((ask) => ask.kind !== 'approval').length ?? 0);
37
+ const path = href.split('?')[0];
38
+ return !!pathname && (pathname === path || pathname.startsWith(`${path}/`));
48
39
  }
49
40
  /**
50
41
  * The sidebar under the `chat` flag: Spaces only. Review first, then the
@@ -67,7 +58,7 @@ export function ProjectSpacesNav({ projectId }) {
67
58
  const chatHref = `${uiRoutes().project(projectId)}/chat`;
68
59
  // The Review page on its own route (`reviewHref`), beside this sidebar.
69
60
  const review = reviewHref(projectId);
70
- const openAsks = useReviewBadgeCount(projectId);
61
+ const openAsks = useReviewNeedsYouCount(projectId);
71
62
  const hrefOf = (space) => space.kind === 'dm' ? uiRoutes().dm(projectId, space.dm_agent_name ?? '') : uiRoutes().channel(projectId, space.slug ?? '');
72
63
  return (_jsxs(FadedScrollArea, { fadeColor: "from-background", className: "h-full min-h-0", children: [_jsxs(SidebarMenu, { className: "gap-px", onKeyDown: moveFocus, children: [review ? (
73
64
  // Spacing, not a rule, sets Review apart from the spaces.
@@ -0,0 +1,37 @@
1
+ import { type ReactNode } from 'react';
2
+ /**
3
+ * Workspace settings drills the project sidebar: the main nav (`children`)
4
+ * slides out to the left and the settings nav slides in from the right, with
5
+ * Back in the slot of New session. The route is the state, so a reload or a
6
+ * shared link opens the panel already drilled, with no slide.
7
+ *
8
+ * This is the only part of the sidebar that reads the route. `children` is
9
+ * created by the parent, so a navigation re-renders these two layers and not
10
+ * the sidebar's nav, switcher or session list.
11
+ *
12
+ * Two layers, one on screen, crossfading with a short directional shift:
13
+ * the settings nav arrives from 22px to the right, the main nav leaves 22px
14
+ * to the left (reversed on Back). Never a full-width slide: text that travels
15
+ * across the column while it fades is text the eye has to chase (motion.md:
16
+ * no opacity with a large translate). The house curve `ease-default` starts
17
+ * fast, so the swap answers the click at once. The leaving layer takes 150ms,
18
+ * the arriving one 200ms: an exit runs at ~75% of the enter. Reduced motion
19
+ * keeps the fade and drops the shift. The hidden layer is inert. The main
20
+ * layer stays mounted: the session list keeps its scroll and open groups.
21
+ */
22
+ /**
23
+ * Records where the sidebar's Back row returns to: the last page of this
24
+ * project outside settings. Moving between settings sections never changes
25
+ * it, so Back leaves settings in one click however many sections were opened.
26
+ * Mounted outside `<Sidebar>`: on mobile the sheet unmounts its content while
27
+ * closed, and a navigation then must still be recorded.
28
+ */
29
+ export declare function SettingsReturnTracker({ projectId }: {
30
+ projectId: string;
31
+ }): null;
32
+ export declare function SidebarDrill({ projectId, onNavigate, children, }: {
33
+ projectId: string;
34
+ /** Called after a click in the settings nav (mobile closes the sheet). */
35
+ onNavigate: () => void;
36
+ children: ReactNode;
37
+ }): import("react").JSX.Element;
@@ -0,0 +1,110 @@
1
+ 'use client';
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useRef, useState } from 'react';
4
+ import { isProjectAdminPath } from '../../internal/layout/project-capability-nav.js';
5
+ import { useWorkspaceSettingsRailStore } from '../../internal/stores/workspace-settings-rail-store.js';
6
+ import { cn } from '../../internal/lib/utils.js';
7
+ import { useUiPathname, useUiSearchParams } from '../../providers/ui-provider.js';
8
+ import { WorkspaceSettingsSidebarNav } from './workspace-settings-sidebar-nav.js';
9
+ /**
10
+ * Workspace settings drills the project sidebar: the main nav (`children`)
11
+ * slides out to the left and the settings nav slides in from the right, with
12
+ * Back in the slot of New session. The route is the state, so a reload or a
13
+ * shared link opens the panel already drilled, with no slide.
14
+ *
15
+ * This is the only part of the sidebar that reads the route. `children` is
16
+ * created by the parent, so a navigation re-renders these two layers and not
17
+ * the sidebar's nav, switcher or session list.
18
+ *
19
+ * Two layers, one on screen, crossfading with a short directional shift:
20
+ * the settings nav arrives from 22px to the right, the main nav leaves 22px
21
+ * to the left (reversed on Back). Never a full-width slide: text that travels
22
+ * across the column while it fades is text the eye has to chase (motion.md:
23
+ * no opacity with a large translate). The house curve `ease-default` starts
24
+ * fast, so the swap answers the click at once. The leaving layer takes 150ms,
25
+ * the arriving one 200ms: an exit runs at ~75% of the enter. Reduced motion
26
+ * keeps the fade and drops the shift. The hidden layer is inert. The main
27
+ * layer stays mounted: the session list keeps its scroll and open groups.
28
+ */
29
+ /**
30
+ * Records where the sidebar's Back row returns to: the last page of this
31
+ * project outside settings. Moving between settings sections never changes
32
+ * it, so Back leaves settings in one click however many sections were opened.
33
+ * Mounted outside `<Sidebar>`: on mobile the sheet unmounts its content while
34
+ * closed, and a navigation then must still be recorded.
35
+ */
36
+ export function SettingsReturnTracker({ projectId }) {
37
+ const pathname = useUiPathname();
38
+ const search = useUiSearchParams().toString();
39
+ const setReturnTo = useWorkspaceSettingsRailStore((s) => s.setReturnTo);
40
+ useEffect(() => {
41
+ // A project switch can commit the new id before the new path.
42
+ if (isProjectAdminPath(pathname) || !pathname?.includes(`/${projectId}`))
43
+ return;
44
+ setReturnTo(projectId, search ? `${pathname}?${search}` : pathname);
45
+ }, [pathname, search, projectId, setReturnTo]);
46
+ return null;
47
+ }
48
+ export function SidebarDrill({ projectId, onNavigate, children, }) {
49
+ const pathname = useUiPathname();
50
+ // The swap starts on the click, not when the route commits. The route can
51
+ // take a few hundred milliseconds to load, and a swap that waits for it
52
+ // reads as unrelated to the click, then runs while the settings page
53
+ // mounts and drops frames. `intent` is the click's answer, held until the
54
+ // path changes; a click that opens a new tab (modifier keys, middle
55
+ // button) is not a drill.
56
+ const [intent, setIntent] = useState(null);
57
+ const drilled = intent && intent.at === pathname ? intent.drilled : isProjectAdminPath(pathname);
58
+ const drillOnClick = (to) => (event) => {
59
+ if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)
60
+ return;
61
+ const link = event.target.closest('a[href]');
62
+ if (!link || link.target === '_blank')
63
+ return;
64
+ const href = link.getAttribute('href') ?? '';
65
+ if (isProjectAdminPath(href) !== to)
66
+ return;
67
+ setIntent({ at: pathname, drilled: to });
68
+ };
69
+ // A keyboard-driven swap is instant (motion.md: never animate a keyboard
70
+ // action). The last input decides, written to the DOM so no render waits
71
+ // on it. A route change with no input of its own (browser Back, a swipe)
72
+ // follows the last input too, so after typing it is instant. The keyboard
73
+ // swap also moves focus into the new layer, since the link that had it is
74
+ // now inert.
75
+ const mainLayerRef = useRef(null);
76
+ const settingsLayerRef = useRef(null);
77
+ useEffect(() => {
78
+ const mark = (instant) => () => {
79
+ for (const layer of [mainLayerRef.current, settingsLayerRef.current]) {
80
+ if (instant)
81
+ layer?.setAttribute('data-instant', '');
82
+ else
83
+ layer?.removeAttribute('data-instant');
84
+ }
85
+ };
86
+ const onKey = mark(true);
87
+ const onPointer = mark(false);
88
+ window.addEventListener('keydown', onKey, true);
89
+ window.addEventListener('pointerdown', onPointer, true);
90
+ return () => {
91
+ window.removeEventListener('keydown', onKey, true);
92
+ window.removeEventListener('pointerdown', onPointer, true);
93
+ };
94
+ }, []);
95
+ const previousDrilled = useRef(drilled);
96
+ useEffect(() => {
97
+ if (previousDrilled.current === drilled)
98
+ return;
99
+ previousDrilled.current = drilled;
100
+ const incoming = drilled ? settingsLayerRef.current : mainLayerRef.current;
101
+ const outgoing = drilled ? mainLayerRef.current : settingsLayerRef.current;
102
+ if (!incoming?.hasAttribute('data-instant'))
103
+ return;
104
+ const active = document.activeElement;
105
+ if (active && active !== document.body && !outgoing?.contains(active))
106
+ return;
107
+ incoming.querySelector('a[href], button:not([disabled])')?.focus();
108
+ }, [drilled]);
109
+ return (_jsxs(_Fragment, { children: [_jsx("div", { ref: mainLayerRef, inert: drilled, onClickCapture: drillOnClick(true), className: cn('flex h-full min-h-0 flex-col space-y-2 transition-[translate,opacity] ease-default will-change-[translate,opacity] data-instant:transition-none', drilled ? 'pointer-events-none opacity-0 duration-normal motion-safe:-translate-x-6' : 'duration-moderate'), children: children }), _jsx("div", { ref: settingsLayerRef, inert: !drilled, onClickCapture: drillOnClick(false), className: cn('absolute inset-0 transition-[translate,opacity] ease-default will-change-[translate,opacity] data-instant:transition-none', drilled ? 'duration-moderate' : 'pointer-events-none opacity-0 duration-normal motion-safe:translate-x-6'), children: _jsx(WorkspaceSettingsSidebarNav, { projectId: projectId, shown: drilled, onNavigate: onNavigate }) })] }));
110
+ }
@@ -0,0 +1,24 @@
1
+ import type { KortixAccount } from '@kortix/sdk';
2
+ import { type WorkspaceRow } from '../project-selector/project-selector-model.js';
3
+ export interface WorkspaceDirectory {
4
+ accounts: KortixAccount[];
5
+ /** Every workspace of the caller in every state, most recently opened first. */
6
+ workspaces: WorkspaceRow[];
7
+ /** The workspaces that open now (`state: 'active'`). */
8
+ openable: WorkspaceRow[];
9
+ /** The list is not known yet. */
10
+ loading: boolean;
11
+ /** Non-empty when the list failed: its workspaces are unknown, not absent. */
12
+ failedAccountIds: string[];
13
+ /** @deprecated No create fills an empty account; read `githubSourceAccount`. */
14
+ reusableAccount: KortixAccount | null;
15
+ /** The account whose GitHub connection a GitHub-source create uses, or null (managed source only). */
16
+ githubSourceAccount: KortixAccount | null;
17
+ retryFailed: () => void;
18
+ }
19
+ /**
20
+ * Every workspace the caller belongs to — the switcher's and the palette's one
21
+ * list, from one request (`GET /v1/workspaces`, `useWorkspaceList`). The
22
+ * chooser reads the same query, so opening one after the other costs nothing.
23
+ */
24
+ export declare function useWorkspaceDirectory(): WorkspaceDirectory;
@@ -0,0 +1,24 @@
1
+ 'use client';
2
+ import { useMemo } from 'react';
3
+ import { isOpenableRow } from '../project-selector/project-selector-model.js';
4
+ import { useWorkspaceList } from './use-workspace-list.js';
5
+ /**
6
+ * Every workspace the caller belongs to — the switcher's and the palette's one
7
+ * list, from one request (`GET /v1/workspaces`, `useWorkspaceList`). The
8
+ * chooser reads the same query, so opening one after the other costs nothing.
9
+ */
10
+ export function useWorkspaceDirectory() {
11
+ const list = useWorkspaceList();
12
+ const accounts = useMemo(() => list.accountsQuery.data ?? [], [list.accountsQuery.data]);
13
+ const openable = useMemo(() => list.rows.filter(isOpenableRow), [list.rows]);
14
+ return {
15
+ accounts,
16
+ workspaces: list.rows,
17
+ openable,
18
+ loading: list.loading || list.accountsQuery.isLoading,
19
+ failedAccountIds: list.failed ? ['workspaces'] : [],
20
+ reusableAccount: list.reusableAccount,
21
+ githubSourceAccount: list.githubSourceAccount,
22
+ retryFailed: list.retry,
23
+ };
24
+ }
@@ -0,0 +1,37 @@
1
+ import { useAccountsList } from '../../internal/hooks/account/use-accounts-list.js';
2
+ import { githubSourceAccount, reusableEmptyAccountFromRows, type WorkspaceRow } from '../project-selector/project-selector-model.js';
3
+ /**
4
+ * Every workspace of the caller in every state, from ONE request:
5
+ * `GET /v1/workspaces` (`listWorkspaces({ includeInactive: true })`, design.md
6
+ * C5). The chooser, the `/workspaces/start` door and the sidebar switcher read
7
+ * this list. A `setup_required` row offers Set up, a `deleting` row (owners
8
+ * only) offers Restore; neither opens until then.
9
+ *
10
+ * Its own key under `qk.projects.scope()`: `useWorkspaces` keys the
11
+ * active-only list, and two shapes under one key would serve each other's
12
+ * rows. Every create, delete and join invalidates the scope.
13
+ */
14
+ export declare function workspaceListQueryKey(userId: string | null | undefined): readonly ["kx", "projects", "workspaces", string, "every-state"];
15
+ export interface WorkspaceList {
16
+ /** Every workspace, most recently opened first. */
17
+ rows: WorkspaceRow[];
18
+ loading: boolean;
19
+ failed: boolean;
20
+ retry: () => void;
21
+ /** @deprecated No create fills an empty account; read `githubSourceAccount`. */
22
+ reusableAccount: ReturnType<typeof reusableEmptyAccountFromRows>;
23
+ /** The account whose GitHub connection a GitHub-source create uses (`githubSourceAccount`), or null. */
24
+ githubSourceAccount: ReturnType<typeof githubSourceAccount>;
25
+ accountsQuery: ReturnType<typeof useAccountsList>;
26
+ }
27
+ export declare function useWorkspaceList(options?: {
28
+ retry?: number;
29
+ }): WorkspaceList;
30
+ /**
31
+ * Set up a `setup_required` workspace (it pays but has no repository yet) or
32
+ * restore a `deleting` one. Both answer the workspace, which then opens.
33
+ */
34
+ export declare function useWorkspaceStateActions(onReady: (workspaceId: string) => void): {
35
+ setup: import("@tanstack/react-query").UseMutationResult<import("@kortix/sdk").Workspace, Error, string, unknown>;
36
+ restore: import("@tanstack/react-query").UseMutationResult<import("@kortix/sdk").Workspace, Error, string, unknown>;
37
+ };
@@ -0,0 +1,71 @@
1
+ 'use client';
2
+ import { listWorkspaces, restoreWorkspace, setupWorkspace } from '@kortix/sdk';
3
+ import { contract, qk } from '@kortix/sdk/react';
4
+ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
5
+ import { useMemo } from 'react';
6
+ import { useAccountsList } from '../../internal/hooks/account/use-accounts-list.js';
7
+ import { useUiViewerId } from '../../providers/ui-provider.js';
8
+ import { githubSourceAccount, reusableEmptyAccountFromRows, workspaceRowsFromSummaries, } from '../project-selector/project-selector-model.js';
9
+ /**
10
+ * Every workspace of the caller in every state, from ONE request:
11
+ * `GET /v1/workspaces` (`listWorkspaces({ includeInactive: true })`, design.md
12
+ * C5). The chooser, the `/workspaces/start` door and the sidebar switcher read
13
+ * this list. A `setup_required` row offers Set up, a `deleting` row (owners
14
+ * only) offers Restore; neither opens until then.
15
+ *
16
+ * Its own key under `qk.projects.scope()`: `useWorkspaces` keys the
17
+ * active-only list, and two shapes under one key would serve each other's
18
+ * rows. Every create, delete and join invalidates the scope.
19
+ */
20
+ export function workspaceListQueryKey(userId) {
21
+ return [...qk.projects.workspaces(userId), 'every-state'];
22
+ }
23
+ export function useWorkspaceList(options = {}) {
24
+ const viewerId = useUiViewerId();
25
+ const accountsQuery = useAccountsList(options.retry === undefined ? undefined : { retry: options.retry });
26
+ const listQuery = useQuery({
27
+ queryKey: workspaceListQueryKey(viewerId),
28
+ queryFn: () => listWorkspaces({ includeInactive: true }),
29
+ retry: options.retry,
30
+ ...contract('inventory'),
31
+ });
32
+ const accounts = useMemo(() => accountsQuery.data ?? [], [accountsQuery.data]);
33
+ const rows = useMemo(() => workspaceRowsFromSummaries({ summaries: listQuery.data ?? [], accounts }), [listQuery.data, accounts]);
34
+ const reusableAccount = useMemo(() => reusableEmptyAccountFromRows({ accounts, rows: listQuery.data ? rows : undefined }), [accounts, rows, listQuery.data]);
35
+ const githubSource = useMemo(() => githubSourceAccount({ accounts, rows: listQuery.data ? rows : undefined }), [accounts, rows, listQuery.data]);
36
+ return {
37
+ rows,
38
+ loading: listQuery.isLoading,
39
+ failed: listQuery.isError,
40
+ retry: () => {
41
+ if (listQuery.isError)
42
+ void listQuery.refetch();
43
+ if (accountsQuery.isError)
44
+ void accountsQuery.refetch();
45
+ },
46
+ reusableAccount,
47
+ githubSourceAccount: githubSource,
48
+ accountsQuery,
49
+ };
50
+ }
51
+ /**
52
+ * Set up a `setup_required` workspace (it pays but has no repository yet) or
53
+ * restore a `deleting` one. Both answer the workspace, which then opens.
54
+ */
55
+ export function useWorkspaceStateActions(onReady) {
56
+ const queryClient = useQueryClient();
57
+ const settle = (workspaceId) => {
58
+ void queryClient.invalidateQueries({ queryKey: qk.projects.scope() });
59
+ void queryClient.invalidateQueries({ queryKey: qk.accounts.scope() });
60
+ onReady(workspaceId);
61
+ };
62
+ const setup = useMutation({
63
+ mutationFn: (workspaceId) => setupWorkspace(workspaceId),
64
+ onSuccess: (_workspace, workspaceId) => settle(workspaceId),
65
+ });
66
+ const restore = useMutation({
67
+ mutationFn: (workspaceId) => restoreWorkspace(workspaceId),
68
+ onSuccess: (_workspace, workspaceId) => settle(workspaceId),
69
+ });
70
+ return { setup, restore };
71
+ }
@@ -1,5 +1,9 @@
1
- import { type HubTarget } from '../../internal/stores/account-panel-store.js';
2
- import type { KortixAccount, KortixProject } from '@kortix/sdk';
1
+ /**
2
+ * The account name as a person reads it. The switcher and the chooser no
3
+ * longer group by account (a workspace is one account and its project, see
4
+ * `project-selector-model.ts`), so this label is search text and the copy on
5
+ * account-level panes, never a heading over workspaces.
6
+ */
3
7
  /**
4
8
  * The account name as a HUMAN reads it in a switcher.
5
9
  *
@@ -16,68 +20,3 @@ import type { KortixAccount, KortixProject } from '@kortix/sdk';
16
20
  * worse than a redundant one.
17
21
  */
18
22
  export declare function workspaceAccountLabel(name: string | null | undefined, fallback?: string, stripSuffix?: boolean): string;
19
- export interface WorkspaceGroup {
20
- accountId: string;
21
- accountName: string;
22
- workspaces: KortixProject[];
23
- }
24
- export interface GroupWorkspacesInput {
25
- accounts: Pick<KortixAccount, 'account_id' | 'name'>[];
26
- workspaces: KortixProject[];
27
- /** The workspace currently open, if any. Its account sorts first. */
28
- activeWorkspaceId: string | null | undefined;
29
- }
30
- export declare function groupWorkspacesByAccount({ accounts, workspaces, activeWorkspaceId, }: GroupWorkspacesInput): WorkspaceGroup[];
31
- /**
32
- * The account the switcher is currently scoped to — what "Account settings"
33
- * in this menu opens.
34
- *
35
- * Resolution order, most specific first:
36
- *
37
- * 1. the account owning the workspace you have open. A user in two accounts
38
- * reads the menu as "settings for where I am", and the open workspace is
39
- * the only unambiguous statement of that;
40
- * 2. `selectedAccountId`, for a mount with no workspace in the URL. It is
41
- * persisted (`packages/ui/src/internal/stores/current-account-store`) so it is present on the first
42
- * paint of a returning visit, before any query resolves;
43
- * 3. the first account, matching the seed `useEnsureSelectedAccount` writes.
44
- *
45
- * `null` only while the user's accounts are genuinely unknown. Callers MUST
46
- * treat that as "render no link" rather than building `/accounts/null`.
47
- */
48
- export declare function resolveSwitcherAccountId({ accounts, workspaces, activeWorkspaceId, selectedAccountId, }: GroupWorkspacesInput & {
49
- selectedAccountId: string | null;
50
- }): string | null;
51
- export type WorkspaceRowNavigation = {
52
- kind: 'switch';
53
- href: string;
54
- }
55
- /** The account hub, which is a modal over the current page rather than a
56
- * route — so this variant names a `HubTarget`, not a URL. */
57
- | {
58
- kind: 'account-settings';
59
- to: HubTarget;
60
- };
61
- /**
62
- * Where clicking a workspace row goes.
63
- *
64
- * The row you are already in cannot switch anywhere: `switchProject` returned
65
- * early on it, so the click spent the menu and did nothing. It is also the one
66
- * row in the product that unambiguously names an account you are a member of,
67
- * so it now opens that account's settings — the same destination as the
68
- * "Account settings" row at the top of this menu. Every other row keeps the
69
- * switch it always had.
70
- */
71
- export declare function resolveWorkspaceRowNavigation(workspace: Pick<KortixProject, 'project_id' | 'account_id'>, activeWorkspaceId: string | null | undefined): WorkspaceRowNavigation;
72
- /**
73
- * Filter grouped workspaces by a free-text query.
74
- *
75
- * NEVER caps the result. The old switcher sliced to 8 because `/projects` was
76
- * the real directory; it is not any more, and a cap here silently hides
77
- * workspaces a user can otherwise reach. Render cost is handled by
78
- * virtualisation in the component, not by dropping data here.
79
- *
80
- * A match on the ACCOUNT name keeps that account's whole group, so "acme"
81
- * answers "show me everything in Acme" as well as "find a workspace".
82
- */
83
- export declare function filterWorkspaceGroups(groups: WorkspaceGroup[], query: string): WorkspaceGroup[];
@@ -1,14 +1,8 @@
1
- import { uiRoutes } from '../../lib/routes.js';
2
- import { hubTarget } from '../../internal/stores/account-panel-store.js';
3
1
  /**
4
- * The switcher menu is the only complete workspace directory in the product —
5
- * the `/projects` index that used to hold that job is gone. So this grouping is
6
- * the whole navigation model, not a convenience view, and it must never drop a
7
- * workspace the user can reach.
8
- *
9
- * That is why an orphan workspace (one whose account is missing from
10
- * `accounts`, e.g. a shared project in an account the user is not a member of)
11
- * still gets a group rather than being filtered out.
2
+ * The account name as a person reads it. The switcher and the chooser no
3
+ * longer group by account (a workspace is one account and its project, see
4
+ * `project-selector-model.ts`), so this label is search text and the copy on
5
+ * account-level panes, never a heading over workspaces.
12
6
  */
13
7
  /** Shown when an account has no usable name. Never blank. */
14
8
  const FALLBACK_ACCOUNT_NAME = 'Account';
@@ -36,100 +30,3 @@ export function workspaceAccountLabel(name, fallback = FALLBACK_ACCOUNT_NAME, st
36
30
  const stripped = trimmed.replace(/[\u2019']s Account$/u, '').trim();
37
31
  return stripped || trimmed;
38
32
  }
39
- function openedAt(workspace) {
40
- return workspace.last_opened_at ? new Date(workspace.last_opened_at).getTime() : 0;
41
- }
42
- export function groupWorkspacesByAccount({ accounts, workspaces, activeWorkspaceId, }) {
43
- const nameByAccountId = new Map(accounts.map((account) => [
44
- account.account_id,
45
- workspaceAccountLabel(account.name, FALLBACK_ACCOUNT_NAME, false),
46
- ]));
47
- const byAccountId = new Map();
48
- for (const workspace of workspaces) {
49
- const bucket = byAccountId.get(workspace.account_id);
50
- if (bucket)
51
- bucket.push(workspace);
52
- else
53
- byAccountId.set(workspace.account_id, [workspace]);
54
- }
55
- const activeAccountId = workspaces.find((workspace) => workspace.project_id === activeWorkspaceId)?.account_id ?? null;
56
- const groups = [...byAccountId.entries()].map(([accountId, list]) => ({
57
- accountId,
58
- accountName: nameByAccountId.get(accountId) ?? FALLBACK_ACCOUNT_NAME,
59
- workspaces: [...list].sort((a, b) => openedAt(b) - openedAt(a)),
60
- }));
61
- groups.sort((a, b) => {
62
- if (a.accountId === activeAccountId)
63
- return -1;
64
- if (b.accountId === activeAccountId)
65
- return 1;
66
- return a.accountName.localeCompare(b.accountName);
67
- });
68
- return groups;
69
- }
70
- /**
71
- * The account the switcher is currently scoped to — what "Account settings"
72
- * in this menu opens.
73
- *
74
- * Resolution order, most specific first:
75
- *
76
- * 1. the account owning the workspace you have open. A user in two accounts
77
- * reads the menu as "settings for where I am", and the open workspace is
78
- * the only unambiguous statement of that;
79
- * 2. `selectedAccountId`, for a mount with no workspace in the URL. It is
80
- * persisted (`packages/ui/src/internal/stores/current-account-store`) so it is present on the first
81
- * paint of a returning visit, before any query resolves;
82
- * 3. the first account, matching the seed `useEnsureSelectedAccount` writes.
83
- *
84
- * `null` only while the user's accounts are genuinely unknown. Callers MUST
85
- * treat that as "render no link" rather than building `/accounts/null`.
86
- */
87
- export function resolveSwitcherAccountId({ accounts, workspaces, activeWorkspaceId, selectedAccountId, }) {
88
- const activeWorkspace = activeWorkspaceId
89
- ? workspaces.find((workspace) => workspace.project_id === activeWorkspaceId)
90
- : undefined;
91
- return activeWorkspace?.account_id ?? selectedAccountId ?? accounts[0]?.account_id ?? null;
92
- }
93
- /**
94
- * Where clicking a workspace row goes.
95
- *
96
- * The row you are already in cannot switch anywhere: `switchProject` returned
97
- * early on it, so the click spent the menu and did nothing. It is also the one
98
- * row in the product that unambiguously names an account you are a member of,
99
- * so it now opens that account's settings — the same destination as the
100
- * "Account settings" row at the top of this menu. Every other row keeps the
101
- * switch it always had.
102
- */
103
- export function resolveWorkspaceRowNavigation(workspace, activeWorkspaceId) {
104
- if (activeWorkspaceId && workspace.project_id === activeWorkspaceId) {
105
- return { kind: 'account-settings', to: hubTarget(workspace.account_id) };
106
- }
107
- return { kind: 'switch', href: uiRoutes().project(workspace.project_id) };
108
- }
109
- /**
110
- * Filter grouped workspaces by a free-text query.
111
- *
112
- * NEVER caps the result. The old switcher sliced to 8 because `/projects` was
113
- * the real directory; it is not any more, and a cap here silently hides
114
- * workspaces a user can otherwise reach. Render cost is handled by
115
- * virtualisation in the component, not by dropping data here.
116
- *
117
- * A match on the ACCOUNT name keeps that account's whole group, so "acme"
118
- * answers "show me everything in Acme" as well as "find a workspace".
119
- */
120
- export function filterWorkspaceGroups(groups, query) {
121
- const needle = query.trim().toLowerCase();
122
- if (!needle)
123
- return groups;
124
- const filtered = [];
125
- for (const group of groups) {
126
- if (group.accountName.toLowerCase().includes(needle)) {
127
- filtered.push(group);
128
- continue;
129
- }
130
- const workspaces = group.workspaces.filter((w) => w.name.toLowerCase().includes(needle));
131
- if (workspaces.length > 0)
132
- filtered.push({ ...group, workspaces });
133
- }
134
- return filtered;
135
- }
@@ -1,12 +1,30 @@
1
- export declare function useWorkspaceMenuModel(activeProjectId: string | undefined, selectedAccountId: string | null, query: string): {
2
- workspacesLoading: boolean;
3
- failedAccounts: {
4
- account: import("@kortix/sdk").KortixAccount;
5
- result: import("@tanstack/react-query").QueryObserverRefetchErrorResult<import("@kortix/sdk").KortixProject[], Error> | import("@tanstack/react-query").QueryObserverLoadingErrorResult<import("@kortix/sdk").KortixProject[], Error>;
6
- }[];
7
- creatableAccountIds: Set<string>;
8
- visibleGroups: import("./workspace-grouping.js").WorkspaceGroup[];
9
- switcherAccountId: string | null;
10
- isEmpty: boolean;
11
- captureOn: boolean;
12
- };
1
+ /**
2
+ * The rows of the workspace menu (the sidebar's workspace name, Slack's
3
+ * "Acme ▾"), in order, by group:
4
+ *
5
+ * 1. the workspace header (icon and name);
6
+ * 2. the workspace: Invite people · Workspace settings · Switch workspace
7
+ * (the list, with the pending-invitation count; Create workspace sits at
8
+ * the bottom of that list, beside the workspaces it adds to);
9
+ * 3. the person: Inbox (notifications from every workspace, KRTX-1742) ·
10
+ * Preferences (Mod+,) · More (Apps and extensions, Appearance, Help,
11
+ * Download app: rows a person opens rarely, one level down);
12
+ * 4. Leave {name} · Log out.
13
+ *
14
+ * Seven rows at most at the top level: the rows used daily stay in reach,
15
+ * and the rest wait one hover away. Each gated row follows the gate its
16
+ * target applies, so a row never opens a page that refuses the caller.
17
+ */
18
+ export type WorkspaceMenuRow = 'header' | 'invite' | 'settings' | 'switch' | 'inbox' | 'preferences' | 'more' | 'leave' | 'logout';
19
+ export interface WorkspaceMenuGates {
20
+ /** `project.members.manage`: the Members section's invite. */
21
+ canInvite: boolean;
22
+ /** Customize › Workspace settings' gate (`config`). */
23
+ canOpenSettings: boolean;
24
+ /** Not the last owner (`useLeaveWorkspace`). */
25
+ canLeave: boolean;
26
+ /** The host serves an Inbox page (`useInboxSummary(...).href` is set). */
27
+ hasInbox: boolean;
28
+ }
29
+ /** The menu's groups, top to bottom; a separator sits between two non-empty groups. */
30
+ export declare function workspaceMenuGroups(gates: WorkspaceMenuGates): WorkspaceMenuRow[][];