@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,6 +1,6 @@
1
1
  import type { UiTranslator } from '../../i18n/index.js';
2
2
  import { type AccountRole, type ConnectionShare, type ProjectRole } from '@kortix/sdk';
3
- import { type ReactNode } from 'react';
3
+ import { type ComponentType, type ReactNode } from 'react';
4
4
  import { type ShareableObject } from './access-dialog-share.js';
5
5
  import { type RoleValue } from './role-select.js';
6
6
  export type AccessDialogScope = {
@@ -205,3 +205,46 @@ export declare function BlastRadiusPreview({ declares, }: {
205
205
  connectors: string[] | 'all';
206
206
  };
207
207
  }): import("react").JSX.Element;
208
+ /** The expiry field: the Kortix `Calendar` in a popover, not the browser's
209
+ * native date input. Empty reads "Never"; past days can't be picked. */
210
+ export declare function ExpiryPicker({ id, value, onChange, disabled, }: {
211
+ id: string;
212
+ value: string;
213
+ onChange: (next: string) => void;
214
+ disabled?: boolean;
215
+ }): import("react").JSX.Element;
216
+ /**
217
+ * The two shells `PrincipalAccessDialog` renders its one body in. The modal
218
+ * blocks a close while a save is in flight; the sheet is the body of the
219
+ * account hub's `useAccountHubSheet`, which owns open and close.
220
+ */
221
+ export interface AccessChrome {
222
+ Root: ComponentType<{
223
+ open: boolean;
224
+ onOpenChange: (open: boolean) => void;
225
+ children?: ReactNode;
226
+ }>;
227
+ Content: ComponentType<{
228
+ children?: ReactNode;
229
+ }>;
230
+ Header: ComponentType<{
231
+ children?: ReactNode;
232
+ }>;
233
+ Title: ComponentType<{
234
+ children?: ReactNode;
235
+ }>;
236
+ Description: ComponentType<{
237
+ children?: ReactNode;
238
+ }>;
239
+ Body: ComponentType<{
240
+ children?: ReactNode;
241
+ }>;
242
+ Footer: ComponentType<{
243
+ children?: ReactNode;
244
+ }>;
245
+ }
246
+ export declare const MODAL_CHROME: AccessChrome;
247
+ /** Inside the account hub's sheet: the host draws the title row and the
248
+ * scrolling body, so this draws only the fields and a footer that sticks to
249
+ * the bottom of that scroll. */
250
+ export declare const SHEET_CHROME: AccessChrome;
@@ -30,14 +30,14 @@ import { Checkbox } from '../../primitives/checkbox.js';
30
30
  import { ConfirmDialog } from '../../primitives/confirm-dialog.js';
31
31
  import { EntityAvatar } from '../../primitives/entity-avatar.js';
32
32
  import { Field, FieldDescription, FieldLabel } from '../../primitives/field.js';
33
- import { InfoBanner } from '../../primitives/info-banner.js';
33
+ import { Alert as BannerAlert, AlertTitle as BannerAlertTitle, AlertDescription as BannerAlertDescription, AlertActions as BannerAlertActions, AlertMedia as BannerAlertMedia } from '../../primitives/alert.js';
34
34
  import { Calendar } from '../../primitives/calendar.js';
35
35
  import { Popover, PopoverContent, PopoverTrigger } from '../../primitives/popover.js';
36
36
  import { triggerVariants } from '../../primitives/trigger-variants.js';
37
37
  import Loading from '../../primitives/loading.js';
38
38
  import { Modal, ModalBody, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalTitle, } from '../../primitives/modal.js';
39
39
  import { Skeleton } from '../../primitives/skeleton.js';
40
- import { Tabs, TabsListCompact, TabsTriggerCompact } from '../../primitives/tabs.js';
40
+ import { Tabs, TabsList, TabsTrigger } from '../../primitives/tabs.js';
41
41
  import { errorToast, successToast, warningToast } from '../../primitives/toast.js';
42
42
  import { UserAvatar } from '../../primitives/user-avatar.js';
43
43
  import { PROJECT_ACTIONS } from '../../internal/lib/project-actions.js';
