@kortix/ui 0.15.7 → 0.15.9

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 (262) hide show
  1. package/README.md +7 -7
  2. package/dist/_vendor/kortix-shared.js +39 -1
  3. package/dist/_vendor/shared/my-kortix-agent.d.ts +7 -0
  4. package/dist/_vendor/shared/pixel-mark.d.ts +18 -0
  5. package/dist/access/access/access-dialog-share.js +12 -6
  6. package/dist/access/access/share-selection.d.ts +9 -0
  7. package/dist/access/access/share-selection.js +64 -0
  8. package/dist/customize/connectors/catalog/connector-categories.d.ts +2 -2
  9. package/dist/customize/connectors/catalog/connector-categories.js +2 -2
  10. package/dist/customize/connectors/connector-identity.js +3 -3
  11. package/dist/customize/connectors/detail/app-page.js +2 -2
  12. package/dist/customize/connectors/detail/connector-accounts.d.ts +3 -1
  13. package/dist/customize/connectors/detail/connector-accounts.js +2 -2
  14. package/dist/customize/connectors/detail/connector-modal.js +1 -1
  15. package/dist/customize/connectors/detail/connector-notice-view.d.ts +4 -0
  16. package/dist/customize/connectors/detail/connector-notice-view.js +4 -0
  17. package/dist/customize/connectors/detail/connector-notice.d.ts +31 -4
  18. package/dist/customize/connectors/detail/connector-notice.js +23 -4
  19. package/dist/customize/connectors/detail/connector-page.js +27 -7
  20. package/dist/customize/connectors/detail/connector-status.d.ts +12 -1
  21. package/dist/customize/connectors/detail/connector-status.js +11 -0
  22. package/dist/customize/connectors/detail/status-badge.d.ts +3 -3
  23. package/dist/customize/connectors/detail/status-badge.js +2 -1
  24. package/dist/customize/connectors/detail/use-connector-detail.js +10 -2
  25. package/dist/customize/connectors/detail/use-mcp-oauth-sign-in.d.ts +13 -0
  26. package/dist/customize/connectors/detail/use-mcp-oauth-sign-in.js +29 -0
  27. package/dist/customize/providers/provider-accordion.js +5 -4
  28. package/dist/customize/providers/provider-connect.js +3 -1
  29. package/dist/customize/providers/provider-sheet.js +9 -4
  30. package/dist/customize/sections/component/email-connect-form.js +4 -2
  31. package/dist/customize/sections/connectors-view.d.ts +4 -1
  32. package/dist/customize/sections/connectors-view.js +42 -7
  33. package/dist/customize/sections/gateway-view.d.ts +1 -1
  34. package/dist/customize/sections/gateway-view.js +1 -1
  35. package/dist/customize/sections/view/account-secret-resources-panel.d.ts +15 -0
  36. package/dist/customize/sections/view/account-secret-resources-panel.js +48 -7
  37. package/dist/customize/sections/view/agent-editor-basics-fields.js +1 -1
  38. package/dist/customize/sections/view/gateway/gateway-logs.d.ts +1 -1
  39. package/dist/customize/sections/view/git-view.js +1 -1
  40. package/dist/customize/sections/view/permission-editor.js +1 -1
  41. package/dist/customize/sections/view/secret-delivery.d.ts +9 -2
  42. package/dist/customize/sections/view/secret-delivery.js +14 -4
  43. package/dist/customize/sections/view/secrets-view.js +21 -5
  44. package/dist/customize/sections/view/subscription-usage.d.ts +3 -32
  45. package/dist/customize/sections/view/subscription-usage.js +2 -86
  46. package/dist/customize/shared/entity/entity-modal.js +8 -10
  47. package/dist/customize/triggers/schedule/schedule-builder.js +1 -1
  48. package/dist/customize/triggers/schedule/schedule-copy.js +4 -0
  49. package/dist/customize/triggers/schedule/schedule-detail-sheet.js +14 -3
  50. package/dist/customize/triggers/schedule/then-fields.d.ts +3 -1
  51. package/dist/customize/triggers/schedule/then-fields.js +8 -4
  52. package/dist/customize/triggers/schedule/trigger-composer.js +1 -1
  53. package/dist/customize/triggers/schedule/trigger-list.d.ts +3 -1
  54. package/dist/customize/triggers/schedule/trigger-list.js +18 -2
  55. package/dist/customize/triggers/schedule/trigger-runs-logic.js +4 -2
  56. package/dist/customize/triggers/schedule/trigger-runs-panel.js +4 -1
  57. package/dist/files/project/components/drive-toolbar.d.ts +1 -1
  58. package/dist/files/project/components/drive-toolbar.js +1 -1
  59. package/dist/files/project/store/version-store.d.ts +1 -1
  60. package/dist/files/renderers/pptx-renderer.js +5 -20
  61. package/dist/files/renderers/presentation/FullScreenPresentationViewer.d.ts +3 -2
  62. package/dist/files/renderers/presentation/FullScreenPresentationViewer.js +23 -304
  63. package/dist/files/renderers/presentation/presentation-export-menu.d.ts +14 -0
  64. package/dist/files/renderers/presentation/presentation-export-menu.js +44 -0
  65. package/dist/files/renderers/presentation/presentation-utils.d.ts +1 -0
  66. package/dist/files/renderers/presentation/presentation-utils.js +4 -0
  67. package/dist/files/renderers/presentation/slide-iframe.d.ts +23 -0
  68. package/dist/files/renderers/presentation/slide-iframe.js +61 -0
  69. package/dist/files/renderers/presentation/use-presentation-metadata.d.ts +39 -0
  70. package/dist/files/renderers/presentation/use-presentation-metadata.js +137 -0
  71. package/dist/files/renderers/presentation/use-slide-navigation.d.ts +17 -0
  72. package/dist/files/renderers/presentation/use-slide-navigation.js +82 -0
  73. package/dist/files/renderers/shared/scroll-area-compat.d.ts +6 -6
  74. package/dist/files/renderers/shared/scroll-area-compat.js +7 -9
  75. package/dist/files/renderers/shared/select-compat.js +3 -7
  76. package/dist/files/renderers/shared/use-stage-fit-scale.d.ts +19 -0
  77. package/dist/files/renderers/shared/use-stage-fit-scale.js +41 -0
  78. package/dist/files/renderers/show-content-renderer.js +16 -11
  79. package/dist/files/renderers/xlsx/xlsx-renderer.d.ts +4 -13
  80. package/dist/files/renderers/xlsx/xlsx-renderer.js +6 -63
  81. package/dist/files/renderers/xlsx/xlsx-viewer.d.ts +4 -2
  82. package/dist/files/renderers/xlsx/xlsx-viewer.js +28 -34
  83. package/dist/files/viewer/file-content-renderer.js +1 -4
  84. package/dist/files/viewer/file-preview-modal.d.ts +10 -11
  85. package/dist/files/viewer/file-preview-modal.js +17 -18
  86. package/dist/files/viewer/use-file-content-state.js +10 -9
  87. package/dist/i18n/en.d.ts +51 -0
  88. package/dist/i18n/en.js +58 -7
  89. package/dist/index.js +1 -1
  90. package/dist/internal/account-hub/account-hub-location.js +2 -2
  91. package/dist/internal/account-hub/use-account-members.d.ts +28 -1
  92. package/dist/internal/account-hub/use-account-members.js +27 -10
  93. package/dist/internal/chrome/use-chrome-offered.d.ts +2 -1
  94. package/dist/internal/chrome/use-chrome-offered.js +4 -2
  95. package/dist/internal/components/agent-mark.d.ts +1 -8
  96. package/dist/internal/components/agent-mark.js +2 -19
  97. package/dist/internal/hooks/connectors/use-finish-sign-in.d.ts +13 -0
  98. package/dist/internal/hooks/connectors/use-finish-sign-in.js +33 -0
  99. package/dist/internal/hooks/connectors/use-pipedream-connect-member.js +6 -1
  100. package/dist/internal/hooks/connectors/use-pipedream-connect-project.js +6 -1
  101. package/dist/internal/lib/error-handler.js +33 -0
  102. package/dist/internal/lib/navigation/modified-click.js +2 -2
  103. package/dist/internal/lib/pixel-mark.d.ts +3 -20
  104. package/dist/internal/lib/pixel-mark.js +3 -34
  105. package/dist/internal/lib/trigger-clock.d.ts +7 -2
  106. package/dist/internal/lib/trigger-clock.js +17 -3
  107. package/dist/internal/stores/active-space-store.d.ts +1 -1
  108. package/dist/internal/stores/browser-recents-store.d.ts +1 -1
  109. package/dist/internal/stores/current-account-store.d.ts +1 -1
  110. package/dist/internal/stores/first-chat-store.d.ts +1 -1
  111. package/dist/internal/stores/mobile-app-promo-store.d.ts +1 -1
  112. package/dist/internal/stores/session-browser-store.d.ts +1 -1
  113. package/dist/internal/stores/session-expanded-store.d.ts +1 -1
  114. package/dist/internal/stores/session-filter-store.d.ts +1 -1
  115. package/dist/internal/stores/session-history-view-store.d.ts +1 -1
  116. package/dist/internal/stores/session-hover-store.d.ts +1 -1
  117. package/dist/internal/stores/session-hover-store.js +1 -1
  118. package/dist/internal/stores/session-panel-memory-store.d.ts +1 -1
  119. package/dist/internal/stores/sound-store.d.ts +1 -1
  120. package/dist/internal/stores/tab-store.d.ts +1 -1
  121. package/dist/internal/stores/user-preferences-store.d.ts +1 -1
  122. package/dist/internal/stores/web-notification-store.d.ts +1 -1
  123. package/dist/lib/base-ui-compat.d.ts +149 -0
  124. package/dist/lib/base-ui-compat.js +339 -0
  125. package/dist/lib/portal-container.d.ts +3 -7
  126. package/dist/lib/portal-container.js +5 -3
  127. package/dist/lib/z-stack.d.ts +9 -5
  128. package/dist/lib/z-stack.js +17 -7
  129. package/dist/primitives/accordion.d.ts +36 -5
  130. package/dist/primitives/accordion.js +41 -8
  131. package/dist/primitives/alert-dialog.d.ts +33 -11
  132. package/dist/primitives/alert-dialog.js +41 -19
  133. package/dist/primitives/avatar.d.ts +5 -2
  134. package/dist/primitives/avatar.js +3 -3
  135. package/dist/primitives/badge.js +1 -1
  136. package/dist/primitives/breadcrumb.js +1 -1
  137. package/dist/primitives/button-group.js +3 -3
  138. package/dist/primitives/button.js +1 -1
  139. package/dist/primitives/checkbox.d.ts +14 -5
  140. package/dist/primitives/checkbox.js +24 -9
  141. package/dist/primitives/collapsible.d.ts +16 -4
  142. package/dist/primitives/collapsible.js +18 -7
  143. package/dist/primitives/command-core.d.ts +121 -0
  144. package/dist/primitives/command-core.js +642 -0
  145. package/dist/primitives/command.d.ts +38 -4
  146. package/dist/primitives/command.js +22 -13
  147. package/dist/primitives/context-menu.d.ts +61 -31
  148. package/dist/primitives/context-menu.js +40 -53
  149. package/dist/primitives/dialog.d.ts +48 -10
  150. package/dist/primitives/dialog.js +48 -19
  151. package/dist/primitives/disclosure.d.ts +1 -1
  152. package/dist/primitives/disclosure.js +2 -2
  153. package/dist/primitives/drawer.d.ts +28 -9
  154. package/dist/primitives/drawer.js +42 -18
  155. package/dist/primitives/dropdown-menu.d.ts +55 -33
  156. package/dist/primitives/dropdown-menu.js +46 -82
  157. package/dist/primitives/faded-scroll-area.js +2 -1
  158. package/dist/primitives/hint.js +3 -3
  159. package/dist/primitives/hover-card.d.ts +17 -5
  160. package/dist/primitives/hover-card.js +45 -8
  161. package/dist/primitives/item.js +2 -2
  162. package/dist/primitives/label.d.ts +5 -2
  163. package/dist/primitives/label.js +10 -3
  164. package/dist/primitives/menu-base.d.ts +150 -0
  165. package/dist/primitives/menu-base.js +171 -0
  166. package/dist/primitives/menu-recipe.d.ts +1 -1
  167. package/dist/primitives/menu-recipe.js +2 -7
  168. package/dist/primitives/modal.d.ts +19 -52
  169. package/dist/primitives/modal.js +24 -28
  170. package/dist/primitives/navigation-menu.d.ts +36 -11
  171. package/dist/primitives/navigation-menu.js +31 -12
  172. package/dist/primitives/popover.d.ts +31 -6
  173. package/dist/primitives/popover.js +79 -12
  174. package/dist/primitives/preview-image.d.ts +18 -7
  175. package/dist/primitives/preview-image.js +14 -11
  176. package/dist/primitives/progress.d.ts +4 -2
  177. package/dist/primitives/progress.js +4 -3
  178. package/dist/primitives/project-icon-picker.js +2 -2
  179. package/dist/primitives/radio-group.d.ts +28 -5
  180. package/dist/primitives/radio-group.js +18 -10
  181. package/dist/primitives/scroll-area.d.ts +2 -2
  182. package/dist/primitives/scroll-area.js +8 -3
  183. package/dist/primitives/select.d.ts +55 -12
  184. package/dist/primitives/select.js +93 -36
  185. package/dist/primitives/separator.d.ts +6 -2
  186. package/dist/primitives/separator.js +10 -2
  187. package/dist/primitives/sheet.d.ts +17 -10
  188. package/dist/primitives/sheet.js +19 -22
  189. package/dist/primitives/sidebar-menu-primitives.js +8 -8
  190. package/dist/primitives/slider-native.d.ts +2 -2
  191. package/dist/primitives/slider-native.js +11 -9
  192. package/dist/primitives/slider.d.ts +24 -6
  193. package/dist/primitives/slider.js +26 -24
  194. package/dist/primitives/slot.d.ts +6 -0
  195. package/dist/primitives/slot.js +7 -0
  196. package/dist/primitives/split-sheet.js +1 -1
  197. package/dist/primitives/stepper.js +1 -1
  198. package/dist/primitives/switch.d.ts +16 -3
  199. package/dist/primitives/switch.js +7 -6
  200. package/dist/primitives/tabs.d.ts +36 -20
  201. package/dist/primitives/tabs.js +131 -102
  202. package/dist/primitives/toggle.d.ts +16 -3
  203. package/dist/primitives/toggle.js +8 -3
  204. package/dist/primitives/tooltip.d.ts +24 -5
  205. package/dist/primitives/tooltip.js +32 -10
  206. package/dist/primitives/type-to-confirm-dialog.d.ts +1 -1
  207. package/dist/primitives/type-to-confirm-dialog.js +1 -1
  208. package/dist/session/composer/animated-placeholder.js +1 -1
  209. package/dist/session/composer/chat-input/chat-input-control.js +3 -3
  210. package/dist/session/composer/editor/composer-editor.js +1 -1
  211. package/dist/session/composer/menus/menu-shell.d.ts +1 -1
  212. package/dist/session/composer/menus/menu-shell.js +1 -1
  213. package/dist/session/composer/menus/mount.js +1 -1
  214. package/dist/session/composer/reasoning-effort-selector.js +1 -1
  215. package/dist/session/header/session-site-header.js +2 -2
  216. package/dist/session/header/subagent-hover-card.js +2 -2
  217. package/dist/session/media/image-preview.js +1 -1
  218. package/dist/session/models/model-connection-gate.js +16 -3
  219. package/dist/session/models/model-picker-panel.js +6 -2
  220. package/dist/session/models/model-selector.d.ts +1 -1
  221. package/dist/session/models/model-selector.js +18 -12
  222. package/dist/session/models/provider-key-action.d.ts +10 -0
  223. package/dist/session/models/provider-key-action.js +35 -0
  224. package/dist/session/models/provider-key-slot.d.ts +9 -0
  225. package/dist/session/models/provider-key-slot.js +19 -0
  226. package/dist/session/models/subscription-switcher.d.ts +37 -0
  227. package/dist/session/models/subscription-switcher.js +97 -0
  228. package/dist/session/models/subscription-windows.d.ts +40 -0
  229. package/dist/session/models/subscription-windows.js +86 -0
  230. package/dist/session/overrides/session-overrides-control.js +3 -3
  231. package/dist/session/panel/diff-dialog.js +1 -1
  232. package/dist/session/panel/easy/detail-view.js +3 -3
  233. package/dist/session/panel/mobile-tool-drawer.js +2 -2
  234. package/dist/session/panel/panel-fallback.js +1 -1
  235. package/dist/session/panel/session-files-explorer.d.ts +1 -1
  236. package/dist/session/panel/session-files-explorer.js +1 -1
  237. package/dist/session/prompts/session-connect-prompt.d.ts +40 -0
  238. package/dist/session/prompts/session-connect-prompt.js +126 -0
  239. package/dist/session/status/session-error-banner.d.ts +1 -1
  240. package/dist/session/status/session-error-banner.js +12 -4
  241. package/dist/session/thread/session-chat.js +9 -4
  242. package/dist/session/thread/session-context-message-explorer.js +1 -1
  243. package/dist/session/thread/transcript.js +31 -7
  244. package/dist/session/thread/turn-share.js +3 -4
  245. package/dist/session/tool/shared/show-helpers.js +1 -1
  246. package/dist/session/turn/message-time-label.js +1 -1
  247. package/dist/styles.css +1 -1
  248. package/dist/test-utils/intl.d.ts +51 -0
  249. package/dist/workspace/projects/modal/project-icon-field.js +9 -23
  250. package/dist/workspace/review/review-center.js +1 -1
  251. package/dist/workspace/sessions/session-row.js +1 -1
  252. package/dist/workspace/sidebar/project-session-list.js +2 -2
  253. package/dist/workspace/sidebar/session-brief-hover-card.d.ts +1 -1
  254. package/dist/workspace/sidebar/session-brief-hover-card.js +3 -3
  255. package/dist/workspace/sidebar/session-title.d.ts +2 -2
  256. package/dist/workspace/sidebar/session-title.js +2 -2
  257. package/dist/workspace/sidebar/workspace-menu-section.js +1 -1
  258. package/dist/workspace/spaces/space-links.js +1 -1
  259. package/dist/workspace/spaces/space-threads-tab.js +1 -1
  260. package/package.json +16 -35
  261. package/skills/kortix-ui/SKILL.md +1 -1
  262. package/skills/kortix-ui/references/custom-dashboard.md +1 -1
