veryfront 0.1.997 → 0.1.999
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.d.ts +1 -1
- package/esm/cli/templates/manifest.js +15 -15
- 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/embedding/index.d.ts +0 -2
- package/esm/src/embedding/index.d.ts.map +1 -1
- package/esm/src/embedding/index.js +0 -1
- package/esm/src/embedding/upload-handler.d.ts +2 -13
- package/esm/src/embedding/upload-handler.d.ts.map +1 -1
- package/esm/src/embedding/upload-handler.js +24 -17
- package/esm/src/modules/import-map/default-import-map.d.ts.map +1 -1
- package/esm/src/modules/import-map/default-import-map.js +0 -5
- 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/embedding/react/use-uploads.d.ts +0 -33
- package/esm/src/embedding/react/use-uploads.d.ts.map +0 -1
- package/esm/src/embedding/react/use-uploads.js +0 -76
- 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,7 +1,7 @@
|
|
|
1
1
|
import * as React from "../../../../../../react/react.js";
|
|
2
2
|
import { cn } from "../../theme.js";
|
|
3
3
|
/** Render inline citation. */
|
|
4
|
-
export function InlineCitation({ index, source, className, onClick, }) {
|
|
4
|
+
export function InlineCitation({ index, source, className, onClick, renderCard, cardClassName, }) {
|
|
5
5
|
const [showCard, setShowCard] = React.useState(false);
|
|
6
6
|
const timerRef = React.useRef(undefined);
|
|
7
7
|
const buttonRef = React.useRef(null);
|
|
@@ -30,30 +30,29 @@ export function InlineCitation({ index, source, className, onClick, }) {
|
|
|
30
30
|
React.useEffect(() => () => clearTimeout(timerRef.current), []);
|
|
31
31
|
return (React.createElement(React.Fragment, null,
|
|
32
32
|
React.createElement("span", { className: "relative inline-block" },
|
|
33
|
-
React.createElement("button", { ref: buttonRef, type: "button", onClick: () => onClick?.(index), onMouseEnter: show, onMouseLeave: hide, className: cn("inline-flex items-center justify-center", "size-
|
|
34
|
-
showCard && source && (React.createElement("div", { style: cardStyle, className: "w-80 animate-in fade-in duration-150", onMouseEnter: show, onMouseLeave: hide },
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
React.createElement("
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
React.createElement("
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
React.createElement("p", { className: "text-xs text-[var(--card-foreground)] line-clamp-4 leading-relaxed italic" }, source.snippet))),
|
|
33
|
+
React.createElement("button", { ref: buttonRef, type: "button", onClick: () => onClick?.(index), onMouseEnter: show, onMouseLeave: hide, className: cn("inline-flex items-center justify-center", "size-[15px] rounded-full border border-[var(--outline-border)] text-[10px] font-semibold leading-none tabular-nums", "bg-[var(--secondary)] text-[var(--soft)] shadow-sm", "hover:border-[var(--faint)] hover:text-[var(--foreground)] transition-colors", "cursor-pointer align-super -translate-y-px ml-0.5", className) }, index + 1)),
|
|
34
|
+
showCard && source && (React.createElement("div", { style: cardStyle, className: cn("w-80 animate-in fade-in duration-150", cardClassName), onMouseEnter: show, onMouseLeave: hide }, renderCard
|
|
35
|
+
? renderCard(source, index)
|
|
36
|
+
: (React.createElement("div", { className: "rounded-lg bg-[var(--popover)] p-3.5 text-left shadow-sm" },
|
|
37
|
+
React.createElement("div", { className: "min-w-0" },
|
|
38
|
+
React.createElement("p", { className: "text-sm font-medium text-[var(--foreground)] line-clamp-2" }, source.title),
|
|
39
|
+
source.url && (React.createElement("p", { className: "text-[10px] text-[var(--faint)] truncate mt-1 flex items-center gap-1" },
|
|
40
|
+
React.createElement("svg", { className: "size-2.5 shrink-0", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" },
|
|
41
|
+
React.createElement("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
|
|
42
|
+
React.createElement("polyline", { points: "15 3 21 3 21 9" }),
|
|
43
|
+
React.createElement("line", { x1: "10", y1: "14", x2: "21", y2: "3" })),
|
|
44
|
+
source.url))),
|
|
45
|
+
source.snippet && (React.createElement("div", { className: "mt-2.5 border-l-2 border-[var(--outline-border)] pl-3" },
|
|
46
|
+
React.createElement("p", { className: "text-xs text-[var(--foreground)] line-clamp-4 leading-relaxed italic" }, source.snippet))),
|
|
48
47
|
source.score != null && (React.createElement("div", { className: "mt-2.5 flex items-center gap-2" },
|
|
49
|
-
React.createElement("span", { className: "text-[10px] text-[var(--
|
|
50
|
-
React.createElement("div", { className: "flex-1 h-1 rounded-full bg-[var(--
|
|
48
|
+
React.createElement("span", { className: "text-[10px] text-[var(--faint)] shrink-0" }, "Relevance"),
|
|
49
|
+
React.createElement("div", { className: "flex-1 h-1 rounded-full bg-[var(--edge-medium)] overflow-hidden" },
|
|
51
50
|
React.createElement("div", { className: cn("h-full rounded-full transition-all", source.score >= 0.7
|
|
52
51
|
? "bg-emerald-500"
|
|
53
52
|
: source.score >= 0.4
|
|
54
53
|
? "bg-amber-500"
|
|
55
54
|
: "bg-neutral-400"), style: { width: `${Math.round(source.score * 100)}%` } })),
|
|
56
|
-
React.createElement("span", { className: "text-[10px] tabular-nums text-[var(--
|
|
55
|
+
React.createElement("span", { className: "text-[10px] tabular-nums text-[var(--faint)]" },
|
|
57
56
|
Math.round(source.score * 100),
|
|
58
|
-
"%"))))))));
|
|
57
|
+
"%")))))))));
|
|
59
58
|
}
|
|
@@ -1,11 +1,34 @@
|
|
|
1
1
|
import * as React from "../../../../../../react/react.js";
|
|
2
|
-
/**
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Icon overrides for {@link MessageActionBar}. Each defaults to the built-in
|
|
4
|
+
* glyph; `copied` shows briefly after a successful copy.
|
|
5
|
+
*/
|
|
6
|
+
export interface MessageActionBarIcons {
|
|
7
|
+
copy?: React.ReactNode;
|
|
8
|
+
copied?: React.ReactNode;
|
|
9
|
+
edit?: React.ReactNode;
|
|
10
|
+
regenerate?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/** Props accepted by the context-free message action bar. */
|
|
13
|
+
export interface MessageActionBarProps {
|
|
4
14
|
content: string;
|
|
5
15
|
className?: string;
|
|
6
|
-
/**
|
|
16
|
+
/** Override any of the action icons. */
|
|
17
|
+
icons?: MessageActionBarIcons;
|
|
18
|
+
/** Wrap the built-in copy; call `next()` to run it (or skip it). */
|
|
19
|
+
onCopy?: (event: React.MouseEvent<HTMLButtonElement>, next: () => void) => void;
|
|
20
|
+
/** When provided, renders an edit button that calls this handler. */
|
|
7
21
|
onEdit?: (content: string) => void;
|
|
22
|
+
/** When provided, renders a regenerate button that calls this handler. */
|
|
23
|
+
onRegenerate?: () => void;
|
|
8
24
|
}
|
|
9
|
-
/**
|
|
10
|
-
|
|
25
|
+
/**
|
|
26
|
+
* MessageActionBar — the low-level, context-free hover action bar (copy / edit /
|
|
27
|
+
* regenerate). Used where there is no `Message.Root` context (e.g. the legacy
|
|
28
|
+
* message-list row). Inside a `Message`, prefer `Message.Actions` +
|
|
29
|
+
* `Message.CopyAction`/… which read from context.
|
|
30
|
+
*
|
|
31
|
+
* Renamed from `MessageActions` to end the collision with `Message.Actions`.
|
|
32
|
+
*/
|
|
33
|
+
export declare const MessageActionBar: React.ForwardRefExoticComponent<MessageActionBarProps & React.RefAttributes<HTMLDivElement>>;
|
|
11
34
|
//# sourceMappingURL=message-actions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-actions.d.ts","sourceRoot":"","sources":["../../../../../../../src/src/react/components/chat/chat/components/message-actions.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"message-actions.d.ts","sourceRoot":"","sources":["../../../../../../../src/src/react/components/chat/chat/components/message-actions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,kCAAkC,CAAC;AAQ1D;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B;AAED,6DAA6D;AAC7D,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,KAAK,CAAC,EAAE,qBAAqB,CAAC;IAC9B,oEAAoE;IACpE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,IAAI,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IAChF,qEAAqE;IACrE,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,0EAA0E;IAC1E,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,8FAyD5B,CAAC"}
|
|
@@ -1,39 +1,27 @@
|
|
|
1
1
|
import * as React from "../../../../../../react/react.js";
|
|
2
2
|
import { cn } from "../../theme.js";
|
|
3
|
-
import { CheckIcon, CopyIcon } from "../../icons/index.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
fallbackCopy();
|
|
27
|
-
}
|
|
28
|
-
finally {
|
|
29
|
-
setCopiedWithTimeout();
|
|
30
|
-
}
|
|
31
|
-
}, [content, fallbackCopy, setCopiedWithTimeout]);
|
|
32
|
-
return (React.createElement("div", { ref: ref, className: cn("flex items-center gap-0.5 mt-1.5 opacity-0 group-hover/msg:opacity-100 transition-all duration-200", className) },
|
|
33
|
-
React.createElement("button", { type: "button", onClick: handleCopy, className: ACTION_BUTTON, title: copied ? "Copied!" : "Copy to clipboard", "aria-label": copied ? "Copied!" : "Copy to clipboard" }, copied ? React.createElement(CheckIcon, { className: "size-3.5" }) : React.createElement(CopyIcon, { className: "size-3.5" })),
|
|
34
|
-
onEdit && (React.createElement("button", { type: "button", onClick: () => onEdit(content), className: ACTION_BUTTON, title: "Edit message", "aria-label": "Edit message" },
|
|
35
|
-
React.createElement("svg", { className: "size-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" },
|
|
36
|
-
React.createElement("path", { d: "M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z" }),
|
|
37
|
-
React.createElement("path", { d: "m15 5 4 4" }))))));
|
|
3
|
+
import { CheckIcon, CopyIcon, PencilIcon, RefreshCwIcon } from "../../icons/index.js";
|
|
4
|
+
import { useClipboard } from "../hooks/use-clipboard.js";
|
|
5
|
+
const ACTION_BUTTON = "inline-flex items-center justify-center size-7 rounded-full text-[var(--faint)] transition-colors hover:bg-[var(--tertiary)] hover:text-[var(--foreground)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--edge-medium)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--background)]";
|
|
6
|
+
/**
|
|
7
|
+
* MessageActionBar — the low-level, context-free hover action bar (copy / edit /
|
|
8
|
+
* regenerate). Used where there is no `Message.Root` context (e.g. the legacy
|
|
9
|
+
* message-list row). Inside a `Message`, prefer `Message.Actions` +
|
|
10
|
+
* `Message.CopyAction`/… which read from context.
|
|
11
|
+
*
|
|
12
|
+
* Renamed from `MessageActions` to end the collision with `Message.Actions`.
|
|
13
|
+
*/
|
|
14
|
+
export const MessageActionBar = React.forwardRef(function MessageActionBar({ content, className, icons, onCopy, onEdit, onRegenerate }, ref) {
|
|
15
|
+
const { copied, copy } = useClipboard();
|
|
16
|
+
const doCopy = React.useCallback(() => void copy(content), [copy, content]);
|
|
17
|
+
return (React.createElement("div", { ref: ref, className: cn(
|
|
18
|
+
// No vertical margin here — the footer row owns spacing/alignment so
|
|
19
|
+
// the buttons stay centered with the token count beside them.
|
|
20
|
+
"flex items-center gap-0.5 opacity-0 group-hover/msg:opacity-100 transition-all duration-200", className) },
|
|
21
|
+
React.createElement("button", { type: "button", onClick: (e) => (onCopy ? onCopy(e, doCopy) : doCopy()), className: ACTION_BUTTON, title: copied ? "Copied!" : "Copy to clipboard", "aria-label": copied ? "Copied!" : "Copy to clipboard" }, copied
|
|
22
|
+
? (icons?.copied ?? React.createElement(CheckIcon, { className: "size-3.5" }))
|
|
23
|
+
: (icons?.copy ?? React.createElement(CopyIcon, { className: "size-3.5" }))),
|
|
24
|
+
onRegenerate && (React.createElement("button", { type: "button", onClick: onRegenerate, className: ACTION_BUTTON, title: "Regenerate response", "aria-label": "Regenerate response" }, icons?.regenerate ?? React.createElement(RefreshCwIcon, { className: "size-3.5" }))),
|
|
25
|
+
onEdit && (React.createElement("button", { type: "button", onClick: () => onEdit(content), className: ACTION_BUTTON, title: "Edit message", "aria-label": "Edit message" }, icons?.edit ?? React.createElement(PencilIcon, { className: "size-3.5" })))));
|
|
38
26
|
});
|
|
39
|
-
|
|
27
|
+
MessageActionBar.displayName = "MessageActionBar";
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import * as React from "../../../../../../react/react.js";
|
|
2
2
|
/** Props accepted by message edit form. */
|
|
3
|
-
export interface MessageEditFormProps {
|
|
3
|
+
export interface MessageEditFormProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "className"> {
|
|
4
4
|
initialContent: string;
|
|
5
5
|
onSave: (content: string) => void;
|
|
6
6
|
onCancel: () => void;
|
|
7
|
+
className?: string;
|
|
8
|
+
/** Label for the save/submit button. Defaults to "Save & Submit". */
|
|
9
|
+
saveLabel?: string;
|
|
10
|
+
/** Label for the cancel button. Defaults to "Cancel". */
|
|
11
|
+
cancelLabel?: string;
|
|
7
12
|
}
|
|
8
13
|
/** Render message edit form. */
|
|
9
|
-
export declare function MessageEditForm({ initialContent, onSave, onCancel, }: MessageEditFormProps): React.ReactElement;
|
|
14
|
+
export declare function MessageEditForm({ initialContent, onSave, onCancel, className, saveLabel, cancelLabel, ...props }: MessageEditFormProps): React.ReactElement;
|
|
10
15
|
//# sourceMappingURL=message-edit-form.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-edit-form.d.ts","sourceRoot":"","sources":["../../../../../../../src/src/react/components/chat/chat/components/message-edit-form.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,kCAAkC,CAAC;AAG1D,2CAA2C;AAC3C,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"message-edit-form.d.ts","sourceRoot":"","sources":["../../../../../../../src/src/react/components/chat/chat/components/message-edit-form.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,kCAAkC,CAAC;AAG1D,2CAA2C;AAC3C,MAAM,WAAW,oBACf,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,WAAW,CAAC;IAC/D,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,gCAAgC;AAChC,wBAAgB,eAAe,CAAC,EAC9B,cAAc,EACd,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAA2B,EAC3B,WAAsB,EACtB,GAAG,KAAK,EACT,EAAE,oBAAoB,GAAG,KAAK,CAAC,YAAY,CAgF3C"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "../../../../../../react/react.js";
|
|
2
2
|
import { cn } from "../../theme.js";
|
|
3
3
|
/** Render message edit form. */
|
|
4
|
-
export function MessageEditForm({ initialContent, onSave, onCancel, }) {
|
|
4
|
+
export function MessageEditForm({ initialContent, onSave, onCancel, className, saveLabel = "Save & Submit", cancelLabel = "Cancel", ...props }) {
|
|
5
5
|
const [content, setContent] = React.useState(initialContent);
|
|
6
6
|
const textareaRef = React.useRef(null);
|
|
7
7
|
React.useEffect(() => {
|
|
@@ -32,16 +32,16 @@ export function MessageEditForm({ initialContent, onSave, onCancel, }) {
|
|
|
32
32
|
onSave(trimmed);
|
|
33
33
|
}
|
|
34
34
|
}, [content, onSave, onCancel]);
|
|
35
|
-
return (React.createElement("div", { className: "w-full" },
|
|
35
|
+
return (React.createElement("div", { ...props, className: cn("w-full", className) },
|
|
36
36
|
React.createElement("textarea", { ref: textareaRef, value: content, onChange: (e) => {
|
|
37
37
|
setContent(e.target.value);
|
|
38
38
|
resize();
|
|
39
|
-
}, onKeyDown: handleKeyDown, rows: 1, className: cn("w-full resize-none rounded-
|
|
39
|
+
}, onKeyDown: handleKeyDown, rows: 1, className: cn("w-full resize-none rounded-[var(--radius-lg)] px-4 py-3 text-[15px] leading-relaxed", "border border-[var(--outline-border)] bg-[var(--secondary)]", "focus:outline-none focus-visible:border-[var(--edge-medium)]", "text-[var(--foreground)]") }),
|
|
40
40
|
React.createElement("div", { className: "flex items-center gap-2 mt-2" },
|
|
41
41
|
React.createElement("button", { type: "button", onClick: () => {
|
|
42
42
|
const trimmed = content.trim();
|
|
43
43
|
if (trimmed)
|
|
44
44
|
onSave(trimmed);
|
|
45
|
-
}, disabled: !content.trim(), className: cn("px-3 py-1.5 text-xs font-medium rounded-full transition-all", "bg-[var(--primary)] text-[var(--
|
|
46
|
-
React.createElement("button", { type: "button", onClick: onCancel, className: "px-3 py-1.5 text-xs font-medium rounded-full text-[var(--
|
|
45
|
+
}, disabled: !content.trim(), className: cn("px-3 py-1.5 text-xs font-medium rounded-full transition-all", "bg-[var(--primary)] text-[var(--secondary)]", "hover:bg-[var(--secondary)] hover:text-[var(--foreground)]", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--edge-medium)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--background)]", "disabled:opacity-50 disabled:pointer-events-none") }, saveLabel),
|
|
46
|
+
React.createElement("button", { type: "button", onClick: onCancel, className: "px-3 py-1.5 text-xs font-medium rounded-full text-[var(--faint)] hover:bg-[var(--tertiary)] hover:text-[var(--foreground)] transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--edge-medium)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--background)]" }, cancelLabel))));
|
|
47
47
|
}
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import * as React from "../../../../../../react/react.js";
|
|
2
2
|
/** Public API contract for feedback value. */
|
|
3
3
|
export type FeedbackValue = "positive" | "negative";
|
|
4
|
+
/**
|
|
5
|
+
* Icon overrides for {@link MessageFeedback}. Each defaults to the built-in
|
|
6
|
+
* thumbs glyph.
|
|
7
|
+
*/
|
|
8
|
+
export interface MessageFeedbackIcons {
|
|
9
|
+
positive?: React.ReactNode;
|
|
10
|
+
negative?: React.ReactNode;
|
|
11
|
+
}
|
|
4
12
|
/** Props accepted by message feedback. */
|
|
5
|
-
export interface MessageFeedbackProps {
|
|
13
|
+
export interface MessageFeedbackProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onClick" | "className"> {
|
|
6
14
|
messageId: string;
|
|
7
15
|
feedback?: FeedbackValue | null;
|
|
8
16
|
onFeedback: (messageId: string, feedback: FeedbackValue) => void;
|
|
9
17
|
className?: string;
|
|
18
|
+
/** Override either of the thumbs icons. */
|
|
19
|
+
icons?: MessageFeedbackIcons;
|
|
10
20
|
}
|
|
11
21
|
/** Render message feedback. */
|
|
12
22
|
export declare const MessageFeedback: React.ForwardRefExoticComponent<MessageFeedbackProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-feedback.d.ts","sourceRoot":"","sources":["../../../../../../../src/src/react/components/chat/chat/components/message-feedback.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,kCAAkC,CAAC;AAG1D,8CAA8C;AAC9C,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,UAAU,CAAC;AAEpD,0CAA0C;AAC1C,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"message-feedback.d.ts","sourceRoot":"","sources":["../../../../../../../src/src/react/components/chat/chat/components/message-feedback.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,kCAAkC,CAAC;AAG1D,8CAA8C;AAC9C,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,UAAU,CAAC;AAEpD;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,0CAA0C;AAC1C,MAAM,WAAW,oBACf,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;IAC3E,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IAChC,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAC;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,oBAAoB,CAAC;CAC9B;AAKD,+BAA+B;AAC/B,eAAO,MAAM,eAAe,6FAkE3B,CAAC"}
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import * as React from "../../../../../../react/react.js";
|
|
2
2
|
import { cn } from "../../theme.js";
|
|
3
|
-
const BUTTON_BASE = "inline-flex items-center justify-center size-7 rounded-full transition-
|
|
3
|
+
const BUTTON_BASE = "inline-flex items-center justify-center size-7 rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--edge-medium)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--background)]";
|
|
4
4
|
/** Render message feedback. */
|
|
5
|
-
export const MessageFeedback = React.forwardRef(function MessageFeedback({ messageId, feedback, onFeedback, className }, ref) {
|
|
6
|
-
return (React.createElement("div", { ref: ref, className: cn("flex items-center gap-1", className) },
|
|
5
|
+
export const MessageFeedback = React.forwardRef(function MessageFeedback({ messageId, feedback, onFeedback, className, icons, ...props }, ref) {
|
|
6
|
+
return (React.createElement("div", { ref: ref, ...props, className: cn("flex items-center gap-1", className) },
|
|
7
7
|
React.createElement("button", { type: "button", onClick: () => onFeedback(messageId, "positive"), className: cn(BUTTON_BASE, feedback === "positive"
|
|
8
8
|
? "text-emerald-500 bg-emerald-500/10"
|
|
9
|
-
: "text-[var(--
|
|
10
|
-
React.createElement("
|
|
11
|
-
|
|
12
|
-
React.createElement("path", { d: "M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2h0a3.13 3.13 0 0 1 3 3.88Z" }))),
|
|
9
|
+
: "text-[var(--faint)] hover:bg-[var(--tertiary)] hover:text-emerald-500"), title: "Helpful" }, icons?.positive ?? (React.createElement("svg", { className: "size-3.5", viewBox: "0 0 24 24", fill: feedback === "positive" ? "currentColor" : "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" },
|
|
10
|
+
React.createElement("path", { d: "M7 10v12" }),
|
|
11
|
+
React.createElement("path", { d: "M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2h0a3.13 3.13 0 0 1 3 3.88Z" })))),
|
|
13
12
|
React.createElement("button", { type: "button", onClick: () => onFeedback(messageId, "negative"), className: cn(BUTTON_BASE, feedback === "negative"
|
|
14
13
|
? "text-red-500 bg-red-500/10"
|
|
15
|
-
: "text-[var(--
|
|
16
|
-
React.createElement("
|
|
17
|
-
|
|
18
|
-
React.createElement("path", { d: "M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22h0a3.13 3.13 0 0 1-3-3.88Z" })))));
|
|
14
|
+
: "text-[var(--faint)] hover:bg-[var(--tertiary)] hover:text-[var(--destructive)]"), title: "Not helpful" }, icons?.negative ?? (React.createElement("svg", { className: "size-3.5", viewBox: "0 0 24 24", fill: feedback === "negative" ? "currentColor" : "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" },
|
|
15
|
+
React.createElement("path", { d: "M17 14V2" }),
|
|
16
|
+
React.createElement("path", { d: "M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22h0a3.13 3.13 0 0 1-3-3.88Z" }))))));
|
|
19
17
|
});
|
|
20
18
|
MessageFeedback.displayName = "MessageFeedback";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quick-actions.d.ts","sourceRoot":"","sources":["../../../../../../../src/src/react/components/chat/chat/components/quick-actions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,kCAAkC,CAAC;AAG1D,4CAA4C;AAC5C,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,uCAAuC;AACvC,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,4BAA4B;AAC5B,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,aAAa,EACb,SAAS,GACV,EAAE,iBAAiB,GAAG,KAAK,CAAC,YAAY,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"quick-actions.d.ts","sourceRoot":"","sources":["../../../../../../../src/src/react/components/chat/chat/components/quick-actions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,kCAAkC,CAAC;AAG1D,4CAA4C;AAC5C,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,uCAAuC;AACvC,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,4BAA4B;AAC5B,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,aAAa,EACb,SAAS,GACV,EAAE,iBAAiB,GAAG,KAAK,CAAC,YAAY,GAAG,IAAI,CAkB/C"}
|
|
@@ -4,5 +4,7 @@ import { cn } from "../../theme.js";
|
|
|
4
4
|
export function QuickActions({ actions, onActionClick, className, }) {
|
|
5
5
|
if (!actions || actions.length === 0)
|
|
6
6
|
return null;
|
|
7
|
-
return (React.createElement("div", { className: cn("flex flex-wrap gap-2", className) }, actions.map((action) => (React.createElement("button", { key: action.id, type: "button", onClick: () => onActionClick?.(action), className: "rounded-full border border-[var(--border)] px-4 py-2 text-sm text-[var(--
|
|
7
|
+
return (React.createElement("div", { className: cn("flex flex-wrap gap-2", className) }, actions.map((action) => (React.createElement("button", { key: action.id, type: "button", onClick: () => onActionClick?.(action), className: "rounded-full border border-[var(--outline-border)] px-4 py-2 text-sm text-[var(--faint)] transition-colors hover:border-[var(--edge-medium)] hover:bg-[var(--tertiary)] hover:text-[var(--foreground)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--edge-medium)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--background)]" },
|
|
8
|
+
action.icon,
|
|
9
|
+
action.label)))));
|
|
8
10
|
}
|
|
@@ -1,10 +1,73 @@
|
|
|
1
1
|
import * as React from "../../../../../../react/react.js";
|
|
2
|
-
|
|
2
|
+
/** Per-card state shared with `Reasoning.*` sub-parts. */
|
|
3
|
+
export interface ReasoningContextValue {
|
|
4
|
+
text: string;
|
|
5
|
+
isStreaming: boolean;
|
|
6
|
+
isOpen: boolean;
|
|
7
|
+
toggle: () => void;
|
|
8
|
+
}
|
|
9
|
+
/** Read the enclosing `Reasoning` state. Throws when used outside a `Reasoning`. */
|
|
10
|
+
export declare function useReasoning(): ReasoningContextValue;
|
|
11
|
+
/** Props accepted by `Reasoning` / `Reasoning.Root` (aka `ReasoningCard`). */
|
|
12
|
+
export interface ReasoningProps {
|
|
3
13
|
text: string;
|
|
4
14
|
isStreaming?: boolean;
|
|
5
15
|
className?: string;
|
|
16
|
+
/** Overrides the chevron glyph. Rotation-on-open styling is applied to the
|
|
17
|
+
* wrapper, so a custom icon does not need to know about open state. */
|
|
18
|
+
icon?: React.ReactNode;
|
|
19
|
+
/** Override the two labels; each defaults to the current string. */
|
|
20
|
+
labels?: {
|
|
21
|
+
thinking?: string;
|
|
22
|
+
thought?: string;
|
|
23
|
+
};
|
|
24
|
+
/** Controlled open state. When provided, the component is controlled and the
|
|
25
|
+
* auto open/collapse behaviour is disabled (the parent owns the state). */
|
|
26
|
+
open?: boolean;
|
|
27
|
+
/** Initial open value when uncontrolled. Defaults to whether the card is
|
|
28
|
+
* streaming at mount — so a completed / reloaded reasoning starts collapsed
|
|
29
|
+
* and never animates, while a live one opens as tokens arrive. */
|
|
30
|
+
defaultOpen?: boolean;
|
|
31
|
+
/** Called whenever the open state should change (both controlled and not). */
|
|
32
|
+
onOpenChange?: (open: boolean) => void;
|
|
33
|
+
/** Compose your own disclosure; when omitted, the default anatomy renders. */
|
|
34
|
+
children?: React.ReactNode;
|
|
35
|
+
}
|
|
36
|
+
/** Props for `Reasoning.Trigger` — the disclosure button. */
|
|
37
|
+
export interface ReasoningTriggerProps {
|
|
38
|
+
/** Overrides the chevron glyph. */
|
|
39
|
+
icon?: React.ReactNode;
|
|
40
|
+
/** Override the two labels; each defaults to the current string. */
|
|
41
|
+
labels?: {
|
|
42
|
+
thinking?: string;
|
|
43
|
+
thought?: string;
|
|
44
|
+
};
|
|
45
|
+
className?: string;
|
|
46
|
+
}
|
|
47
|
+
/** The header row: a "Thinking…" / "Thought process" label + expand chevron. */
|
|
48
|
+
declare function ReasoningTrigger({ icon, labels, className }: ReasoningTriggerProps): React.JSX.Element;
|
|
49
|
+
declare namespace ReasoningTrigger {
|
|
50
|
+
var displayName: string;
|
|
51
|
+
}
|
|
52
|
+
/** The reasoning body. Renders when open; pass children to replace the markdown. */
|
|
53
|
+
declare function ReasoningContent({ className, children }: {
|
|
54
|
+
className?: string;
|
|
55
|
+
children?: React.ReactNode;
|
|
56
|
+
}): React.JSX.Element | null;
|
|
57
|
+
declare namespace ReasoningContent {
|
|
58
|
+
var displayName: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Reasoning — render `<Reasoning text={…} />` for the default disclosure, or
|
|
62
|
+
* compose `Reasoning.Trigger` + `Reasoning.Content` for a custom layout.
|
|
63
|
+
* Mirrors the `Message` / `ToolCall` compounds: render it, or compose it.
|
|
64
|
+
*/
|
|
65
|
+
export declare const Reasoning: React.ForwardRefExoticComponent<ReasoningProps & React.RefAttributes<HTMLDivElement>> & {
|
|
66
|
+
Root: React.ForwardRefExoticComponent<ReasoningProps & React.RefAttributes<HTMLDivElement>>;
|
|
67
|
+
Trigger: typeof ReasoningTrigger;
|
|
68
|
+
Content: typeof ReasoningContent;
|
|
6
69
|
};
|
|
7
|
-
/**
|
|
8
|
-
export declare const ReasoningCard: React.ForwardRefExoticComponent<
|
|
70
|
+
/** Back-compat alias — `message.tsx` and `agent-card.tsx` import `ReasoningCard`. */
|
|
71
|
+
export declare const ReasoningCard: React.ForwardRefExoticComponent<ReasoningProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
72
|
export {};
|
|
10
73
|
//# sourceMappingURL=reasoning.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reasoning.d.ts","sourceRoot":"","sources":["../../../../../../../src/src/react/components/chat/chat/components/reasoning.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"reasoning.d.ts","sourceRoot":"","sources":["../../../../../../../src/src/react/components/chat/chat/components/reasoning.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,kCAAkC,CAAC;AAgB1D,0DAA0D;AAC1D,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAID,oFAAoF;AACpF,wBAAgB,YAAY,IAAI,qBAAqB,CAQpD;AAED,8EAA8E;AAC9E,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;4EACwE;IACxE,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,oEAAoE;IACpE,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjD;gFAC4E;IAC5E,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;uEAEmE;IACnE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,8EAA8E;IAC9E,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAqFD,6DAA6D;AAC7D,MAAM,WAAW,qBAAqB;IACpC,mCAAmC;IACnC,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,oEAAoE;IACpE,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,gFAAgF;AAChF,iBAAS,gBAAgB,CACvB,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,qBAAqB,GACjD,KAAK,CAAC,GAAG,CAAC,OAAO,CA0BnB;kBA5BQ,gBAAgB;;;AA+BzB,oFAAoF;AACpF,iBAAS,gBAAgB,CACvB,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,GAC1E,KAAK,CAAC,GAAG,CAAC,OAAO,GAAG,IAAI,CAY1B;kBAdQ,gBAAgB;;;AAiBzB;;;;GAIG;AACH,eAAO,MAAM,SAAS;;;;CAIpB,CAAC;AAEH,qFAAqF;AACrF,eAAO,MAAM,aAAa,uFAAgB,CAAC"}
|
|
@@ -1,30 +1,104 @@
|
|
|
1
1
|
import * as React from "../../../../../../react/react.js";
|
|
2
2
|
import { cn } from "../../theme.js";
|
|
3
3
|
import { Markdown } from "../../markdown.js";
|
|
4
|
-
import {
|
|
4
|
+
import { ChevronDownIcon } from "../../icons/index.js";
|
|
5
|
+
import { COMPONENT_ERROR } from "../../../../../errors/error-registry.js";
|
|
5
6
|
import { Shimmer } from "./animations.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const ReasoningContext = React.createContext(null);
|
|
8
|
+
/** Read the enclosing `Reasoning` state. Throws when used outside a `Reasoning`. */
|
|
9
|
+
export function useReasoning() {
|
|
10
|
+
const ctx = React.useContext(ReasoningContext);
|
|
11
|
+
if (!ctx) {
|
|
12
|
+
throw COMPONENT_ERROR.create({
|
|
13
|
+
detail: "useReasoning must be used within a Reasoning",
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return ctx;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* `Reasoning.Root` — context provider + wrapper. No children renders the
|
|
20
|
+
* default anatomy (`Trigger` + `Content`); pass children to recompose.
|
|
21
|
+
*/
|
|
22
|
+
const ReasoningRoot = React.forwardRef(function Reasoning({ text, isStreaming = false, className, icon, labels, open, defaultOpen, onOpenChange, children, }, ref) {
|
|
23
|
+
const isControlled = open !== undefined;
|
|
24
|
+
// Uncontrolled default: open only if we mount mid-stream. A completed /
|
|
25
|
+
// reloaded card (isStreaming === false) starts collapsed, so it never
|
|
26
|
+
// plays the open-then-collapse animation.
|
|
27
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen ?? isStreaming);
|
|
28
|
+
const isOpen = isControlled ? open : uncontrolledOpen;
|
|
9
29
|
const userToggledRef = React.useRef(false);
|
|
30
|
+
// Tracks whether this card has ever streamed during its lifetime. We only
|
|
31
|
+
// auto-collapse once streaming actually ends — a card that was never
|
|
32
|
+
// streaming (history reload) has nothing to animate away from.
|
|
33
|
+
const hasStreamedRef = React.useRef(isStreaming);
|
|
10
34
|
React.useEffect(() => {
|
|
11
|
-
|
|
35
|
+
// Parent owns state when controlled, and a manual toggle opts out of the
|
|
36
|
+
// stream-driven open/collapse entirely.
|
|
37
|
+
if (isControlled || userToggledRef.current)
|
|
12
38
|
return;
|
|
13
|
-
|
|
39
|
+
if (isStreaming) {
|
|
40
|
+
hasStreamedRef.current = true;
|
|
41
|
+
if (!isOpen) {
|
|
42
|
+
setUncontrolledOpen(true);
|
|
43
|
+
onOpenChange?.(true);
|
|
44
|
+
}
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
// Streaming just finished in this session — collapse after a beat. If we
|
|
48
|
+
// never streamed (reloaded chat), leave the card exactly as it mounted.
|
|
49
|
+
if (!hasStreamedRef.current || !isOpen)
|
|
50
|
+
return;
|
|
51
|
+
const timer = globalThis.setTimeout(() => {
|
|
52
|
+
setUncontrolledOpen(false);
|
|
53
|
+
onOpenChange?.(false);
|
|
54
|
+
}, 1000);
|
|
14
55
|
return () => clearTimeout(timer);
|
|
15
|
-
}, [isStreaming, isOpen]);
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
56
|
+
}, [isControlled, isStreaming, isOpen, onOpenChange]);
|
|
57
|
+
const toggle = React.useCallback(() => {
|
|
58
|
+
userToggledRef.current = true;
|
|
59
|
+
const next = !isOpen;
|
|
60
|
+
if (!isControlled)
|
|
61
|
+
setUncontrolledOpen(next);
|
|
62
|
+
onOpenChange?.(next);
|
|
63
|
+
}, [isControlled, isOpen, onOpenChange]);
|
|
64
|
+
const context = { text, isStreaming, isOpen, toggle };
|
|
65
|
+
return (React.createElement(ReasoningContext.Provider, { value: context },
|
|
66
|
+
React.createElement("div", { ref: ref, className: cn("not-prose mb-3", className) }, children ?? (React.createElement(React.Fragment, null,
|
|
67
|
+
React.createElement(ReasoningTrigger, { icon: icon, labels: labels }),
|
|
68
|
+
React.createElement(ReasoningContent, null))))));
|
|
69
|
+
});
|
|
70
|
+
ReasoningRoot.displayName = "Reasoning.Root";
|
|
71
|
+
/** The header row: a "Thinking…" / "Thought process" label + expand chevron. */
|
|
72
|
+
function ReasoningTrigger({ icon, labels, className }) {
|
|
73
|
+
const { isStreaming, isOpen, toggle } = useReasoning();
|
|
74
|
+
const thinkingLabel = labels?.thinking ?? "Thinking...";
|
|
75
|
+
const thoughtLabel = labels?.thought ?? "Thought process";
|
|
76
|
+
const label = isStreaming ? React.createElement(Shimmer, null, thinkingLabel) : React.createElement("span", null, thoughtLabel);
|
|
77
|
+
return (React.createElement("button", { type: "button", onClick: toggle, className: cn("flex w-full items-center gap-2 rounded-sm text-sm text-[var(--foreground)] outline-none transition-colors focus-visible:ring-2 focus-visible:ring-[var(--edge-medium)] focus-visible:ring-offset-0", className) },
|
|
78
|
+
label,
|
|
79
|
+
React.createElement("span", { className: cn("flex size-3.5 shrink-0 items-center justify-center transition-transform duration-200", !isOpen && "-rotate-90") }, icon ?? React.createElement(ChevronDownIcon, { className: "size-3.5 shrink-0" }))));
|
|
80
|
+
}
|
|
81
|
+
ReasoningTrigger.displayName = "Reasoning.Trigger";
|
|
82
|
+
/** The reasoning body. Renders when open; pass children to replace the markdown. */
|
|
83
|
+
function ReasoningContent({ className, children }) {
|
|
84
|
+
const { text, isOpen } = useReasoning();
|
|
85
|
+
if (!isOpen)
|
|
86
|
+
return null;
|
|
87
|
+
return (React.createElement("div", { className: cn("mt-2 text-sm text-[var(--foreground)]", className) }, children ?? (
|
|
88
|
+
// `text-sm!` overrides Markdown's base `text-base` (cn does not tw-merge)
|
|
89
|
+
// so reasoning renders at 14px like Studio's compact variant.
|
|
90
|
+
React.createElement(Markdown, { className: "mb-0 space-y-2.5 text-sm!" }, text))));
|
|
91
|
+
}
|
|
92
|
+
ReasoningContent.displayName = "Reasoning.Content";
|
|
93
|
+
/**
|
|
94
|
+
* Reasoning — render `<Reasoning text={…} />` for the default disclosure, or
|
|
95
|
+
* compose `Reasoning.Trigger` + `Reasoning.Content` for a custom layout.
|
|
96
|
+
* Mirrors the `Message` / `ToolCall` compounds: render it, or compose it.
|
|
97
|
+
*/
|
|
98
|
+
export const Reasoning = Object.assign(ReasoningRoot, {
|
|
99
|
+
Root: ReasoningRoot,
|
|
100
|
+
Trigger: ReasoningTrigger,
|
|
101
|
+
Content: ReasoningContent,
|
|
29
102
|
});
|
|
30
|
-
|
|
103
|
+
/** Back-compat alias — `message.tsx` and `agent-card.tsx` import `ReasoningCard`. */
|
|
104
|
+
export const ReasoningCard = ReasoningRoot;
|