@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,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* "Invite people to {workspace}" (design.md §3.1 finding 19, C3): email
|
|
3
|
+
* chips, ONE role from the workspace ladder (Member, Manager, Admin; Owner is
|
|
4
|
+
* a transfer, never an invite), and an optional expiry. It sends
|
|
5
|
+
* `POST /v1/workspaces/:id/members {email, role, expires_at}` once per email.
|
|
6
|
+
* The server writes the storage the role needs, so the dialog never asks for
|
|
7
|
+
* a project grant. A `split_pending` workspace (a legacy account that still
|
|
8
|
+
* holds several workspaces) keeps the per-workspace grant dialog
|
|
9
|
+
* (`AccessDialog`).
|
|
10
|
+
*
|
|
11
|
+
* The same body renders in the account hub's split sheet (Members › Invite)
|
|
12
|
+
* and in a Modal.
|
|
13
|
+
*/
|
|
14
|
+
import { type WorkspaceRole } from '@kortix/sdk';
|
|
15
|
+
/** The roles an invite can carry, lowest first. */
|
|
16
|
+
export type InviteRole = Exclude<WorkspaceRole, 'owner'>;
|
|
17
|
+
export declare const INVITE_ROLES: readonly InviteRole[];
|
|
18
|
+
/**
|
|
19
|
+
* Split typed text into emails: commas, semicolons, spaces and new lines
|
|
20
|
+
* separate them. Returns the valid emails (lowercased, de-duplicated against
|
|
21
|
+
* `existing`) and what is left over (a partial or invalid entry stays typed).
|
|
22
|
+
*/
|
|
23
|
+
export declare function parseInviteEmails(text: string, existing: readonly string[]): {
|
|
24
|
+
emails: string[];
|
|
25
|
+
rest: string;
|
|
26
|
+
};
|
|
27
|
+
export interface InvitePeopleDialogProps {
|
|
28
|
+
workspaceId: string;
|
|
29
|
+
workspaceName: string;
|
|
30
|
+
open: boolean;
|
|
31
|
+
onOpenChange: (open: boolean) => void;
|
|
32
|
+
/** `member.update`: only then may an invite make an Admin. */
|
|
33
|
+
canGrantAdmin: boolean;
|
|
34
|
+
/** After the invites were sent (members, invites and probes changed). */
|
|
35
|
+
onDone?: () => void;
|
|
36
|
+
}
|
|
37
|
+
export declare function InvitePeopleDialog({ workspaceId, workspaceName, open, onOpenChange, canGrantAdmin, onDone, }: InvitePeopleDialogProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* "Invite people to {workspace}" (design.md §3.1 finding 19, C3): email
|
|
5
|
+
* chips, ONE role from the workspace ladder (Member, Manager, Admin; Owner is
|
|
6
|
+
* a transfer, never an invite), and an optional expiry. It sends
|
|
7
|
+
* `POST /v1/workspaces/:id/members {email, role, expires_at}` once per email.
|
|
8
|
+
* The server writes the storage the role needs, so the dialog never asks for
|
|
9
|
+
* a project grant. A `split_pending` workspace (a legacy account that still
|
|
10
|
+
* holds several workspaces) keeps the per-workspace grant dialog
|
|
11
|
+
* (`AccessDialog`).
|
|
12
|
+
*
|
|
13
|
+
* The same body renders in the account hub's split sheet (Members › Invite)
|
|
14
|
+
* and in a Modal.
|
|
15
|
+
*/
|
|
16
|
+
import { inviteWorkspaceMember } from '@kortix/sdk';
|
|
17
|
+
import { XIcon } from '@phosphor-icons/react';
|
|
18
|
+
import { useMutation } from '@tanstack/react-query';
|
|
19
|
+
import { useState } from 'react';
|
|
20
|
+
import { useTranslations } from '../../i18n/index.js';
|
|
21
|
+
import { useInAccountHubSheetBody } from '../../internal/account-hub/hub-sheet.js';
|
|
22
|
+
import { Badge } from '../../primitives/badge.js';
|
|
23
|
+
import { Button } from '../../primitives/button.js';
|
|
24
|
+
import { Field, FieldDescription, FieldLabel } from '../../primitives/field.js';
|
|
25
|
+
import Loading from '../../primitives/loading.js';
|
|
26
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../../primitives/select.js';
|
|
27
|
+
import { errorToast, successToast } from '../../primitives/toast.js';
|
|
28
|
+
import { ExpiryPicker, MODAL_CHROME, SHEET_CHROME } from './access-dialog.js';
|
|
29
|
+
import { endOfLocalDayIso } from './access-shared.js';
|
|
30
|
+
import { isInviteEmail } from './principal-picker.js';
|
|
31
|
+
export const INVITE_ROLES = ['member', 'manager', 'admin'];
|
|
32
|
+
/**
|
|
33
|
+
* Split typed text into emails: commas, semicolons, spaces and new lines
|
|
34
|
+
* separate them. Returns the valid emails (lowercased, de-duplicated against
|
|
35
|
+
* `existing`) and what is left over (a partial or invalid entry stays typed).
|
|
36
|
+
*/
|
|
37
|
+
export function parseInviteEmails(text, existing) {
|
|
38
|
+
const parts = text.split(/[\s,;]+/);
|
|
39
|
+
const emails = [];
|
|
40
|
+
const rest = [];
|
|
41
|
+
const seen = new Set(existing);
|
|
42
|
+
for (const part of parts) {
|
|
43
|
+
const value = part.trim().toLowerCase();
|
|
44
|
+
if (!value)
|
|
45
|
+
continue;
|
|
46
|
+
if (isInviteEmail(value)) {
|
|
47
|
+
if (!seen.has(value)) {
|
|
48
|
+
seen.add(value);
|
|
49
|
+
emails.push(value);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
rest.push(part.trim());
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return { emails, rest: rest.join(' ') };
|
|
57
|
+
}
|
|
58
|
+
export function InvitePeopleDialog({ workspaceId, workspaceName, open, onOpenChange, canGrantAdmin, onDone, }) {
|
|
59
|
+
const t = useTranslations('workspaces.invite');
|
|
60
|
+
const tRoles = useTranslations('workspaces.roles');
|
|
61
|
+
const chrome = useInAccountHubSheetBody() ? SHEET_CHROME : MODAL_CHROME;
|
|
62
|
+
const [emails, setEmails] = useState([]);
|
|
63
|
+
const [draft, setDraft] = useState('');
|
|
64
|
+
const [role, setRole] = useState('member');
|
|
65
|
+
const [expires, setExpires] = useState('');
|
|
66
|
+
const [failures, setFailures] = useState([]);
|
|
67
|
+
const commit = (text) => {
|
|
68
|
+
const parsed = parseInviteEmails(text, emails);
|
|
69
|
+
if (parsed.emails.length > 0)
|
|
70
|
+
setEmails((current) => [...current, ...parsed.emails]);
|
|
71
|
+
setDraft(parsed.rest);
|
|
72
|
+
return parsed;
|
|
73
|
+
};
|
|
74
|
+
const send = useMutation({
|
|
75
|
+
mutationFn: async (list) => {
|
|
76
|
+
const expiresIso = endOfLocalDayIso(expires);
|
|
77
|
+
const results = await Promise.allSettled(list.map((email) => inviteWorkspaceMember(workspaceId, { email, role, ...(expiresIso ? { expires_at: expiresIso } : {}) })));
|
|
78
|
+
return results.map((result, index) => ({
|
|
79
|
+
email: list[index],
|
|
80
|
+
ok: result.status === 'fulfilled',
|
|
81
|
+
message: result.status === 'rejected' ? result.reason?.message || t('sendFailed') : '',
|
|
82
|
+
}));
|
|
83
|
+
},
|
|
84
|
+
onSuccess: (results) => {
|
|
85
|
+
const sent = results.filter((result) => result.ok);
|
|
86
|
+
const failed = results.filter((result) => !result.ok);
|
|
87
|
+
if (sent.length > 0) {
|
|
88
|
+
successToast(t('sentToast', { count: sent.length }));
|
|
89
|
+
onDone?.();
|
|
90
|
+
}
|
|
91
|
+
setFailures(failed.map(({ email, message }) => ({ email, message })));
|
|
92
|
+
// The emails that failed stay as chips, so a fix is one more click.
|
|
93
|
+
setEmails(failed.map((result) => result.email));
|
|
94
|
+
if (failed.length === 0) {
|
|
95
|
+
setEmails([]);
|
|
96
|
+
setExpires('');
|
|
97
|
+
setRole('member');
|
|
98
|
+
onOpenChange(false);
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
onError: (error) => errorToast(error.message || t('sendFailed')),
|
|
102
|
+
});
|
|
103
|
+
const pending = send.isPending;
|
|
104
|
+
const submit = () => {
|
|
105
|
+
const parsed = commit(draft);
|
|
106
|
+
const list = [...emails, ...parsed.emails];
|
|
107
|
+
if (list.length === 0 || parsed.rest)
|
|
108
|
+
return;
|
|
109
|
+
send.mutate(list);
|
|
110
|
+
};
|
|
111
|
+
const onKeyDown = (event) => {
|
|
112
|
+
if (event.key === 'Enter' || event.key === ',' || event.key === ' ' || event.key === 'Tab') {
|
|
113
|
+
if (!draft.trim()) {
|
|
114
|
+
if (event.key === 'Enter') {
|
|
115
|
+
event.preventDefault();
|
|
116
|
+
submit();
|
|
117
|
+
}
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
event.preventDefault();
|
|
121
|
+
commit(draft);
|
|
122
|
+
}
|
|
123
|
+
else if (event.key === 'Backspace' && !draft && emails.length > 0) {
|
|
124
|
+
setEmails((current) => current.slice(0, -1));
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const invalidDraft = draft.trim().length > 0 && !isInviteEmail(draft);
|
|
128
|
+
const canSubmit = !pending && (emails.length > 0 || isInviteEmail(draft));
|
|
129
|
+
const roles = INVITE_ROLES.filter((value) => value !== 'admin' || canGrantAdmin);
|
|
130
|
+
return (_jsx(chrome.Root, { open: open, onOpenChange: (next) => (pending ? undefined : onOpenChange(next)), children: _jsxs(chrome.Content, { children: [_jsxs(chrome.Header, { children: [_jsx(chrome.Title, { children: t('title', { name: workspaceName }) }), _jsx(chrome.Description, { children: t('description') })] }), _jsxs("form", { className: "contents", onSubmit: (event) => {
|
|
131
|
+
event.preventDefault();
|
|
132
|
+
submit();
|
|
133
|
+
}, children: [_jsxs(chrome.Body, { children: [_jsxs(Field, { className: "gap-1.5", children: [_jsx(FieldLabel, { htmlFor: "invite-emails", children: t('emailsLabel') }), _jsxs("div", { className: "bg-popover focus-within:ring-ring flex min-h-9 flex-wrap items-center gap-1 rounded-md border px-2 py-1 focus-within:ring-1", "data-testid": "invite-emails", children: [emails.map((email) => (_jsxs(Badge, { variant: "secondary", size: "sm", className: "gap-1", children: [email, _jsx("button", { type: "button", "aria-label": t('removeEmail', { email }), className: "text-muted-foreground hover:text-foreground", onClick: () => setEmails((current) => current.filter((value) => value !== email)), disabled: pending, children: _jsx(XIcon, { className: "size-3" }) })] }, email))), _jsx("input", { id: "invite-emails", type: "text", inputMode: "email", autoComplete: "off", autoFocus: true, value: draft, onChange: (event) => setDraft(event.target.value), onKeyDown: onKeyDown, onBlur: () => draft.trim() && commit(draft), onPaste: (event) => {
|
|
134
|
+
const text = event.clipboardData.getData('text');
|
|
135
|
+
if (/[\s,;]/.test(text)) {
|
|
136
|
+
event.preventDefault();
|
|
137
|
+
commit(`${draft} ${text}`);
|
|
138
|
+
}
|
|
139
|
+
}, placeholder: emails.length === 0 ? t('emailsPlaceholder') : undefined, "aria-invalid": invalidDraft || undefined, disabled: pending, className: "text-foreground placeholder:text-muted-foreground min-w-32 flex-1 bg-transparent py-1 text-sm outline-none" })] }), _jsx(FieldDescription, { children: invalidDraft ? t('invalidEmail') : t('emailsHint') })] }), _jsxs(Field, { className: "gap-1.5", children: [_jsx(FieldLabel, { htmlFor: "invite-role", children: t('roleLabel') }), _jsxs(Select, { value: role, onValueChange: (value) => setRole(value), disabled: pending, children: [_jsx(SelectTrigger, { id: "invite-role", size: "md", className: "w-full", children: _jsx(SelectValue, { children: tRoles(`${role}.label`) }) }), _jsx(SelectContent, { children: roles.map((value) => (_jsx(SelectItem, { value: value, textValue: tRoles(`${value}.label`), children: _jsxs("span", { className: "flex flex-col gap-0.5", children: [_jsx("span", { children: tRoles(`${value}.label`) }), _jsx("span", { className: "text-muted-foreground text-xs", children: tRoles(`${value}.blurb`) })] }) }, value))) })] }), _jsx(FieldDescription, { children: t('ownerHint') })] }), _jsxs(Field, { className: "gap-1.5", children: [_jsxs("div", { className: "flex items-baseline justify-between gap-2", children: [_jsx(FieldLabel, { htmlFor: "invite-expires", children: t('expiresLabel') }), _jsx("span", { className: "text-muted-foreground text-xs", children: t('optional') })] }), _jsx(ExpiryPicker, { id: "invite-expires", value: expires, onChange: setExpires, disabled: pending }), _jsx(FieldDescription, { children: t('expiresHint') })] }), failures.length > 0 ? (_jsx("ul", { role: "alert", className: "space-y-1", "data-testid": "invite-failures", children: failures.map((failure) => (_jsxs("li", { className: "text-destructive text-xs", children: [_jsx("span", { className: "font-medium", children: failure.email }), ": ", failure.message] }, failure.email))) })) : null] }), _jsxs(chrome.Footer, { children: [_jsx(Button, { type: "button", variant: "outline-ghost", size: "sm", disabled: pending, onClick: () => onOpenChange(false), children: t('cancel') }), _jsxs(Button, { type: "submit", size: "sm", disabled: !canSubmit, className: "gap-1.5", "data-testid": "invite-send", children: [pending ? _jsx(Loading, { className: "size-4 shrink-0" }) : null, t('send', { count: Math.max(1, emails.length + (isInviteEmail(draft) ? 1 : 0)) })] })] })] })] }) }));
|
|
140
|
+
}
|
|
@@ -107,9 +107,10 @@ export function everyoneMatchesQuery(label, query) {
|
|
|
107
107
|
const q = query.trim().toLowerCase();
|
|
108
108
|
return q === '' || label.toLowerCase().includes(q);
|
|
109
109
|
}
|
|
110
|
-
export function PrincipalPicker({ scope, selection = 'multi', kinds = ['member', 'group'], allowInvite = false, everyone, excludeUserIds, value, onChange, emptyLabel
|
|
110
|
+
export function PrincipalPicker({ scope, selection = 'multi', kinds = ['member', 'group'], allowInvite = false, everyone, excludeUserIds, value, onChange, emptyLabel, allExcludedLabel, autoFocus = true, disabled = false, searchPlaceholder, className, }) {
|
|
111
111
|
const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
|
|
112
112
|
const tAgents = useTranslations('agentPrincipals');
|
|
113
|
+
const tSharing = useTranslations('accessSharing');
|
|
113
114
|
const [query, setQuery] = useState('');
|
|
114
115
|
// Single mode collapses to a "selected + Change" row once something is
|
|
115
116
|
// chosen; `editing` re-opens the list without clearing the value.
|
|
@@ -255,7 +256,7 @@ export function PrincipalPicker({ scope, selection = 'multi', kinds = ['member',
|
|
|
255
256
|
return (_jsxs("div", { className: cn('border-border overflow-hidden rounded-md border', className), children: [_jsxs(InputGroupSearch, { className: "border-b", children: [_jsx(InputGroupSearchIcon, { children: _jsx(MagnifyingGlassIcon, {}) }), _jsx(InputGroupSearchInput, { value: query, onChange: (event) => setQuery(event.target.value), placeholder: placeholder, variant: "popover", disabled: disabled,
|
|
256
257
|
// Every caller opens this as the first interactive element of a
|
|
257
258
|
// fresh dialog — typing starts the instant it is open.
|
|
258
|
-
autoFocus: autoFocus }), query ? _jsx(InputGroupSearchClear, { onClick: () => setQuery('') }) : null] }), selection === 'multi' && selectedCount > 0 ? (_jsxs("div", { className: "border-border flex items-center justify-between border-b px-3 py-1.5", children: [_jsxs("span", { className: "text-muted-foreground text-xs", children: [selectedCount, " ", tI18nComplete.raw('textd7cbbb688b2e')] }), _jsx(Button, { type: "button", variant: "ghost", size: "sm", className: "h-6 px-2 text-xs", disabled: disabled, onClick: () => onChange(EMPTY_PRINCIPAL_SELECTION), children: tI18nComplete.raw('text83b12c2216ef') })] })) : null, _jsx("div", { className: "max-h-56 overflow-y-auto p-1", children: loading ? (_jsx("div", { className: "space-y-1 p-1", children: [0, 1, 2].map((i) => (_jsxs("div", { className: "flex items-center gap-2.5 px-2 py-1.5", children: [_jsx(Skeleton, { className: "size-6 rounded-full" }), _jsx(Skeleton, { className: "h-3.5 w-40" })] }, i))) })) : nothing ? (_jsx("p", { className: "text-muted-foreground px-3 py-6 text-center text-xs", children: emptyLabel })) : allExcluded ? (_jsx("p", { className: "text-muted-foreground px-3 py-6 text-center text-xs", children: allExcludedLabel })) : filteredGroups.length === 0 &&
|
|
259
|
+
autoFocus: autoFocus }), query ? _jsx(InputGroupSearchClear, { onClick: () => setQuery('') }) : null] }), selection === 'multi' && selectedCount > 0 ? (_jsxs("div", { className: "border-border flex items-center justify-between border-b px-3 py-1.5", children: [_jsxs("span", { className: "text-muted-foreground text-xs", children: [selectedCount, " ", tI18nComplete.raw('textd7cbbb688b2e')] }), _jsx(Button, { type: "button", variant: "ghost", size: "sm", className: "h-6 px-2 text-xs", disabled: disabled, onClick: () => onChange(EMPTY_PRINCIPAL_SELECTION), children: tI18nComplete.raw('text83b12c2216ef') })] })) : null, _jsx("div", { className: "max-h-56 overflow-y-auto p-1", children: loading ? (_jsx("div", { className: "space-y-1 p-1", children: [0, 1, 2].map((i) => (_jsxs("div", { className: "flex items-center gap-2.5 px-2 py-1.5", children: [_jsx(Skeleton, { className: "size-6 rounded-full" }), _jsx(Skeleton, { className: "h-3.5 w-40" })] }, i))) })) : nothing ? (_jsx("p", { className: "text-muted-foreground px-3 py-6 text-center text-xs", children: emptyLabel ?? tSharing('pickerEmpty') })) : allExcluded ? (_jsx("p", { className: "text-muted-foreground px-3 py-6 text-center text-xs", children: allExcludedLabel ?? tSharing('pickerAllAdded') })) : filteredGroups.length === 0 &&
|
|
259
260
|
filteredMembers.length === 0 &&
|
|
260
261
|
filteredAgents.length === 0 &&
|
|
261
262
|
!inviteCandidate &&
|
|
@@ -17,11 +17,11 @@ import { useMemo } from 'react';
|
|
|
17
17
|
const DEFAULT_EMPTY_TEXT = {
|
|
18
18
|
none: 'No projects in this account yet.',
|
|
19
19
|
allExcluded: 'Already attached to every project you can manage.',
|
|
20
|
-
noneEligible: 'You need Manager access on a
|
|
20
|
+
noneEligible: 'You need Manager access on a workspace to attach a group to it.',
|
|
21
21
|
};
|
|
22
22
|
/** Sentinel for the optional "every project" row — never a real project id. */
|
|
23
23
|
export const PROJECT_SELECT_ALL = '__all__';
|
|
24
|
-
export function ProjectSelect({ accountId, value, onChange, filter, excludeIds, allOptionLabel, disabled, placeholder = 'Choose a
|
|
24
|
+
export function ProjectSelect({ accountId, value, onChange, filter, excludeIds, allOptionLabel, disabled, placeholder = 'Choose a workspace', emptyText, enabled = true, requireAction, id, className, }) {
|
|
25
25
|
const projectsQuery = useQuery({
|
|
26
26
|
queryKey: qk.projects.list(accountId),
|
|
27
27
|
queryFn: () => listProjectsForAccount(accountId),
|
|
@@ -23,17 +23,18 @@ interface RoleDescriptor {
|
|
|
23
23
|
summary: string;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
-
* Single source of truth for how a built-in role is described in the UI.
|
|
27
|
-
*
|
|
28
|
-
*
|
|
26
|
+
* Single source of truth for how a built-in role is described in the UI. One
|
|
27
|
+
* workspace ladder (design.md C3): Owner > Admin > Manager > Member. The
|
|
28
|
+
* storage still has two scopes (owner/admin/member on the account, manager on
|
|
29
|
+
* the workspace's project), but a person reads one role per workspace, so the
|
|
30
|
+
* labels never say "account" or "project".
|
|
29
31
|
*/
|
|
30
32
|
export declare const ACCOUNT_ROLE_DESCRIPTORS: Record<AccountRole, RoleDescriptor>;
|
|
31
33
|
/**
|
|
32
|
-
* The two
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* keys and the URL vocabulary); only what a person reads changed.
|
|
34
|
+
* The two rungs a workspace's project row stores (Marko, 2026-09-03): a
|
|
35
|
+
* member USES agents — the ones they are granted — and a manager CONFIGURES
|
|
36
|
+
* the workspace, which is Customize. The keys stay `member` / `manager` (they
|
|
37
|
+
* are the API's role keys and the URL vocabulary).
|
|
37
38
|
*/
|
|
38
39
|
export declare const PROJECT_ROLE_DESCRIPTORS: Record<OfferedProjectRole, RoleDescriptor>;
|
|
39
40
|
export declare function builtinRoleDescriptor(scope: RoleScope, role: AccountRole | ProjectRole, tI18nComplete?: UiTranslator): RoleDescriptor | undefined;
|
|
@@ -43,44 +43,41 @@ export function builtinRolesForScope(scope) {
|
|
|
43
43
|
return scope === 'account' ? [...ACCOUNT_ROLES_ASCENDING] : [...PROJECT_ROLES_ASCENDING];
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
|
-
* Single source of truth for how a built-in role is described in the UI.
|
|
47
|
-
*
|
|
48
|
-
*
|
|
46
|
+
* Single source of truth for how a built-in role is described in the UI. One
|
|
47
|
+
* workspace ladder (design.md C3): Owner > Admin > Manager > Member. The
|
|
48
|
+
* storage still has two scopes (owner/admin/member on the account, manager on
|
|
49
|
+
* the workspace's project), but a person reads one role per workspace, so the
|
|
50
|
+
* labels never say "account" or "project".
|
|
49
51
|
*/
|
|
50
52
|
export const ACCOUNT_ROLE_DESCRIPTORS = {
|
|
51
53
|
owner: {
|
|
52
|
-
label: '
|
|
53
|
-
blurb: 'Full control
|
|
54
|
-
summary: 'Full control of the
|
|
54
|
+
label: 'Owner',
|
|
55
|
+
blurb: 'Full control: billing, people, and deleting the workspace.',
|
|
56
|
+
summary: 'Full control of the workspace: billing, people, transferring ownership and deleting it.',
|
|
55
57
|
},
|
|
56
58
|
admin: {
|
|
57
|
-
label: '
|
|
58
|
-
blurb: 'Everything except deleting the
|
|
59
|
-
summary: 'Everything an owner can do except deleting the
|
|
59
|
+
label: 'Admin',
|
|
60
|
+
blurb: 'Billing and people. Everything except deleting the workspace or transferring ownership.',
|
|
61
|
+
summary: 'Everything an owner can do except deleting the workspace or transferring ownership.',
|
|
60
62
|
},
|
|
61
63
|
member: {
|
|
62
|
-
label: '
|
|
63
|
-
blurb: '
|
|
64
|
-
summary: 'The floor role
|
|
64
|
+
label: 'Member',
|
|
65
|
+
blurb: 'Works in sessions with the agents they are granted.',
|
|
66
|
+
summary: 'The floor role. Works in sessions with the agents they are granted, directly or through a group. No Customize.',
|
|
65
67
|
},
|
|
66
68
|
};
|
|
67
69
|
/**
|
|
68
|
-
* The two
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* keys and the URL vocabulary); only what a person reads changed.
|
|
70
|
+
* The two rungs a workspace's project row stores (Marko, 2026-09-03): a
|
|
71
|
+
* member USES agents — the ones they are granted — and a manager CONFIGURES
|
|
72
|
+
* the workspace, which is Customize. The keys stay `member` / `manager` (they
|
|
73
|
+
* are the API's role keys and the URL vocabulary).
|
|
73
74
|
*/
|
|
74
75
|
export const PROJECT_ROLE_DESCRIPTORS = {
|
|
75
|
-
member:
|
|
76
|
-
label: 'Project member',
|
|
77
|
-
blurb: 'Starts and works in sessions with the agents they are granted. No Customize.',
|
|
78
|
-
summary: 'Starts and works in sessions with the agents they are granted — nothing else. No access to Customize. The project floor role.',
|
|
79
|
-
},
|
|
76
|
+
member: ACCOUNT_ROLE_DESCRIPTORS.member,
|
|
80
77
|
manager: {
|
|
81
|
-
label: '
|
|
82
|
-
blurb: 'Customize and everything in it
|
|
83
|
-
summary: 'Customize and everything in it
|
|
78
|
+
label: 'Manager',
|
|
79
|
+
blurb: 'Customize and everything in it: every agent, skill, connector, secret and trigger.',
|
|
80
|
+
summary: 'Customize and everything in it: every agent, skill, connector, secret and trigger.',
|
|
84
81
|
},
|
|
85
82
|
};
|
|
86
83
|
export function builtinRoleDescriptor(scope, role, tI18nComplete) {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Change a person's one role in a workspace (design.md C3):
|
|
3
|
+
* `PATCH /v1/workspaces/:id/members/:userId {role}`. The ladder is Owner >
|
|
4
|
+
* Admin > Manager > Member; the server writes the storage each rung needs, and
|
|
5
|
+
* only an owner can make an owner.
|
|
6
|
+
*/
|
|
7
|
+
import { type WorkspaceRole } from '@kortix/sdk';
|
|
8
|
+
/** The ladder, highest first. */
|
|
9
|
+
export declare const WORKSPACE_ROLE_LADDER: readonly WorkspaceRole[];
|
|
10
|
+
/** The roles a caller may give: Owner only by an owner; Admin only with `member.update`. */
|
|
11
|
+
export declare function assignableWorkspaceRoles(input: {
|
|
12
|
+
viewerIsOwner: boolean;
|
|
13
|
+
canGrantAdmin: boolean;
|
|
14
|
+
}): WorkspaceRole[];
|
|
15
|
+
export interface WorkspaceRoleDialogProps {
|
|
16
|
+
workspaceId: string;
|
|
17
|
+
target: {
|
|
18
|
+
userId: string;
|
|
19
|
+
label: string;
|
|
20
|
+
role: WorkspaceRole;
|
|
21
|
+
} | null;
|
|
22
|
+
onOpenChange: (open: boolean) => void;
|
|
23
|
+
viewerIsOwner: boolean;
|
|
24
|
+
canGrantAdmin: boolean;
|
|
25
|
+
onDone?: () => void;
|
|
26
|
+
}
|
|
27
|
+
export declare function WorkspaceRoleDialog({ workspaceId, target, onOpenChange, viewerIsOwner, canGrantAdmin, onDone, }: WorkspaceRoleDialogProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Change a person's one role in a workspace (design.md C3):
|
|
5
|
+
* `PATCH /v1/workspaces/:id/members/:userId {role}`. The ladder is Owner >
|
|
6
|
+
* Admin > Manager > Member; the server writes the storage each rung needs, and
|
|
7
|
+
* only an owner can make an owner.
|
|
8
|
+
*/
|
|
9
|
+
import { updateWorkspaceMemberRole } from '@kortix/sdk';
|
|
10
|
+
import { useMutation } from '@tanstack/react-query';
|
|
11
|
+
import { useState } from 'react';
|
|
12
|
+
import { useTranslations } from '../../i18n/index.js';
|
|
13
|
+
import { Button } from '../../primitives/button.js';
|
|
14
|
+
import { Field, FieldLabel } from '../../primitives/field.js';
|
|
15
|
+
import Loading from '../../primitives/loading.js';
|
|
16
|
+
import { Modal, ModalBody, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalTitle, } from '../../primitives/modal.js';
|
|
17
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../../primitives/select.js';
|
|
18
|
+
import { errorToast, successToast } from '../../primitives/toast.js';
|
|
19
|
+
/** The ladder, highest first. */
|
|
20
|
+
export const WORKSPACE_ROLE_LADDER = ['owner', 'admin', 'manager', 'member'];
|
|
21
|
+
/** The roles a caller may give: Owner only by an owner; Admin only with `member.update`. */
|
|
22
|
+
export function assignableWorkspaceRoles(input) {
|
|
23
|
+
return WORKSPACE_ROLE_LADDER.filter((role) => (role !== 'owner' || input.viewerIsOwner) && (role !== 'admin' || input.canGrantAdmin));
|
|
24
|
+
}
|
|
25
|
+
export function WorkspaceRoleDialog({ workspaceId, target, onOpenChange, viewerIsOwner, canGrantAdmin, onDone, }) {
|
|
26
|
+
const t = useTranslations('workspaces.roleDialog');
|
|
27
|
+
const tRoles = useTranslations('workspaces.roles');
|
|
28
|
+
const [picked, setPicked] = useState(null);
|
|
29
|
+
const role = picked ?? target?.role ?? 'member';
|
|
30
|
+
const roles = assignableWorkspaceRoles({ viewerIsOwner, canGrantAdmin });
|
|
31
|
+
const save = useMutation({
|
|
32
|
+
mutationFn: () => updateWorkspaceMemberRole(workspaceId, target.userId, role),
|
|
33
|
+
onSuccess: () => {
|
|
34
|
+
successToast(t('savedToast', { name: target?.label ?? '', role: tRoles(`${role}.label`) }));
|
|
35
|
+
setPicked(null);
|
|
36
|
+
onOpenChange(false);
|
|
37
|
+
onDone?.();
|
|
38
|
+
},
|
|
39
|
+
onError: (error) => errorToast(error.message || t('saveFailed')),
|
|
40
|
+
});
|
|
41
|
+
return (_jsx(Modal, { open: target !== null, onOpenChange: (open) => {
|
|
42
|
+
if (save.isPending)
|
|
43
|
+
return;
|
|
44
|
+
if (!open)
|
|
45
|
+
setPicked(null);
|
|
46
|
+
onOpenChange(open);
|
|
47
|
+
}, children: _jsxs(ModalContent, { className: "sm:max-w-md", children: [_jsxs(ModalHeader, { children: [_jsx(ModalTitle, { children: t('title', { name: target?.label ?? '' }) }), _jsx(ModalDescription, { children: t('description') })] }), _jsx(ModalBody, { children: _jsxs(Field, { className: "gap-1.5", children: [_jsx(FieldLabel, { htmlFor: "workspace-role", children: t('roleLabel') }), _jsxs(Select, { value: role, onValueChange: (value) => setPicked(value), disabled: save.isPending, children: [_jsx(SelectTrigger, { id: "workspace-role", size: "md", className: "w-full", children: _jsx(SelectValue, { children: tRoles(`${role}.label`) }) }), _jsx(SelectContent, { children: roles.map((value) => (_jsx(SelectItem, { value: value, textValue: tRoles(`${value}.label`), children: _jsxs("span", { className: "flex flex-col gap-0.5", children: [_jsx("span", { children: tRoles(`${value}.label`) }), _jsx("span", { className: "text-muted-foreground text-xs", children: tRoles(`${value}.blurb`) })] }) }, value))) })] })] }) }), _jsxs(ModalFooter, { children: [_jsx(Button, { variant: "outline-ghost", size: "sm", disabled: save.isPending, onClick: () => onOpenChange(false), children: t('cancel') }), _jsxs(Button, { size: "sm", className: "gap-1.5", disabled: save.isPending || role === target?.role, onClick: () => save.mutate(), children: [save.isPending ? _jsx(Loading, { className: "size-4 shrink-0" }) : null, t('save')] })] })] }) }));
|
|
48
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* "Add a GitHub account" — the ONE dialog for linking a GitHub personal
|
|
3
|
-
* account or organization to a Kortix account. The account Git tab and `/new`
|
|
3
|
+
* account or organization to a Kortix account. The account Git tab and `/workspaces/new`
|
|
4
4
|
* both open it, so the two surfaces can never drift into two different
|
|
5
5
|
* stories about how a connection is made.
|
|
6
6
|
*
|
|
@@ -8,7 +8,7 @@ import { rememberGitHubSetupReturn } from '../../internal/lib/github-installatio
|
|
|
8
8
|
import { GithubLogoIcon as Github } from '@phosphor-icons/react';
|
|
9
9
|
/**
|
|
10
10
|
* "Add a GitHub account" — the ONE dialog for linking a GitHub personal
|
|
11
|
-
* account or organization to a Kortix account. The account Git tab and `/new`
|
|
11
|
+
* account or organization to a Kortix account. The account Git tab and `/workspaces/new`
|
|
12
12
|
* both open it, so the two surfaces can never drift into two different
|
|
13
13
|
* stories about how a connection is made.
|
|
14
14
|
*
|
|
@@ -51,3 +51,21 @@ export declare function defaultExpiryOption(policy: PatPolicy | null | undefined
|
|
|
51
51
|
* testable.
|
|
52
52
|
*/
|
|
53
53
|
export declare function expiresAtIso(value: ExpiryOptionValue, now?: number): string | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* What a person may pick for a new API key (a workspace key or a personal
|
|
56
|
+
* key). Unlike a service account, a key always expires unless the workspace
|
|
57
|
+
* policy allows no expiry (`allow_no_expiry`, and not `require_expiry`):
|
|
58
|
+
*
|
|
59
|
+
* - every preset up to the policy maximum (365 days when none is set);
|
|
60
|
+
* - a maximum shorter than every preset becomes the only offer;
|
|
61
|
+
* - "Never" only when the policy allows it.
|
|
62
|
+
*/
|
|
63
|
+
export declare function keyExpiryOptions(policy: PatPolicy | null | undefined, tI18nComplete: UiTranslator): ExpiryOption[];
|
|
64
|
+
/** The pre-selected expiry of a new key: 90 days, or the longest the policy allows. */
|
|
65
|
+
export declare function defaultKeyExpiryOption(policy: PatPolicy | null | undefined, tI18nComplete: UiTranslator): ExpiryOptionValue;
|
|
66
|
+
/**
|
|
67
|
+
* The `expiresAt` a key mint sends: an ISO instant, or `null` for "Never".
|
|
68
|
+
* `null` is explicit because the API gives a key without `expires_at` the
|
|
69
|
+
* default lifetime (90 days), not "no expiry".
|
|
70
|
+
*/
|
|
71
|
+
export declare function keyExpiresAt(value: ExpiryOptionValue, now?: number): string | null;
|
|
@@ -66,3 +66,50 @@ export function expiresAtIso(value, now = Date.now()) {
|
|
|
66
66
|
return undefined;
|
|
67
67
|
return new Date(now + days * MS_PER_DAY).toISOString();
|
|
68
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* The longest expiry a new API key may have when the workspace policy sets no
|
|
71
|
+
* maximum, and the expiry a key gets when the person picks none (design.md
|
|
72
|
+
* §3.2 C4a, `resolveMintExpiry` in apps/api). The API reports both on the
|
|
73
|
+
* policy (`effective_max_lifetime_days`, `default_lifetime_days`); these are
|
|
74
|
+
* the values of an API that does not.
|
|
75
|
+
*/
|
|
76
|
+
const KEY_MAX_DAYS = 365;
|
|
77
|
+
const KEY_DEFAULT_DAYS = 90;
|
|
78
|
+
/**
|
|
79
|
+
* What a person may pick for a new API key (a workspace key or a personal
|
|
80
|
+
* key). Unlike a service account, a key always expires unless the workspace
|
|
81
|
+
* policy allows no expiry (`allow_no_expiry`, and not `require_expiry`):
|
|
82
|
+
*
|
|
83
|
+
* - every preset up to the policy maximum (365 days when none is set);
|
|
84
|
+
* - a maximum shorter than every preset becomes the only offer;
|
|
85
|
+
* - "Never" only when the policy allows it.
|
|
86
|
+
*/
|
|
87
|
+
export function keyExpiryOptions(policy, tI18nComplete) {
|
|
88
|
+
const cap = policy?.effective_max_lifetime_days ?? policy?.max_lifetime_days ?? KEY_MAX_DAYS;
|
|
89
|
+
const withinCap = OFFERED_DAYS.filter((d) => d <= cap);
|
|
90
|
+
const days = cap < 30 && cap !== 1 ? [...withinCap, cap] : withinCap;
|
|
91
|
+
const options = days.map((d) => ({ value: String(d), label: dayLabel(d) }));
|
|
92
|
+
if (policy?.allow_no_expiry === true && policy.require_expiry !== true) {
|
|
93
|
+
options.push({ value: NEVER_EXPIRES, label: tI18nComplete.raw('text6300ef800bb8') });
|
|
94
|
+
}
|
|
95
|
+
return options;
|
|
96
|
+
}
|
|
97
|
+
/** The pre-selected expiry of a new key: 90 days, or the longest the policy allows. */
|
|
98
|
+
export function defaultKeyExpiryOption(policy, tI18nComplete) {
|
|
99
|
+
const options = keyExpiryOptions(policy, tI18nComplete);
|
|
100
|
+
const preferred = options.find((o) => o.value === String(policy?.default_lifetime_days ?? KEY_DEFAULT_DAYS));
|
|
101
|
+
if (preferred)
|
|
102
|
+
return preferred.value;
|
|
103
|
+
const dated = options.filter((o) => o.value !== NEVER_EXPIRES);
|
|
104
|
+
return dated[dated.length - 1]?.value ?? options[0]?.value ?? String(KEY_DEFAULT_DAYS);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The `expiresAt` a key mint sends: an ISO instant, or `null` for "Never".
|
|
108
|
+
* `null` is explicit because the API gives a key without `expires_at` the
|
|
109
|
+
* default lifetime (90 days), not "no expiry".
|
|
110
|
+
*/
|
|
111
|
+
export function keyExpiresAt(value, now = Date.now()) {
|
|
112
|
+
if (value === NEVER_EXPIRES)
|
|
113
|
+
return null;
|
|
114
|
+
return expiresAtIso(value, now) ?? new Date(now + KEY_DEFAULT_DAYS * MS_PER_DAY).toISOString();
|
|
115
|
+
}
|
|
@@ -85,6 +85,12 @@ export interface ApiKeyRow {
|
|
|
85
85
|
expiresAt: string | null;
|
|
86
86
|
/** What the key can reach. `null` = everything in this workspace. */
|
|
87
87
|
scopeLabel: string | null;
|
|
88
|
+
/** What the key may do inside its creator's role. Absent on service accounts and older APIs. */
|
|
89
|
+
access?: 'full' | 'read' | 'custom';
|
|
90
|
+
/** A `custom` key's permissions, workspace spelling. */
|
|
91
|
+
permissions?: string[];
|
|
92
|
+
/** True when each use moves the expiry out again (the CLI login). */
|
|
93
|
+
expiryRenews?: boolean;
|
|
88
94
|
}
|
|
89
95
|
/**
|
|
90
96
|
* Trim a public key to something a person can eyeball without wrapping.
|
|
@@ -105,6 +105,9 @@ export function buildApiKeyRows({ tokens = [], serviceAccounts = [], projects =
|
|
|
105
105
|
lastUsedAt: t.last_used_at,
|
|
106
106
|
expiresAt: t.expires_at,
|
|
107
107
|
scopeLabel: t.project_id ? (projectName.get(t.project_id) ?? shortId(t.project_id)) : null,
|
|
108
|
+
access: t.scope ?? 'full',
|
|
109
|
+
...(t.workspace_permissions ? { permissions: t.workspace_permissions } : {}),
|
|
110
|
+
...(t.expiry_renews ? { expiryRenews: true } : {}),
|
|
108
111
|
});
|
|
109
112
|
}
|
|
110
113
|
const automation = serviceAccounts.map((sa) => ({
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace settings › API keys: who a new key acts as, and what a row offers.
|
|
3
|
+
*
|
|
4
|
+
* Pure so the picker rules are testable without a DOM (design.md §3.2 C4b):
|
|
5
|
+
*
|
|
6
|
+
* - `me`: every member mints and revokes their own keys.
|
|
7
|
+
* - `agent` / `bot`: need `token.create` (`can_manage_principals`). An agent
|
|
8
|
+
* key needs an agent in kortix.yaml; a bot key names an existing bot or a
|
|
9
|
+
* new name (the API creates the bot with the Member role).
|
|
10
|
+
*/
|
|
11
|
+
import type { WorkspaceKey, WorkspaceKeyActsAsInput, WorkspaceKeyList, WorkspaceKeyPrincipal } from '@kortix/sdk';
|
|
12
|
+
/** Why a principal cannot be picked, or null when it can. */
|
|
13
|
+
export type ActsAsBlock = 'needs_permission' | 'no_agents' | null;
|
|
14
|
+
export interface ActsAsOption {
|
|
15
|
+
value: WorkspaceKeyPrincipal;
|
|
16
|
+
block: ActsAsBlock;
|
|
17
|
+
}
|
|
18
|
+
/** The three choices of "Acts as", each with the reason it is off (if it is). */
|
|
19
|
+
export declare function actsAsOptions(list: Pick<WorkspaceKeyList, 'can_manage_principals' | 'agents'> | null | undefined): ActsAsOption[];
|
|
20
|
+
/** The bot Select's sentinel for "a new bot with this name". */
|
|
21
|
+
export declare const NEW_BOT = "__new_bot__";
|
|
22
|
+
export interface ActsAsDraft {
|
|
23
|
+
actsAs: WorkspaceKeyPrincipal;
|
|
24
|
+
agent: string;
|
|
25
|
+
/** A bot id, or `NEW_BOT`. */
|
|
26
|
+
bot: string;
|
|
27
|
+
newBotName: string;
|
|
28
|
+
}
|
|
29
|
+
/** The request field for a draft, or null while it is incomplete. */
|
|
30
|
+
export declare function actsAsInput(draft: ActsAsDraft): WorkspaceKeyActsAsInput | null;
|
|
31
|
+
export type KeyStatus = 'active' | 'expired' | 'revoked';
|
|
32
|
+
/** A key's state: revoked wins over expired. */
|
|
33
|
+
export declare function keyStatus(key: Pick<WorkspaceKey, 'status' | 'revoked_at' | 'expires_at'>, now?: number): KeyStatus;
|
|
34
|
+
/**
|
|
35
|
+
* What a row's menu offers. The caller's own key: revoke, then delete once
|
|
36
|
+
* revoked. An agent or bot key: revoke for a manager. An older bot's own
|
|
37
|
+
* bearer: revoke, then delete for a manager.
|
|
38
|
+
*/
|
|
39
|
+
export declare function keyRowAction(key: Pick<WorkspaceKey, 'acts_as' | 'credential' | 'status' | 'revoked_at' | 'expires_at'>, canManagePrincipals: boolean, now?: number): 'revoke' | 'delete' | null;
|
|
40
|
+
/** Active keys first, then by creation, newest first. */
|
|
41
|
+
export declare function sortKeys<T extends Pick<WorkspaceKey, 'status' | 'revoked_at' | 'expires_at' | 'created_at'>>(keys: readonly T[], now?: number): T[];
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** The three choices of "Acts as", each with the reason it is off (if it is). */
|
|
2
|
+
export function actsAsOptions(list) {
|
|
3
|
+
const can = list?.can_manage_principals === true;
|
|
4
|
+
return [
|
|
5
|
+
{ value: 'me', block: null },
|
|
6
|
+
{ value: 'agent', block: !can ? 'needs_permission' : (list?.agents.length ?? 0) === 0 ? 'no_agents' : null },
|
|
7
|
+
{ value: 'bot', block: !can ? 'needs_permission' : null },
|
|
8
|
+
];
|
|
9
|
+
}
|
|
10
|
+
/** The bot Select's sentinel for "a new bot with this name". */
|
|
11
|
+
export const NEW_BOT = '__new_bot__';
|
|
12
|
+
/** The request field for a draft, or null while it is incomplete. */
|
|
13
|
+
export function actsAsInput(draft) {
|
|
14
|
+
if (draft.actsAs === 'me')
|
|
15
|
+
return { type: 'me' };
|
|
16
|
+
if (draft.actsAs === 'agent')
|
|
17
|
+
return draft.agent.trim() ? { type: 'agent', agent: draft.agent.trim() } : null;
|
|
18
|
+
if (draft.bot === NEW_BOT)
|
|
19
|
+
return draft.newBotName.trim() ? { type: 'bot', bot: draft.newBotName.trim() } : null;
|
|
20
|
+
return draft.bot ? { type: 'bot', bot: draft.bot } : null;
|
|
21
|
+
}
|
|
22
|
+
/** A key's state: revoked wins over expired. */
|
|
23
|
+
export function keyStatus(key, now = Date.now()) {
|
|
24
|
+
if (key.status !== 'active' || key.revoked_at)
|
|
25
|
+
return 'revoked';
|
|
26
|
+
if (key.expires_at && Date.parse(key.expires_at) <= now)
|
|
27
|
+
return 'expired';
|
|
28
|
+
return 'active';
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* What a row's menu offers. The caller's own key: revoke, then delete once
|
|
32
|
+
* revoked. An agent or bot key: revoke for a manager. An older bot's own
|
|
33
|
+
* bearer: revoke, then delete for a manager.
|
|
34
|
+
*/
|
|
35
|
+
export function keyRowAction(key, canManagePrincipals, now = Date.now()) {
|
|
36
|
+
const status = keyStatus(key, now);
|
|
37
|
+
const own = key.acts_as.type === 'me';
|
|
38
|
+
if (!own && !canManagePrincipals)
|
|
39
|
+
return null;
|
|
40
|
+
if (status !== 'revoked')
|
|
41
|
+
return 'revoke';
|
|
42
|
+
return own || key.credential === 'service_account_bearer' ? 'delete' : null;
|
|
43
|
+
}
|
|
44
|
+
/** Active keys first, then by creation, newest first. */
|
|
45
|
+
export function sortKeys(keys, now = Date.now()) {
|
|
46
|
+
const rank = (k) => (keyStatus(k, now) === 'active' ? 0 : 1);
|
|
47
|
+
return [...keys].sort((a, b) => rank(a) - rank(b) || b.created_at.localeCompare(a.created_at));
|
|
48
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const DEFAULT_COPY = {
|
|
2
2
|
heading: 'Who can access this',
|
|
3
|
-
project: { label: '
|
|
3
|
+
project: { label: 'Workspace-wide', desc: 'Every member of this workspace' },
|
|
4
4
|
private: { label: 'Only me', desc: 'Just you' },
|
|
5
5
|
members: {
|
|
6
6
|
label: 'Specific members or groups',
|
|
@@ -53,7 +53,7 @@ const NO_INVITE_EMAILS = [];
|
|
|
53
53
|
* @deprecated Use `PrincipalPicker` from
|
|
54
54
|
* `@/features/workspace/shared/access`.
|
|
55
55
|
*/
|
|
56
|
-
export function SubjectPicker({ projectId, accountId, memberIds, groupIds, inviteEmails = NO_INVITE_EMAILS, onChange, allowInvite = false, kinds = ['member', 'group'], excludeUserIds, emptyLabel
|
|
56
|
+
export function SubjectPicker({ projectId, accountId, memberIds, groupIds, inviteEmails = NO_INVITE_EMAILS, onChange, allowInvite = false, kinds = ['member', 'group'], excludeUserIds, emptyLabel, allExcludedLabel, }) {
|
|
57
57
|
const value = useMemo(() => ({ memberIds, groupIds, inviteEmails }), [memberIds, groupIds, inviteEmails]);
|
|
58
58
|
const scope = projectId
|
|
59
59
|
? { kind: 'project', projectId }
|