@@ -1,19 +1,41 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import * as TooltipPrimitive from '@radix-ui/react-tooltip';
3
+ import { Tooltip as TooltipPrimitive } from '@base-ui/react/tooltip';
4
4
  import * as React from 'react';
5
+ import { asChildRender, splitPosition, stateRender, FLOATING_LAYER_ATTR, } from '../lib/base-ui-compat.js';
5
6
  import { withPortalContainer } from '../lib/portal-container.js';
6
7
  import { cn } from '../lib/utils.js';
7
8
  const TooltipPortal = withPortalContainer(TooltipPrimitive.Portal);
8
- const TooltipProvider = TooltipPrimitive.Provider;
9
+ // `delayed-open` is the open value Radix gave a tooltip that opened on hover.
10
+ const tooltipState = (s) => (s.open ? 'delayed-open' : 'closed');
11
+ /** The hover delay, set on `Tooltip` (per tooltip) or `TooltipProvider` (for a subtree). */
12
+ const TooltipDelayContext = React.createContext(undefined);
13
+ // Radix's defaults, kept so an unconfigured tooltip opens as it did.
14
+ const DEFAULT_DELAY = 700;
15
+ const DEFAULT_SKIP_DELAY = 300;
16
+ function TooltipProvider({ delayDuration, skipDelayDuration, children, }) {
17
+ return (_jsx(TooltipPrimitive.Provider, { delay: delayDuration ?? DEFAULT_DELAY, timeout: skipDelayDuration ?? DEFAULT_SKIP_DELAY, children: _jsx(TooltipDelayContext.Provider, { value: delayDuration, children: children }) }));
18
+ }
9
19
  /** @deprecated In feature code use `Hint` (`@kortix/ui/hint`). `Tooltip` is the primitive `Hint` builds on. */