@@ -881,14 +881,14 @@ function PrincipalAccessDialog({ open, onOpenChange, accountId, scope, mode, acc
881
881
  // Ownership transfer is its own flow — never a grant.
882
882
  builtinRoles: roleScope === 'account' && mode.kind === 'grant'
883
883
  ? ['member', 'admin']
884
- : undefined }), scope.kind === 'project' && principals.groupIds.length > 0 ? (_jsx(FieldDescription, { children: tI18nComplete.raw('text237f1a28cf06') })) : null] })) : null, scope.kind === 'project' && everyoneSelected ? (_jsx(InfoBanner, { tone: "neutral", icon: UsersThreeIcon, children: tSharing('everyoneRoleNote', { project: scope.projectName }) })) : null, scope.kind === 'project' && showAgentCeilingNote ? (_jsx(InfoBanner, { tone: "neutral", icon: RobotIcon, title: tAgents('ceilingNoteTitle'), children: _jsx("span", { "data-testid": "agent-ceiling-note", children: tAgents('ceilingNote') }) })) : null, showAgents ? (_jsxs(Field, { className: "gap-1.5", children: [_jsx(FieldLabel, { children: tI18nComplete.raw('text279b44d2ab4b') }), resourceGrantsQuery.isError ? (_jsx(InfoBanner, { tone: "destructive", action: _jsx(Button, { size: "sm", variant: "outline", onClick: () => void resourceGrantsQuery.refetch(), children: tCommon('retry') }), children: resourceGrantsQuery.error.message })) : resourceGrantsQuery.isLoading ? (_jsx(Skeleton, { className: "h-6 w-full rounded-md" })) : null, _jsx(Tabs, { value: agents.mode, onValueChange: (next) => setAgents(next === 'all' ? ALL_AGENTS : { mode: 'subset', ids: agents.ids }), children: _jsxs(TabsListCompact, { children: [_jsx(TabsTriggerCompact, { value: "all", children: tI18nComplete.raw('text54c32d3e2cfa') }), _jsx(TabsTriggerCompact, { value: "subset", children: tI18nComplete.raw('textb080141d6840') })] }) }), agents.mode === 'all' ? (_jsx(FieldDescription, { children: projectAgents.length === 0
884
+ : undefined }), scope.kind === 'project' && principals.groupIds.length > 0 ? (_jsx(FieldDescription, { children: tI18nComplete.raw('text237f1a28cf06') })) : null] })) : null, scope.kind === 'project' && everyoneSelected ? (_jsxs(BannerAlert, { variant: "default", children: [_jsx(BannerAlertMedia, { children: _jsx(UsersThreeIcon, {}) }), _jsx(BannerAlertDescription, { children: tSharing('everyoneRoleNote', { project: scope.projectName }) })] })) : null, scope.kind === 'project' && showAgentCeilingNote ? (_jsxs(BannerAlert, { variant: "default", children: [_jsx(BannerAlertMedia, { children: _jsx(RobotIcon, {}) }), _jsx(BannerAlertTitle, { children: tAgents('ceilingNoteTitle') }), _jsx(BannerAlertDescription, { children: _jsx("span", { "data-testid": "agent-ceiling-note", children: tAgents('ceilingNote') }) })] })) : null, showAgents ? (_jsxs(Field, { className: "gap-1.5", children: [_jsx(FieldLabel, { children: tI18nComplete.raw('text279b44d2ab4b') }), resourceGrantsQuery.isError ? (_jsxs(BannerAlert, { variant: "destructive", children: [_jsx(BannerAlertDescription, { children: resourceGrantsQuery.error.message }), _jsx(BannerAlertActions, { children: _jsx(Button, { size: "sm", variant: "outline", onClick: () => void resourceGrantsQuery.refetch(), children: tCommon('retry') }) })] })) : resourceGrantsQuery.isLoading ? (_jsx(Skeleton, { className: "h-6 w-full rounded-md" })) : null, _jsx(Tabs, { value: agents.mode, onValueChange: (next) => setAgents(next === 'all' ? ALL_AGENTS : { mode: 'subset', ids: agents.ids }), children: _jsxs(TabsList, { size: "xs", children: [_jsx(TabsTrigger, { value: "all", children: tI18nComplete.raw('text54c32d3e2cfa') }), _jsx(TabsTrigger, { value: "subset", children: tI18nComplete.raw('textb080141d6840') })] }) }), agents.mode === 'all' ? (_jsx(FieldDescription, { children: projectAgents.length === 0
885
885
  ? tI18nComplete.raw('text7bf9d07dcb99')
886
886
  : tI18nComplete('textc5bb9fda9711', { value0: projectAgents.length }) })) : null, agents.mode === 'subset' ? (resourceGrantsQuery.isLoading ? (_jsx(Skeleton, { className: "h-24 w-full rounded-md" })) : projectAgents.length === 0 ? (_jsx("p", { className: "text-muted-foreground text-xs", children: tI18nComplete.raw('text7bf9d07dcb99') })) : (_jsx("div", { className: "border-border max-h-40 overflow-y-auto rounded-md border p-1", children: projectAgents.map((agent) => (_jsx(Checkbox, { label: agent.name, checked: selectedAgentIdSet.has(agent.id), disabled: pending, onCheckedChange: () => setAgents((prev) => ({
887
887
  mode: 'subset',
888
888
  ids: prev.ids.includes(agent.id)
889
889
  ? prev.ids.filter((x) => x !== agent.id)
890
890
  : [...prev.ids, agent.id],
891
- })) }, agent.id))) }))) : null, selectedAgentDeclares ? (_jsx(BlastRadiusPreview, { declares: selectedAgentDeclares })) : null] })) : null, showAccountAdminBanner ? (_jsx(InfoBanner, { tone: "neutral", children: tI18nComplete.raw('text65abb6edc2c0') })) : showProjectAccessSection ? (_jsx(ProjectAccessRows, { accountId: accountId, rows: projectGrants, onChange: setProjectGrants, expanded: projectAccessOpen, onExpand: () => {
891
+ })) }, agent.id))) }))) : null, selectedAgentDeclares ? (_jsx(BlastRadiusPreview, { declares: selectedAgentDeclares })) : null] })) : null, showAccountAdminBanner ? (_jsx(BannerAlert, { variant: "default", children: _jsx(BannerAlertDescription, { children: tI18nComplete.raw('text65abb6edc2c0') }) })) : showProjectAccessSection ? (_jsx(ProjectAccessRows, { accountId: accountId, rows: projectGrants, onChange: setProjectGrants, expanded: projectAccessOpen, onExpand: () => {
892
892
  setProjectAccessOpen(true);
893
893
  if (projectGrants.length === 0) {
894
894
  setProjectGrants([{ project_id: '', role: 'member' }]);
@@ -901,7 +901,7 @@ function PrincipalAccessDialog({ open, onOpenChange, accountId, scope, mode, acc
901
901
  ? scope.projectName
902
902
  : scope.kind === 'group'
903
903
  ? scope.groupName
904
- : (accountName ?? 'this account'),
904
+ : (accountName ?? 'this workspace'),
905
905
  inherited: inheritedFrom,
906
906
  }, tI18nComplete) })) : null] }));
907
907
  }
@@ -946,7 +946,7 @@ function parseDateValue(value) {
946
946
  }
947
947
  /** The expiry field: the Kortix `Calendar` in a popover, not the browser's
948
948
  * native date input. Empty reads "Never"; past days can't be picked. */
949
- function ExpiryPicker({ id, value, onChange, disabled, }) {
949
+ export function ExpiryPicker({ id, value, onChange, disabled, }) {
950
950
  const tI18nComplete = useI18nTranslations('hardcodedUi.i18nComplete');
951
951
  const [open, setOpen] = useState(false);
952
952
  const selected = parseDateValue(value);
@@ -960,7 +960,7 @@ function ExpiryPicker({ id, value, onChange, disabled, }) {
960
960
  setOpen(false);
961
961
  }, children: tI18nComplete.raw('text83b12c2216ef') }) })) : null] })] }));
