veryfront 0.1.997 → 0.1.998
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 +1 -1
- package/esm/deno.d.ts +7 -0
- package/esm/deno.js +11 -3
- package/esm/deps/esm.sh/react-dom@19.2.4.d.ts +2 -0
- package/esm/deps/esm.sh/react-dom@19.2.4.d.ts.map +1 -0
- package/esm/deps/esm.sh/react-dom@19.2.4.js +3 -0
- package/esm/react/react-dom.d.ts +3 -0
- package/esm/react/react-dom.d.ts.map +1 -0
- package/esm/react/react-dom.js +2 -0
- package/esm/src/agent/ag-ui/host-support.d.ts.map +1 -1
- package/esm/src/agent/ag-ui/host-support.js +12 -0
- package/esm/src/agent/react/index.d.ts +4 -2
- package/esm/src/agent/react/index.d.ts.map +1 -1
- package/esm/src/agent/react/index.js +2 -1
- package/esm/src/agent/react/use-agent-metadata.d.ts +5 -0
- package/esm/src/agent/react/use-agent-metadata.d.ts.map +1 -1
- package/esm/src/agent/react/use-agent-metadata.js +18 -9
- package/esm/src/agent/react/use-agents.d.ts +33 -0
- package/esm/src/agent/react/use-agents.d.ts.map +1 -0
- package/esm/src/agent/react/use-agents.js +72 -0
- package/esm/src/agent/react/use-chat/index.d.ts +1 -1
- package/esm/src/agent/react/use-chat/index.d.ts.map +1 -1
- package/esm/src/agent/react/use-chat/types.d.ts +3 -2
- package/esm/src/agent/react/use-chat/types.d.ts.map +1 -1
- package/esm/src/agent/react/use-chat/use-chat.d.ts +12 -1
- package/esm/src/agent/react/use-chat/use-chat.d.ts.map +1 -1
- package/esm/src/agent/react/use-chat/use-chat.js +47 -7
- package/esm/src/agent/react/use-chat/utils.d.ts.map +1 -1
- package/esm/src/agent/react/use-chat/utils.js +4 -0
- package/esm/src/agent/runtime/message-adapter.d.ts.map +1 -1
- package/esm/src/agent/runtime/message-adapter.js +3 -1
- package/esm/src/agent/runtime/text-generation-runtime-message-converter.d.ts.map +1 -1
- package/esm/src/agent/runtime/text-generation-runtime-message-converter.js +6 -2
- package/esm/src/chat/index.d.ts +17 -7
- package/esm/src/chat/index.d.ts.map +1 -1
- package/esm/src/chat/index.js +33 -7
- package/esm/src/chat/protocol.d.ts +13 -1
- package/esm/src/chat/protocol.d.ts.map +1 -1
- package/esm/src/chat/upload-handler.d.ts +55 -0
- package/esm/src/chat/upload-handler.d.ts.map +1 -0
- package/esm/src/chat/upload-handler.js +180 -0
- package/esm/src/discovery/import-rewriter.d.ts +1 -1
- package/esm/src/discovery/import-rewriter.d.ts.map +1 -1
- package/esm/src/discovery/import-rewriter.js +2 -0
- package/esm/src/discovery/transpiler.d.ts.map +1 -1
- package/esm/src/discovery/transpiler.js +2 -0
- package/esm/src/react/components/chat/agent-card.d.ts +84 -11
- package/esm/src/react/components/chat/agent-card.d.ts.map +1 -1
- package/esm/src/react/components/chat/agent-card.js +151 -57
- package/esm/src/react/components/chat/agent-picker.d.ts +166 -0
- package/esm/src/react/components/chat/agent-picker.d.ts.map +1 -0
- package/esm/src/react/components/chat/agent-picker.js +183 -0
- package/esm/src/react/components/chat/chat/components/animations.js +1 -1
- package/esm/src/react/components/chat/chat/components/attachment-pill.d.ts +125 -3
- 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 +209 -25
- package/esm/src/react/components/chat/chat/components/attachments-panel.d.ts +149 -0
- package/esm/src/react/components/chat/chat/components/attachments-panel.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/components/attachments-panel.js +187 -0
- package/esm/src/react/components/chat/chat/components/branch-picker.d.ts +13 -2
- 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 +6 -8
- package/esm/src/react/components/chat/chat/components/chat-messages-skeleton.d.ts +20 -0
- package/esm/src/react/components/chat/chat/components/chat-messages-skeleton.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/components/chat-messages-skeleton.js +31 -0
- package/esm/src/react/components/chat/chat/components/code-block.d.ts +9 -1
- 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 +14 -6
- package/esm/src/react/components/chat/chat/components/drop-zone.d.ts +11 -4
- 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 +10 -8
- package/esm/src/react/components/chat/chat/components/empty-state.d.ts +2 -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 +7 -8
- package/esm/src/react/components/chat/chat/components/inference-badge.d.ts +6 -2
- 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 +5 -4
- package/esm/src/react/components/chat/chat/components/inline-citation.d.ts +9 -1
- 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 +19 -20
- package/esm/src/react/components/chat/chat/components/message-actions.d.ts +28 -5
- 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 +24 -36
- package/esm/src/react/components/chat/chat/components/message-edit-form.d.ts +7 -2
- 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 +5 -5
- package/esm/src/react/components/chat/chat/components/message-feedback.d.ts +11 -1
- 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 +9 -11
- 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 +3 -1
- package/esm/src/react/components/chat/chat/components/reasoning.d.ts +66 -3
- package/esm/src/react/components/chat/chat/components/reasoning.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/reasoning.js +95 -21
- package/esm/src/react/components/chat/chat/components/sidebar.d.ts +178 -12
- package/esm/src/react/components/chat/chat/components/sidebar.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/sidebar.js +228 -45
- package/esm/src/react/components/chat/chat/components/skill-badge.d.ts +6 -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 +6 -5
- package/esm/src/react/components/chat/chat/components/skill-tool.d.ts +37 -0
- package/esm/src/react/components/chat/chat/components/skill-tool.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/components/skill-tool.js +46 -0
- package/esm/src/react/components/chat/chat/components/sources.d.ts +55 -3
- package/esm/src/react/components/chat/chat/components/sources.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/sources.js +50 -16
- package/esm/src/react/components/chat/chat/components/step-indicator.d.ts +42 -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 +55 -12
- 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 +3 -3
- package/esm/src/react/components/chat/chat/components/tool-ui.d.ts +96 -3
- 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 +158 -36
- package/esm/src/react/components/chat/chat/composition/api.d.ts +4 -2
- package/esm/src/react/components/chat/chat/composition/api.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/api.js +4 -2
- package/esm/src/react/components/chat/chat/composition/chat-composer.d.ts +112 -5
- 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 +251 -61
- package/esm/src/react/components/chat/chat/composition/chat-empty-state.d.ts +78 -0
- package/esm/src/react/components/chat/chat/composition/chat-empty-state.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/composition/chat-empty-state.js +63 -0
- package/esm/src/react/components/chat/chat/composition/chat-empty.d.ts +4 -1
- 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 +11 -10
- package/esm/src/react/components/chat/chat/composition/chat-message-list.d.ts +11 -3
- 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 +81 -111
- package/esm/src/react/components/chat/chat/composition/chat-root.d.ts +4 -0
- 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 -1
- package/esm/src/react/components/chat/chat/composition/error-banner.d.ts +4 -0
- 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 +10 -7
- package/esm/src/react/components/chat/chat/composition/message.d.ts +123 -5
- package/esm/src/react/components/chat/chat/composition/message.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/message.js +332 -53
- package/esm/src/react/components/chat/chat/composition/model-avatar.d.ts +6 -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 +3 -4
- package/esm/src/react/components/chat/chat/composition/pending-message.d.ts +31 -0
- package/esm/src/react/components/chat/chat/composition/pending-message.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/composition/pending-message.js +31 -0
- package/esm/src/react/components/chat/chat/contexts/chat-context.d.ts +4 -0
- package/esm/src/react/components/chat/chat/contexts/chat-context.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/contexts/composer-context.d.ts +1 -0
- package/esm/src/react/components/chat/chat/contexts/composer-context.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/contexts/conversations-context.d.ts +29 -0
- package/esm/src/react/components/chat/chat/contexts/conversations-context.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/contexts/conversations-context.js +39 -0
- 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 +2 -0
- package/esm/src/react/components/chat/chat/contexts/message-context.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/hooks/use-clipboard.d.ts +10 -0
- package/esm/src/react/components/chat/chat/hooks/use-clipboard.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/hooks/use-clipboard.js +34 -0
- package/esm/src/react/components/chat/chat/hooks/use-conversation.d.ts +21 -0
- package/esm/src/react/components/chat/chat/hooks/use-conversation.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/hooks/use-conversation.js +54 -0
- package/esm/src/react/components/chat/chat/hooks/use-conversations.d.ts +67 -0
- package/esm/src/react/components/chat/chat/hooks/use-conversations.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/hooks/use-conversations.js +317 -0
- package/esm/src/react/components/chat/chat/hooks/use-drop-zone.d.ts +27 -0
- package/esm/src/react/components/chat/chat/hooks/use-drop-zone.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/hooks/use-drop-zone.js +50 -0
- package/esm/src/react/components/chat/chat/hooks/use-stick-to-bottom.d.ts +49 -0
- package/esm/src/react/components/chat/chat/hooks/use-stick-to-bottom.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/hooks/use-stick-to-bottom.js +120 -0
- package/esm/src/react/components/chat/chat/hooks/use-upload.d.ts +34 -0
- package/esm/src/react/components/chat/chat/hooks/use-upload.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/hooks/use-upload.js +147 -0
- package/esm/src/react/components/chat/chat/hooks/use-uploads-registry.d.ts +37 -0
- package/esm/src/react/components/chat/chat/hooks/use-uploads-registry.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/hooks/use-uploads-registry.js +178 -0
- package/esm/src/react/components/chat/chat/index.d.ts +171 -31
- package/esm/src/react/components/chat/chat/index.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/index.js +371 -77
- package/esm/src/react/components/chat/chat/persistence/conversation-store.d.ts +63 -0
- package/esm/src/react/components/chat/chat/persistence/conversation-store.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/persistence/conversation-store.js +1 -0
- package/esm/src/react/components/chat/chat/persistence/local-conversation-store.d.ts +13 -0
- package/esm/src/react/components/chat/chat/persistence/local-conversation-store.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/persistence/local-conversation-store.js +102 -0
- package/esm/src/react/components/chat/chat/persistence/memory-conversation-store.d.ts +11 -0
- package/esm/src/react/components/chat/chat/persistence/memory-conversation-store.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/persistence/memory-conversation-store.js +33 -0
- package/esm/src/react/components/chat/chat/utils/message-parts.d.ts +4 -1
- package/esm/src/react/components/chat/chat/utils/message-parts.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/utils/message-parts.js +4 -0
- package/esm/src/react/components/chat/chat-actions.d.ts +164 -0
- package/esm/src/react/components/chat/chat-actions.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat-actions.js +191 -0
- package/esm/src/react/components/chat/chat-agent-picker.d.ts +50 -0
- package/esm/src/react/components/chat/chat-agent-picker.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat-agent-picker.js +40 -0
- package/esm/src/react/components/chat/chat-theme-scope.d.ts +26 -0
- package/esm/src/react/components/chat/chat-theme-scope.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat-theme-scope.js +27 -0
- package/esm/src/react/components/chat/chat-tokens-style.d.ts +21 -0
- package/esm/src/react/components/chat/chat-tokens-style.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat-tokens-style.js +24 -0
- package/esm/src/react/components/chat/chat.d.ts +5 -5
- package/esm/src/react/components/chat/chat.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat.js +5 -5
- package/esm/src/react/components/chat/color-mode.d.ts +46 -0
- package/esm/src/react/components/chat/color-mode.d.ts.map +1 -0
- package/esm/src/react/components/chat/color-mode.js +123 -0
- package/esm/src/react/components/chat/error-boundary.js +2 -2
- package/esm/src/react/components/chat/icons/index.d.ts +8 -0
- package/esm/src/react/components/chat/icons/index.d.ts.map +1 -1
- package/esm/src/react/components/chat/icons/index.js +64 -0
- package/esm/src/react/components/chat/markdown.d.ts +24 -1
- package/esm/src/react/components/chat/markdown.d.ts.map +1 -1
- package/esm/src/react/components/chat/markdown.js +122 -38
- package/esm/src/react/components/chat/model-selector.d.ts +130 -8
- package/esm/src/react/components/chat/model-selector.d.ts.map +1 -1
- package/esm/src/react/components/chat/model-selector.js +148 -121
- package/esm/src/react/components/chat/theme.d.ts +9 -12
- package/esm/src/react/components/chat/theme.d.ts.map +1 -1
- package/esm/src/react/components/chat/theme.js +149 -93
- package/esm/src/react/components/chat/ui/alert.d.ts +30 -0
- package/esm/src/react/components/chat/ui/alert.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/alert.js +35 -0
- package/esm/src/react/components/chat/ui/app-shell.d.ts +155 -0
- package/esm/src/react/components/chat/ui/app-shell.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/app-shell.js +276 -0
- package/esm/src/react/components/chat/ui/avatar.d.ts +24 -0
- package/esm/src/react/components/chat/ui/avatar.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/avatar.js +44 -0
- package/esm/src/react/components/chat/ui/badge.d.ts +24 -0
- package/esm/src/react/components/chat/ui/badge.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/badge.js +30 -0
- package/esm/src/react/components/chat/ui/button.d.ts +44 -0
- package/esm/src/react/components/chat/ui/button.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/button.js +108 -0
- package/esm/src/react/components/chat/ui/card.d.ts +42 -0
- package/esm/src/react/components/chat/ui/card.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/card.js +55 -0
- package/esm/src/react/components/chat/ui/checkbox.d.ts +28 -0
- package/esm/src/react/components/chat/ui/checkbox.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/checkbox.js +36 -0
- package/esm/src/react/components/chat/ui/code-block.d.ts +89 -0
- package/esm/src/react/components/chat/ui/code-block.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/code-block.js +277 -0
- package/esm/src/react/components/chat/ui/collapsible.d.ts +30 -0
- package/esm/src/react/components/chat/ui/collapsible.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/collapsible.js +44 -0
- package/esm/src/react/components/chat/ui/command.d.ts +65 -0
- package/esm/src/react/components/chat/ui/command.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/command.js +121 -0
- package/esm/src/react/components/chat/ui/cva.d.ts +36 -0
- package/esm/src/react/components/chat/ui/cva.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/cva.js +45 -0
- package/esm/src/react/components/chat/ui/dialog.d.ts +55 -0
- package/esm/src/react/components/chat/ui/dialog.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/dialog.js +116 -0
- package/esm/src/react/components/chat/ui/drawer.d.ts +41 -0
- package/esm/src/react/components/chat/ui/drawer.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/drawer.js +92 -0
- package/esm/src/react/components/chat/ui/dropdown-menu.d.ts +63 -0
- package/esm/src/react/components/chat/ui/dropdown-menu.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/dropdown-menu.js +76 -0
- package/esm/src/react/components/chat/ui/file-type.d.ts +26 -0
- package/esm/src/react/components/chat/ui/file-type.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/file-type.js +235 -0
- package/esm/src/react/components/chat/ui/floating.d.ts +29 -0
- package/esm/src/react/components/chat/ui/floating.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/floating.js +90 -0
- package/esm/src/react/components/chat/ui/icon-button.d.ts +19 -0
- package/esm/src/react/components/chat/ui/icon-button.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/icon-button.js +20 -0
- package/esm/src/react/components/chat/ui/index.d.ts +43 -0
- package/esm/src/react/components/chat/ui/index.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/index.js +42 -0
- package/esm/src/react/components/chat/ui/input.d.ts +27 -0
- package/esm/src/react/components/chat/ui/input.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/input.js +41 -0
- package/esm/src/react/components/chat/ui/label.d.ts +29 -0
- package/esm/src/react/components/chat/ui/label.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/label.js +40 -0
- package/esm/src/react/components/chat/ui/list.d.ts +47 -0
- package/esm/src/react/components/chat/ui/list.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/list.js +40 -0
- package/esm/src/react/components/chat/ui/pill.d.ts +26 -0
- package/esm/src/react/components/chat/ui/pill.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/pill.js +39 -0
- package/esm/src/react/components/chat/ui/popover.d.ts +47 -0
- package/esm/src/react/components/chat/ui/popover.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/popover.js +68 -0
- package/esm/src/react/components/chat/ui/progress-bar.d.ts +20 -0
- package/esm/src/react/components/chat/ui/progress-bar.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/progress-bar.js +31 -0
- package/esm/src/react/components/chat/ui/radio.d.ts +25 -0
- package/esm/src/react/components/chat/ui/radio.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/radio.js +29 -0
- package/esm/src/react/components/chat/ui/scroll-fade.d.ts +23 -0
- package/esm/src/react/components/chat/ui/scroll-fade.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/scroll-fade.js +40 -0
- package/esm/src/react/components/chat/ui/select.d.ts +64 -0
- package/esm/src/react/components/chat/ui/select.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/select.js +148 -0
- package/esm/src/react/components/chat/ui/shimmer.d.ts +25 -0
- package/esm/src/react/components/chat/ui/shimmer.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/shimmer.js +24 -0
- package/esm/src/react/components/chat/ui/skeleton.d.ts +14 -0
- package/esm/src/react/components/chat/ui/skeleton.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/skeleton.js +12 -0
- package/esm/src/react/components/chat/ui/slot.d.ts +21 -0
- package/esm/src/react/components/chat/ui/slot.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/slot.js +70 -0
- package/esm/src/react/components/chat/ui/status.d.ts +28 -0
- package/esm/src/react/components/chat/ui/status.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/status.js +23 -0
- package/esm/src/react/components/chat/ui/switch.d.ts +34 -0
- package/esm/src/react/components/chat/ui/switch.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/switch.js +58 -0
- package/esm/src/react/components/chat/ui/tabs.d.ts +44 -0
- package/esm/src/react/components/chat/ui/tabs.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/tabs.js +51 -0
- package/esm/src/react/components/chat/ui/tag.d.ts +22 -0
- package/esm/src/react/components/chat/ui/tag.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/tag.js +27 -0
- package/esm/src/react/components/chat/ui/textarea.d.ts +22 -0
- package/esm/src/react/components/chat/ui/textarea.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/textarea.js +35 -0
- package/esm/src/react/components/chat/ui/tooltip.d.ts +40 -0
- package/esm/src/react/components/chat/ui/tooltip.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/tooltip.js +132 -0
- package/esm/src/react/primitives/input-box.d.ts.map +1 -1
- package/esm/src/react/primitives/input-box.js +17 -4
- package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/framework-candidates.generated.js +9437 -1064
- package/esm/src/server/handlers/dev/projects/html-shell.d.ts +1 -1
- package/esm/src/server/handlers/dev/projects/html-shell.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/projects/html-shell.js +1 -12
- package/esm/src/server/handlers/request/public-agents-list.handler.d.ts +18 -0
- package/esm/src/server/handlers/request/public-agents-list.handler.d.ts.map +1 -0
- package/esm/src/server/handlers/request/public-agents-list.handler.js +44 -0
- package/esm/src/server/runtime-handler/index.d.ts +1 -1
- package/esm/src/server/runtime-handler/index.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/index.js +3 -0
- package/esm/src/studio/bridge/bridge-bundle.generated.d.ts +1 -1
- package/esm/src/studio/bridge/bridge-bundle.generated.d.ts.map +1 -1
- package/esm/src/studio/bridge/bridge-bundle.generated.js +3 -2
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/esm/src/workflow/blob/local-storage.d.ts +32 -0
- package/esm/src/workflow/blob/local-storage.d.ts.map +1 -0
- package/esm/src/workflow/blob/local-storage.js +179 -0
- package/esm/src/workflow/blob/types.d.ts +5 -0
- package/esm/src/workflow/blob/types.d.ts.map +1 -1
- package/esm/src/workflow/blob/veryfront-cloud-storage.d.ts +11 -0
- package/esm/src/workflow/blob/veryfront-cloud-storage.d.ts.map +1 -1
- package/esm/src/workflow/blob/veryfront-cloud-storage.js +36 -0
- package/package.json +5 -1
- package/esm/src/react/components/chat/chat/components/uploads-panel.d.ts +0 -20
- package/esm/src/react/components/chat/chat/components/uploads-panel.d.ts.map +0 -1
- package/esm/src/react/components/chat/chat/components/uploads-panel.js +0 -49
- package/esm/src/react/components/chat/chat/contexts/thread-list-context.d.ts +0 -28
- package/esm/src/react/components/chat/chat/contexts/thread-list-context.d.ts.map +0 -1
- package/esm/src/react/components/chat/chat/contexts/thread-list-context.js +0 -27
- package/esm/src/react/components/chat/chat/hooks/use-threads.d.ts +0 -28
- package/esm/src/react/components/chat/chat/hooks/use-threads.d.ts.map +0 -1
- package/esm/src/react/components/chat/chat/hooks/use-threads.js +0 -151
- package/esm/src/react/components/chat/chat-with-sidebar.d.ts +0 -110
- package/esm/src/react/components/chat/chat-with-sidebar.d.ts.map +0 -1
- package/esm/src/react/components/chat/chat-with-sidebar.js +0 -167
- package/esm/src/react/components/chat/message.d.ts +0 -42
- package/esm/src/react/components/chat/message.d.ts.map +0 -1
- package/esm/src/react/components/chat/message.js +0 -69
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* localConversationStore — the default {@link ConversationStore}, backed by
|
|
3
|
+
* `localStorage`. Layout (matches the pre-adapter thread store, plus a richer
|
|
4
|
+
* index so `list()` never has to read message blobs):
|
|
5
|
+
*
|
|
6
|
+
* `{key}-index` → ConversationSummary[] (what the sidebar renders)
|
|
7
|
+
* `{key}-{id}` → Conversation (full, with messages)
|
|
8
|
+
*
|
|
9
|
+
* Methods are async to satisfy the interface even though localStorage is
|
|
10
|
+
* synchronous — swapping in `idbConversationStore` / `apiConversationStore`
|
|
11
|
+
* needs no caller changes. The backing store is injectable (a Web-Storage-like
|
|
12
|
+
* object) so it's testable and degrades to a no-op on SSR / blocked storage.
|
|
13
|
+
*
|
|
14
|
+
* @module react/components/chat/persistence/local-conversation-store
|
|
15
|
+
*/
|
|
16
|
+
import * as dntShim from "../../../../../../_dnt.shims.js";
|
|
17
|
+
import { isBrowserEnvironment } from "../../../../../platform/compat/runtime.js";
|
|
18
|
+
const DEFAULT_KEY = "vf-conversations";
|
|
19
|
+
const NOOP_STORAGE = {
|
|
20
|
+
getItem: () => null,
|
|
21
|
+
setItem: () => { },
|
|
22
|
+
removeItem: () => { },
|
|
23
|
+
};
|
|
24
|
+
function defaultStorage() {
|
|
25
|
+
if (!isBrowserEnvironment())
|
|
26
|
+
return NOOP_STORAGE;
|
|
27
|
+
try {
|
|
28
|
+
const ls = dntShim.dntGlobalThis.localStorage;
|
|
29
|
+
return ls ?? NOOP_STORAGE;
|
|
30
|
+
}
|
|
31
|
+
catch (_) {
|
|
32
|
+
return NOOP_STORAGE; // access can throw (private mode, no --location, etc.)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function toSummary(c) {
|
|
36
|
+
return {
|
|
37
|
+
id: c.id,
|
|
38
|
+
title: c.title,
|
|
39
|
+
...(c.agentId ? { agentId: c.agentId } : {}),
|
|
40
|
+
messageCount: c.messages.length,
|
|
41
|
+
createdAt: c.createdAt,
|
|
42
|
+
updatedAt: c.updatedAt,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function byNewest(a, b) {
|
|
46
|
+
return b.updatedAt - a.updatedAt;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* localStorage-backed conversation persistence. Pass a `storage` to back it with
|
|
50
|
+
* something else (tests inject an in-memory store); defaults to `localStorage`.
|
|
51
|
+
*/
|
|
52
|
+
export function localConversationStore(storageKey = DEFAULT_KEY, storage = defaultStorage()) {
|
|
53
|
+
const indexKey = `${storageKey}-index`;
|
|
54
|
+
const blobKey = (id) => `${storageKey}-${id}`;
|
|
55
|
+
function readIndex() {
|
|
56
|
+
try {
|
|
57
|
+
const raw = storage.getItem(indexKey);
|
|
58
|
+
if (raw)
|
|
59
|
+
return JSON.parse(raw).sort(byNewest);
|
|
60
|
+
}
|
|
61
|
+
catch (_) { /* expected: corrupted / blocked storage */ }
|
|
62
|
+
return [];
|
|
63
|
+
}
|
|
64
|
+
function writeIndex(summaries) {
|
|
65
|
+
try {
|
|
66
|
+
storage.setItem(indexKey, JSON.stringify(summaries.sort(byNewest)));
|
|
67
|
+
}
|
|
68
|
+
catch (_) { /* expected: quota exceeded or blocked storage */ }
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
list() {
|
|
72
|
+
return Promise.resolve(readIndex());
|
|
73
|
+
},
|
|
74
|
+
load(id) {
|
|
75
|
+
try {
|
|
76
|
+
const raw = storage.getItem(blobKey(id));
|
|
77
|
+
if (raw)
|
|
78
|
+
return Promise.resolve(JSON.parse(raw));
|
|
79
|
+
}
|
|
80
|
+
catch (_) { /* expected: corrupted / blocked storage */ }
|
|
81
|
+
return Promise.resolve(null);
|
|
82
|
+
},
|
|
83
|
+
save(conversation) {
|
|
84
|
+
try {
|
|
85
|
+
storage.setItem(blobKey(conversation.id), JSON.stringify(conversation));
|
|
86
|
+
const summaries = readIndex().filter((s) => s.id !== conversation.id);
|
|
87
|
+
summaries.push(toSummary(conversation));
|
|
88
|
+
writeIndex(summaries);
|
|
89
|
+
}
|
|
90
|
+
catch (_) { /* expected: quota exceeded or blocked storage */ }
|
|
91
|
+
return Promise.resolve();
|
|
92
|
+
},
|
|
93
|
+
delete(id) {
|
|
94
|
+
try {
|
|
95
|
+
storage.removeItem(blobKey(id));
|
|
96
|
+
writeIndex(readIndex().filter((s) => s.id !== id));
|
|
97
|
+
}
|
|
98
|
+
catch (_) { /* expected: blocked storage */ }
|
|
99
|
+
return Promise.resolve();
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* memoryConversationStore — an in-memory {@link ConversationStore}. Useful for
|
|
3
|
+
* tests, SSR, and ephemeral (no-persistence) chats. Holds full conversations in
|
|
4
|
+
* a Map; `list()` derives summaries on demand.
|
|
5
|
+
*
|
|
6
|
+
* @module react/components/chat/persistence/memory-conversation-store
|
|
7
|
+
*/
|
|
8
|
+
import type { Conversation, ConversationStore } from "./conversation-store.js";
|
|
9
|
+
/** In-memory conversation persistence. Optionally seed with initial conversations. */
|
|
10
|
+
export declare function memoryConversationStore(seed?: Conversation[]): ConversationStore;
|
|
11
|
+
//# sourceMappingURL=memory-conversation-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-conversation-store.d.ts","sourceRoot":"","sources":["../../../../../../../src/src/react/components/chat/chat/persistence/memory-conversation-store.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAuB,MAAM,yBAAyB,CAAC;AAapG,sFAAsF;AACtF,wBAAgB,uBAAuB,CAAC,IAAI,GAAE,YAAY,EAAO,GAAG,iBAAiB,CAwBpF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
function toSummary(c) {
|
|
2
|
+
return {
|
|
3
|
+
id: c.id,
|
|
4
|
+
title: c.title,
|
|
5
|
+
...(c.agentId ? { agentId: c.agentId } : {}),
|
|
6
|
+
messageCount: c.messages.length,
|
|
7
|
+
createdAt: c.createdAt,
|
|
8
|
+
updatedAt: c.updatedAt,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
/** In-memory conversation persistence. Optionally seed with initial conversations. */
|
|
12
|
+
export function memoryConversationStore(seed = []) {
|
|
13
|
+
const map = new Map(seed.map((c) => [c.id, c]));
|
|
14
|
+
return {
|
|
15
|
+
list() {
|
|
16
|
+
const summaries = Array.from(map.values(), toSummary).sort((a, b) => b.updatedAt - a.updatedAt);
|
|
17
|
+
return Promise.resolve(summaries);
|
|
18
|
+
},
|
|
19
|
+
load(id) {
|
|
20
|
+
const found = map.get(id);
|
|
21
|
+
// Clone so callers can't mutate stored state through the returned object.
|
|
22
|
+
return Promise.resolve(found ? structuredClone(found) : null);
|
|
23
|
+
},
|
|
24
|
+
save(conversation) {
|
|
25
|
+
map.set(conversation.id, structuredClone(conversation));
|
|
26
|
+
return Promise.resolve();
|
|
27
|
+
},
|
|
28
|
+
delete(id) {
|
|
29
|
+
map.delete(id);
|
|
30
|
+
return Promise.resolve();
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Message Parts Utilities
|
|
3
3
|
* @module react/components/chat/utils/message-parts
|
|
4
4
|
*/
|
|
5
|
-
import type { ChatDynamicToolPart, ChatMessage, ChatMessagePart, ChatToolPart } from "../../../../../agent/react/index.js";
|
|
5
|
+
import type { ChatDynamicToolPart, ChatFilePart, ChatMessage, ChatMessagePart, ChatToolPart } from "../../../../../agent/react/index.js";
|
|
6
6
|
import type { Source } from "../components/sources.js";
|
|
7
7
|
/** Get text content from chat message parts */
|
|
8
8
|
export declare function getTextContent(message: ChatMessage): string;
|
|
@@ -32,6 +32,9 @@ export declare function isReasoningPart(part: ChatMessagePart): part is {
|
|
|
32
32
|
export type PartGroup = {
|
|
33
33
|
type: "text";
|
|
34
34
|
content: string;
|
|
35
|
+
} | {
|
|
36
|
+
type: "file";
|
|
37
|
+
file: ChatFilePart;
|
|
35
38
|
} | {
|
|
36
39
|
type: "tool";
|
|
37
40
|
tool: ChatToolPart | ChatDynamicToolPart;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-parts.d.ts","sourceRoot":"","sources":["../../../../../../../src/src/react/components/chat/chat/utils/message-parts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,YAAY,EACb,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAEvD,+CAA+C;AAC/C,wBAAgB,cAAc,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAE3D;AAED,0DAA0D;AAC1D,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,MAAM,CAQxE;AAED,qCAAqC;AACrC,wBAAgB,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,IAAI,YAAY,GAAG,mBAAmB,CAG5F;AAUD;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,eAAe,EAAE,EACxB,OAAO,EAAE;IAAE,WAAW,EAAE,OAAO,CAAA;CAAE,GAChC,eAAe,EAAE,CAenB;AAQD,oDAAoD;AACpD,wBAAgB,eAAe,CAAC,IAAI,EAAE,YAAY,GAAG,mBAAmB,GAAG,OAAO,CAEjF;AAED,0CAA0C;AAC1C,wBAAgB,eAAe,CAC7B,IAAI,EAAE,eAAe,GACpB,IAAI,IAAI;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,WAAW,GAAG,MAAM,CAAA;CAAE,CAE3E;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,YAAY,GAAG,mBAAmB,CAAA;CAAE,GAC1D;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAE,GACzD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAAC;AAE7D;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"message-parts.d.ts","sourceRoot":"","sources":["../../../../../../../src/src/react/components/chat/chat/utils/message-parts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EACZ,WAAW,EACX,eAAe,EACf,YAAY,EACb,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAEvD,+CAA+C;AAC/C,wBAAgB,cAAc,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAE3D;AAED,0DAA0D;AAC1D,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,MAAM,CAQxE;AAED,qCAAqC;AACrC,wBAAgB,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,IAAI,YAAY,GAAG,mBAAmB,CAG5F;AAUD;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,eAAe,EAAE,EACxB,OAAO,EAAE;IAAE,WAAW,EAAE,OAAO,CAAA;CAAE,GAChC,eAAe,EAAE,CAenB;AAQD,oDAAoD;AACpD,wBAAgB,eAAe,CAAC,IAAI,EAAE,YAAY,GAAG,mBAAmB,GAAG,OAAO,CAEjF;AAED,0CAA0C;AAC1C,wBAAgB,eAAe,CAC7B,IAAI,EAAE,eAAe,GACpB,IAAI,IAAI;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,WAAW,GAAG,MAAM,CAAA;CAAE,CAE3E;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,YAAY,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,YAAY,GAAG,mBAAmB,CAAA;CAAE,GAC1D;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAE,GACzD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAAC;AAE7D;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,SAAS,EAAE,CAuDvE;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,MAAM,EAAE,CAiC1E"}
|
|
@@ -84,6 +84,10 @@ export function groupPartsInOrder(parts) {
|
|
|
84
84
|
continue;
|
|
85
85
|
}
|
|
86
86
|
flushText();
|
|
87
|
+
if (part.type === "file") {
|
|
88
|
+
groups.push({ type: "file", file: part });
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
87
91
|
if (isToolPart(part)) {
|
|
88
92
|
groups.push({ type: "tool", tool: part });
|
|
89
93
|
continue;
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import * as React from "../../../../react/react.js";
|
|
2
|
+
/** The two toggle settings surfaced in the Settings submenu (forked from Studio). */
|
|
3
|
+
export interface ChatActionsSettings {
|
|
4
|
+
/** "Auto-send queue" — send queued messages automatically. */
|
|
5
|
+
autoSubmit: boolean;
|
|
6
|
+
/** "Autofix errors" — attempt to fix errors automatically. */
|
|
7
|
+
autoFixErrors: boolean;
|
|
8
|
+
/** Called with the next value when "Auto-send queue" is toggled. */
|
|
9
|
+
onAutoSubmitChange: (value: boolean) => void;
|
|
10
|
+
/** Called with the next value when "Autofix errors" is toggled. */
|
|
11
|
+
onAutoFixErrorsChange: (value: boolean) => void;
|
|
12
|
+
}
|
|
13
|
+
/** A single data-driven action row in the `<ChatActions>` menu. */
|
|
14
|
+
export interface ChatActionItem {
|
|
15
|
+
/** Stable key. */
|
|
16
|
+
id?: string;
|
|
17
|
+
/** Leading icon. */
|
|
18
|
+
icon?: React.ReactNode;
|
|
19
|
+
/** Row label. */
|
|
20
|
+
label: string;
|
|
21
|
+
/** Native title/tooltip. */
|
|
22
|
+
title?: string;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
onSelect: () => void;
|
|
25
|
+
}
|
|
26
|
+
/** Props accepted by `<ChatActions>` / `<ChatActions.Root>`. */
|
|
27
|
+
export interface ChatActionsProps {
|
|
28
|
+
/**
|
|
29
|
+
* Menu rows — fully data-driven, so callers own every action (no hardcoded
|
|
30
|
+
* app-specific rows like "Attach Figma"). Rows render in order. Consumed by
|
|
31
|
+
* the default preset (ignored when you pass your own `children`).
|
|
32
|
+
*/
|
|
33
|
+
actions?: ChatActionItem[];
|
|
34
|
+
/** Selecting "Attach Files or Photos" — a convenience built-in row. Hidden when omitted. */
|
|
35
|
+
onAttachFiles?: () => void;
|
|
36
|
+
/** Label for the built-in attach row. @default "Attach Files or Photos" */
|
|
37
|
+
attachFilesLabel?: string;
|
|
38
|
+
/** Settings submenu toggles. Submenu is hidden when omitted. */
|
|
39
|
+
settings?: ChatActionsSettings;
|
|
40
|
+
/**
|
|
41
|
+
* Custom trigger. Rendered via `asChild`, so it must forward props to a
|
|
42
|
+
* single focusable element. Defaults to a `+` Button.
|
|
43
|
+
*/
|
|
44
|
+
trigger?: React.ReactNode;
|
|
45
|
+
/** Controlled open state of the top-level menu. */
|
|
46
|
+
open?: boolean;
|
|
47
|
+
/** Uncontrolled initial open state. */
|
|
48
|
+
defaultOpen?: boolean;
|
|
49
|
+
/** Fired when the top-level menu opens or closes. */
|
|
50
|
+
onOpenChange?: (open: boolean) => void;
|
|
51
|
+
/** Extra classes for the menu surface. */
|
|
52
|
+
className?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Compose your own menu from `ChatActions.Trigger` / `Content` / `Item`; when
|
|
55
|
+
* omitted, the data-driven preset (attach row + `actions` + `settings`) is
|
|
56
|
+
* rendered. Presence over booleans — pass children, own the anatomy.
|
|
57
|
+
*/
|
|
58
|
+
children?: React.ReactNode;
|
|
59
|
+
}
|
|
60
|
+
/** Shared state exposed to `ChatActions.*` sub-parts via `useChatActions()`. */
|
|
61
|
+
export interface ChatActionsContextValue {
|
|
62
|
+
/** The data-driven rows passed to the preset (empty when composed). */
|
|
63
|
+
actions: ChatActionItem[];
|
|
64
|
+
/** The `onAttachFiles` callback, if any. */
|
|
65
|
+
onAttachFiles?: () => void;
|
|
66
|
+
/** Resolved label for the built-in attach row. */
|
|
67
|
+
attachFilesLabel: string;
|
|
68
|
+
/** The settings submenu config, if any. */
|
|
69
|
+
settings?: ChatActionsSettings;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Read the enclosing `ChatActions` state. Throws when used outside a
|
|
73
|
+
* `ChatActions` — a misplaced sub-part is a loud error, never a silent null.
|
|
74
|
+
*/
|
|
75
|
+
export declare function useChatActions(): ChatActionsContextValue;
|
|
76
|
+
/**
|
|
77
|
+
* `ChatActions.Root` — the `DropdownMenu` wrapper + context provider. No
|
|
78
|
+
* children renders the default preset (`Trigger` + `Content` with the attach
|
|
79
|
+
* row, `actions`, and `settings` submenu); pass children to recompose. Portals
|
|
80
|
+
* its surface via `Floating` (DropdownMenu) so it never clips inside the
|
|
81
|
+
* composer or a Storybook iframe.
|
|
82
|
+
*/
|
|
83
|
+
declare function ChatActionsRoot({ actions, onAttachFiles, attachFilesLabel, settings, trigger, open, defaultOpen, onOpenChange, className, children, }: ChatActionsProps): React.ReactElement;
|
|
84
|
+
declare namespace ChatActionsRoot {
|
|
85
|
+
var displayName: string;
|
|
86
|
+
}
|
|
87
|
+
/** Props for `ChatActions.Trigger` — the menu's trigger button. */
|
|
88
|
+
export interface ChatActionsTriggerProps {
|
|
89
|
+
/**
|
|
90
|
+
* Custom trigger element, rendered via `asChild`. Defaults to the `+` Button.
|
|
91
|
+
* (Back-compat: `ChatActions`'s `trigger` prop maps here.)
|
|
92
|
+
*/
|
|
93
|
+
children?: React.ReactNode;
|
|
94
|
+
className?: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* `ChatActions.Trigger` — the `+` button that opens the menu. Rendered via the
|
|
98
|
+
* DropdownMenu's `asChild`, so a custom child must forward props to one
|
|
99
|
+
* focusable element. `className` merges onto the default `+` Button.
|
|
100
|
+
*/
|
|
101
|
+
declare function ChatActionsTrigger({ children, className }: ChatActionsTriggerProps): React.ReactElement;
|
|
102
|
+
declare namespace ChatActionsTrigger {
|
|
103
|
+
var displayName: string;
|
|
104
|
+
}
|
|
105
|
+
/** Props for `ChatActions.Content` — the dropdown surface. */
|
|
106
|
+
export interface ChatActionsContentProps {
|
|
107
|
+
children?: React.ReactNode;
|
|
108
|
+
/** Horizontal alignment relative to the trigger. @default "start" */
|
|
109
|
+
align?: "start" | "end";
|
|
110
|
+
className?: string;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* `ChatActions.Content` — the portalled dropdown surface. Pass `ChatActions.Item`
|
|
114
|
+
* children (or your own rows). `className` merges onto the menu surface.
|
|
115
|
+
*/
|
|
116
|
+
declare function ChatActionsContent({ children, align, className }: ChatActionsContentProps): React.ReactElement;
|
|
117
|
+
declare namespace ChatActionsContent {
|
|
118
|
+
var displayName: string;
|
|
119
|
+
}
|
|
120
|
+
/** Props for `ChatActions.Item` — a single selectable menu row. */
|
|
121
|
+
export interface ChatActionsItemProps {
|
|
122
|
+
children?: React.ReactNode;
|
|
123
|
+
/** Leading icon. */
|
|
124
|
+
icon?: React.ReactNode;
|
|
125
|
+
/** Called when the row is chosen (also closes the menu). */
|
|
126
|
+
onSelect?: () => void;
|
|
127
|
+
/** Native title/tooltip. */
|
|
128
|
+
title?: string;
|
|
129
|
+
disabled?: boolean;
|
|
130
|
+
className?: string;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* `ChatActions.Item` — a single action row. Wraps `DropdownMenuItem` (so it
|
|
134
|
+
* closes the menu on select). `className` merges onto the row.
|
|
135
|
+
*/
|
|
136
|
+
declare function ChatActionsItem({ children, icon, onSelect, title, disabled, className }: ChatActionsItemProps): React.ReactElement;
|
|
137
|
+
declare namespace ChatActionsItem {
|
|
138
|
+
var displayName: string;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* `ChatActions.Preset` — the default menu body (attach row + `actions` +
|
|
142
|
+
* `settings` submenu), driven from `useChatActions()`. Rendered by the preset
|
|
143
|
+
* path; also exported so a composed `ChatActions.Content` can drop the whole
|
|
144
|
+
* data-driven body back in alongside custom rows.
|
|
145
|
+
*/
|
|
146
|
+
declare function ChatActionsPreset(): React.ReactElement;
|
|
147
|
+
declare namespace ChatActionsPreset {
|
|
148
|
+
var displayName: string;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* ChatActions — render `<ChatActions onAttachFiles={…} actions={…} />` for the
|
|
152
|
+
* default preset menu, or compose `ChatActions.Trigger` / `Content` / `Item`
|
|
153
|
+
* (each reads `useChatActions()`) for a custom menu. Mirrors the `ToolCall`
|
|
154
|
+
* compound: render it, or compose it.
|
|
155
|
+
*/
|
|
156
|
+
export declare const ChatActions: typeof ChatActionsRoot & {
|
|
157
|
+
Root: typeof ChatActionsRoot;
|
|
158
|
+
Trigger: typeof ChatActionsTrigger;
|
|
159
|
+
Content: typeof ChatActionsContent;
|
|
160
|
+
Item: typeof ChatActionsItem;
|
|
161
|
+
Preset: typeof ChatActionsPreset;
|
|
162
|
+
};
|
|
163
|
+
export {};
|
|
164
|
+
//# sourceMappingURL=chat-actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-actions.d.ts","sourceRoot":"","sources":["../../../../../src/src/react/components/chat/chat-actions.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,KAAK,MAAM,4BAA4B,CAAC;AAqEpD,qFAAqF;AACrF,MAAM,WAAW,mBAAmB;IAClC,8DAA8D;IAC9D,UAAU,EAAE,OAAO,CAAC;IACpB,8DAA8D;IAC9D,aAAa,EAAE,OAAO,CAAC;IACvB,oEAAoE;IACpE,kBAAkB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,mEAAmE;IACnE,qBAAqB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACjD;AA+HD,mEAAmE;AACnE,MAAM,WAAW,cAAc;IAC7B,kBAAkB;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,oBAAoB;IACpB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,gEAAgE;AAChE,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B,4FAA4F;IAC5F,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,2EAA2E;IAC3E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gEAAgE;IAChE,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B;;;OAGG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,mDAAmD;IACnD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uCAAuC;IACvC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,qDAAqD;IACrD,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAgBD,gFAAgF;AAChF,MAAM,WAAW,uBAAuB;IACtC,uEAAuE;IACvE,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,4CAA4C;IAC5C,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,kDAAkD;IAClD,gBAAgB,EAAE,MAAM,CAAC;IACzB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,mBAAmB,CAAC;CAChC;AAMD;;;GAGG;AACH,wBAAgB,cAAc,IAAI,uBAAuB,CAQxD;AAED;;;;;;GAMG;AACH,iBAAS,eAAe,CAAC,EACvB,OAAO,EACP,aAAa,EACb,gBAA2C,EAC3C,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,WAAW,EACX,YAAY,EACZ,SAAS,EACT,QAAQ,GACT,EAAE,gBAAgB,GAAG,KAAK,CAAC,YAAY,CAyBvC;kBApCQ,eAAe;;;AAuCxB,mEAAmE;AACnE,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,iBAAS,kBAAkB,CACzB,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,uBAAuB,GAC/C,KAAK,CAAC,YAAY,CAgBpB;kBAlBQ,kBAAkB;;;AAqB3B,8DAA8D;AAC9D,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,qEAAqE;IACrE,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,iBAAS,kBAAkB,CACzB,EAAE,QAAQ,EAAE,KAAe,EAAE,SAAS,EAAE,EAAE,uBAAuB,GAChE,KAAK,CAAC,YAAY,CAMpB;kBARQ,kBAAkB;;;AAW3B,mEAAmE;AACnE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,oBAAoB;IACpB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,4BAA4B;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,iBAAS,eAAe,CACtB,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,oBAAoB,GAC7E,KAAK,CAAC,YAAY,CAYpB;kBAdQ,eAAe;;;AAiBxB;;;;;GAKG;AACH,iBAAS,iBAAiB,IAAI,KAAK,CAAC,YAAY,CAiC/C;kBAjCQ,iBAAiB;;;AAoC1B;;;;;GAKG;AACH,eAAO,MAAM,WAAW;;;;;;CAMtB,CAAC"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ChatActions — the composer's `+` menu, forked dependency-light 1:1 from
|
|
3
|
+
* Studio's `PromptMenuContent`. A DropdownMenu with the built-in attach rows
|
|
4
|
+
* ("Attach Files or Photos", "Attach Figma File") and a "Settings" submenu of
|
|
5
|
+
* toggle rows (auto-send queue, autofix errors).
|
|
6
|
+
*
|
|
7
|
+
* Studio composes `PromptMenuContent` *inside* a caller-owned `DropdownMenu`;
|
|
8
|
+
* here `ChatActions` is the whole self-contained menu (trigger + content) so it
|
|
9
|
+
* drops into a composer with a small, focused prop surface.
|
|
10
|
+
*
|
|
11
|
+
* Notes vs Studio:
|
|
12
|
+
* - No `@radix-ui/*`, no `class-variance-authority`, no `@/` imports, no
|
|
13
|
+
* licensed fonts / motion — the logic is forked onto our `chat/ui` primitives.
|
|
14
|
+
* - Our `dropdown-menu.tsx` has NO submenu primitive (radix `Sub*`), so the
|
|
15
|
+
* Settings submenu is a nested `DropdownMenu` anchored to its trigger row and
|
|
16
|
+
* portalled via `Floating` (same overlay pattern), aligned to the side.
|
|
17
|
+
* - Icons render a half-step smaller than Studio (`size-4` → `size-3.5`), and
|
|
18
|
+
* the Figma / Settings / ChevronRight glyphs are inlined here (not in the
|
|
19
|
+
* shared icons barrel).
|
|
20
|
+
*
|
|
21
|
+
* @module react/components/chat/chat-actions
|
|
22
|
+
*/
|
|
23
|
+
import * as dntShim from "../../../../_dnt.shims.js";
|
|
24
|
+
import * as React from "../../../../react/react.js";
|
|
25
|
+
import { cn } from "./theme.js";
|
|
26
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from "./ui/dropdown-menu.js";
|
|
27
|
+
import { Switch } from "./ui/switch.js";
|
|
28
|
+
import { Floating } from "./ui/floating.js";
|
|
29
|
+
import { Button } from "./ui/button.js";
|
|
30
|
+
import { PaperclipIcon, PlusIcon } from "./icons/index.js";
|
|
31
|
+
import { COMPONENT_ERROR } from "../../../errors/error-registry.js";
|
|
32
|
+
/* -------------------------------------------------------------------------------------------------
|
|
33
|
+
* Inlined icons — Figma / Settings / ChevronRight are not in the shared icons
|
|
34
|
+
* barrel; kept local so this component adds no shared-file edits. Match the
|
|
35
|
+
* `size-3.5` half-step and `currentColor` stroke of the barrel icons.
|
|
36
|
+
* -------------------------------------------------------------------------------------------------*/
|
|
37
|
+
function GlyphSvg({ className, children, }) {
|
|
38
|
+
return (React.createElement("svg", { className: cn("size-3.5", className), viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true" }, children));
|
|
39
|
+
}
|
|
40
|
+
function SettingsGlyph({ className }) {
|
|
41
|
+
return (React.createElement(GlyphSvg, { className: className },
|
|
42
|
+
React.createElement("path", { d: "M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" }),
|
|
43
|
+
React.createElement("circle", { cx: "12", cy: "12", r: "3" })));
|
|
44
|
+
}
|
|
45
|
+
function ChevronRightGlyph({ className }) {
|
|
46
|
+
return (React.createElement(GlyphSvg, { className: className },
|
|
47
|
+
React.createElement("polyline", { points: "9 18 15 12 9 6" })));
|
|
48
|
+
}
|
|
49
|
+
/** A toggle row inside the Settings submenu — label left, switch right. */
|
|
50
|
+
function SettingsToggleRow({ label, checked, onCheckedChange, }) {
|
|
51
|
+
return (React.createElement("label", { className: "relative flex w-full cursor-pointer select-none items-center gap-2.5 rounded-md px-3 h-[36px] text-base font-normal text-left text-[var(--foreground)] transition-colors hover:bg-[var(--tertiary)] dark:hover:bg-[var(--accent)]" },
|
|
52
|
+
React.createElement("span", null, label),
|
|
53
|
+
React.createElement("span", { className: "ml-auto" },
|
|
54
|
+
React.createElement(Switch, { size: "sm", checked: checked, onCheckedChange: onCheckedChange }))));
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The "Settings" row + its nested submenu (a portalled `Floating` popover).
|
|
58
|
+
*
|
|
59
|
+
* The submenu is portalled to `document.body`, so it is NOT a DOM descendant of
|
|
60
|
+
* the row — moving the pointer from the row into the submenu would fire the
|
|
61
|
+
* row's `onMouseLeave` and close it before the mouse arrives. Two fixes:
|
|
62
|
+
* 1. **Close delay** — leaving the row schedules a close after a short grace
|
|
63
|
+
* period; entering the submenu (or re-entering the row) cancels it. This
|
|
64
|
+
* is the standard "safe transit" technique (a lighter cousin of Radix's
|
|
65
|
+
* pointer-safe-triangle).
|
|
66
|
+
* 2. **stopPropagation on the submenu's pointer-down** — the parent menu
|
|
67
|
+
* dismisses on outside pointer-down; without this, toggling a switch in
|
|
68
|
+
* the (portalled, "outside") submenu would collapse the whole menu.
|
|
69
|
+
*/
|
|
70
|
+
function SettingsSubmenu({ settings, }) {
|
|
71
|
+
const [open, setOpen] = React.useState(false);
|
|
72
|
+
const rowRef = React.useRef(null);
|
|
73
|
+
const closeTimer = React.useRef(null);
|
|
74
|
+
const cancelClose = React.useCallback(() => {
|
|
75
|
+
if (closeTimer.current) {
|
|
76
|
+
clearTimeout(closeTimer.current);
|
|
77
|
+
closeTimer.current = null;
|
|
78
|
+
}
|
|
79
|
+
}, []);
|
|
80
|
+
const openNow = React.useCallback(() => {
|
|
81
|
+
cancelClose();
|
|
82
|
+
setOpen(true);
|
|
83
|
+
}, [cancelClose]);
|
|
84
|
+
const scheduleClose = React.useCallback(() => {
|
|
85
|
+
cancelClose();
|
|
86
|
+
closeTimer.current = dntShim.setTimeout(() => setOpen(false), 160);
|
|
87
|
+
}, [cancelClose]);
|
|
88
|
+
React.useEffect(() => cancelClose, [cancelClose]);
|
|
89
|
+
return (React.createElement("div", { ref: rowRef, className: "relative", onMouseEnter: openNow, onMouseLeave: scheduleClose },
|
|
90
|
+
React.createElement("button", { type: "button", role: "menuitem", "aria-haspopup": "menu", "aria-expanded": open, onClick: () => (open ? scheduleClose() : openNow()), className: cn("relative flex w-full cursor-pointer select-none items-center gap-2.5 rounded-md px-3 h-[36px] text-base font-normal text-left text-[var(--foreground)] outline-none transition-colors", "hover:bg-[var(--tertiary)] focus:bg-[var(--tertiary)] dark:hover:bg-[var(--accent)] dark:focus:bg-[var(--accent)]", "[&_svg]:size-3.5 [&_svg]:shrink-0", open && "bg-[var(--tertiary)] dark:bg-[var(--accent)]") },
|
|
91
|
+
React.createElement(SettingsGlyph, null),
|
|
92
|
+
"Settings",
|
|
93
|
+
React.createElement(ChevronRightGlyph, { className: "ml-auto" })),
|
|
94
|
+
React.createElement(Floating, { anchorRef: rowRef, open: open, align: "end", onDismiss: () => setOpen(false), role: "menu", onMouseEnter: openNow, onMouseLeave: scheduleClose, onPointerDownCapture: (e) => e.stopPropagation(), className: "z-50 min-w-[240px] overflow-hidden rounded-lg bg-[var(--popover)] p-2.5 shadow-sm outline-none" },
|
|
95
|
+
React.createElement("div", { "aria-hidden": "true", className: "absolute -top-2 right-0 left-0 h-2" }),
|
|
96
|
+
React.createElement(SettingsToggleRow, { label: "Auto-send queue", checked: settings.autoSubmit, onCheckedChange: settings.onAutoSubmitChange }),
|
|
97
|
+
React.createElement(SettingsToggleRow, { label: "Autofix errors", checked: settings.autoFixErrors, onCheckedChange: settings.onAutoFixErrorsChange }))));
|
|
98
|
+
}
|
|
99
|
+
const ChatActionsContext = React.createContext(null);
|
|
100
|
+
/**
|
|
101
|
+
* Read the enclosing `ChatActions` state. Throws when used outside a
|
|
102
|
+
* `ChatActions` — a misplaced sub-part is a loud error, never a silent null.
|
|
103
|
+
*/
|
|
104
|
+
export function useChatActions() {
|
|
105
|
+
const ctx = React.useContext(ChatActionsContext);
|
|
106
|
+
if (!ctx) {
|
|
107
|
+
throw COMPONENT_ERROR.create({
|
|
108
|
+
detail: "useChatActions must be used within a ChatActions",
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
return ctx;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* `ChatActions.Root` — the `DropdownMenu` wrapper + context provider. No
|
|
115
|
+
* children renders the default preset (`Trigger` + `Content` with the attach
|
|
116
|
+
* row, `actions`, and `settings` submenu); pass children to recompose. Portals
|
|
117
|
+
* its surface via `Floating` (DropdownMenu) so it never clips inside the
|
|
118
|
+
* composer or a Storybook iframe.
|
|
119
|
+
*/
|
|
120
|
+
function ChatActionsRoot({ actions, onAttachFiles, attachFilesLabel = "Attach Files or Photos", settings, trigger, open, defaultOpen, onOpenChange, className, children, }) {
|
|
121
|
+
const context = {
|
|
122
|
+
actions: actions ?? [],
|
|
123
|
+
onAttachFiles,
|
|
124
|
+
attachFilesLabel,
|
|
125
|
+
settings,
|
|
126
|
+
};
|
|
127
|
+
return (React.createElement(ChatActionsContext.Provider, { value: context },
|
|
128
|
+
React.createElement(DropdownMenu, { open: open, defaultOpen: defaultOpen, onOpenChange: onOpenChange }, children ?? (React.createElement(React.Fragment, null,
|
|
129
|
+
React.createElement(ChatActionsTrigger, null, trigger),
|
|
130
|
+
React.createElement(ChatActionsContent, { className: className },
|
|
131
|
+
React.createElement(ChatActionsPreset, null)))))));
|
|
132
|
+
}
|
|
133
|
+
ChatActionsRoot.displayName = "ChatActions.Root";
|
|
134
|
+
/**
|
|
135
|
+
* `ChatActions.Trigger` — the `+` button that opens the menu. Rendered via the
|
|
136
|
+
* DropdownMenu's `asChild`, so a custom child must forward props to one
|
|
137
|
+
* focusable element. `className` merges onto the default `+` Button.
|
|
138
|
+
*/
|
|
139
|
+
function ChatActionsTrigger({ children, className }) {
|
|
140
|
+
return (React.createElement(DropdownMenuTrigger, { asChild: true }, children ?? (React.createElement(Button, { type: "button", variant: "icon-tertiary", size: "icon-lg", "aria-label": "Add attachments and settings", className: cn("shrink-0", className) },
|
|
141
|
+
React.createElement(PlusIcon, null)))));
|
|
142
|
+
}
|
|
143
|
+
ChatActionsTrigger.displayName = "ChatActions.Trigger";
|
|
144
|
+
/**
|
|
145
|
+
* `ChatActions.Content` — the portalled dropdown surface. Pass `ChatActions.Item`
|
|
146
|
+
* children (or your own rows). `className` merges onto the menu surface.
|
|
147
|
+
*/
|
|
148
|
+
function ChatActionsContent({ children, align = "start", className }) {
|
|
149
|
+
return (React.createElement(DropdownMenuContent, { align: align, className: className }, children));
|
|
150
|
+
}
|
|
151
|
+
ChatActionsContent.displayName = "ChatActions.Content";
|
|
152
|
+
/**
|
|
153
|
+
* `ChatActions.Item` — a single action row. Wraps `DropdownMenuItem` (so it
|
|
154
|
+
* closes the menu on select). `className` merges onto the row.
|
|
155
|
+
*/
|
|
156
|
+
function ChatActionsItem({ children, icon, onSelect, title, disabled, className }) {
|
|
157
|
+
return (React.createElement(DropdownMenuItem, { onSelect: onSelect, title: title, disabled: disabled, className: className },
|
|
158
|
+
icon,
|
|
159
|
+
children));
|
|
160
|
+
}
|
|
161
|
+
ChatActionsItem.displayName = "ChatActions.Item";
|
|
162
|
+
/**
|
|
163
|
+
* `ChatActions.Preset` — the default menu body (attach row + `actions` +
|
|
164
|
+
* `settings` submenu), driven from `useChatActions()`. Rendered by the preset
|
|
165
|
+
* path; also exported so a composed `ChatActions.Content` can drop the whole
|
|
166
|
+
* data-driven body back in alongside custom rows.
|
|
167
|
+
*/
|
|
168
|
+
function ChatActionsPreset() {
|
|
169
|
+
const { actions, onAttachFiles, attachFilesLabel, settings } = useChatActions();
|
|
170
|
+
const hasAttach = Boolean(onAttachFiles || actions.length > 0);
|
|
171
|
+
return (React.createElement(React.Fragment, null,
|
|
172
|
+
onAttachFiles && (React.createElement(ChatActionsItem, { onSelect: onAttachFiles, title: "Attach files or photos to chat", icon: React.createElement(PaperclipIcon, null) }, attachFilesLabel)),
|
|
173
|
+
actions.map((action, i) => (React.createElement(ChatActionsItem, { key: action.id ?? `${action.label}-${i}`, onSelect: action.onSelect, title: action.title, disabled: action.disabled, icon: action.icon }, action.label))),
|
|
174
|
+
settings && (React.createElement(React.Fragment, null,
|
|
175
|
+
hasAttach && React.createElement(DropdownMenuSeparator, { className: "my-2!" }),
|
|
176
|
+
React.createElement(SettingsSubmenu, { settings: settings })))));
|
|
177
|
+
}
|
|
178
|
+
ChatActionsPreset.displayName = "ChatActions.Preset";
|
|
179
|
+
/**
|
|
180
|
+
* ChatActions — render `<ChatActions onAttachFiles={…} actions={…} />` for the
|
|
181
|
+
* default preset menu, or compose `ChatActions.Trigger` / `Content` / `Item`
|
|
182
|
+
* (each reads `useChatActions()`) for a custom menu. Mirrors the `ToolCall`
|
|
183
|
+
* compound: render it, or compose it.
|
|
184
|
+
*/
|
|
185
|
+
export const ChatActions = Object.assign(ChatActionsRoot, {
|
|
186
|
+
Root: ChatActionsRoot,
|
|
187
|
+
Trigger: ChatActionsTrigger,
|
|
188
|
+
Content: ChatActionsContent,
|
|
189
|
+
Item: ChatActionsItem,
|
|
190
|
+
Preset: ChatActionsPreset,
|
|
191
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ChatAgentPicker — the connected {@link AgentPicker}. Fetches the project's
|
|
3
|
+
* agents with {@link useAgents} and renders the picker only when there is more
|
|
4
|
+
* than one to switch between, so it can be dropped straight into the composer's
|
|
5
|
+
* `toolbarStart` slot without the caller wiring up data:
|
|
6
|
+
*
|
|
7
|
+
* ```tsx
|
|
8
|
+
* const [agentId, setAgentId] = React.useState<string>();
|
|
9
|
+
* <ChatInput
|
|
10
|
+
* …
|
|
11
|
+
* toolbarStart={<ChatAgentPicker value={agentId} onValueChange={setAgentId} />}
|
|
12
|
+
* />
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* It renders nothing while loading, on error, or when the project exposes fewer
|
|
16
|
+
* than `minAgents` (default 2) agents — a single-agent project has nothing to
|
|
17
|
+
* switch to, so the slot stays empty. Selection is controlled by the caller
|
|
18
|
+
* (`value` / `onValueChange`), matching {@link AgentPicker}.
|
|
19
|
+
*
|
|
20
|
+
* @module react/components/chat/chat-agent-picker
|
|
21
|
+
*/
|
|
22
|
+
import * as React from "../../../../react/react.js";
|
|
23
|
+
import { type AgentMetadata } from "../../../agent/react/index.js";
|
|
24
|
+
import { type AgentOption } from "./agent-picker.js";
|
|
25
|
+
/** Map browser-safe agent metadata to the picker's row shape. */
|
|
26
|
+
export declare function agentsToPickerOptions(agents: AgentMetadata[]): AgentOption[];
|
|
27
|
+
/** Props accepted by `<ChatAgentPicker>`. */
|
|
28
|
+
export interface ChatAgentPickerProps {
|
|
29
|
+
/** Selected agent id (controlled). */
|
|
30
|
+
value?: string;
|
|
31
|
+
/** Called with the chosen agent id. */
|
|
32
|
+
onValueChange?: (id: string) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Minimum agent count before the picker renders. Defaults to `2` — with one
|
|
35
|
+
* agent there is nothing to switch to. Set to `1` to always show it once an
|
|
36
|
+
* agent is available.
|
|
37
|
+
*/
|
|
38
|
+
minAgents?: number;
|
|
39
|
+
/** When `false`, skips the fetch and renders nothing. Defaults to `true`. */
|
|
40
|
+
enabled?: boolean;
|
|
41
|
+
/** Shows a "Create Agent" row at the bottom of the list. */
|
|
42
|
+
onCreate?: () => void;
|
|
43
|
+
/** Shows a "Manage Agents" row at the bottom of the list. */
|
|
44
|
+
onManage?: () => void;
|
|
45
|
+
/** Additional class names for the trigger. */
|
|
46
|
+
className?: string;
|
|
47
|
+
}
|
|
48
|
+
/** Render the connected agent switcher, or nothing when there's nothing to switch. */
|
|
49
|
+
export declare function ChatAgentPicker({ value, onValueChange, minAgents, enabled, onCreate, onManage, className, }: ChatAgentPickerProps): React.ReactElement | null;
|
|
50
|
+
//# sourceMappingURL=chat-agent-picker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-agent-picker.d.ts","sourceRoot":"","sources":["../../../../../src/src/react/components/chat/chat-agent-picker.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,KAAK,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,KAAK,aAAa,EAAa,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,KAAK,WAAW,EAAe,MAAM,mBAAmB,CAAC;AAElE,iEAAiE;AACjE,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,WAAW,EAAE,CAM5E;AAED,6CAA6C;AAC7C,MAAM,WAAW,oBAAoB;IACnC,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,aAAa,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,sFAAsF;AACtF,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,aAAa,EACb,SAAa,EACb,OAAc,EACd,QAAQ,EACR,QAAQ,EACR,SAAS,GACV,EAAE,oBAAoB,GAAG,KAAK,CAAC,YAAY,GAAG,IAAI,CAgBlD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ChatAgentPicker — the connected {@link AgentPicker}. Fetches the project's
|
|
3
|
+
* agents with {@link useAgents} and renders the picker only when there is more
|
|
4
|
+
* than one to switch between, so it can be dropped straight into the composer's
|
|
5
|
+
* `toolbarStart` slot without the caller wiring up data:
|
|
6
|
+
*
|
|
7
|
+
* ```tsx
|
|
8
|
+
* const [agentId, setAgentId] = React.useState<string>();
|
|
9
|
+
* <ChatInput
|
|
10
|
+
* …
|
|
11
|
+
* toolbarStart={<ChatAgentPicker value={agentId} onValueChange={setAgentId} />}
|
|
12
|
+
* />
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* It renders nothing while loading, on error, or when the project exposes fewer
|
|
16
|
+
* than `minAgents` (default 2) agents — a single-agent project has nothing to
|
|
17
|
+
* switch to, so the slot stays empty. Selection is controlled by the caller
|
|
18
|
+
* (`value` / `onValueChange`), matching {@link AgentPicker}.
|
|
19
|
+
*
|
|
20
|
+
* @module react/components/chat/chat-agent-picker
|
|
21
|
+
*/
|
|
22
|
+
import * as React from "../../../../react/react.js";
|
|
23
|
+
import { useAgents } from "../../../agent/react/index.js";
|
|
24
|
+
import { AgentPicker } from "./agent-picker.js";
|
|
25
|
+
/** Map browser-safe agent metadata to the picker's row shape. */
|
|
26
|
+
export function agentsToPickerOptions(agents) {
|
|
27
|
+
return agents.map((agent) => ({
|
|
28
|
+
id: agent.id,
|
|
29
|
+
name: agent.name,
|
|
30
|
+
...(agent.avatarUrl ? { avatarSrc: agent.avatarUrl } : {}),
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
/** Render the connected agent switcher, or nothing when there's nothing to switch. */
|
|
34
|
+
export function ChatAgentPicker({ value, onValueChange, minAgents = 2, enabled = true, onCreate, onManage, className, }) {
|
|
35
|
+
const { agents } = useAgents({ enabled });
|
|
36
|
+
const options = React.useMemo(() => agentsToPickerOptions(agents), [agents]);
|
|
37
|
+
if (options.length < minAgents)
|
|
38
|
+
return null;
|
|
39
|
+
return (React.createElement(AgentPicker, { agents: options, value: value, onValueChange: onValueChange, ...(onCreate ? { onCreate } : {}), ...(onManage ? { onManage } : {}), ...(className ? { className } : {}) }));
|
|
40
|
+
}
|