10
- const Tooltip = TooltipPrimitive.Root;
11
- const TooltipTrigger = TooltipPrimitive.Trigger;
20
+ function Tooltip({ open, defaultOpen, onOpenChange, delayDuration, disableHoverableContent, children, }) {
21
+ const inherited = React.useContext(TooltipDelayContext);
22
+ return (_jsx(TooltipPrimitive.Root, { open: open, defaultOpen: defaultOpen, onOpenChange: onOpenChange ? (next) => onOpenChange(next) : undefined, disableHoverablePopup: disableHoverableContent, children: _jsx(TooltipDelayContext.Provider, { value: delayDuration ?? inherited, children: children }) }));
23
+ }
24
+ const TooltipTrigger = React.forwardRef(({ asChild, children, ...props }, ref) => {
25
+ const delay = React.useContext(TooltipDelayContext);
26
+ const slot = asChildRender(asChild, children);
27
+ return (_jsx(TooltipPrimitive.Trigger, { ref: ref, delay: delay ?? DEFAULT_DELAY, ...props, render: stateRender('button', tooltipState, slot.render), children: slot.children }));
28
+ });
29
+ TooltipTrigger.displayName = 'TooltipTrigger';
12
30
  /** @deprecated In feature code use `Hint` (`@kortix/ui/hint`). */
13
- const TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => (_jsx(TooltipPortal, { children: _jsx(TooltipPrimitive.Content, { ref: ref, "data-slot": "tooltip-content", sideOffset: sideOffset,
14
- // No enter/exit animation, the same as the dropdown, select and popover
15
- // panels: the tooltip paints on the frame it mounts and unmounts on the
16
- // frame it closes. The hover delay lives on `TooltipProvider`, not here.
17
- className: cn('bg-foreground text-background ring-foreground/5 z-[9999] overflow-hidden rounded-sm p-1 px-2 text-[length:var(--text-xs,0.8125rem)] ring-[1px]', className), ...props }) })));
18
- TooltipContent.displayName = TooltipPrimitive.Content.displayName;
31
+ const TooltipContent = React.forwardRef(({ className, sideOffset = 4, asChild, forceMount, children, ...rest }, ref) => {
32
+ const { positioner, rest: props } = splitPosition({ sideOffset, ...rest });
33
+ const slot = asChildRender(asChild, children);
34
+ return (_jsx(TooltipPortal, { keepMounted: forceMount, children: _jsx(TooltipPrimitive.Positioner, { ...positioner, ...FLOATING_LAYER_ATTR, className: "z-[9999]", children: _jsx(TooltipPrimitive.Popup, { ref: ref, "data-slot": "tooltip-content",
35
+ // No enter/exit animation, the same as the dropdown, select and popover
36
+ // panels: the tooltip paints on the frame it mounts and unmounts on the
37
+ // frame it closes. The hover delay lives on `TooltipProvider`, not here.
38
+ className: cn('bg-foreground text-background ring-foreground/5 z-[9999] overflow-hidden rounded-sm p-1 px-2 text-[length:var(--text-xs,0.8125rem)] ring-[1px]', className), ...props, render: stateRender('div', tooltipState, slot.render), children: slot.children }) }) }));
39
+ });
40
+ TooltipContent.displayName = 'TooltipContent';
19
41
  export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
@@ -27,7 +27,7 @@
27
27
  * workspace.
28
28
  *
29
29
  * The matcher is `confirmationPhraseMatches` below, exported and tested
30
- * separately: this dialog renders through a Radix portal, which emits nothing
30
+ * separately: this dialog renders through a portal, which emits nothing
31
31
  * under `renderToStaticMarkup`, so a test that reached for the button's
32
32
  * `disabled` attribute in rendered output would silently be unable to fail.
33
33
  * See `type-to-confirm-dialog.test.ts`.
@@ -29,7 +29,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
29
29
  * workspace.
30
30
  *
31
31
  * The matcher is `confirmationPhraseMatches` below, exported and tested
32
- * separately: this dialog renders through a Radix portal, which emits nothing
32
+ * separately: this dialog renders through a portal, which emits nothing
33
33
  * under `renderToStaticMarkup`, so a test that reached for the button's
