@kortix/ui 0.14.17 → 0.15.0
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/README.md +3 -3
- package/dist/_vendor/kortix-shared.js +993 -74
- package/dist/_vendor/shared/artifact-annotations.d.ts +85 -607
- package/dist/_vendor/shared/artifact-comments.d.ts +53 -489
- package/dist/_vendor/shared/channel-descriptors.d.ts +20 -1
- package/dist/_vendor/shared/channel-message.d.ts +1 -1
- package/dist/_vendor/shared/index.d.ts +0 -1
- package/dist/_vendor/shared/my-kortix-agent.d.ts +1 -1
- package/dist/_vendor/shared/peer-message-prompt.d.ts +7 -1
- package/dist/_vendor/shared/project-glyphs.d.ts +103 -20
- package/dist/_vendor/shared/space-slug.d.ts +3 -4
- package/dist/_vendor/shared/utils/ambiguous-write.d.ts +3 -3
- package/dist/_vendor/shared/webhook-signing.d.ts +3 -1
- package/dist/access/access/access-dialog-share.d.ts +3 -28
- package/dist/access/access/access-dialog-share.js +3 -75
- package/dist/artifacts/artifact-frame.js +26 -2
- package/dist/artifacts/artifact-session.js +6 -2
- package/dist/artifacts/frame-policy.d.ts +2 -9
- package/dist/artifacts/frame-policy.js +2 -25
- package/dist/customize/agents/agent-instructions.d.ts +8 -0
- package/dist/customize/agents/agent-instructions.js +38 -12
- package/dist/customize/agents/agent-overview.d.ts +6 -3
- package/dist/customize/agents/agent-overview.js +8 -2
- package/dist/customize/agents/agent-page-chrome.d.ts +45 -27
- package/dist/customize/agents/agent-page-chrome.js +60 -37
- package/dist/customize/agents/agent-page.js +88 -99
- package/dist/customize/agents/agent-tabs.d.ts +15 -14
- package/dist/customize/agents/agent-tabs.js +19 -16
- package/dist/customize/agents/agents-page.js +9 -7
- package/dist/customize/agents/create-agent-modal.js +1 -1
- package/dist/customize/connectors/connector-filter.d.ts +2 -1
- package/dist/customize/connectors/connector-filter.js +2 -3
- package/dist/customize/connectors/connectors-page.js +15 -24
- package/dist/customize/connectors/detail/account-info.js +1 -1
- package/dist/customize/connectors/detail/connector-status.d.ts +3 -24
- package/dist/customize/connectors/detail/connector-status.js +2 -42
- package/dist/customize/connectors/detail/use-connector-detail.d.ts +2 -6
- package/dist/customize/connectors/detail/use-connector-detail.js +3 -13
- package/dist/customize/connectors/install/install.d.ts +2 -6
- package/dist/customize/connectors/install/install.js +2 -16
- package/dist/customize/connectors/provider-label.d.ts +4 -17
- package/dist/customize/connectors/provider-label.js +4 -37
- package/dist/customize/project-settings/project-admin-sections.d.ts +6 -2
- package/dist/customize/project-settings/project-admin-sections.js +5 -3
- package/dist/customize/project-settings/project-settings-sections.js +1 -1
- package/dist/customize/providers/provider-connect.d.ts +6 -15
- package/dist/customize/providers/provider-connect.js +5 -36
- package/dist/customize/sections/component/channel-access-panel.js +16 -0
- package/dist/customize/sections/component/channel-mocks.d.ts +5 -0
- package/dist/customize/sections/component/channel-mocks.js +14 -2
- package/dist/customize/sections/component/discord-channel-row.d.ts +6 -0
- package/dist/customize/sections/component/discord-channel-row.js +48 -0
- package/dist/customize/sections/connector-connection-form.d.ts +3 -7
- package/dist/customize/sections/connector-connection-form.js +2 -33
- package/dist/customize/sections/connector-oauth2-auto.d.ts +3 -33
- package/dist/customize/sections/connector-oauth2-auto.js +2 -64
- package/dist/customize/sections/gateway-access-tab.js +1 -1
- package/dist/customize/sections/gateway-view.d.ts +6 -5
- package/dist/customize/sections/gateway-view.js +31 -13
- package/dist/customize/sections/llm-provider/constants.d.ts +1 -2
- package/dist/customize/sections/llm-provider/constants.js +1 -2
- package/dist/customize/sections/llm-provider/utils.d.ts +1 -41
- package/dist/customize/sections/llm-provider/utils.js +1 -52
- package/dist/customize/sections/view/account-secret-resources-panel.js +4 -1
- package/dist/customize/sections/view/agent-editor-catalog.js +0 -5
- package/dist/customize/sections/view/channel-settings-patch.js +1 -1
- package/dist/customize/sections/view/channels-view.js +26 -9
- package/dist/customize/sections/view/connector-connections.d.ts +5 -85
- package/dist/customize/sections/view/connector-connections.js +5 -99
- package/dist/customize/sections/view/gateway/gateway-logs.d.ts +42 -3
- package/dist/customize/sections/view/gateway/gateway-logs.js +212 -15
- package/dist/customize/sections/view/gateway/gateway-overview.js +1 -1
- package/dist/customize/sections/view/gateway/gateway-routing.d.ts +3 -3
- package/dist/customize/sections/view/gateway/gateway-routing.js +81 -200
- package/dist/customize/sections/view/gateway/routing-parts.d.ts +101 -0
- package/dist/customize/sections/view/gateway/routing-parts.js +154 -0
- package/dist/customize/sections/view/gateway/routing-sentence-layout.d.ts +2 -0
- package/dist/customize/sections/view/gateway/routing-sentence-layout.js +82 -0
- package/dist/customize/sections/view/git-view.js +2 -2
- package/dist/customize/sections/view/review-center-connected.js +17 -15
- package/dist/customize/sections/view/review-view.d.ts +7 -0
- package/dist/customize/sections/view/review-view.js +11 -0
- package/dist/customize/sections/view/secret-delivery.js +2 -2
- package/dist/customize/sections/view/secrets-view.js +1 -1
- package/dist/customize/sections/view/subscription-usage-tab.d.ts +14 -0
- package/dist/customize/sections/view/subscription-usage-tab.js +122 -0
- package/dist/customize/sections/view/subscription-usage.d.ts +34 -0
- package/dist/customize/sections/view/subscription-usage.js +98 -0
- package/dist/customize/settings/rail.js +2 -2
- package/dist/customize/settings/tabs/experimental-tab.d.ts +2 -2
- package/dist/customize/settings/tabs/experimental-tab.js +5 -5
- package/dist/customize/settings/tabs/general-tab.js +70 -14
- package/dist/customize/shared/capability-library.js +19 -22
- package/dist/customize/shared/catalog/catalog-card.d.ts +9 -4
- package/dist/customize/shared/catalog/catalog-card.js +3 -3
- package/dist/customize/shared/channels-switch-dialog.d.ts +1 -1
- package/dist/customize/shared/channels-switch-dialog.js +1 -1
- package/dist/customize/shared/customize-tab-bar.d.ts +1 -2
- package/dist/customize/shared/customize-tab-bar.js +10 -11
- package/dist/customize/shared/feature-gate-screen.js +1 -1
- package/dist/customize/triggers/schedule/post-to-field.d.ts +1 -1
- package/dist/customize/triggers/schedule/post-to-field.js +2 -2
- package/dist/customize/triggers/schedule/trigger-composer-logic.d.ts +1 -1
- package/dist/files/drives/conflict-marks.d.ts +28 -0
- package/dist/files/drives/conflict-marks.js +39 -0
- package/dist/files/drives/session-drives-chip.js +15 -10
- package/dist/files/project/components/drive-create-dialog.js +3 -3
- package/dist/files/viewer/index.d.ts +1 -1
- package/dist/files/viewer/index.js +1 -1
- package/dist/i18n/en.d.ts +502 -207
- package/dist/i18n/en.js +608 -313
- package/dist/i18n/ui-catalog/remaining-ui-translation-keys.generated.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/account-hub/sections.d.ts +1 -1
- package/dist/internal/branding/branding-provider.d.ts +15 -4
- package/dist/internal/branding/branding-provider.js +12 -7
- package/dist/internal/capture/use-capture-area.d.ts +5 -1
- package/dist/internal/capture/use-capture-area.js +16 -9
- package/dist/internal/connector-logo/connector-logo.js +2 -0
- package/dist/internal/connector-logo/connector-mark-files.js +1 -0
- package/dist/internal/goals/goal-meta.d.ts +50 -3
- package/dist/internal/goals/goal-meta.js +144 -9
- package/dist/internal/hooks/channels/use-channels-installations.d.ts +7 -2
- package/dist/internal/hooks/channels/use-channels-installations.js +31 -1
- package/dist/internal/hooks/connectors/use-add-account.d.ts +3 -9
- package/dist/internal/hooks/connectors/use-add-account.js +3 -18
- package/dist/internal/hooks/connectors/use-connect-link.d.ts +3 -2
- package/dist/internal/hooks/connectors/use-connect-link.js +15 -24
- package/dist/internal/hooks/connectors/use-pipedream-connect-project.d.ts +3 -56
- package/dist/internal/hooks/connectors/use-pipedream-connect-project.js +3 -87
- package/dist/internal/hooks/projects/use-new-project-session.d.ts +9 -16
- package/dist/internal/hooks/projects/use-new-project-session.js +16 -100
- package/dist/internal/hooks/projects/use-project-can-run.d.ts +7 -0
- package/dist/internal/hooks/projects/use-project-can-run.js +12 -5
- package/dist/internal/hooks/projects/use-restart-project-session.d.ts +0 -1
- package/dist/internal/hooks/projects/use-restart-project-session.js +0 -1
- package/dist/internal/hooks/use-notification-center.d.ts +11 -8
- package/dist/internal/hooks/use-notification-center.js +22 -10
- package/dist/internal/icons/discord.d.ts +9 -0
- package/dist/internal/icons/discord.js +9 -0
- package/dist/internal/layout/connect-mcp-modal.js +1 -1
- package/dist/internal/layout/project-capability-nav.js +6 -2
- package/dist/internal/layout/project-page-header.d.ts +3 -1
- package/dist/internal/layout/project-page-header.js +2 -2
- package/dist/internal/lib/account-secret-access.d.ts +1 -41
- package/dist/internal/lib/account-secret-access.js +3 -46
- package/dist/internal/lib/browser-error-noise.d.ts +1 -1
- package/dist/internal/lib/browser-error-noise.js +1 -1
- package/dist/internal/lib/browser-noise/rules/expected-states.d.ts +2 -15
- package/dist/internal/lib/browser-noise/rules/expected-states.js +6 -56
- package/dist/internal/lib/capability-tab-routes.d.ts +3 -3
- package/dist/internal/lib/capability-tab-routes.js +11 -3
- package/dist/internal/lib/error-handler.js +1 -1
- package/dist/internal/lib/llm-providers.d.ts +4 -110
- package/dist/internal/lib/llm-providers.js +5 -102
- package/dist/internal/lib/navigation/message-link.d.ts +32 -0
- package/dist/internal/lib/navigation/message-link.js +51 -0
- package/dist/internal/lib/navigation/session-href.d.ts +11 -0
- package/dist/internal/lib/navigation/session-href.js +20 -0
- package/dist/internal/lib/navigation/session-spawn-urls.d.ts +17 -0
- package/dist/internal/lib/navigation/session-spawn-urls.js +26 -0
- package/dist/internal/lib/space-scope.d.ts +3 -3
- package/dist/internal/lib/space-scope.js +3 -3
- package/dist/internal/lib/use-project-feature-flags.js +11 -9
- package/dist/internal/lib/web-notifications.d.ts +1 -1
- package/dist/internal/lib/web-notifications.js +0 -3
- package/dist/internal/notifications/notification-bell.js +1 -3
- package/dist/internal/notifications/notification-rows.d.ts +2 -2
- package/dist/internal/notifications/notification-rows.js +2 -3
- package/dist/internal/session-types/index.d.ts +5 -7
- package/dist/internal/session-types/index.js +5 -7
- package/dist/internal/stores/active-space-store.d.ts +1 -1
- package/dist/internal/stores/active-space-store.js +1 -1
- package/dist/internal/stores/kortix-computer-store.d.ts +15 -0
- package/dist/internal/stores/kortix-computer-store.js +12 -0
- package/dist/lib/routes.d.ts +17 -7
- package/dist/lib/routes.js +18 -2
- package/dist/markdown/app-link-icons.d.ts +7 -0
- package/dist/markdown/app-link-icons.js +20 -0
- package/dist/markdown/app-links.d.ts +9 -0
- package/dist/markdown/app-links.js +112 -0
- package/dist/markdown/doc-editor/doc-attrs.d.ts +28 -0
- package/dist/markdown/doc-editor/doc-attrs.js +156 -0
- package/dist/markdown/doc-editor/doc-embed.d.ts +6 -0
- package/dist/markdown/doc-editor/doc-embed.js +26 -8
- package/dist/markdown/doc-editor/doc-extensions.d.ts +10 -0
- package/dist/markdown/doc-editor/doc-extensions.js +55 -8
- package/dist/markdown/doc-editor/doc-fidelity.d.ts +72 -0
- package/dist/markdown/doc-editor/doc-fidelity.js +135 -0
- package/dist/markdown/doc-editor/doc-node-view.d.ts +9 -0
- package/dist/markdown/doc-editor/doc-node-view.js +29 -0
- package/dist/markdown/doc-editor/markdown.d.ts +20 -0
- package/dist/markdown/doc-editor/markdown.js +455 -18
- package/dist/markdown/markdown-frontmatter.d.ts +0 -3
- package/dist/markdown/markdown-frontmatter.js +45 -5
- package/dist/markdown/unified-markdown.d.ts +1 -1
- package/dist/markdown/unified-markdown.js +129 -10
- package/dist/primitives/emoji-picker.js +16 -100
- package/dist/primitives/emoji-tint.js +12 -12
- package/dist/primitives/entity-avatar.js +14 -9
- package/dist/primitives/glyph-face.d.ts +19 -12
- package/dist/primitives/glyph-face.js +59 -20
- package/dist/primitives/glyph-paths-source.d.ts +7 -0
- package/dist/primitives/glyph-paths-source.js +14 -6
- package/dist/primitives/glyph-paths.generated.d.ts +1 -1
- package/dist/primitives/glyph-paths.generated.js +947 -204
- package/dist/primitives/glyph-picker.d.ts +6 -10
- package/dist/primitives/glyph-picker.js +147 -98
- package/dist/primitives/glyph-registry.js +1604 -1
- package/dist/primitives/glyph-tint.d.ts +28 -3
- package/dist/primitives/glyph-tint.js +41 -83
- package/dist/primitives/kortix-glyphs.d.ts +32 -0
- package/dist/primitives/kortix-glyphs.js +157 -0
- package/dist/primitives/project-icon-picker.d.ts +8 -1
- package/dist/primitives/project-icon-picker.js +13 -5
- package/dist/primitives/user-avatar.d.ts +8 -1
- package/dist/primitives/user-avatar.js +2 -2
- package/dist/providers/ui-provider.d.ts +1 -8
- package/dist/session/actions/project-session-list-helpers.d.ts +4 -14
- package/dist/session/actions/project-session-list-helpers.js +6 -17
- package/dist/session/actions/session-label.d.ts +5 -9
- package/dist/session/actions/session-label.js +6 -10
- package/dist/session/agents/agent-model.js +4 -0
- package/dist/session/agents/agent-state-mark.d.ts +12 -7
- package/dist/session/agents/agent-state-mark.js +37 -15
- package/dist/session/agents/agent-strip.js +8 -2
- package/dist/session/agents/agent-surface.d.ts +81 -0
- package/dist/session/agents/agent-surface.js +97 -0
- package/dist/session/agents/held-messages.js +7 -4
- package/dist/session/agents/legacy-subagent-chat.js +1 -1
- package/dist/session/agents/session-peek.js +24 -12
- package/dist/session/agents/steer-session.d.ts +2 -0
- package/dist/session/agents/steer-session.js +3 -2
- package/dist/session/agents/subagent-dialog-content.d.ts +30 -1
- package/dist/session/agents/subagent-dialog-content.js +147 -33
- package/dist/session/agents/subagent-view.d.ts +15 -5
- package/dist/session/agents/subagent-view.js +28 -6
- package/dist/session/agents/tasks-panel.js +2 -12
- package/dist/session/agents/workflow-run-controls.d.ts +3 -1
- package/dist/session/agents/workflow-run-controls.js +12 -7
- package/dist/session/composer/ComposerCard.d.ts +7 -1
- package/dist/session/composer/ComposerCard.js +74 -9
- package/dist/session/composer/agent-selector.d.ts +16 -0
- package/dist/session/composer/agent-selector.js +19 -11
- package/dist/session/composer/chat-input/chat-input-control.d.ts +64 -0
- package/dist/session/composer/chat-input/chat-input-control.js +578 -0
- package/dist/session/composer/chat-input/chat-input-overrides.d.ts +76 -0
- package/dist/session/composer/chat-input/chat-input-overrides.js +40 -0
- package/dist/session/composer/chat-input/chat-input-panes.d.ts +56 -0
- package/dist/session/composer/chat-input/chat-input-panes.js +148 -0
- package/dist/session/composer/chat-input/chat-input-summary.d.ts +67 -0
- package/dist/session/composer/chat-input/chat-input-summary.js +67 -0
- package/dist/session/composer/chat-queue-lines.d.ts +20 -0
- package/dist/session/composer/chat-queue-lines.js +20 -0
- package/dist/session/composer/composer-chat-input.d.ts +8 -1
- package/dist/session/composer/composer-chat-input.js +12 -4
- package/dist/session/composer/composer-focus-context.d.ts +7 -0
- package/dist/session/composer/composer-focus-context.js +9 -0
- package/dist/session/composer/composer-toolbar.d.ts +3 -1
- package/dist/session/composer/composer-toolbar.js +3 -3
- package/dist/session/composer/composer-underbar.d.ts +10 -1
- package/dist/session/composer/composer-underbar.js +10 -2
- package/dist/session/composer/composer.d.ts +12 -0
- package/dist/session/composer/composer.js +55 -1
- package/dist/session/composer/editor/composer-editor.d.ts +10 -2
- package/dist/session/composer/editor/composer-editor.js +22 -6
- package/dist/session/composer/editor/first-visual-line.d.ts +2 -0
- package/dist/session/composer/editor/first-visual-line.js +9 -0
- package/dist/session/composer/editor/mention-node.js +2 -0
- package/dist/session/composer/editor/serialize.js +9 -1
- package/dist/session/composer/hooks/use-file-search.d.ts +1 -1
- package/dist/session/composer/hooks/use-file-search.js +1 -1
- package/dist/session/composer/menus/mention-controller.d.ts +3 -11
- package/dist/session/composer/menus/mention-controller.js +56 -16
- package/dist/session/composer/menus/mention-menu.d.ts +7 -2
- package/dist/session/composer/menus/mention-menu.js +17 -9
- package/dist/session/composer/menus/menu-items.d.ts +9 -0
- package/dist/session/composer/menus/space-mentions.d.ts +48 -0
- package/dist/session/composer/menus/space-mentions.js +83 -0
- package/dist/session/composer/prompt-history.d.ts +9 -0
- package/dist/session/composer/prompt-history.js +45 -0
- package/dist/session/composer/queue-projection.d.ts +2 -0
- package/dist/session/composer/queue-projection.js +1 -0
- package/dist/session/composer/queued-prompt-list.js +53 -4
- package/dist/session/composer/reasoning-effort-selector.d.ts +20 -0
- package/dist/session/composer/reasoning-effort-selector.js +3 -3
- package/dist/session/composer/types.d.ts +2 -1
- package/dist/session/header/session-site-header.js +7 -3
- package/dist/session/header/subagent-hover-card.d.ts +7 -4
- package/dist/session/header/subagent-hover-card.js +62 -11
- package/dist/session/list/session-status-mark.d.ts +42 -0
- package/dist/{workspace/sidebar → session/list}/session-status-mark.js +37 -2
- package/dist/session/models/model-selector.d.ts +7 -2
- package/dist/session/models/model-selector.js +39 -31
- package/dist/session/overrides/provider-secret-pool-editor.d.ts +11 -0
- package/dist/session/overrides/provider-secret-pool-editor.js +17 -0
- package/dist/session/overrides/session-overrides-control.d.ts +5 -0
- package/dist/session/overrides/session-overrides-toolbar.js +147 -7
- package/dist/session/panel/model-switch-event.d.ts +8 -0
- package/dist/session/panel/model-switch-event.js +19 -0
- package/dist/session/panel/session-audit-panel.js +3 -2
- package/dist/session/panel/session-desktop.js +5 -1
- package/dist/session/panel/session-panel-provider.js +1 -1
- package/dist/session/panel/shared/use-panel-handoffs.d.ts +2 -2
- package/dist/session/panel/shared/use-panel-handoffs.js +21 -2
- package/dist/session/participants/session-participants.d.ts +7 -5
- package/dist/session/participants/session-participants.js +11 -7
- package/dist/session/prompts/ask-deck.d.ts +21 -0
- package/dist/session/prompts/ask-deck.js +253 -0
- package/dist/session/prompts/session-permission-prompt.d.ts +7 -1
- package/dist/session/prompts/session-permission-prompt.js +3 -3
- package/dist/session/status/provisioning-failure.d.ts +4 -5
- package/dist/session/status/provisioning-failure.js +4 -5
- package/dist/session/status/session-load-state.d.ts +0 -1
- package/dist/session/status/session-load-state.js +2 -4
- package/dist/session/thread/message-parsing.d.ts +0 -1
- package/dist/session/thread/message-parsing.js +0 -1
- package/dist/session/thread/optimistic-turn.js +11 -2
- package/dist/session/thread/session-chat.d.ts +3 -1
- package/dist/session/thread/session-chat.js +498 -301
- package/dist/session/thread/session-context-metrics.d.ts +0 -1
- package/dist/session/thread/session-context-metrics.js +1 -1
- package/dist/session/thread/session-context-sub-sessions.js +3 -1
- package/dist/session/thread/show-work.d.ts +38 -0
- package/dist/session/thread/show-work.js +115 -0
- package/dist/session/thread/thread-boot-rows.d.ts +2 -1
- package/dist/session/thread/thread-boot-rows.js +7 -3
- package/dist/session/thread/transcript-rows.d.ts +36 -0
- package/dist/session/thread/transcript.d.ts +55 -2
- package/dist/session/thread/transcript.js +264 -33
- package/dist/session/thread/typing-indicator.d.ts +21 -0
- package/dist/session/thread/typing-indicator.js +46 -0
- package/dist/session/tool/shared/infrastructure-contexts.d.ts +12 -0
- package/dist/session/tool/shared/infrastructure-contexts.js +6 -0
- package/dist/session/tool/tool-part-renderer.d.ts +2 -0
- package/dist/session/tool/tool-part-renderer.js +16 -2
- package/dist/session/tool/tools/channel-send-card.js +1 -0
- package/dist/session/tool/tools/kortix-action-tool.js +8 -1
- package/dist/session/tool/tools/multi-agent-tool-bodies.d.ts +19 -0
- package/dist/session/tool/tools/multi-agent-tool-bodies.js +34 -13
- package/dist/session/tool/tools/session-spawn-urls.d.ts +1 -16
- package/dist/session/tool/tools/session-spawn-urls.js +4 -26
- package/dist/session/tool/tools/task-tool.d.ts +5 -18
- package/dist/session/tool/tools/task-tool.js +47 -86
- package/dist/session/tool/tools/workflow-progress.d.ts +14 -18
- package/dist/session/tool/tools/workflow-progress.js +24 -179
- package/dist/session/tool/tools/workflow-result-text.d.ts +15 -0
- package/dist/session/tool/tools/workflow-result-text.js +34 -0
- package/dist/session/tool/tools/workflow-run-card.d.ts +35 -0
- package/dist/session/tool/tools/workflow-run-card.js +157 -0
- package/dist/session/tool/tools/workflow-tool.js +45 -58
- package/dist/session/turn/activity-burst.d.ts +2 -2
- package/dist/session/turn/activity-burst.js +11 -5
- package/dist/session/turn/answered-question-step.d.ts +29 -0
- package/dist/session/turn/answered-question-step.js +48 -3
- package/dist/session/turn/channel-brand.js +4 -0
- package/dist/session/turn/message-author.d.ts +13 -8
- package/dist/session/turn/message-author.js +34 -16
- package/dist/session/turn/notice-batch-group.d.ts +4 -4
- package/dist/session/turn/notice-batch-group.js +5 -8
- package/dist/session/turn/peer-message-row.d.ts +15 -0
- package/dist/session/turn/peer-message-row.js +39 -30
- package/dist/session/turn/subagent-notice-row.d.ts +16 -1
- package/dist/session/turn/subagent-notice-row.js +47 -35
- package/dist/session/turn/throttled-markdown.js +4 -1
- package/dist/session/turn/turn-work-accordion.d.ts +10 -3
- package/dist/session/turn/turn-work-accordion.js +18 -11
- package/dist/session/turn/user-message.js +17 -43
- package/dist/session/turn/voice-turn.d.ts +22 -0
- package/dist/session/turn/voice-turn.js +32 -0
- package/dist/session/voice/call-audio.d.ts +32 -0
- package/dist/session/voice/call-audio.js +146 -0
- package/dist/session/voice/call-ring.d.ts +10 -0
- package/dist/session/voice/call-ring.js +52 -0
- package/dist/session/voice/screen-share.d.ts +24 -0
- package/dist/session/voice/screen-share.js +75 -0
- package/dist/session/voice/use-voice-call.d.ts +15 -0
- package/dist/session/voice/use-voice-call.js +217 -0
- package/dist/session/voice/voice-call-card.d.ts +6 -0
- package/dist/session/voice/voice-call-card.js +113 -0
- package/dist/session/voice/voice-call-state.d.ts +99 -0
- package/dist/session/voice/voice-call-state.js +104 -0
- package/dist/session/voice/voice-call-store.d.ts +22 -0
- package/dist/session/voice/voice-call-store.js +10 -0
- package/dist/session/voice/voice-call-url.d.ts +24 -0
- package/dist/session/voice/voice-call-url.js +33 -0
- package/dist/session/voice/voice-call.d.ts +11 -0
- package/dist/session/voice/voice-call.js +51 -0
- package/dist/styles/components.css +33 -0
- package/dist/styles/theme.css +26 -0
- package/dist/styles.css +1 -1
- package/dist/workspace/admin/project-admin-dashboard.d.ts +1 -1
- package/dist/workspace/admin/project-admin-dashboard.js +21 -13
- package/dist/workspace/index.d.ts +3 -2
- package/dist/workspace/index.js +2 -1
- package/dist/workspace/layout/project-home.js +13 -14
- package/dist/workspace/layout/use-project-home-send.d.ts +2 -0
- package/dist/workspace/layout/use-project-home-send.js +5 -3
- package/dist/workspace/memory/company-memory-page.d.ts +1 -1
- package/dist/workspace/memory/company-memory-page.js +1 -1
- package/dist/workspace/new/use-creatable-accounts.js +13 -4
- package/dist/workspace/projects/modal/project-icon-field.js +49 -34
- package/dist/workspace/review/review-center.d.ts +4 -1
- package/dist/workspace/review/review-center.js +6 -3
- package/dist/workspace/sessions/project-sessions-helpers.js +1 -1
- package/dist/workspace/sessions/project-sessions-view.js +1 -1
- package/dist/workspace/sessions/session-row.js +6 -4
- package/dist/workspace/sessions/sessions-toolbar.d.ts +1 -1
- package/dist/workspace/sessions/sessions-toolbar.js +4 -4
- package/dist/workspace/sidebar/footer/project-manifest-issues-alert.d.ts +1 -1
- package/dist/workspace/sidebar/footer/project-manifest-issues-alert.js +4 -3
- package/dist/workspace/sidebar/footer/project-memory-nav.d.ts +1 -1
- package/dist/workspace/sidebar/footer/project-memory-nav.js +1 -1
- package/dist/workspace/sidebar/project-nav-items.js +2 -5
- package/dist/workspace/sidebar/project-session-list.d.ts +7 -1
- package/dist/workspace/sidebar/project-session-list.js +64 -24
- package/dist/workspace/sidebar/project-sidebar.js +10 -7
- package/dist/workspace/sidebar/project-spaces-nav.d.ts +7 -3
- package/dist/workspace/sidebar/project-spaces-nav.js +77 -46
- package/dist/workspace/sidebar/session-brief-hover-card.d.ts +4 -2
- package/dist/workspace/sidebar/session-brief-hover-card.js +47 -28
- package/dist/workspace/sidebar/session-filter-menu.js +1 -0
- package/dist/workspace/sidebar/session-group-sections.js +12 -4
- package/dist/workspace/sidebar/session-grouping.d.ts +4 -0
- package/dist/workspace/sidebar/session-grouping.js +2 -0
- package/dist/workspace/sidebar/session-source-icons.js +2 -0
- package/dist/workspace/sidebar/sidebar-more-group.d.ts +13 -0
- package/dist/workspace/sidebar/sidebar-more-group.js +27 -0
- package/dist/workspace/space/space-blocks.d.ts +3 -1
- package/dist/workspace/space/space-blocks.js +4 -7
- package/dist/workspace/space/space-page.d.ts +4 -6
- package/dist/workspace/space/space-page.js +12 -26
- package/dist/workspace/space/space-tab-panels.d.ts +14 -1
- package/dist/workspace/space/space-tab-panels.js +12 -21
- package/dist/workspace/space/space-templates.d.ts +4 -5
- package/dist/workspace/space/space-templates.js +2 -7
- package/dist/workspace/space/use-space-filter.d.ts +1 -1
- package/dist/workspace/space/use-space-filter.js +1 -1
- package/dist/workspace/spaces/channels-onboarding.d.ts +2 -2
- package/dist/workspace/spaces/channels-onboarding.js +4 -3
- package/dist/workspace/spaces/create-channel-dialog.js +4 -2
- package/dist/workspace/spaces/principal-card.d.ts +71 -0
- package/dist/workspace/spaces/principal-card.js +246 -0
- package/dist/workspace/spaces/space-auto-open.d.ts +8 -0
- package/dist/workspace/spaces/space-auto-open.js +18 -0
- package/dist/workspace/spaces/space-avatar.d.ts +44 -0
- package/dist/workspace/spaces/space-avatar.js +41 -0
- package/dist/workspace/spaces/space-details-panel.d.ts +26 -0
- package/dist/workspace/spaces/space-details-panel.js +119 -0
- package/dist/workspace/spaces/space-identity.d.ts +49 -0
- package/dist/workspace/spaces/space-identity.js +104 -0
- package/dist/workspace/spaces/space-members.js +1 -1
- package/dist/workspace/spaces/space-mention-source.d.ts +12 -0
- package/dist/workspace/spaces/space-mention-source.js +78 -0
- package/dist/workspace/spaces/space-people.d.ts +29 -0
- package/dist/workspace/spaces/space-people.js +87 -0
- package/dist/workspace/spaces/space-roster.d.ts +3 -2
- package/dist/workspace/spaces/space-roster.js +7 -4
- package/dist/workspace/spaces/space-tab-list.d.ts +37 -0
- package/dist/workspace/spaces/space-tab-list.js +82 -0
- package/dist/workspace/spaces/space-tabs.d.ts +74 -0
- package/dist/workspace/spaces/space-tabs.js +199 -0
- package/dist/workspace/spaces/space-threads-tab.js +1 -1
- package/dist/workspace/spaces/space-timeline-view.js +126 -17
- package/dist/workspace/spaces/space-timeline.d.ts +44 -9
- package/dist/workspace/spaces/space-timeline.js +120 -12
- package/dist/workspace/spaces/space-view.d.ts +19 -12
- package/dist/workspace/spaces/space-view.js +201 -67
- package/dist/workspace/spaces/use-personal-space-name.d.ts +2 -0
- package/dist/workspace/spaces/use-personal-space-name.js +10 -0
- package/package.json +17 -13
- package/skills/kortix-ui/SKILL.md +3 -3
- package/skills/kortix-ui/references/custom-dashboard.md +3 -4
- package/skills/kortix-ui/references/modules.md +4 -4
- package/dist/_vendor/shared/room-prompt.d.ts +0 -66
- package/dist/customize/agents/agent-section-rail.d.ts +0 -21
- package/dist/customize/agents/agent-section-rail.js +0 -23
- package/dist/internal/hooks/projects/use-warm-project-session.d.ts +0 -270
- package/dist/internal/hooks/projects/use-warm-project-session.js +0 -362
- package/dist/internal/hooks/projects/warm-session-seed.d.ts +0 -66
- package/dist/internal/hooks/projects/warm-session-seed.js +0 -80
- package/dist/internal/hooks/projects/warm-session-taken-registry.d.ts +0 -61
- package/dist/internal/hooks/projects/warm-session-taken-registry.js +0 -141
- package/dist/workspace/sidebar/footer/project-rooms-nav.d.ts +0 -9
- package/dist/workspace/sidebar/footer/project-rooms-nav.js +0 -32
- package/dist/workspace/sidebar/session-status-mark.d.ts +0 -19
- package/dist/workspace/space/space-room.d.ts +0 -20
- package/dist/workspace/space/space-room.js +0 -27
- /package/dist/{workspace/sidebar → session/list}/session-list-chrome.d.ts +0 -0
- /package/dist/{workspace/sidebar → session/list}/session-list-chrome.js +0 -0
|
@@ -0,0 +1,578 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { isMyKortixAgentName } from '../../../_vendor/kortix-shared.js';
|
|
4
|
+
import { CaretDownIcon, CaretRightIcon, CpuIcon, MagnifyingGlassIcon, PlugsConnectedIcon, } from '@phosphor-icons/react';
|
|
5
|
+
import { useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, } from 'react';
|
|
6
|
+
import { useTranslations } from '../../../i18n/index.js';
|
|
7
|
+
import { AgentMark } from '../../../internal/components/agent-mark.js';
|
|
8
|
+
import { cn } from '../../../lib/utils.js';
|
|
9
|
+
import { Button } from '../../../primitives/button.js';
|
|
10
|
+
import { InputGroupSearch, InputGroupSearchIcon, InputGroupSearchInput, } from '../../../primitives/input-group.js';
|
|
11
|
+
import Loading from '../../../primitives/loading.js';
|
|
12
|
+
import { Popover, PopoverContent, PopoverTrigger } from '../../../primitives/popover.js';
|
|
13
|
+
import { ModelSelector } from '../../models/model-selector.js';
|
|
14
|
+
import { AgentSelector, resolveDisplayedAgentName, useComposerAgentChoices, } from '../agent-selector.js';
|
|
15
|
+
import { EffortIcon, effortLabel, reasoningEffortChoices } from '../reasoning-effort-selector.js';
|
|
16
|
+
import { useChatInputOverrides } from './chat-input-overrides.js';
|
|
17
|
+
import { ChoiceRow, ConnectorsPane, OPTION_ATTR, ProviderKeysPane, SecretsPane, connectorsChanged, providerKeysInEffect, secretsInEffect, } from './chat-input-panes.js';
|
|
18
|
+
import { chatInputAgents, chatInputTriggerParts, modelIsOverridden, sameModel, } from './chat-input-summary.js';
|
|
19
|
+
/** Same threshold as `AgentSelector`: past six agents scanning turns into scrolling. */
|
|
20
|
+
const SEARCH_MIN_AGENTS = 7;
|
|
21
|
+
/** The effort list's value for "no override: the agent's default". */
|
|
22
|
+
const AUTO_EFFORT = 'auto';
|
|
23
|
+
/**
|
|
24
|
+
* How long the pointer rests on a row before the right pane follows it. A
|
|
25
|
+
* diagonal move from a row to the pane crosses other rows; without the rest
|
|
26
|
+
* each of them would swap the pane under the cursor.
|
|
27
|
+
*/
|
|
28
|
+
const HOVER_REST_MS = 90;
|
|
29
|
+
/** Between the panel's bottom edge and the composer card's top edge, in px. */
|
|
30
|
+
const PANEL_GAP = 6;
|
|
31
|
+
/** The panel's width: room for the list and a pane, not the whole composer. */
|
|
32
|
+
const PANEL_WIDTH = 'w-[min(37rem,calc(100vw-1.5rem))]';
|
|
33
|
+
/** The left list's "More" row: it opens the extras and has no pane of its own. */
|
|
34
|
+
const MORE_ROW = '__more';
|
|
35
|
+
/** The extra rows, in the order the list shows them. */
|
|
36
|
+
const EXTRA_ORDER = ['connectors', 'secrets', 'provider-keys', 'sandbox'];
|
|
37
|
+
/** An open dialog that is not this panel: the Models dialog, an accounts modal. */
|
|
38
|
+
function foreignDialogOpen(panel) {
|
|
39
|
+
for (const dialog of document.querySelectorAll('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')) {
|
|
40
|
+
if (!panel || (dialog !== panel && !panel.contains(dialog) && !dialog.contains(panel)))
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The composer card this control belongs to, found from its trigger: the
|
|
47
|
+
* nearest bordered ancestor of the composer's editor. The trigger sits under
|
|
48
|
+
* the card (`ComposerUnderbar` row) or inside it (the inline toolbar), so the
|
|
49
|
+
* walk goes up from the trigger until a subtree holds the editor.
|
|
50
|
+
*/
|
|
51
|
+
function findComposerCard(from) {
|
|
52
|
+
let scope = from;
|
|
53
|
+
let editor = null;
|
|
54
|
+
while (scope && !editor) {
|
|
55
|
+
editor = scope.querySelector('.ProseMirror');
|
|
56
|
+
scope = scope.parentElement;
|
|
57
|
+
}
|
|
58
|
+
for (let node = editor?.parentElement ?? null; node; node = node.parentElement) {
|
|
59
|
+
const style = getComputedStyle(node);
|
|
60
|
+
if (parseFloat(style.borderBottomWidth) > 0 && parseFloat(style.borderBottomLeftRadius) > 0)
|
|
61
|
+
return node;
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
function isTextField(element) {
|
|
66
|
+
return element.tagName === 'INPUT' || element.tagName === 'TEXTAREA' || element.isContentEditable;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The `chat_input` flag's composer control: the agent, its model and its
|
|
70
|
+
* effort behind one trigger, and every other session override one step away.
|
|
71
|
+
*
|
|
72
|
+
* Closed, it names the agent and the model ("My Kortix · GLM 5.3 Flash"),
|
|
73
|
+
* plus the effort when it is overridden and a count of the other overrides
|
|
74
|
+
* (`chatInputTriggerParts`).
|
|
75
|
+
*
|
|
76
|
+
* Open, it is one panel that grows out of the top of the composer card: the
|
|
77
|
+
* card's width, the card's surface and corners. Two panes, the shape of the
|
|
78
|
+
* session-overrides gear it replaces:
|
|
79
|
+
*
|
|
80
|
+
* - left, the settings: Agent (none when the agent is fixed: a DM), Model,
|
|
81
|
+
* Effort, then under one hairline the quiet ones (secrets, provider keys,
|
|
82
|
+
* sandbox, files). Each names its current value; a value someone chose
|
|
83
|
+
* reads in foreground, a default stays muted.
|
|
84
|
+
* - right, the highlighted setting: its name, one sentence, a Reset when
|
|
85
|
+
* it is overridden, and its editor. The agents and efforts are radio
|
|
86
|
+
* lists, the model is the model picker's own list in place.
|
|
87
|
+
*
|
|
88
|
+
* Hover (after a short rest) or the arrow keys move the highlight. Right,
|
|
89
|
+
* Enter or Tab go into the pane; Left or Esc come back; Esc on the list
|
|
90
|
+
* closes, and focus returns to the composer.
|
|
91
|
+
*
|
|
92
|
+
* It owns no setting. Agent, model and effort write through the composer's
|
|
93
|
+
* own handlers (the same ones the three pickers call with the flag off);
|
|
94
|
+
* secrets, provider keys and the sandbox are the rows `SessionOverridesToolbar`
|
|
95
|
+
* publishes, with its drafts and its Save. Picking another agent therefore
|
|
96
|
+
* resets what that agent does not allow exactly as before.
|
|
97
|
+
*/
|
|
98
|
+
export function ChatInputControl({ agents, selectedAgent, onAgentChange, agentLocked = false, unavailableHint, open: openProp, onOpenChange, initialRow = null, triggerLabelClassName, showModel, models, modelsLoading, selectedModel, inheritedModel, onModelChange, providers, modelDefaultControls, projectId, variants, selectedVariant, onVariantChange, }) {
|
|
99
|
+
const t = useTranslations('threads');
|
|
100
|
+
const tHardcodedUi = useTranslations('hardcodedUi');
|
|
101
|
+
const tPooled = useTranslations('pooledSecrets');
|
|
102
|
+
const overrides = useChatInputOverrides();
|
|
103
|
+
const { primaryAgents, label } = useComposerAgentChoices(agents);
|
|
104
|
+
const baseId = useId();
|
|
105
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState(false);
|
|
106
|
+
const open = openProp ?? uncontrolledOpen;
|
|
107
|
+
const saving = overrides?.saving ?? false;
|
|
108
|
+
const setOpen = useCallback((next) => {
|
|
109
|
+
// A save in flight holds the panel open: closing would hide its result.
|
|
110
|
+
if (!next && saving)
|
|
111
|
+
return;
|
|
112
|
+
if (openProp === undefined)
|
|
113
|
+
setUncontrolledOpen(next);
|
|
114
|
+
onOpenChange?.(next);
|
|
115
|
+
}, [onOpenChange, openProp, saving]);
|
|
116
|
+
// A fixed agent (a DM): name it and offer no other.
|
|
117
|
+
const agentFixed = agentLocked;
|
|
118
|
+
const agentChoice = chatInputAgents(primaryAgents.map((agent) => agent.name), agentFixed ? selectedAgent : (resolveDisplayedAgentName(primaryAgents, selectedAgent) ?? null), agentFixed, isMyKortixAgentName);
|
|
119
|
+
const displayedName = agentChoice.name ?? undefined;
|
|
120
|
+
const agentLabel = displayedName ? label(displayedName) : t('chatInputAgent');
|
|
121
|
+
const effortChoices = useMemo(() => reasoningEffortChoices(variants, !!onVariantChange), [variants, onVariantChange]);
|
|
122
|
+
const currentEffort = selectedVariant && effortChoices.includes(selectedVariant) ? selectedVariant : null;
|
|
123
|
+
const currentModel = models.find((model) => sameModel(model, selectedModel));
|
|
124
|
+
const modelShown = showModel && !!onModelChange;
|
|
125
|
+
const modelOverridden = modelShown && modelIsOverridden(selectedModel, inheritedModel);
|
|
126
|
+
const inheritedOffered = !!inheritedModel && models.some((model) => sameModel(model, inheritedModel));
|
|
127
|
+
const modelName = currentModel?.modelName ?? selectedModel?.modelID ?? null;
|
|
128
|
+
const resetModel = modelOverridden && inheritedOffered && inheritedModel && onModelChange
|
|
129
|
+
? () => onModelChange(inheritedModel)
|
|
130
|
+
: undefined;
|
|
131
|
+
const effortShown = effortChoices.length > 0 && !!onVariantChange;
|
|
132
|
+
const showAgents = !agentFixed;
|
|
133
|
+
const extraRows = overrides?.rows;
|
|
134
|
+
const extrasOverridden = (extraRows ?? []).filter((row) => row.overridden === true).length;
|
|
135
|
+
const parts = chatInputTriggerParts({
|
|
136
|
+
model: modelShown ? modelName : null,
|
|
137
|
+
effort: currentEffort ? effortLabel(currentEffort) : null,
|
|
138
|
+
extras: extrasOverridden,
|
|
139
|
+
});
|
|
140
|
+
// The count reads as a bare number on the trigger; its accessible name spells it out.
|
|
141
|
+
const spokenParts = parts.map((part, i) => i === parts.length - 1 && extrasOverridden > 0
|
|
142
|
+
? t('chatInputOverrideCount', { count: extrasOverridden })
|
|
143
|
+
: part);
|
|
144
|
+
const items = [];
|
|
145
|
+
if (showAgents) {
|
|
146
|
+
items.push({
|
|
147
|
+
id: 'agent',
|
|
148
|
+
name: t('chatInputAgent'),
|
|
149
|
+
icon: _jsx(AgentMark, { slug: displayedName ?? agentLabel }),
|
|
150
|
+
value: agentLabel,
|
|
151
|
+
overridden: false,
|
|
152
|
+
description: t('chatInputAgentDescription'),
|
|
153
|
+
extra: false,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
if (modelShown) {
|
|
157
|
+
items.push({
|
|
158
|
+
id: 'model',
|
|
159
|
+
name: t('chatInputModel'),
|
|
160
|
+
icon: _jsx(CpuIcon, { className: "size-4" }),
|
|
161
|
+
value: modelName ?? t('noModel'),
|
|
162
|
+
overridden: modelOverridden,
|
|
163
|
+
description: t('chatInputModelDescription'),
|
|
164
|
+
onReset: resetModel,
|
|
165
|
+
extra: false,
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
if (effortShown && onVariantChange) {
|
|
169
|
+
items.push({
|
|
170
|
+
id: 'effort',
|
|
171
|
+
name: t('chatInputEffort'),
|
|
172
|
+
icon: _jsx(EffortIcon, { value: currentEffort, className: "size-4" }),
|
|
173
|
+
value: currentEffort ? effortLabel(currentEffort) : t('auto'),
|
|
174
|
+
overridden: !!currentEffort,
|
|
175
|
+
description: t('chatInputEffortDescription'),
|
|
176
|
+
onReset: currentEffort ? () => onVariantChange(null) : undefined,
|
|
177
|
+
extra: false,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
const scopeData = overrides?.scope;
|
|
181
|
+
const keyData = overrides?.providerKeys;
|
|
182
|
+
const agentDefault = t('chatInputAgentDefault');
|
|
183
|
+
const sortedExtras = [...(extraRows ?? [])].sort((left, right) => EXTRA_ORDER.indexOf(left.id) - EXTRA_ORDER.indexOf(right.id));
|
|
184
|
+
for (const row of sortedExtras) {
|
|
185
|
+
const overridden = row.overridden === true;
|
|
186
|
+
const RowIcon = row.icon;
|
|
187
|
+
const item = {
|
|
188
|
+
id: row.id,
|
|
189
|
+
name: row.name,
|
|
190
|
+
icon: _jsx(RowIcon, { className: "size-4" }),
|
|
191
|
+
value: overridden ? row.summary : agentDefault,
|
|
192
|
+
overridden,
|
|
193
|
+
description: row.description,
|
|
194
|
+
onReset: overridden && overrides ? () => overrides.onResetRow(row.id) : undefined,
|
|
195
|
+
extra: true,
|
|
196
|
+
};
|
|
197
|
+
// Each row says what the prompt will carry, in the same words.
|
|
198
|
+
if (row.id === 'connectors') {
|
|
199
|
+
const changed = scopeData ? connectorsChanged(scopeData) : null;
|
|
200
|
+
item.name = t('chatInputConnectors');
|
|
201
|
+
item.icon = _jsx(PlugsConnectedIcon, { className: "size-4" });
|
|
202
|
+
item.value = changed === null ? agentDefault : t('chatInputAppCount', { count: changed });
|
|
203
|
+
item.description = t('chatInputConnectorsDescription');
|
|
204
|
+
}
|
|
205
|
+
else if (row.id === 'secrets') {
|
|
206
|
+
// No secret to send or to hold back: nothing to change here.
|
|
207
|
+
if (!overridden &&
|
|
208
|
+
scopeData?.catalog.secrets.status === 'ready' &&
|
|
209
|
+
scopeData.catalog.secrets.items.length === 0)
|
|
210
|
+
continue;
|
|
211
|
+
const count = scopeData ? secretsInEffect(scopeData) : null;
|
|
212
|
+
item.name = t('chatInputSecrets');
|
|
213
|
+
item.value = !overridden
|
|
214
|
+
? count === null || count === 0
|
|
215
|
+
? agentDefault
|
|
216
|
+
: `${agentDefault} · ${count}`
|
|
217
|
+
: t('chatInputSecretCount', { count: count ?? 0 });
|
|
218
|
+
item.description = t('chatInputSecretsDescription');
|
|
219
|
+
}
|
|
220
|
+
else if (row.id === 'provider-keys') {
|
|
221
|
+
const count = keyData ? providerKeysInEffect(keyData) : 0;
|
|
222
|
+
item.overridden = count > 0;
|
|
223
|
+
item.value = count > 0 ? t('chatInputKeyCount', { count }) : agentDefault;
|
|
224
|
+
item.description = t('chatInputProviderKeysDescription');
|
|
225
|
+
}
|
|
226
|
+
else if (row.id === 'sandbox') {
|
|
227
|
+
item.name = t('chatInputMachine');
|
|
228
|
+
item.description = t('chatInputMachineDescription');
|
|
229
|
+
}
|
|
230
|
+
items.push(item);
|
|
231
|
+
}
|
|
232
|
+
// The highlighted row. Each open starts on the row the `/` palette asked
|
|
233
|
+
// for, else the first. Adjusted during render (React's "storing information
|
|
234
|
+
// from previous renders"), not in an effect, so the first open frame
|
|
235
|
+
// already shows it.
|
|
236
|
+
const [activeId, setActiveId] = useState(null);
|
|
237
|
+
const [search, setSearch] = useState('');
|
|
238
|
+
// The extras (connectors, secrets, provider keys, machine) sit behind one
|
|
239
|
+
// "More" row; each open starts with it closed, unless the `/` palette asked
|
|
240
|
+
// for one of them.
|
|
241
|
+
const [moreOpen, setMoreOpen] = useState(false);
|
|
242
|
+
const [seen, setSeen] = useState({ open, initialRow });
|
|
243
|
+
if (seen.open !== open || seen.initialRow !== initialRow) {
|
|
244
|
+
setSeen({ open, initialRow });
|
|
245
|
+
if (open) {
|
|
246
|
+
setActiveId(initialRow);
|
|
247
|
+
setMoreOpen(items.some((item) => item.extra && item.id === initialRow));
|
|
248
|
+
}
|
|
249
|
+
else
|
|
250
|
+
setSearch('');
|
|
251
|
+
}
|
|
252
|
+
const mainItems = items.filter((item) => !item.extra);
|
|
253
|
+
const extraItems = items.filter((item) => item.extra);
|
|
254
|
+
const extrasChanged = extraItems.filter((item) => item.overridden).length;
|
|
255
|
+
// What the left list shows, in order; `MORE_ROW` is the disclosure itself.
|
|
256
|
+
const listIds = [
|
|
257
|
+
...mainItems.map((item) => item.id),
|
|
258
|
+
...(extraItems.length > 0 ? [MORE_ROW] : []),
|
|
259
|
+
...(moreOpen ? extraItems.map((item) => item.id) : []),
|
|
260
|
+
];
|
|
261
|
+
const visible = items.filter((item) => listIds.includes(item.id));
|
|
262
|
+
const active = visible.find((item) => item.id === activeId) ?? visible[0];
|
|
263
|
+
const triggerRef = useRef(null);
|
|
264
|
+
const listRef = useRef(null);
|
|
265
|
+
const paneRef = useRef(null);
|
|
266
|
+
const hoverTimer = useRef(null);
|
|
267
|
+
useEffect(() => () => {
|
|
268
|
+
if (hoverTimer.current)
|
|
269
|
+
clearTimeout(hoverTimer.current);
|
|
270
|
+
}, []);
|
|
271
|
+
/*
|
|
272
|
+
The panel opens from the composer card, not from the trigger: its left
|
|
273
|
+
edge is the card's left edge and its bottom edge sits just above the
|
|
274
|
+
card's top (or the top of the strip stacked on it: the queue, a notice).
|
|
275
|
+
Radix still anchors to the trigger; the offsets below move the panel from
|
|
276
|
+
the trigger to the card. Measured on open and on resize. A composer
|
|
277
|
+
without a card (none found) keeps the trigger's position.
|
|
278
|
+
*/
|
|
279
|
+
const [placement, setPlacement] = useState(null);
|
|
280
|
+
useLayoutEffect(() => {
|
|
281
|
+
if (!open)
|
|
282
|
+
return;
|
|
283
|
+
let frame = 0;
|
|
284
|
+
let tries = 0;
|
|
285
|
+
let observer = null;
|
|
286
|
+
const measure = () => {
|
|
287
|
+
const trigger = triggerRef.current;
|
|
288
|
+
const card = findComposerCard(trigger);
|
|
289
|
+
if (!trigger || !card) {
|
|
290
|
+
// The editor can mount a frame after the panel opens (a cold
|
|
291
|
+
// composer). Look again for a few frames before keeping the fallback.
|
|
292
|
+
if (tries++ < 20)
|
|
293
|
+
frame = requestAnimationFrame(measure);
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
if (!observer && typeof ResizeObserver !== 'undefined') {
|
|
297
|
+
observer = new ResizeObserver(() => measure());
|
|
298
|
+
observer.observe(card);
|
|
299
|
+
}
|
|
300
|
+
const triggerBox = trigger.getBoundingClientRect();
|
|
301
|
+
const box = card.getBoundingClientRect();
|
|
302
|
+
const stack = card.previousElementSibling;
|
|
303
|
+
const top = stack instanceof HTMLElement && stack.hasAttribute('data-composer-stack')
|
|
304
|
+
? Math.min(stack.getBoundingClientRect().top, box.top)
|
|
305
|
+
: box.top;
|
|
306
|
+
const next = {
|
|
307
|
+
sideOffset: Math.round(triggerBox.top - top) + PANEL_GAP,
|
|
308
|
+
alignOffset: Math.round(box.left - triggerBox.left),
|
|
309
|
+
};
|
|
310
|
+
setPlacement((current) => current &&
|
|
311
|
+
current.sideOffset === next.sideOffset &&
|
|
312
|
+
current.alignOffset === next.alignOffset
|
|
313
|
+
? current
|
|
314
|
+
: next);
|
|
315
|
+
};
|
|
316
|
+
measure();
|
|
317
|
+
window.addEventListener('resize', measure);
|
|
318
|
+
return () => {
|
|
319
|
+
cancelAnimationFrame(frame);
|
|
320
|
+
observer?.disconnect();
|
|
321
|
+
window.removeEventListener('resize', measure);
|
|
322
|
+
setPlacement(null);
|
|
323
|
+
};
|
|
324
|
+
}, [open]);
|
|
325
|
+
/*
|
|
326
|
+
A dialog opened from inside the panel (the Models dialog behind "+", a
|
|
327
|
+
ChatGPT accounts modal, a model-connection gate) must sit above it. The
|
|
328
|
+
panel stays mounted, so a dialog it owns keeps its state, but it hides
|
|
329
|
+
and ignores outside clicks until no other dialog is open. When the dialog
|
|
330
|
+
closes the panel shows again where it was.
|
|
331
|
+
*/
|
|
332
|
+
const contentRef = useRef(null);
|
|
333
|
+
const [suspended, setSuspended] = useState(false);
|
|
334
|
+
useEffect(() => {
|
|
335
|
+
if (!open)
|
|
336
|
+
return;
|
|
337
|
+
const check = () => setSuspended(foreignDialogOpen(contentRef.current));
|
|
338
|
+
check();
|
|
339
|
+
const observer = new MutationObserver(check);
|
|
340
|
+
observer.observe(document.body, {
|
|
341
|
+
childList: true,
|
|
342
|
+
subtree: true,
|
|
343
|
+
attributes: true,
|
|
344
|
+
attributeFilter: ['data-state'],
|
|
345
|
+
});
|
|
346
|
+
return () => {
|
|
347
|
+
observer.disconnect();
|
|
348
|
+
setSuspended(false);
|
|
349
|
+
};
|
|
350
|
+
}, [open]);
|
|
351
|
+
const focusTab = (id) => {
|
|
352
|
+
if (!id)
|
|
353
|
+
return;
|
|
354
|
+
listRef.current?.querySelector(`[data-row-id="${CSS.escape(id)}"]`)?.focus();
|
|
355
|
+
};
|
|
356
|
+
/** Into the right pane: its checked option, else its first control. */
|
|
357
|
+
const focusPane = () => {
|
|
358
|
+
const pane = paneRef.current;
|
|
359
|
+
if (!pane)
|
|
360
|
+
return;
|
|
361
|
+
const target = pane.querySelector(`[${OPTION_ATTR}][aria-checked="true"]`) ??
|
|
362
|
+
pane.querySelector('input:not([disabled]), [cmdk-input]') ??
|
|
363
|
+
pane.querySelector(`[${OPTION_ATTR}], button:not([disabled]), [href], select, textarea, [tabindex]:not([tabindex="-1"])`);
|
|
364
|
+
target?.focus();
|
|
365
|
+
};
|
|
366
|
+
const select = (id) => {
|
|
367
|
+
if (hoverTimer.current)
|
|
368
|
+
clearTimeout(hoverTimer.current);
|
|
369
|
+
setActiveId(id);
|
|
370
|
+
};
|
|
371
|
+
/** Opening "More" highlights its first row; closing it while one is highlighted goes back to the first row. */
|
|
372
|
+
const toggleMore = (next = !moreOpen) => {
|
|
373
|
+
setMoreOpen(next);
|
|
374
|
+
if (next && extraItems[0]) {
|
|
375
|
+
select(extraItems[0].id);
|
|
376
|
+
requestAnimationFrame(() => focusTab(extraItems[0].id));
|
|
377
|
+
}
|
|
378
|
+
else if (!next && active?.extra) {
|
|
379
|
+
select(mainItems[0]?.id ?? MORE_ROW);
|
|
380
|
+
requestAnimationFrame(() => focusTab(MORE_ROW));
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
const onPanelKeyDown = (event) => {
|
|
384
|
+
const target = event.target;
|
|
385
|
+
const rowId = target.dataset.rowId;
|
|
386
|
+
if (rowId !== undefined) {
|
|
387
|
+
// The left list: up and down walk the rows, right and Enter go into the pane.
|
|
388
|
+
const ids = listIds;
|
|
389
|
+
const index = ids.indexOf(rowId);
|
|
390
|
+
let next = null;
|
|
391
|
+
if (event.key === 'ArrowDown')
|
|
392
|
+
next = (index + 1) % ids.length;
|
|
393
|
+
else if (event.key === 'ArrowUp')
|
|
394
|
+
next = (index <= 0 ? ids.length : index) - 1;
|
|
395
|
+
else if (event.key === 'Home')
|
|
396
|
+
next = 0;
|
|
397
|
+
else if (event.key === 'End')
|
|
398
|
+
next = ids.length - 1;
|
|
399
|
+
if (next !== null) {
|
|
400
|
+
event.preventDefault();
|
|
401
|
+
// "More" takes focus but keeps the pane on the row before it.
|
|
402
|
+
if (ids[next] !== MORE_ROW)
|
|
403
|
+
select(ids[next]);
|
|
404
|
+
focusTab(ids[next]);
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
if (rowId === MORE_ROW) {
|
|
408
|
+
if (event.key === 'ArrowRight' || event.key === 'Enter' || event.key === ' ') {
|
|
409
|
+
event.preventDefault();
|
|
410
|
+
toggleMore(true);
|
|
411
|
+
}
|
|
412
|
+
else if (event.key === 'ArrowLeft' && moreOpen) {
|
|
413
|
+
event.preventDefault();
|
|
414
|
+
toggleMore(false);
|
|
415
|
+
}
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
if (event.key === 'ArrowRight' || event.key === 'Enter') {
|
|
419
|
+
event.preventDefault();
|
|
420
|
+
select(rowId);
|
|
421
|
+
// The pane renders the row's editor on this commit; focus it on the next frame.
|
|
422
|
+
requestAnimationFrame(focusPane);
|
|
423
|
+
}
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
if (!paneRef.current?.contains(target))
|
|
427
|
+
return;
|
|
428
|
+
// Left leaves the pane, except where it moves a caret through typed text.
|
|
429
|
+
if (event.key === 'ArrowLeft' &&
|
|
430
|
+
(!isTextField(target) || target.value === '')) {
|
|
431
|
+
event.preventDefault();
|
|
432
|
+
focusTab(active?.id);
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
// The agent search hands Down to the first agent.
|
|
436
|
+
if (event.key === 'ArrowDown' && target.dataset.chatInputSearch !== undefined) {
|
|
437
|
+
event.preventDefault();
|
|
438
|
+
paneRef.current.querySelector(`[${OPTION_ATTR}]`)?.focus();
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
// A radio list (agents, efforts): up and down walk its options.
|
|
442
|
+
if (target.hasAttribute(OPTION_ATTR) &&
|
|
443
|
+
['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(event.key)) {
|
|
444
|
+
const options = Array.from(target
|
|
445
|
+
.closest('[role="radiogroup"]')
|
|
446
|
+
?.querySelectorAll(`[${OPTION_ATTR}]:not([disabled])`) ?? []);
|
|
447
|
+
const index = options.indexOf(target);
|
|
448
|
+
const next = event.key === 'Home'
|
|
449
|
+
? 0
|
|
450
|
+
: event.key === 'End'
|
|
451
|
+
? options.length - 1
|
|
452
|
+
: event.key === 'ArrowDown'
|
|
453
|
+
? Math.min(index + 1, options.length - 1)
|
|
454
|
+
: index - 1;
|
|
455
|
+
event.preventDefault();
|
|
456
|
+
if (next < 0) {
|
|
457
|
+
paneRef.current.querySelector('[data-chat-input-search]')?.focus();
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
options[next]?.focus();
|
|
461
|
+
}
|
|
462
|
+
};
|
|
463
|
+
const offeredKey = agentChoice.offered.join('\n');
|
|
464
|
+
const filteredAgents = useMemo(() => {
|
|
465
|
+
const query = search.toLowerCase().trim();
|
|
466
|
+
// `chatInputAgents` orders them (My Kortix first) and offers none for a fixed agent.
|
|
467
|
+
const offered = offeredKey ? offeredKey.split('\n') : [];
|
|
468
|
+
const list = offered.flatMap((name) => primaryAgents.filter((agent) => agent.name === name));
|
|
469
|
+
return query
|
|
470
|
+
? list.filter((agent) => agent.name.toLowerCase().includes(query) ||
|
|
471
|
+
label(agent.name).toLowerCase().includes(query) ||
|
|
472
|
+
(agent.description ?? '').toLowerCase().includes(query))
|
|
473
|
+
: list;
|
|
474
|
+
}, [label, offeredKey, primaryAgents, search]);
|
|
475
|
+
/*
|
|
476
|
+
Nothing to pick: the agent picker's own inert trigger, with its reason.
|
|
477
|
+
Model and effort have no agent to inherit from and the send is refused
|
|
478
|
+
(see `composer-agent-access.ts`), so there is nothing else to show.
|
|
479
|
+
*/
|
|
480
|
+
if (primaryAgents.length === 0 && !(agentFixed && displayedName)) {
|
|
481
|
+
return (_jsx(AgentSelector, { agents: primaryAgents, selectedAgent: selectedAgent, onSelect: onAgentChange ?? (() => { }), triggerLabelClassName: triggerLabelClassName, unavailableHint: unavailableHint }));
|
|
482
|
+
}
|
|
483
|
+
const activeExtra = active?.extra ? extraRows?.find((row) => row.id === active.id) : undefined;
|
|
484
|
+
// The Save footer shows only while there is something to save, whichever row is highlighted.
|
|
485
|
+
const showSave = !!overrides && overrides.dirty;
|
|
486
|
+
const saveAndClose = async () => {
|
|
487
|
+
if (!overrides)
|
|
488
|
+
return;
|
|
489
|
+
const saved = await overrides.onSave();
|
|
490
|
+
if (saved)
|
|
491
|
+
setOpen(false);
|
|
492
|
+
};
|
|
493
|
+
let editor = null;
|
|
494
|
+
if (active?.id === 'agent') {
|
|
495
|
+
editor = (_jsxs(_Fragment, { children: [primaryAgents.length >= SEARCH_MIN_AGENTS ? (_jsxs(InputGroupSearch, { className: "pb-1", children: [_jsx(InputGroupSearchIcon, { children: _jsx(MagnifyingGlassIcon, {}) }), _jsx(InputGroupSearchInput, { size: "sm", "data-chat-input-search": "", value: search, onChange: (event) => setSearch(event.target.value), placeholder: tHardcodedUi.raw('componentsSessionSessionChatInput.line231JsxAttrPlaceholderSearchAgents') })] })) : null, _jsxs("div", { role: "radiogroup", "aria-label": t('chatInputAgent'), className: "flex flex-col gap-px", children: [filteredAgents.map((agent) => (_jsx(ChoiceRow, { checked: agent.name === displayedName, onSelect: () => onAgentChange?.(agent.name), icon: _jsx(AgentMark, { slug: agent.name, size: 21, tile: 28 }), label: label(agent.name), description: isMyKortixAgentName(agent.name) ? t('myKortixRoutes') : agent.description }, agent.name))), filteredAgents.length === 0 ? (_jsxs("p", { className: "text-muted-foreground px-2 py-3 text-xs", children: [tHardcodedUi.raw('componentsSessionSessionChatInput.line273JsxTextNoAgentsMatchLdquo'), search.trim(), tHardcodedUi.raw('componentsSessionSessionChatInput.line273JsxTextRdquo')] })) : null] })] }));
|
|
496
|
+
}
|
|
497
|
+
else if (active?.id === 'effort' && onVariantChange) {
|
|
498
|
+
editor = (_jsx("div", { role: "radiogroup", "aria-label": t('chatInputEffort'), className: "flex flex-col gap-px", children: [AUTO_EFFORT, ...effortChoices].map((value) => (_jsx(ChoiceRow, { checked: (currentEffort ?? AUTO_EFFORT) === value, disabled: saving, onSelect: () => onVariantChange(value === AUTO_EFFORT ? null : value), icon: _jsx(EffortIcon, { value: value, className: "text-foreground size-4" }), label: value === AUTO_EFFORT ? t('auto') : effortLabel(value) }, value))) }));
|
|
499
|
+
}
|
|
500
|
+
else if (active?.id === 'secrets' && scopeData) {
|
|
501
|
+
editor = _jsx(SecretsPane, { scope: scopeData });
|
|
502
|
+
}
|
|
503
|
+
else if (active?.id === 'connectors' && scopeData) {
|
|
504
|
+
editor = _jsx(ConnectorsPane, { scope: scopeData });
|
|
505
|
+
}
|
|
506
|
+
else if (active?.id === 'provider-keys' && keyData) {
|
|
507
|
+
editor = _jsx(ProviderKeysPane, { providerKeys: keyData });
|
|
508
|
+
}
|
|
509
|
+
else if (activeExtra) {
|
|
510
|
+
editor = _jsx("div", { className: "px-2", children: activeExtra.editor });
|
|
511
|
+
}
|
|
512
|
+
const notice = overrides?.notice && activeExtra && overrides.saveRowIds.includes(activeExtra.id) ? (_jsx("div", { className: "px-2 pt-2", children: overrides.notice })) : null;
|
|
513
|
+
const tabId = (id) => `${baseId}-tab-${id}`;
|
|
514
|
+
const paneId = `${baseId}-pane`;
|
|
515
|
+
const modelPane = active?.id === 'model' && !!onModelChange;
|
|
516
|
+
return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { ref: triggerRef, type: "button", variant: "ghost", size: "sm", "aria-label": [`${t('chatInput')}: ${agentLabel}`, ...spokenParts].join(' · '), className: "text-muted-foreground data-[state=open]:text-foreground hit-area-y-3 min-w-0 rounded-lg", children: [_jsx(AgentMark, { slug: displayedName ?? agentLabel }), _jsx("span", { className: cn('max-w-[7rem] truncate', triggerLabelClassName), children: agentLabel }), parts.map((part, i) => (_jsxs("span", { className: "contents", children: [_jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsx("span", { className: cn('min-w-0 truncate', i === 0 && modelShown ? 'max-w-[10rem]' : 'shrink-0'), children: part })] }, i))), _jsx(CaretDownIcon, { className: cn('duration-moderate size-3 shrink-0 transition-transform ease-out', open && 'rotate-180') })] }) }), _jsx(PopoverContent, { ref: contentRef, ...(suspended ? { 'data-state': 'suspended' } : {}), "aria-label": t('chatInput'), side: "top", align: "start", sideOffset: placement?.sideOffset ?? PANEL_GAP, alignOffset: placement?.alignOffset ?? 0, collisionPadding: 12,
|
|
517
|
+
// The composer card's surface and corners: the panel reads as the
|
|
518
|
+
// composer grown upward, not as a menu beside it.
|
|
519
|
+
className: cn('bg-background overflow-hidden rounded-xl p-0', PANEL_WIDTH,
|
|
520
|
+
// A dialog opened from inside sits above: the panel steps out of its way.
|
|
521
|
+
suspended && 'invisible'), onOpenAutoFocus: (event) => {
|
|
522
|
+
event.preventDefault();
|
|
523
|
+
if (initialRow)
|
|
524
|
+
requestAnimationFrame(focusPane);
|
|
525
|
+
else
|
|
526
|
+
focusTab(active?.id);
|
|
527
|
+
}, onCloseAutoFocus: (event) => {
|
|
528
|
+
// Back to the message: the panel was a detour on the way to Send.
|
|
529
|
+
const editorNode = findComposerCard(triggerRef.current)?.querySelector('.ProseMirror');
|
|
530
|
+
if (!editorNode)
|
|
531
|
+
return;
|
|
532
|
+
event.preventDefault();
|
|
533
|
+
editorNode.focus();
|
|
534
|
+
}, onEscapeKeyDown: (event) => {
|
|
535
|
+
if (saving) {
|
|
536
|
+
event.preventDefault();
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
// Esc in the pane steps back to the list; Esc on the list closes.
|
|
540
|
+
if (paneRef.current?.contains(document.activeElement)) {
|
|
541
|
+
event.preventDefault();
|
|
542
|
+
focusTab(active?.id);
|
|
543
|
+
}
|
|
544
|
+
},
|
|
545
|
+
// The editors' selects open in their own portals, and a dialog opened
|
|
546
|
+
// from inside is outside too. Radix would close this panel under the cursor.
|
|
547
|
+
onInteractOutside: (event) => {
|
|
548
|
+
const target = event.target;
|
|
549
|
+
if (saving ||
|
|
550
|
+
foreignDialogOpen(contentRef.current) ||
|
|
551
|
+
target?.closest('[data-radix-popper-content-wrapper], [role="dialog"]'))
|
|
552
|
+
event.preventDefault();
|
|
553
|
+
}, onFocusOutside: (event) => {
|
|
554
|
+
if (foreignDialogOpen(contentRef.current))
|
|
555
|
+
event.preventDefault();
|
|
556
|
+
}, children: _jsxs("div", { onKeyDown: onPanelKeyDown,
|
|
557
|
+
// As tall as the list on the left, never taller than the room
|
|
558
|
+
// above the composer; the pane on the right scrolls inside that.
|
|
559
|
+
className: "flex max-h-[var(--radix-popover-content-available-height,32rem)] flex-col", children: [_jsxs("div", { className: "flex min-h-[9.5rem] flex-1", children: [_jsx("div", { ref: listRef, role: "tablist", "aria-orientation": "vertical", "aria-label": t('chatInput'), className: "flex w-72 shrink-0 flex-col gap-px overflow-y-auto p-1.5", children: listIds.map((id) => {
|
|
560
|
+
if (id === MORE_ROW) {
|
|
561
|
+
return (_jsxs("button", { type: "button", "aria-expanded": moreOpen, tabIndex: -1, "data-row-id": MORE_ROW, onClick: () => toggleMore(), className: "focus-visible:ring-ring hover:bg-hover text-foreground flex min-h-7 w-full min-w-0 shrink-0 items-center gap-2 rounded-md px-2 py-1 text-left text-sm outline-none focus-visible:ring-2", children: [_jsx("span", { className: "flex size-4 shrink-0 items-center justify-center", children: _jsx(CaretRightIcon, { className: cn('duration-moderate size-3.5 transition-transform ease-out motion-reduce:transition-none', moreOpen && 'rotate-90') }) }), _jsx("span", { className: "shrink-0 truncate font-medium", children: t('chatInputMore') }), extrasChanged > 0 ? (_jsxs("span", { className: "ml-auto flex items-center gap-1.5 pl-2 text-xs tabular-nums", children: [_jsx("span", { "aria-hidden": true, className: "bg-foreground size-1 shrink-0 rounded-full" }), t('chatInputChangedCount', { count: extrasChanged })] })) : null] }, MORE_ROW));
|
|
562
|
+
}
|
|
563
|
+
const item = items.find((candidate) => candidate.id === id);
|
|
564
|
+
const selected = item.id === active?.id;
|
|
565
|
+
return (_jsxs("button", { type: "button", role: "tab", id: tabId(item.id), "aria-selected": selected, "aria-controls": paneId, tabIndex: selected ? 0 : -1, "data-row-id": item.id, onClick: () => select(item.id), onPointerEnter: () => {
|
|
566
|
+
if (hoverTimer.current)
|
|
567
|
+
clearTimeout(hoverTimer.current);
|
|
568
|
+
hoverTimer.current = setTimeout(() => setActiveId(item.id), HOVER_REST_MS);
|
|
569
|
+
}, onPointerLeave: () => {
|
|
570
|
+
if (hoverTimer.current)
|
|
571
|
+
clearTimeout(hoverTimer.current);
|
|
572
|
+
}, className: cn('focus-visible:ring-ring text-foreground flex min-h-7 w-full min-w-0 shrink-0 items-center gap-2 rounded-md py-1 pr-2 text-left text-sm outline-none focus-visible:ring-2',
|
|
573
|
+
// Rows under "More" step in by one icon, so they read as its children.
|
|
574
|
+
item.extra ? 'pl-6' : 'pl-2', selected ? 'bg-active' : 'hover:bg-hover'), children: [_jsx("span", { className: "flex size-4 shrink-0 items-center justify-center", children: item.icon }), _jsx("span", { className: "shrink-0 truncate font-medium", children: item.name }), _jsxs("span", { className: "ml-auto flex min-w-0 items-center gap-1.5 pl-2", children: [item.overridden ? (_jsx("span", { "aria-hidden": true, className: "bg-foreground size-1 shrink-0 rounded-full" })) : null, _jsx("span", { className: "min-w-0 truncate text-right text-xs", children: item.value })] })] }, item.id));
|
|
575
|
+
}) }), _jsx("div", { ref: paneRef, id: paneId, role: "tabpanel", "aria-labelledby": active ? tabId(active.id) : undefined,
|
|
576
|
+
// Out of flow: the list alone sets the panel's height.
|
|
577
|
+
className: "relative min-w-0 flex-1", children: _jsxs("div", { className: "absolute inset-0 flex flex-col", children: [active ? (_jsxs("div", { className: "flex shrink-0 items-start gap-3 px-3.5 pt-2.5 pb-1.5", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("h3", { className: "text-foreground text-sm font-medium", children: active.name }), active.description ? (_jsx("p", { className: "text-muted-foreground text-xs text-pretty", children: active.description })) : null] }), active.onReset ? (_jsx(Button, { type: "button", variant: "ghost", size: "xs", disabled: saving, onClick: active.onReset, className: "-mt-0.5 -mr-1.5 shrink-0", children: t('chatInputReset') })) : null] })) : null, modelPane ? (_jsx("div", { className: "flex min-h-0 flex-1 flex-col", children: _jsx(ModelSelector, { appearance: "inline", models: models, modelsLoading: modelsLoading, selectedModel: selectedModel, onSelect: onModelChange, providers: providers, defaultControls: modelDefaultControls, projectId: projectId, offerProviderAccounts: true }) })) : (_jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto px-1.5 pb-1.5", children: [editor, notice] }))] }) })] }), overrides?.error ? (_jsx("p", { role: "alert", className: "text-destructive px-3.5 py-2 text-xs", children: overrides.error })) : null, showSave && overrides ? (_jsxs("div", { className: "bg-muted flex shrink-0 items-center justify-between gap-3 px-3.5 py-1.5", children: [_jsx("p", { className: "text-foreground text-xs text-pretty", "aria-live": "polite", children: overrides.pendingNote ?? tHardcodedUi.raw('i18nComplete.text26ee1166df63') }), _jsxs(Button, { type: "button", size: "xs", disabled: saving || overrides.saveDisabled, onClick: () => void saveAndClose(), children: [saving ? _jsx(Loading, { className: "size-3.5 shrink-0" }) : null, saving ? tPooled('saving') : tPooled('saveChanges')] })] })) : null] }) })] }));
|
|
578
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { SessionOverrideRow } from '../../overrides/session-overrides-control.js';
|
|
3
|
+
import type { SessionScopeDraft, SessionScopeSelectionCatalog } from '../../scope/session-scope-model.js';
|
|
4
|
+
/**
|
|
5
|
+
* The session-override rows (secrets, provider keys, sandbox, files) as the
|
|
6
|
+
* `chat_input` control renders them.
|
|
7
|
+
*
|
|
8
|
+
* `SessionOverridesToolbar` owns these rows: their drafts, their Save, their
|
|
9
|
+
* permission checks. The host still mounts it where it always did (the
|
|
10
|
+
* composer's `toolbarSlot`). Inside a composer with the flag on, it publishes
|
|
11
|
+
* the rows here instead of drawing its gear, and the control under the
|
|
12
|
+
* composer reads them. One owner, one state: the control holds no copy.
|
|
13
|
+
*
|
|
14
|
+
* A store rather than React state on the card: the rows change on every
|
|
15
|
+
* draft edit, and only the control should re-render for that, not the
|
|
16
|
+
* composer card and its editor.
|
|
17
|
+
*/
|
|
18
|
+
export interface ChatInputOverrides {
|
|
19
|
+
/** Editable rows only, plus the read-only Files row. */
|
|
20
|
+
rows: SessionOverrideRow[];
|
|
21
|
+
/** The rows whose editor writes through Save (secrets, provider keys). */
|
|
22
|
+
saveRowIds: readonly string[];
|
|
23
|
+
saving: boolean;
|
|
24
|
+
saveDisabled: boolean;
|
|
25
|
+
/** Save would write something: the scope draft or a provider-key draft changed. */
|
|
26
|
+
dirty: boolean;
|
|
27
|
+
pendingNote?: string;
|
|
28
|
+
error?: string | null;
|
|
29
|
+
notice?: ReactNode;
|
|
30
|
+
/** Commits the drafts. Resolves `true` on success. */
|
|
31
|
+
onSave: () => Promise<boolean>;
|
|
32
|
+
/**
|
|
33
|
+
* "Reset to auto" for one overridden row. Secrets and provider keys reset
|
|
34
|
+
* AND save, one click; the gear's reset only edits the draft.
|
|
35
|
+
*/
|
|
36
|
+
onResetRow: (id: string) => void;
|
|
37
|
+
/** The secrets and connectors draft, for the control's own editors. */
|
|
38
|
+
scope?: {
|
|
39
|
+
draft: SessionScopeDraft;
|
|
40
|
+
catalog: SessionScopeSelectionCatalog;
|
|
41
|
+
/** The catalog (or the session's scope) has not answered yet. */
|
|
42
|
+
loading: boolean;
|
|
43
|
+
disabled: boolean;
|
|
44
|
+
onChange: (draft: SessionScopeDraft) => void;
|
|
45
|
+
};
|
|
46
|
+
/** The provider-key pools in effect (saved plus drafts), for the control's own editor. */
|
|
47
|
+
providerKeys?: {
|
|
48
|
+
projectId: string;
|
|
49
|
+
sessionId?: string;
|
|
50
|
+
/** Provider id → the key ids in effect. A provider absent here runs on the agent default. */
|
|
51
|
+
selection: Record<string, string[]>;
|
|
52
|
+
canEdit: boolean;
|
|
53
|
+
loading: boolean;
|
|
54
|
+
/** `null` or `[]`: back to the agent default for that provider. */
|
|
55
|
+
onChange: (providerId: string, ids: string[] | null) => void;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
interface ChatInputOverridesStore {
|
|
59
|
+
get: () => ChatInputOverrides | null;
|
|
60
|
+
set: (value: ChatInputOverrides | null) => void;
|
|
61
|
+
subscribe: (listener: () => void) => () => void;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Mounted by every composer card; it hands out the store only while
|
|
65
|
+
* `chat_input` is on. Always mounted, so the flag resolving after the first
|
|
66
|
+
* render swaps a context value instead of remounting the card and its editor.
|
|
67
|
+
*/
|
|
68
|
+
export declare function ChatInputOverridesProvider({ enabled, children }: {
|
|
69
|
+
enabled: boolean;
|
|
70
|
+
children: ReactNode;
|
|
71
|
+
}): import("react").JSX.Element;
|
|
72
|
+
/** `null` outside a `chat_input` composer: the caller draws its own gear. */
|
|
73
|
+
export declare function useChatInputOverridesStore(): ChatInputOverridesStore | null;
|
|
74
|
+
/** The published rows, or `null` while nothing publishes (no project, host overrides off). */
|
|
75
|
+
export declare function useChatInputOverrides(): ChatInputOverrides | null;
|
|
76
|
+
export {};
|