veryfront 0.1.1048 → 0.1.1049
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/esm/cli/templates/manifest.js +3 -3
- package/esm/deno.d.ts +3 -0
- package/esm/deno.js +10 -6
- package/esm/src/agent/react/use-agent-metadata.js +1 -1
- package/esm/src/agent/react/use-agent.js +1 -1
- package/esm/src/agent/react/use-agents.js +1 -1
- package/esm/src/agent/react/use-chat/types.d.ts +0 -6
- package/esm/src/agent/react/use-chat/types.d.ts.map +1 -1
- package/esm/src/agent/react/use-chat/use-chat.d.ts +5 -0
- package/esm/src/agent/react/use-chat/use-chat.d.ts.map +1 -1
- package/esm/src/agent/react/use-chat/use-chat.js +87 -34
- package/esm/src/agent/react/use-completion.js +1 -1
- package/esm/src/agent/react/use-streaming.js +1 -1
- package/esm/src/agent/react/use-voice-input.js +1 -1
- package/esm/src/cache/backends/api.d.ts.map +1 -1
- package/esm/src/cache/backends/api.js +10 -7
- package/esm/src/chat/index.d.ts +8 -15
- package/esm/src/chat/index.d.ts.map +1 -1
- package/esm/src/chat/index.js +7 -16
- package/esm/src/modules/component-registry/registry.d.ts +1 -1
- package/esm/src/modules/component-registry/registry.d.ts.map +1 -1
- package/esm/src/modules/react-loader/component-loader.d.ts +1 -1
- package/esm/src/modules/react-loader/component-loader.d.ts.map +1 -1
- package/esm/src/modules/react-loader/extract-component.d.ts +1 -1
- package/esm/src/modules/react-loader/extract-component.d.ts.map +1 -1
- package/esm/src/modules/react-loader/ssr-module-loader/loader.d.ts +1 -1
- package/esm/src/modules/react-loader/ssr-module-loader/loader.d.ts.map +1 -1
- package/esm/src/modules/react-loader/types.d.ts +1 -1
- package/esm/src/modules/react-loader/types.d.ts.map +1 -1
- package/esm/src/platform/adapters/fs/veryfront/multi-project-adapter.d.ts +3 -1
- package/esm/src/platform/adapters/fs/veryfront/multi-project-adapter.d.ts.map +1 -1
- package/esm/src/platform/adapters/fs/veryfront/multi-project-adapter.js +2 -0
- package/esm/src/platform/adapters/fs/veryfront/request-context.d.ts +4 -0
- package/esm/src/platform/adapters/fs/veryfront/request-context.d.ts.map +1 -1
- package/esm/src/platform/adapters/fs/veryfront/request-context.js +1 -0
- package/esm/src/proxy/main.js +6 -5
- package/esm/src/proxy/retry.d.ts +14 -6
- package/esm/src/proxy/retry.d.ts.map +1 -1
- package/esm/src/proxy/retry.js +82 -20
- package/esm/src/react/compat/hooks-adapter.d.ts +1 -1
- package/esm/src/react/compat/hooks-adapter.d.ts.map +1 -1
- package/esm/src/react/compat/hooks-adapter.js +1 -1
- package/esm/src/react/compat/ssr-adapter/response-builder.d.ts +1 -1
- package/esm/src/react/compat/ssr-adapter/response-builder.d.ts.map +1 -1
- package/esm/src/react/compat/ssr-adapter/server-loader.d.ts +5 -5
- package/esm/src/react/compat/ssr-adapter/server-loader.d.ts.map +1 -1
- package/esm/src/react/compat/ssr-adapter/stream-renderer.d.ts +1 -1
- package/esm/src/react/compat/ssr-adapter/stream-renderer.d.ts.map +1 -1
- package/esm/src/react/compat/ssr-adapter/string-renderer.d.ts +1 -1
- package/esm/src/react/compat/ssr-adapter/string-renderer.d.ts.map +1 -1
- package/esm/src/react/compat/version-detector/feature-detector.js +1 -1
- package/esm/src/react/components/AppWrapper.d.ts +1 -1
- package/esm/src/react/components/AppWrapper.d.ts.map +1 -1
- package/esm/src/react/components/AppWrapper.js +1 -1
- package/esm/src/react/components/LayoutComponent.d.ts +1 -1
- package/esm/src/react/components/LayoutComponent.d.ts.map +1 -1
- package/esm/src/react/components/LayoutComponent.js +1 -1
- package/esm/src/react/components/MDXProvider.d.ts +1 -1
- package/esm/src/react/components/MDXProvider.d.ts.map +1 -1
- package/esm/src/react/components/MDXProvider.js +1 -1
- package/esm/src/react/components/ProviderComponent.d.ts +1 -1
- package/esm/src/react/components/ProviderComponent.d.ts.map +1 -1
- package/esm/src/react/components/ProviderComponent.js +1 -1
- package/esm/src/react/components/chat/agent-card.d.ts +15 -7
- package/esm/src/react/components/chat/agent-card.d.ts.map +1 -1
- package/esm/src/react/components/chat/agent-card.js +9 -10
- package/esm/src/react/components/chat/agent-picker-actions.d.ts +20 -0
- package/esm/src/react/components/chat/agent-picker-actions.d.ts.map +1 -0
- package/esm/src/react/components/chat/agent-picker-actions.js +24 -0
- package/esm/src/react/components/chat/agent-picker-context.d.ts +19 -0
- package/esm/src/react/components/chat/agent-picker-context.d.ts.map +1 -0
- package/esm/src/react/components/chat/agent-picker-context.js +13 -0
- package/esm/src/react/components/chat/agent-picker.d.ts +35 -42
- package/esm/src/react/components/chat/agent-picker.d.ts.map +1 -1
- package/esm/src/react/components/chat/agent-picker.js +59 -50
- package/esm/src/react/components/chat/chat/app-mode-chat.d.ts +14 -0
- package/esm/src/react/components/chat/chat/app-mode-chat.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/app-mode-chat.js +137 -0
- package/esm/src/react/components/chat/chat/chat-attachments.d.ts +7 -0
- package/esm/src/react/components/chat/chat/chat-attachments.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/chat-attachments.js +16 -0
- package/esm/src/react/components/chat/chat/chat-component.d.ts +21 -0
- package/esm/src/react/components/chat/chat/chat-component.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/chat-component.js +1 -0
- package/esm/src/react/components/chat/chat/chat-props.d.ts +114 -0
- package/esm/src/react/components/chat/chat/chat-props.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/chat-props.js +1 -0
- package/esm/src/react/components/chat/chat/components/animations.d.ts +1 -1
- package/esm/src/react/components/chat/chat/components/animations.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/animations.js +1 -1
- package/esm/src/react/components/chat/chat/components/attachment-pill.d.ts +18 -18
- package/esm/src/react/components/chat/chat/components/attachment-pill.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/attachment-pill.js +11 -15
- package/esm/src/react/components/chat/chat/components/attachments-panel.d.ts +14 -3
- package/esm/src/react/components/chat/chat/components/attachments-panel.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/attachments-panel.js +3 -3
- package/esm/src/react/components/chat/chat/components/branch-picker.d.ts +44 -14
- package/esm/src/react/components/chat/chat/components/branch-picker.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/branch-picker.js +55 -12
- package/esm/src/react/components/chat/chat/components/chat-messages-skeleton.d.ts +1 -1
- package/esm/src/react/components/chat/chat/components/chat-messages-skeleton.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/chat-messages-skeleton.js +1 -1
- package/esm/src/react/components/chat/chat/components/code-block.d.ts +7 -2
- package/esm/src/react/components/chat/chat/components/code-block.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/code-block.js +3 -3
- package/esm/src/react/components/chat/chat/components/drop-zone.d.ts +1 -1
- package/esm/src/react/components/chat/chat/components/drop-zone.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/drop-zone.js +1 -1
- package/esm/src/react/components/chat/chat/components/empty-state.d.ts +1 -1
- package/esm/src/react/components/chat/chat/components/empty-state.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/empty-state.js +1 -1
- package/esm/src/react/components/chat/chat/components/inference-badge.d.ts +1 -1
- package/esm/src/react/components/chat/chat/components/inference-badge.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/inference-badge.js +1 -1
- package/esm/src/react/components/chat/chat/components/inline-citation.d.ts +33 -10
- package/esm/src/react/components/chat/chat/components/inline-citation.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/inline-citation.js +145 -51
- package/esm/src/react/components/chat/chat/components/message-actions.d.ts +49 -20
- package/esm/src/react/components/chat/chat/components/message-actions.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/message-actions.js +72 -18
- package/esm/src/react/components/chat/chat/components/message-edit-form.d.ts +1 -1
- package/esm/src/react/components/chat/chat/components/message-edit-form.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/message-edit-form.js +1 -1
- package/esm/src/react/components/chat/chat/components/message-feedback.d.ts +34 -14
- package/esm/src/react/components/chat/chat/components/message-feedback.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/message-feedback.js +54 -15
- package/esm/src/react/components/chat/chat/components/quick-actions.d.ts +1 -1
- package/esm/src/react/components/chat/chat/components/quick-actions.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/quick-actions.js +1 -1
- package/esm/src/react/components/chat/chat/components/reasoning.d.ts +14 -6
- package/esm/src/react/components/chat/chat/components/reasoning.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/reasoning.js +3 -5
- package/esm/src/react/components/chat/chat/components/sidebar.d.ts +70 -16
- package/esm/src/react/components/chat/chat/components/sidebar.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/sidebar.js +72 -23
- package/esm/src/react/components/chat/chat/components/skill-badge.d.ts +1 -1
- package/esm/src/react/components/chat/chat/components/skill-badge.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/skill-badge.js +1 -1
- package/esm/src/react/components/chat/chat/components/skill-tool.d.ts +1 -1
- package/esm/src/react/components/chat/chat/components/skill-tool.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/skill-tool.js +1 -1
- package/esm/src/react/components/chat/chat/components/sources.d.ts +25 -15
- package/esm/src/react/components/chat/chat/components/sources.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/sources.js +7 -7
- package/esm/src/react/components/chat/chat/components/step-indicator.d.ts +14 -3
- package/esm/src/react/components/chat/chat/components/step-indicator.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/step-indicator.js +3 -3
- package/esm/src/react/components/chat/chat/components/tab-switcher.d.ts +1 -1
- package/esm/src/react/components/chat/chat/components/tab-switcher.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/tab-switcher.js +1 -1
- package/esm/src/react/components/chat/chat/components/tool-ui.d.ts +16 -9
- package/esm/src/react/components/chat/chat/components/tool-ui.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/tool-ui.js +10 -14
- package/esm/src/react/components/chat/chat/composition/agent-avatar.d.ts +1 -1
- package/esm/src/react/components/chat/chat/composition/agent-avatar.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/agent-avatar.js +1 -1
- package/esm/src/react/components/chat/chat/composition/api.d.ts +3 -3
- package/esm/src/react/components/chat/chat/composition/api.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/api.js +2 -2
- package/esm/src/react/components/chat/chat/composition/chat-composer.d.ts +72 -29
- package/esm/src/react/components/chat/chat/composition/chat-composer.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-composer.js +92 -82
- package/esm/src/react/components/chat/chat/composition/chat-empty-state.d.ts +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-empty-state.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-empty-state.js +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-empty.d.ts +7 -2
- package/esm/src/react/components/chat/chat/composition/chat-empty.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-empty.js +3 -3
- package/esm/src/react/components/chat/chat/composition/chat-if.d.ts +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-if.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-message-list.d.ts +25 -11
- package/esm/src/react/components/chat/chat/composition/chat-message-list.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-message-list.js +67 -29
- package/esm/src/react/components/chat/chat/composition/chat-root.d.ts +7 -3
- package/esm/src/react/components/chat/chat/composition/chat-root.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-root.js +3 -5
- package/esm/src/react/components/chat/chat/composition/error-banner.d.ts +7 -2
- package/esm/src/react/components/chat/chat/composition/error-banner.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/error-banner.js +3 -3
- package/esm/src/react/components/chat/chat/composition/message.d.ts +85 -34
- package/esm/src/react/components/chat/chat/composition/message.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/message.js +146 -122
- package/esm/src/react/components/chat/chat/composition/model-avatar.d.ts +1 -1
- package/esm/src/react/components/chat/chat/composition/model-avatar.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/model-avatar.js +1 -1
- package/esm/src/react/components/chat/chat/composition/pending-message.d.ts +1 -1
- package/esm/src/react/components/chat/chat/composition/pending-message.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/pending-message.js +1 -1
- package/esm/src/react/components/chat/chat/contexts/chat-context.d.ts +2 -3
- package/esm/src/react/components/chat/chat/contexts/chat-context.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/contexts/chat-context.js +1 -1
- package/esm/src/react/components/chat/chat/contexts/composer-context.d.ts +2 -2
- package/esm/src/react/components/chat/chat/contexts/composer-context.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/contexts/composer-context.js +1 -1
- package/esm/src/react/components/chat/chat/contexts/conversations-context.d.ts +2 -2
- package/esm/src/react/components/chat/chat/contexts/conversations-context.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/contexts/conversations-context.js +1 -1
- package/esm/src/react/components/chat/chat/contexts/index.d.ts +1 -1
- package/esm/src/react/components/chat/chat/contexts/index.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/contexts/index.js +1 -1
- package/esm/src/react/components/chat/chat/contexts/message-context.d.ts +15 -2
- package/esm/src/react/components/chat/chat/contexts/message-context.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/contexts/message-context.js +11 -1
- package/esm/src/react/components/chat/chat/controlled-chat.d.ts +15 -0
- package/esm/src/react/components/chat/chat/controlled-chat.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/controlled-chat.js +97 -0
- package/esm/src/react/components/chat/chat/hooks/use-clipboard.js +1 -1
- package/esm/src/react/components/chat/chat/hooks/use-conversation-chat.d.ts +54 -0
- package/esm/src/react/components/chat/chat/hooks/use-conversation-chat.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/hooks/use-conversation-chat.js +179 -0
- package/esm/src/react/components/chat/chat/hooks/use-conversation.js +1 -1
- package/esm/src/react/components/chat/chat/hooks/use-conversations.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/hooks/use-conversations.js +3 -6
- package/esm/src/react/components/chat/chat/hooks/use-drop-zone.d.ts +8 -5
- package/esm/src/react/components/chat/chat/hooks/use-drop-zone.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/hooks/use-drop-zone.js +6 -6
- package/esm/src/react/components/chat/chat/hooks/use-stick-to-bottom.d.ts +1 -1
- package/esm/src/react/components/chat/chat/hooks/use-stick-to-bottom.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/hooks/use-stick-to-bottom.js +1 -1
- package/esm/src/react/components/chat/chat/hooks/use-upload.js +1 -1
- package/esm/src/react/components/chat/chat/hooks/use-uploads-registry.js +1 -1
- package/esm/src/react/components/chat/chat/index.d.ts +13 -230
- package/esm/src/react/components/chat/chat/index.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/index.js +27 -383
- package/esm/src/react/components/chat/chat-actions.d.ts +1 -1
- package/esm/src/react/components/chat/chat-actions.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat-actions.js +1 -1
- package/esm/src/react/components/chat/chat-agent-picker.d.ts +1 -1
- package/esm/src/react/components/chat/chat-agent-picker.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat-agent-picker.js +1 -1
- package/esm/src/react/components/chat/chat-theme-scope.d.ts +1 -1
- package/esm/src/react/components/chat/chat-theme-scope.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat-theme-scope.js +1 -1
- package/esm/src/react/components/chat/chat.d.ts +6 -6
- package/esm/src/react/components/chat/chat.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat.js +4 -4
- package/esm/src/react/components/chat/error-boundary.d.ts +1 -1
- package/esm/src/react/components/chat/error-boundary.d.ts.map +1 -1
- package/esm/src/react/components/chat/error-boundary.js +1 -1
- package/esm/src/react/components/chat/markdown.d.ts +3 -5
- package/esm/src/react/components/chat/markdown.d.ts.map +1 -1
- package/esm/src/react/components/chat/markdown.js +4 -72
- package/esm/src/react/components/chat/model-selector.d.ts +21 -27
- package/esm/src/react/components/chat/model-selector.d.ts.map +1 -1
- package/esm/src/react/components/chat/model-selector.js +26 -31
- package/esm/src/react/components/optimized-image/OptimizedBackgroundImage.d.ts +1 -1
- package/esm/src/react/components/optimized-image/OptimizedBackgroundImage.d.ts.map +1 -1
- package/esm/src/react/components/optimized-image/OptimizedBackgroundImage.js +1 -1
- package/esm/src/react/components/optimized-image/OptimizedImage.d.ts +1 -1
- package/esm/src/react/components/optimized-image/OptimizedImage.d.ts.map +1 -1
- package/esm/src/react/components/optimized-image/OptimizedImage.js +1 -1
- package/esm/src/react/components/optimized-image/SimpleOptimizedImage.d.ts +1 -1
- package/esm/src/react/components/optimized-image/SimpleOptimizedImage.d.ts.map +1 -1
- package/esm/src/react/components/optimized-image/utils.d.ts +1 -1
- package/esm/src/react/components/optimized-image/utils.d.ts.map +1 -1
- package/esm/src/react/components/optimized-image/utils.js +1 -1
- package/esm/src/react/components/ui/alert.d.ts +1 -1
- package/esm/src/react/components/ui/alert.d.ts.map +1 -1
- package/esm/src/react/components/ui/alert.js +1 -1
- package/esm/src/react/components/ui/app-shell.d.ts +1 -1
- package/esm/src/react/components/ui/app-shell.d.ts.map +1 -1
- package/esm/src/react/components/ui/app-shell.js +1 -1
- package/esm/src/react/components/ui/avatar.d.ts +1 -1
- package/esm/src/react/components/ui/avatar.d.ts.map +1 -1
- package/esm/src/react/components/ui/avatar.js +1 -1
- package/esm/src/react/components/ui/badge.d.ts +1 -1
- package/esm/src/react/components/ui/badge.d.ts.map +1 -1
- package/esm/src/react/components/ui/badge.js +1 -1
- package/esm/src/react/components/ui/button.d.ts +1 -1
- package/esm/src/react/components/ui/button.d.ts.map +1 -1
- package/esm/src/react/components/ui/button.js +1 -1
- package/esm/src/react/components/ui/card.d.ts +1 -1
- package/esm/src/react/components/ui/card.d.ts.map +1 -1
- package/esm/src/react/components/ui/card.js +1 -1
- package/esm/src/react/components/ui/checkbox.d.ts +1 -1
- package/esm/src/react/components/ui/checkbox.d.ts.map +1 -1
- package/esm/src/react/components/ui/checkbox.js +1 -1
- package/esm/src/react/components/ui/code-block.d.ts +1 -1
- package/esm/src/react/components/ui/code-block.d.ts.map +1 -1
- package/esm/src/react/components/ui/code-block.js +1 -1
- package/esm/src/react/components/ui/collapsible.d.ts +1 -1
- package/esm/src/react/components/ui/collapsible.d.ts.map +1 -1
- package/esm/src/react/components/ui/collapsible.js +1 -1
- package/esm/src/react/components/ui/color-mode.d.ts +2 -2
- package/esm/src/react/components/ui/color-mode.d.ts.map +1 -1
- package/esm/src/react/components/ui/color-mode.js +1 -1
- package/esm/src/react/components/ui/command.d.ts +1 -1
- package/esm/src/react/components/ui/command.d.ts.map +1 -1
- package/esm/src/react/components/ui/command.js +1 -1
- package/esm/src/react/components/ui/dialog.d.ts +1 -1
- package/esm/src/react/components/ui/dialog.d.ts.map +1 -1
- package/esm/src/react/components/ui/dialog.js +1 -1
- package/esm/src/react/components/ui/drawer.d.ts +1 -1
- package/esm/src/react/components/ui/drawer.d.ts.map +1 -1
- package/esm/src/react/components/ui/drawer.js +1 -1
- package/esm/src/react/components/ui/dropdown-menu.d.ts +1 -1
- package/esm/src/react/components/ui/dropdown-menu.d.ts.map +1 -1
- package/esm/src/react/components/ui/dropdown-menu.js +1 -1
- package/esm/src/react/components/ui/file-type.d.ts +1 -1
- package/esm/src/react/components/ui/file-type.d.ts.map +1 -1
- package/esm/src/react/components/ui/file-type.js +1 -1
- package/esm/src/react/components/ui/floating.d.ts +1 -1
- package/esm/src/react/components/ui/floating.d.ts.map +1 -1
- package/esm/src/react/components/ui/floating.js +2 -2
- package/esm/src/react/components/ui/icon-button.d.ts +1 -1
- package/esm/src/react/components/ui/icon-button.d.ts.map +1 -1
- package/esm/src/react/components/ui/icon-button.js +1 -1
- package/esm/src/react/components/ui/icons/index.d.ts +1 -1
- package/esm/src/react/components/ui/icons/index.d.ts.map +1 -1
- package/esm/src/react/components/ui/icons/index.js +1 -1
- package/esm/src/react/components/ui/input.d.ts +1 -1
- package/esm/src/react/components/ui/input.d.ts.map +1 -1
- package/esm/src/react/components/ui/input.js +1 -1
- package/esm/src/react/components/ui/label.d.ts +1 -1
- package/esm/src/react/components/ui/label.d.ts.map +1 -1
- package/esm/src/react/components/ui/label.js +1 -1
- package/esm/src/react/components/ui/list.d.ts +1 -1
- package/esm/src/react/components/ui/list.d.ts.map +1 -1
- package/esm/src/react/components/ui/list.js +1 -1
- package/esm/src/react/components/ui/pill.d.ts +1 -1
- package/esm/src/react/components/ui/pill.d.ts.map +1 -1
- package/esm/src/react/components/ui/pill.js +1 -1
- package/esm/src/react/components/ui/popover.d.ts +1 -1
- package/esm/src/react/components/ui/popover.d.ts.map +1 -1
- package/esm/src/react/components/ui/popover.js +1 -1
- package/esm/src/react/components/ui/progress-bar.d.ts +1 -1
- package/esm/src/react/components/ui/progress-bar.d.ts.map +1 -1
- package/esm/src/react/components/ui/progress-bar.js +1 -1
- package/esm/src/react/components/ui/radio.d.ts +1 -1
- package/esm/src/react/components/ui/radio.d.ts.map +1 -1
- package/esm/src/react/components/ui/radio.js +1 -1
- package/esm/src/react/components/ui/scroll-fade.d.ts +1 -1
- package/esm/src/react/components/ui/scroll-fade.d.ts.map +1 -1
- package/esm/src/react/components/ui/scroll-fade.js +1 -1
- package/esm/src/react/components/ui/select.d.ts +1 -1
- package/esm/src/react/components/ui/select.d.ts.map +1 -1
- package/esm/src/react/components/ui/select.js +1 -1
- package/esm/src/react/components/ui/shimmer.d.ts +1 -1
- package/esm/src/react/components/ui/shimmer.d.ts.map +1 -1
- package/esm/src/react/components/ui/shimmer.js +1 -1
- package/esm/src/react/components/ui/skeleton.d.ts +1 -1
- package/esm/src/react/components/ui/skeleton.d.ts.map +1 -1
- package/esm/src/react/components/ui/skeleton.js +1 -1
- package/esm/src/react/components/ui/slot.d.ts +1 -1
- package/esm/src/react/components/ui/slot.d.ts.map +1 -1
- package/esm/src/react/components/ui/slot.js +1 -1
- package/esm/src/react/components/ui/status.d.ts +1 -1
- package/esm/src/react/components/ui/status.d.ts.map +1 -1
- package/esm/src/react/components/ui/status.js +1 -1
- package/esm/src/react/components/ui/switch.d.ts +1 -1
- package/esm/src/react/components/ui/switch.d.ts.map +1 -1
- package/esm/src/react/components/ui/switch.js +1 -1
- package/esm/src/react/components/ui/tabs.d.ts +3 -3
- package/esm/src/react/components/ui/tabs.d.ts.map +1 -1
- package/esm/src/react/components/ui/tabs.js +1 -1
- package/esm/src/react/components/ui/tag.d.ts +1 -1
- package/esm/src/react/components/ui/tag.d.ts.map +1 -1
- package/esm/src/react/components/ui/tag.js +1 -1
- package/esm/src/react/components/ui/textarea.d.ts +1 -1
- package/esm/src/react/components/ui/textarea.d.ts.map +1 -1
- package/esm/src/react/components/ui/textarea.js +1 -1
- package/esm/src/react/components/ui/tokens.d.ts +1 -1
- package/esm/src/react/components/ui/tokens.d.ts.map +1 -1
- package/esm/src/react/components/ui/tokens.js +1 -1
- package/esm/src/react/components/ui/tooltip.d.ts +1 -1
- package/esm/src/react/components/ui/tooltip.d.ts.map +1 -1
- package/esm/src/react/components/ui/tooltip.js +2 -2
- package/esm/src/react/fonts/index.d.ts +1 -1
- package/esm/src/react/fonts/index.d.ts.map +1 -1
- package/esm/src/react/fonts/index.js +1 -1
- package/esm/src/react/primitives/agent-primitives.d.ts +4 -4
- package/esm/src/react/primitives/agent-primitives.d.ts.map +1 -1
- package/esm/src/react/primitives/agent-primitives.js +1 -1
- package/esm/src/react/primitives/chat-container.d.ts +2 -2
- package/esm/src/react/primitives/chat-container.d.ts.map +1 -1
- package/esm/src/react/primitives/chat-container.js +1 -1
- package/esm/src/react/primitives/input-box.d.ts +4 -4
- package/esm/src/react/primitives/input-box.d.ts.map +1 -1
- package/esm/src/react/primitives/input-box.js +1 -1
- package/esm/src/react/primitives/message-list.d.ts +5 -5
- package/esm/src/react/primitives/message-list.d.ts.map +1 -1
- package/esm/src/react/primitives/message-list.js +1 -1
- package/esm/src/react/primitives/tool-primitives.d.ts +4 -4
- package/esm/src/react/primitives/tool-primitives.d.ts.map +1 -1
- package/esm/src/react/primitives/tool-primitives.js +1 -1
- package/esm/src/react/runtime/core.d.ts +1 -1
- package/esm/src/react/runtime/core.d.ts.map +1 -1
- package/esm/src/react/runtime/core.js +1 -1
- package/esm/src/rendering/app-reserved.d.ts +1 -1
- package/esm/src/rendering/app-reserved.d.ts.map +1 -1
- package/esm/src/rendering/app-reserved.js +1 -1
- package/esm/src/rendering/component-handling.d.ts +1 -1
- package/esm/src/rendering/component-handling.d.ts.map +1 -1
- package/esm/src/rendering/element-validator/element-normalizer.d.ts +1 -1
- package/esm/src/rendering/element-validator/element-normalizer.d.ts.map +1 -1
- package/esm/src/rendering/element-validator/element-normalizer.js +1 -1
- package/esm/src/rendering/element-validator/primitive-checks.d.ts +1 -1
- package/esm/src/rendering/element-validator/primitive-checks.d.ts.map +1 -1
- package/esm/src/rendering/element-validator/primitive-checks.js +1 -1
- package/esm/src/rendering/element-validator/validator-core.d.ts +1 -1
- package/esm/src/rendering/element-validator/validator-core.d.ts.map +1 -1
- package/esm/src/rendering/layouts/layout-applicator.d.ts +1 -1
- package/esm/src/rendering/layouts/layout-applicator.d.ts.map +1 -1
- package/esm/src/rendering/layouts/utils/applicator.d.ts +1 -1
- package/esm/src/rendering/layouts/utils/applicator.d.ts.map +1 -1
- package/esm/src/rendering/layouts/utils/component-loader.d.ts +1 -1
- package/esm/src/rendering/layouts/utils/component-loader.d.ts.map +1 -1
- package/esm/src/rendering/layouts/utils/ensure-valid-child.d.ts +1 -1
- package/esm/src/rendering/layouts/utils/ensure-valid-child.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/layout.d.ts +1 -1
- package/esm/src/rendering/orchestrator/layout.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/ssr-orchestrator.d.ts +1 -1
- package/esm/src/rendering/orchestrator/ssr-orchestrator.d.ts.map +1 -1
- package/esm/src/rendering/page-renderer.d.ts +1 -1
- package/esm/src/rendering/page-renderer.d.ts.map +1 -1
- package/esm/src/rendering/page-rendering.d.ts +1 -1
- package/esm/src/rendering/page-rendering.d.ts.map +1 -1
- package/esm/src/rendering/rsc/server-renderer/component-detector.d.ts +1 -1
- package/esm/src/rendering/rsc/server-renderer/component-detector.d.ts.map +1 -1
- package/esm/src/rendering/rsc/server-renderer/rsc-renderer.d.ts +1 -1
- package/esm/src/rendering/rsc/server-renderer/rsc-renderer.d.ts.map +1 -1
- package/esm/src/rendering/rsc/server-renderer/tree-processor.d.ts +1 -1
- package/esm/src/rendering/rsc/server-renderer/tree-processor.d.ts.map +1 -1
- package/esm/src/rendering/rsc/server-renderer/tree-processor.js +1 -1
- package/esm/src/rendering/snippet-renderer.js +2 -2
- package/esm/src/rendering/ssr/component-registry.d.ts +1 -1
- package/esm/src/rendering/ssr/component-registry.d.ts.map +1 -1
- package/esm/src/rendering/ssr/component-registry.js +1 -1
- package/esm/src/rendering/ssr/mdx-renderer.d.ts +1 -1
- package/esm/src/rendering/ssr/mdx-renderer.d.ts.map +1 -1
- package/esm/src/rendering/ssr/mdx-renderer.js +1 -1
- package/esm/src/rendering/ssr/types.d.ts +1 -1
- package/esm/src/rendering/ssr/types.d.ts.map +1 -1
- package/esm/src/rendering/ssr-renderer.d.ts +1 -1
- package/esm/src/rendering/ssr-renderer.d.ts.map +1 -1
- package/esm/src/rendering/utils/react-helpers.d.ts +1 -1
- package/esm/src/rendering/utils/react-helpers.d.ts.map +1 -1
- package/esm/src/rendering/utils/react-helpers.js +1 -1
- package/esm/src/security/http/base-handler.d.ts +2 -0
- package/esm/src/security/http/base-handler.d.ts.map +1 -1
- package/esm/src/security/http/base-handler.js +1 -0
- package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/framework-candidates.generated.js +841 -596
- package/esm/src/server/handlers/request/agent-stream.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/request/agent-stream.handler.js +4 -1
- package/esm/src/transforms/mdx/esm-module-loader/components/resolver.d.ts +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/components/resolver.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/jsx/runtime-loader.js +1 -1
- package/esm/src/transforms/mdx/index.d.ts +1 -1
- package/esm/src/transforms/mdx/index.d.ts.map +1 -1
- package/esm/src/transforms/mdx/index.js +1 -1
- package/esm/src/transforms/mdx/mdx-cache-adapter.js +1 -1
- package/esm/src/transforms/mdx/module-loader/types.d.ts +1 -1
- package/esm/src/transforms/mdx/module-loader/types.d.ts.map +1 -1
- package/esm/src/transforms/mdx/types.d.ts +2 -2
- package/esm/src/transforms/mdx/types.d.ts.map +1 -1
- package/esm/src/types/app.d.ts +1 -1
- package/esm/src/types/app.d.ts.map +1 -1
- package/esm/src/types/global-guards.d.ts +1 -1
- package/esm/src/types/global-guards.d.ts.map +1 -1
- package/esm/src/types/index.d.ts +1 -1
- package/esm/src/types/index.d.ts.map +1 -1
- package/esm/src/utils/id.d.ts +7 -0
- package/esm/src/utils/id.d.ts.map +1 -1
- package/esm/src/utils/id.js +22 -0
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/esm/src/workflow/claude-code/react/use-claude-code-stream.js +1 -1
- package/esm/src/workflow/claude-code/react/use-claude-code-websocket.js +1 -1
- package/esm/src/workflow/react/use-approval.js +1 -1
- package/esm/src/workflow/react/use-workflow-list.js +1 -1
- package/esm/src/workflow/react/use-workflow-start.js +1 -1
- package/esm/src/workflow/react/use-workflow.js +1 -1
- package/package.json +4 -5
- package/esm/deps/esm.sh/react-dom@19.2.4/client.d.ts +0 -3
- package/esm/deps/esm.sh/react-dom@19.2.4/client.d.ts.map +0 -1
- package/esm/deps/esm.sh/react-dom@19.2.4/client.js +0 -3
- package/esm/deps/esm.sh/react-dom@19.2.4/server.d.ts +0 -3
- package/esm/deps/esm.sh/react-dom@19.2.4/server.d.ts.map +0 -1
- package/esm/deps/esm.sh/react-dom@19.2.4/server.js +0 -3
- package/esm/deps/esm.sh/react-dom@19.2.4.d.ts +0 -3
- package/esm/deps/esm.sh/react-dom@19.2.4.d.ts.map +0 -1
- package/esm/deps/esm.sh/react-dom@19.2.4.js +0 -3
- package/esm/deps/esm.sh/react@19.2.4/jsx-dev-runtime.d.ts +0 -3
- package/esm/deps/esm.sh/react@19.2.4/jsx-dev-runtime.d.ts.map +0 -1
- package/esm/deps/esm.sh/react@19.2.4/jsx-dev-runtime.js +0 -3
- package/esm/deps/esm.sh/react@19.2.4/jsx-runtime.d.ts +0 -3
- package/esm/deps/esm.sh/react@19.2.4/jsx-runtime.d.ts.map +0 -1
- package/esm/deps/esm.sh/react@19.2.4/jsx-runtime.js +0 -3
- package/esm/deps/esm.sh/react@19.2.4.d.ts +0 -3
- package/esm/deps/esm.sh/react@19.2.4.d.ts.map +0 -1
- package/esm/deps/esm.sh/react@19.2.4.js +0 -3
- package/esm/deps/esm.sh/scheduler@^0.27.0.d.ts +0 -3
- package/esm/deps/esm.sh/scheduler@^0.27.0.d.ts.map +0 -1
- package/esm/deps/esm.sh/scheduler@^0.27.0.js +0 -3
- package/esm/react/jsx-dev-runtime.d.ts +0 -2
- package/esm/react/jsx-dev-runtime.d.ts.map +0 -1
- package/esm/react/jsx-dev-runtime.js +0 -1
- package/esm/react/jsx-runtime.d.ts +0 -2
- package/esm/react/jsx-runtime.d.ts.map +0 -1
- package/esm/react/jsx-runtime.js +0 -1
- package/esm/react/react-dom-client.d.ts +0 -3
- package/esm/react/react-dom-client.d.ts.map +0 -1
- package/esm/react/react-dom-client.js +0 -2
- package/esm/react/react-dom-server.d.ts +0 -3
- package/esm/react/react-dom-server.d.ts.map +0 -1
- package/esm/react/react-dom-server.js +0 -2
- package/esm/react/react-dom.d.ts +0 -3
- package/esm/react/react-dom.d.ts.map +0 -1
- package/esm/react/react-dom.js +0 -2
- package/esm/react/react.d.ts +0 -6
- package/esm/react/react.d.ts.map +0 -1
- package/esm/react/react.js +0 -7
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { COMPONENT_ERROR } from "../../../errors/error-registry.js";
|
|
3
|
+
export const AgentPickerContext = React.createContext(null);
|
|
4
|
+
/** Read the enclosing `AgentPicker` state. */
|
|
5
|
+
export function useAgentPicker() {
|
|
6
|
+
const context = React.useContext(AgentPickerContext);
|
|
7
|
+
if (!context) {
|
|
8
|
+
throw COMPONENT_ERROR.create({
|
|
9
|
+
detail: "useAgentPicker must be used within an AgentPicker",
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
return context;
|
|
13
|
+
}
|
|
@@ -13,7 +13,11 @@
|
|
|
13
13
|
*
|
|
14
14
|
* @module react/components/chat/agent-picker
|
|
15
15
|
*/
|
|
16
|
-
import * as React from "
|
|
16
|
+
import * as React from "react";
|
|
17
|
+
import { type AgentPickerContextValue, useAgentPicker } from "./agent-picker-context.js";
|
|
18
|
+
import { type AgentPickerActionProps, AgentPickerCreate, AgentPickerManage } from "./agent-picker-actions.js";
|
|
19
|
+
export type { AgentPickerActionProps, AgentPickerContextValue };
|
|
20
|
+
export { useAgentPicker };
|
|
17
21
|
/** A selectable agent entry. */
|
|
18
22
|
export interface AgentOption {
|
|
19
23
|
/** Stable identifier — used as the selection value. */
|
|
@@ -31,15 +35,6 @@ export interface AgentPickerSection {
|
|
|
31
35
|
label?: string;
|
|
32
36
|
agents: AgentOption[];
|
|
33
37
|
}
|
|
34
|
-
/**
|
|
35
|
-
* Icon overrides for {@link AgentPicker}. Each defaults to the built-in glyph.
|
|
36
|
-
*/
|
|
37
|
-
export interface AgentPickerIcons {
|
|
38
|
-
check?: React.ReactNode;
|
|
39
|
-
chevron?: React.ReactNode;
|
|
40
|
-
create?: React.ReactNode;
|
|
41
|
-
more?: React.ReactNode;
|
|
42
|
-
}
|
|
43
38
|
/** Props accepted by `<AgentPicker>`. */
|
|
44
39
|
export interface AgentPickerProps {
|
|
45
40
|
/** Agents shown in the default (top) group. */
|
|
@@ -64,58 +59,53 @@ export interface AgentPickerProps {
|
|
|
64
59
|
isLoading?: boolean;
|
|
65
60
|
/** Additional class names for the trigger. */
|
|
66
61
|
className?: string;
|
|
67
|
-
/** Override any of the picker icons. */
|
|
68
|
-
icons?: AgentPickerIcons;
|
|
69
62
|
/**
|
|
70
63
|
* Compose your own menu from `AgentPicker.Trigger` / `Content` / `List` /
|
|
71
64
|
* `Item`. When omitted, the default data-driven preset is rendered.
|
|
72
65
|
*/
|
|
73
66
|
children?: React.ReactNode;
|
|
74
67
|
}
|
|
75
|
-
/** Shared selection + open state exposed to `AgentPicker.*` sub-parts. */
|
|
76
|
-
export interface AgentPickerContextValue {
|
|
77
|
-
/** Selected agent id. */
|
|
78
|
-
value?: string;
|
|
79
|
-
/** Select an agent by id (also closes the menu). */
|
|
80
|
-
onSelect: (id: string) => void;
|
|
81
|
-
/** Popover open state. */
|
|
82
|
-
open: boolean;
|
|
83
|
-
/** Set the popover open state (notifies `onOpenChange`). */
|
|
84
|
-
setOpen: (open: boolean) => void;
|
|
85
|
-
/** Icon overrides passed to the picker. */
|
|
86
|
-
icons?: AgentPickerIcons;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Read the enclosing `AgentPicker` selection + open state. Throws when used
|
|
90
|
-
* outside an `<AgentPicker>`.
|
|
91
|
-
*/
|
|
92
|
-
export declare function useAgentPicker(): AgentPickerContextValue;
|
|
93
68
|
/** Props for `AgentPicker.Trigger` — the pill/input combobox button. */
|
|
94
69
|
export interface AgentPickerTriggerProps {
|
|
95
70
|
/** Render as an input-style field instead of a pill. */
|
|
96
71
|
inputStyle?: boolean;
|
|
97
72
|
/** Mark the input-style trigger invalid. */
|
|
98
73
|
invalid?: boolean;
|
|
74
|
+
/** Override the trailing chevron glyph. */
|
|
75
|
+
icon?: React.ReactNode;
|
|
99
76
|
/** Override the trigger contents; defaults to the selected agent's row. */
|
|
100
77
|
children?: React.ReactNode;
|
|
101
78
|
className?: string;
|
|
102
79
|
}
|
|
103
80
|
/** The pill (or input-style) combobox trigger. Toggles the popover. */
|
|
104
|
-
declare function AgentPickerTrigger({ inputStyle, invalid, children, className }: AgentPickerTriggerProps): React.ReactElement;
|
|
81
|
+
declare function AgentPickerTrigger({ inputStyle, invalid, icon, children, className }: AgentPickerTriggerProps): React.ReactElement;
|
|
105
82
|
declare namespace AgentPickerTrigger {
|
|
106
83
|
var displayName: string;
|
|
107
84
|
}
|
|
85
|
+
/** Props for `AgentPicker.Search` — the addressable search input leaf. */
|
|
86
|
+
export interface AgentPickerSearchProps {
|
|
87
|
+
/** Search input placeholder. */
|
|
88
|
+
placeholder?: string;
|
|
89
|
+
className?: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The search input row. An addressable leaf so a consumer composing
|
|
93
|
+
* `AgentPicker.Content` can place / restyle / omit it. Reads the filter query
|
|
94
|
+
* state straight from the enclosing `Command` context (via `CommandInput`) —
|
|
95
|
+
* no prop-drilling. This is the same markup `AgentPicker.Content` renders for
|
|
96
|
+
* its default (search-gated) anatomy.
|
|
97
|
+
*/
|
|
98
|
+
declare function AgentPickerSearch({ placeholder, className }: AgentPickerSearchProps): React.ReactElement;
|
|
99
|
+
declare namespace AgentPickerSearch {
|
|
100
|
+
var displayName: string;
|
|
101
|
+
}
|
|
108
102
|
/** Props for `AgentPicker.Content` — the popover surface + `Command` shell. */
|
|
109
103
|
export interface AgentPickerContentProps {
|
|
110
|
-
/** Show the search input above the list. */
|
|
111
|
-
showSearch?: boolean;
|
|
112
|
-
/** Search input placeholder. */
|
|
113
|
-
searchPlaceholder?: string;
|
|
114
104
|
children?: React.ReactNode;
|
|
115
105
|
className?: string;
|
|
116
106
|
}
|
|
117
107
|
/** The popover surface wrapping a `Command` (search + list region). */
|
|
118
|
-
declare function AgentPickerContent({
|
|
108
|
+
declare function AgentPickerContent({ children, className }: AgentPickerContentProps): React.ReactElement;
|
|
119
109
|
declare namespace AgentPickerContent {
|
|
120
110
|
var displayName: string;
|
|
121
111
|
}
|
|
@@ -133,10 +123,12 @@ export interface AgentPickerItemProps {
|
|
|
133
123
|
agent: AgentOption;
|
|
134
124
|
/** Force selected styling; defaults to matching the context `value`. */
|
|
135
125
|
selected?: boolean;
|
|
126
|
+
/** Override the selection-check glyph. */
|
|
127
|
+
icon?: React.ReactNode;
|
|
136
128
|
className?: string;
|
|
137
129
|
}
|
|
138
130
|
/** A single agent row (Avatar + name + selection check). */
|
|
139
|
-
declare function AgentPickerItem({ agent, selected, className }: AgentPickerItemProps): React.ReactElement;
|
|
131
|
+
declare function AgentPickerItem({ agent, selected, icon, className }: AgentPickerItemProps): React.ReactElement;
|
|
140
132
|
declare namespace AgentPickerItem {
|
|
141
133
|
var displayName: string;
|
|
142
134
|
}
|
|
@@ -145,22 +137,23 @@ declare namespace AgentPickerItem {
|
|
|
145
137
|
* renders the default data-driven preset; pass children to recompose from
|
|
146
138
|
* `AgentPicker.Trigger` / `Content` / `List` / `Item`.
|
|
147
139
|
*/
|
|
148
|
-
declare function AgentPickerRoot({ agents, value, onValueChange, sections, onManage, onCreate, onOpenChange, inputStyle, invalid, isLoading, className,
|
|
140
|
+
declare function AgentPickerRoot({ agents, value, onValueChange, sections, onManage, onCreate, onOpenChange, inputStyle, invalid, isLoading, className, children, }: AgentPickerProps): React.ReactElement;
|
|
149
141
|
declare namespace AgentPickerRoot {
|
|
150
142
|
var displayName: string;
|
|
151
143
|
}
|
|
152
144
|
/**
|
|
153
145
|
* AgentPicker — render `<AgentPicker agents={...} .../>` for the default
|
|
154
|
-
* data-driven combobox, or compose `AgentPicker.Trigger
|
|
155
|
-
* `Item` for a custom menu.
|
|
156
|
-
* compose it.
|
|
146
|
+
* data-driven combobox, or compose `AgentPicker.Trigger`, `Content`, `Search`,
|
|
147
|
+
* `List`, `Item`, `Create`, and `Manage` for a custom menu.
|
|
157
148
|
*/
|
|
158
149
|
export declare const AgentPicker: typeof AgentPickerRoot & {
|
|
159
150
|
Root: typeof AgentPickerRoot;
|
|
160
151
|
Trigger: typeof AgentPickerTrigger;
|
|
161
152
|
Content: typeof AgentPickerContent;
|
|
153
|
+
Search: typeof AgentPickerSearch;
|
|
162
154
|
List: typeof AgentPickerList;
|
|
163
155
|
Item: typeof AgentPickerItem;
|
|
156
|
+
Create: typeof AgentPickerCreate;
|
|
157
|
+
Manage: typeof AgentPickerManage;
|
|
164
158
|
};
|
|
165
|
-
export {};
|
|
166
159
|
//# sourceMappingURL=agent-picker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-picker.d.ts","sourceRoot":"","sources":["../../../../../src/src/react/components/chat/agent-picker.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,KAAK,MAAM,
|
|
1
|
+
{"version":3,"file":"agent-picker.d.ts","sourceRoot":"","sources":["../../../../../src/src/react/components/chat/agent-picker.tsx"],"names":[],"mappings":"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"}
|
|
@@ -13,14 +13,16 @@
|
|
|
13
13
|
*
|
|
14
14
|
* @module react/components/chat/agent-picker
|
|
15
15
|
*/
|
|
16
|
-
import * as React from "
|
|
16
|
+
import * as React from "react";
|
|
17
17
|
import { cn } from "./theme.js";
|
|
18
18
|
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from "../ui/command.js";
|
|
19
19
|
import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover.js";
|
|
20
20
|
import { Pill } from "../ui/pill.js";
|
|
21
21
|
import { Avatar } from "../ui/avatar.js";
|
|
22
|
-
import { CheckIcon, ChevronDownIcon
|
|
23
|
-
import {
|
|
22
|
+
import { CheckIcon, ChevronDownIcon } from "../ui/icons/index.js";
|
|
23
|
+
import { AgentPickerContext, useAgentPicker, } from "./agent-picker-context.js";
|
|
24
|
+
import { AgentPickerCreate, AgentPickerManage, } from "./agent-picker-actions.js";
|
|
25
|
+
export { useAgentPicker };
|
|
24
26
|
/** Search box appears once the combined agent count crosses this. */
|
|
25
27
|
const SEARCH_THRESHOLD = 5;
|
|
26
28
|
const LOADING_ROW_WIDTHS = ["w-3/5", "w-3/4", "w-2/3"];
|
|
@@ -48,23 +50,9 @@ function AgentPickerLoadingRows() {
|
|
|
48
50
|
React.createElement("div", { className: "size-5 shrink-0 rounded-full bg-[var(--accent)] animate-pulse" }),
|
|
49
51
|
React.createElement("div", { className: cn("h-3 rounded-md bg-[var(--accent)] animate-pulse", widthClass) }))))));
|
|
50
52
|
}
|
|
51
|
-
const AgentPickerContext = React.createContext(null);
|
|
52
|
-
/**
|
|
53
|
-
* Read the enclosing `AgentPicker` selection + open state. Throws when used
|
|
54
|
-
* outside an `<AgentPicker>`.
|
|
55
|
-
*/
|
|
56
|
-
export function useAgentPicker() {
|
|
57
|
-
const ctx = React.useContext(AgentPickerContext);
|
|
58
|
-
if (!ctx) {
|
|
59
|
-
throw COMPONENT_ERROR.create({
|
|
60
|
-
detail: "useAgentPicker must be used within a AgentPicker",
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
return ctx;
|
|
64
|
-
}
|
|
65
53
|
/** The pill (or input-style) combobox trigger. Toggles the popover. */
|
|
66
|
-
function AgentPickerTrigger({ inputStyle = false, invalid = false, children, className }) {
|
|
67
|
-
const { value
|
|
54
|
+
function AgentPickerTrigger({ inputStyle = false, invalid = false, icon, children, className }) {
|
|
55
|
+
const { value } = useAgentPicker();
|
|
68
56
|
const sections = React.useContext(AgentDataContext);
|
|
69
57
|
const selected = sections ? findAgent(value, sections.agents, sections.sections) : undefined;
|
|
70
58
|
const triggerLabel = selected?.name ?? "Select agent";
|
|
@@ -72,21 +60,29 @@ function AgentPickerTrigger({ inputStyle = false, invalid = false, children, cla
|
|
|
72
60
|
selected && (React.createElement(Avatar, { name: selected.name, avatarSrc: selected.avatarSrc, tone: "muted", "aria-hidden": "true", className: "size-5! bg-[var(--background)]" })),
|
|
73
61
|
React.createElement("span", { className: "min-w-0 truncate" }, triggerLabel),
|
|
74
62
|
inputStyle
|
|
75
|
-
? (
|
|
76
|
-
|
|
77
|
-
: (icons?.chevron ?? React.createElement(ChevronDownIcon, { className: "ml-auto" }))));
|
|
63
|
+
? (icon ?? React.createElement(ChevronDownIcon, { className: "ml-auto size-3.5 opacity-50" }))
|
|
64
|
+
: (icon ?? React.createElement(ChevronDownIcon, { className: "ml-auto" }))));
|
|
78
65
|
const trigger = inputStyle
|
|
79
66
|
? (React.createElement("button", { type: "button", "data-invalid": invalid || undefined, className: cn("flex w-full items-center gap-2.5 rounded-md border border-[var(--input-border)] bg-[var(--input-bg)] h-[50px] px-3 text-base text-[var(--foreground)]", "data-[invalid=true]:border-[var(--status-error)]", className) }, content))
|
|
80
67
|
: (React.createElement(Pill, { className: cn("min-w-0 max-w-full", className) }, content));
|
|
81
68
|
return React.createElement(PopoverTrigger, { asChild: true }, trigger);
|
|
82
69
|
}
|
|
83
70
|
AgentPickerTrigger.displayName = "AgentPicker.Trigger";
|
|
71
|
+
/**
|
|
72
|
+
* The search input row. An addressable leaf so a consumer composing
|
|
73
|
+
* `AgentPicker.Content` can place / restyle / omit it. Reads the filter query
|
|
74
|
+
* state straight from the enclosing `Command` context (via `CommandInput`) —
|
|
75
|
+
* no prop-drilling. This is the same markup `AgentPicker.Content` renders for
|
|
76
|
+
* its default (search-gated) anatomy.
|
|
77
|
+
*/
|
|
78
|
+
function AgentPickerSearch({ placeholder = "Search agents...", className }) {
|
|
79
|
+
return React.createElement(CommandInput, { placeholder: placeholder, className: className });
|
|
80
|
+
}
|
|
81
|
+
AgentPickerSearch.displayName = "AgentPicker.Search";
|
|
84
82
|
/** The popover surface wrapping a `Command` (search + list region). */
|
|
85
|
-
function AgentPickerContent({
|
|
83
|
+
function AgentPickerContent({ children, className }) {
|
|
86
84
|
return (React.createElement(PopoverContent, { align: "start", className: cn("min-w-[280px] p-0! rounded-lg", className) },
|
|
87
|
-
React.createElement(Command, { className: "bg-transparent" },
|
|
88
|
-
showSearch && React.createElement(CommandInput, { placeholder: searchPlaceholder }),
|
|
89
|
-
children)));
|
|
85
|
+
React.createElement(Command, { className: "bg-transparent" }, children)));
|
|
90
86
|
}
|
|
91
87
|
AgentPickerContent.displayName = "AgentPicker.Content";
|
|
92
88
|
/** The scrollable `Command` list region. */
|
|
@@ -95,14 +91,14 @@ function AgentPickerList({ children, className }) {
|
|
|
95
91
|
}
|
|
96
92
|
AgentPickerList.displayName = "AgentPicker.List";
|
|
97
93
|
/** A single agent row (Avatar + name + selection check). */
|
|
98
|
-
function AgentPickerItem({ agent, selected, className }) {
|
|
99
|
-
const { value, onSelect
|
|
94
|
+
function AgentPickerItem({ agent, selected, icon, className }) {
|
|
95
|
+
const { value, onSelect } = useAgentPicker();
|
|
100
96
|
const isSelected = selected ?? agent.id === value;
|
|
101
97
|
return (React.createElement(CommandItem, { value: agent.name, disabled: agent.disabled, onSelect: () => onSelect(agent.id), className: className },
|
|
102
98
|
React.createElement(Avatar, { name: agent.name, avatarSrc: agent.avatarSrc, tone: "muted", "aria-hidden": "true", className: "size-5! bg-[var(--background)]" }),
|
|
103
99
|
React.createElement("span", { className: "min-w-0 flex-1 truncate" }, agent.name),
|
|
104
100
|
isSelected &&
|
|
105
|
-
(
|
|
101
|
+
(icon ?? React.createElement(CheckIcon, { className: "ml-auto opacity-70" }))));
|
|
106
102
|
}
|
|
107
103
|
AgentPickerItem.displayName = "AgentPicker.Item";
|
|
108
104
|
/**
|
|
@@ -112,7 +108,8 @@ AgentPickerItem.displayName = "AgentPicker.Item";
|
|
|
112
108
|
*/
|
|
113
109
|
const AgentDataContext = React.createContext(null);
|
|
114
110
|
/** The default preset body — the data-driven groups + action rows. */
|
|
115
|
-
function AgentPickerPresetBody({ agents, value, sections,
|
|
111
|
+
function AgentPickerPresetBody({ agents, value, sections, isLoading, }) {
|
|
112
|
+
const { onCreate, onManage } = useAgentPicker();
|
|
116
113
|
const hasSectionAgents = sections.some((section) => section.agents.length > 0);
|
|
117
114
|
const showLoading = isLoading && !hasSectionAgents;
|
|
118
115
|
return (React.createElement(React.Fragment, null,
|
|
@@ -121,19 +118,15 @@ function AgentPickerPresetBody({ agents, value, sections, onManage, onCreate, is
|
|
|
121
118
|
showLoading && React.createElement(AgentPickerLoadingRows, null),
|
|
122
119
|
sections.map((section, index) => (React.createElement(CommandGroup, { key: section.label ?? `section-${index}`, heading: section.label }, section.agents.map((agent) => (React.createElement(AgentPickerItem, { key: agent.id, agent: agent, selected: agent.id === value })))))),
|
|
123
120
|
(onCreate || onManage) && (React.createElement(CommandGroup, null,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
"Create Agent")),
|
|
127
|
-
onManage && (React.createElement(CommandItem, { value: "Manage Agents", onSelect: onManage },
|
|
128
|
-
icons?.more ?? React.createElement(SparklesIcon, null),
|
|
129
|
-
"Manage Agents"))))));
|
|
121
|
+
React.createElement(AgentPickerCreate, null),
|
|
122
|
+
React.createElement(AgentPickerManage, null)))));
|
|
130
123
|
}
|
|
131
124
|
/**
|
|
132
125
|
* `AgentPicker.Root` — context provider + the popover shell. No children
|
|
133
126
|
* renders the default data-driven preset; pass children to recompose from
|
|
134
127
|
* `AgentPicker.Trigger` / `Content` / `List` / `Item`.
|
|
135
128
|
*/
|
|
136
|
-
function AgentPickerRoot({ agents, value, onValueChange, sections = [], onManage, onCreate, onOpenChange, inputStyle = false, invalid = false, isLoading = false, className,
|
|
129
|
+
function AgentPickerRoot({ agents, value, onValueChange, sections = [], onManage, onCreate, onOpenChange, inputStyle = false, invalid = false, isLoading = false, className, children, }) {
|
|
137
130
|
const [open, setOpen] = React.useState(false);
|
|
138
131
|
const showSearch = totalAgentCount(agents, sections) > SEARCH_THRESHOLD;
|
|
139
132
|
const handleOpenChange = React.useCallback((nextOpen) => {
|
|
@@ -144,40 +137,56 @@ function AgentPickerRoot({ agents, value, onValueChange, sections = [], onManage
|
|
|
144
137
|
handleOpenChange(false);
|
|
145
138
|
onValueChange?.(id);
|
|
146
139
|
}, [handleOpenChange, onValueChange]);
|
|
147
|
-
const handleManage = () => {
|
|
140
|
+
const handleManage = React.useCallback(() => {
|
|
148
141
|
handleOpenChange(false);
|
|
149
142
|
onManage?.();
|
|
150
|
-
};
|
|
151
|
-
const handleCreate = () => {
|
|
143
|
+
}, [handleOpenChange, onManage]);
|
|
144
|
+
const handleCreate = React.useCallback(() => {
|
|
152
145
|
handleOpenChange(false);
|
|
153
146
|
onCreate?.();
|
|
154
|
-
};
|
|
155
|
-
|
|
147
|
+
}, [handleOpenChange, onCreate]);
|
|
148
|
+
// Memoized so consumers don't re-render on every parent render (F-3). The
|
|
149
|
+
// callbacks are already stable (useCallback above).
|
|
150
|
+
const context = React.useMemo(() => ({
|
|
156
151
|
value,
|
|
157
152
|
onSelect: handleSelect,
|
|
158
153
|
open,
|
|
159
154
|
setOpen: handleOpenChange,
|
|
160
|
-
|
|
161
|
-
|
|
155
|
+
onCreate: onCreate ? handleCreate : undefined,
|
|
156
|
+
onManage: onManage ? handleManage : undefined,
|
|
157
|
+
}), [
|
|
158
|
+
value,
|
|
159
|
+
handleSelect,
|
|
160
|
+
open,
|
|
161
|
+
handleOpenChange,
|
|
162
|
+
onCreate,
|
|
163
|
+
handleCreate,
|
|
164
|
+
onManage,
|
|
165
|
+
handleManage,
|
|
166
|
+
]);
|
|
167
|
+
const agentData = React.useMemo(() => ({ agents, sections }), [agents, sections]);
|
|
162
168
|
return (React.createElement(AgentPickerContext.Provider, { value: context },
|
|
163
|
-
React.createElement(AgentDataContext.Provider, { value:
|
|
169
|
+
React.createElement(AgentDataContext.Provider, { value: agentData },
|
|
164
170
|
React.createElement(Popover, { open: open, onOpenChange: handleOpenChange }, children ?? (React.createElement(React.Fragment, null,
|
|
165
171
|
React.createElement(AgentPickerTrigger, { inputStyle: inputStyle, invalid: invalid, className: className }),
|
|
166
|
-
React.createElement(AgentPickerContent,
|
|
172
|
+
React.createElement(AgentPickerContent, null,
|
|
173
|
+
showSearch && React.createElement(AgentPickerSearch, null),
|
|
167
174
|
React.createElement(AgentPickerList, null,
|
|
168
|
-
React.createElement(AgentPickerPresetBody, { agents: agents, value: value, sections: sections,
|
|
175
|
+
React.createElement(AgentPickerPresetBody, { agents: agents, value: value, sections: sections, isLoading: isLoading })))))))));
|
|
169
176
|
}
|
|
170
177
|
AgentPickerRoot.displayName = "AgentPicker.Root";
|
|
171
178
|
/**
|
|
172
179
|
* AgentPicker — render `<AgentPicker agents={...} .../>` for the default
|
|
173
|
-
* data-driven combobox, or compose `AgentPicker.Trigger
|
|
174
|
-
* `Item` for a custom menu.
|
|
175
|
-
* compose it.
|
|
180
|
+
* data-driven combobox, or compose `AgentPicker.Trigger`, `Content`, `Search`,
|
|
181
|
+
* `List`, `Item`, `Create`, and `Manage` for a custom menu.
|
|
176
182
|
*/
|
|
177
183
|
export const AgentPicker = Object.assign(AgentPickerRoot, {
|
|
178
184
|
Root: AgentPickerRoot,
|
|
179
185
|
Trigger: AgentPickerTrigger,
|
|
180
186
|
Content: AgentPickerContent,
|
|
187
|
+
Search: AgentPickerSearch,
|
|
181
188
|
List: AgentPickerList,
|
|
182
189
|
Item: AgentPickerItem,
|
|
190
|
+
Create: AgentPickerCreate,
|
|
191
|
+
Manage: AgentPickerManage,
|
|
183
192
|
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { ChatProps } from "./chat-props.js";
|
|
3
|
+
/**
|
|
4
|
+
* App-mode `<Chat>` with conversation-thread lifecycle when a
|
|
5
|
+
* `ConversationsProvider` is present: keys by the active id so switching threads
|
|
6
|
+
* remounts `UncontrolledChat` (fresh `useChat` seed), and holds the skeleton
|
|
7
|
+
* while the active thread's messages load from the store. No provider → renders
|
|
8
|
+
* `UncontrolledChat` unchanged.
|
|
9
|
+
*/
|
|
10
|
+
export declare function ConversationBoundChat(props: ChatProps): React.ReactElement;
|
|
11
|
+
export declare namespace ConversationBoundChat {
|
|
12
|
+
var displayName: string;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=app-mode-chat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-mode-chat.d.ts","sourceRoot":"","sources":["../../../../../../src/src/react/components/chat/chat/app-mode-chat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AA2KjD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,SAAS,GAAG,KAAK,CAAC,YAAY,CAY1E;yBAZe,qBAAqB"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useAgentMetadata } from "../../../../agent/react/use-agent-metadata.js";
|
|
3
|
+
import { AgentAvatar } from "./composition/agent-avatar.js";
|
|
4
|
+
import { ChatMessagesSkeleton } from "./components/chat-messages-skeleton.js";
|
|
5
|
+
import { useUpload } from "./hooks/use-upload.js";
|
|
6
|
+
import { useConversationsContextOptional } from "./contexts/conversations-context.js";
|
|
7
|
+
import { useConversationChat } from "./hooks/use-conversation-chat.js";
|
|
8
|
+
import { ControlledChat } from "./controlled-chat.js";
|
|
9
|
+
import { attachmentsToFileParts, hasPendingAttachments } from "./chat-attachments.js";
|
|
10
|
+
/**
|
|
11
|
+
* Map agent-metadata suggestions to `{ label, prompt }`. The chip shows the
|
|
12
|
+
* short `title` ("Triage login issue") while the click sends the full `prompt`
|
|
13
|
+
* ("Triage a customer who cannot sign in after a release.") — so the empty
|
|
14
|
+
* state stays scannable without truncating what the agent actually receives.
|
|
15
|
+
*/
|
|
16
|
+
function agentSuggestionItems(suggestions) {
|
|
17
|
+
const list = suggestions?.suggestions;
|
|
18
|
+
if (!Array.isArray(list))
|
|
19
|
+
return [];
|
|
20
|
+
return list.flatMap((s) => {
|
|
21
|
+
if (s.type !== "prompt" || !("prompt" in s) || !s.prompt)
|
|
22
|
+
return [];
|
|
23
|
+
const title = s.title;
|
|
24
|
+
const label = typeof title === "string" && title.length > 0 ? title : s.prompt;
|
|
25
|
+
return [{ label, prompt: s.prompt }];
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function UncontrolledChat({ agentId, api = "/api/ag-ui", initialMessages, onError, onUpdate, agent: userAgent, suggestions: suggestionsProp, onSuggestionClick, emptyState,
|
|
29
|
+
// Attachments: default-wired through `useUpload` unless the caller
|
|
30
|
+
// controls them. With no `uploadApi`, files inline as base64 `data:` URLs
|
|
31
|
+
// (guest mode — zero backend). Set `uploadApi` to POST to a durable
|
|
32
|
+
// upload endpoint (multipart `file` → `{ url }`) for real users + a project.
|
|
33
|
+
uploadApi, onAttach: userOnAttach, onDrop: userOnDrop, attachments: userAttachments, onRemoveAttachment: userOnRemoveAttachment, ref, ...rest }) {
|
|
34
|
+
// Seed + persistence are the library's job, not app code's: `useConversationChat`
|
|
35
|
+
// does `useChat` + conversation seeding + the persist bridge internally (the
|
|
36
|
+
// §2.3 anti-pattern lifted into a reusable hook). This component stays a dumb
|
|
37
|
+
// presenter of the resulting session.
|
|
38
|
+
const { chat, resolvedAgentId } = useConversationChat({
|
|
39
|
+
api,
|
|
40
|
+
agentId,
|
|
41
|
+
initialMessages,
|
|
42
|
+
onError,
|
|
43
|
+
onUpdate,
|
|
44
|
+
});
|
|
45
|
+
const { agent, error: agentError } = useAgentMetadata(resolvedAgentId);
|
|
46
|
+
// App mode owns the loading signal: from the very first paint until the
|
|
47
|
+
// agent resolves (or errors) we render the skeleton — never flash an idle
|
|
48
|
+
// placeholder first. Keyed off "agent not yet here" rather than the hook's
|
|
49
|
+
// `isLoading` flag so there's no one-frame gap on mount. Works out of the
|
|
50
|
+
// box — no `isLoading` wiring from the consumer.
|
|
51
|
+
const agentInitializing = Boolean(resolvedAgentId) && !agent && !agentError;
|
|
52
|
+
// Agent-driven empty state: avatar + name + description, shown once the
|
|
53
|
+
// agent resolves (the skeleton covers the load, so the generic
|
|
54
|
+
// "What can I help with?" placeholder never flashes). A consumer-supplied
|
|
55
|
+
// `emptyState` still wins.
|
|
56
|
+
const derivedEmptyState = React.useMemo(() => {
|
|
57
|
+
if (emptyState)
|
|
58
|
+
return emptyState;
|
|
59
|
+
if (!agent)
|
|
60
|
+
return undefined;
|
|
61
|
+
return {
|
|
62
|
+
icon: (React.createElement(AgentAvatar, { name: agent.name, avatarUrl: agent.avatarUrl ?? undefined, className: "size-12" })),
|
|
63
|
+
title: agent.name,
|
|
64
|
+
description: agent.description ?? undefined,
|
|
65
|
+
};
|
|
66
|
+
}, [emptyState, agent]);
|
|
67
|
+
// Chips show the short `title`; the click sends the full `prompt`.
|
|
68
|
+
const suggestionItems = React.useMemo(() => agentSuggestionItems(agent?.suggestions), [agent]);
|
|
69
|
+
const derivedSuggestions = suggestionsProp ??
|
|
70
|
+
(suggestionItems.length > 0 ? suggestionItems.map((s) => s.label) : undefined);
|
|
71
|
+
const resolvedAgent = agent || userAgent
|
|
72
|
+
? {
|
|
73
|
+
...(agent
|
|
74
|
+
? {
|
|
75
|
+
name: agent.name,
|
|
76
|
+
avatarUrl: agent.avatarUrl ?? undefined,
|
|
77
|
+
description: agent.description ?? undefined,
|
|
78
|
+
}
|
|
79
|
+
: {}),
|
|
80
|
+
...userAgent,
|
|
81
|
+
}
|
|
82
|
+
: undefined;
|
|
83
|
+
const handleSuggestion = onSuggestionClick ??
|
|
84
|
+
((label) => {
|
|
85
|
+
const item = suggestionItems.find((s) => s.label === label);
|
|
86
|
+
void chat.sendMessage({ text: item?.prompt ?? label });
|
|
87
|
+
});
|
|
88
|
+
// Batteries-included attachments: unless the caller controls them, files
|
|
89
|
+
// uploaded via the `+` menu / drag land here, ride along on submit as
|
|
90
|
+
// `file` parts, and clear once sent.
|
|
91
|
+
const upload = useUpload({ api: uploadApi });
|
|
92
|
+
const attachControlled = userOnAttach !== undefined ||
|
|
93
|
+
userOnDrop !== undefined ||
|
|
94
|
+
userAttachments !== undefined ||
|
|
95
|
+
userOnRemoveAttachment !== undefined;
|
|
96
|
+
const manageAttachments = !attachControlled;
|
|
97
|
+
const submitWithAttachments = React.useCallback((e) => {
|
|
98
|
+
e?.preventDefault();
|
|
99
|
+
if (chat.isLoading)
|
|
100
|
+
return;
|
|
101
|
+
// Never send while a file is still uploading: the fold below only
|
|
102
|
+
// carries resolved urls, so submitting now would silently drop the
|
|
103
|
+
// pending attachment (and `clear()` would abort its upload).
|
|
104
|
+
if (hasPendingAttachments(upload.attachments))
|
|
105
|
+
return;
|
|
106
|
+
const text = chat.input.trim();
|
|
107
|
+
const files = attachmentsToFileParts(upload.attachments);
|
|
108
|
+
if (!text && files.length === 0)
|
|
109
|
+
return;
|
|
110
|
+
chat.setInput("");
|
|
111
|
+
upload.clear();
|
|
112
|
+
void chat.sendMessage({ text, files });
|
|
113
|
+
}, [chat, upload]);
|
|
114
|
+
return (React.createElement(ControlledChat, { ...rest, ref: ref, chat: chat, submit: manageAttachments ? submitWithAttachments : chat.handleSubmit, emptyState: derivedEmptyState, agent: resolvedAgent, initializing: agentInitializing, suggestions: derivedSuggestions, onSuggestionClick: handleSuggestion, onAttach: manageAttachments ? upload.upload : userOnAttach, onDrop: manageAttachments ? upload.upload : userOnDrop, attachments: manageAttachments ? upload.attachments : userAttachments, onRemoveAttachment: manageAttachments ? upload.remove : userOnRemoveAttachment }));
|
|
115
|
+
}
|
|
116
|
+
UncontrolledChat.displayName = "UncontrolledChat";
|
|
117
|
+
/**
|
|
118
|
+
* App-mode `<Chat>` with conversation-thread lifecycle when a
|
|
119
|
+
* `ConversationsProvider` is present: keys by the active id so switching threads
|
|
120
|
+
* remounts `UncontrolledChat` (fresh `useChat` seed), and holds the skeleton
|
|
121
|
+
* while the active thread's messages load from the store. No provider → renders
|
|
122
|
+
* `UncontrolledChat` unchanged.
|
|
123
|
+
*/
|
|
124
|
+
export function ConversationBoundChat(props) {
|
|
125
|
+
const conversations = useConversationsContextOptional();
|
|
126
|
+
if (!conversations || conversations.activeId == null) {
|
|
127
|
+
return React.createElement(UncontrolledChat, { ref: props.ref, ...props });
|
|
128
|
+
}
|
|
129
|
+
const { active, activeId } = conversations;
|
|
130
|
+
// Wait for the active thread's messages before mounting, so `useChat` seeds
|
|
131
|
+
// from the right thread rather than a still-loading one.
|
|
132
|
+
if (active?.id !== activeId) {
|
|
133
|
+
return React.createElement(React.Fragment, null, props.skeleton ?? React.createElement(ChatMessagesSkeleton, null));
|
|
134
|
+
}
|
|
135
|
+
return React.createElement(UncontrolledChat, { key: activeId, ref: props.ref, ...props });
|
|
136
|
+
}
|
|
137
|
+
ConversationBoundChat.displayName = "ConversationBoundChat";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ChatFilePart } from "../../../../agent/react/index.js";
|
|
2
|
+
import type { AttachmentInfo } from "./components/attachment-pill.js";
|
|
3
|
+
/** Map resolved attachments to file message parts. */
|
|
4
|
+
export declare function attachmentsToFileParts(items: AttachmentInfo[]): ChatFilePart[];
|
|
5
|
+
/** Return true while an attachment is still resolving its URL. */
|
|
6
|
+
export declare function hasPendingAttachments(items: AttachmentInfo[]): boolean;
|
|
7
|
+
//# sourceMappingURL=chat-attachments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-attachments.d.ts","sourceRoot":"","sources":["../../../../../../src/src/react/components/chat/chat/chat-attachments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEtE,sDAAsD;AACtD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,YAAY,EAAE,CAU9E;AAED,kEAAkE;AAClE,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,OAAO,CAEtE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Map resolved attachments to file message parts. */
|
|
2
|
+
export function attachmentsToFileParts(items) {
|
|
3
|
+
return items
|
|
4
|
+
.filter((item) => Boolean(item.url))
|
|
5
|
+
.map((item) => ({
|
|
6
|
+
type: "file",
|
|
7
|
+
mediaType: item.type ?? "application/octet-stream",
|
|
8
|
+
url: item.url,
|
|
9
|
+
filename: item.name,
|
|
10
|
+
...(item.size != null ? { size: item.size } : {}),
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
/** Return true while an attachment is still resolving its URL. */
|
|
14
|
+
export function hasPendingAttachments(items) {
|
|
15
|
+
return items.some((item) => item.state === "uploading" || item.state === "processing");
|
|
16
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import type { ChatProps } from "./chat-props.js";
|
|
3
|
+
import type { ChatMessagesSkeleton } from "./components/chat-messages-skeleton.js";
|
|
4
|
+
import type { ChatEmpty } from "./composition/chat-empty.js";
|
|
5
|
+
import type { ChatIf } from "./composition/chat-if.js";
|
|
6
|
+
import type { ChatInput } from "./composition/chat-composer.js";
|
|
7
|
+
import type { ErrorBanner } from "./composition/error-banner.js";
|
|
8
|
+
import type { ChatMessageList } from "./composition/chat-message-list.js";
|
|
9
|
+
import type { ChatRoot } from "./composition/chat-root.js";
|
|
10
|
+
import type { Message } from "./composition/message.js";
|
|
11
|
+
export type ChatComponent = ((props: ChatProps) => React.ReactElement) & {
|
|
12
|
+
Root: typeof ChatRoot;
|
|
13
|
+
MessageList: typeof ChatMessageList;
|
|
14
|
+
Input: typeof ChatInput;
|
|
15
|
+
Empty: typeof ChatEmpty;
|
|
16
|
+
Skeleton: typeof ChatMessagesSkeleton;
|
|
17
|
+
If: typeof ChatIf;
|
|
18
|
+
Message: typeof Message;
|
|
19
|
+
ErrorBanner: typeof ErrorBanner;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=chat-component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-component.d.ts","sourceRoot":"","sources":["../../../../../../src/src/react/components/chat/chat/chat-component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAEpC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAExD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,EAAE,SAAS,KAAK,KAAK,CAAC,YAAY,CAAC,GAAG;IACvE,IAAI,EAAE,OAAO,QAAQ,CAAC;IACtB,WAAW,EAAE,OAAO,eAAe,CAAC;IACpC,KAAK,EAAE,OAAO,SAAS,CAAC;IACxB,KAAK,EAAE,OAAO,SAAS,CAAC;IACxB,QAAQ,EAAE,OAAO,oBAAoB,CAAC;IACtC,EAAE,EAAE,OAAO,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,OAAO,CAAC;IACxB,WAAW,EAAE,OAAO,WAAW,CAAC;CACjC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|