34
34
  * `disabled` attribute in rendered output would silently be unable to fail.
35
35
  * See `type-to-confirm-dialog.test.ts`.
@@ -115,5 +115,5 @@ export function AnimatedComposerPlaceholder({ placeholder, active, }) {
115
115
  // wrapper's edge while the caret underneath it sits one inset further
116
116
  // in — the placeholder and the cursor stop agreeing on where the line
117
117
  // starts. See composer-text-metrics.ts.
118
- className: cn('text-muted-foreground pointer-events-none absolute inset-x-1 top-0 overflow-hidden text-sm', COMPOSER_TEXT_METRICS), children: _jsx(AnimatePresence, { mode: "popLayout", initial: false, children: _jsx(m.span, { initial: swap.initial, animate: swap.animate, exit: swap.exit, transition: swap.transition, className: "block min-w-0 truncate", children: variants[index] }, `${index}:${variants[index]}`) }) }));
118
+ className: cn('text-muted-foreground pointer-events-none absolute inset-x-1 top-0 overflow-hidden text-base sm:text-sm', COMPOSER_TEXT_METRICS), children: _jsx(AnimatePresence, { mode: "popLayout", initial: false, children: _jsx(m.span, { initial: swap.initial, animate: swap.animate, exit: swap.exit, transition: swap.transition, className: "block min-w-0 truncate", children: variants[index] }, `${index}:${variants[index]}`) }) }));
119
119
  }
@@ -265,7 +265,7 @@ export function ChatInputControl({ agents, selectedAgent, onAgentChange, agentLo
265
265
  The panel opens from the composer card, not from the trigger: its left
266
266
  edge is the card's left edge and its bottom edge sits just above the
267
267
  card's top (or the top of the strip stacked on it: the queue, a notice).
268
- Radix still anchors to the trigger; the offsets below move the panel from
268
+ The positioner still anchors to the trigger; the offsets below move the panel from
269
269
  the trigger to the card. Measured on open and on resize. A composer
270
270
  without a card (none found) keeps the trigger's position.
271
271
  */
@@ -536,12 +536,12 @@ export function ChatInputControl({ agents, selectedAgent, onAgentChange, agentLo
536
536
  }
537
537
  },
538
538
  // The editors' selects open in their own portals, and a dialog opened
539
- // from inside is outside too. Radix would close this panel under the cursor.
539
+ // from inside is outside too. The popover would close this panel under the cursor.
540
540
  onInteractOutside: (event) => {
541
541
  const target = event.target;
542
542
  if (saving ||
543
543
  foreignDialogOpen(contentRef.current) ||
544
- target?.closest('[data-radix-popper-content-wrapper], [role="dialog"]'))
544
+ target?.closest('[data-kortix-floating], [role="dialog"]'))
545
545
  event.preventDefault();
546
546
  }, onFocusOutside: (event) => {
547
547
  if (foreignDialogOpen(contentRef.current))
@@ -459,5 +459,5 @@ export const ComposerEditor = forwardRef(function ComposerEditor({ placeholder,
459
459
  // page on focus for any input under 16px, and the composer is the one
460
460
  // field on the screen. `sm:text-sm` above 640px, which is the size
461
461
  // `styles/components.css`'s slash-trigger rule already documents.
462
- 'kortix-composer-editor w-full text-sm', disabled && 'opacity-50') }), ultracodeActive ? (_jsxs("p", { "data-slot": "ultracode-hint", className: "text-muted-foreground mt-1 truncate text-xs", children: [tUltracode('hint'), _jsx("span", { "aria-hidden": true, className: "px-1", children: "\u00B7" }), tUltracode('dismiss', { key: dismissKeyLabel() })] })) : null] }));
462
+ 'kortix-composer-editor w-full text-base sm:text-sm', disabled && 'opacity-50') }), ultracodeActive ? (_jsxs("p", { "data-slot": "ultracode-hint", className: "text-muted-foreground mt-1 truncate text-xs", children: [tUltracode('hint'), _jsx("span", { "aria-hidden": true, className: "px-1", children: "\u00B7" }), tUltracode('dismiss', { key: dismissKeyLabel() })] })) : null] }));
463
463
  });
@@ -60,7 +60,7 @@ export interface MenuRowProps {
60
60
  * row beneath a resting mouse, which fires enter, which drags the selection
61
61
  * straight back: the keyboard and the mouse fight and the keyboard loses.
62
62
  * `pointermove` fires only on real pointer travel, so a stationary mouse
63
- * cannot claim anything. (Same reason `cmdk` and Radix's menus use it.)
63
+ * cannot claim anything. (Same reason the command list and the menus use it.)
64
64
  *
65
65
  * Touch is excluded: a finger dragging across the list to scroll it is not
66
66
  * "hovering", and repainting the `/` menu's detail pane under the drag would
@@ -50,7 +50,7 @@ export function MenuSectionHeading({ children }) {
50
50
  * row beneath a resting mouse, which fires enter, which drags the selection
51
51
  * straight back: the keyboard and the mouse fight and the keyboard loses.
52
52
  * `pointermove` fires only on real pointer travel, so a stationary mouse
53
- * cannot claim anything. (Same reason `cmdk` and Radix's menus use it.)
53
+ * cannot claim anything. (Same reason the command list and the menus use it.)
54
54
  *
55
55
  * Touch is excluded: a finger dragging across the list to scroll it is not
56
56
  * "hovering", and repainting the `/` menu's detail pane under the drag would
@@ -10,7 +10,7 @@ const CARET_GAP = 4;
10
10
  *
11
11
  * The plugin appends the popup to `document.body` and sets NO z-index, so paint
12
12
  * order is decided purely by document order against everything else the app
13
- * portals into `body` (Radix popovers, dropdowns, toasts). `60` puts the menu
13
+ * portals into `body` (popovers, dropdowns, toasts). `60` puts the menu
14
14
  * above the app's own overlay layers — it is opened by an explicit keystroke
15
15
  * inside a focused editor, so nothing it can cover is more current than it.
16
16
  */
@@ -33,7 +33,7 @@ import { SolidCheckIcon } from '../../internal/icons/solid-check-icon.js';
33
33
  import { CaretDownIcon, CellSignalFullIcon, CellSignalHighIcon, CellSignalLowIcon, CellSignalMediumIcon, CellSignalNoneIcon, GaugeIcon, } from '@phosphor-icons/react';
34
34
  /**
35
35
  * The value `onVariantChange(null)` means: no variant, let the model decide.
36
- * A sentinel is needed because Radix's radio group addresses items by string
36
+ * A sentinel is needed because the radio group addresses items by string
37
37
  * and cannot carry `null`.
38
38
  */
39
39
  const AUTO = '__auto__';
@@ -95,7 +95,7 @@ export function SessionSiteHeader({ sessionId, sessionTitle, isMobileView, leadi
95
95
  // The name edits in place: the name button swaps for a field. The menu's
96
96
  // Rename item opens the same field, so there is one rename surface.
97
97
  const [isRenaming, setIsRenaming] = useState(false);
98
- // Set by the menu's Rename item. Radix returns focus to the caret trigger
98
+ // Set by the menu's Rename item. The menu returns focus to the caret trigger
99
99
  // when the menu closes, which would blur, and so save, the field that just
100
100
  // opened; `onCloseAutoFocus` reads this and keeps focus in the field.
101
101
  const renameFromMenu = useRef(false);
@@ -269,7 +269,7 @@ export function SessionSiteHeader({ sessionId, sessionTitle, isMobileView, leadi
269
269
  : tI18nHardcoded.raw('i18nComplete.text32ad3abe4479'));
270
270
  },
271
271
  }), children: [forkSession.isPending ? _jsx(Loading, {}) : _jsx(GitForkIcon, {}), tI18nHardcoded.raw('i18nComplete.text0e5f7f6732e0')] }))] })), outOfContextPresent && (_jsx(DropdownMenuCheckboxItem, { className: "cursor-pointer", checked: !outOfContextHidden, onCheckedChange: (checked) => setOutOfContextHidden(historyKey, !checked), children: tHistory('showOutOfContext') })), _jsxs(DropdownMenuItem, { className: "cursor-pointer", onClick: () => setExportOpen(true), children: [_jsx(FileDown, {}), tI18nHardcoded.raw('i18nComplete.text5d974f9e80c3')] }), canCompact && (_jsxs(DropdownMenuItem, { className: "cursor-pointer", onClick: () => setCompactOpen(true), children: [_jsx(Layers, {}), contextRecord ? tReset('dialogAction') : tI18nHardcoded.raw('i18nComplete.textca838377bb5a')] })), isProjectSession && canManageLifecycle && (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { className: "cursor-pointer", onClick: () => setDeleteOpen(true), children: [_jsx(TrashIcon, {}), tI18nHardcoded.raw('i18nComplete.texte2d0a54968ea')] })] }))] }));
