veryfront 0.1.996 → 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 +8 -0
- package/esm/deno.js +12 -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/task/discovery.d.ts +95 -0
- package/esm/src/task/discovery.d.ts.map +1 -0
- package/esm/src/task/discovery.js +192 -0
- package/esm/src/task/index.d.ts +27 -0
- package/esm/src/task/index.d.ts.map +1 -0
- package/esm/src/task/index.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/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 +9 -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
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import * as React from "../../../../../../react/react.js";
|
|
2
|
-
import { cn } from "../../theme.js";
|
|
3
|
-
import { FileTextIcon, TrashIcon } from "../../icons/index.js";
|
|
4
|
-
function formatFileSize(bytes) {
|
|
5
|
-
if (bytes < 1024)
|
|
6
|
-
return `${bytes} B`;
|
|
7
|
-
if (bytes < 1024 * 1024)
|
|
8
|
-
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
9
|
-
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
10
|
-
}
|
|
11
|
-
/** Render uploads panel. */
|
|
12
|
-
export function UploadsPanel({ uploads = [], onRemoveUpload, onAttach, attachAccept, className, }) {
|
|
13
|
-
const fileInputRef = React.useRef(null);
|
|
14
|
-
return (React.createElement("div", { className: cn("flex flex-col h-full", className) },
|
|
15
|
-
React.createElement("div", { className: "flex-1 overflow-y-auto px-4 py-4" }, uploads.length === 0
|
|
16
|
-
? (React.createElement("div", { className: "flex flex-col items-center justify-center h-full text-center" },
|
|
17
|
-
React.createElement("h1", { className: "text-2xl font-medium text-[var(--foreground)] tracking-tight" }, "No files uploaded"),
|
|
18
|
-
React.createElement("p", { className: "mt-2 max-w-sm text-sm text-[var(--muted-foreground)] leading-relaxed" }, "Upload files to start asking questions"),
|
|
19
|
-
onAttach && (React.createElement("button", { type: "button", onClick: () => fileInputRef.current?.click(), className: "mt-4 px-4 py-2 text-sm font-medium rounded-full bg-[var(--primary)] text-[var(--primary-foreground)] hover:opacity-90 transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-2" }, "Upload Files"))))
|
|
20
|
-
: (React.createElement("div", { className: "max-w-2xl mx-auto space-y-1.5" },
|
|
21
|
-
uploads.map((doc) => (React.createElement("div", { key: doc.id, className: "flex items-center gap-3 rounded-lg px-3 py-2.5 group hover:bg-[var(--accent)] transition-colors" },
|
|
22
|
-
React.createElement("div", { className: "shrink-0 size-8 rounded-lg bg-[var(--accent)] flex items-center justify-center text-[var(--muted-foreground)]" },
|
|
23
|
-
React.createElement(FileTextIcon, { className: "size-4" })),
|
|
24
|
-
React.createElement("div", { className: "flex-1 min-w-0" },
|
|
25
|
-
doc.url
|
|
26
|
-
? (React.createElement("a", { href: doc.url, target: "_blank", rel: "noreferrer", className: "block truncate text-sm text-[var(--card-foreground)] hover:underline" }, doc.name))
|
|
27
|
-
: (React.createElement("p", { className: "text-sm text-[var(--card-foreground)] truncate" }, doc.name)),
|
|
28
|
-
doc.size != null && (React.createElement("p", { className: "text-xs text-[var(--muted-foreground)]" }, formatFileSize(doc.size)))),
|
|
29
|
-
onRemoveUpload && (React.createElement("button", { type: "button", onClick: () => onRemoveUpload(doc.id), className: "shrink-0 p-1.5 rounded-md text-[var(--muted-foreground)] hover:text-[var(--destructive)] hover:bg-[var(--destructive)]/10 transition-colors opacity-0 group-hover:opacity-100", "aria-label": `Remove ${doc.name}` },
|
|
30
|
-
React.createElement(TrashIcon, { className: "size-4" })))))),
|
|
31
|
-
onAttach && (React.createElement("button", { type: "button", onClick: () => fileInputRef.current?.click(), className: "w-full flex items-center justify-center gap-2 rounded-lg px-3 py-2.5 text-sm text-[var(--muted-foreground)] hover:bg-[var(--accent)] transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-2" },
|
|
32
|
-
React.createElement("span", { className: "text-xs" }, "+"),
|
|
33
|
-
"Upload more files"))))),
|
|
34
|
-
onAttach && (React.createElement("input", { ref: fileInputRef, type: "file", accept: attachAccept, multiple: true, "aria-label": "Upload file", onChange: (e) => {
|
|
35
|
-
if (e.target.files?.length)
|
|
36
|
-
onAttach(e.target.files);
|
|
37
|
-
e.target.value = "";
|
|
38
|
-
}, style: {
|
|
39
|
-
position: "absolute",
|
|
40
|
-
width: 1,
|
|
41
|
-
height: 1,
|
|
42
|
-
padding: 0,
|
|
43
|
-
margin: -1,
|
|
44
|
-
overflow: "hidden",
|
|
45
|
-
clip: "rect(0,0,0,0)",
|
|
46
|
-
whiteSpace: "nowrap",
|
|
47
|
-
border: 0,
|
|
48
|
-
} }))));
|
|
49
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ThreadListContext — Thread navigation state for multi-conversation UIs.
|
|
3
|
-
*
|
|
4
|
-
* Provided by ThreadList.Root or ChatWithSidebar.
|
|
5
|
-
* Consumed by thread list items, create/delete buttons, etc.
|
|
6
|
-
*
|
|
7
|
-
* @module react/components/chat/contexts/thread-list-context
|
|
8
|
-
*/
|
|
9
|
-
import * as React from "../../../../../../react/react.js";
|
|
10
|
-
import type { Thread } from "../hooks/use-threads.js";
|
|
11
|
-
/** Public API contract for thread list context value. */
|
|
12
|
-
export interface ThreadListContextValue {
|
|
13
|
-
threads: Thread[];
|
|
14
|
-
activeThreadId: string | null;
|
|
15
|
-
activeThread: Thread | null;
|
|
16
|
-
createThread: () => Thread;
|
|
17
|
-
selectThread: (id: string) => void;
|
|
18
|
-
deleteThread: (id: string) => void;
|
|
19
|
-
renameThread: (id: string, title: string) => void;
|
|
20
|
-
updateThread: (id: string, updates: Partial<Pick<Thread, "title" | "messages">>) => void;
|
|
21
|
-
}
|
|
22
|
-
/** Context for use thread list. */
|
|
23
|
-
export declare function useThreadListContext(): ThreadListContextValue;
|
|
24
|
-
/** React hook for thread list context optional. */
|
|
25
|
-
export declare function useThreadListContextOptional(): ThreadListContextValue | null;
|
|
26
|
-
/** Render thread list context provider. */
|
|
27
|
-
export declare const ThreadListContextProvider: React.Provider<ThreadListContextValue | null>;
|
|
28
|
-
//# sourceMappingURL=thread-list-context.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"thread-list-context.d.ts","sourceRoot":"","sources":["../../../../../../../src/src/react/components/chat/chat/contexts/thread-list-context.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,KAAK,MAAM,kCAAkC,CAAC;AAE1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,yDAAyD;AACzD,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAG5B,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,GAAG,UAAU,CAAC,CAAC,KAAK,IAAI,CAAC;CAC1F;AAID,mCAAmC;AACnC,wBAAgB,oBAAoB,IAAI,sBAAsB,CAQ7D;AAED,mDAAmD;AACnD,wBAAgB,4BAA4B,IAAI,sBAAsB,GAAG,IAAI,CAE5E;AAED,2CAA2C;AAC3C,eAAO,MAAM,yBAAyB,+CAA6B,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ThreadListContext — Thread navigation state for multi-conversation UIs.
|
|
3
|
-
*
|
|
4
|
-
* Provided by ThreadList.Root or ChatWithSidebar.
|
|
5
|
-
* Consumed by thread list items, create/delete buttons, etc.
|
|
6
|
-
*
|
|
7
|
-
* @module react/components/chat/contexts/thread-list-context
|
|
8
|
-
*/
|
|
9
|
-
import * as React from "../../../../../../react/react.js";
|
|
10
|
-
import { COMPONENT_ERROR } from "../../../../../errors/error-registry.js";
|
|
11
|
-
const ThreadListContext = React.createContext(null);
|
|
12
|
-
/** Context for use thread list. */
|
|
13
|
-
export function useThreadListContext() {
|
|
14
|
-
const context = React.useContext(ThreadListContext);
|
|
15
|
-
if (!context) {
|
|
16
|
-
throw COMPONENT_ERROR.create({
|
|
17
|
-
detail: "useThreadListContext must be used within a ThreadList provider",
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return context;
|
|
21
|
-
}
|
|
22
|
-
/** React hook for thread list context optional. */
|
|
23
|
-
export function useThreadListContextOptional() {
|
|
24
|
-
return React.useContext(ThreadListContext);
|
|
25
|
-
}
|
|
26
|
-
/** Render thread list context provider. */
|
|
27
|
-
export const ThreadListContextProvider = ThreadListContext.Provider;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { ChatMessage } from "../../../../../agent/react/index.js";
|
|
2
|
-
/** Public API contract for thread. */
|
|
3
|
-
export interface Thread {
|
|
4
|
-
id: string;
|
|
5
|
-
title: string;
|
|
6
|
-
messages: ChatMessage[];
|
|
7
|
-
createdAt: number;
|
|
8
|
-
updatedAt: number;
|
|
9
|
-
}
|
|
10
|
-
/** Options accepted by use threads. */
|
|
11
|
-
export interface UseThreadsOptions {
|
|
12
|
-
/** localStorage key prefix. Default: "vf-threads" */
|
|
13
|
-
storageKey?: string;
|
|
14
|
-
}
|
|
15
|
-
/** Result returned from use threads. */
|
|
16
|
-
export interface UseThreadsResult {
|
|
17
|
-
threads: Thread[];
|
|
18
|
-
activeThreadId: string | null;
|
|
19
|
-
activeThread: Thread | null;
|
|
20
|
-
createThread: () => Thread;
|
|
21
|
-
selectThread: (id: string) => void;
|
|
22
|
-
deleteThread: (id: string) => void;
|
|
23
|
-
updateThread: (id: string, updates: Partial<Pick<Thread, "title" | "messages">>) => void;
|
|
24
|
-
renameThread: (id: string, title: string) => void;
|
|
25
|
-
}
|
|
26
|
-
/** React hook for threads. */
|
|
27
|
-
export declare function useThreads(options?: UseThreadsOptions): UseThreadsResult;
|
|
28
|
-
//# sourceMappingURL=use-threads.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-threads.d.ts","sourceRoot":"","sources":["../../../../../../../src/src/react/components/chat/chat/hooks/use-threads.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAGvE,sCAAsC;AACtC,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAMD,uCAAuC;AACvC,MAAM,WAAW,iBAAiB;IAChC,qDAAqD;IACrD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wCAAwC;AACxC,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,GAAG,UAAU,CAAC,CAAC,KAAK,IAAI,CAAC;IACzF,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnD;AAiDD,8BAA8B;AAC9B,wBAAgB,UAAU,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,gBAAgB,CA+HxE"}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import * as React from "../../../../../../react/react.js";
|
|
2
|
-
import { isBrowserEnvironment } from "../../../../../platform/compat/runtime.js";
|
|
3
|
-
function generateId() {
|
|
4
|
-
return `t_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
|
|
5
|
-
}
|
|
6
|
-
function createEmptyThread() {
|
|
7
|
-
return {
|
|
8
|
-
id: generateId(),
|
|
9
|
-
title: "New Chat",
|
|
10
|
-
messages: [],
|
|
11
|
-
createdAt: Date.now(),
|
|
12
|
-
updatedAt: Date.now(),
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
function loadIndex(key) {
|
|
16
|
-
if (!isBrowserEnvironment())
|
|
17
|
-
return { ids: [] };
|
|
18
|
-
try {
|
|
19
|
-
const raw = localStorage.getItem(`${key}-index`);
|
|
20
|
-
if (raw)
|
|
21
|
-
return JSON.parse(raw);
|
|
22
|
-
}
|
|
23
|
-
catch (_) { /* expected: corrupted localStorage data */ }
|
|
24
|
-
return { ids: [] };
|
|
25
|
-
}
|
|
26
|
-
function saveIndex(key, index) {
|
|
27
|
-
if (!isBrowserEnvironment())
|
|
28
|
-
return;
|
|
29
|
-
localStorage.setItem(`${key}-index`, JSON.stringify(index));
|
|
30
|
-
}
|
|
31
|
-
function loadThread(key, id) {
|
|
32
|
-
if (!isBrowserEnvironment())
|
|
33
|
-
return null;
|
|
34
|
-
try {
|
|
35
|
-
const raw = localStorage.getItem(`${key}-${id}`);
|
|
36
|
-
if (raw)
|
|
37
|
-
return JSON.parse(raw);
|
|
38
|
-
}
|
|
39
|
-
catch (_) { /* expected: corrupted localStorage data */ }
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
function saveThread(key, thread) {
|
|
43
|
-
if (!isBrowserEnvironment())
|
|
44
|
-
return;
|
|
45
|
-
localStorage.setItem(`${key}-${thread.id}`, JSON.stringify(thread));
|
|
46
|
-
}
|
|
47
|
-
function removeThread(key, id) {
|
|
48
|
-
if (!isBrowserEnvironment())
|
|
49
|
-
return;
|
|
50
|
-
localStorage.removeItem(`${key}-${id}`);
|
|
51
|
-
}
|
|
52
|
-
/** React hook for threads. */
|
|
53
|
-
export function useThreads(options) {
|
|
54
|
-
const storageKey = options?.storageKey ?? "vf-threads";
|
|
55
|
-
const [threads, setThreads] = React.useState(() => {
|
|
56
|
-
const index = loadIndex(storageKey);
|
|
57
|
-
const loaded = [];
|
|
58
|
-
for (const id of index.ids) {
|
|
59
|
-
const thread = loadThread(storageKey, id);
|
|
60
|
-
if (thread)
|
|
61
|
-
loaded.push(thread);
|
|
62
|
-
}
|
|
63
|
-
if (loaded.length === 0) {
|
|
64
|
-
// Return empty array during SSR/first render; create thread in useEffect
|
|
65
|
-
return [];
|
|
66
|
-
}
|
|
67
|
-
// Sort by updatedAt desc
|
|
68
|
-
loaded.sort((a, b) => b.updatedAt - a.updatedAt);
|
|
69
|
-
return loaded;
|
|
70
|
-
});
|
|
71
|
-
const [activeThreadId, setActiveThreadId] = React.useState(() => threads[0]?.id ?? null);
|
|
72
|
-
// Create initial thread on client only to avoid SSR hydration mismatch
|
|
73
|
-
React.useEffect(() => {
|
|
74
|
-
if (threads.length > 0)
|
|
75
|
-
return;
|
|
76
|
-
const first = createEmptyThread();
|
|
77
|
-
saveThread(storageKey, first);
|
|
78
|
-
saveIndex(storageKey, { ids: [first.id] });
|
|
79
|
-
setThreads([first]);
|
|
80
|
-
setActiveThreadId(first.id);
|
|
81
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
82
|
-
}, []);
|
|
83
|
-
// Debounced persist — clear on unmount to avoid stale writes
|
|
84
|
-
const saveTimerRef = React.useRef(undefined);
|
|
85
|
-
React.useEffect(() => () => clearTimeout(saveTimerRef.current), []);
|
|
86
|
-
const persistThreads = React.useCallback((updated) => {
|
|
87
|
-
clearTimeout(saveTimerRef.current);
|
|
88
|
-
saveTimerRef.current = globalThis.setTimeout(() => {
|
|
89
|
-
saveIndex(storageKey, { ids: updated.map((t) => t.id) });
|
|
90
|
-
for (const thread of updated) {
|
|
91
|
-
saveThread(storageKey, thread);
|
|
92
|
-
}
|
|
93
|
-
}, 300);
|
|
94
|
-
}, [storageKey]);
|
|
95
|
-
const activeThread = React.useMemo(() => threads.find((t) => t.id === activeThreadId) ?? null, [threads, activeThreadId]);
|
|
96
|
-
const createThread = React.useCallback(() => {
|
|
97
|
-
const thread = createEmptyThread();
|
|
98
|
-
setThreads((prev) => {
|
|
99
|
-
const next = [thread, ...prev];
|
|
100
|
-
persistThreads(next);
|
|
101
|
-
return next;
|
|
102
|
-
});
|
|
103
|
-
setActiveThreadId(thread.id);
|
|
104
|
-
return thread;
|
|
105
|
-
}, [persistThreads]);
|
|
106
|
-
const selectThread = React.useCallback((id) => {
|
|
107
|
-
setActiveThreadId(id);
|
|
108
|
-
}, []);
|
|
109
|
-
const deleteThread = React.useCallback((id) => {
|
|
110
|
-
setThreads((prev) => {
|
|
111
|
-
const next = prev.filter((t) => t.id !== id);
|
|
112
|
-
removeThread(storageKey, id);
|
|
113
|
-
if (next.length === 0) {
|
|
114
|
-
const fresh = createEmptyThread();
|
|
115
|
-
saveThread(storageKey, fresh);
|
|
116
|
-
const result = [fresh];
|
|
117
|
-
persistThreads(result);
|
|
118
|
-
setActiveThreadId(fresh.id);
|
|
119
|
-
return result;
|
|
120
|
-
}
|
|
121
|
-
persistThreads(next);
|
|
122
|
-
// If we deleted the active thread, switch to the first one
|
|
123
|
-
setActiveThreadId((current) => current === id ? (next[0]?.id ?? null) : current);
|
|
124
|
-
return next;
|
|
125
|
-
});
|
|
126
|
-
}, [storageKey, persistThreads]);
|
|
127
|
-
const updateThread = React.useCallback((id, updates) => {
|
|
128
|
-
setThreads((prev) => {
|
|
129
|
-
const next = prev.map((t) => {
|
|
130
|
-
if (t.id !== id)
|
|
131
|
-
return t;
|
|
132
|
-
return { ...t, ...updates, updatedAt: Date.now() };
|
|
133
|
-
});
|
|
134
|
-
persistThreads(next);
|
|
135
|
-
return next;
|
|
136
|
-
});
|
|
137
|
-
}, [persistThreads]);
|
|
138
|
-
const renameThread = React.useCallback((id, title) => {
|
|
139
|
-
updateThread(id, { title });
|
|
140
|
-
}, [updateThread]);
|
|
141
|
-
return {
|
|
142
|
-
threads,
|
|
143
|
-
activeThreadId,
|
|
144
|
-
activeThread,
|
|
145
|
-
createThread,
|
|
146
|
-
selectThread,
|
|
147
|
-
deleteThread,
|
|
148
|
-
updateThread,
|
|
149
|
-
renameThread,
|
|
150
|
-
};
|
|
151
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import * as React from "../../../../react/react.js";
|
|
2
|
-
import { type ChatProps } from "./chat/index.js";
|
|
3
|
-
type ChatMessageSetter = (messages: ChatProps["messages"]) => void;
|
|
4
|
-
type TabChangeHandler = NonNullable<ChatProps["onTabChange"]>;
|
|
5
|
-
/** Public API contract for chat with sidebar chat controller. */
|
|
6
|
-
export interface ChatWithSidebarChatController {
|
|
7
|
-
messages: ChatProps["messages"];
|
|
8
|
-
input: ChatProps["input"];
|
|
9
|
-
onChange: ChatProps["onChange"];
|
|
10
|
-
onSubmit?: ChatProps["onSubmit"];
|
|
11
|
-
stop?: ChatProps["stop"];
|
|
12
|
-
reload?: ChatProps["reload"];
|
|
13
|
-
setInput?: ChatProps["setInput"];
|
|
14
|
-
isLoading?: ChatProps["isLoading"];
|
|
15
|
-
error?: ChatProps["error"];
|
|
16
|
-
model?: ChatProps["model"];
|
|
17
|
-
activeModel?: ChatProps["activeModel"];
|
|
18
|
-
onModelChange?: ChatProps["onModelChange"];
|
|
19
|
-
inferenceMode?: ChatProps["inferenceMode"];
|
|
20
|
-
editMessage?: ChatProps["editMessage"];
|
|
21
|
-
getBranches?: ChatProps["getBranches"];
|
|
22
|
-
switchBranch?: ChatProps["switchBranch"];
|
|
23
|
-
setMessages: ChatMessageSetter;
|
|
24
|
-
}
|
|
25
|
-
interface ChatWithSidebarSidebarBaseConfig {
|
|
26
|
-
storageKey?: string;
|
|
27
|
-
visible?: boolean;
|
|
28
|
-
}
|
|
29
|
-
/** Configuration used by chat with sidebar sidebar. */
|
|
30
|
-
export type ChatWithSidebarSidebarConfig = (ChatWithSidebarSidebarBaseConfig & {
|
|
31
|
-
open: boolean;
|
|
32
|
-
onToggle: () => void;
|
|
33
|
-
}) | (ChatWithSidebarSidebarBaseConfig & {
|
|
34
|
-
open?: undefined;
|
|
35
|
-
onToggle?: () => void;
|
|
36
|
-
});
|
|
37
|
-
/** Configuration used by chat with sidebar model. */
|
|
38
|
-
export interface ChatWithSidebarModelConfig {
|
|
39
|
-
options?: ChatProps["models"];
|
|
40
|
-
}
|
|
41
|
-
/** Configuration used by chat with sidebar attachment. */
|
|
42
|
-
export interface ChatWithSidebarAttachmentConfig {
|
|
43
|
-
accept?: ChatProps["attachAccept"];
|
|
44
|
-
items?: ChatProps["attachments"];
|
|
45
|
-
uploads?: ChatProps["uploads"];
|
|
46
|
-
onAttach?: ChatProps["onAttach"];
|
|
47
|
-
onDrop?: ChatProps["onDrop"];
|
|
48
|
-
onRemoveItem?: ChatProps["onRemoveAttachment"];
|
|
49
|
-
onRemoveUpload?: ChatProps["onRemoveUpload"];
|
|
50
|
-
}
|
|
51
|
-
/** Configuration used by chat with sidebar quick actions. */
|
|
52
|
-
export interface ChatWithSidebarQuickActionsConfig {
|
|
53
|
-
suggestions?: ChatProps["suggestions"];
|
|
54
|
-
onSuggestionClick?: ChatProps["onSuggestionClick"];
|
|
55
|
-
actions?: ChatProps["quickActions"];
|
|
56
|
-
onAction?: ChatProps["onQuickAction"];
|
|
57
|
-
}
|
|
58
|
-
/** Configuration used by chat with sidebar message. */
|
|
59
|
-
export interface ChatWithSidebarMessageConfig {
|
|
60
|
-
render?: ChatProps["renderMessage"];
|
|
61
|
-
renderTool?: ChatProps["renderTool"];
|
|
62
|
-
onFeedback?: ChatProps["onFeedback"];
|
|
63
|
-
onSourceClick?: ChatProps["onSourceClick"];
|
|
64
|
-
}
|
|
65
|
-
/** Configuration used by chat with sidebar feature. */
|
|
66
|
-
export interface ChatWithSidebarFeatureConfig {
|
|
67
|
-
steps?: ChatProps["showSteps"];
|
|
68
|
-
tabs?: ChatProps["showTabs"];
|
|
69
|
-
sources?: ChatProps["showSources"];
|
|
70
|
-
export?: ChatProps["showExport"];
|
|
71
|
-
scrollButton?: ChatProps["showScrollButton"];
|
|
72
|
-
messageActions?: ChatProps["showMessageActions"];
|
|
73
|
-
}
|
|
74
|
-
/** Configuration used by chat with sidebar tabs. */
|
|
75
|
-
export type ChatWithSidebarTabsConfig = {
|
|
76
|
-
active: ChatProps["activeTab"];
|
|
77
|
-
onChange: TabChangeHandler;
|
|
78
|
-
} | {
|
|
79
|
-
active?: undefined;
|
|
80
|
-
onChange?: TabChangeHandler;
|
|
81
|
-
};
|
|
82
|
-
/** Configuration used by chat with sidebar voice. */
|
|
83
|
-
export interface ChatWithSidebarVoiceConfig {
|
|
84
|
-
enabled?: ChatProps["enableVoice"];
|
|
85
|
-
onVoice?: ChatProps["onVoice"];
|
|
86
|
-
}
|
|
87
|
-
/** Props accepted by chat with sidebar grouped. */
|
|
88
|
-
export interface ChatWithSidebarGroupedProps {
|
|
89
|
-
chat: ChatWithSidebarChatController;
|
|
90
|
-
sidebar?: ChatWithSidebarSidebarConfig;
|
|
91
|
-
models?: ChatWithSidebarModelConfig;
|
|
92
|
-
attachments?: ChatWithSidebarAttachmentConfig;
|
|
93
|
-
quickActions?: ChatWithSidebarQuickActionsConfig;
|
|
94
|
-
message?: ChatWithSidebarMessageConfig;
|
|
95
|
-
features?: ChatWithSidebarFeatureConfig;
|
|
96
|
-
tabs?: ChatWithSidebarTabsConfig;
|
|
97
|
-
voice?: ChatWithSidebarVoiceConfig;
|
|
98
|
-
className?: string;
|
|
99
|
-
maxHeight?: ChatProps["maxHeight"];
|
|
100
|
-
theme?: ChatProps["theme"];
|
|
101
|
-
placeholder?: ChatProps["placeholder"];
|
|
102
|
-
emptyState?: ChatProps["emptyState"];
|
|
103
|
-
children?: ChatProps["children"];
|
|
104
|
-
}
|
|
105
|
-
/** Props accepted by chat with sidebar. */
|
|
106
|
-
export type ChatWithSidebarProps = ChatWithSidebarGroupedProps;
|
|
107
|
-
/** Render chat with sidebar. */
|
|
108
|
-
export declare const ChatWithSidebar: React.ForwardRefExoticComponent<ChatWithSidebarGroupedProps & React.RefAttributes<HTMLDivElement>>;
|
|
109
|
-
export {};
|
|
110
|
-
//# sourceMappingURL=chat-with-sidebar.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chat-with-sidebar.d.ts","sourceRoot":"","sources":["../../../../../src/src/react/components/chat/chat-with-sidebar.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import * as React from "../../../../react/react.js";
|
|
2
|
-
import { getDocumentNonce } from "./csp-nonce.js";
|
|
3
|
-
import { cn, generateTokenCSS } from "./theme.js";
|
|
4
|
-
import { Chat } from "./chat/index.js";
|
|
5
|
-
import { ChatSidebar } from "./chat/components/sidebar.js";
|
|
6
|
-
import { TabSwitcher } from "./chat/components/tab-switcher.js";
|
|
7
|
-
import { useThreads } from "./chat/hooks/use-threads.js";
|
|
8
|
-
import { PanelLeftIcon } from "./icons/index.js";
|
|
9
|
-
/** Render chat with sidebar. */
|
|
10
|
-
export const ChatWithSidebar = React.forwardRef(function ChatWithSidebar({ chat, sidebar, models, attachments, quickActions, message, features, tabs, voice, className, maxHeight, theme, placeholder, emptyState, children, }, ref) {
|
|
11
|
-
const nonce = getDocumentNonce();
|
|
12
|
-
const storageKey = sidebar?.storageKey;
|
|
13
|
-
const controlledOpen = sidebar?.open;
|
|
14
|
-
const onSidebarToggle = sidebar?.onToggle;
|
|
15
|
-
const showSidebar = sidebar?.visible ?? true;
|
|
16
|
-
const setMessages = chat.setMessages;
|
|
17
|
-
const messages = chat.messages;
|
|
18
|
-
const model = chat.model;
|
|
19
|
-
const onModelChange = chat.onModelChange;
|
|
20
|
-
const controlledTab = tabs?.active;
|
|
21
|
-
const chatProps = {
|
|
22
|
-
input: chat.input,
|
|
23
|
-
onChange: chat.onChange,
|
|
24
|
-
onSubmit: chat.onSubmit,
|
|
25
|
-
stop: chat.stop,
|
|
26
|
-
reload: chat.reload,
|
|
27
|
-
setInput: chat.setInput,
|
|
28
|
-
isLoading: chat.isLoading,
|
|
29
|
-
error: chat.error,
|
|
30
|
-
placeholder,
|
|
31
|
-
maxHeight,
|
|
32
|
-
theme,
|
|
33
|
-
renderMessage: message?.render,
|
|
34
|
-
renderTool: message?.renderTool,
|
|
35
|
-
suggestions: quickActions?.suggestions,
|
|
36
|
-
onSuggestionClick: quickActions?.onSuggestionClick,
|
|
37
|
-
emptyState,
|
|
38
|
-
showScrollButton: features?.scrollButton,
|
|
39
|
-
showMessageActions: features?.messageActions,
|
|
40
|
-
models: models?.options,
|
|
41
|
-
activeModel: chat.activeModel,
|
|
42
|
-
inferenceMode: chat.inferenceMode,
|
|
43
|
-
showSources: features?.sources,
|
|
44
|
-
onSourceClick: message?.onSourceClick,
|
|
45
|
-
onAttach: attachments?.onAttach,
|
|
46
|
-
onDrop: attachments?.onDrop,
|
|
47
|
-
attachAccept: attachments?.accept,
|
|
48
|
-
attachments: attachments?.items,
|
|
49
|
-
onRemoveAttachment: attachments?.onRemoveItem,
|
|
50
|
-
showExport: features?.export,
|
|
51
|
-
onFeedback: message?.onFeedback,
|
|
52
|
-
editMessage: chat.editMessage,
|
|
53
|
-
getBranches: chat.getBranches,
|
|
54
|
-
switchBranch: chat.switchBranch,
|
|
55
|
-
showSteps: features?.steps,
|
|
56
|
-
showTabs: features?.tabs,
|
|
57
|
-
uploads: attachments?.uploads,
|
|
58
|
-
onRemoveUpload: attachments?.onRemoveUpload,
|
|
59
|
-
quickActions: quickActions?.actions,
|
|
60
|
-
onQuickAction: quickActions?.onAction,
|
|
61
|
-
enableVoice: voice?.enabled,
|
|
62
|
-
onVoice: voice?.onVoice,
|
|
63
|
-
children,
|
|
64
|
-
};
|
|
65
|
-
const { activeThreadId, createThread, deleteThread, renameThread, selectThread, threads, updateThread, } = useThreads({ storageKey });
|
|
66
|
-
const [internalOpen, setInternalOpen] = React.useState(false);
|
|
67
|
-
const [internalTab, setInternalTab] = React.useState("chat");
|
|
68
|
-
const showTabs = chatProps.showTabs ?? false;
|
|
69
|
-
const isSidebarControlled = controlledOpen !== undefined;
|
|
70
|
-
const sidebarOpen = isSidebarControlled ? controlledOpen : internalOpen;
|
|
71
|
-
const toggleSidebar = React.useCallback(() => {
|
|
72
|
-
if (isSidebarControlled) {
|
|
73
|
-
onSidebarToggle?.();
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
setInternalOpen((prev) => {
|
|
77
|
-
const next = !prev;
|
|
78
|
-
onSidebarToggle?.();
|
|
79
|
-
return next;
|
|
80
|
-
});
|
|
81
|
-
}, [isSidebarControlled, onSidebarToggle]);
|
|
82
|
-
const isTabControlled = controlledTab !== undefined;
|
|
83
|
-
const activeTab = controlledTab ?? internalTab;
|
|
84
|
-
const handleTabChange = React.useCallback((tab) => {
|
|
85
|
-
if (!isTabControlled) {
|
|
86
|
-
setInternalTab(tab);
|
|
87
|
-
}
|
|
88
|
-
tabs?.onChange?.(tab);
|
|
89
|
-
}, [isTabControlled, tabs]);
|
|
90
|
-
// Keep refs in sync so callbacks always read current values
|
|
91
|
-
const activeIdRef = React.useRef(activeThreadId);
|
|
92
|
-
activeIdRef.current = activeThreadId;
|
|
93
|
-
const messagesRef = React.useRef(messages);
|
|
94
|
-
messagesRef.current = messages;
|
|
95
|
-
const threadsRef = React.useRef(threads);
|
|
96
|
-
threadsRef.current = threads;
|
|
97
|
-
// Sync current messages to active thread on change
|
|
98
|
-
const prevMessagesRef = React.useRef(messages);
|
|
99
|
-
React.useEffect(() => {
|
|
100
|
-
const currentActiveId = activeIdRef.current;
|
|
101
|
-
if (!currentActiveId || messages === prevMessagesRef.current)
|
|
102
|
-
return;
|
|
103
|
-
prevMessagesRef.current = messages;
|
|
104
|
-
if (messages.length > 0) {
|
|
105
|
-
// Auto-title from first user message — combine with message sync
|
|
106
|
-
// into a single updateThread call to avoid racing setThreads batches
|
|
107
|
-
const activeThread = threadsRef.current.find((t) => t.id === currentActiveId);
|
|
108
|
-
let title;
|
|
109
|
-
if (activeThread?.title === "New Chat") {
|
|
110
|
-
const firstUserMsg = messages.find((m) => m.role === "user");
|
|
111
|
-
if (firstUserMsg) {
|
|
112
|
-
const text = firstUserMsg.parts
|
|
113
|
-
.filter((p) => p.type === "text")
|
|
114
|
-
.map((p) => p.text)
|
|
115
|
-
.join("")
|
|
116
|
-
.trim();
|
|
117
|
-
if (text)
|
|
118
|
-
title = text.slice(0, 30);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
updateThread(currentActiveId, title ? { messages, title } : { messages });
|
|
122
|
-
}
|
|
123
|
-
}, [messages, updateThread]);
|
|
124
|
-
const setInput = chat.setInput;
|
|
125
|
-
const stopChat = chat.stop;
|
|
126
|
-
const handleSelectThread = React.useCallback((id) => {
|
|
127
|
-
stopChat?.();
|
|
128
|
-
const currentActiveId = activeIdRef.current;
|
|
129
|
-
if (currentActiveId && messagesRef.current.length > 0) {
|
|
130
|
-
updateThread(currentActiveId, { messages: messagesRef.current });
|
|
131
|
-
}
|
|
132
|
-
selectThread(id);
|
|
133
|
-
const thread = threadsRef.current.find((t) => t.id === id);
|
|
134
|
-
setMessages(thread?.messages ?? []);
|
|
135
|
-
setInput?.("");
|
|
136
|
-
}, [selectThread, updateThread, setMessages, setInput, stopChat]);
|
|
137
|
-
const handleNewThread = React.useCallback(() => {
|
|
138
|
-
stopChat?.();
|
|
139
|
-
const currentActiveId = activeIdRef.current;
|
|
140
|
-
if (currentActiveId && messagesRef.current.length > 0) {
|
|
141
|
-
updateThread(currentActiveId, { messages: messagesRef.current });
|
|
142
|
-
}
|
|
143
|
-
const nextThread = createThread();
|
|
144
|
-
setMessages(nextThread.messages);
|
|
145
|
-
setInput?.("");
|
|
146
|
-
}, [createThread, updateThread, setMessages, setInput, stopChat]);
|
|
147
|
-
if (!showSidebar) {
|
|
148
|
-
return (React.createElement(Chat, { ref: ref, messages: messages, model: model, onModelChange: onModelChange, className: className, ...chatProps }));
|
|
149
|
-
}
|
|
150
|
-
const tokenCSS = React.useMemo(() => generateTokenCSS(), []);
|
|
151
|
-
return (React.createElement("div", { ref: ref, className: cn("flex h-full bg-[var(--background)]", className), "data-vf-chat": "" },
|
|
152
|
-
React.createElement("style", { nonce: nonce, dangerouslySetInnerHTML: { __html: tokenCSS } }),
|
|
153
|
-
sidebarOpen && (React.createElement(ChatSidebar, { threads: threads, activeThreadId: activeThreadId, onSelectThread: handleSelectThread, onDeleteThread: (id) => {
|
|
154
|
-
deleteThread(id);
|
|
155
|
-
const next = threadsRef.current.find((t) => t.id !== id);
|
|
156
|
-
setMessages(next?.messages ?? []);
|
|
157
|
-
}, onRenameThread: renameThread, onNewThread: handleNewThread })),
|
|
158
|
-
React.createElement("div", { className: "flex-1 min-w-0 flex flex-col" },
|
|
159
|
-
React.createElement("div", { className: "flex items-center px-3 pt-4 pb-1 shrink-0" },
|
|
160
|
-
React.createElement("button", { type: "button", onClick: toggleSidebar, className: "size-8 inline-flex items-center justify-center rounded-full text-[var(--muted-foreground)] hover:text-[var(--foreground)] hover:bg-[var(--foreground)]/5 transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-2", "aria-label": sidebarOpen ? "Close sidebar" : "Open sidebar" },
|
|
161
|
-
React.createElement(PanelLeftIcon, { className: "size-[18px]" })),
|
|
162
|
-
showTabs && (React.createElement("div", { className: "flex-1 flex justify-center" },
|
|
163
|
-
React.createElement(TabSwitcher, { activeTab: activeTab, onTabChange: handleTabChange, className: "py-0" }))),
|
|
164
|
-
showTabs && React.createElement("div", { className: "size-8 shrink-0" })),
|
|
165
|
-
React.createElement(Chat, { messages: messages, model: model, onModelChange: onModelChange, className: "flex-1 min-h-0", activeTab: activeTab, onTabChange: handleTabChange, hideTabSwitcher: true, ...chatProps }))));
|
|
166
|
-
});
|
|
167
|
-
ChatWithSidebar.displayName = "ChatWithSidebar";
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import * as React from "../../../../react/react.js";
|
|
2
|
-
import type { ChatMessage, ChatMessagePart, ChatToolPart } from "../../../agent/react/index.js";
|
|
3
|
-
import { type ChatTheme } from "./theme.js";
|
|
4
|
-
/** Props accepted by message. */
|
|
5
|
-
export interface MessageProps {
|
|
6
|
-
/** Message to display */
|
|
7
|
-
message: ChatMessage;
|
|
8
|
-
/** Additional class name */
|
|
9
|
-
className?: string;
|
|
10
|
-
/** Theme customization */
|
|
11
|
-
theme?: Partial<ChatTheme>;
|
|
12
|
-
/** Show role label */
|
|
13
|
-
showRole?: boolean;
|
|
14
|
-
/** Show timestamp */
|
|
15
|
-
showTimestamp?: boolean;
|
|
16
|
-
/** Custom renderer for tool calls (matches tool-${toolName} pattern) */
|
|
17
|
-
renderToolCall?: (part: ChatToolPart) => React.ReactNode;
|
|
18
|
-
/** Custom renderer for dynamic tools */
|
|
19
|
-
renderDynamicTool?: (part: Extract<ChatMessagePart, {
|
|
20
|
-
type: "dynamic-tool";
|
|
21
|
-
}>) => React.ReactNode;
|
|
22
|
-
/** Custom renderer for reasoning */
|
|
23
|
-
renderReasoning?: (part: Extract<ChatMessagePart, {
|
|
24
|
-
type: "reasoning";
|
|
25
|
-
}>) => React.ReactNode;
|
|
26
|
-
}
|
|
27
|
-
/** Render a standalone chat message. */
|
|
28
|
-
export declare const Message: React.ForwardRefExoticComponent<MessageProps & React.RefAttributes<HTMLDivElement>>;
|
|
29
|
-
/** Props accepted by streaming message. */
|
|
30
|
-
export interface StreamingMessageProps {
|
|
31
|
-
/** Streaming message parts */
|
|
32
|
-
parts: ChatMessagePart[];
|
|
33
|
-
/** Show typing cursor */
|
|
34
|
-
showCursor?: boolean;
|
|
35
|
-
/** Additional class name */
|
|
36
|
-
className?: string;
|
|
37
|
-
/** Theme customization */
|
|
38
|
-
theme?: Partial<ChatTheme>;
|
|
39
|
-
}
|
|
40
|
-
/** Message shape for streaming. */
|
|
41
|
-
export declare const StreamingMessage: React.ForwardRefExoticComponent<StreamingMessageProps & React.RefAttributes<HTMLDivElement>>;
|
|
42
|
-
//# sourceMappingURL=message.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../../src/src/react/components/chat/message.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,4BAA4B,CAAC;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAChG,OAAO,EAAE,KAAK,SAAS,EAAqC,MAAM,YAAY,CAAC;AAE/E,iCAAiC;AACjC,MAAM,WAAW,YAAY;IAC3B,yBAAyB;IACzB,OAAO,EAAE,WAAW,CAAC;IAErB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,0BAA0B;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAE3B,sBAAsB;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,qBAAqB;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,wEAAwE;IACxE,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,KAAK,CAAC,SAAS,CAAC;IAEzD,wCAAwC;IACxC,iBAAiB,CAAC,EAAE,CAClB,IAAI,EAAE,OAAO,CAAC,eAAe,EAAE;QAAE,IAAI,EAAE,cAAc,CAAA;KAAE,CAAC,KACrD,KAAK,CAAC,SAAS,CAAC;IAErB,oCAAoC;IACpC,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,eAAe,EAAE;QAAE,IAAI,EAAE,WAAW,CAAA;KAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;CAC9F;AAYD,wCAAwC;AACxC,eAAO,MAAM,OAAO,qFAqFlB,CAAC;AAIH,2CAA2C;AAC3C,MAAM,WAAW,qBAAqB;IACpC,8BAA8B;IAC9B,KAAK,EAAE,eAAe,EAAE,CAAC;IAEzB,yBAAyB;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,0BAA0B;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;CAC5B;AAED,mCAAmC;AACnC,eAAO,MAAM,gBAAgB,8FAgB5B,CAAC"}
|