@kortix/ui 0.15.2 → 0.15.3
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.
- package/dist/_vendor/kortix-shared.js +157 -2
- package/dist/_vendor/shared/channel-descriptors.d.ts +1 -1
- package/dist/_vendor/shared/index.d.ts +1 -0
- package/dist/_vendor/shared/workspace-actions.d.ts +155 -0
- package/dist/_vendor/shared/workspace-settings.d.ts +62 -0
- package/dist/access/access/access-dialog-share.js +6 -6
- package/dist/access/access/access-dialog.d.ts +44 -1
- package/dist/access/access/access-dialog.js +8 -8
- package/dist/access/access/agent-principals.d.ts +3 -3
- package/dist/access/access/agent-principals.js +5 -4
- package/dist/access/access/invite-people-dialog.d.ts +37 -0
- package/dist/access/access/invite-people-dialog.js +140 -0
- package/dist/access/access/principal-picker.js +3 -2
- package/dist/access/access/project-select.js +2 -2
- package/dist/access/access/role-select.d.ts +9 -8
- package/dist/access/access/role-select.js +22 -25
- package/dist/access/access/workspace-role-dialog.d.ts +27 -0
- package/dist/access/access/workspace-role-dialog.js +48 -0
- package/dist/access/iam/add-github-account-dialog.d.ts +1 -1
- package/dist/access/iam/add-github-account-dialog.js +1 -1
- package/dist/access/iam/api-key-expiry.d.ts +18 -0
- package/dist/access/iam/api-key-expiry.js +47 -0
- package/dist/access/iam/api-key-rows.d.ts +6 -0
- package/dist/access/iam/api-key-rows.js +3 -0
- package/dist/access/iam/workspace-key-acts-as.d.ts +41 -0
- package/dist/access/iam/workspace-key-acts-as.js +48 -0
- package/dist/access/sharing-intent.js +1 -1
- package/dist/access/sharing-picker.js +1 -1
- package/dist/animated-copy-icon.d.ts +2 -2
- package/dist/animated-copy-icon.js +7 -4
- package/dist/apps/app-shared.js +2 -2
- package/dist/artifacts/artifact-session.js +1 -1
- package/dist/customize/agents/agent-drives-section.js +2 -2
- package/dist/customize/agents/agent-page-chrome.js +1 -1
- package/dist/customize/agents/agent-page.js +4 -5
- package/dist/customize/agents/agents-page.js +2 -3
- package/dist/customize/connectors/connector-identity.d.ts +1 -1
- package/dist/customize/connectors/connector-identity.js +1 -1
- package/dist/customize/connectors/connector-moves-banner.js +2 -2
- package/dist/customize/connectors/connectors-page.d.ts +2 -2
- package/dist/customize/connectors/connectors-page.js +4 -4
- package/dist/customize/connectors/detail/app-page.js +1 -1
- package/dist/customize/connectors/detail/connector-page.d.ts +1 -1
- package/dist/customize/connectors/detail/connector-page.js +1 -1
- package/dist/customize/connectors/detail/connector-policy-sets.js +2 -2
- package/dist/customize/connectors/detail/connector-tools.js +7 -7
- package/dist/customize/connectors/detail/connector-triggers.js +2 -3
- package/dist/customize/connectors/detail/email-inboxes.js +2 -2
- package/dist/customize/models/models-page.d.ts +1 -1
- package/dist/customize/models/models-page.js +1 -1
- package/dist/customize/project-settings/project-admin-sections.d.ts +53 -17
- package/dist/customize/project-settings/project-admin-sections.js +80 -31
- package/dist/customize/project-settings/project-settings-page.d.ts +2 -2
- package/dist/customize/project-settings/project-settings-page.js +6 -4
- package/dist/customize/project-settings/project-settings-sections.d.ts +2 -3
- package/dist/customize/project-settings/project-settings-sections.js +9 -4
- package/dist/customize/providers/provider-accordion.d.ts +3 -1
- package/dist/customize/providers/provider-accordion.js +2 -2
- package/dist/customize/secrets/secrets-page.d.ts +1 -1
- package/dist/customize/secrets/secrets-page.js +1 -1
- package/dist/customize/sections/component/email-connect-form.js +2 -2
- package/dist/customize/sections/component/slack-byo-wizard.js +3 -3
- package/dist/customize/sections/connectors-view.js +17 -17
- package/dist/customize/sections/gateway-view.d.ts +7 -5
- package/dist/customize/sections/gateway-view.js +28 -17
- package/dist/customize/sections/llm-provider/chatgpt-subscription-connect.js +2 -2
- package/dist/customize/sections/llm-provider/custom-provider-form.js +2 -2
- package/dist/customize/sections/llm-provider/llm-provider-modal.d.ts +1 -1
- package/dist/customize/sections/llm-provider/llm-provider-modal.js +4 -4
- package/dist/customize/sections/llm-provider/models-tab-row.js +5 -3
- package/dist/customize/sections/llm-provider/types.d.ts +2 -0
- package/dist/customize/sections/view/agent-editor-catalog.d.ts +5 -6
- package/dist/customize/sections/view/agent-editor-catalog.js +33 -14
- package/dist/customize/sections/view/agent-editor.js +1 -1
- package/dist/customize/sections/view/channels-view.js +13 -13
- package/dist/customize/sections/view/gateway/gateway-budgets.js +12 -10
- package/dist/customize/sections/view/gateway/gateway-logs.d.ts +1 -1
- package/dist/customize/sections/view/gateway/gateway-logs.js +3 -3
- package/dist/customize/sections/view/gateway/gateway-overview.js +1 -1
- package/dist/customize/sections/view/gateway/gateway-routing.js +1 -1
- package/dist/customize/sections/view/git-view.js +3 -3
- package/dist/customize/sections/view/grant-mode-field.js +2 -2
- package/dist/customize/sections/view/review-center-connected.js +1 -1
- package/dist/customize/sections/view/review-view.d.ts +0 -15
- package/dist/customize/sections/view/review-view.js +1 -23
- package/dist/customize/sections/view/secret-delivery.js +2 -2
- package/dist/customize/sections/view/secrets-view.js +16 -16
- package/dist/customize/sections/view/subscription-usage-tab.d.ts +12 -1
- package/dist/customize/sections/view/subscription-usage-tab.js +71 -72
- package/dist/customize/settings/rail-copy-context.js +1 -1
- package/dist/customize/settings/rail.d.ts +1 -1
- package/dist/customize/settings/rail.js +11 -18
- package/dist/customize/settings/settings-tab-header.d.ts +1 -1
- package/dist/customize/settings/settings-tab-header.js +1 -1
- package/dist/customize/settings/settings-tabs.d.ts +5 -12
- package/dist/customize/settings/settings-tabs.js +31 -44
- package/dist/customize/settings/tabs/experimental-tab.js +4 -4
- package/dist/customize/settings/tabs/general-tab.d.ts +29 -11
- package/dist/customize/settings/tabs/general-tab.js +55 -25
- package/dist/customize/settings/tabs/project-edit-patch.d.ts +0 -13
- package/dist/customize/settings/tabs/project-edit-patch.js +0 -28
- package/dist/customize/settings/tabs/sandbox-tab.js +2 -2
- package/dist/customize/settings/tabs/tokens-tab.d.ts +32 -2
- package/dist/customize/settings/tabs/tokens-tab.js +157 -32
- package/dist/customize/settings/tabs/workspace-keys.d.ts +6 -0
- package/dist/customize/settings/tabs/workspace-keys.js +240 -0
- package/dist/customize/shared/capability-library.js +3 -1
- package/dist/customize/shared/catalog/catalog-space-tabs.js +2 -2
- package/dist/customize/shared/customize-tab-bar.d.ts +6 -2
- package/dist/customize/shared/customize-tab-bar.js +36 -35
- package/dist/customize/shared/standalone-settings-nav.js +2 -2
- package/dist/customize/triggers/schedule/schedule-copy.d.ts +1 -1
- package/dist/customize/triggers/schedule/trigger-composer.js +5 -6
- package/dist/customize/triggers/schedule/trigger-list.js +2 -2
- package/dist/customize/triggers/schedule/trigger-session-access-copy.d.ts +6 -6
- package/dist/customize/triggers/schedule/trigger-session-access-copy.js +3 -3
- package/dist/customize/triggers/schedule/when-event.js +4 -4
- package/dist/customize/triggers/schedule/when-webhook-address.js +2 -2
- package/dist/customize/triggers/schedule/when-webhook.js +2 -2
- package/dist/customize/triggers/schedule-view.js +4 -5
- package/dist/customize/triggers/triggers-page.d.ts +1 -1
- package/dist/customize/triggers/triggers-page.js +1 -1
- package/dist/files/drives/drive-storage.d.ts +2 -2
- package/dist/files/drives/drive-storage.js +13 -6
- package/dist/files/project/components/change-request-detail-dialog.js +6 -6
- package/dist/files/project/components/change-requests-panel.js +2 -2
- package/dist/files/project/components/diff-preview-banner.d.ts +1 -1
- package/dist/files/project/components/diff-preview-banner.js +1 -1
- package/dist/files/project/components/drive-grid-view.js +1 -1
- package/dist/files/project/components/drive-list-view.js +1 -1
- package/dist/files/project/context.d.ts +1 -1
- package/dist/files/project/context.js +1 -1
- package/dist/files/renderers/image-renderer.js +1 -1
- package/dist/files/runtime/hooks/use-binary-blob.js +12 -2
- package/dist/files/runtime/hooks/use-file-content.js +18 -2
- package/dist/files/viewer/file-content-renderer.js +2 -2
- package/dist/files/viewer/preview-fit.d.ts +1 -1
- package/dist/files/viewer/preview-fit.js +1 -1
- package/dist/i18n/en.d.ts +304 -25
- package/dist/i18n/en.js +867 -588
- package/dist/i18n/ui-catalog/account-hub-translation-keys.generated.js +9 -9
- package/dist/i18n/ui-catalog/app-registry-translation-keys.generated.js +12 -6
- package/dist/i18n/ui-catalog/product-catalog-translation-keys.generated.js +5 -5
- package/dist/i18n/ui-catalog/remaining-ui-translation-keys.generated.js +67 -60
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.js +1 -0
- package/dist/icons/solid-right-arrow.d.ts +8 -0
- package/dist/icons/solid-right-arrow.js +11 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/account-hub/account-hub-entry.js +9 -8
- package/dist/internal/account-hub/account-hub-location.d.ts +20 -3
- package/dist/internal/account-hub/account-hub-location.js +16 -7
- package/dist/internal/account-hub/hub-sheet.d.ts +1 -1
- package/dist/internal/account-hub/hub-sheet.js +1 -1
- package/dist/internal/account-hub/sections.d.ts +2 -2
- package/dist/internal/account-hub/sections.js +10 -10
- package/dist/internal/account-hub/use-account-hub-access.d.ts +2 -0
- package/dist/internal/account-hub/use-account-hub-access.js +13 -5
- package/dist/internal/account-hub/workspace-settings-route.d.ts +27 -0
- package/dist/internal/account-hub/workspace-settings-route.js +51 -0
- package/dist/internal/components/nav-rail.d.ts +3 -1
- package/dist/internal/components/nav-rail.js +2 -0
- package/dist/internal/components/repository-disconnected.js +2 -2
- package/dist/internal/desktop/desktop-back-button.d.ts +1 -1
- package/dist/internal/files/file-read-retry.d.ts +13 -0
- package/dist/internal/files/file-read-retry.js +53 -1
- package/dist/internal/goals/goal-meta.d.ts +2 -1
- package/dist/internal/goals/goal-meta.js +4 -2
- package/dist/internal/hooks/account/use-accounts-list.d.ts +2 -12
- package/dist/internal/hooks/account/use-accounts-list.js +1 -14
- package/dist/internal/hooks/account/use-my-invites.d.ts +1 -1
- package/dist/internal/hooks/account/use-my-invites.js +1 -1
- package/dist/internal/hooks/use-review-session-summary.d.ts +7 -0
- package/dist/internal/hooks/use-review-session-summary.js +12 -1
- package/dist/internal/layout/project-capability-nav.d.ts +6 -17
- package/dist/internal/layout/project-capability-nav.js +7 -79
- package/dist/internal/layout/project-settings-nav.d.ts +2 -2
- package/dist/internal/layout/project-settings-nav.js +3 -3
- package/dist/internal/lib/billing/billing-gate-state.d.ts +11 -0
- package/dist/internal/lib/billing/billing-gate-state.js +18 -0
- package/dist/internal/lib/browser-noise/rules/expected-states.js +2 -3
- package/dist/internal/lib/browser-noise/rules/extensions.js +18 -0
- package/dist/internal/lib/browser-noise/rules/injected-scripts.js +55 -5
- package/dist/internal/lib/capability-tab-routes.d.ts +16 -40
- package/dist/internal/lib/capability-tab-routes.js +25 -54
- package/dist/internal/lib/desktop.d.ts +1 -1
- package/dist/internal/lib/desktop.js +1 -1
- package/dist/internal/lib/github-installations.d.ts +1 -1
- package/dist/internal/lib/github-installations.js +1 -1
- package/dist/internal/lib/model-pricing.js +1 -1
- package/dist/internal/lib/navigation/session-href.d.ts +1 -1
- package/dist/internal/lib/navigation/session-href.js +1 -1
- package/dist/internal/lib/onboarding/landing-destination.d.ts +12 -4
- package/dist/internal/lib/onboarding/landing-destination.js +17 -5
- package/dist/internal/lib/onboarding/last-project-cookie.d.ts +1 -1
- package/dist/internal/lib/onboarding/last-project-cookie.js +1 -1
- package/dist/internal/lib/project-actions.d.ts +1 -4
- package/dist/internal/lib/project-actions.js +2 -5
- package/dist/internal/lib/provider-branding.js +11 -3
- package/dist/internal/lib/use-project-can.d.ts +1 -3
- package/dist/internal/lib/use-project-can.js +0 -5
- package/dist/internal/lib/web-notifications.js +5 -5
- package/dist/internal/notifications/notification-inbox.d.ts +8 -2
- package/dist/internal/notifications/notification-inbox.js +8 -5
- package/dist/internal/notifications/use-inbox-summary.d.ts +8 -4
- package/dist/internal/notifications/use-inbox-summary.js +12 -6
- package/dist/internal/reminders/use-refetch-after-fire.d.ts +0 -2
- package/dist/internal/reminders/use-refetch-after-fire.js +1 -10
- package/dist/internal/stores/account-panel-store.d.ts +17 -1
- package/dist/internal/stores/account-panel-store.js +19 -2
- package/dist/internal/stores/project-switch-store.d.ts +2 -2
- package/dist/internal/stores/project-switch-store.js +4 -4
- package/dist/internal/stores/settings-panel-store.d.ts +6 -0
- package/dist/internal/stores/settings-panel-store.js +4 -1
- package/dist/internal/stores/workspace-settings-rail-store.d.ts +67 -0
- package/dist/internal/stores/workspace-settings-rail-store.js +11 -0
- package/dist/lib/routes.js +19 -18
- package/dist/lib/z-stack.d.ts +7 -0
- package/dist/lib/z-stack.js +13 -0
- package/dist/markdown/copy-button.d.ts +2 -2
- package/dist/markdown/copy-button.js +22 -20
- package/dist/markdown/setup-links/setup-link-button.js +1 -1
- package/dist/primitives/emoji-tint.d.ts +1 -1
- package/dist/primitives/emoji-tint.js +1 -1
- package/dist/primitives/error-state.js +8 -1
- package/dist/primitives/inline-meta.d.ts +12 -1
- package/dist/primitives/inline-meta.js +38 -5
- package/dist/primitives/page-search-bar.js +6 -6
- package/dist/primitives/section.d.ts +3 -3
- package/dist/primitives/section.js +9 -9
- package/dist/primitives/status.d.ts +5 -5
- package/dist/primitives/status.js +33 -33
- package/dist/primitives/tabs.d.ts +14 -26
- package/dist/primitives/tabs.js +103 -105
- package/dist/primitives/tag.d.ts +1 -1
- package/dist/primitives/toast.d.ts +6 -6
- package/dist/primitives/toast.js +55 -48
- package/dist/providers/session-ids.d.ts +1 -1
- package/dist/providers/ui-provider.d.ts +2 -0
- package/dist/session/agents/agent-strip.js +6 -6
- package/dist/session/agents/subagent-dialog-content.js +3 -4
- package/dist/session/agents/workflow-run-controls.d.ts +0 -2
- package/dist/session/agents/workflow-run-controls.js +1 -12
- package/dist/session/composer/ComposerCard.js +1 -1
- package/dist/session/composer/animated-placeholder.js +1 -1
- package/dist/session/composer/chat-input/chat-input-control.js +1 -8
- package/dist/session/composer/composer-toolbar.d.ts +18 -16
- package/dist/session/composer/composer-toolbar.js +10 -1
- package/dist/session/composer/composer.js +5 -13
- package/dist/session/composer/reasoning-effort-selector.d.ts +21 -0
- package/dist/session/composer/reasoning-effort-selector.js +46 -1
- package/dist/session/header/session-goal-indicator.js +2 -3
- package/dist/session/header/session-reminders-indicator.js +3 -3
- package/dist/session/header/session-site-header.js +1 -1
- package/dist/session/index.d.ts +1 -1
- package/dist/session/models/model-availability.d.ts +11 -0
- package/dist/session/models/model-availability.js +12 -0
- package/dist/session/models/model-connection-gate.d.ts +11 -26
- package/dist/session/models/model-connection-gate.js +22 -35
- package/dist/session/models/model-grouping.d.ts +30 -0
- package/dist/session/models/model-grouping.js +46 -0
- package/dist/session/models/model-picker-panel.d.ts +62 -0
- package/dist/session/models/model-picker-panel.js +181 -0
- package/dist/session/models/model-selector.d.ts +28 -4
- package/dist/session/models/model-selector.js +59 -15
- package/dist/session/models/model-tags.d.ts +4 -8
- package/dist/session/models/model-tags.js +20 -13
- package/dist/session/models/subscription-offer.d.ts +35 -0
- package/dist/session/models/subscription-offer.js +91 -0
- package/dist/session/models/use-model-connection-gate.d.ts +3 -3
- package/dist/session/models/use-model-connection-gate.js +8 -6
- package/dist/session/overrides/session-overrides-toolbar.js +8 -5
- package/dist/session/panel/open-session-quick-view.js +1 -1
- package/dist/session/panel/session-detail-panel.js +5 -1
- package/dist/session/panel/session-panel-provider.js +2 -2
- package/dist/session/panel/session-reminders-panel.js +2 -2
- package/dist/session/panel/shared/use-panel-derivations.d.ts +1 -0
- package/dist/session/panel/shared/use-panel-derivations.js +1 -1
- package/dist/session/panel/shared/use-panel-handoffs.d.ts +2 -2
- package/dist/session/panel/shared/use-panel-handoffs.js +22 -3
- package/dist/session/panel/use-session-panel-state.js +1 -1
- package/dist/session/prompts/ask-deck.d.ts +5 -3
- package/dist/session/prompts/ask-deck.js +30 -10
- package/dist/session/prompts/session-access-prompt.d.ts +61 -0
- package/dist/session/prompts/session-access-prompt.js +88 -0
- package/dist/session/prompts/session-permission-prompt.js +1 -1
- package/dist/session/scope/session-scope-control.js +2 -2
- package/dist/session/status/session-notice-banner.js +3 -3
- package/dist/session/status/session-route-prefetch.d.ts +2 -2
- package/dist/session/thread/optimistic-turn.js +1 -1
- package/dist/session/thread/session-chat.js +40 -18
- package/dist/session/thread/session-context-message-explorer.js +2 -2
- package/dist/session/thread/session-history.js +3 -3
- package/dist/session/tool/render-static.d.ts +11 -0
- package/dist/session/tool/render-static.js +16 -0
- package/dist/session/tool/shared/session-helpers.js +2 -2
- package/dist/session/tool/tool-part-renderer.d.ts +6 -1
- package/dist/session/tool/tool-part-renderer.js +9 -5
- package/dist/session/tool/tools/kortix-action-tool.js +4 -25
- package/dist/session/tool/tools/task-tool.js +9 -2
- package/dist/session/tool/tools/workflow-run-card.js +5 -1
- package/dist/session/tool/tools/workflow-tool.js +3 -14
- package/dist/session/turn/user-message.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/test-utils/intl.d.ts +10096 -0
- package/dist/test-utils/intl.js +27 -0
- package/dist/test-utils/strip-tags.d.ts +24 -0
- package/dist/test-utils/strip-tags.js +32 -0
- package/dist/workspace/admin/project-admin-dashboard.d.ts +51 -33
- package/dist/workspace/admin/project-admin-dashboard.js +269 -81
- package/dist/workspace/admin/settings-search-landing.d.ts +11 -0
- package/dist/workspace/admin/settings-search-landing.js +103 -0
- package/dist/workspace/admin/settings-search.d.ts +69 -0
- package/dist/workspace/admin/settings-search.js +393 -0
- package/dist/workspace/home/existing-repo-setup-prompt.d.ts +22 -0
- package/dist/workspace/home/existing-repo-setup-prompt.js +58 -0
- package/dist/workspace/home/no-agent-home.d.ts +25 -0
- package/dist/workspace/home/no-agent-home.js +44 -0
- package/dist/workspace/home/welcome-body.js +2 -1
- package/dist/workspace/inbox/workspace-inbox.d.ts +21 -0
- package/dist/workspace/inbox/workspace-inbox.js +52 -0
- package/dist/workspace/layout/project-files-view.js +1 -1
- package/dist/workspace/layout/project-home.js +60 -9
- package/dist/workspace/memory/memory-body.js +2 -2
- package/dist/workspace/new/account-param.d.ts +1 -1
- package/dist/workspace/new/account-param.js +4 -4
- package/dist/workspace/new/advanced-fields.js +3 -3
- package/dist/workspace/new/clone-param.d.ts +1 -1
- package/dist/workspace/new/clone-param.js +1 -1
- package/dist/workspace/new/create-workspace-key.js +1 -1
- package/dist/workspace/new/github-source.d.ts +6 -6
- package/dist/workspace/new/github-source.js +6 -6
- package/dist/workspace/new/new-workspace-form.d.ts +11 -141
- package/dist/workspace/new/new-workspace-form.js +9 -195
- package/dist/workspace/new/provision-new-workspace.d.ts +14 -0
- package/dist/workspace/new/provision-new-workspace.js +14 -0
- package/dist/workspace/new/repository-options.d.ts +2 -2
- package/dist/workspace/new/repository-options.js +2 -2
- package/dist/workspace/new/source-param.d.ts +2 -2
- package/dist/workspace/new/source-param.js +2 -2
- package/dist/workspace/new/use-create-workspace.d.ts +43 -102
- package/dist/workspace/new/use-create-workspace.js +77 -136
- package/dist/workspace/new/use-project-quota.d.ts +1 -1
- package/dist/workspace/new/use-project-quota.js +1 -1
- package/dist/workspace/new/workspace-handoff.d.ts +2 -2
- package/dist/workspace/new/workspace-handoff.js +2 -2
- package/dist/workspace/new/workspace-name.d.ts +1 -1
- package/dist/workspace/new/workspace-name.js +1 -1
- package/dist/workspace/project-selector/project-selector-model.d.ts +115 -57
- package/dist/workspace/project-selector/project-selector-model.js +157 -111
- package/dist/workspace/projects/modal/project-icon-field.d.ts +5 -5
- package/dist/workspace/projects/modal/project-icon-field.js +4 -4
- package/dist/workspace/projects/policies-panel.js +3 -3
- package/dist/workspace/sessions/board-grouping.js +1 -1
- package/dist/workspace/sessions/project-sessions-view.js +2 -2
- package/dist/workspace/sessions/session-detail.js +2 -2
- package/dist/workspace/sessions/sessions-board.d.ts +1 -1
- package/dist/workspace/sessions/sessions-board.js +1 -1
- package/dist/workspace/settings/split-notice-banner.d.ts +13 -0
- package/dist/workspace/settings/split-notice-banner.js +59 -0
- package/dist/workspace/settings/use-leave-workspace.d.ts +16 -0
- package/dist/workspace/settings/use-leave-workspace.js +60 -0
- package/dist/workspace/sidebar/footer/project-files-nav.js +2 -2
- package/dist/workspace/sidebar/footer/sandbox-health.js +1 -1
- package/dist/workspace/sidebar/invitations-menu-group.d.ts +2 -2
- package/dist/workspace/sidebar/invitations-menu-group.js +4 -4
- package/dist/workspace/sidebar/modal/session-embed-section.js +1 -1
- package/dist/workspace/sidebar/modal/share-session-access.js +1 -1
- package/dist/workspace/sidebar/modal/share-session-modal.js +3 -3
- package/dist/workspace/sidebar/project-nav-items.js +14 -25
- package/dist/workspace/sidebar/project-sidebar.js +17 -2
- package/dist/workspace/sidebar/project-spaces-nav.js +6 -15
- package/dist/workspace/sidebar/sidebar-drill.d.ts +37 -0
- package/dist/workspace/sidebar/sidebar-drill.js +110 -0
- package/dist/workspace/sidebar/use-workspace-directory.d.ts +24 -0
- package/dist/workspace/sidebar/use-workspace-directory.js +24 -0
- package/dist/workspace/sidebar/use-workspace-list.d.ts +37 -0
- package/dist/workspace/sidebar/use-workspace-list.js +71 -0
- package/dist/workspace/sidebar/workspace-grouping.d.ts +6 -67
- package/dist/workspace/sidebar/workspace-grouping.js +4 -107
- package/dist/workspace/sidebar/workspace-menu-model.d.ts +30 -12
- package/dist/workspace/sidebar/workspace-menu-model.js +13 -107
- package/dist/workspace/sidebar/workspace-menu-section.d.ts +7 -1
- package/dist/workspace/sidebar/workspace-menu-section.js +65 -100
- package/dist/workspace/sidebar/workspace-settings-sidebar-nav.d.ts +34 -0
- package/dist/workspace/sidebar/workspace-settings-sidebar-nav.js +282 -0
- package/dist/workspace/space/space-filter-tabs.js +2 -2
- package/dist/workspace/space/space-page.d.ts +1 -1
- package/dist/workspace/space/space-page.js +1 -1
- package/package.json +51 -47
- package/skills/kortix-ui/SKILL.md +66 -66
- package/skills/kortix-ui/references/custom-dashboard.md +15 -15
- package/skills/kortix-ui/references/modules.md +15 -15
- package/dist/customize/agents/agent-pin-button.d.ts +0 -10
- package/dist/customize/agents/agent-pin-button.js +0 -20
- package/dist/customize/settings/tabs/transfer-workspace-dialog.d.ts +0 -4
- package/dist/customize/settings/tabs/transfer-workspace-dialog.js +0 -82
- package/dist/internal/account-hub/account-settings-shell.d.ts +0 -7
- package/dist/internal/account-hub/account-settings-shell.js +0 -87
- package/dist/internal/account-hub/account-settings-sidebar.d.ts +0 -2
- package/dist/internal/account-hub/account-settings-sidebar.js +0 -169
- package/dist/internal/lib/use-project-feature-flags.d.ts +0 -28
- package/dist/internal/lib/use-project-feature-flags.js +0 -76
- package/dist/internal/stores/pinned-agents-store.d.ts +0 -26
- package/dist/internal/stores/pinned-agents-store.js +0 -20
- package/dist/primitives/info-banner.d.ts +0 -14
- package/dist/primitives/info-banner.js +0 -72
- package/dist/workspace/new/account-picker.d.ts +0 -71
- package/dist/workspace/new/account-picker.js +0 -92
- package/dist/workspace/new/use-creatable-accounts.d.ts +0 -8
- package/dist/workspace/new/use-creatable-accounts.js +0 -33
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { StarIcon } from '@phosphor-icons/react';
|
|
4
|
+
import { Fragment, useEffect, useMemo, useRef, useState } from 'react';
|
|
5
|
+
import { useTranslations } from '../../i18n/index.js';
|
|
6
|
+
import { MODEL_SELECTOR_PROVIDER_IDS, ProviderLogo } from '../../internal/lib/provider-branding.js';
|
|
7
|
+
import { cn } from '../../lib/utils.js';
|
|
8
|
+
import { SolidCheckIcon } from '../../internal/icons/solid-check-icon.js';
|
|
9
|
+
import { foreignDialogOpen } from '../../lib/z-stack.js';
|
|
10
|
+
import { Button } from '../../primitives/button.js';
|
|
11
|
+
import { CommandGroup, CommandInput, CommandItem, CommandList } from '../../primitives/command.js';
|
|
12
|
+
import Hint from '../../primitives/hint.js';
|
|
13
|
+
import { Kbd } from '../../primitives/kbd.js';
|
|
14
|
+
import Loading from '../../primitives/loading.js';
|
|
15
|
+
import { Tag } from '../../primitives/tag.js';
|
|
16
|
+
import { ReasoningEffortPane } from '../composer/reasoning-effort-selector.js';
|
|
17
|
+
import { initialPickerTab, modelItemValue, pickerGroupId, pickerGroupLabel, pickerTabOf, pickerTabs, splitModelLabel, } from './model-grouping.js';
|
|
18
|
+
import { pickerModelName, shouldShowFreeTag } from './model-tags.js';
|
|
19
|
+
const IS_MAC = typeof navigator !== 'undefined' && /Mac|iPod|iPhone|iPad/.test(navigator.platform);
|
|
20
|
+
const MOD = IS_MAC ? '⌘' : 'Ctrl';
|
|
21
|
+
/** Rows past the ninth have no digit to bind. */
|
|
22
|
+
const SHORTCUT_ROWS = 9;
|
|
23
|
+
const sameModel = (a, b) => !!a && a.providerID === b.providerID && a.modelID === b.modelID;
|
|
24
|
+
/**
|
|
25
|
+
* The composer's model popover: a rail on the left (Favorites, Kortix,
|
|
26
|
+
* ChatGPT, then one tab per connected provider), the tab's models in the
|
|
27
|
+
* middle, and the selected model's thinking effort on the right. Picking a
|
|
28
|
+
* model or a level keeps it open; Escape or a click outside closes it.
|
|
29
|
+
*
|
|
30
|
+
* The star on a row is a FAVORITE (per browser, `useModelStore`), not the
|
|
31
|
+
* workspace default: favorites collect in the first tab, the way a member
|
|
32
|
+
* keeps the three models they switch between in one place. The workspace
|
|
33
|
+
* default is set in Customize -> Models.
|
|
34
|
+
*
|
|
35
|
+
* Mod + 1..9 picks the visible row with that number while the popover is open.
|
|
36
|
+
*/
|
|
37
|
+
export function ModelPickerPanel({ browseModels, pickableModels, searchModels, search, onSearchChange, searchRight, selected, onPick, isFavorite, setFavorite, loading, emptyState, searchEmpty, onConnectChatGpt, connectLabel, effort, onForeignDialog, }) {
|
|
38
|
+
const t = useTranslations('modelSelector');
|
|
39
|
+
const tPooled = useTranslations('pooledSecrets');
|
|
40
|
+
const favorites = useMemo(() => pickableModels.filter(isFavorite), [pickableModels, isFavorite]);
|
|
41
|
+
const tabs = useMemo(() => pickerTabs(browseModels, {
|
|
42
|
+
canConnectChatGpt: !!onConnectChatGpt,
|
|
43
|
+
providerOrder: MODEL_SELECTOR_PROVIDER_IDS,
|
|
44
|
+
}), [browseModels, onConnectChatGpt]);
|
|
45
|
+
const selectedModel = useMemo(() => (selected ? browseModels.find((m) => sameModel(selected, m)) : undefined), [browseModels, selected]);
|
|
46
|
+
// The tab is fixed once the models are there, then moves only on a rail
|
|
47
|
+
// click: picking or starring a model must not yank the rail elsewhere. The
|
|
48
|
+
// popover unmounts this panel on close, so every open starts afresh.
|
|
49
|
+
const [chosenTab, setChosenTab] = useState(null);
|
|
50
|
+
const openingTab = initialPickerTab({
|
|
51
|
+
tabs,
|
|
52
|
+
selected: selectedModel ?? null,
|
|
53
|
+
selectedIsFavorite: !!selectedModel && isFavorite(selectedModel),
|
|
54
|
+
hasFavorites: favorites.length > 0,
|
|
55
|
+
});
|
|
56
|
+
// Set during render (React's "adjust state on a prop change" pattern): the
|
|
57
|
+
// first render with models pins the tab, before anything can move it.
|
|
58
|
+
if (chosenTab === null && !loading && browseModels.length > 0)
|
|
59
|
+
setChosenTab(openingTab);
|
|
60
|
+
const tab = chosenTab && tabs.includes(chosenTab) ? chosenTab : openingTab;
|
|
61
|
+
const searching = search.trim().length > 0;
|
|
62
|
+
// Mounted only while the popover is open, so this watches exactly then.
|
|
63
|
+
const rootRef = useRef(null);
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
if (!onForeignDialog)
|
|
66
|
+
return;
|
|
67
|
+
const check = () => {
|
|
68
|
+
if (foreignDialogOpen(rootRef.current))
|
|
69
|
+
onForeignDialog();
|
|
70
|
+
};
|
|
71
|
+
const observer = new MutationObserver(check);
|
|
72
|
+
observer.observe(document.body, {
|
|
73
|
+
childList: true,
|
|
74
|
+
subtree: true,
|
|
75
|
+
attributes: true,
|
|
76
|
+
attributeFilter: ['data-state'],
|
|
77
|
+
});
|
|
78
|
+
return () => observer.disconnect();
|
|
79
|
+
}, [onForeignDialog]);
|
|
80
|
+
const rows = useMemo(() => {
|
|
81
|
+
if (searching)
|
|
82
|
+
return searchModels;
|
|
83
|
+
if (tab === 'favorites')
|
|
84
|
+
return favorites;
|
|
85
|
+
return browseModels.filter((m) => pickerTabOf(m) === tab);
|
|
86
|
+
}, [searching, searchModels, tab, favorites, browseModels]);
|
|
87
|
+
const sections = useMemo(() => [{ id: searching ? 'search' : tab, models: rows }], [searching, tab, rows]);
|
|
88
|
+
const ordered = useMemo(() => sections.flatMap((s) => s.models), [sections]);
|
|
89
|
+
const onKeyDown = (event) => {
|
|
90
|
+
if (!(IS_MAC ? event.metaKey : event.ctrlKey) || event.altKey || event.shiftKey)
|
|
91
|
+
return;
|
|
92
|
+
if (!/^[1-9]$/.test(event.key))
|
|
93
|
+
return;
|
|
94
|
+
const model = ordered[Number(event.key) - 1];
|
|
95
|
+
if (!model)
|
|
96
|
+
return;
|
|
97
|
+
event.preventDefault();
|
|
98
|
+
event.stopPropagation();
|
|
99
|
+
onPick(model);
|
|
100
|
+
};
|
|
101
|
+
const tabLabel = (id) => {
|
|
102
|
+
if (id === 'favorites')
|
|
103
|
+
return t('favorites');
|
|
104
|
+
if (id === 'kortix')
|
|
105
|
+
return 'Kortix';
|
|
106
|
+
if (id === 'chatgpt')
|
|
107
|
+
return 'ChatGPT';
|
|
108
|
+
const sample = browseModels.find((m) => pickerTabOf(m) === id);
|
|
109
|
+
return sample ? pickerGroupLabel(id, sample) : id;
|
|
110
|
+
};
|
|
111
|
+
const tabIcon = (id) => {
|
|
112
|
+
// One size for every rail glyph: the star, the Kortix mark, each provider.
|
|
113
|
+
if (id === 'favorites')
|
|
114
|
+
return _jsx(StarIcon, { weight: "fill", className: "text-kortix-orange size-4.5" });
|
|
115
|
+
return (_jsx(ProviderLogo, { providerID: id === 'chatgpt' ? 'codex' : id, name: tabLabel(id), size: "xs", className: "size-4.5" }));
|
|
116
|
+
};
|
|
117
|
+
let body;
|
|
118
|
+
if (loading) {
|
|
119
|
+
body = (_jsx("div", { className: "flex h-full items-center justify-center", role: "status", "aria-label": t('loading'), children: _jsx(Loading, { className: "text-muted-foreground size-4 shrink-0" }) }));
|
|
120
|
+
}
|
|
121
|
+
else if (browseModels.length === 0 && !searching) {
|
|
122
|
+
body = emptyState;
|
|
123
|
+
}
|
|
124
|
+
else if (searching && rows.length === 0) {
|
|
125
|
+
body = searchEmpty;
|
|
126
|
+
}
|
|
127
|
+
else if (rows.length === 0 && tab === 'favorites') {
|
|
128
|
+
body = _jsx("p", { className: "text-muted-foreground px-3 py-6 text-center text-sm", children: t('favoritesEmpty') });
|
|
129
|
+
}
|
|
130
|
+
else if (rows.length === 0 && tab === 'chatgpt' && onConnectChatGpt) {
|
|
131
|
+
body = (_jsx("div", { className: "flex justify-center px-3 py-6", children: _jsx(Button, { type: "button", size: "sm", variant: "outline", onClick: onConnectChatGpt, children: tPooled('connectChatGpt') }) }));
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
let index = 0;
|
|
135
|
+
body = sections.map((section) => (_jsx(Fragment, { children: _jsx(CommandGroup, { forceMount: true, children: section.models.map((model) => {
|
|
136
|
+
index += 1;
|
|
137
|
+
return (_jsx(PickerRow, { model: model, isSelected: sameModel(selected, model), favorite: isFavorite(model), onToggleFavorite: (on) => setFavorite(model, on), onSelect: () => onPick(model), shortcut: index <= SHORTCUT_ROWS ? index : null, connectLabel: connectLabel }, `${model.providerID}:${model.modelID}`));
|
|
138
|
+
}) }) }, section.id)));
|
|
139
|
+
}
|
|
140
|
+
return (
|
|
141
|
+
// `bg-surface`: a hair below the white canvas (#fcfcfc light), so the
|
|
142
|
+
// popover reads as a surface of its own; `card` (#f4f4f4) was too dark.
|
|
143
|
+
// It covers the `Command` root's `bg-popover`, which matches the page.
|
|
144
|
+
_jsxs("div", { ref: rootRef, className: "bg-surface flex min-h-0 flex-col sm:flex-row", onKeyDown: onKeyDown, children: [_jsxs("div", { className: "flex h-[min(22rem,55vh)] min-w-0 flex-1", children: [_jsx("div", { role: "tablist", "aria-label": t('groups'), "aria-orientation": "vertical", className: "flex w-12 shrink-0 flex-col items-center gap-1 overflow-y-auto border-r py-2", children: tabs.map((id) => {
|
|
145
|
+
const active = !searching && id === tab;
|
|
146
|
+
return (_jsx(Hint, { label: tabLabel(id), side: "left", className: "z-50", children: _jsx("button", { type: "button", role: "tab", "aria-selected": active, "aria-label": tabLabel(id), onClick: () => {
|
|
147
|
+
setChosenTab(id);
|
|
148
|
+
if (searching)
|
|
149
|
+
onSearchChange('');
|
|
150
|
+
}, onKeyDown: keepKeyOnButton, className: cn('text-muted-foreground flex size-9 shrink-0 cursor-pointer items-center justify-center rounded-md outline-none', 'hover:bg-hover hover:text-foreground focus-visible:ring-kortix-base focus-visible:ring-2', active && 'bg-active text-foreground'), children: tabIcon(id) }) }, id));
|
|
151
|
+
}) }), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col", children: [_jsx(CommandInput, { compact: true, placeholder: t('search'), value: search, onValueChange: onSearchChange, rightElement: searchRight }), _jsx(CommandList, { className: "max-h-none min-h-0 flex-1", children: body })] })] }), effort && effort.choices.length > 0 ? (_jsx(ReasoningEffortPane, { title: t('thinking'), choices: effort.choices, selectedVariant: effort.selectedVariant, onVariantChange: effort.onChange, className: "border-t sm:w-44 sm:shrink-0 sm:border-t-0 sm:border-l" })) : null] }));
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Enter and Space activate the focused button. cmdk handles both on its root
|
|
155
|
+
* and would select the highlighted model row instead, so they stop here; the
|
|
156
|
+
* browser's own activation still runs. Escape and Mod+digit still bubble.
|
|
157
|
+
*/
|
|
158
|
+
function keepKeyOnButton(event) {
|
|
159
|
+
if (event.key === 'Enter' || event.key === ' ')
|
|
160
|
+
event.stopPropagation();
|
|
161
|
+
}
|
|
162
|
+
function PickerRow({ model, isSelected, favorite, onToggleFavorite, onSelect, shortcut, connectLabel, }) {
|
|
163
|
+
const t = useTranslations('modelSelector');
|
|
164
|
+
const unavailable = model.available === false;
|
|
165
|
+
const groupID = pickerGroupId(model);
|
|
166
|
+
const { lead, trail } = splitModelLabel(pickerModelName(model));
|
|
167
|
+
return (_jsxs(CommandItem, { value: modelItemValue('model', model), title: model.modelID, onSelect: onSelect, className: cn('group h-9 gap-2',
|
|
168
|
+
// `--accent` equals the popover surface in dark mode; see ModelRow.
|
|
169
|
+
'hover:bg-hover [&:not([data-nav=pointer]_*)]:data-[selected=true]:bg-hover', isSelected && 'bg-active [&:not([data-nav=pointer]_*)]:data-[selected=true]:bg-active'), children: [_jsx(ProviderLogo, { providerID: groupID, name: pickerGroupLabel(groupID, model), size: "xs", className: "size-4.5" }), _jsxs("span", { className: cn('min-w-0 truncate leading-tight', unavailable && 'opacity-60'), children: [_jsx("span", { className: "text-foreground font-medium", children: lead }), trail ? _jsxs("span", { className: "text-muted-foreground font-normal", children: [" ", trail] }) : null] }), isSelected ? _jsx(SolidCheckIcon, { className: "text-ring size-3.5 shrink-0" }) : null, _jsx("span", { className: "flex-1" }), unavailable ? (_jsx(Tag, { children: connectLabel })) : shouldShowFreeTag(model) ? (_jsx(Tag, { variant: "free", children: t('free') })) : null, _jsx("button", { type: "button", "aria-label": favorite
|
|
170
|
+
? t('removeFavorite', { model: model.modelName })
|
|
171
|
+
: t('addFavorite', { model: model.modelName }), "aria-pressed": favorite,
|
|
172
|
+
// cmdk selects on the item's click: a star must not also switch models.
|
|
173
|
+
onPointerDown: (e) => e.stopPropagation(), onKeyDown: keepKeyOnButton, onClick: (e) => {
|
|
174
|
+
e.stopPropagation();
|
|
175
|
+
onToggleFavorite(!favorite);
|
|
176
|
+
}, className: cn('flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md', 'text-muted-foreground hover:text-kortix-orange hover:bg-foreground/10', 'duration-normal transition-[color,background-color,transform] ease-out motion-safe:active:scale-[0.96]', 'focus-visible:ring-kortix-base focus-visible:ring-2 focus-visible:outline-none',
|
|
177
|
+
// Hidden means unclickable too; a favorite keeps its star at rest.
|
|
178
|
+
favorite
|
|
179
|
+
? 'text-kortix-orange hover:text-kortix-orange'
|
|
180
|
+
: 'pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 group-data-[selected=true]:pointer-events-auto group-data-[selected=true]:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100'), children: _jsx(StarIcon, { weight: favorite ? 'fill' : 'regular', className: cn('size-3.5', favorite ? 'text-kortix-orange' : 'text-current') }) }), shortcut ? (_jsxs(Kbd, { className: "bg-muted h-5 w-auto min-w-7 shrink-0 tabular-nums", children: [MOD, shortcut] })) : (_jsx("span", { className: "w-7 shrink-0" }))] }));
|
|
181
|
+
}
|
|
@@ -11,7 +11,12 @@ type ModelRef = {
|
|
|
11
11
|
modelID: string;
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
14
|
-
* The one default this picker sets: the
|
|
14
|
+
* The one default this picker sets: the WORKSPACE default model (the project
|
|
15
|
+
* default — a workspace is one account and its project), from the star on a
|
|
16
|
+
* row. `accountDefault` / `onSetAccountDefault` keep their names (a public
|
|
17
|
+
* prop contract); the host passes the project default through them.
|
|
18
|
+
*
|
|
19
|
+
* History: it set the ACCOUNT default, from the star on
|
|
15
20
|
* a row. It is the default for every member of the account, so it needs
|
|
16
21
|
* `project.model.write` and the star is hidden without it.
|
|
17
22
|
*
|
|
@@ -38,6 +43,18 @@ export interface ModelDefaultControls {
|
|
|
38
43
|
accountDefault?: ModelRef | null;
|
|
39
44
|
onSetAccountDefault: (model: ModelRef) => void;
|
|
40
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Thinking effort, merged into the model popover as a right-hand pane. It is
|
|
48
|
+
* the session's model variant: the same value `ReasoningEffortSelector` sets.
|
|
49
|
+
*/
|
|
50
|
+
export interface ModelReasoningControls {
|
|
51
|
+
/** The selected model's variant ids (`Object.keys(model.variants)`). */
|
|
52
|
+
variants: readonly string[] | undefined;
|
|
53
|
+
/** The session's current variant, or null = model default. */
|
|
54
|
+
selectedVariant: string | null | undefined;
|
|
55
|
+
/** Absent = the host cannot apply a variant: no pane, no trigger suffix. */
|
|
56
|
+
onVariantChange?: (variant: string | null) => void;
|
|
57
|
+
}
|
|
41
58
|
export interface ModelSelectorProps {
|
|
42
59
|
models: FlatModel[];
|
|
43
60
|
selectedModel: {
|
|
@@ -80,8 +97,8 @@ export interface ModelSelectorProps {
|
|
|
80
97
|
* the picker stayed shut, because this component's `open` was internal
|
|
81
98
|
* state with no way in.
|
|
82
99
|
*
|
|
83
|
-
* "Set reasoning effort"
|
|
84
|
-
*
|
|
100
|
+
* "Set reasoning effort" routes here too: the composer passes `reasoning`,
|
|
101
|
+
* so effort is the right-hand pane of this popover.
|
|
85
102
|
*
|
|
86
103
|
* Controlled/uncontrolled is decided by whether `open` is `undefined`, the
|
|
87
104
|
* same rule Radix itself uses — so every existing call site keeps its
|
|
@@ -89,5 +106,12 @@ export interface ModelSelectorProps {
|
|
|
89
106
|
*/
|
|
90
107
|
open?: boolean;
|
|
91
108
|
onOpenChange?: (open: boolean) => void;
|
|
109
|
+
/**
|
|
110
|
+
* Thinking effort in the same popover (`chip` appearance only). When the
|
|
111
|
+
* selected model publishes variants, the popover grows a right-hand pane
|
|
112
|
+
* with Auto + those levels, and the trigger names the level after the model.
|
|
113
|
+
* A model with no variants keeps the single-column popover.
|
|
114
|
+
*/
|
|
115
|
+
reasoning?: ModelReasoningControls;
|
|
92
116
|
}
|
|
93
|
-
export declare function ModelSelector({ models, selectedModel, onSelect, defaultControls, unsetLabel, disabled, modelsLoading, triggerLabelClassName, triggerVariant, appearance, offerProviderAccounts, open: openProp, onOpenChange, }: ModelSelectorProps): import("react").JSX.Element;
|
|
117
|
+
export declare function ModelSelector({ models, selectedModel, onSelect, defaultControls, unsetLabel, disabled, modelsLoading, triggerLabelClassName, triggerVariant, appearance, offerProviderAccounts, open: openProp, onOpenChange, reasoning, }: ModelSelectorProps): import("react").JSX.Element;
|
|
@@ -19,6 +19,8 @@ import { isPickerGroupOpen, modelItemValue, pickerGroupId, pickerGroupLabel, bui
|
|
|
19
19
|
import { modelInDefaultView } from '@kortix/sdk';
|
|
20
20
|
import { isClaudeSubscriptionModel, isSubscriptionModel, pickerModelName, shouldShowFreeTag } from './model-tags.js';
|
|
21
21
|
import { useModelConnectionGate } from './use-model-connection-gate.js';
|
|
22
|
+
import { ModelPickerPanel } from './model-picker-panel.js';
|
|
23
|
+
import { effortLabel, reasoningEffortChoices } from '../composer/reasoning-effort-selector.js';
|
|
22
24
|
// Re-export for consumers
|
|
23
25
|
export { Tag };
|
|
24
26
|
export function ConnectProviderDialog({ open, onOpenChange, providers: _providers, }) {
|
|
@@ -53,6 +55,9 @@ import { Tag } from '../../primitives/tag.js';
|
|
|
53
55
|
*/
|
|
54
56
|
function ModelRow({ model, groupProviderID, groupProviderName, isSelected, isAccountDefault, defaultControls, onSelect, scope, showSubscriptionTag = true, connectLabel, }) {
|
|
55
57
|
const t = useTranslations('modelSelector');
|
|
58
|
+
// The star sets the WORKSPACE default (the project default): a workspace
|
|
59
|
+
// is one account and its project (Workspaces, PR 1).
|
|
60
|
+
const tDefault = useTranslations('workspaces.models');
|
|
56
61
|
// Kept in the list so a default stays visible, but not runnable: the row
|
|
57
62
|
// reads "Connect" and selecting it opens the connection (KRTX-3011).
|
|
58
63
|
const unavailable = model.available === false;
|
|
@@ -88,8 +93,8 @@ function ModelRow({ model, groupProviderID, groupProviderName, isSelected, isAcc
|
|
|
88
93
|
chip — `cn` puts these last, so they win over the component's own
|
|
89
94
|
`bg-zinc-*`. */
|
|
90
95
|
className: "size-4 rounded-none bg-transparent" }), _jsxs("span", { className: cn('min-w-0 flex-1 truncate leading-tight', unavailable && 'opacity-60'), children: [_jsx("span", { className: "text-foreground font-medium", children: lead }), trail ? _jsxs("span", { className: "text-muted-foreground font-normal", children: [" ", trail] }) : null] }), unavailable ? (_jsx(Tag, { children: connectLabel })) : isFree ? (_jsx(Tag, { variant: "free", children: t('free') })) : isSubscription && showSubscriptionTag ? (_jsx(Tag, { children: t('included') })) : null, _jsxs("span", { className: "relative flex size-6 shrink-0 items-center justify-center", children: [isSelected && (_jsx(Check, { className: "text-foreground size-4 group-hover:opacity-0 group-data-[selected=true]:opacity-0" })), defaultControls && (_jsx("button", { type: "button", "aria-label": isAccountDefault
|
|
91
|
-
?
|
|
92
|
-
:
|
|
96
|
+
? tDefault('defaultAria', { model: model.modelName })
|
|
97
|
+
: tDefault('setDefaultAria', { model: model.modelName }), title: isAccountDefault ? tDefault('defaultTitle') : tDefault('setDefaultTitle'),
|
|
93
98
|
/* No `aria-pressed`: that promises a toggle, and clicking the
|
|
94
99
|
filled star does nothing. Clearing an account default is a real
|
|
95
100
|
action with a real fallback behind it, and it belongs where the
|
|
@@ -137,8 +142,9 @@ function ModelRow({ model, groupProviderID, groupProviderName, isSelected, isAcc
|
|
|
137
142
|
function GroupHeading({ children }) {
|
|
138
143
|
return _jsx("span", { className: "text-muted-foreground font-medium tracking-wide", children: children });
|
|
139
144
|
}
|
|
140
|
-
export function ModelSelector({ models, selectedModel, onSelect, defaultControls, unsetLabel, disabled = false, modelsLoading = false, triggerLabelClassName, triggerVariant = 'ghost', appearance = 'chip', offerProviderAccounts = false, open: openProp, onOpenChange, }) {
|
|
145
|
+
export function ModelSelector({ models, selectedModel, onSelect, defaultControls, unsetLabel, disabled = false, modelsLoading = false, triggerLabelClassName, triggerVariant = 'ghost', appearance = 'chip', offerProviderAccounts = false, open: openProp, onOpenChange, reasoning, }) {
|
|
141
146
|
const tModel = useTranslations('modelSelector');
|
|
147
|
+
const tDefault = useTranslations('workspaces.models');
|
|
142
148
|
const t = useTranslations('threads');
|
|
143
149
|
// Controlled when `open` is supplied, uncontrolled otherwise — Radix's own
|
|
144
150
|
// rule. `setOpen` below is the single write path every internal caller
|
|
@@ -180,7 +186,16 @@ export function ModelSelector({ models, selectedModel, onSelect, defaultControls
|
|
|
180
186
|
: resolveAvailableSelectedModel(selectedModel, isSelectableModel);
|
|
181
187
|
const current = models.find((m) => m.providerID === availableSelectedModel?.providerID &&
|
|
182
188
|
m.modelID === availableSelectedModel?.modelID);
|
|
183
|
-
|
|
189
|
+
// The pill names the model, never its plan suffix: "GPT-6 Luna", not "GPT-6 Luna (ChatGPT)".
|
|
190
|
+
const displayName = (current && pickerModelName(current)) || unsetLabel || t('noModel');
|
|
191
|
+
const effortChoices = appearance === 'chip'
|
|
192
|
+
? reasoningEffortChoices(reasoning?.variants, !!reasoning?.onVariantChange)
|
|
193
|
+
: [];
|
|
194
|
+
const showEffort = effortChoices.length > 0 && !!reasoning?.onVariantChange;
|
|
195
|
+
// A stale per-model pick reads as Auto, the same rule as the pane.
|
|
196
|
+
const currentEffort = reasoning?.selectedVariant && effortChoices.includes(reasoning.selectedVariant)
|
|
197
|
+
? reasoning.selectedVariant
|
|
198
|
+
: null;
|
|
184
199
|
useEffect(() => {
|
|
185
200
|
if (!open) {
|
|
186
201
|
setSearch('');
|
|
@@ -195,8 +210,8 @@ export function ModelSelector({ models, selectedModel, onSelect, defaultControls
|
|
|
195
210
|
// `enabled` stamping `/model-picker` gives gateway catalogs. See
|
|
196
211
|
// modelInDefaultView.
|
|
197
212
|
const pickerModelStore = useModelStore(models);
|
|
198
|
-
const
|
|
199
|
-
const q =
|
|
213
|
+
const filterModels = useCallback((query) => {
|
|
214
|
+
const q = query.toLowerCase();
|
|
200
215
|
return models
|
|
201
216
|
.filter((m) => m.enabled !== false &&
|
|
202
217
|
// Claude subscription models appear once the member signed in to Claude
|
|
@@ -207,12 +222,17 @@ export function ModelSelector({ models, selectedModel, onSelect, defaultControls
|
|
|
207
222
|
(m.modelID || '').toLowerCase().includes(q) ||
|
|
208
223
|
(m.providerName || '').toLowerCase().includes(q)) &&
|
|
209
224
|
modelInDefaultView(m, {
|
|
210
|
-
search,
|
|
225
|
+
search: query,
|
|
211
226
|
isStoreVisible: pickerModelStore.isVisible,
|
|
212
227
|
selected: selectedModel,
|
|
213
228
|
}))
|
|
214
229
|
.sort((a, b) => a.modelName.localeCompare(b.modelName));
|
|
215
|
-
}, [models,
|
|
230
|
+
}, [models, pickerModelStore.isVisible, selectedModel]);
|
|
231
|
+
const visibleModels = useMemo(() => filterModels(search), [filterModels, search]);
|
|
232
|
+
// The chip popover's rail and tabs read the unsearched list.
|
|
233
|
+
const browseModels = useMemo(() => filterModels(''), [filterModels]);
|
|
234
|
+
// Favorites skip the default-view curation: a starred model stays listed.
|
|
235
|
+
const pickableModels = useMemo(() => models.filter((m) => m.enabled !== false && !(isClaudeSubscriptionModel(m) && m.available === false)), [models]);
|
|
216
236
|
/** Is there anything to pick AT ALL, ignoring the search box? The empty
|
|
217
237
|
* state below branches on this: "no models match your search" and "you have
|
|
218
238
|
* no models" are different problems with different ways out. */
|
|
@@ -299,14 +319,32 @@ export function ModelSelector({ models, selectedModel, onSelect, defaultControls
|
|
|
299
319
|
if (connect === 'claude' || connect === 'provider')
|
|
300
320
|
return handleOpenProviderModal('providers');
|
|
301
321
|
onSelect({ providerID: model.providerID, modelID: model.modelID });
|
|
302
|
-
|
|
303
|
-
|
|
322
|
+
// The chip popover stays open: a model and its thinking level are set
|
|
323
|
+
// in one visit, and Escape or a click outside closes it.
|
|
324
|
+
if (appearance !== 'chip')
|
|
325
|
+
setOpen(false);
|
|
326
|
+
}, [
|
|
327
|
+
onSelect,
|
|
328
|
+
setOpen,
|
|
329
|
+
chatGptAvailable,
|
|
330
|
+
handleOpenChatGpt,
|
|
331
|
+
handleOpenProviderModal,
|
|
332
|
+
appearance,
|
|
333
|
+
]);
|
|
334
|
+
// Stays open too: the check moves, and the model list is still in reach.
|
|
335
|
+
const handleEffortChange = useCallback((variant) => reasoning?.onVariantChange?.(variant), [reasoning]);
|
|
336
|
+
const closePicker = useCallback(() => setOpen(false), [setOpen]);
|
|
304
337
|
const handleUpgrade = useCallback(() => {
|
|
305
338
|
setOpen(false);
|
|
306
339
|
openUpgrade();
|
|
307
340
|
}, [openUpgrade, setOpen]);
|
|
341
|
+
const searchRight = canManageModels && canConnectProvider ? (_jsxs("div", { className: "-mr-0.5 flex shrink-0 items-center gap-0.5", children: [_jsx(Hint, { label: tModel('connectProvider'), side: "top", className: "z-50", children: _jsx("button", { type: "button", "aria-label": tModel('addProvider'), onClick: () => handleOpenProviderModal('providers'), className: "text-muted-foreground hover:text-foreground hover:bg-muted flex size-8 cursor-pointer items-center justify-center rounded-md transition-colors", children: _jsx(Plus, { className: "size-4" }) }) }), _jsx(Hint, { label: tModel('manageModels'), side: "top", className: "z-50", children: _jsx("button", { type: "button", "aria-label": tModel('manageModels'), onClick: () => handleOpenProviderModal('models'), className: "text-muted-foreground hover:text-foreground hover:bg-muted flex size-8 cursor-pointer items-center justify-center rounded-md transition-colors", children: _jsx(SlidersHorizontal, { className: "size-4" }) }) })] })) : undefined;
|
|
342
|
+
const searchEmptyState = (_jsx(ModelSearchEmpty, { search: search, modelCount: models.filter((model) => model.enabled !== false && !(isClaudeSubscriptionModel(model) && model.available === false)).length, onClear: () => setSearch(''), onUpgrade: showUpgradeOption ? handleUpgrade : undefined }));
|
|
343
|
+
const noModelsState = (_jsxs("div", { className: "px-3 py-5 text-center", children: [_jsx("div", { className: "text-foreground text-sm font-medium", children: tModel('empty.title') }), _jsx("p", { className: "text-muted-foreground mx-auto mt-1 max-w-[220px] text-xs leading-5", children: showUpgradeOption
|
|
344
|
+
? tModel('empty.upgradeDescription')
|
|
345
|
+
: tModel('empty.description') }), _jsxs("div", { className: "mt-4 flex items-center justify-center gap-2", children: [showUpgradeOption && (_jsxs(Button, { type: "button", size: "xs", onClick: handleUpgrade, children: [_jsx(CreditCard, { className: "size-3.5" }), tModel('upgrade')] })), canConnectProvider && (_jsxs(Button, { type: "button", size: "xs", variant: showUpgradeOption ? 'outline' : 'default', onClick: () => handleOpenProviderModal('providers'), children: [_jsx(KeyRound, { className: "size-3.5" }), tModel('connectProvider')] }))] })] }));
|
|
308
346
|
const inline = appearance === 'inline';
|
|
309
|
-
const listBody = (_jsxs(_Fragment, { children: [_jsx(CommandInput, { compact: true, placeholder: tModel('search'), value: search, onValueChange: setSearch, rightElement:
|
|
347
|
+
const listBody = (_jsxs(_Fragment, { children: [_jsx(CommandInput, { compact: true, placeholder: tModel('search'), value: search, onValueChange: setSearch, rightElement: searchRight }), grouped.length > 1 && _jsx(CommandSeparator, { className: "bg-border/60" }), _jsx(CommandList, { className: inline ? 'max-h-none min-h-0 flex-1' : 'max-h-[380px]', children: modelsLoading || entitlementsPending ? (_jsx("div", { className: "flex min-h-32 items-center justify-center", role: "status", "aria-label": tModel('loading'), children: _jsx(Loading, { className: "text-muted-foreground size-4 shrink-0" }) })) : grouped.length > 0 ? (_jsxs(_Fragment, { children: [pinnedDefault && (_jsxs(_Fragment, { children: [_jsx(CommandGroup, { heading: _jsx(GroupHeading, { children: tDefault('yourDefault') }), forceMount: true, children: _jsx(ModelRow, { model: pinnedDefault.model, groupProviderID: pinnedDefault.providerID, groupProviderName: pinnedDefault.providerName, isSelected: availableSelectedModel?.providerID === pinnedDefault.model.providerID &&
|
|
310
348
|
availableSelectedModel?.modelID === pinnedDefault.model.modelID, isAccountDefault: true, defaultControls: rowDefaultControls, onSelect: handleSelect, connectLabel: tPooled('connect'), scope: "pinned" }) }), _jsx(CommandSeparator, {})] })), sections.map((section, sectionIndex) => {
|
|
311
349
|
const selectedInSection = section.models.find((m) => availableSelectedModel?.providerID === m.providerID &&
|
|
312
350
|
availableSelectedModel?.modelID === m.modelID);
|
|
@@ -332,9 +370,7 @@ export function ModelSelector({ models, selectedModel, onSelect, defaultControls
|
|
|
332
370
|
filtered by `search`, so the branch below could not tell the
|
|
333
371
|
two apart: typing "zzz" with 40 models connected showed
|
|
334
372
|
"No models available" and a Connect-provider CTA. */
|
|
335
|
-
|
|
336
|
-
? tModel('empty.upgradeDescription')
|
|
337
|
-
: tModel('empty.description') }), _jsxs("div", { className: "mt-4 flex items-center justify-center gap-2", children: [showUpgradeOption && (_jsxs(Button, { type: "button", size: "xs", onClick: handleUpgrade, children: [_jsx(CreditCard, { className: "size-3.5" }), tModel('upgrade')] })), canConnectProvider && (_jsxs(Button, { type: "button", size: "xs", variant: showUpgradeOption ? 'outline' : 'default', onClick: () => handleOpenProviderModal('providers'), children: [_jsx(KeyRound, { className: "size-3.5" }), tModel('connectProvider')] }))] })] })) })] }));
|
|
373
|
+
searchEmptyState) : (noModelsState) })] }));
|
|
338
374
|
const modals = (_jsxs(_Fragment, { children: [connectionModal, projectId && chatGptPossible && ProviderAccountsModal && (_jsx(ProviderAccountsModal, { projectId: projectId, providerId: "codex", open: chatGptOpen, onOpenChange: setChatGptOpen }))] }));
|
|
339
375
|
if (inline) {
|
|
340
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',
|
|
@@ -344,5 +380,13 @@ export function ModelSelector({ models, selectedModel, onSelect, defaultControls
|
|
|
344
380
|
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",
|
|
345
381
|
// `min-w-0 shrink`: in a narrow toolbar (a channel's thread panel) the
|
|
346
382
|
// model name truncates; the controls beside it keep their width.
|
|
347
|
-
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 }), _jsx(ChevronDown, { className: cn('duration-moderate size-3 transition-transform ease-out', open && 'rotate-180') })] })) }), _jsx(CommandPopoverContent, { side: "top", align: "start", sideOffset: 8, className:
|
|
383
|
+
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
|
+
? '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 }) })] })] }));
|
|
348
392
|
}
|
|
@@ -19,18 +19,14 @@ export declare function isClaudeSubscriptionModel(model: {
|
|
|
19
19
|
providerID?: string;
|
|
20
20
|
}): boolean;
|
|
21
21
|
/**
|
|
22
|
-
* What the picker prints for a model.
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* (`picker-catalog.ts`, `catalog-models.ts`) so surfaces with no grouping —
|
|
26
|
-
* the CLI, `/v1/models` — can still tell `gpt-6-astra` from
|
|
27
|
-
* `codex/gpt-6-astra`. The picker HAS grouping: the rows already sit under a
|
|
28
|
-
* "ChatGPT subscription" heading, so the suffix repeated the heading on every
|
|
29
|
-
* row and pushed the real name off the same column as its managed twin.
|
|
22
|
+
* What the picker prints for a model: its name without the plan suffix. The
|
|
23
|
+
* picker shows the plan another way (the ChatGPT tab, the provider's tab), so
|
|
24
|
+
* the suffix only pushed the real name off the trigger and out of the column.
|
|
30
25
|
*
|
|
31
26
|
* Display only. Search, aria labels and every stored id keep the full name, so
|
|
32
27
|
* typing "chatgpt" still finds these rows.
|
|
33
28
|
*/
|
|
34
29
|
export declare function pickerModelName(model: Pick<FlatModel, 'modelID' | 'modelName'> & {
|
|
35
30
|
provider?: string | null;
|
|
31
|
+
providerID?: string;
|
|
36
32
|
}): string;
|
|
@@ -22,22 +22,29 @@ export function isClaudeSubscriptionModel(model) {
|
|
|
22
22
|
return model.providerID === 'claude-agent' || model.provider === 'claude-agent';
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
* A trailing parenthetical that names how a model is billed, not what it is:
|
|
26
|
+
* "(ChatGPT)", "(Claude subscription)", "(Anthropic plan)". The gateway and
|
|
27
|
+
* the plan catalogs append these so ungrouped surfaces (the CLI, `/v1/models`)
|
|
28
|
+
* can tell a plan model from its metered twin. `[^()]*` keeps the match
|
|
29
|
+
* linear (CodeQL js/polynomial-redos) and inside one pair of parentheses.
|
|
30
|
+
*/
|
|
31
|
+
const PLAN_SUFFIX = /\((?:ChatGPT|Claude|Anthropic)(?: [^()]*)?\)$/i;
|
|
32
|
+
/** A suffix that says it is a plan, on any model. */
|
|
33
|
+
const EXPLICIT_PLAN_SUFFIX = /\([^()]*\b(?:subscription|plan)\)$/i;
|
|
34
|
+
/**
|
|
35
|
+
* What the picker prints for a model: its name without the plan suffix. The
|
|
36
|
+
* picker shows the plan another way (the ChatGPT tab, the provider's tab), so
|
|
37
|
+
* the suffix only pushed the real name off the trigger and out of the column.
|
|
33
38
|
*
|
|
34
39
|
* Display only. Search, aria labels and every stored id keep the full name, so
|
|
35
40
|
* typing "chatgpt" still finds these rows.
|
|
36
41
|
*/
|
|
37
42
|
export function pickerModelName(model) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
const name = model.modelName.trim();
|
|
44
|
+
// A bare "(ChatGPT)" on a model that is NOT on a plan is part of its name.
|
|
45
|
+
const onPlan = isSubscriptionModel(model) || isClaudeSubscriptionModel(model);
|
|
46
|
+
let stripped = name.replace(EXPLICIT_PLAN_SUFFIX, '');
|
|
47
|
+
if (onPlan)
|
|
48
|
+
stripped = stripped.replace(PLAN_SUFFIX, '');
|
|
49
|
+
return stripped.trim() || model.modelName;
|
|
43
50
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one "connect a model" surface: two rows, "Connect ChatGPT · Plus or Pro
|
|
3
|
+
* plan →" and "Connect Claude · Pro or Max plan →". Each opens the provider
|
|
4
|
+
* dialog with that provider already expanded, so the next click is the sign-in.
|
|
5
|
+
*
|
|
6
|
+
* The rows read like starter suggestions: no box, no fill until hover. Inside
|
|
7
|
+
* each row the logo centres under the composer's paperclip (`pl-2.5`) and the
|
|
8
|
+
* arrow under its send button (`pr-3.5`), so the host must place the rows at
|
|
9
|
+
* the composer card's width.
|
|
10
|
+
*
|
|
11
|
+
* `dismissible`: hovering a row swaps its arrow for a ✕ in the same slot. The ✕
|
|
12
|
+
* hides that row for this project in this browser (`localStorage`). Only the
|
|
13
|
+
* optional offer is dismissible; with no model at all there is nothing else to
|
|
14
|
+
* send with, so the rows stay.
|
|
15
|
+
*
|
|
16
|
+
* `projectId` omitted: the gate reads the `[id]` route segment.
|
|
17
|
+
*/
|
|
18
|
+
export declare function ConnectPlanRows({ projectId, dismissible, className, }: {
|
|
19
|
+
projectId?: string;
|
|
20
|
+
dismissible: boolean;
|
|
21
|
+
className?: string;
|
|
22
|
+
}): import("react").JSX.Element;
|
|
23
|
+
/**
|
|
24
|
+
* The project home's optional offer: the rows, dismissible, under the hero
|
|
25
|
+
* composer. New projects run on Kortix models, and most people already pay
|
|
26
|
+
* for ChatGPT or Claude.
|
|
27
|
+
*
|
|
28
|
+
* Shown only when a model already runs (with none, the composer's own
|
|
29
|
+
* `ModelConnectionBar` shows the same rows, undismissible), no ChatGPT or
|
|
30
|
+
* Claude plan serves one yet, and the viewer may change the project's models.
|
|
31
|
+
* `px-4` is the composer shell's gutter, so the rows span the card's width.
|
|
32
|
+
*/
|
|
33
|
+
export declare function SubscriptionOffer({ projectId }: {
|
|
34
|
+
projectId: string;
|
|
35
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useWorkspaceModels } from '@kortix/sdk/react';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { useTranslations } from '../../i18n/index.js';
|
|
6
|
+
import { Close } from '../../icons/close.js';
|
|
7
|
+
import { SolidRightArrow } from '../../icons/solid-right-arrow.js';
|
|
8
|
+
import { ClaudeCode } from '../../internal/icons/claude-code.js';
|
|
9
|
+
import { ProviderLogo } from '../../internal/lib/provider-branding.js';
|
|
10
|
+
import { cn } from '../../internal/lib/utils.js';
|
|
11
|
+
import { hasRunnableSubscriptionModel, isRunnableModel } from './model-availability.js';
|
|
12
|
+
import { useModelConnectionGate } from './use-model-connection-gate.js';
|
|
13
|
+
const PLANS = [
|
|
14
|
+
{ providerId: 'openai', name: 'ChatGPT', labelKey: 'connectChatGpt', planKey: 'chatGptPlan' },
|
|
15
|
+
{ providerId: 'anthropic', name: 'Claude', labelKey: 'connectClaude', planKey: 'claudePlan' },
|
|
16
|
+
];
|
|
17
|
+
const dismissedKey = (projectId) => `kortix:subscription-offer-dismissed:${projectId}`;
|
|
18
|
+
/** The rows this browser hid for this project. Empty when storage is blocked. */
|
|
19
|
+
function readDismissed(projectId) {
|
|
20
|
+
if (!projectId || typeof window === 'undefined')
|
|
21
|
+
return [];
|
|
22
|
+
try {
|
|
23
|
+
const parsed = JSON.parse(window.localStorage.getItem(dismissedKey(projectId)) ?? '[]');
|
|
24
|
+
return Array.isArray(parsed)
|
|
25
|
+
? parsed.filter((id) => PLANS.some((plan) => plan.providerId === id))
|
|
26
|
+
: [];
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function writeDismissed(projectId, ids) {
|
|
33
|
+
try {
|
|
34
|
+
window.localStorage.setItem(dismissedKey(projectId), JSON.stringify(ids));
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
// Storage blocked (private mode): the row stays hidden until reload.
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The one "connect a model" surface: two rows, "Connect ChatGPT · Plus or Pro
|
|
42
|
+
* plan →" and "Connect Claude · Pro or Max plan →". Each opens the provider
|
|
43
|
+
* dialog with that provider already expanded, so the next click is the sign-in.
|
|
44
|
+
*
|
|
45
|
+
* The rows read like starter suggestions: no box, no fill until hover. Inside
|
|
46
|
+
* each row the logo centres under the composer's paperclip (`pl-2.5`) and the
|
|
47
|
+
* arrow under its send button (`pr-3.5`), so the host must place the rows at
|
|
48
|
+
* the composer card's width.
|
|
49
|
+
*
|
|
50
|
+
* `dismissible`: hovering a row swaps its arrow for a ✕ in the same slot. The ✕
|
|
51
|
+
* hides that row for this project in this browser (`localStorage`). Only the
|
|
52
|
+
* optional offer is dismissible; with no model at all there is nothing else to
|
|
53
|
+
* send with, so the rows stay.
|
|
54
|
+
*
|
|
55
|
+
* `projectId` omitted: the gate reads the `[id]` route segment.
|
|
56
|
+
*/
|
|
57
|
+
export function ConnectPlanRows({ projectId, dismissible, className, }) {
|
|
58
|
+
const t = useTranslations('sessionUi.modelGate');
|
|
59
|
+
const { canConnectProvider, openConnectProvider, modal } = useModelConnectionGate(undefined, projectId === undefined ? undefined : { projectId });
|
|
60
|
+
const [dismissed, setDismissed] = useState(() => dismissible ? readDismissed(projectId) : []);
|
|
61
|
+
const plans = PLANS.filter((plan) => !dismissed.includes(plan.providerId));
|
|
62
|
+
const dismiss = (id) => {
|
|
63
|
+
const next = [...dismissed, id];
|
|
64
|
+
setDismissed(next);
|
|
65
|
+
if (projectId)
|
|
66
|
+
writeDismissed(projectId, next);
|
|
67
|
+
};
|
|
68
|
+
return (_jsxs(_Fragment, { children: [modal, canConnectProvider && plans.length > 0 ? (_jsx("div", { role: "group", "aria-label": t('offerTitle'), className: cn('flex flex-col', className), children: plans.map((plan) => (_jsxs("div", { className: "group relative", children: [_jsxs("button", { type: "button", onClick: () => openConnectProvider('providers', plan.providerId), className: "hover:bg-muted/60 focus-visible:ring-kortix-base flex w-full min-w-0 items-center gap-3 rounded-lg py-2 pr-3.5 pl-2.5 text-left transition-colors outline-none focus-visible:ring-[0.6px]", children: [plan.providerId === 'anthropic' ? (
|
|
69
|
+
// Claude plans run through Claude Code, so the row shows its mark.
|
|
70
|
+
_jsx(ClaudeCode, { className: "size-5 shrink-0" })) : (_jsx(ProviderLogo, { providerID: plan.providerId, size: "xs", className: "size-5 [&_img]:size-5" })), _jsx("span", { className: "text-foreground shrink-0 text-sm", children: t(plan.labelKey) }), _jsx("span", { className: "text-muted-foreground truncate text-sm", children: t(plan.planKey) }), _jsx(SolidRightArrow, { className: cn('text-muted-foreground ml-auto size-4 shrink-0 transition-opacity', dismissible && 'group-focus-within:opacity-0 group-hover:opacity-0') })] }), dismissible ? (
|
|
71
|
+
// A sibling, not a child: a button cannot hold a button. It sits
|
|
72
|
+
// over the arrow's slot — `w-11` is `pr-3.5` + the arrow +
|
|
73
|
+
// `pr-3.5` — so the ✕ centres where the arrow was.
|
|
74
|
+
_jsx("button", { type: "button", "aria-label": t('hidePlan', { name: plan.name }), onClick: () => dismiss(plan.providerId), className: "text-muted-foreground hover:text-foreground focus-visible:ring-kortix-base absolute inset-y-0 right-0 flex w-11 items-center justify-center rounded-lg opacity-0 transition-opacity outline-none group-focus-within:opacity-100 group-hover:opacity-100 focus-visible:ring-[0.6px]", children: _jsx(Close, {}) })) : null] }, plan.providerId))) })) : null] }));
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The project home's optional offer: the rows, dismissible, under the hero
|
|
78
|
+
* composer. New projects run on Kortix models, and most people already pay
|
|
79
|
+
* for ChatGPT or Claude.
|
|
80
|
+
*
|
|
81
|
+
* Shown only when a model already runs (with none, the composer's own
|
|
82
|
+
* `ModelConnectionBar` shows the same rows, undismissible), no ChatGPT or
|
|
83
|
+
* Claude plan serves one yet, and the viewer may change the project's models.
|
|
84
|
+
* `px-4` is the composer shell's gutter, so the rows span the card's width.
|
|
85
|
+
*/
|
|
86
|
+
export function SubscriptionOffer({ projectId }) {
|
|
87
|
+
const models = useWorkspaceModels(projectId);
|
|
88
|
+
const { canWriteProviders } = useModelConnectionGate(undefined, { projectId });
|
|
89
|
+
const show = canWriteProviders && models.some(isRunnableModel) && !hasRunnableSubscriptionModel(models);
|
|
90
|
+
return show ? _jsx(ConnectPlanRows, { projectId: projectId, dismissible: true, className: "px-4" }) : null;
|
|
91
|
+
}
|