272
- return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "relative z-50 w-full", children: [_jsxs("div", { className: cn('flex items-center justify-between p-2 px-3.5 pt-2 pr-4',
272
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "relative z-50 w-full", children: [_jsxs("div", { className: cn('flex items-center justify-between p-2 px-3.5 pt-[max(0.5rem,env(safe-area-inset-top))] pr-4', // audit:allow device safe-area inset, not a spacing step
273
273
  // Unconditional on the shell. The LEFT indent depends on the
274
274
  // sidebar (expanded, it covers the macOS lights itself) and is
275
275
  // gated by the data attribute — but the RIGHT one does not: this
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { formatDistanceToNowStrict } from 'date-fns';
4
- import { Slot } from 'radix-ui';
4
+ import { Slot } from '../../lib/base-ui-compat.js';
5
5
  import { useRef, useState } from 'react';
6
6
  import { useTranslations } from '../../i18n/index.js';
7
7
  import { HoverPrefetchLink } from '../../internal/components/hover-prefetch-link.js';
@@ -54,7 +54,7 @@ export function SubagentHoverCard({ projectId, projectSessionId, subsessions, sp
54
54
  }, children: _jsxs(HoverCard, { open: !keyboard && open, onOpenChange: (value) => {
55
55
  if (!keyboard && (!value || !suppressFocusOpen.current))
56
56
  setOpen(value);
57
- }, openDelay: 300, closeDelay: 100, children: [_jsx(PopoverAnchor, { asChild: true, children: _jsx(HoverCardTrigger, { asChild: true, children: _jsx(Slot.Root, { ref: titleRef, "aria-keyshortcuts": "ArrowDown", onPointerEnter: () => {
57
+ }, openDelay: 300, closeDelay: 100, children: [_jsx(PopoverAnchor, { asChild: true, children: _jsx(HoverCardTrigger, { asChild: true, children: _jsx(Slot, { ref: titleRef, "aria-keyshortcuts": "ArrowDown", onPointerEnter: () => {
58
58
  suppressFocusOpen.current = false;
59
59
  }, onBlur: () => {
60
60
  suppressFocusOpen.current = false;
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { Modal, ModalContent, ModalTitle } from '../../primitives/modal.js';
4
- import { VisuallyHidden } from '@radix-ui/react-visually-hidden';
4
+ import { VisuallyHidden } from '../../lib/base-ui-compat.js';
5
5
  import { useState } from 'react';
6
6
  /**
7
7
  * ImagePreview — wraps a clickable image thumbnail. On click, opens a full-size
@@ -1,10 +1,12 @@
1
1
  'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { ImageBrokenIcon } from '@phosphor-icons/react';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { CreditCardIcon, ImageBrokenIcon, KeyIcon } from '@phosphor-icons/react';
4
4
  import { AnimatePresence, m, useReducedMotion } from 'motion/react';
5
5
  import { useState } from 'react';
6
6
  import { useTranslations } from '../../i18n/index.js';
7
+ import { Button } from '../../primitives/button.js';
7
8
  import { ConnectPlanRows } from './subscription-offer.js';
9
+ import { useModelConnectionGate } from './use-model-connection-gate.js';
8
10
  // Enter waits a beat (delay) so the composer paints first, then the bar slides
9
11
  // out from under it — height opens the space while the strip translates down,
10
12
  // same spring on both so they move as one surface. Exit runs faster than enter
@@ -24,7 +26,18 @@ const BAR_EXIT = { type: 'spring', duration: 0.35, bounce: 0 };
24
26
  * `show` must only flip on settled data (see `entitlementsPending`).
25
27
  */
26
28
  export function ModelConnectionBar({ show }) {
27
- return show ? _jsx(ConnectPlanRows, { dismissible: false, className: "mt-4" }) : null;
29
+ return show ? (_jsxs("div", { className: "mt-4 flex flex-col gap-1", children: [_jsx(NoModelReason, {}), _jsx(ConnectPlanRows, { dismissible: false })] })) : null;
30
+ }
31
+ /**
32
+ * Why Send is disabled, and the two ways out. A Free account sees no Kortix
33
+ * model (managed models are Credits-plan only) even with credits bought, so
34
+ * the composer said "No model" and gave no reason. The same sentence answers a
35
+ * session create refused with `no_model_available` (error-handler.tsx).
36
+ */
37
+ function NoModelReason() {
38
+ const t = useTranslations('sessionUi.modelGate');
39
+ const { canConnectProvider, openConnectProvider, openUpgrade, showUpgradeOption, modal } = useModelConnectionGate();
40
+ return (_jsxs(_Fragment, { children: [modal, _jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-2 py-1 pr-3.5 pl-2.5", "data-testid": "no-model-reason", children: [_jsx("span", { className: "text-muted-foreground min-w-0 flex-1 text-xs", children: showUpgradeOption ? t('noModelUpgradeReason') : t('noModelKeyReason') }), showUpgradeOption ? (_jsxs(Button, { type: "button", size: "xs", onClick: openUpgrade, children: [_jsx(CreditCardIcon, { className: "size-3.5" }), t('noModelUpgradePlan')] })) : null, canConnectProvider ? (_jsxs(Button, { type: "button", size: "xs", variant: showUpgradeOption ? 'outline' : 'default', onClick: () => openConnectProvider('providers'), children: [_jsx(KeyIcon, { className: "size-3.5" }), t('noModelAddProviderKey')] })) : null] })] }));
28
41
  }
29
42
  /**
30
43
  * One line under the card when the selected model cannot read an attached image
@@ -6,7 +6,7 @@ import { useTranslations } from '../../i18n/index.js';
6
6
  import { MODEL_SELECTOR_PROVIDER_IDS, ProviderLogo } from '../../internal/lib/provider-branding.js';
7
7
  import { cn } from '../../lib/utils.js';
8
8
  import { SolidCheckIcon } from '../../internal/icons/solid-check-icon.js';
9
- import { foreignDialogOpen } from '../../lib/z-stack.js';
9
+ import { foreignDialogOpen, openDialogs } from '../../lib/z-stack.js';
10
10
  import { Button } from '../../primitives/button.js';
11
11
  import { CommandGroup, CommandInput, CommandItem, CommandList } from '../../primitives/command.js';
12
12
  import Hint from '../../primitives/hint.js';
@@ -64,8 +64,12 @@ export function ModelPickerPanel({ browseModels, pickableModels, searchModels, s
64
64
  useEffect(() => {
65
65
  if (!onForeignDialog)
66
66
  return;
67
+ // A dialog already open when the picker opens is its host (the trigger
68
+ // composer, a settings modal), not one that opened over it. Counting it
69
+ // closed the picker ~60 ms after every open inside a modal.
70
+ const host = new Set(openDialogs());
67
71
  const check = () => {
68
- if (foreignDialogOpen(rootRef.current))
72
+ if (foreignDialogOpen(rootRef.current, host))
69
73
  onForeignDialog();
70
74
  };
71
75
  const observer = new MutationObserver(check);
@@ -101,7 +101,7 @@ export interface ModelSelectorProps {
101
101
  * so effort is the right-hand pane of this popover.
102
102
  *
103
103
  * Controlled/uncontrolled is decided by whether `open` is `undefined`, the
104
- * same rule Radix itself uses — so every existing call site keeps its
104
+ * same rule the Base UI roots use — so every existing call site keeps its
105
105
  * internal state untouched.
106
106
  */
107
107
  open?: boolean;
@@ -21,6 +21,7 @@ import { isClaudeSubscriptionModel, isSubscriptionModel, pickerModelName, should
21
21
  import { useModelConnectionGate } from './use-model-connection-gate.js';
22
22
  import { ModelPickerPanel } from './model-picker-panel.js';
23
23
  import { effortLabel, reasoningEffortChoices } from '../composer/reasoning-effort-selector.js';
24
+ import { SubscriptionSwitcher, subscriptionProviderOf } from './subscription-switcher.js';
24
25
  // Re-export for consumers
25
26
  export { Tag };
26
27
  export function ConnectProviderDialog({ open, onOpenChange, providers: _providers, }) {
@@ -146,8 +147,8 @@ export function ModelSelector({ models, selectedModel, onSelect, defaultControls
146
147
  const tModel = useTranslations('modelSelector');
147
148
  const tDefault = useTranslations('workspaces.models');
148
149
  const t = useTranslations('threads');
149
- // Controlled when `open` is supplied, uncontrolled otherwise — Radix's own
150
- // rule. `setOpen` below is the single write path every internal caller
150
+ // Controlled when `open` is supplied, uncontrolled otherwise — the Base UI
151
+ // roots' rule. `setOpen` below is the single write path every internal caller
151
152
  // already goes through (`setOpen(false)` after picking a model or a
152
153
  // default), so a controlled parent hears about those closes too rather than
153
154
  // being silently desynced from a popover that shut itself.
@@ -188,6 +189,11 @@ export function ModelSelector({ models, selectedModel, onSelect, defaultControls
188
189
  m.modelID === availableSelectedModel?.modelID);
189
190
  // The pill names the model, never its plan suffix: "GPT-6 Luna", not "GPT-6 Luna (ChatGPT)".
190
191
  const displayName = (current && pickerModelName(current)) || unsetLabel || t('noModel');
192
+ // A subscription model names the login that pays for it: the picker grows a
193
+ // subscription pane under the list (both appearances), so switching the
194
+ // ChatGPT or Claude plan a turn runs on needs no trip to Customize.
195
+ const subscriptionProvider = current ? subscriptionProviderOf(current) : null;
196
+ const subscriptionNode = subscriptionProvider ? _jsx(SubscriptionSwitcher, { providerId: subscriptionProvider }) : null;
191
197
  const effortChoices = appearance === 'chip'
192
198
  ? reasoningEffortChoices(reasoning?.variants, !!reasoning?.onVariantChange)
193
199
  : [];
@@ -373,20 +379,20 @@ export function ModelSelector({ models, selectedModel, onSelect, defaultControls
373
379
  searchEmptyState) : (noModelsState) })] }));
374
380
  const modals = (_jsxs(_Fragment, { children: [connectionModal, projectId && chatGptPossible && ProviderAccountsModal && (_jsx(ProviderAccountsModal, { projectId: projectId, providerId: "codex", open: chatGptOpen, onOpenChange: setChatGptOpen }))] }));
375
381
  if (inline) {
376
- return (_jsxs(_Fragment, { children: [modals, _jsx(Command, { shouldFilter: false, className: cn('min-h-0 flex-1 rounded-none bg-transparent', '[&_[cmdk-group]]:px-1.5 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0',
377
- // No hairlines in a host pane: the search is a filled field, groups part by space.
378
- '[&_[data-slot=command-input-wrapper]]:bg-muted [&_[data-slot=command-input-wrapper]]:mx-2 [&_[data-slot=command-input-wrapper]]:h-8 [&_[data-slot=command-input-wrapper]]:gap-2 [&_[data-slot=command-input-wrapper]]:rounded-md [&_[data-slot=command-input-wrapper]]:border-b-0 [&_[data-slot=command-input-wrapper]]:px-2.5', '[&_[data-slot=command-input]]:h-8 [&_[data-slot=command-input]]:text-sm', '[&_[data-slot=command-separator]]:hidden [&_[data-slot=command-group]]:py-1'), children: listBody })] }));
382
+ return (_jsxs(_Fragment, { children: [modals, _jsxs("div", { className: "flex min-h-0 flex-1 flex-col", children: [_jsx(Command, { shouldFilter: false, className: cn('min-h-0 flex-1 rounded-none bg-transparent', '[&_[cmdk-group]]:px-1.5 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0',
383
+ // No hairlines in a host pane: the search is a filled field, groups part by space.
384
+ '[&_[data-slot=command-input-wrapper]]:bg-muted [&_[data-slot=command-input-wrapper]]:mx-2 [&_[data-slot=command-input-wrapper]]:h-8 [&_[data-slot=command-input-wrapper]]:gap-2 [&_[data-slot=command-input-wrapper]]:rounded-md [&_[data-slot=command-input-wrapper]]:border-b-0 [&_[data-slot=command-input-wrapper]]:px-2.5', '[&_[data-slot=command-input]]:h-8 [&_[data-slot=command-input]]:text-sm', '[&_[data-slot=command-separator]]:hidden [&_[data-slot=command-group]]:py-1'), children: listBody }), subscriptionNode] })] }));
379
385
  }
380
386
  return (_jsxs(_Fragment, { children: [modals, _jsxs(CommandPopover, { open: disabled ? false : open, onOpenChange: (next) => !disabled && setOpen(next), children: [_jsx(CommandPopoverTrigger, { children: appearance === 'field' ? (_jsxs("button", { type: "button", disabled: disabled, className: cn(triggerVariants(), 'h-9 w-full'), children: [_jsx("span", { className: "truncate", children: displayName }), disabled ? null : _jsx(ChevronDown, { className: cn(TRIGGER_CARET_CLASS, 'size-4') })] })) : (_jsxs(Button, { type: "button", variant: triggerVariant, size: "sm",
381
387
  // `min-w-0 shrink`: in a narrow toolbar (a channel's thread panel) the
382
388
  // model name truncates; the controls beside it keep their width.
383
389
  className: cn('min-w-0 shrink rounded-lg hit-area-y-3', triggerVariant === 'ghost' && 'text-muted-foreground'), children: [_jsx("span", { className: cn('max-w-30 truncate', triggerLabelClassName), children: displayName }), showEffort && (_jsx("span", { className: "shrink-0", children: currentEffort ? effortLabel(currentEffort) : t('auto') })), _jsx(ChevronDown, { className: cn('duration-moderate size-3 transition-transform ease-out', open && 'rotate-180') })] })) }), _jsx(CommandPopoverContent, { side: "top", align: "start", sideOffset: 8, className: showEffort
384
390
  ? 'w-[min(38rem,calc(100vw-1.5rem))]'
385
- : 'w-[min(28rem,calc(100vw-1.5rem))]', children: _jsx(ModelPickerPanel, { browseModels: browseModels, pickableModels: pickableModels, searchModels: visibleModels, search: search, onSearchChange: setSearch, searchRight: searchRight, selected: availableSelectedModel ?? null, onPick: handleSelect, isFavorite: pickerModelStore.isFavorite, setFavorite: pickerModelStore.setFavorite, loading: modelsLoading || entitlementsPending, emptyState: noModelsState, searchEmpty: searchEmptyState, onConnectChatGpt: chatGptAvailable ? handleOpenChatGpt : undefined, onForeignDialog: closePicker, connectLabel: tPooled('connect'), effort: showEffort
386
- ? {
387
- choices: effortChoices,
388
- selectedVariant: reasoning?.selectedVariant,
389
- onChange: handleEffortChange,
390
- }
391
- : undefined }) })] })] }));
391
+ : 'w-[min(28rem,calc(100vw-1.5rem))]', children: _jsxs("div", { className: "flex min-w-0 flex-col", children: [_jsx(ModelPickerPanel, { browseModels: browseModels, pickableModels: pickableModels, searchModels: visibleModels, search: search, onSearchChange: setSearch, searchRight: searchRight, selected: availableSelectedModel ?? null, onPick: handleSelect, isFavorite: pickerModelStore.isFavorite, setFavorite: pickerModelStore.setFavorite, loading: modelsLoading || entitlementsPending, emptyState: noModelsState, searchEmpty: searchEmptyState, onConnectChatGpt: chatGptAvailable ? handleOpenChatGpt : undefined, onForeignDialog: closePicker, connectLabel: tPooled('connect'), effort: showEffort
392
+ ? {
393
+ choices: effortChoices,
394
+ selectedVariant: reasoning?.selectedVariant,
395
+ onChange: handleEffortChange,
396
+ }
397
+ : undefined }), subscriptionNode] }) })] })] }));
392
398
  }
@@ -0,0 +1,10 @@
1
+ import type { GatewayErrorDetails } from '@kortix/sdk';
2
+ /**
3
+ * The provider whose key a failed turn needs fixed in Models → Providers, or
4
+ * null. A resolution error names no provider (`provider: ''`), so the routed
5
+ * model names it. A Kortix-managed model (no provider prefix) never needs a key.
6
+ */
7
+ export declare function providerKeyFix(details: Pick<GatewayErrorDetails, 'code' | 'provider' | 'requestedModel' | 'resolvedModel' | 'upstreamStatus'> | null | undefined): {
8
+ providerId: string;
9
+ code: string;
10
+ } | null;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Gateway codes a person fixes on the provider's account in Models: no key,
3
+ * a key the provider refused, an expired provider login, a provider account
4
+ * with no funds (`providerClientErrorBody`, `resolve-candidates.ts`).
5
+ */
6
+ const FIXED_IN_MODELS = new Set([
7
+ 'provider_not_connected',
8
+ 'provider_key_rejected',
9
+ 'provider_reauth_required',
10
+ 'provider_payment_required',
11
+ ]);
12
+ /** Providers with their own fix: ChatGPT (`chatGptConnectionAction`) and Claude (`claudeConnectionAction`). */
13
+ const OWN_FIX = new Set(['codex', 'openai-codex', 'claude-agent']);
14
+ /** The provider a gateway model id names (`anthropic/claude-x` → `anthropic`), without OpenCode's `kortix/`. */
15
+ function providerOfModel(model) {
16
+ const id = (model ?? '').replace(/^kortix\//, '');
17
+ const slash = id.indexOf('/');
18
+ return slash > 0 ? id.slice(0, slash) : undefined;
19
+ }
20
+ /**
21
+ * The provider whose key a failed turn needs fixed in Models → Providers, or
22
+ * null. A resolution error names no provider (`provider: ''`), so the routed
23
+ * model names it. A Kortix-managed model (no provider prefix) never needs a key.
24
+ */
25
+ export function providerKeyFix(details) {
26
+ if (!details)
27
+ return null;
28
+ const code = details.code ?? (details.upstreamStatus === 401 || details.upstreamStatus === 403 ? 'provider_key_rejected' : undefined);
29
+ if (!code || !FIXED_IN_MODELS.has(code))
30
+ return null;
31
+ const providerId = details.provider || providerOfModel(details.resolvedModel ?? details.requestedModel);
32
+ if (!providerId || OWN_FIX.has(providerId) || providerId === 'kortix')
33
+ return null;
34
+ return { providerId, code };
35
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The fix for a turn that failed on a provider key: Models → Providers, open
3
+ * on that provider, where the key is added, replaced or checked. Renders on a
4
+ * project route only (`useModelConnectionGate`).
5
+ */
6
+ export declare function ProviderKeySlot({ providerId, className }: {
7
+ providerId: string;
8
+ className?: string;
9
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,19 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { PROVIDER_LABELS } from '../../internal/lib/provider-branding.js';
4
+ import { Button } from '../../primitives/button.js';
5
+ import { useTranslations } from '../../i18n/index.js';
6
+ import { useModelConnectionGate } from './use-model-connection-gate.js';
7
+ /**
8
+ * The fix for a turn that failed on a provider key: Models → Providers, open
9
+ * on that provider, where the key is added, replaced or checked. Renders on a
10
+ * project route only (`useModelConnectionGate`).
11
+ */
12
+ export function ProviderKeySlot({ providerId, className = 'mt-2 pl-7' }) {
13
+ const t = useTranslations('pooledSecrets');
14
+ const { canConnectProvider, openConnectProvider, modal } = useModelConnectionGate();
15
+ if (!canConnectProvider)
16
+ return null;
17
+ const name = PROVIDER_LABELS[providerId] ?? providerId;
18
+ return (_jsxs("div", { className: className, children: [modal, _jsx(Button, { size: "sm", className: "active:scale-[0.96]", onClick: () => openConnectProvider('providers', providerId), children: t('openProviderInModels', { provider: name }) })] }));
19
+ }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * The subscription pane of the model picker: which ChatGPT or Claude login
3
+ * pays for the selected subscription model in this session, and how much of
4
+ * its allowance is spent.
5
+ *
6
+ * The choice IS the session's provider key pool for that provider, pinned to
7
+ * one login — the same pool Customize → Models and the session-overrides
8
+ * "Provider keys" row read and write (`useSessionProviderSecretPools`). No
9
+ * second source of truth: picking a login here writes the pool, and the
10
+ * gateway resolves the turn's credential from it (resolve-candidates'
11
+ * `selectedPool`). "Workspace default" clears the pin, handing the provider
12
+ * back to rotation.
13
+ *
14
+ * Data comes from the same reads those surfaces use: `useProviderKeyChoices`
15
+ * (the account's usable gateway logins, personal-key scoped to this session)
16
+ * and the pool list. The usage shown per login is the snapshot those reads
17
+ * carry — the same numbers the provider sheet renders (`subscription-usage`);
18
+ * a login the provider has not reported on yet shows none.
19
+ *
20
+ * Only an existing session can switch: a pool belongs to a session, so a
21
+ * pre-create composer renders nothing.
22
+ */
23
+ import type { SubscriptionUsage, SubscriptionUsageWindow } from '@kortix/sdk';
24
+ import { type FlatModel } from '@kortix/sdk/react';
25
+ /** The provider whose pooled logins pay for a subscription model. Null for every other model. */
26
+ export declare function subscriptionProviderOf(model: Pick<FlatModel, 'providerID' | 'modelID'> & {
27
+ provider?: string | null;
28
+ }): 'codex' | 'claude-agent' | null;
29
+ /**
30
+ * The window to show beside a login: the fullest one still in force that
31
+ * gates its model calls (`isBlockingWindow`, the rule the provider sheet's
32
+ * summary and the gateway's limit state share). Null when nothing is reported.
33
+ */
34
+ export declare function peakBlockingWindow(usage: SubscriptionUsage | null | undefined, now: number): SubscriptionUsageWindow | null;
35
+ export declare function SubscriptionSwitcher({ providerId }: {
36
+ providerId: 'codex' | 'claude-agent';
37
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,97 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useSessionProviderSecretPools } from '@kortix/sdk/react';
4
+ import { useTranslations } from '../../i18n/index.js';
5
+ import { needsReconnection } from '../../internal/lib/account-secret-access.js';
6
+ import { SolidCheckIcon } from '../../internal/icons/solid-check-icon.js';
7
+ import { cn } from '../../lib/utils.js';
8
+ import { useSessionIds } from '../../providers/session-ids.js';
9
+ import { isClaudeSubscriptionModel, isSubscriptionModel } from './model-tags.js';
10
+ import { accountLine, isBlockingWindow, loginLimit, usageTone, windowLabel, } from './subscription-windows.js';
11
+ import { useProviderKeyChoices } from '../overrides/provider-secret-pool-editor.js';
12
+ /** The provider whose pooled logins pay for a subscription model. Null for every other model. */
13
+ export function subscriptionProviderOf(model) {
14
+ if (isSubscriptionModel(model))
15
+ return 'codex';
16
+ if (isClaudeSubscriptionModel(model))
17
+ return 'claude-agent';
18
+ return null;
19
+ }
20
+ /**
21
+ * The window to show beside a login: the fullest one still in force that
22
+ * gates its model calls (`isBlockingWindow`, the rule the provider sheet's
23
+ * summary and the gateway's limit state share). Null when nothing is reported.
24
+ */
25
+ export function peakBlockingWindow(usage, now) {
26
+ if (!usage)
27
+ return null;
28
+ let peak = null;
29
+ for (const window of usage.windows) {
30
+ if (!isBlockingWindow(window.id))
31
+ continue;
32
+ if (window.resets_at && Date.parse(window.resets_at) <= now)
33
+ continue;
34
+ if (!peak || window.used_percent > peak.used_percent)
35
+ peak = window;
36
+ }
37
+ return peak;
38
+ }
39
+ export function SubscriptionSwitcher({ providerId }) {
40
+ const t = useTranslations('pooledSecrets');
41
+ const tUsage = useTranslations('subscriptionUsage');
42
+ const { projectId, sessionId } = useSessionIds();
43
+ const pools = useSessionProviderSecretPools(projectId ?? null, sessionId ?? null);
44
+ const keys = useProviderKeyChoices(projectId ?? '', sessionId);
45
+ const logins = keys.keys.filter((secret) => secret.provider_id === providerId);
46
+ // Nothing to switch (no connected login, pre-create, or a failed read): no pane.
47
+ if (!sessionId || logins.length === 0)
48
+ return null;
49
+ const pinned = pools.data?.pools.find((pool) => pool.provider_id === providerId)?.secret_ids ?? null;
50
+ // A pool of several logins rotates; the pane reads that as the default.
51
+ const pinnedId = pinned && pinned.length === 1 ? pinned[0] : null;
52
+ const canEdit = pools.data?.can_edit === true;
53
+ const pending = pools.setPool.isPending;
54
+ // The clock the usage reads judge resets by: the pool read's own timestamp
55
+ // (react-query render data, what `subscription-usage` passes as `now`), so
56
+ // the pane stays pure. A pane left open ages past it like any snapshot.
57
+ const now = pools.dataUpdatedAt;
58
+ const pick = (secretId) => {
59
+ void pools.setPool.mutateAsync({ providerId, secretIds: secretId ? [secretId] : null });
60
+ };
61
+ const rows = [
62
+ { secretId: null, label: t('projectDefaultShort'), line: t('subscriptionSwitcherDefault'), window: null, limited: false, broken: false },
63
+ ...logins.map((secret) => {
64
+ const peak = peakBlockingWindow(secret.usage, now);
65
+ return {
66
+ secretId: secret.secret_id,
67
+ label: secret.label,
68
+ line: accountLine(secret.provider_account, secret.label),
69
+ window: peak,
70
+ limited: loginLimit(secret.usage ?? null, now).limited,
71
+ broken: needsReconnection(secret),
72
+ };
73
+ }),
74
+ ];
75
+ const onKeyDown = (event) => {
76
+ // Same contract as the reasoning pane beside it: Escape bubbles (the
77
+ // popover closes), modifiers and Tab stay with the panel, the arrows walk
78
+ // the radios, every other key stops so cmdk never selects a model row.
79
+ if (event.key === 'Escape' || event.key === 'Tab')
80
+ return;
81
+ if (event.metaKey || event.ctrlKey || event.altKey)
82
+ return;
83
+ event.stopPropagation();
84
+ if (event.key !== 'ArrowDown' && event.key !== 'ArrowUp')
85
+ return;
86
+ event.preventDefault();
87
+ const radios = Array.from(event.currentTarget.querySelectorAll('[role="radio"]'));
88
+ const index = radios.indexOf(document.activeElement);
89
+ const step = event.key === 'ArrowDown' ? 1 : -1;
90
+ radios[(index + step + radios.length) % radios.length]?.focus();
91
+ };
92
+ return (_jsxs("div", { children: [_jsx("div", { className: "text-muted-foreground flex h-9 shrink-0 items-center border-b px-3 text-sm", children: t('subscriptionSwitcher') }), _jsx("div", { role: "radiogroup", "aria-label": t('subscriptionSwitcher'), onKeyDown: onKeyDown, className: "flex flex-col gap-px p-1.5", children: rows.map((row) => {
93
+ const checked = row.secretId === pinnedId || (row.secretId === null && pinnedId === null);
94
+ const tone = row.window ? usageTone(row.window, row.limited) : 'ok';
95
+ return (_jsxs("button", { type: "button", role: "radio", "aria-checked": checked, "aria-label": row.secretId ? t('subscriptionSwitcherUse', { label: row.label }) : undefined, tabIndex: checked ? 0 : -1, disabled: !canEdit || pending, onClick: () => pick(row.secretId), className: cn('flex cursor-pointer flex-col gap-0.5 rounded-md px-2 py-1 text-left text-sm outline-none', 'hover:bg-hover focus-visible:bg-hover focus-visible:ring-kortix-base focus-visible:ring-2', 'disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-60', checked && 'bg-active hover:bg-active'), children: [_jsxs("span", { className: "flex min-w-0 items-center gap-2", children: [_jsx("span", { className: "text-foreground min-w-0 flex-1 truncate font-medium", children: row.label }), row.limited ? (_jsx("span", { className: "text-foreground shrink-0 text-xs", children: tUsage('limitReached') })) : row.window ? (_jsxs("span", { className: cn('shrink-0 text-xs tabular-nums', tone === 'ok' ? 'text-muted-foreground' : 'text-foreground'), children: [windowLabel(row.window.id, tUsage), " \u00B7 ", tUsage('percent', { percent: Math.round(row.window.used_percent) })] })) : null, checked ? _jsx(SolidCheckIcon, { className: "text-ring size-4 shrink-0" }) : null] }), _jsxs("span", { className: "text-muted-foreground flex min-w-0 items-center gap-2 text-xs", children: [row.line ? _jsx("span", { className: "min-w-0 truncate", children: row.line }) : null, row.broken ? _jsx("span", { className: row.line ? 'shrink-0' : 'min-w-0 truncate', children: t('needsReconnection') }) : null, !row.line && !row.broken && row.secretId && !row.window ? (_jsx("span", { className: "min-w-0 truncate", children: tUsage('noUsageYet') })) : null] })] }, row.secretId ?? 'default'));
96
+ }) }), canEdit ? null : _jsx("p", { className: "text-muted-foreground px-3 pb-1.5 text-xs", children: t('readOnlyPool') })] }));
97
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * The pure reading of a subscription login's usage windows: tone, names,
3
+ * blocking windows and the limit. The model picker (`subscription-switcher`)
4
+ * and the provider sheet (`customize/sections/view/subscription-usage`) both
5
+ * read these, so they live at the session layer, below customize.
6
+ */
7
+ import type { SubscriptionAccount, SubscriptionUsage, SubscriptionUsageWindow } from '@kortix/sdk';
8
+ import type { useTranslations } from '../../i18n/index.js';
9
+ export type UsageTone = 'ok' | 'near' | 'critical' | 'limited';
10
+ /** Warn at 80%, turn red at 95%, and distinguish a provider-enforced limit. */
11
+ export declare function usageTone(window: SubscriptionUsageWindow, limited: boolean): UsageTone;
12
+ /**
13
+ * Windows that never stop the login's model calls: code review, paid extra
14
+ * usage, and one model's own limit (ChatGPT `model_*`, Claude `seven_day_opus`,
15
+ * `7d_sonnet`). Claude's OAuth-apps window stays blocking. The server's twin
16
+ * is `isBlockingWindow` in packages/llm-gateway/src/usage/subscription-usage.ts.
17
+ */
18
+ export declare function isBlockingWindow(id: string): boolean;
19
+ /** The model name of a model-specific weekly window (`seven_day_opus` → `Opus`), or null. */
20
+ export declare function weeklyModel(id: string): string | null;
21
+ /** A model limit's id fragment read back as its name: `gpt_5_3_codex_spark` → `GPT-5.3 Codex Spark`. */
22
+ export declare function modelName(slug: string): string;
23
+ type Translate = ReturnType<typeof useTranslations>;
24
+ /** A window's name: `5-hour`, `Weekly`, `Weekly · Opus`, `Code review · Weekly`, `Extra usage`. */
25
+ export declare function windowLabel(id: string, t: Translate, options?: {
26
+ modelWeekly?: boolean;
27
+ }): string;
28
+ /**
29
+ * `person@example.test · Pro`: who the login signs in as. The email is left out
30
+ * when the label already shows it; null when the provider says nothing.
31
+ */
32
+ export declare function accountLine(account: SubscriptionAccount | null | undefined, label: string): string | null;
33
+ /** The windows still in force: a window whose reset passed no longer limits anything. */
34
+ export declare function currentWindows(usage: SubscriptionUsage, now: number): SubscriptionUsageWindow[];
35
+ /** A login that cannot take a model call now, and when that ends (null: unknown). */
36
+ export declare function loginLimit(usage: SubscriptionUsage | null, now: number): {
37
+ limited: boolean;
38
+ until: string | null;
39
+ };
40
+ export {};