962
962
  }
963
- const MODAL_CHROME = {
963
+ export const MODAL_CHROME = {
964
964
  Root: Modal,
965
965
  Content: ({ children }) => (_jsx(ModalContent, { className: "sm:max-w-md", children: children })),
966
966
  Header: ModalHeader,
@@ -973,7 +973,7 @@ const Passthrough = ({ children }) => _jsx(_Fragment, { children: children });
973
973
  /** Inside the account hub's sheet: the host draws the title row and the
974
974
  * scrolling body, so this draws only the fields and a footer that sticks to
975
975
  * the bottom of that scroll. */
976
- const SHEET_CHROME = {
976
+ export const SHEET_CHROME = {
977
977
  Root: Passthrough,
978
978
  // Fills the sheet body's height so `mt-auto` can push the footer to the
979
979
  // bottom edge even when the form is short.
@@ -1,7 +1,7 @@
1
1
  import { type AgentIdentity, type IamRole, type RoleAssignment } from '@kortix/sdk';
2
- /** Never an agent's, whatever its role or its `kortix_permissions` say. Mirrors
3
- * `HUMAN_ONLY_ACTIONS` in apps/api `iam/agent-principal.ts`: a token an agent
4
- * minted would carry none of its permissions. */
2
+ /** Never an agent's, whatever its role or its `kortix_permissions` say: the
3
+ * HUMAN_ONLY set the API enforces (minting credentials, moving money). None of
4
+ * them is in the grantable catalog, so only an explicit list can name one. */
5
5
  export declare const HUMAN_ONLY_PERMISSIONS: readonly string[];
6
6
  /** Every project permission `kortix_permissions` may name. */
7
7
  export declare const GRANTABLE_PROJECT_PERMISSIONS: readonly string[];
@@ -14,13 +14,14 @@
14
14
  // the IAM half. Enforcement is server-side (`apps/api/src/iam/authorize.ts`);
15
15
  // nothing here decides access.
16
16
  import { getRolePermissions, listAgentIdentities, listProjectAgentIdentities, listAssignments, listRoles, } from '@kortix/sdk';
17
+ import { HUMAN_ONLY } from '../../_vendor/kortix-shared.js';
17
18
  import { useQueries, useQuery } from '@tanstack/react-query';
18
19
  import { useMemo } from 'react';
19
20
  import { KORTIX_PERMISSIONS_CATALOG } from '../../customize/sections/view/agent-editor-catalog.js';
20
- /** Never an agent's, whatever its role or its `kortix_permissions` say. Mirrors
21
- * `HUMAN_ONLY_ACTIONS` in apps/api `iam/agent-principal.ts`: a token an agent
22
- * minted would carry none of its permissions. */
23
- export const HUMAN_ONLY_PERMISSIONS = ['project.credentials.issue'];
21
+ /** Never an agent's, whatever its role or its `kortix_permissions` say: the
22
+ * HUMAN_ONLY set the API enforces (minting credentials, moving money). None of
23
+ * them is in the grantable catalog, so only an explicit list can name one. */
24
+ export const HUMAN_ONLY_PERMISSIONS = [...HUMAN_ONLY];
24
25
  /** Every project permission `kortix_permissions` may name. */
25
26
  export const GRANTABLE_PROJECT_PERMISSIONS = KORTIX_PERMISSIONS_CATALOG.flatMap((group) => group.actions);
26
27
  /** Always granted to an agent inside its own project (spec §2.1). */
@@ -0,0 +1,37 @@
1
+ /**
2
+ * "Invite people to {workspace}" (design.md §3.1 finding 19, C3): email
3
+ * chips, ONE role from the workspace ladder (Member, Manager, Admin; Owner is
4
+ * a transfer, never an invite), and an optional expiry. It sends
5
+ * `POST /v1/workspaces/:id/members {email, role, expires_at}` once per email.
6
+ * The server writes the storage the role needs, so the dialog never asks for
7
+ * a project grant. A `split_pending` workspace (a legacy account that still
8
+ * holds several workspaces) keeps the per-workspace grant dialog
9
+ * (`AccessDialog`).
10
+ *
11
+ * The same body renders in the account hub's split sheet (Members › Invite)
12
+ * and in a Modal.
13
+ */
14
+ import { type WorkspaceRole } from '@kortix/sdk';
15
+ /** The roles an invite can carry, lowest first. */
16
+ export type InviteRole = Exclude<WorkspaceRole, 'owner'>;
17
+ export declare const INVITE_ROLES: readonly InviteRole[];
18
+ /**
19
+ * Split typed text into emails: commas, semicolons, spaces and new lines
20
+ * separate them. Returns the valid emails (lowercased, de-duplicated against
21
+ * `existing`) and what is left over (a partial or invalid entry stays typed).
22
+ */
23
+ export declare function parseInviteEmails(text: string, existing: readonly string[]): {
24
+ emails: string[];
25
+ rest: string;
26
+ };
27
+ export interface InvitePeopleDialogProps {
28
+ workspaceId: string;
29
+ workspaceName: string;
30
+ open: boolean;
31
+ onOpenChange: (open: boolean) => void;
32
+ /** `member.update`: only then may an invite make an Admin. */
33
+ canGrantAdmin: boolean;
34
+ /** After the invites were sent (members, invites and probes changed). */
35
+ onDone?: () => void;
36
+ }
37
+ export declare function InvitePeopleDialog({ workspaceId, workspaceName, open, onOpenChange, canGrantAdmin, onDone, }: InvitePeopleDialogProps): import("react").JSX.Element;
@@ -0,0 +1,140 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ /**
4
+ * "Invite people to {workspace}" (design.md §3.1 finding 19, C3): email
5
+ * chips, ONE role from the workspace ladder (Member, Manager, Admin; Owner is
6
+ * a transfer, never an invite), and an optional expiry. It sends
7
+ * `POST /v1/workspaces/:id/members {email, role, expires_at}` once per email.
8
+ * The server writes the storage the role needs, so the dialog never asks for
9
+ * a project grant. A `split_pending` workspace (a legacy account that still
10
+ * holds several workspaces) keeps the per-workspace grant dialog
11
+ * (`AccessDialog`).
12
+ *
13
+ * The same body renders in the account hub's split sheet (Members › Invite)
14
+ * and in a Modal.
15
+ */
16
+ import { inviteWorkspaceMember } from '@kortix/sdk';
17
+ import { XIcon } from '@phosphor-icons/react';
18
+ import { useMutation } from '@tanstack/react-query';
19
+ import { useState } from 'react';
20
+ import { useTranslations } from '../../i18n/index.js';
21
+ import { useInAccountHubSheetBody } from '../../internal/account-hub/hub-sheet.js';
22
+ import { Badge } from '../../primitives/badge.js';
23
+ import { Button } from '../../primitives/button.js';
24
+ import { Field, FieldDescription, FieldLabel } from '../../primitives/field.js';
25
+ import Loading from '../../primitives/loading.js';
26
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../../primitives/select.js';
27
+ import { errorToast, successToast } from '../../primitives/toast.js';
28
+ import { ExpiryPicker, MODAL_CHROME, SHEET_CHROME } from './access-dialog.js';
29
+ import { endOfLocalDayIso } from './access-shared.js';
30
+ import { isInviteEmail } from './principal-picker.js';
31
+ export const INVITE_ROLES = ['member', 'manager', 'admin'];
32
+ /**
33
+ * Split typed text into emails: commas, semicolons, spaces and new lines
34
+ * separate them. Returns the valid emails (lowercased, de-duplicated against
35
+ * `existing`) and what is left over (a partial or invalid entry stays typed).
36
+ */
37
+ export function parseInviteEmails(text, existing) {
38
+ const parts = text.split(/[\s,;]+/);
39
+ const emails = [];
40
+ const rest = [];
41
+ const seen = new Set(existing);
42
+ for (const part of parts) {
43
+ const value = part.trim().toLowerCase();
44
+ if (!value)
45
+ continue;
46
+ if (isInviteEmail(value)) {
47
+ if (!seen.has(value)) {
48
+ seen.add(value);
49
+ emails.push(value);
50
+ }
51
+ }
52
+ else {
53
+ rest.push(part.trim());
54
+ }
55
+ }
56
+ return { emails, rest: rest.join(' ') };
57
+ }
58
+ export function InvitePeopleDialog({ workspaceId, workspaceName, open, onOpenChange, canGrantAdmin, onDone, }) {
59
+ const t = useTranslations('workspaces.invite');
60
+ const tRoles = useTranslations('workspaces.roles');
61
+ const chrome = useInAccountHubSheetBody() ? SHEET_CHROME : MODAL_CHROME;
62
+ const [emails, setEmails] = useState([]);
63
+ const [draft, setDraft] = useState('');
64
+ const [role, setRole] = useState('member');
65
+ const [expires, setExpires] = useState('');
66
+ const [failures, setFailures] = useState([]);
67
+ const commit = (text) => {
68
+ const parsed = parseInviteEmails(text, emails);
69
+ if (parsed.emails.length > 0)
70
+ setEmails((current) => [...current, ...parsed.emails]);
71
+ setDraft(parsed.rest);
72
+ return parsed;
73
+ };
74
+ const send = useMutation({
75
+ mutationFn: async (list) => {
76
+ const expiresIso = endOfLocalDayIso(expires);
77
+ const results = await Promise.allSettled(list.map((email) => inviteWorkspaceMember(workspaceId, { email, role, ...(expiresIso ? { expires_at: expiresIso } : {}) })));
78
+ return results.map((result, index) => ({
79
+ email: list[index],
80
+ ok: result.status === 'fulfilled',
81
+ message: result.status === 'rejected' ? result.reason?.message || t('sendFailed') : '',
82
+ }));
83
+ },
84
+ onSuccess: (results) => {
85
+ const sent = results.filter((result) => result.ok);
86
+ const failed = results.filter((result) => !result.ok);
87
+ if (sent.length > 0) {
88
+ successToast(t('sentToast', { count: sent.length }));
89
+ onDone?.();
90
+ }
91
+ setFailures(failed.map(({ email, message }) => ({ email, message })));
92
+ // The emails that failed stay as chips, so a fix is one more click.
93
+ setEmails(failed.map((result) => result.email));
94
+ if (failed.length === 0) {
95
+ setEmails([]);
96
+ setExpires('');
97
+ setRole('member');
98
+ onOpenChange(false);
99
+ }
100
+ },
101
+ onError: (error) => errorToast(error.message || t('sendFailed')),
102
+ });
103
+ const pending = send.isPending;
104
+ const submit = () => {
105
+ const parsed = commit(draft);
106
+ const list = [...emails, ...parsed.emails];
107
+ if (list.length === 0 || parsed.rest)
108
+ return;
109
+ send.mutate(list);
110
+ };
111
+ const onKeyDown = (event) => {
112
+ if (event.key === 'Enter' || event.key === ',' || event.key === ' ' || event.key === 'Tab') {
113
+ if (!draft.trim()) {
114
+ if (event.key === 'Enter') {
115
+ event.preventDefault();
116
+ submit();
117
+ }
118
+ return;
119
+ }
120
+ event.preventDefault();
121
+ commit(draft);
122
+ }
123
+ else if (event.key === 'Backspace' && !draft && emails.length > 0) {
124
+ setEmails((current) => current.slice(0, -1));
125
+ }
126
+ };
127
+ const invalidDraft = draft.trim().length > 0 && !isInviteEmail(draft);
128
+ const canSubmit = !pending && (emails.length > 0 || isInviteEmail(draft));
129
+ const roles = INVITE_ROLES.filter((value) => value !== 'admin' || canGrantAdmin);
130
+ return (_jsx(chrome.Root, { open: open, onOpenChange: (next) => (pending ? undefined : onOpenChange(next)), children: _jsxs(chrome.Content, { children: [_jsxs(chrome.Header, { children: [_jsx(chrome.Title, { children: t('title', { name: workspaceName }) }), _jsx(chrome.Description, { children: t('description') })] }), _jsxs("form", { className: "contents", onSubmit: (event) => {
131
+ event.preventDefault();
132
+ submit();
133
+ }, children: [_jsxs(chrome.Body, { children: [_jsxs(Field, { className: "gap-1.5", children: [_jsx(FieldLabel, { htmlFor: "invite-emails", children: t('emailsLabel') }), _jsxs("div", { className: "bg-popover focus-within:ring-ring flex min-h-9 flex-wrap items-center gap-1 rounded-md border px-2 py-1 focus-within:ring-1", "data-testid": "invite-emails", children: [emails.map((email) => (_jsxs(Badge, { variant: "secondary", size: "sm", className: "gap-1", children: [email, _jsx("button", { type: "button", "aria-label": t('removeEmail', { email }), className: "text-muted-foreground hover:text-foreground", onClick: () => setEmails((current) => current.filter((value) => value !== email)), disabled: pending, children: _jsx(XIcon, { className: "size-3" }) })] }, email))), _jsx("input", { id: "invite-emails", type: "text", inputMode: "email", autoComplete: "off", autoFocus: true, value: draft, onChange: (event) => setDraft(event.target.value), onKeyDown: onKeyDown, onBlur: () => draft.trim() && commit(draft), onPaste: (event) => {
134
+ const text = event.clipboardData.getData('text');
135
+ if (/[\s,;]/.test(text)) {
136
+ event.preventDefault();
137
+ commit(`${draft} ${text}`);
138
+ }
139
+ }, placeholder: emails.length === 0 ? t('emailsPlaceholder') : undefined, "aria-invalid": invalidDraft || undefined, disabled: pending, className: "text-foreground placeholder:text-muted-foreground min-w-32 flex-1 bg-transparent py-1 text-sm outline-none" })] }), _jsx(FieldDescription, { children: invalidDraft ? t('invalidEmail') : t('emailsHint') })] }), _jsxs(Field, { className: "gap-1.5", children: [_jsx(FieldLabel, { htmlFor: "invite-role", children: t('roleLabel') }), _jsxs(Select, { value: role, onValueChange: (value) => setRole(value), disabled: pending, children: [_jsx(SelectTrigger, { id: "invite-role", size: "md", className: "w-full", children: _jsx(SelectValue, { children: tRoles(`${role}.label`) }) }), _jsx(SelectContent, { children: roles.map((value) => (_jsx(SelectItem, { value: value, textValue: tRoles(`${value}.label`), children: _jsxs("span", { className: "flex flex-col gap-0.5", children: [_jsx("span", { children: tRoles(`${value}.label`) }), _jsx("span", { className: "text-muted-foreground text-xs", children: tRoles(`${value}.blurb`) })] }) }, value))) })] }), _jsx(FieldDescription, { children: t('ownerHint') })] }), _jsxs(Field, { className: "gap-1.5", children: [_jsxs("div", { className: "flex items-baseline justify-between gap-2", children: [_jsx(FieldLabel, { htmlFor: "invite-expires", children: t('expiresLabel') }), _jsx("span", { className: "text-muted-foreground text-xs", children: t('optional') })] }), _jsx(ExpiryPicker, { id: "invite-expires", value: expires, onChange: setExpires, disabled: pending }), _jsx(FieldDescription, { children: t('expiresHint') })] }), failures.length > 0 ? (_jsx("ul", { role: "alert", className: "space-y-1", "data-testid": "invite-failures", children: failures.map((failure) => (_jsxs("li", { className: "text-destructive text-xs", children: [_jsx("span", { className: "font-medium", children: failure.email }), ": ", failure.message] }, failure.email))) })) : null] }), _jsxs(chrome.Footer, { children: [_jsx(Button, { type: "button", variant: "outline-ghost", size: "sm", disabled: pending, onClick: () => onOpenChange(false), children: t('cancel') }), _jsxs(Button, { type: "submit", size: "sm", disabled: !canSubmit, className: "gap-1.5", "data-testid": "invite-send", children: [pending ? _jsx(Loading, { className: "size-4 shrink-0" }) : null, t('send', { count: Math.max(1, emails.length + (isInviteEmail(draft) ? 1 : 0)) })] })] })] })] }) }));
140
+ }
@@ -107,9 +107,10 @@ export function everyoneMatchesQuery(label, query) {
107
107
  const q = query.trim().toLowerCase();
108
108
  return q === '' || label.toLowerCase().includes(q);
109
109
  }
110
- export function PrincipalPicker({ scope, selection = 'multi', kinds = ['member', 'group'], allowInvite = false, everyone, excludeUserIds, value, onChange, emptyLabel = 'No members or groups here yet.', allExcludedLabel = 'Everyone is already added.', autoFocus = true, disabled = false, searchPlaceholder, className, }) {
110
+ export function PrincipalPicker({ scope, selection = 'multi', kinds = ['member', 'group'], allowInvite = false, everyone, excludeUserIds, value, onChange, emptyLabel, allExcludedLabel, autoFocus = true, disabled = false, searchPlaceholder, className, }) {
111
111
  const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
112
112
  const tAgents = useTranslations('agentPrincipals');
113
+ const tSharing = useTranslations('accessSharing');
113
114
  const [query, setQuery] = useState('');
114
115
  // Single mode collapses to a "selected + Change" row once something is
115
116
  // chosen; `editing` re-opens the list without clearing the value.
@@ -255,7 +256,7 @@ export function PrincipalPicker({ scope, selection = 'multi', kinds = ['member',
255
256
  return (_jsxs("div", { className: cn('border-border overflow-hidden rounded-md border', className), children: [_jsxs(InputGroupSearch, { className: "border-b", children: [_jsx(InputGroupSearchIcon, { children: _jsx(MagnifyingGlassIcon, {}) }), _jsx(InputGroupSearchInput, { value: query, onChange: (event) => setQuery(event.target.value), placeholder: placeholder, variant: "popover", disabled: disabled,
256
257
  // Every caller opens this as the first interactive element of a
257
258
  // fresh dialog — typing starts the instant it is open.
258
- autoFocus: autoFocus }), query ? _jsx(InputGroupSearchClear, { onClick: () => setQuery('') }) : null] }), selection === 'multi' && selectedCount > 0 ? (_jsxs("div", { className: "border-border flex items-center justify-between border-b px-3 py-1.5", children: [_jsxs("span", { className: "text-muted-foreground text-xs", children: [selectedCount, " ", tI18nComplete.raw('textd7cbbb688b2e')] }), _jsx(Button, { type: "button", variant: "ghost", size: "sm", className: "h-6 px-2 text-xs", disabled: disabled, onClick: () => onChange(EMPTY_PRINCIPAL_SELECTION), children: tI18nComplete.raw('text83b12c2216ef') })] })) : null, _jsx("div", { className: "max-h-56 overflow-y-auto p-1", children: loading ? (_jsx("div", { className: "space-y-1 p-1", children: [0, 1, 2].map((i) => (_jsxs("div", { className: "flex items-center gap-2.5 px-2 py-1.5", children: [_jsx(Skeleton, { className: "size-6 rounded-full" }), _jsx(Skeleton, { className: "h-3.5 w-40" })] }, i))) })) : nothing ? (_jsx("p", { className: "text-muted-foreground px-3 py-6 text-center text-xs", children: emptyLabel })) : allExcluded ? (_jsx("p", { className: "text-muted-foreground px-3 py-6 text-center text-xs", children: allExcludedLabel })) : filteredGroups.length === 0 &&
259
+ autoFocus: autoFocus }), query ? _jsx(InputGroupSearchClear, { onClick: () => setQuery('') }) : null] }), selection === 'multi' && selectedCount > 0 ? (_jsxs("div", { className: "border-border flex items-center justify-between border-b px-3 py-1.5", children: [_jsxs("span", { className: "text-muted-foreground text-xs", children: [selectedCount, " ", tI18nComplete.raw('textd7cbbb688b2e')] }), _jsx(Button, { type: "button", variant: "ghost", size: "sm", className: "h-6 px-2 text-xs", disabled: disabled, onClick: () => onChange(EMPTY_PRINCIPAL_SELECTION), children: tI18nComplete.raw('text83b12c2216ef') })] })) : null, _jsx("div", { className: "max-h-56 overflow-y-auto p-1", children: loading ? (_jsx("div", { className: "space-y-1 p-1", children: [0, 1, 2].map((i) => (_jsxs("div", { className: "flex items-center gap-2.5 px-2 py-1.5", children: [_jsx(Skeleton, { className: "size-6 rounded-full" }), _jsx(Skeleton, { className: "h-3.5 w-40" })] }, i))) })) : nothing ? (_jsx("p", { className: "text-muted-foreground px-3 py-6 text-center text-xs", children: emptyLabel ?? tSharing('pickerEmpty') })) : allExcluded ? (_jsx("p", { className: "text-muted-foreground px-3 py-6 text-center text-xs", children: allExcludedLabel ?? tSharing('pickerAllAdded') })) : filteredGroups.length === 0 &&
259
260
  filteredMembers.length === 0 &&
260
261
  filteredAgents.length === 0 &&
261
262
  !inviteCandidate &&
@@ -17,11 +17,11 @@ import { useMemo } from 'react';
17
17
  const DEFAULT_EMPTY_TEXT = {
18
18
  none: 'No projects in this account yet.',
19
19
  allExcluded: 'Already attached to every project you can manage.',
20
- noneEligible: 'You need Manager access on a project to attach a group to it.',
20
+ noneEligible: 'You need Manager access on a workspace to attach a group to it.',
21
21
  };
22
22
  /** Sentinel for the optional "every project" row — never a real project id. */
23
23
  export const PROJECT_SELECT_ALL = '__all__';
24
- export function ProjectSelect({ accountId, value, onChange, filter, excludeIds, allOptionLabel, disabled, placeholder = 'Choose a project', emptyText, enabled = true, requireAction, id, className, }) {
24
+ export function ProjectSelect({ accountId, value, onChange, filter, excludeIds, allOptionLabel, disabled, placeholder = 'Choose a workspace', emptyText, enabled = true, requireAction, id, className, }) {
25
25
  const projectsQuery = useQuery({
26
26
  queryKey: qk.projects.list(accountId),
27
27
  queryFn: () => listProjectsForAccount(accountId),
@@ -23,17 +23,18 @@ interface RoleDescriptor {
23
23
  summary: string;
24
24
  }
25
25
  /**
26
- * Single source of truth for how a built-in role is described in the UI.
27
- * Copy lifted verbatim from `components/iam/project-role-descriptors.ts`
28
- * so no wording changes as part of the unification.
26
+ * Single source of truth for how a built-in role is described in the UI. One
27
+ * workspace ladder (design.md C3): Owner > Admin > Manager > Member. The
28
+ * storage still has two scopes (owner/admin/member on the account, manager on
29
+ * the workspace's project), but a person reads one role per workspace, so the
30
+ * labels never say "account" or "project".
29
31
  */
30
32
  export declare const ACCOUNT_ROLE_DESCRIPTORS: Record<AccountRole, RoleDescriptor>;
31
33
  /**
32
- * The two project roles, and the whole difference between them (Marko,
33
- * 2026-09-03): a member USES agents — the ones they are granted — and a
34
- * project manager CONFIGURES the project, which is Customize. Nothing in
35
- * between. The keys stay `member` / `manager` (they are the API's role
36
- * keys and the URL vocabulary); only what a person reads changed.
34
+ * The two rungs a workspace's project row stores (Marko, 2026-09-03): a
35
+ * member USES agents — the ones they are granted — and a manager CONFIGURES
36
+ * the workspace, which is Customize. The keys stay `member` / `manager` (they
37
+ * are the API's role keys and the URL vocabulary).
37
38
  */
38
39
  export declare const PROJECT_ROLE_DESCRIPTORS: Record<OfferedProjectRole, RoleDescriptor>;
39
40
  export declare function builtinRoleDescriptor(scope: RoleScope, role: AccountRole | ProjectRole, tI18nComplete?: UiTranslator): RoleDescriptor | undefined;
@@ -43,44 +43,41 @@ export function builtinRolesForScope(scope) {
43
43
  return scope === 'account' ? [...ACCOUNT_ROLES_ASCENDING] : [...PROJECT_ROLES_ASCENDING];
44
44
  }
45
45
  /**
46
- * Single source of truth for how a built-in role is described in the UI.
47
- * Copy lifted verbatim from `components/iam/project-role-descriptors.ts`
48
- * so no wording changes as part of the unification.
46
+ * Single source of truth for how a built-in role is described in the UI. One
47
+ * workspace ladder (design.md C3): Owner > Admin > Manager > Member. The
48
+ * storage still has two scopes (owner/admin/member on the account, manager on
49
+ * the workspace's project), but a person reads one role per workspace, so the
50
+ * labels never say "account" or "project".
49
51
  */
50
52
  export const ACCOUNT_ROLE_DESCRIPTORS = {
51
53
  owner: {
52
- label: 'Account owner',
53
- blurb: 'Full control of the account: billing, members, transfer or delete it.',
54
- summary: 'Full control of the account — billing, members, transferring ownership, deleting it. Project manager on every project.',
54
+ label: 'Owner',
55
+ blurb: 'Full control: billing, people, and deleting the workspace.',
56
+ summary: 'Full control of the workspace: billing, people, transferring ownership and deleting it.',
55
57
  },
56
58
  admin: {
57
- label: 'Account admin',
58
- blurb: 'Everything except deleting the account or transferring ownership.',
59
- summary: 'Everything an owner can do except deleting the account or transferring ownership. Project manager on every project.',
59
+ label: 'Admin',
60
+ blurb: 'Billing and people. Everything except deleting the workspace or transferring ownership.',
61
+ summary: 'Everything an owner can do except deleting the workspace or transferring ownership.',
60
62
  },
61
63
  member: {
62
- label: 'Account member',
63
- blurb: 'Sees only the projects they are added to, and only the agents granted there.',
64
- summary: 'The floor role for the account. Sees only the projects they are added to, directly or through a group, and uses only the agents granted to them there.',
64
+ label: 'Member',
65
+ blurb: 'Works in sessions with the agents they are granted.',
66
+ summary: 'The floor role. Works in sessions with the agents they are granted, directly or through a group. No Customize.',
65
67
  },
66
68
  };
67
69
  /**
68
- * The two project roles, and the whole difference between them (Marko,
69
- * 2026-09-03): a member USES agents — the ones they are granted — and a
70
- * project manager CONFIGURES the project, which is Customize. Nothing in
71
- * between. The keys stay `member` / `manager` (they are the API's role
72
- * keys and the URL vocabulary); only what a person reads changed.
70
+ * The two rungs a workspace's project row stores (Marko, 2026-09-03): a
71
+ * member USES agents — the ones they are granted — and a manager CONFIGURES
72
+ * the workspace, which is Customize. The keys stay `member` / `manager` (they
73
+ * are the API's role keys and the URL vocabulary).
73
74
  */
74
75
  export const PROJECT_ROLE_DESCRIPTORS = {
75
- member: {
76
- label: 'Project member',
77
- blurb: 'Starts and works in sessions with the agents they are granted. No Customize.',
78
- summary: 'Starts and works in sessions with the agents they are granted — nothing else. No access to Customize. The project floor role.',
79
- },
76
+ member: ACCOUNT_ROLE_DESCRIPTORS.member,
80
77
  manager: {
81
- label: 'Project manager',
82
- blurb: 'Customize and everything in it — every agent, skill, connector, secret, trigger, and member.',
83
- summary: 'Customize and everything in it — every agent, skill, connector, secret and trigger, plus members and the project itself.',
78
+ label: 'Manager',
79
+ blurb: 'Customize and everything in it: every agent, skill, connector, secret and trigger.',
80
+ summary: 'Customize and everything in it: every agent, skill, connector, secret and trigger.',
84
81
  },
85
82
  };
86
83
  export function builtinRoleDescriptor(scope, role, tI18nComplete) {
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Change a person's one role in a workspace (design.md C3):
3
+ * `PATCH /v1/workspaces/:id/members/:userId {role}`. The ladder is Owner >
4
+ * Admin > Manager > Member; the server writes the storage each rung needs, and
5
+ * only an owner can make an owner.
6
+ */
7
+ import { type WorkspaceRole } from '@kortix/sdk';
8
+ /** The ladder, highest first. */
9
+ export declare const WORKSPACE_ROLE_LADDER: readonly WorkspaceRole[];
10
+ /** The roles a caller may give: Owner only by an owner; Admin only with `member.update`. */
11
+ export declare function assignableWorkspaceRoles(input: {
12
+ viewerIsOwner: boolean;
13
+ canGrantAdmin: boolean;
14
+ }): WorkspaceRole[];
15
+ export interface WorkspaceRoleDialogProps {
16
+ workspaceId: string;
17
+ target: {
18
+ userId: string;
19
+ label: string;
20
+ role: WorkspaceRole;
21
+ } | null;
22
+ onOpenChange: (open: boolean) => void;
23
+ viewerIsOwner: boolean;
24
+ canGrantAdmin: boolean;
25
+ onDone?: () => void;
26
+ }
27
+ export declare function WorkspaceRoleDialog({ workspaceId, target, onOpenChange, viewerIsOwner, canGrantAdmin, onDone, }: WorkspaceRoleDialogProps): import("react").JSX.Element;
@@ -0,0 +1,48 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ /**
4
+ * Change a person's one role in a workspace (design.md C3):
5
+ * `PATCH /v1/workspaces/:id/members/:userId {role}`. The ladder is Owner >
6
+ * Admin > Manager > Member; the server writes the storage each rung needs, and
7
+ * only an owner can make an owner.
8
+ */
9
+ import { updateWorkspaceMemberRole } from '@kortix/sdk';
10
+ import { useMutation } from '@tanstack/react-query';
11
+ import { useState } from 'react';
12
+ import { useTranslations } from '../../i18n/index.js';
13
+ import { Button } from '../../primitives/button.js';
14
+ import { Field, FieldLabel } from '../../primitives/field.js';
15
+ import Loading from '../../primitives/loading.js';
16
+ import { Modal, ModalBody, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalTitle, } from '../../primitives/modal.js';
17
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../../primitives/select.js';
18
+ import { errorToast, successToast } from '../../primitives/toast.js';
19
+ /** The ladder, highest first. */
20
+ export const WORKSPACE_ROLE_LADDER = ['owner', 'admin', 'manager', 'member'];
21
+ /** The roles a caller may give: Owner only by an owner; Admin only with `member.update`. */
22
+ export function assignableWorkspaceRoles(input) {
23
+ return WORKSPACE_ROLE_LADDER.filter((role) => (role !== 'owner' || input.viewerIsOwner) && (role !== 'admin' || input.canGrantAdmin));
24
+ }
25
+ export function WorkspaceRoleDialog({ workspaceId, target, onOpenChange, viewerIsOwner, canGrantAdmin, onDone, }) {
26
+ const t = useTranslations('workspaces.roleDialog');
27
+ const tRoles = useTranslations('workspaces.roles');
28
+ const [picked, setPicked] = useState(null);
29
+ const role = picked ?? target?.role ?? 'member';
30
+ const roles = assignableWorkspaceRoles({ viewerIsOwner, canGrantAdmin });
31
+ const save = useMutation({
32
+ mutationFn: () => updateWorkspaceMemberRole(workspaceId, target.userId, role),
33
+ onSuccess: () => {
34
+ successToast(t('savedToast', { name: target?.label ?? '', role: tRoles(`${role}.label`) }));
35
+ setPicked(null);
36
+ onOpenChange(false);
37
+ onDone?.();
38
+ },
39
+ onError: (error) => errorToast(error.message || t('saveFailed')),
40
+ });
41
+ return (_jsx(Modal, { open: target !== null, onOpenChange: (open) => {
42
+ if (save.isPending)
43
+ return;
44
+ if (!open)
45
+ setPicked(null);
46
+ onOpenChange(open);
47
+ }, children: _jsxs(ModalContent, { className: "sm:max-w-md", children: [_jsxs(ModalHeader, { children: [_jsx(ModalTitle, { children: t('title', { name: target?.label ?? '' }) }), _jsx(ModalDescription, { children: t('description') })] }), _jsx(ModalBody, { children: _jsxs(Field, { className: "gap-1.5", children: [_jsx(FieldLabel, { htmlFor: "workspace-role", children: t('roleLabel') }), _jsxs(Select, { value: role, onValueChange: (value) => setPicked(value), disabled: save.isPending, children: [_jsx(SelectTrigger, { id: "workspace-role", size: "md", className: "w-full", children: _jsx(SelectValue, { children: tRoles(`${role}.label`) }) }), _jsx(SelectContent, { children: roles.map((value) => (_jsx(SelectItem, { value: value, textValue: tRoles(`${value}.label`), children: _jsxs("span", { className: "flex flex-col gap-0.5", children: [_jsx("span", { children: tRoles(`${value}.label`) }), _jsx("span", { className: "text-muted-foreground text-xs", children: tRoles(`${value}.blurb`) })] }) }, value))) })] })] }) }), _jsxs(ModalFooter, { children: [_jsx(Button, { variant: "outline-ghost", size: "sm", disabled: save.isPending, onClick: () => onOpenChange(false), children: t('cancel') }), _jsxs(Button, { size: "sm", className: "gap-1.5", disabled: save.isPending || role === target?.role, onClick: () => save.mutate(), children: [save.isPending ? _jsx(Loading, { className: "size-4 shrink-0" }) : null, t('save')] })] })] }) }));
48
+ }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * "Add a GitHub account" — the ONE dialog for linking a GitHub personal
3
- * account or organization to a Kortix account. The account Git tab and `/new`
3
+ * account or organization to a Kortix account. The account Git tab and `/workspaces/new`
4
4
  * both open it, so the two surfaces can never drift into two different
5
5
  * stories about how a connection is made.
6
6
  *
@@ -8,7 +8,7 @@ import { rememberGitHubSetupReturn } from '../../internal/lib/github-installatio
8
8
  import { GithubLogoIcon as Github } from '@phosphor-icons/react';
9
9
  /**
10
10
  * "Add a GitHub account" — the ONE dialog for linking a GitHub personal
11
- * account or organization to a Kortix account. The account Git tab and `/new`
11
+ * account or organization to a Kortix account. The account Git tab and `/workspaces/new`
12
12
  * both open it, so the two surfaces can never drift into two different
13
13
  * stories about how a connection is made.
14
14
  *
@@ -51,3 +51,21 @@ export declare function defaultExpiryOption(policy: PatPolicy | null | undefined
51
51
  * testable.
52
52
  */
53
53
  export declare function expiresAtIso(value: ExpiryOptionValue, now?: number): string | undefined;
54
+ /**
55
+ * What a person may pick for a new API key (a workspace key or a personal
56
+ * key). Unlike a service account, a key always expires unless the workspace
57
+ * policy allows no expiry (`allow_no_expiry`, and not `require_expiry`):
58
+ *
59
+ * - every preset up to the policy maximum (365 days when none is set);
60
+ * - a maximum shorter than every preset becomes the only offer;
61
+ * - "Never" only when the policy allows it.
62
+ */
63
+ export declare function keyExpiryOptions(policy: PatPolicy | null | undefined, tI18nComplete: UiTranslator): ExpiryOption[];
64
+ /** The pre-selected expiry of a new key: 90 days, or the longest the policy allows. */
65
+ export declare function defaultKeyExpiryOption(policy: PatPolicy | null | undefined, tI18nComplete: UiTranslator): ExpiryOptionValue;
66
+ /**
67
+ * The `expiresAt` a key mint sends: an ISO instant, or `null` for "Never".
68
+ * `null` is explicit because the API gives a key without `expires_at` the
69
+ * default lifetime (90 days), not "no expiry".
70
+ */
71
+ export declare function keyExpiresAt(value: ExpiryOptionValue, now?: number): string | null;