veryfront 0.1.997 → 0.1.998
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/cli/templates/manifest.js +1 -1
- package/esm/deno.d.ts +7 -0
- package/esm/deno.js +11 -3
- package/esm/deps/esm.sh/react-dom@19.2.4.d.ts +2 -0
- package/esm/deps/esm.sh/react-dom@19.2.4.d.ts.map +1 -0
- package/esm/deps/esm.sh/react-dom@19.2.4.js +3 -0
- package/esm/react/react-dom.d.ts +3 -0
- package/esm/react/react-dom.d.ts.map +1 -0
- package/esm/react/react-dom.js +2 -0
- package/esm/src/agent/ag-ui/host-support.d.ts.map +1 -1
- package/esm/src/agent/ag-ui/host-support.js +12 -0
- package/esm/src/agent/react/index.d.ts +4 -2
- package/esm/src/agent/react/index.d.ts.map +1 -1
- package/esm/src/agent/react/index.js +2 -1
- package/esm/src/agent/react/use-agent-metadata.d.ts +5 -0
- package/esm/src/agent/react/use-agent-metadata.d.ts.map +1 -1
- package/esm/src/agent/react/use-agent-metadata.js +18 -9
- package/esm/src/agent/react/use-agents.d.ts +33 -0
- package/esm/src/agent/react/use-agents.d.ts.map +1 -0
- package/esm/src/agent/react/use-agents.js +72 -0
- package/esm/src/agent/react/use-chat/index.d.ts +1 -1
- package/esm/src/agent/react/use-chat/index.d.ts.map +1 -1
- package/esm/src/agent/react/use-chat/types.d.ts +3 -2
- package/esm/src/agent/react/use-chat/types.d.ts.map +1 -1
- package/esm/src/agent/react/use-chat/use-chat.d.ts +12 -1
- package/esm/src/agent/react/use-chat/use-chat.d.ts.map +1 -1
- package/esm/src/agent/react/use-chat/use-chat.js +47 -7
- package/esm/src/agent/react/use-chat/utils.d.ts.map +1 -1
- package/esm/src/agent/react/use-chat/utils.js +4 -0
- package/esm/src/agent/runtime/message-adapter.d.ts.map +1 -1
- package/esm/src/agent/runtime/message-adapter.js +3 -1
- package/esm/src/agent/runtime/text-generation-runtime-message-converter.d.ts.map +1 -1
- package/esm/src/agent/runtime/text-generation-runtime-message-converter.js +6 -2
- package/esm/src/chat/index.d.ts +17 -7
- package/esm/src/chat/index.d.ts.map +1 -1
- package/esm/src/chat/index.js +33 -7
- package/esm/src/chat/protocol.d.ts +13 -1
- package/esm/src/chat/protocol.d.ts.map +1 -1
- package/esm/src/chat/upload-handler.d.ts +55 -0
- package/esm/src/chat/upload-handler.d.ts.map +1 -0
- package/esm/src/chat/upload-handler.js +180 -0
- package/esm/src/discovery/import-rewriter.d.ts +1 -1
- package/esm/src/discovery/import-rewriter.d.ts.map +1 -1
- package/esm/src/discovery/import-rewriter.js +2 -0
- package/esm/src/discovery/transpiler.d.ts.map +1 -1
- package/esm/src/discovery/transpiler.js +2 -0
- package/esm/src/react/components/chat/agent-card.d.ts +84 -11
- package/esm/src/react/components/chat/agent-card.d.ts.map +1 -1
- package/esm/src/react/components/chat/agent-card.js +151 -57
- package/esm/src/react/components/chat/agent-picker.d.ts +166 -0
- package/esm/src/react/components/chat/agent-picker.d.ts.map +1 -0
- package/esm/src/react/components/chat/agent-picker.js +183 -0
- package/esm/src/react/components/chat/chat/components/animations.js +1 -1
- package/esm/src/react/components/chat/chat/components/attachment-pill.d.ts +125 -3
- package/esm/src/react/components/chat/chat/components/attachment-pill.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/attachment-pill.js +209 -25
- package/esm/src/react/components/chat/chat/components/attachments-panel.d.ts +149 -0
- package/esm/src/react/components/chat/chat/components/attachments-panel.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/components/attachments-panel.js +187 -0
- package/esm/src/react/components/chat/chat/components/branch-picker.d.ts +13 -2
- package/esm/src/react/components/chat/chat/components/branch-picker.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/branch-picker.js +6 -8
- package/esm/src/react/components/chat/chat/components/chat-messages-skeleton.d.ts +20 -0
- package/esm/src/react/components/chat/chat/components/chat-messages-skeleton.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/components/chat-messages-skeleton.js +31 -0
- package/esm/src/react/components/chat/chat/components/code-block.d.ts +9 -1
- package/esm/src/react/components/chat/chat/components/code-block.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/code-block.js +14 -6
- package/esm/src/react/components/chat/chat/components/drop-zone.d.ts +11 -4
- package/esm/src/react/components/chat/chat/components/drop-zone.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/drop-zone.js +10 -8
- package/esm/src/react/components/chat/chat/components/empty-state.d.ts +2 -1
- package/esm/src/react/components/chat/chat/components/empty-state.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/empty-state.js +7 -8
- package/esm/src/react/components/chat/chat/components/inference-badge.d.ts +6 -2
- package/esm/src/react/components/chat/chat/components/inference-badge.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/inference-badge.js +5 -4
- package/esm/src/react/components/chat/chat/components/inline-citation.d.ts +9 -1
- package/esm/src/react/components/chat/chat/components/inline-citation.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/inline-citation.js +19 -20
- package/esm/src/react/components/chat/chat/components/message-actions.d.ts +28 -5
- package/esm/src/react/components/chat/chat/components/message-actions.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/message-actions.js +24 -36
- package/esm/src/react/components/chat/chat/components/message-edit-form.d.ts +7 -2
- package/esm/src/react/components/chat/chat/components/message-edit-form.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/message-edit-form.js +5 -5
- package/esm/src/react/components/chat/chat/components/message-feedback.d.ts +11 -1
- package/esm/src/react/components/chat/chat/components/message-feedback.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/message-feedback.js +9 -11
- package/esm/src/react/components/chat/chat/components/quick-actions.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/quick-actions.js +3 -1
- package/esm/src/react/components/chat/chat/components/reasoning.d.ts +66 -3
- package/esm/src/react/components/chat/chat/components/reasoning.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/reasoning.js +95 -21
- package/esm/src/react/components/chat/chat/components/sidebar.d.ts +178 -12
- package/esm/src/react/components/chat/chat/components/sidebar.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/sidebar.js +228 -45
- package/esm/src/react/components/chat/chat/components/skill-badge.d.ts +6 -1
- package/esm/src/react/components/chat/chat/components/skill-badge.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/skill-badge.js +6 -5
- package/esm/src/react/components/chat/chat/components/skill-tool.d.ts +37 -0
- package/esm/src/react/components/chat/chat/components/skill-tool.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/components/skill-tool.js +46 -0
- package/esm/src/react/components/chat/chat/components/sources.d.ts +55 -3
- package/esm/src/react/components/chat/chat/components/sources.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/sources.js +50 -16
- package/esm/src/react/components/chat/chat/components/step-indicator.d.ts +42 -3
- package/esm/src/react/components/chat/chat/components/step-indicator.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/step-indicator.js +55 -12
- package/esm/src/react/components/chat/chat/components/tab-switcher.d.ts +1 -1
- package/esm/src/react/components/chat/chat/components/tab-switcher.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/tab-switcher.js +3 -3
- package/esm/src/react/components/chat/chat/components/tool-ui.d.ts +96 -3
- package/esm/src/react/components/chat/chat/components/tool-ui.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/components/tool-ui.js +158 -36
- package/esm/src/react/components/chat/chat/composition/api.d.ts +4 -2
- package/esm/src/react/components/chat/chat/composition/api.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/api.js +4 -2
- package/esm/src/react/components/chat/chat/composition/chat-composer.d.ts +112 -5
- package/esm/src/react/components/chat/chat/composition/chat-composer.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-composer.js +251 -61
- package/esm/src/react/components/chat/chat/composition/chat-empty-state.d.ts +78 -0
- package/esm/src/react/components/chat/chat/composition/chat-empty-state.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/composition/chat-empty-state.js +63 -0
- package/esm/src/react/components/chat/chat/composition/chat-empty.d.ts +4 -1
- package/esm/src/react/components/chat/chat/composition/chat-empty.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-empty.js +11 -10
- package/esm/src/react/components/chat/chat/composition/chat-message-list.d.ts +11 -3
- package/esm/src/react/components/chat/chat/composition/chat-message-list.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-message-list.js +81 -111
- package/esm/src/react/components/chat/chat/composition/chat-root.d.ts +4 -0
- package/esm/src/react/components/chat/chat/composition/chat-root.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/chat-root.js +3 -1
- package/esm/src/react/components/chat/chat/composition/error-banner.d.ts +4 -0
- package/esm/src/react/components/chat/chat/composition/error-banner.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/error-banner.js +10 -7
- package/esm/src/react/components/chat/chat/composition/message.d.ts +123 -5
- package/esm/src/react/components/chat/chat/composition/message.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/message.js +332 -53
- package/esm/src/react/components/chat/chat/composition/model-avatar.d.ts +6 -1
- package/esm/src/react/components/chat/chat/composition/model-avatar.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/composition/model-avatar.js +3 -4
- package/esm/src/react/components/chat/chat/composition/pending-message.d.ts +31 -0
- package/esm/src/react/components/chat/chat/composition/pending-message.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/composition/pending-message.js +31 -0
- package/esm/src/react/components/chat/chat/contexts/chat-context.d.ts +4 -0
- package/esm/src/react/components/chat/chat/contexts/chat-context.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/contexts/composer-context.d.ts +1 -0
- package/esm/src/react/components/chat/chat/contexts/composer-context.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/contexts/conversations-context.d.ts +29 -0
- package/esm/src/react/components/chat/chat/contexts/conversations-context.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/contexts/conversations-context.js +39 -0
- package/esm/src/react/components/chat/chat/contexts/index.d.ts +1 -1
- package/esm/src/react/components/chat/chat/contexts/index.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/contexts/index.js +1 -1
- package/esm/src/react/components/chat/chat/contexts/message-context.d.ts +2 -0
- package/esm/src/react/components/chat/chat/contexts/message-context.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/hooks/use-clipboard.d.ts +10 -0
- package/esm/src/react/components/chat/chat/hooks/use-clipboard.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/hooks/use-clipboard.js +34 -0
- package/esm/src/react/components/chat/chat/hooks/use-conversation.d.ts +21 -0
- package/esm/src/react/components/chat/chat/hooks/use-conversation.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/hooks/use-conversation.js +54 -0
- package/esm/src/react/components/chat/chat/hooks/use-conversations.d.ts +67 -0
- package/esm/src/react/components/chat/chat/hooks/use-conversations.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/hooks/use-conversations.js +317 -0
- package/esm/src/react/components/chat/chat/hooks/use-drop-zone.d.ts +27 -0
- package/esm/src/react/components/chat/chat/hooks/use-drop-zone.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/hooks/use-drop-zone.js +50 -0
- package/esm/src/react/components/chat/chat/hooks/use-stick-to-bottom.d.ts +49 -0
- package/esm/src/react/components/chat/chat/hooks/use-stick-to-bottom.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/hooks/use-stick-to-bottom.js +120 -0
- package/esm/src/react/components/chat/chat/hooks/use-upload.d.ts +34 -0
- package/esm/src/react/components/chat/chat/hooks/use-upload.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/hooks/use-upload.js +147 -0
- package/esm/src/react/components/chat/chat/hooks/use-uploads-registry.d.ts +37 -0
- package/esm/src/react/components/chat/chat/hooks/use-uploads-registry.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/hooks/use-uploads-registry.js +178 -0
- package/esm/src/react/components/chat/chat/index.d.ts +171 -31
- package/esm/src/react/components/chat/chat/index.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/index.js +371 -77
- package/esm/src/react/components/chat/chat/persistence/conversation-store.d.ts +63 -0
- package/esm/src/react/components/chat/chat/persistence/conversation-store.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/persistence/conversation-store.js +1 -0
- package/esm/src/react/components/chat/chat/persistence/local-conversation-store.d.ts +13 -0
- package/esm/src/react/components/chat/chat/persistence/local-conversation-store.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/persistence/local-conversation-store.js +102 -0
- package/esm/src/react/components/chat/chat/persistence/memory-conversation-store.d.ts +11 -0
- package/esm/src/react/components/chat/chat/persistence/memory-conversation-store.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat/persistence/memory-conversation-store.js +33 -0
- package/esm/src/react/components/chat/chat/utils/message-parts.d.ts +4 -1
- package/esm/src/react/components/chat/chat/utils/message-parts.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat/utils/message-parts.js +4 -0
- package/esm/src/react/components/chat/chat-actions.d.ts +164 -0
- package/esm/src/react/components/chat/chat-actions.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat-actions.js +191 -0
- package/esm/src/react/components/chat/chat-agent-picker.d.ts +50 -0
- package/esm/src/react/components/chat/chat-agent-picker.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat-agent-picker.js +40 -0
- package/esm/src/react/components/chat/chat-theme-scope.d.ts +26 -0
- package/esm/src/react/components/chat/chat-theme-scope.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat-theme-scope.js +27 -0
- package/esm/src/react/components/chat/chat-tokens-style.d.ts +21 -0
- package/esm/src/react/components/chat/chat-tokens-style.d.ts.map +1 -0
- package/esm/src/react/components/chat/chat-tokens-style.js +24 -0
- package/esm/src/react/components/chat/chat.d.ts +5 -5
- package/esm/src/react/components/chat/chat.d.ts.map +1 -1
- package/esm/src/react/components/chat/chat.js +5 -5
- package/esm/src/react/components/chat/color-mode.d.ts +46 -0
- package/esm/src/react/components/chat/color-mode.d.ts.map +1 -0
- package/esm/src/react/components/chat/color-mode.js +123 -0
- package/esm/src/react/components/chat/error-boundary.js +2 -2
- package/esm/src/react/components/chat/icons/index.d.ts +8 -0
- package/esm/src/react/components/chat/icons/index.d.ts.map +1 -1
- package/esm/src/react/components/chat/icons/index.js +64 -0
- package/esm/src/react/components/chat/markdown.d.ts +24 -1
- package/esm/src/react/components/chat/markdown.d.ts.map +1 -1
- package/esm/src/react/components/chat/markdown.js +122 -38
- package/esm/src/react/components/chat/model-selector.d.ts +130 -8
- package/esm/src/react/components/chat/model-selector.d.ts.map +1 -1
- package/esm/src/react/components/chat/model-selector.js +148 -121
- package/esm/src/react/components/chat/theme.d.ts +9 -12
- package/esm/src/react/components/chat/theme.d.ts.map +1 -1
- package/esm/src/react/components/chat/theme.js +149 -93
- package/esm/src/react/components/chat/ui/alert.d.ts +30 -0
- package/esm/src/react/components/chat/ui/alert.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/alert.js +35 -0
- package/esm/src/react/components/chat/ui/app-shell.d.ts +155 -0
- package/esm/src/react/components/chat/ui/app-shell.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/app-shell.js +276 -0
- package/esm/src/react/components/chat/ui/avatar.d.ts +24 -0
- package/esm/src/react/components/chat/ui/avatar.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/avatar.js +44 -0
- package/esm/src/react/components/chat/ui/badge.d.ts +24 -0
- package/esm/src/react/components/chat/ui/badge.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/badge.js +30 -0
- package/esm/src/react/components/chat/ui/button.d.ts +44 -0
- package/esm/src/react/components/chat/ui/button.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/button.js +108 -0
- package/esm/src/react/components/chat/ui/card.d.ts +42 -0
- package/esm/src/react/components/chat/ui/card.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/card.js +55 -0
- package/esm/src/react/components/chat/ui/checkbox.d.ts +28 -0
- package/esm/src/react/components/chat/ui/checkbox.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/checkbox.js +36 -0
- package/esm/src/react/components/chat/ui/code-block.d.ts +89 -0
- package/esm/src/react/components/chat/ui/code-block.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/code-block.js +277 -0
- package/esm/src/react/components/chat/ui/collapsible.d.ts +30 -0
- package/esm/src/react/components/chat/ui/collapsible.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/collapsible.js +44 -0
- package/esm/src/react/components/chat/ui/command.d.ts +65 -0
- package/esm/src/react/components/chat/ui/command.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/command.js +121 -0
- package/esm/src/react/components/chat/ui/cva.d.ts +36 -0
- package/esm/src/react/components/chat/ui/cva.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/cva.js +45 -0
- package/esm/src/react/components/chat/ui/dialog.d.ts +55 -0
- package/esm/src/react/components/chat/ui/dialog.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/dialog.js +116 -0
- package/esm/src/react/components/chat/ui/drawer.d.ts +41 -0
- package/esm/src/react/components/chat/ui/drawer.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/drawer.js +92 -0
- package/esm/src/react/components/chat/ui/dropdown-menu.d.ts +63 -0
- package/esm/src/react/components/chat/ui/dropdown-menu.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/dropdown-menu.js +76 -0
- package/esm/src/react/components/chat/ui/file-type.d.ts +26 -0
- package/esm/src/react/components/chat/ui/file-type.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/file-type.js +235 -0
- package/esm/src/react/components/chat/ui/floating.d.ts +29 -0
- package/esm/src/react/components/chat/ui/floating.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/floating.js +90 -0
- package/esm/src/react/components/chat/ui/icon-button.d.ts +19 -0
- package/esm/src/react/components/chat/ui/icon-button.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/icon-button.js +20 -0
- package/esm/src/react/components/chat/ui/index.d.ts +43 -0
- package/esm/src/react/components/chat/ui/index.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/index.js +42 -0
- package/esm/src/react/components/chat/ui/input.d.ts +27 -0
- package/esm/src/react/components/chat/ui/input.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/input.js +41 -0
- package/esm/src/react/components/chat/ui/label.d.ts +29 -0
- package/esm/src/react/components/chat/ui/label.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/label.js +40 -0
- package/esm/src/react/components/chat/ui/list.d.ts +47 -0
- package/esm/src/react/components/chat/ui/list.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/list.js +40 -0
- package/esm/src/react/components/chat/ui/pill.d.ts +26 -0
- package/esm/src/react/components/chat/ui/pill.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/pill.js +39 -0
- package/esm/src/react/components/chat/ui/popover.d.ts +47 -0
- package/esm/src/react/components/chat/ui/popover.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/popover.js +68 -0
- package/esm/src/react/components/chat/ui/progress-bar.d.ts +20 -0
- package/esm/src/react/components/chat/ui/progress-bar.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/progress-bar.js +31 -0
- package/esm/src/react/components/chat/ui/radio.d.ts +25 -0
- package/esm/src/react/components/chat/ui/radio.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/radio.js +29 -0
- package/esm/src/react/components/chat/ui/scroll-fade.d.ts +23 -0
- package/esm/src/react/components/chat/ui/scroll-fade.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/scroll-fade.js +40 -0
- package/esm/src/react/components/chat/ui/select.d.ts +64 -0
- package/esm/src/react/components/chat/ui/select.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/select.js +148 -0
- package/esm/src/react/components/chat/ui/shimmer.d.ts +25 -0
- package/esm/src/react/components/chat/ui/shimmer.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/shimmer.js +24 -0
- package/esm/src/react/components/chat/ui/skeleton.d.ts +14 -0
- package/esm/src/react/components/chat/ui/skeleton.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/skeleton.js +12 -0
- package/esm/src/react/components/chat/ui/slot.d.ts +21 -0
- package/esm/src/react/components/chat/ui/slot.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/slot.js +70 -0
- package/esm/src/react/components/chat/ui/status.d.ts +28 -0
- package/esm/src/react/components/chat/ui/status.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/status.js +23 -0
- package/esm/src/react/components/chat/ui/switch.d.ts +34 -0
- package/esm/src/react/components/chat/ui/switch.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/switch.js +58 -0
- package/esm/src/react/components/chat/ui/tabs.d.ts +44 -0
- package/esm/src/react/components/chat/ui/tabs.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/tabs.js +51 -0
- package/esm/src/react/components/chat/ui/tag.d.ts +22 -0
- package/esm/src/react/components/chat/ui/tag.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/tag.js +27 -0
- package/esm/src/react/components/chat/ui/textarea.d.ts +22 -0
- package/esm/src/react/components/chat/ui/textarea.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/textarea.js +35 -0
- package/esm/src/react/components/chat/ui/tooltip.d.ts +40 -0
- package/esm/src/react/components/chat/ui/tooltip.d.ts.map +1 -0
- package/esm/src/react/components/chat/ui/tooltip.js +132 -0
- package/esm/src/react/primitives/input-box.d.ts.map +1 -1
- package/esm/src/react/primitives/input-box.js +17 -4
- package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/framework-candidates.generated.js +9437 -1064
- package/esm/src/server/handlers/dev/projects/html-shell.d.ts +1 -1
- package/esm/src/server/handlers/dev/projects/html-shell.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/projects/html-shell.js +1 -12
- package/esm/src/server/handlers/request/public-agents-list.handler.d.ts +18 -0
- package/esm/src/server/handlers/request/public-agents-list.handler.d.ts.map +1 -0
- package/esm/src/server/handlers/request/public-agents-list.handler.js +44 -0
- package/esm/src/server/runtime-handler/index.d.ts +1 -1
- package/esm/src/server/runtime-handler/index.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/index.js +3 -0
- package/esm/src/studio/bridge/bridge-bundle.generated.d.ts +1 -1
- package/esm/src/studio/bridge/bridge-bundle.generated.d.ts.map +1 -1
- package/esm/src/studio/bridge/bridge-bundle.generated.js +3 -2
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/esm/src/workflow/blob/local-storage.d.ts +32 -0
- package/esm/src/workflow/blob/local-storage.d.ts.map +1 -0
- package/esm/src/workflow/blob/local-storage.js +179 -0
- package/esm/src/workflow/blob/types.d.ts +5 -0
- package/esm/src/workflow/blob/types.d.ts.map +1 -1
- package/esm/src/workflow/blob/veryfront-cloud-storage.d.ts +11 -0
- package/esm/src/workflow/blob/veryfront-cloud-storage.d.ts.map +1 -1
- package/esm/src/workflow/blob/veryfront-cloud-storage.js +36 -0
- package/package.json +5 -1
- package/esm/src/react/components/chat/chat/components/uploads-panel.d.ts +0 -20
- package/esm/src/react/components/chat/chat/components/uploads-panel.d.ts.map +0 -1
- package/esm/src/react/components/chat/chat/components/uploads-panel.js +0 -49
- package/esm/src/react/components/chat/chat/contexts/thread-list-context.d.ts +0 -28
- package/esm/src/react/components/chat/chat/contexts/thread-list-context.d.ts.map +0 -1
- package/esm/src/react/components/chat/chat/contexts/thread-list-context.js +0 -27
- package/esm/src/react/components/chat/chat/hooks/use-threads.d.ts +0 -28
- package/esm/src/react/components/chat/chat/hooks/use-threads.d.ts.map +0 -1
- package/esm/src/react/components/chat/chat/hooks/use-threads.js +0 -151
- package/esm/src/react/components/chat/chat-with-sidebar.d.ts +0 -110
- package/esm/src/react/components/chat/chat-with-sidebar.d.ts.map +0 -1
- package/esm/src/react/components/chat/chat-with-sidebar.js +0 -167
- package/esm/src/react/components/chat/message.d.ts +0 -42
- package/esm/src/react/components/chat/message.d.ts.map +0 -1
- package/esm/src/react/components/chat/message.js +0 -69
|
@@ -53,7 +53,7 @@ export default {
|
|
|
53
53
|
"app/api/uploads/[id]/route.ts": "import { createUploadHandler } from \"veryfront/embedding\";\nimport { store } from \"../../../../store.ts\";\n\nexport const { DELETE } = createUploadHandler(store, {\n auth: { type: \"none\", allowUnauthenticated: true },\n});\n",
|
|
54
54
|
"app/api/uploads/route.ts": "import { createUploadHandler } from \"veryfront/embedding\";\nimport { store } from \"../../../store.ts\";\n\nexport const { POST, GET } = createUploadHandler(store, {\n auth: { type: \"none\", allowUnauthenticated: true },\n});\n",
|
|
55
55
|
"app/layout.tsx": "import \"../globals.css\";\nimport { Head } from \"veryfront/head\";\n\nexport default function RootLayout({ children }: { children: React.ReactNode }): React.ReactNode {\n return (\n <>\n <Head><title>Docs Agent</title></Head>\n <div className=\"flex flex-col h-screen\">\n {children}\n </div>\n </>\n );\n}\n",
|
|
56
|
-
"app/page.tsx": "'use client'\n\nimport {
|
|
56
|
+
"app/page.tsx": "'use client'\n\nimport { useCallback, useMemo } from 'react'\nimport {\n Chat,\n ChatSidebar,\n ChatThemeScope,\n ConversationsProvider,\n useChat,\n useUploadsRegistry,\n} from 'veryfront/chat'\n\nconst UPLOAD_API = '/api/uploads'\nconst ACCEPT = '.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.csv,.txt,.md,.mdx,.html,.rtf,.epub,.json,.xml'\n\nconst SUGGESTIONS = [\n {\n label: 'Ask Question',\n prompt: 'I have a question about this document: ',\n },\n {\n label: 'Extract Insights',\n prompt: 'Extract the key insights from the uploaded documents.',\n },\n {\n label: 'Find Sources',\n prompt: 'Find relevant sources and references in the documents for: ',\n },\n]\n\nconst MODELS = [\n {\n value: 'anthropic/claude-sonnet-4-6',\n label: 'Claude Sonnet',\n },\n {\n value: 'openai/gpt-4.1-mini',\n label: 'GPT-4.1 Mini',\n },\n {\n value: 'google/gemini-2.5-flash',\n label: 'Gemini 2.5 Flash',\n badge: 'Fast',\n },\n]\n\nfunction DocsChatSurface() {\n const chat = useChat({ api: '/api/ag-ui' })\n const uploads = useUploadsRegistry({ url: UPLOAD_API, storageKey: 'rag-uploads' })\n\n const suggestionLabels = useMemo(\n () => SUGGESTIONS.map((suggestion) => suggestion.label),\n [],\n )\n\n const handleSuggestionClick = useCallback((label: string) => {\n const suggestion = SUGGESTIONS.find((item) => item.label === label)\n chat.setInput(suggestion?.prompt ?? label)\n }, [chat.setInput])\n\n return (\n <ChatThemeScope className=\"flex h-screen min-h-0\">\n <ChatSidebar className=\"w-72 shrink-0 border-r border-[var(--border)]\" />\n <Chat\n chat={chat}\n showSteps\n showTabs\n showSources\n agent={{\n name: 'Docs Agent',\n description: 'Upload files and ask questions',\n models: MODELS,\n }}\n suggestions={suggestionLabels}\n onSuggestionClick={handleSuggestionClick}\n uploads={uploads.items}\n onRemoveUpload={uploads.remove}\n onAttach={uploads.upload}\n onDrop={uploads.upload}\n attachAccept={ACCEPT}\n className=\"flex-1 min-h-0\"\n placeholder=\"Ask anything about your documents...\"\n emptyState={{ title: 'Docs Agent', description: 'Upload files and ask questions' }}\n />\n </ChatThemeScope>\n )\n}\n\nexport default function DocsChat() {\n return (\n <ConversationsProvider storageKey=\"rag-conversations\">\n <DocsChatSurface />\n </ConversationsProvider>\n )\n}\n",
|
|
57
57
|
"content/architecture.md": "# Architecture\n\nAcme Platform uses a modular, event-driven architecture.\n\n## Core Components\n\n### API Gateway\nRoutes incoming requests to the appropriate microservice. Handles authentication, rate limiting, and request validation.\n\n### Event Bus\nAsynchronous message broker connecting all services. Supports pub/sub and point-to-point messaging patterns.\n\n### Data Layer\nMulti-tenant data storage with automatic sharding. Supports PostgreSQL for relational data and Redis for caching.\n\n## Request Flow\n\n1. Client sends request to API Gateway\n2. Gateway validates authentication token\n3. Request is routed to the target service\n4. Service processes request and publishes events\n5. Response is returned through the gateway\n\n## Scaling\n\nEach component scales independently. The API Gateway uses horizontal scaling with load balancing. Services auto-scale based on queue depth and CPU utilization.\n\n## Security\n\n- All inter-service communication uses mTLS\n- API tokens are rotated every 24 hours\n- Data at rest is encrypted with AES-256\n- Audit logs are retained for 90 days\n",
|
|
58
58
|
"content/getting-started.md": "# Getting Started\n\nWelcome to Acme Platform. This guide covers initial setup and core concepts.\n\n## Installation\n\nInstall the CLI globally:\n\n```bash\nnpm install -g @acme/cli\n```\n\n## Creating a Project\n\nRun the init command to scaffold a new project:\n\n```bash\nacme init my-project\ncd my-project\n```\n\n## Project Structure\n\n- `src/`: Application source code\n- `config/`: Configuration files\n- `tests/`: Test suite\n- `docs/`: Documentation\n\n## Configuration\n\nCreate an `acme.config.ts` file in your project root:\n\n```ts\nexport default {\n name: \"my-project\",\n region: \"us-east-1\",\n features: [\"auth\", \"storage\"],\n};\n```\n\n## Next Steps\n\n- Read the [Architecture Guide](./architecture) to understand the system design\n- Check [API Reference](./api-reference) for available endpoints\n- Join our Discord community for support\n",
|
|
59
59
|
"globals.css": "@import \"tailwindcss\";\n",
|
package/esm/deno.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ declare namespace _default {
|
|
|
20
20
|
"./chat/ag-ui": string;
|
|
21
21
|
"./chat/protocol": string;
|
|
22
22
|
"./chat/types": string;
|
|
23
|
+
"./chat/uploads": string;
|
|
23
24
|
"./markdown": string;
|
|
24
25
|
"./mdx": string;
|
|
25
26
|
"./agent": string;
|
|
@@ -89,6 +90,7 @@ declare namespace _default {
|
|
|
89
90
|
"veryfront/fonts": string;
|
|
90
91
|
"veryfront/chat": string;
|
|
91
92
|
"veryfront/chat/types": string;
|
|
93
|
+
"veryfront/chat/uploads": string;
|
|
92
94
|
"veryfront/markdown": string;
|
|
93
95
|
"veryfront/mdx": string;
|
|
94
96
|
"veryfront/fs": string;
|
|
@@ -188,6 +190,7 @@ declare namespace _default {
|
|
|
188
190
|
"#veryfront/chat/protocol": string;
|
|
189
191
|
"#veryfront/chat/provider-errors": string;
|
|
190
192
|
"#veryfront/chat/stream-watchdog": string;
|
|
193
|
+
"#veryfront/chat/uploads": string;
|
|
191
194
|
"#veryfront/build": string;
|
|
192
195
|
"#veryfront/cache": string;
|
|
193
196
|
"#veryfront/config": string;
|
|
@@ -347,6 +350,9 @@ declare namespace _default {
|
|
|
347
350
|
"coverage:html": string;
|
|
348
351
|
bench: string;
|
|
349
352
|
clean: string;
|
|
353
|
+
storybook: string;
|
|
354
|
+
"build:storybook": string;
|
|
355
|
+
"storybook:check": string;
|
|
350
356
|
lint: string;
|
|
351
357
|
fmt: string;
|
|
352
358
|
"fmt:check": string;
|
|
@@ -368,6 +374,7 @@ declare namespace _default {
|
|
|
368
374
|
"lint:ban-deep-imports": string;
|
|
369
375
|
"lint:imports": string;
|
|
370
376
|
"lint:ban-internal-root-imports": string;
|
|
377
|
+
"lint:chat-composability": string;
|
|
371
378
|
"lint:style": string;
|
|
372
379
|
"lint:cli-boundary": string;
|
|
373
380
|
"validate:architecture": string;
|
package/esm/deno.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.998",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"nodeModulesDir": "auto",
|
|
6
6
|
"minimumDependencyAge": {
|
|
@@ -59,6 +59,7 @@ export default {
|
|
|
59
59
|
"dist/",
|
|
60
60
|
"coverage/",
|
|
61
61
|
"scripts/",
|
|
62
|
+
"storybook/",
|
|
62
63
|
"examples/",
|
|
63
64
|
"data/",
|
|
64
65
|
".deno_cache/",
|
|
@@ -76,6 +77,7 @@ export default {
|
|
|
76
77
|
"./chat/ag-ui": "./src/chat/ag-ui.ts",
|
|
77
78
|
"./chat/protocol": "./src/chat/protocol.ts",
|
|
78
79
|
"./chat/types": "./src/chat/types.ts",
|
|
80
|
+
"./chat/uploads": "./src/chat/upload-handler.ts",
|
|
79
81
|
"./markdown": "./src/markdown/index.ts",
|
|
80
82
|
"./mdx": "./src/mdx/index.ts",
|
|
81
83
|
"./agent": "./src/agent/index.ts",
|
|
@@ -145,6 +147,7 @@ export default {
|
|
|
145
147
|
"veryfront/fonts": "./src/react/fonts/index.ts",
|
|
146
148
|
"veryfront/chat": "./src/chat/index.ts",
|
|
147
149
|
"veryfront/chat/types": "./src/chat/types.ts",
|
|
150
|
+
"veryfront/chat/uploads": "./src/chat/upload-handler.ts",
|
|
148
151
|
"veryfront/markdown": "./src/markdown/index.ts",
|
|
149
152
|
"veryfront/mdx": "./src/mdx/index.ts",
|
|
150
153
|
"veryfront/fs": "./src/fs/index.ts",
|
|
@@ -244,6 +247,7 @@ export default {
|
|
|
244
247
|
"#veryfront/chat/protocol": "./src/chat/protocol.ts",
|
|
245
248
|
"#veryfront/chat/provider-errors": "./src/chat/provider-errors.ts",
|
|
246
249
|
"#veryfront/chat/stream-watchdog": "./src/chat/stream-watchdog.ts",
|
|
250
|
+
"#veryfront/chat/uploads": "./src/chat/upload-handler.ts",
|
|
247
251
|
"#veryfront/build": "./src/build/index.ts",
|
|
248
252
|
"#veryfront/cache": "./src/cache/index.ts",
|
|
249
253
|
"#veryfront/config": "./src/config/index.ts",
|
|
@@ -409,12 +413,15 @@ export default {
|
|
|
409
413
|
"coverage:html": "deno coverage coverage --include=src/ --exclude=tests '--exclude=src/**/*_test.ts' '--exclude=src/**/*_test.tsx' '--exclude=src/**/*.test.ts' '--exclude=src/**/*.test.tsx' --html",
|
|
410
414
|
"bench": "VF_DISABLE_LRU_INTERVAL=1 NODE_ENV=production LOG_FORMAT=text deno bench --no-check --allow-all --unstable-worker-options --unstable-net $(find src -name '*.bench.ts')",
|
|
411
415
|
"clean": "rm -rf .cache/",
|
|
416
|
+
"storybook": "npm --prefix storybook run storybook",
|
|
417
|
+
"build:storybook": "npm --prefix storybook run build-storybook",
|
|
418
|
+
"storybook:check": "deno test --no-lock --config=scripts/test.deno.json --no-check --allow-read scripts/storybook/storybook-workbench.test.ts",
|
|
412
419
|
"lint": "DENO_NO_PACKAGE_JSON=1 deno lint src/ cli/ react/ && deno lint --config=scripts/test.deno.json scripts/test/ scripts/build/npm-package-metadata.test.ts",
|
|
413
420
|
"fmt": "deno fmt src/ cli/ react/ && deno fmt --config=scripts/test.deno.json scripts/test/",
|
|
414
421
|
"fmt:check": "deno fmt --check src/ cli/ react/ && deno fmt --check --config=scripts/test.deno.json scripts/test/",
|
|
415
422
|
"typecheck": "deno task generate:manifests:check && deno check src/index.ts cli/main.ts src/server/index.ts src/routing/api/index.ts src/rendering/index.ts src/platform/index.ts src/platform/adapters/index.ts src/build/index.ts src/build/production-build/index.ts src/transforms/index.ts src/config/index.ts src/utils/index.ts src/data/index.ts src/security/index.ts src/middleware/index.ts src/server/handlers/dev/index.ts src/server/handlers/request/api/index.ts src/rendering/cache/index.ts src/rendering/cache/stores/index.ts src/rendering/rsc/actions/index.ts src/html/index.ts src/modules/index.ts src/proxy/main.ts src/chat/index.ts src/markdown/index.ts src/mdx/index.ts src/fs/index.ts src/oauth/index.ts src/agent/index.ts src/agent/service/route-export.check.ts src/eval/index.ts src/tool/index.ts src/workflow/index.ts src/work/index.ts src/prompt/index.ts src/resource/index.ts src/runs/index.ts src/mcp/index.ts src/provider/index.ts",
|
|
416
|
-
"verify": "deno task generate:manifests:check && deno task fmt:check && deno task lint && deno task lint:style && deno task lint:cli-boundary && deno task lint:wildcard-exports && deno task lint:barrel-jsdoc && deno task lint:ban-test-only && deno task lint:sanitizer-baseline && deno task lint:skipped-tests && deno task lint:ban-zod && deno task lint:core-deps && deno task lint:dependency-boundaries && deno task lint:extension-contracts && deno task lint:extension-capabilities && deno task docs:validate && deno task typecheck && deno task test && deno task test:e2e:binary",
|
|
417
|
-
"verify:quick": "deno task generate:manifests:check && deno task fmt:check && deno task lint && deno task lint:style && deno task lint:cli-boundary && deno task lint:wildcard-exports && deno task lint:barrel-jsdoc && deno task lint:ban-test-only && deno task lint:sanitizer-baseline && deno task lint:skipped-tests && deno task lint:ban-zod && deno task lint:core-deps && deno task lint:dependency-boundaries && deno task lint:extension-contracts && deno task lint:extension-capabilities && deno task docs:validate && deno task typecheck",
|
|
423
|
+
"verify": "deno task generate:manifests:check && deno task fmt:check && deno task lint && deno task lint:style && deno task lint:chat-composability && deno task lint:cli-boundary && deno task lint:wildcard-exports && deno task lint:barrel-jsdoc && deno task lint:ban-test-only && deno task lint:sanitizer-baseline && deno task lint:skipped-tests && deno task lint:ban-zod && deno task lint:core-deps && deno task lint:dependency-boundaries && deno task lint:extension-contracts && deno task lint:extension-capabilities && deno task docs:validate && deno task typecheck && deno task test && deno task test:e2e:binary",
|
|
424
|
+
"verify:quick": "deno task generate:manifests:check && deno task fmt:check && deno task lint && deno task lint:style && deno task lint:chat-composability && deno task lint:cli-boundary && deno task lint:wildcard-exports && deno task lint:barrel-jsdoc && deno task lint:ban-test-only && deno task lint:sanitizer-baseline && deno task lint:skipped-tests && deno task lint:ban-zod && deno task lint:core-deps && deno task lint:dependency-boundaries && deno task lint:extension-contracts && deno task lint:extension-capabilities && deno task docs:validate && deno task typecheck",
|
|
418
425
|
"docs": "deno run --allow-read --allow-write --allow-run --allow-env scripts/docs/generate-api-reference.ts",
|
|
419
426
|
"docs:coverage": "deno run --allow-read scripts/docs/docs-coverage.ts",
|
|
420
427
|
"docs:copy": "rm -rf ../../docs/docs/code/api-reference && cp -r docs/api-reference/ ../../docs/docs/code/api-reference/",
|
|
@@ -430,6 +437,7 @@ export default {
|
|
|
430
437
|
"lint:ban-deep-imports": "deno run --allow-read scripts/lint/ban-deep-imports.ts",
|
|
431
438
|
"lint:imports": "deno run --allow-read scripts/lint/no-cross-boundary-relative-imports.ts",
|
|
432
439
|
"lint:ban-internal-root-imports": "deno run --allow-read scripts/lint/ban-internal-root-imports.ts",
|
|
440
|
+
"lint:chat-composability": "deno run --allow-read scripts/lint/audit-chat-composability.ts",
|
|
433
441
|
"lint:style": "deno run --allow-read scripts/lint/enforce-style-conventions.ts",
|
|
434
442
|
"lint:cli-boundary": "deno run --allow-read scripts/lint/enforce-cli-boundary.ts",
|
|
435
443
|
"validate:architecture": "deno run --allow-read scripts/lint/validate-architecture.ts",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-dom@19.2.4.d.ts","sourceRoot":"","sources":["../../../src/deps/esm.sh/react-dom@19.2.4.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-dom.d.ts","sourceRoot":"","sources":["../../src/react/react-dom.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-support.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/ag-ui/host-support.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAa3C,mCAAmC;AACnC,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAgBD,eAAO,MAAM,yBAAyB;;;;GASrC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;GAuBpC,CAAC;AAuBF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiBhC,CAAC;AAEF,kDAAkD;AAClD,eAAO,MAAM,sBAAsB;;;;GAAwC,CAAC;AAC5E,iDAAiD;AACjD,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;GAAuC,CAAC;AAC1E;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAmC,CAAC;AAElE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CAAC;AACzF,kDAAkD;AAClD,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAC;AACvF,iCAAiC;AACjC,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC;AAE/E,MAAM,WAAW,4BAA4B;IAC3C,sBAAsB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5C;AA6OD,uCAAuC;AACvC,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAE7E;AAED,8CAA8C;AAC9C,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,WAAW,GAAG,QAAQ,CAAC,CAKjC;AAED,iCAAiC;AACjC,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,WAAW,CAAC,UAAU,CAAC,EACjC,OAAO,GAAE,4BAAiC,GACzC,OAAO,EAAE,CAsCX;AAED,gDAAgD;AAChD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,YAAY,CAQpF;AAED,mDAAmD;AACnD,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,QAAQ,CAUxF;AAED,6CAA6C;AAC7C,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,QAAQ,CASlF"}
|
|
@@ -181,6 +181,18 @@ function normalizeMessagePart(part, toolNamesById = new Map()) {
|
|
|
181
181
|
result: "result" in part ? part.result : undefined,
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
|
+
// Attachments: keep `file`/`image` parts (multimodal input). The composer
|
|
185
|
+
// sends every attachment as `type: "file"`, so route by media type — images
|
|
186
|
+
// become `image` parts the model can view, everything else stays `file`.
|
|
187
|
+
// The `url` may be a fetchable URL or an inline `data:` base64 URL.
|
|
188
|
+
if ((part.type === "file" || part.type === "image") &&
|
|
189
|
+
typeof part.url === "string" && part.url.length > 0 &&
|
|
190
|
+
typeof part.mediaType === "string" && part.mediaType.length > 0) {
|
|
191
|
+
const isImage = part.type === "image" || part.mediaType.startsWith("image/");
|
|
192
|
+
return isImage
|
|
193
|
+
? { type: "image", url: part.url, mediaType: part.mediaType }
|
|
194
|
+
: { type: "file", url: part.url, mediaType: part.mediaType };
|
|
195
|
+
}
|
|
184
196
|
return null;
|
|
185
197
|
}
|
|
186
198
|
function buildMessageMetadataFields(message) {
|
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
* @module agent/react
|
|
5
5
|
*/
|
|
6
6
|
export { useChat } from "./use-chat/index.js";
|
|
7
|
-
export type { BranchInfo, ChatDynamicToolPart, ChatFinishReason, ChatMessage, ChatMessagePart, ChatReasoningPart, ChatStepPart, ChatStreamEvent, ChatTextPart, ChatToolPart, ChatToolResultPart, ChatToolState, InferenceMode, OnToolCallArg, ToolOutput, UseChatOptions, UseChatResult, } from "./use-chat/index.js";
|
|
7
|
+
export type { BranchInfo, ChatDynamicToolPart, ChatFilePart, ChatFinishReason, ChatMessage, ChatMessagePart, ChatReasoningPart, ChatStepPart, ChatStreamEvent, ChatTextPart, ChatToolPart, ChatToolResultPart, ChatToolState, InferenceMode, OnToolCallArg, ToolOutput, UseChatOptions, UseChatResult, } from "./use-chat/index.js";
|
|
8
8
|
export { useAgent } from "./use-agent.js";
|
|
9
9
|
export type { UseAgentOptions, UseAgentResult } from "./use-agent.js";
|
|
10
|
-
export { getAgentPromptSuggestions, normalizeAgentMetadataResponse, useAgentMetadata, } from "./use-agent-metadata.js";
|
|
10
|
+
export { getAgentPromptSuggestions, normalizeAgentMetadata, normalizeAgentMetadataResponse, useAgentMetadata, } from "./use-agent-metadata.js";
|
|
11
11
|
export type { AgentMetadata, AgentMetadataPromptSuggestion, AgentMetadataSuggestion, AgentMetadataSuggestions, AgentMetadataTaskSuggestion, UseAgentMetadataResult, } from "./use-agent-metadata.js";
|
|
12
|
+
export { normalizeAgentsListResponse, useAgents } from "./use-agents.js";
|
|
13
|
+
export type { UseAgentsOptions, UseAgentsResult } from "./use-agents.js";
|
|
12
14
|
export { useCompletion } from "./use-completion.js";
|
|
13
15
|
export type { UseCompletionOptions, UseCompletionResult } from "./use-completion.js";
|
|
14
16
|
export { useStreaming } from "./use-streaming.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/react/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,YAAY,EACV,UAAU,EACV,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,aAAa,EACb,UAAU,EACV,cAAc,EACd,aAAa,GACd,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,EACL,yBAAyB,EACzB,8BAA8B,EAC9B,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,aAAa,EACb,6BAA6B,EAC7B,uBAAuB,EACvB,wBAAwB,EACxB,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAErF,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;A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,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export { useChat } from "./use-chat/index.js";
|
|
7
7
|
export { useAgent } from "./use-agent.js";
|
|
8
|
-
export { getAgentPromptSuggestions, normalizeAgentMetadataResponse, useAgentMetadata, } from "./use-agent-metadata.js";
|
|
8
|
+
export { getAgentPromptSuggestions, normalizeAgentMetadata, normalizeAgentMetadataResponse, useAgentMetadata, } from "./use-agent-metadata.js";
|
|
9
|
+
export { normalizeAgentsListResponse, useAgents } from "./use-agents.js";
|
|
9
10
|
export { useCompletion } from "./use-completion.js";
|
|
10
11
|
export { useStreaming } from "./use-streaming.js";
|
|
11
12
|
export { useVoiceInput } from "./use-voice-input.js";
|
|
@@ -33,6 +33,11 @@ export interface UseAgentMetadataResult {
|
|
|
33
33
|
isLoading: boolean;
|
|
34
34
|
error: Error | null;
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Normalize a single browser-safe agent record (the `agent` object inside the
|
|
38
|
+
* `/api/agents/:id` response, or one entry of the `/api/agents` list).
|
|
39
|
+
*/
|
|
40
|
+
export declare function normalizeAgentMetadata(value: unknown): AgentMetadata;
|
|
36
41
|
/** Normalize the wire response from /api/agents/:id. */
|
|
37
42
|
export declare function normalizeAgentMetadataResponse(value: unknown): AgentMetadata;
|
|
38
43
|
/** Return prompt text suggestions that the current Chat component can render. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-agent-metadata.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/react/use-agent-metadata.ts"],"names":[],"mappings":"AAGA,+DAA+D;AAC/D,MAAM,MAAM,6BAA6B,GACrC;IACA,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,GACC;IACA,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC;AAEJ,6DAA6D;AAC7D,MAAM,MAAM,2BAA2B,GAAG;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,uCAAuC;AACvC,MAAM,MAAM,uBAAuB,GAAG,6BAA6B,GAAG,2BAA2B,CAAC;AAElG,oDAAoD;AACpD,MAAM,WAAW,wBAAwB;IACvC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,uBAAuB,EAAE,CAAC;CACxC;AAED,kDAAkD;AAClD,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,CAAC,EAAE,wBAAwB,CAAC;CACxC;AAED,6CAA6C;AAC7C,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AA2ED,wDAAwD;AACxD,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,
|
|
1
|
+
{"version":3,"file":"use-agent-metadata.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/react/use-agent-metadata.ts"],"names":[],"mappings":"AAGA,+DAA+D;AAC/D,MAAM,MAAM,6BAA6B,GACrC;IACA,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,GACC;IACA,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC;AAEJ,6DAA6D;AAC7D,MAAM,MAAM,2BAA2B,GAAG;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,uCAAuC;AACvC,MAAM,MAAM,uBAAuB,GAAG,6BAA6B,GAAG,2BAA2B,CAAC;AAElG,oDAAoD;AACpD,MAAM,WAAW,wBAAwB;IACvC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,uBAAuB,EAAE,CAAC;CACxC;AAED,kDAAkD;AAClD,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,CAAC,EAAE,wBAAwB,CAAC;CACxC;AAED,6CAA6C;AAC7C,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AA2ED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,CAYpE;AAED,wDAAwD;AACxD,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,CAK5E;AAED,iFAAiF;AACjF,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,GAAG,MAAM,EAAE,CAK/E;AAED,iEAAiE;AACjE,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,sBAAsB,CAkD3F"}
|
|
@@ -62,19 +62,28 @@ function normalizeSuggestions(value) {
|
|
|
62
62
|
suggestions: rawSuggestions.map(normalizeSuggestion),
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Normalize a single browser-safe agent record (the `agent` object inside the
|
|
67
|
+
* `/api/agents/:id` response, or one entry of the `/api/agents` list).
|
|
68
|
+
*/
|
|
69
|
+
export function normalizeAgentMetadata(value) {
|
|
70
|
+
if (!isRecord(value)) {
|
|
71
|
+
throw new Error("Invalid agent metadata: agent must be an object");
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
id: getRequiredString(value, "id"),
|
|
75
|
+
name: getRequiredString(value, "name"),
|
|
76
|
+
description: getNullableString(value, "description"),
|
|
77
|
+
avatarUrl: getNullableString(value, "avatar_url"),
|
|
78
|
+
suggestions: normalizeSuggestions(value.suggestions),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
65
81
|
/** Normalize the wire response from /api/agents/:id. */
|
|
66
82
|
export function normalizeAgentMetadataResponse(value) {
|
|
67
|
-
if (!isRecord(value)
|
|
83
|
+
if (!isRecord(value)) {
|
|
68
84
|
throw new Error("Invalid agent metadata response");
|
|
69
85
|
}
|
|
70
|
-
|
|
71
|
-
return {
|
|
72
|
-
id: getRequiredString(agent, "id"),
|
|
73
|
-
name: getRequiredString(agent, "name"),
|
|
74
|
-
description: getNullableString(agent, "description"),
|
|
75
|
-
avatarUrl: getNullableString(agent, "avatar_url"),
|
|
76
|
-
suggestions: normalizeSuggestions(agent.suggestions),
|
|
77
|
-
};
|
|
86
|
+
return normalizeAgentMetadata(value.agent);
|
|
78
87
|
}
|
|
79
88
|
/** Return prompt text suggestions that the current Chat component can render. */
|
|
80
89
|
export function getAgentPromptSuggestions(agent) {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type AgentMetadata } from "./use-agent-metadata.js";
|
|
2
|
+
/** Options accepted by {@link useAgents}. */
|
|
3
|
+
export interface UseAgentsOptions {
|
|
4
|
+
/**
|
|
5
|
+
* When `false`, the request is skipped and the hook stays idle with an empty
|
|
6
|
+
* list. Flip it to `true` to fetch (or refetch). Defaults to `true`.
|
|
7
|
+
*/
|
|
8
|
+
enabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** Result returned from {@link useAgents}. */
|
|
11
|
+
export interface UseAgentsResult {
|
|
12
|
+
/** Browser-safe metadata for every agent the project exposes, sorted by name. */
|
|
13
|
+
agents: AgentMetadata[];
|
|
14
|
+
/** `true` while the list request is in flight. */
|
|
15
|
+
isLoading: boolean;
|
|
16
|
+
/** The last request error, or `null`. */
|
|
17
|
+
error: Error | null;
|
|
18
|
+
/** Re-run the request, bypassing nothing — always hits the network. */
|
|
19
|
+
refetch: () => void;
|
|
20
|
+
}
|
|
21
|
+
/** Normalize the wire response from `GET /api/agents`. */
|
|
22
|
+
export declare function normalizeAgentsListResponse(value: unknown): AgentMetadata[];
|
|
23
|
+
/**
|
|
24
|
+
* React hook that lists the browser-safe agents a project exposes, via
|
|
25
|
+
* `GET /api/agents`. Companion to {@link useAgentMetadata} (single agent) — use
|
|
26
|
+
* it to drive an agent switcher, e.g. only rendering a picker when
|
|
27
|
+
* `agents.length > 1`.
|
|
28
|
+
*
|
|
29
|
+
* The in-flight request is aborted on unmount, on option change, and before a
|
|
30
|
+
* `refetch`, so state never lands from a stale response.
|
|
31
|
+
*/
|
|
32
|
+
export declare function useAgents(options?: UseAgentsOptions): UseAgentsResult;
|
|
33
|
+
//# sourceMappingURL=use-agents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-agents.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/react/use-agents.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAA0B,MAAM,yBAAyB,CAAC;AAErF,6CAA6C;AAC7C,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,8CAA8C;AAC9C,MAAM,WAAW,eAAe;IAC9B,iFAAiF;IACjF,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,kDAAkD;IAClD,SAAS,EAAE,OAAO,CAAC;IACnB,yCAAyC;IACzC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,uEAAuE;IACvE,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAQD,0DAA0D;AAC1D,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,EAAE,CAK3E;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,OAAO,GAAE,gBAAqB,GAAG,eAAe,CAuDzE"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { useCallback, useEffect, useState } from "../../../react/react.js";
|
|
2
|
+
import { ensureError } from "../../errors/veryfront-error.js";
|
|
3
|
+
import { normalizeAgentMetadata } from "./use-agent-metadata.js";
|
|
4
|
+
function isRecord(value) {
|
|
5
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
6
|
+
}
|
|
7
|
+
/** Normalize the wire response from `GET /api/agents`. */
|
|
8
|
+
export function normalizeAgentsListResponse(value) {
|
|
9
|
+
if (!isRecord(value) || !Array.isArray(value.agents)) {
|
|
10
|
+
throw new Error("Invalid agents list response: agents must be an array");
|
|
11
|
+
}
|
|
12
|
+
return value.agents.map(normalizeAgentMetadata);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* React hook that lists the browser-safe agents a project exposes, via
|
|
16
|
+
* `GET /api/agents`. Companion to {@link useAgentMetadata} (single agent) — use
|
|
17
|
+
* it to drive an agent switcher, e.g. only rendering a picker when
|
|
18
|
+
* `agents.length > 1`.
|
|
19
|
+
*
|
|
20
|
+
* The in-flight request is aborted on unmount, on option change, and before a
|
|
21
|
+
* `refetch`, so state never lands from a stale response.
|
|
22
|
+
*/
|
|
23
|
+
export function useAgents(options = {}) {
|
|
24
|
+
const { enabled = true } = options;
|
|
25
|
+
const [agents, setAgents] = useState([]);
|
|
26
|
+
const [isLoading, setIsLoading] = useState(enabled);
|
|
27
|
+
const [error, setError] = useState(null);
|
|
28
|
+
// Bumping this re-runs the effect below to force a fresh request.
|
|
29
|
+
const [reloadToken, setReloadToken] = useState(0);
|
|
30
|
+
const refetch = useCallback(() => {
|
|
31
|
+
setReloadToken((token) => token + 1);
|
|
32
|
+
}, []);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (!enabled) {
|
|
35
|
+
setAgents([]);
|
|
36
|
+
setIsLoading(false);
|
|
37
|
+
setError(null);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const abortController = new AbortController();
|
|
41
|
+
setIsLoading(true);
|
|
42
|
+
setError(null);
|
|
43
|
+
async function loadAgents() {
|
|
44
|
+
try {
|
|
45
|
+
const response = await fetch("/api/agents", {
|
|
46
|
+
headers: { accept: "application/json" },
|
|
47
|
+
signal: abortController.signal,
|
|
48
|
+
});
|
|
49
|
+
if (!response.ok) {
|
|
50
|
+
throw new Error(`Agents list request failed: ${response.status}`);
|
|
51
|
+
}
|
|
52
|
+
setAgents(normalizeAgentsListResponse(await response.json()));
|
|
53
|
+
}
|
|
54
|
+
catch (caught) {
|
|
55
|
+
if (caught instanceof Error && caught.name === "AbortError")
|
|
56
|
+
return;
|
|
57
|
+
setAgents([]);
|
|
58
|
+
setError(ensureError(caught));
|
|
59
|
+
}
|
|
60
|
+
finally {
|
|
61
|
+
if (!abortController.signal.aborted) {
|
|
62
|
+
setIsLoading(false);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
void loadAgents();
|
|
67
|
+
return () => {
|
|
68
|
+
abortController.abort();
|
|
69
|
+
};
|
|
70
|
+
}, [enabled, reloadToken]);
|
|
71
|
+
return { agents, isLoading, error, refetch };
|
|
72
|
+
}
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* Build any interface you want.
|
|
6
6
|
*/
|
|
7
7
|
export { useChat } from "./use-chat.js";
|
|
8
|
-
export type { BranchInfo, ChatDynamicToolPart, ChatMessage, ChatMessagePart, ChatReasoningPart, ChatStepPart, ChatTextPart, ChatToolPart, ChatToolResultPart, ChatToolState, InferenceMode, OnToolCallArg, ToolOutput, UseChatOptions, UseChatResult, } from "./types.js";
|
|
8
|
+
export type { BranchInfo, ChatDynamicToolPart, ChatFilePart, ChatMessage, ChatMessagePart, ChatReasoningPart, ChatStepPart, ChatTextPart, ChatToolPart, ChatToolResultPart, ChatToolState, InferenceMode, OnToolCallArg, ToolOutput, UseChatOptions, UseChatResult, } from "./types.js";
|
|
9
9
|
export type { ChatFinishReason, ChatStreamEvent, } from "./stream-protocol.js";
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/src/agent/react/use-chat/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,YAAY,EACV,UAAU,EACV,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,aAAa,EACb,UAAU,EACV,cAAc,EACd,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,gBAAgB,EAChB,eAAe,GAChB,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/src/agent/react/use-chat/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,YAAY,EACV,UAAU,EACV,mBAAmB,EACnB,YAAY,EACZ,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,aAAa,EACb,UAAU,EACV,cAAc,EACd,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,gBAAgB,EAChB,eAAe,GAChB,MAAM,sBAAsB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { ChatDataPart, ChatDynamicToolPart, ChatMessage, ChatMessagePart, ChatReasoningPart, ChatStepPart, ChatTextPart, ChatToolPart, ChatToolResultPart, ChatToolState } from "../../../chat/protocol.js";
|
|
1
|
+
import type { ChatDataPart, ChatDynamicToolPart, ChatFilePart, ChatMessage, ChatMessagePart, ChatReasoningPart, ChatStepPart, ChatTextPart, ChatToolPart, ChatToolResultPart, ChatToolState } from "../../../chat/protocol.js";
|
|
2
2
|
/** Where inference is happening. */
|
|
3
3
|
export type InferenceMode = "cloud" | "server-local";
|
|
4
|
-
export type { ChatDataPart, ChatDynamicToolPart, ChatMessage, ChatMessagePart, ChatReasoningPart, ChatStepPart, ChatTextPart, ChatToolPart, ChatToolResultPart, ChatToolState, };
|
|
4
|
+
export type { ChatDataPart, ChatDynamicToolPart, ChatFilePart, ChatMessage, ChatMessagePart, ChatReasoningPart, ChatStepPart, ChatTextPart, ChatToolPart, ChatToolResultPart, ChatToolState, };
|
|
5
5
|
type ToolOutputState = "output-available" | "output-error";
|
|
6
6
|
/** Output from tool. */
|
|
7
7
|
export interface ToolOutput {
|
|
@@ -59,6 +59,7 @@ export interface UseChatResult {
|
|
|
59
59
|
setModel: (model: string | undefined) => void;
|
|
60
60
|
sendMessage: (message: {
|
|
61
61
|
text: string;
|
|
62
|
+
files?: ChatFilePart[];
|
|
62
63
|
}) => Promise<void>;
|
|
63
64
|
/** Edit a user message and resubmit — truncates history to that point */
|
|
64
65
|
editMessage: (messageId: string, newText: string) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/src/agent/react/use-chat/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACd,MAAM,2BAA2B,CAAC;AAEnC,oCAAoC;AACpC,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,cAAc,CAAC;AAEr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E,UAAU,KAAK,IAAI,CAAC;IAC5C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,iBAAiB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,KAAK,IAAI,CAAC;IAC1F,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,sFAAsF;IACtF,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,KAAK,IAAI,CAAC;IACjF,iFAAiF;IACjF,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,kFAAkF;IAClF,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CACpD"}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* - server-local: explicit local model on the server
|
|
10
10
|
*/
|
|
11
11
|
import { handleAgUiStreamingResponse } from "./streaming/index.js";
|
|
12
|
-
import type { ChatMessage, UseChatOptions, UseChatResult } from "./types.js";
|
|
12
|
+
import type { ChatFilePart, ChatMessage, ChatMessagePart, UseChatOptions, UseChatResult } from "./types.js";
|
|
13
13
|
type UseChatStreamHandler = typeof handleAgUiStreamingResponse;
|
|
14
14
|
/** A snapshot of messages from a branch point onward */
|
|
15
15
|
interface Branch {
|
|
@@ -24,6 +24,17 @@ interface BranchState {
|
|
|
24
24
|
export declare function isLatestRequest(activeRequestId: number, requestId: number): boolean;
|
|
25
25
|
export declare function resolveBranchKey(messageId: string, branchMap: Map<string, BranchState>, branchKeyByMessageId: Map<string, string>): string | undefined;
|
|
26
26
|
export declare function findBranchUserMessageIndex(messages: ChatMessage[], branchKey: string, branchKeyByMessageId: Map<string, string>): number;
|
|
27
|
+
/**
|
|
28
|
+
* Build the parts for an outgoing user message. File attachments lead (before
|
|
29
|
+
* the text) so the model sees the referenced files first — matching how AI-SDK
|
|
30
|
+
* orders multimodal parts. Exported for unit testing.
|
|
31
|
+
*/
|
|
32
|
+
export declare function buildUserMessageParts(text: string, files?: ChatFilePart[]): ChatMessagePart[];
|
|
33
|
+
/** Extract the text and file payload from a user message for regenerate. */
|
|
34
|
+
export declare function userMessagePayload(message: ChatMessage): {
|
|
35
|
+
text: string;
|
|
36
|
+
files?: ChatFilePart[];
|
|
37
|
+
} | null;
|
|
27
38
|
export declare function resolveUseChatStreamHandler(transport: UseChatOptions["transport"]): UseChatStreamHandler;
|
|
28
39
|
export declare function useChat(options?: UseChatOptions): UseChatResult;
|
|
29
40
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-chat.d.ts","sourceRoot":"","sources":["../../../../../src/src/agent/react/use-chat/use-chat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAEV,WAAW,
|
|
1
|
+
{"version":3,"file":"use-chat.d.ts","sourceRoot":"","sources":["../../../../../src/src/agent/react/use-chat/use-chat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAEV,YAAY,EACZ,WAAW,EACX,eAAe,EAGf,cAAc,EACd,aAAa,EACd,MAAM,YAAY,CAAC;AAGpB,KAAK,oBAAoB,GAAG,OAAO,2BAA2B,CAAC;AAE/D,wDAAwD;AACxD,UAAU,MAAM;IACd,QAAQ,EAAE,WAAW,EAAE,CAAC;CACzB;AAED,sEAAsE;AACtE,UAAU,WAAW;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,WAAW,EAAE,CAAC;CAC7B;AAED,wBAAgB,eAAe,CAAC,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAEnF;AAED,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,EACnC,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACxC,MAAM,GAAG,SAAS,CAGpB;AAED,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,WAAW,EAAE,EACvB,SAAS,EAAE,MAAM,EACjB,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACxC,MAAM,CAIR;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,YAAY,EAAE,GACrB,eAAe,EAAE,CAEnB;AAMD,4EAA4E;AAC5E,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,WAAW,GACnB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,YAAY,EAAE,CAAA;CAAE,GAAG,IAAI,CAQjD;AAED,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,cAAc,CAAC,WAAW,CAAC,GACrC,oBAAoB,CAGtB;AAOD,wBAAgB,OAAO,CAAC,OAAO,GAAE,cAAmB,GAAG,aAAa,CAsbnE"}
|
|
@@ -22,6 +22,28 @@ export function resolveBranchKey(messageId, branchMap, branchKeyByMessageId) {
|
|
|
22
22
|
export function findBranchUserMessageIndex(messages, branchKey, branchKeyByMessageId) {
|
|
23
23
|
return messages.findIndex((m) => m.role === "user" && branchKeyByMessageId.get(m.id) === branchKey);
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Build the parts for an outgoing user message. File attachments lead (before
|
|
27
|
+
* the text) so the model sees the referenced files first — matching how AI-SDK
|
|
28
|
+
* orders multimodal parts. Exported for unit testing.
|
|
29
|
+
*/
|
|
30
|
+
export function buildUserMessageParts(text, files) {
|
|
31
|
+
return [...(files ?? []), { type: "text", text }];
|
|
32
|
+
}
|
|
33
|
+
function isFilePart(part) {
|
|
34
|
+
return part.type === "file";
|
|
35
|
+
}
|
|
36
|
+
/** Extract the text and file payload from a user message for regenerate. */
|
|
37
|
+
export function userMessagePayload(message) {
|
|
38
|
+
const text = message.parts
|
|
39
|
+
.filter((part) => part.type === "text")
|
|
40
|
+
.map((part) => part.text)
|
|
41
|
+
.join("");
|
|
42
|
+
const files = message.parts.filter(isFilePart);
|
|
43
|
+
if (!text && files.length === 0)
|
|
44
|
+
return null;
|
|
45
|
+
return { text, ...(files.length > 0 ? { files } : {}) };
|
|
46
|
+
}
|
|
25
47
|
export function resolveUseChatStreamHandler(transport) {
|
|
26
48
|
void transport;
|
|
27
49
|
return handleAgUiStreamingResponse;
|
|
@@ -88,7 +110,8 @@ export function useChat(options = {}) {
|
|
|
88
110
|
const userMessage = {
|
|
89
111
|
id: message.userMessageId ?? generateClientId("msg"),
|
|
90
112
|
role: "user",
|
|
91
|
-
parts:
|
|
113
|
+
parts: buildUserMessageParts(message.text, message.files),
|
|
114
|
+
createdAt: new Date().toISOString(),
|
|
92
115
|
};
|
|
93
116
|
const base = message.baseMessages ?? messagesRef.current;
|
|
94
117
|
setMessages([...base, userMessage]);
|
|
@@ -151,7 +174,12 @@ export function useChat(options = {}) {
|
|
|
151
174
|
if (!hasAddedStreamingMessage)
|
|
152
175
|
return [...prev, withMeta];
|
|
153
176
|
return prev.map((m) => (m.id === currentMessageIdRef.current
|
|
154
|
-
? {
|
|
177
|
+
? {
|
|
178
|
+
...withMeta,
|
|
179
|
+
// Keep the timestamp from when the turn first streamed in.
|
|
180
|
+
createdAt: m.createdAt ?? withMeta.createdAt,
|
|
181
|
+
metadata: { ...m.metadata, ...withMeta.metadata },
|
|
182
|
+
}
|
|
155
183
|
: m));
|
|
156
184
|
});
|
|
157
185
|
options.onFinish?.(withMeta);
|
|
@@ -187,7 +215,17 @@ export function useChat(options = {}) {
|
|
|
187
215
|
}
|
|
188
216
|
if (!hasAddedStreamingMessage) {
|
|
189
217
|
hasAddedStreamingMessage = true;
|
|
190
|
-
setMessages((prev) => [
|
|
218
|
+
setMessages((prev) => [
|
|
219
|
+
...prev,
|
|
220
|
+
{
|
|
221
|
+
id,
|
|
222
|
+
role: "assistant",
|
|
223
|
+
parts,
|
|
224
|
+
metadata,
|
|
225
|
+
// Stamp when the turn first appears; `onMessage` preserves it.
|
|
226
|
+
createdAt: new Date().toISOString(),
|
|
227
|
+
},
|
|
228
|
+
]);
|
|
191
229
|
return;
|
|
192
230
|
}
|
|
193
231
|
setMessages((prev) => prev.map((m) => m.id === currentMessageIdRef.current
|
|
@@ -223,11 +261,13 @@ export function useChat(options = {}) {
|
|
|
223
261
|
if (lastUserIndex === -1)
|
|
224
262
|
return;
|
|
225
263
|
const lastUserMessage = currentMessages[lastUserIndex];
|
|
226
|
-
|
|
227
|
-
|
|
264
|
+
if (!lastUserMessage)
|
|
265
|
+
return;
|
|
266
|
+
const payload = userMessagePayload(lastUserMessage);
|
|
267
|
+
if (!payload)
|
|
228
268
|
return;
|
|
229
269
|
const base = currentMessages.slice(0, lastUserIndex);
|
|
230
|
-
await sendMessage({
|
|
270
|
+
await sendMessage({ ...payload, baseMessages: base });
|
|
231
271
|
}, [sendMessage]);
|
|
232
272
|
/**
|
|
233
273
|
* Stop generation
|
|
@@ -368,7 +408,7 @@ export function useChat(options = {}) {
|
|
|
368
408
|
data,
|
|
369
409
|
handleInputChange,
|
|
370
410
|
handleSubmit,
|
|
371
|
-
// Aliases that match ChatProps
|
|
411
|
+
// Aliases that match ChatProps so users can spread {...chat}
|
|
372
412
|
onChange: handleInputChange,
|
|
373
413
|
onSubmit: handleSubmit,
|
|
374
414
|
onModelChange: setModel,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/src/agent/react/use-chat/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE/D,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,eAAe,EAAE,EACxB,QAAQ,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,GACjC,WAAW,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/src/agent/react/use-chat/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE/D,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,eAAe,EAAE,EACxB,QAAQ,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,GACjC,WAAW,CAWb"}
|