@agentuity/workbench 0.0.63 → 0.0.65
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/dist/components/App.d.ts +6 -0
- package/dist/components/App.d.ts.map +1 -0
- package/dist/components/App.js +13 -0
- package/dist/components/App.js.map +1 -0
- package/dist/components/ConnectionStatus.d.ts +7 -0
- package/dist/components/ConnectionStatus.d.ts.map +1 -0
- package/dist/components/ConnectionStatus.js +52 -0
- package/dist/components/ConnectionStatus.js.map +1 -0
- package/dist/components/Inline.d.ts +10 -0
- package/dist/components/Inline.d.ts.map +1 -0
- package/dist/components/Inline.js +11 -0
- package/dist/components/Inline.js.map +1 -0
- package/dist/components/ai-elements/actions.d.ts +10 -0
- package/dist/components/ai-elements/actions.d.ts.map +1 -0
- package/dist/components/ai-elements/actions.js +14 -0
- package/dist/components/ai-elements/actions.js.map +1 -0
- package/dist/components/ai-elements/artifact.d.ts +24 -0
- package/dist/components/ai-elements/artifact.d.ts.map +1 -0
- package/dist/components/ai-elements/artifact.js +21 -0
- package/dist/components/ai-elements/artifact.js.map +1 -0
- package/dist/components/ai-elements/branch.d.ts +21 -0
- package/dist/components/ai-elements/branch.d.ts.map +1 -0
- package/dist/components/ai-elements/branch.js +71 -0
- package/dist/components/ai-elements/branch.js.map +1 -0
- package/dist/components/ai-elements/canvas.d.ts +9 -0
- package/dist/components/ai-elements/canvas.d.ts.map +1 -0
- package/dist/components/ai-elements/canvas.js +6 -0
- package/dist/components/ai-elements/canvas.js.map +1 -0
- package/dist/components/ai-elements/chain-of-thought.d.ts +30 -0
- package/dist/components/ai-elements/chain-of-thought.d.ts.map +1 -0
- package/dist/components/ai-elements/chain-of-thought.js +52 -0
- package/dist/components/ai-elements/chain-of-thought.js.map +1 -0
- package/dist/components/ai-elements/code-block.d.ts +18 -0
- package/dist/components/ai-elements/code-block.d.ts.map +1 -0
- package/dist/components/ai-elements/code-block.js +89 -0
- package/dist/components/ai-elements/code-block.js.map +1 -0
- package/dist/components/ai-elements/confirmation.d.ts +27 -0
- package/dist/components/ai-elements/confirmation.d.ts.map +1 -0
- package/dist/components/ai-elements/confirmation.js +57 -0
- package/dist/components/ai-elements/confirmation.js.map +1 -0
- package/dist/components/ai-elements/connection.d.ts +3 -0
- package/dist/components/ai-elements/connection.d.ts.map +1 -0
- package/dist/components/ai-elements/connection.js +4 -0
- package/dist/components/ai-elements/connection.js.map +1 -0
- package/dist/components/ai-elements/context.d.ts +33 -0
- package/dist/components/ai-elements/context.d.ts.map +1 -0
- package/dist/components/ai-elements/context.js +167 -0
- package/dist/components/ai-elements/context.js.map +1 -0
- package/dist/components/ai-elements/controls.d.ts +5 -0
- package/dist/components/ai-elements/controls.d.ts.map +1 -0
- package/dist/components/ai-elements/controls.js +6 -0
- package/dist/components/ai-elements/controls.js.map +1 -0
- package/dist/components/ai-elements/conversation.d.ts +16 -0
- package/dist/components/ai-elements/conversation.d.ts.map +1 -0
- package/dist/components/ai-elements/conversation.js +18 -0
- package/dist/components/ai-elements/conversation.js.map +1 -0
- package/dist/components/ai-elements/edge.d.ts +6 -0
- package/dist/components/ai-elements/edge.d.ts.map +1 -0
- package/dist/components/ai-elements/edge.js +83 -0
- package/dist/components/ai-elements/edge.js.map +1 -0
- package/dist/components/ai-elements/image.d.ts +7 -0
- package/dist/components/ai-elements/image.d.ts.map +1 -0
- package/dist/components/ai-elements/image.js +4 -0
- package/dist/components/ai-elements/image.js.map +1 -0
- package/dist/components/ai-elements/inline-citation.d.ts +39 -0
- package/dist/components/ai-elements/inline-citation.d.ts.map +1 -0
- package/dist/components/ai-elements/inline-citation.js +62 -0
- package/dist/components/ai-elements/inline-citation.js.map +1 -0
- package/dist/components/ai-elements/loader.d.ts +6 -0
- package/dist/components/ai-elements/loader.d.ts.map +1 -0
- package/dist/components/ai-elements/loader.js +5 -0
- package/dist/components/ai-elements/loader.js.map +1 -0
- package/dist/components/ai-elements/message.d.ts +20 -0
- package/dist/components/ai-elements/message.d.ts.map +1 -0
- package/dist/components/ai-elements/message.js +26 -0
- package/dist/components/ai-elements/message.js.map +1 -0
- package/dist/components/ai-elements/node.d.ts +22 -0
- package/dist/components/ai-elements/node.d.ts.map +1 -0
- package/dist/components/ai-elements/node.js +12 -0
- package/dist/components/ai-elements/node.js.map +1 -0
- package/dist/components/ai-elements/open-in-chat.d.ts +29 -0
- package/dist/components/ai-elements/open-in-chat.d.ts.map +1 -0
- package/dist/components/ai-elements/open-in-chat.js +97 -0
- package/dist/components/ai-elements/open-in-chat.js.map +1 -0
- package/dist/components/ai-elements/panel.d.ts +6 -0
- package/dist/components/ai-elements/panel.d.ts.map +1 -0
- package/dist/components/ai-elements/panel.js +5 -0
- package/dist/components/ai-elements/panel.js.map +1 -0
- package/dist/components/ai-elements/plan.d.ts +26 -0
- package/dist/components/ai-elements/plan.d.ts.map +1 -0
- package/dist/components/ai-elements/plan.js +32 -0
- package/dist/components/ai-elements/plan.js.map +1 -0
- package/dist/components/ai-elements/prompt-input.d.ts +187 -0
- package/dist/components/ai-elements/prompt-input.d.ts.map +1 -0
- package/dist/components/ai-elements/prompt-input.js +544 -0
- package/dist/components/ai-elements/prompt-input.js.map +1 -0
- package/dist/components/ai-elements/queue.d.ts +62 -0
- package/dist/components/ai-elements/queue.d.ts.map +1 -0
- package/dist/components/ai-elements/queue.js +25 -0
- package/dist/components/ai-elements/queue.js.map +1 -0
- package/dist/components/ai-elements/reasoning.d.ts +17 -0
- package/dist/components/ai-elements/reasoning.d.ts.map +1 -0
- package/dist/components/ai-elements/reasoning.js +77 -0
- package/dist/components/ai-elements/reasoning.js.map +1 -0
- package/dist/components/ai-elements/response.d.ts +6 -0
- package/dist/components/ai-elements/response.d.ts.map +1 -0
- package/dist/components/ai-elements/response.js +8 -0
- package/dist/components/ai-elements/response.js.map +1 -0
- package/dist/components/ai-elements/shimmer.d.ts +10 -0
- package/dist/components/ai-elements/shimmer.d.ts.map +1 -0
- package/dist/components/ai-elements/shimmer.js +19 -0
- package/dist/components/ai-elements/shimmer.js.map +1 -0
- package/dist/components/ai-elements/sources.d.ts +13 -0
- package/dist/components/ai-elements/sources.d.ts.map +1 -0
- package/dist/components/ai-elements/sources.js +10 -0
- package/dist/components/ai-elements/sources.js.map +1 -0
- package/dist/components/ai-elements/suggestion.d.ts +11 -0
- package/dist/components/ai-elements/suggestion.d.ts.map +1 -0
- package/dist/components/ai-elements/suggestion.js +13 -0
- package/dist/components/ai-elements/suggestion.js.map +1 -0
- package/dist/components/ai-elements/task.d.ts +15 -0
- package/dist/components/ai-elements/task.d.ts.map +1 -0
- package/dist/components/ai-elements/task.js +11 -0
- package/dist/components/ai-elements/task.js.map +1 -0
- package/dist/components/ai-elements/tool.d.ts +24 -0
- package/dist/components/ai-elements/tool.d.ts.map +1 -0
- package/dist/components/ai-elements/tool.js +47 -0
- package/dist/components/ai-elements/tool.js.map +1 -0
- package/dist/components/ai-elements/toolbar.d.ts +6 -0
- package/dist/components/ai-elements/toolbar.d.ts.map +1 -0
- package/dist/components/ai-elements/toolbar.js +5 -0
- package/dist/components/ai-elements/toolbar.js.map +1 -0
- package/dist/components/ai-elements/web-preview.d.ts +35 -0
- package/dist/components/ai-elements/web-preview.d.ts.map +1 -0
- package/dist/components/ai-elements/web-preview.js +63 -0
- package/dist/components/ai-elements/web-preview.js.map +1 -0
- package/dist/components/internal/Chat.d.ts +11 -0
- package/dist/components/internal/Chat.d.ts.map +1 -0
- package/dist/components/internal/Chat.js +52 -0
- package/dist/components/internal/Chat.js.map +1 -0
- package/dist/components/internal/Header.d.ts +10 -0
- package/dist/components/internal/Header.d.ts.map +1 -0
- package/dist/components/internal/Header.js +31 -0
- package/dist/components/internal/Header.js.map +1 -0
- package/dist/components/internal/InputSection.d.ts +14 -0
- package/dist/components/internal/InputSection.d.ts.map +1 -0
- package/dist/components/internal/InputSection.js +212 -0
- package/dist/components/internal/InputSection.js.map +1 -0
- package/dist/components/internal/Schema.d.ts +7 -0
- package/dist/components/internal/Schema.d.ts.map +1 -0
- package/dist/components/internal/Schema.js +14 -0
- package/dist/components/internal/Schema.js.map +1 -0
- package/dist/components/internal/WorkbenchProvider.d.ts +11 -0
- package/dist/components/internal/WorkbenchProvider.d.ts.map +1 -0
- package/dist/components/internal/WorkbenchProvider.js +224 -0
- package/dist/components/internal/WorkbenchProvider.js.map +1 -0
- package/dist/components/internal/logo.d.ts +2 -0
- package/dist/components/internal/logo.d.ts.map +1 -0
- package/dist/components/internal/logo.js +5 -0
- package/dist/components/internal/logo.js.map +1 -0
- package/dist/components/ui/alert.d.ts +10 -0
- package/dist/components/ui/alert.d.ts.map +1 -0
- package/dist/components/ui/alert.js +25 -0
- package/dist/components/ui/alert.js.map +1 -0
- package/dist/components/ui/avatar.d.ts +7 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/avatar.js +14 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/badge.d.ts +10 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.js +23 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/button.d.ts +3 -4
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/card.d.ts +2 -1
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/card.js +4 -1
- package/dist/components/ui/card.js.map +1 -1
- package/dist/components/ui/carousel.d.ts +20 -0
- package/dist/components/ui/carousel.d.ts.map +1 -0
- package/dist/components/ui/carousel.js +92 -0
- package/dist/components/ui/carousel.js.map +1 -0
- package/dist/components/ui/checkbox.d.ts +5 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox.js +9 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +14 -0
- package/dist/components/ui/collapsible.js.map +1 -0
- package/dist/components/ui/command.d.ts +19 -0
- package/dist/components/ui/command.d.ts.map +1 -0
- package/dist/components/ui/command.js +34 -0
- package/dist/components/ui/command.js.map +1 -0
- package/dist/components/ui/dialog.d.ts +16 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog.js +36 -0
- package/dist/components/ui/dialog.js.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +26 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +52 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/ui/field.d.ts +25 -0
- package/dist/components/ui/field.d.ts.map +1 -0
- package/dist/components/ui/field.js +74 -0
- package/dist/components/ui/field.js.map +1 -0
- package/dist/components/ui/form.d.ts +25 -0
- package/dist/components/ui/form.d.ts.map +1 -0
- package/dist/components/ui/form.js +58 -0
- package/dist/components/ui/form.js.map +1 -0
- package/dist/components/ui/hover-card.d.ts +7 -0
- package/dist/components/ui/hover-card.d.ts.map +1 -0
- package/dist/components/ui/hover-card.js +14 -0
- package/dist/components/ui/hover-card.js.map +1 -0
- package/dist/components/ui/input-group.d.ts +17 -0
- package/dist/components/ui/input-group.d.ts.map +1 -0
- package/dist/components/ui/input-group.js +64 -0
- package/dist/components/ui/input-group.js.map +1 -0
- package/dist/components/ui/input.d.ts +1 -2
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/input.js +3 -5
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/label.d.ts +5 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/label.js +9 -0
- package/dist/components/ui/label.js.map +1 -0
- package/dist/components/ui/popover.d.ts +8 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/popover.js +18 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/progress.d.ts +5 -0
- package/dist/components/ui/progress.d.ts.map +1 -0
- package/dist/components/ui/progress.js +9 -0
- package/dist/components/ui/progress.js.map +1 -0
- package/dist/components/ui/resizable-provider.d.ts +15 -0
- package/dist/components/ui/resizable-provider.d.ts.map +1 -0
- package/dist/components/ui/resizable-provider.js +54 -0
- package/dist/components/ui/resizable-provider.js.map +1 -0
- package/dist/components/ui/resizable.d.ts +9 -0
- package/dist/components/ui/resizable.d.ts.map +1 -0
- package/dist/components/ui/resizable.js +16 -0
- package/dist/components/ui/resizable.js.map +1 -0
- package/dist/components/ui/scroll-area.d.ts +6 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.js +11 -0
- package/dist/components/ui/scroll-area.js.map +1 -0
- package/dist/components/ui/select.d.ts +16 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/select.js +39 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/separator.d.ts +5 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.js +9 -0
- package/dist/components/ui/separator.js.map +1 -0
- package/dist/components/ui/switch.d.ts +5 -0
- package/dist/components/ui/switch.d.ts.map +1 -0
- package/dist/components/ui/switch.js +8 -0
- package/dist/components/ui/switch.js.map +1 -0
- package/dist/components/ui/tabs.d.ts +8 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +17 -0
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/components/ui/textarea.d.ts +4 -0
- package/dist/components/ui/textarea.d.ts.map +1 -0
- package/dist/components/ui/textarea.js +7 -0
- package/dist/components/ui/textarea.js.map +1 -0
- package/dist/components/ui/theme-provider.d.ts +14 -0
- package/dist/components/ui/theme-provider.d.ts.map +1 -0
- package/dist/components/ui/theme-provider.js +37 -0
- package/dist/components/ui/theme-provider.js.map +1 -0
- package/dist/components/ui/theme-toggle.d.ts +2 -0
- package/dist/components/ui/theme-toggle.d.ts.map +1 -0
- package/dist/components/ui/theme-toggle.js +10 -0
- package/dist/components/ui/theme-toggle.js.map +1 -0
- package/dist/components/ui/toggle.d.ts +10 -0
- package/dist/components/ui/toggle.d.ts.map +1 -0
- package/dist/components/ui/toggle.js +26 -0
- package/dist/components/ui/toggle.js.map +1 -0
- package/dist/components/ui/tooltip.d.ts +8 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.js +17 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/components.d.ts +10 -6
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +11 -36
- package/dist/components.js.map +1 -1
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/useAgentSchemas.d.ts +70 -0
- package/dist/hooks/useAgentSchemas.d.ts.map +1 -0
- package/dist/hooks/useAgentSchemas.js +90 -0
- package/dist/hooks/useAgentSchemas.js.map +1 -0
- package/dist/hooks/useWorkbenchSchemas.d.ts +56 -0
- package/dist/hooks/useWorkbenchSchemas.d.ts.map +1 -0
- package/dist/hooks/useWorkbenchSchemas.js +63 -0
- package/dist/hooks/useWorkbenchSchemas.js.map +1 -0
- package/dist/hooks/useWorkbenchWebsocket.d.ts +14 -0
- package/dist/hooks/useWorkbenchWebsocket.d.ts.map +1 -0
- package/dist/hooks/useWorkbenchWebsocket.js +163 -0
- package/dist/hooks/useWorkbenchWebsocket.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +3 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +5 -0
- package/dist/server.js.map +1 -0
- package/dist/styles.css +3423 -196
- package/dist/types/config.d.ts +29 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +2 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/workbench.d.ts +1 -2
- package/dist/workbench.d.ts.map +1 -1
- package/dist/workbench.js +0 -2
- package/dist/workbench.js.map +1 -1
- package/package.json +50 -7
- package/src/components/App.tsx +29 -0
- package/src/components/ConnectionStatus.tsx +67 -0
- package/src/components/Inline.tsx +16 -0
- package/src/components/ai-elements/actions.tsx +60 -0
- package/src/components/ai-elements/artifact.tsx +118 -0
- package/src/components/ai-elements/branch.tsx +187 -0
- package/src/components/ai-elements/canvas.tsx +24 -0
- package/src/components/ai-elements/chain-of-thought.tsx +198 -0
- package/src/components/ai-elements/code-block.tsx +175 -0
- package/src/components/ai-elements/confirmation.tsx +119 -0
- package/src/components/ai-elements/connection.tsx +16 -0
- package/src/components/ai-elements/context.tsx +357 -0
- package/src/components/ai-elements/controls.tsx +18 -0
- package/src/components/ai-elements/conversation.tsx +90 -0
- package/src/components/ai-elements/edge.tsx +131 -0
- package/src/components/ai-elements/image.tsx +16 -0
- package/src/components/ai-elements/inline-citation.tsx +246 -0
- package/src/components/ai-elements/loader.tsx +88 -0
- package/src/components/ai-elements/message.tsx +63 -0
- package/src/components/ai-elements/node.tsx +66 -0
- package/src/components/ai-elements/open-in-chat.tsx +333 -0
- package/src/components/ai-elements/panel.tsx +12 -0
- package/src/components/ai-elements/plan.tsx +123 -0
- package/src/components/ai-elements/prompt-input.tsx +1203 -0
- package/src/components/ai-elements/queue.tsx +231 -0
- package/src/components/ai-elements/reasoning.tsx +163 -0
- package/src/components/ai-elements/response.tsx +19 -0
- package/src/components/ai-elements/shimmer.tsx +53 -0
- package/src/components/ai-elements/sources.tsx +53 -0
- package/src/components/ai-elements/suggestion.tsx +47 -0
- package/src/components/ai-elements/task.tsx +64 -0
- package/src/components/ai-elements/tool.tsx +136 -0
- package/src/components/ai-elements/toolbar.tsx +13 -0
- package/src/components/ai-elements/web-preview.tsx +238 -0
- package/src/components/internal/Chat.tsx +183 -0
- package/src/components/internal/Header.tsx +77 -0
- package/src/components/internal/InputSection.tsx +427 -0
- package/src/components/internal/Schema.tsx +111 -0
- package/src/components/internal/WorkbenchProvider.tsx +265 -0
- package/src/components/internal/logo.tsx +11 -0
- package/src/components/ui/alert.tsx +60 -0
- package/src/components/ui/avatar.tsx +42 -0
- package/src/components/ui/badge.tsx +40 -0
- package/src/components/ui/button.tsx +10 -5
- package/src/components/ui/card.tsx +4 -1
- package/src/components/ui/carousel.tsx +234 -0
- package/src/components/ui/checkbox.tsx +27 -0
- package/src/components/ui/collapsible.tsx +21 -0
- package/src/components/ui/command.tsx +153 -0
- package/src/components/ui/dialog.tsx +127 -0
- package/src/components/ui/dropdown-menu.tsx +228 -0
- package/src/components/ui/field.tsx +234 -0
- package/src/components/ui/form.tsx +154 -0
- package/src/components/ui/hover-card.tsx +36 -0
- package/src/components/ui/input-group.tsx +158 -0
- package/src/components/ui/input.tsx +16 -18
- package/src/components/ui/label.tsx +21 -0
- package/src/components/ui/popover.tsx +42 -0
- package/src/components/ui/progress.tsx +28 -0
- package/src/components/ui/resizable-provider.tsx +83 -0
- package/src/components/ui/resizable.tsx +54 -0
- package/src/components/ui/scroll-area.tsx +54 -0
- package/src/components/ui/select.tsx +172 -0
- package/src/components/ui/separator.tsx +28 -0
- package/src/components/ui/switch.tsx +26 -0
- package/src/components/ui/tabs.tsx +52 -0
- package/src/components/ui/textarea.tsx +18 -0
- package/src/components/ui/theme-provider.tsx +71 -0
- package/src/components/ui/theme-toggle.tsx +30 -0
- package/src/components/ui/toggle.tsx +44 -0
- package/src/components/ui/tooltip.tsx +55 -0
- package/src/components.tsx +28 -74
- package/src/hooks/index.ts +19 -0
- package/src/hooks/useAgentSchemas.ts +144 -0
- package/src/hooks/useWorkbenchSchemas.ts +69 -0
- package/src/hooks/useWorkbenchWebsocket.ts +220 -0
- package/src/index.ts +5 -11
- package/src/server.ts +6 -0
- package/src/styles.css +214 -59
- package/src/types/config.ts +34 -0
- package/src/types.ts +1 -1
- package/src/workbench.ts +1 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../src/components/App.tsx"],"names":[],"mappings":"AAQA,MAAM,WAAW,QAAQ;IACxB,YAAY,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,GAAG,CAAC,EAAE,YAAY,EAAE,EAAE,QAAQ,2CAc7C;AAED,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { WorkbenchProvider } from './internal/WorkbenchProvider';
|
|
3
|
+
import { Header } from './internal/Header';
|
|
4
|
+
import { Chat } from './internal/Chat';
|
|
5
|
+
import { ThemeProvider } from './ui/theme-provider';
|
|
6
|
+
import { ResizableProvider } from './ui/resizable-provider';
|
|
7
|
+
import { decodeWorkbenchConfig } from '@agentuity/core/workbench';
|
|
8
|
+
export function App({ configBase64 }) {
|
|
9
|
+
const decodedConfig = decodeWorkbenchConfig(configBase64);
|
|
10
|
+
return (_jsx(WorkbenchProvider, { config: decodedConfig, children: _jsx(ThemeProvider, { children: _jsx(ResizableProvider, { children: _jsxs("div", { className: "flex flex-col h-screen", children: [_jsx(Header, {}), _jsx(Chat, {})] }) }) }) }));
|
|
11
|
+
}
|
|
12
|
+
export default App;
|
|
13
|
+
//# sourceMappingURL=App.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App.js","sourceRoot":"","sources":["../../src/components/App.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAMlE,MAAM,UAAU,GAAG,CAAC,EAAE,YAAY,EAAY;IAC7C,MAAM,aAAa,GAAG,qBAAqB,CAAC,YAAY,CAAC,CAAC;IAC1D,OAAO,CACN,KAAC,iBAAiB,IAAC,MAAM,EAAE,aAAa,YACvC,KAAC,aAAa,cACb,KAAC,iBAAiB,cACjB,eAAK,SAAS,EAAC,wBAAwB,aACtC,KAAC,MAAM,KAAG,EACV,KAAC,IAAI,KAAG,IACH,GACa,GACL,GACG,CACpB,CAAC;AACH,CAAC;AAED,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ConnectionStatus as ConnectionStatusType } from '../types/config';
|
|
2
|
+
interface ConnectionStatusProps {
|
|
3
|
+
status: ConnectionStatusType;
|
|
4
|
+
}
|
|
5
|
+
export declare function ConnectionStatus({ status }: ConnectionStatusProps): import("react/jsx-runtime").JSX.Element | null;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=ConnectionStatus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectionStatus.d.ts","sourceRoot":"","sources":["../../src/components/ConnectionStatus.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,IAAI,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEhF,UAAU,qBAAqB;IAC9B,MAAM,EAAE,oBAAoB,CAAC;CAC7B;AAED,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,EAAE,qBAAqB,kDA2DjE"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export function ConnectionStatus({ status }) {
|
|
3
|
+
if (status === 'connected') {
|
|
4
|
+
return null; // Don't show anything when connected normally
|
|
5
|
+
}
|
|
6
|
+
const getStatusConfig = (status) => {
|
|
7
|
+
switch (status) {
|
|
8
|
+
case 'restarting':
|
|
9
|
+
return {
|
|
10
|
+
text: 'Server restarting...',
|
|
11
|
+
bgColor: 'bg-amber-100',
|
|
12
|
+
textColor: 'text-amber-800',
|
|
13
|
+
borderColor: 'border-amber-200',
|
|
14
|
+
icon: '🔄',
|
|
15
|
+
};
|
|
16
|
+
case 'disconnected':
|
|
17
|
+
return {
|
|
18
|
+
text: 'Disconnected from server',
|
|
19
|
+
bgColor: 'bg-red-100',
|
|
20
|
+
textColor: 'text-red-800',
|
|
21
|
+
borderColor: 'border-red-200',
|
|
22
|
+
icon: '⚠️',
|
|
23
|
+
};
|
|
24
|
+
case 'connected':
|
|
25
|
+
return {
|
|
26
|
+
text: 'Connected',
|
|
27
|
+
bgColor: 'bg-green-100',
|
|
28
|
+
textColor: 'text-green-800',
|
|
29
|
+
borderColor: 'border-green-200',
|
|
30
|
+
icon: '✅',
|
|
31
|
+
};
|
|
32
|
+
default:
|
|
33
|
+
return {
|
|
34
|
+
text: 'Unknown status',
|
|
35
|
+
bgColor: 'bg-gray-100',
|
|
36
|
+
textColor: 'text-gray-800',
|
|
37
|
+
borderColor: 'border-gray-200',
|
|
38
|
+
icon: '❓',
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const config = getStatusConfig(status);
|
|
43
|
+
return (_jsxs("div", { className: `
|
|
44
|
+
fixed top-0 left-0 right-0 z-50
|
|
45
|
+
px-4 py-2
|
|
46
|
+
${config.bgColor} ${config.textColor} ${config.borderColor}
|
|
47
|
+
border-b
|
|
48
|
+
text-center text-sm font-medium
|
|
49
|
+
transition-all duration-200 ease-in-out
|
|
50
|
+
`, children: [_jsx("span", { className: "mr-2", children: config.icon }), config.text] }));
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=ConnectionStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectionStatus.js","sourceRoot":"","sources":["../../src/components/ConnectionStatus.tsx"],"names":[],"mappings":";AAOA,MAAM,UAAU,gBAAgB,CAAC,EAAE,MAAM,EAAyB;IACjE,IAAI,MAAM,KAAK,WAAW,EA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
|
4
|
+
/**
|
|
5
|
+
* Inline component - just the chat area
|
|
6
|
+
* Must be used within WorkbenchProvider
|
|
7
|
+
*/
|
|
8
|
+
export declare function Inline({ className }: InlineProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default Inline;
|
|
10
|
+
//# sourceMappingURL=Inline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Inline.d.ts","sourceRoot":"","sources":["../../src/components/Inline.tsx"],"names":[],"mappings":"AAGA,MAAM,WAAW,WAAW;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,EAAE,SAAS,EAAE,EAAE,WAAW,2CAEhD;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Chat } from './internal/Chat';
|
|
3
|
+
/**
|
|
4
|
+
* Inline component - just the chat area
|
|
5
|
+
* Must be used within WorkbenchProvider
|
|
6
|
+
*/
|
|
7
|
+
export function Inline({ className }) {
|
|
8
|
+
return _jsx(Chat, { className: className });
|
|
9
|
+
}
|
|
10
|
+
export default Inline;
|
|
11
|
+
//# sourceMappingURL=Inline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Inline.js","sourceRoot":"","sources":["../../src/components/Inline.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAMvC;;;GAGG;AACH,MAAM,UAAU,MAAM,CAAC,EAAE,SAAS,EAAe;IAChD,OAAO,KAAC,IAAI,IAAC,SAAS,EAAE,SAAS,GAAI,CAAC;AACvC,CAAC;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Button } from '../ui/button';
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
3
|
+
export type ActionsProps = ComponentProps<'div'>;
|
|
4
|
+
export declare const Actions: ({ className, children, ...props }: ActionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export type ActionProps = ComponentProps<typeof Button> & {
|
|
6
|
+
tooltip?: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const Action: ({ tooltip, children, label, className, variant, size, ...props }: ActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/actions.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAEjD,eAAO,MAAM,OAAO,GAAI,mCAAmC,YAAY,4CAItE,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,GAAG;IACzD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,kEAQpB,WAAW,4CA+Bb,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button } from '../ui/button';
|
|
4
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../ui/tooltip';
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
export const Actions = ({ className, children, ...props }) => (_jsx("div", { className: cn('flex items-center gap-1', className), ...props, children: children }));
|
|
7
|
+
export const Action = ({ tooltip, children, label, className, variant = 'ghost', size = 'sm', ...props }) => {
|
|
8
|
+
const button = (_jsxs(Button, { className: cn('relative size-9 p-1.5 text-muted-foreground hover:text-foreground', className), size: size, type: "button", variant: variant, ...props, children: [children, _jsx("span", { className: "sr-only", children: label || tooltip })] }));
|
|
9
|
+
if (tooltip) {
|
|
10
|
+
return (_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: button }), _jsx(TooltipContent, { children: _jsx("p", { children: tooltip }) })] }) }));
|
|
11
|
+
}
|
|
12
|
+
return button;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../src/components/ai-elements/actions.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACzF,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAKrC,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAgB,EAAE,EAAE,CAAC,CAC3E,cAAK,SAAS,EAAE,EAAE,CAAC,yBAAyB,EAAE,SAAS,CAAC,KAAM,KAAK,YACjE,QAAQ,GACJ,CACN,CAAC;AAOF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,EACtB,OAAO,EACP,QAAQ,EACR,KAAK,EACL,SAAS,EACT,OAAO,GAAG,OAAO,EACjB,IAAI,GAAG,IAAI,EACX,GAAG,KAAK,EACK,EAAE,EAAE;IACjB,MAAM,MAAM,GAAG,CACd,MAAC,MAAM,IACN,SAAS,EAAE,EAAE,CACZ,mEAAmE,EACnE,SAAS,CACT,EACD,IAAI,EAAE,IAAI,EACV,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,OAAO,KACZ,KAAK,aAER,QAAQ,EACT,eAAM,SAAS,EAAC,SAAS,YAAE,KAAK,IAAI,OAAO,GAAQ,IAC3C,CACT,CAAC;IAEF,IAAI,OAAO,EAAE,CAAC;QACb,OAAO,CACN,KAAC,eAAe,cACf,MAAC,OAAO,eACP,KAAC,cAAc,IAAC,OAAO,kBAAE,MAAM,GAAkB,EACjD,KAAC,cAAc,cACd,sBAAI,OAAO,GAAK,GACA,IACR,GACO,CAClB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Button } from '../ui/button';
|
|
2
|
+
import { type LucideIcon } from 'lucide-react';
|
|
3
|
+
import type { ComponentProps, HTMLAttributes } from 'react';
|
|
4
|
+
export type ArtifactProps = HTMLAttributes<HTMLDivElement>;
|
|
5
|
+
export declare const Artifact: ({ className, ...props }: ArtifactProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export type ArtifactHeaderProps = HTMLAttributes<HTMLDivElement>;
|
|
7
|
+
export declare const ArtifactHeader: ({ className, ...props }: ArtifactHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export type ArtifactCloseProps = ComponentProps<typeof Button>;
|
|
9
|
+
export declare const ArtifactClose: ({ className, children, size, variant, ...props }: ArtifactCloseProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export type ArtifactTitleProps = HTMLAttributes<HTMLParagraphElement>;
|
|
11
|
+
export declare const ArtifactTitle: ({ className, ...props }: ArtifactTitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export type ArtifactDescriptionProps = HTMLAttributes<HTMLParagraphElement>;
|
|
13
|
+
export declare const ArtifactDescription: ({ className, ...props }: ArtifactDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export type ArtifactActionsProps = HTMLAttributes<HTMLDivElement>;
|
|
15
|
+
export declare const ArtifactActions: ({ className, ...props }: ArtifactActionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export type ArtifactActionProps = ComponentProps<typeof Button> & {
|
|
17
|
+
tooltip?: string;
|
|
18
|
+
label?: string;
|
|
19
|
+
icon?: LucideIcon;
|
|
20
|
+
};
|
|
21
|
+
export declare const ArtifactAction: ({ tooltip, label, icon: Icon, children, className, size, variant, ...props }: ArtifactActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export type ArtifactContentProps = HTMLAttributes<HTMLDivElement>;
|
|
23
|
+
export declare const ArtifactContent: ({ className, ...props }: ArtifactContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
//# sourceMappingURL=artifact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/artifact.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC,OAAO,EAAE,KAAK,UAAU,EAAS,MAAM,cAAc,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5D,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAE3D,eAAO,MAAM,QAAQ,GAAI,yBAAyB,aAAa,4CAQ9D,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEjE,eAAO,MAAM,cAAc,GAAI,yBAAyB,mBAAmB,4CAK1E,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC;AAE/D,eAAO,MAAM,aAAa,GAAI,kDAM3B,kBAAkB,4CAWpB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,oBAAoB,CAAC,CAAC;AAEtE,eAAO,MAAM,aAAa,GAAI,yBAAyB,kBAAkB,4CAExE,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,cAAc,CAAC,oBAAoB,CAAC,CAAC;AAE5E,eAAO,MAAM,mBAAmB,GAAI,yBAAyB,wBAAwB,4CAEpF,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAElE,eAAO,MAAM,eAAe,GAAI,yBAAyB,oBAAoB,4CAE5E,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,GAAG;IACjE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,UAAU,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,8EAS5B,mBAAmB,4CA4BrB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAElE,eAAO,MAAM,eAAe,GAAI,yBAAyB,oBAAoB,4CAE5E,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button } from '../ui/button';
|
|
4
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../ui/tooltip';
|
|
5
|
+
import { cn } from '../../lib/utils';
|
|
6
|
+
import { XIcon } from 'lucide-react';
|
|
7
|
+
export const Artifact = ({ className, ...props }) => (_jsx("div", { className: cn('flex flex-col overflow-hidden rounded-lg border bg-background shadow-sm', className), ...props }));
|
|
8
|
+
export const ArtifactHeader = ({ className, ...props }) => (_jsx("div", { className: cn('flex items-center justify-between border-b bg-muted/50 px-4 py-3', className), ...props }));
|
|
9
|
+
export const ArtifactClose = ({ className, children, size = 'sm', variant = 'ghost', ...props }) => (_jsxs(Button, { className: cn('size-8 p-0 text-muted-foreground hover:text-foreground', className), size: size, type: "button", variant: variant, ...props, children: [children ?? _jsx(XIcon, { className: "size-4" }), _jsx("span", { className: "sr-only", children: "Close" })] }));
|
|
10
|
+
export const ArtifactTitle = ({ className, ...props }) => (_jsx("p", { className: cn('font-medium text-foreground text-sm', className), ...props }));
|
|
11
|
+
export const ArtifactDescription = ({ className, ...props }) => (_jsx("p", { className: cn('text-muted-foreground text-sm', className), ...props }));
|
|
12
|
+
export const ArtifactActions = ({ className, ...props }) => (_jsx("div", { className: cn('flex items-center gap-1', className), ...props }));
|
|
13
|
+
export const ArtifactAction = ({ tooltip, label, icon: Icon, children, className, size = 'sm', variant = 'ghost', ...props }) => {
|
|
14
|
+
const button = (_jsxs(Button, { className: cn('size-8 p-0 text-muted-foreground hover:text-foreground', className), size: size, type: "button", variant: variant, ...props, children: [Icon ? _jsx(Icon, { className: "size-4" }) : children, _jsx("span", { className: "sr-only", children: label || tooltip })] }));
|
|
15
|
+
if (tooltip) {
|
|
16
|
+
return (_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: button }), _jsx(TooltipContent, { children: _jsx("p", { children: tooltip }) })] }) }));
|
|
17
|
+
}
|
|
18
|
+
return button;
|
|
19
|
+
};
|
|
20
|
+
export const ArtifactContent = ({ className, ...props }) => (_jsx("div", { className: cn('flex-1 overflow-auto p-4', className), ...props }));
|
|
21
|
+
//# sourceMappingURL=artifact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact.js","sourceRoot":"","sources":["../../../src/components/ai-elements/artifact.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACzF,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAmB,KAAK,EAAE,MAAM,cAAc,CAAC;AAKtD,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAiB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,CAAC,yBAAyB,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CACvE,CAAC;AAQF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAC9B,OAAO,EACP,KAAK,EACL,IAAI,EAAE,IAAI,EACV,QAAQ,EACR,SAAS,EACT,IAAI,GAAG,IAAI,EACX,OAAO,GAAG,OAAO,EACjB,GAAG,KAAK,EACa,EAAE,EAAE;IACzB,MAAM,MAAM,GAAG,CACd,MAAC,MAAM,IACN,SAAS,EAAE,EAAE,CAAC,wDAAwD,EAAE,SAAS,CAAC,EAClF,IAAI,EAAE,IAAI,EACV,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,OAAO,KACZ,KAAK,aAER,IAAI,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,SAAS,EAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,QAAQ,EAC9C,eAAM,SAAS,EAAC,SAAS,YAAE,KAAK,IAAI,OAAO,GAAQ,IAC3C,CACT,CAAC;IAEF,IAAI,OAAO,EAAE,CAAC;QACb,OAAO,CACN,KAAC,eAAe,cACf,MAAC,OAAO,eACP,KAAC,cAAc,IAAC,OAAO,kBAAE,MAAM,GAAkB,EACjD,KAAC,cAAc,cACd,sBAAI,OAAO,GAAK,GACA,IACR,GACO,CAClB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC,CAAC;AAIF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAwB,EAAE,EAAE,CAAC,CACjF,cAAK,SAAS,EAAE,EAAE,CAAC,0BAA0B,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CACxE,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Button } from '../ui/button';
|
|
2
|
+
import type { UIMessage } from 'ai';
|
|
3
|
+
import type { ComponentProps, HTMLAttributes } from 'react';
|
|
4
|
+
export type BranchProps = HTMLAttributes<HTMLDivElement> & {
|
|
5
|
+
defaultBranch?: number;
|
|
6
|
+
onBranchChange?: (branchIndex: number) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const Branch: ({ defaultBranch, onBranchChange, className, ...props }: BranchProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export type BranchMessagesProps = HTMLAttributes<HTMLDivElement>;
|
|
10
|
+
export declare const BranchMessages: ({ children, ...props }: BranchMessagesProps) => import("react/jsx-runtime").JSX.Element[];
|
|
11
|
+
export type BranchSelectorProps = HTMLAttributes<HTMLDivElement> & {
|
|
12
|
+
from: UIMessage['role'];
|
|
13
|
+
};
|
|
14
|
+
export declare const BranchSelector: ({ className, from, ...props }: BranchSelectorProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
15
|
+
export type BranchPreviousProps = ComponentProps<typeof Button>;
|
|
16
|
+
export declare const BranchPrevious: ({ className, children, ...props }: BranchPreviousProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export type BranchNextProps = ComponentProps<typeof Button>;
|
|
18
|
+
export declare const BranchNext: ({ className, children, ...props }: BranchNextProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export type BranchPageProps = HTMLAttributes<HTMLSpanElement>;
|
|
20
|
+
export declare const BranchPage: ({ className, ...props }: BranchPageProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
//# sourceMappingURL=branch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/branch.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAEpC,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAgB,MAAM,OAAO,CAAC;AAwB1E,MAAM,MAAM,WAAW,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAC1D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,wDAA4D,WAAW,4CAiC7F,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEjE,eAAO,MAAM,cAAc,GAAI,wBAAwB,mBAAmB,8CAuBzE,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAClE,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,+BAA+B,mBAAmB,mDAkBhF,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC;AAEhE,eAAO,MAAM,cAAc,GAAI,mCAAmC,mBAAmB,4CAsBpF,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC;AAE5D,eAAO,MAAM,UAAU,GAAI,mCAAmC,eAAe,4CAsB5E,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,eAAe,CAAC,CAAC;AAE9D,eAAO,MAAM,UAAU,GAAI,yBAAyB,eAAe,4CAWlE,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button } from '../ui/button';
|
|
4
|
+
import { cn } from '../../lib/utils';
|
|
5
|
+
import { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';
|
|
6
|
+
import { createContext, useContext, useEffect, useState } from 'react';
|
|
7
|
+
const BranchContext = createContext(null);
|
|
8
|
+
const useBranch = () => {
|
|
9
|
+
const context = useContext(BranchContext);
|
|
10
|
+
if (!context) {
|
|
11
|
+
throw new Error('Branch components must be used within Branch');
|
|
12
|
+
}
|
|
13
|
+
return context;
|
|
14
|
+
};
|
|
15
|
+
export const Branch = ({ defaultBranch = 0, onBranchChange, className, ...props }) => {
|
|
16
|
+
const [currentBranch, setCurrentBranch] = useState(defaultBranch);
|
|
17
|
+
const [branches, setBranches] = useState([]);
|
|
18
|
+
const handleBranchChange = (newBranch) => {
|
|
19
|
+
setCurrentBranch(newBranch);
|
|
20
|
+
onBranchChange?.(newBranch);
|
|
21
|
+
};
|
|
22
|
+
const goToPrevious = () => {
|
|
23
|
+
const newBranch = currentBranch > 0 ? currentBranch - 1 : branches.length - 1;
|
|
24
|
+
handleBranchChange(newBranch);
|
|
25
|
+
};
|
|
26
|
+
const goToNext = () => {
|
|
27
|
+
const newBranch = currentBranch < branches.length - 1 ? currentBranch + 1 : 0;
|
|
28
|
+
handleBranchChange(newBranch);
|
|
29
|
+
};
|
|
30
|
+
const contextValue = {
|
|
31
|
+
currentBranch,
|
|
32
|
+
totalBranches: branches.length,
|
|
33
|
+
goToPrevious,
|
|
34
|
+
goToNext,
|
|
35
|
+
branches,
|
|
36
|
+
setBranches,
|
|
37
|
+
};
|
|
38
|
+
return (_jsx(BranchContext.Provider, { value: contextValue, children: _jsx("div", { className: cn('grid w-full gap-2 [&>div]:pb-0', className), ...props }) }));
|
|
39
|
+
};
|
|
40
|
+
export const BranchMessages = ({ children, ...props }) => {
|
|
41
|
+
const { currentBranch, setBranches, branches } = useBranch();
|
|
42
|
+
const childrenArray = Array.isArray(children) ? children : [children];
|
|
43
|
+
// Use useEffect to update branches when they change
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (branches.length !== childrenArray.length) {
|
|
46
|
+
setBranches(childrenArray);
|
|
47
|
+
}
|
|
48
|
+
}, [childrenArray, branches, setBranches]);
|
|
49
|
+
return childrenArray.map((branch, index) => (_jsx("div", { className: cn('grid gap-2 overflow-hidden [&>div]:pb-0', index === currentBranch ? 'block' : 'hidden'), ...props, children: branch }, branch.key)));
|
|
50
|
+
};
|
|
51
|
+
export const BranchSelector = ({ className, from, ...props }) => {
|
|
52
|
+
const { totalBranches } = useBranch();
|
|
53
|
+
// Don't render if there's only one branch
|
|
54
|
+
if (totalBranches <= 1) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
return (_jsx("div", { className: cn('flex items-center gap-2 self-end px-10', from === 'assistant' ? 'justify-start' : 'justify-end', className), ...props }));
|
|
58
|
+
};
|
|
59
|
+
export const BranchPrevious = ({ className, children, ...props }) => {
|
|
60
|
+
const { goToPrevious, totalBranches } = useBranch();
|
|
61
|
+
return (_jsx(Button, { "aria-label": "Previous branch", className: cn('size-7 shrink-0 rounded-full text-muted-foreground transition-colors', 'hover:bg-accent hover:text-foreground', 'disabled:pointer-events-none disabled:opacity-50', className), disabled: totalBranches <= 1, onClick: goToPrevious, size: "icon", type: "button", variant: "ghost", ...props, children: children ?? _jsx(ChevronLeftIcon, { size: 14 }) }));
|
|
62
|
+
};
|
|
63
|
+
export const BranchNext = ({ className, children, ...props }) => {
|
|
64
|
+
const { goToNext, totalBranches } = useBranch();
|
|
65
|
+
return (_jsx(Button, { "aria-label": "Next branch", className: cn('size-7 shrink-0 rounded-full text-muted-foreground transition-colors', 'hover:bg-accent hover:text-foreground', 'disabled:pointer-events-none disabled:opacity-50', className), disabled: totalBranches <= 1, onClick: goToNext, size: "icon", type: "button", variant: "ghost", ...props, children: children ?? _jsx(ChevronRightIcon, { size: 14 }) }));
|
|
66
|
+
};
|
|
67
|
+
export const BranchPage = ({ className, ...props }) => {
|
|
68
|
+
const { currentBranch, totalBranches } = useBranch();
|
|
69
|
+
return (_jsxs("span", { className: cn('font-medium text-muted-foreground text-xs tabular-nums', className), ...props, children: [currentBranch + 1, " of ", totalBranches] }));
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=branch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branch.js","sourceRoot":"","sources":["../../../src/components/ai-elements/branch.tsx"],"names":[],"mappings":"AAAA,YAAY,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,EAAE,aAAa,EAAE,GAAG,SAAS,EAAE,CAAC;IAEhD,OAAO,CACN,KAAC,MAAM,kBACK,aAAa,EACxB,SAAS,EAAE,EAAE,CACZ,sEAAsE,EACtE,uCAAuC,EACvC,kDAAkD,EAClD,SAAS,CACT,EACD,QAAQ,EAAE,aAAa,IAAI,CAAC,EAC5B,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAC,MAAM,EACX,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,OAAO,KACX,KAAK,YAER,QAAQ,IAAI,KAAC,gBAAgB,IAAC,IAAI,EAAE,EAAE,GAAI,GACnC,CACT,CAAC;AACH,CAAC,CAAC;AAIF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAmB,EAAE,EAAE;IACtE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,SAAS,EAAE,CAAC;IAErD,OAAO,CACN,gBACC,SAAS,EAAE,EAAE,CAAC,wDAAwD,EAAE,SAAS,CAAC,KAC9E,KAAK,aAER,aAAa,GAAG,CAAC,UAAM,aAAa,IAC/B,CACP,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactFlowProps } from '@xyflow/react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import '@xyflow/react/dist/style.css';
|
|
4
|
+
type CanvasProps = ReactFlowProps & {
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export declare const Canvas: ({ children, ...props }: CanvasProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=canvas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canvas.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/canvas.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,8BAA8B,CAAC;AAGtC,KAAK,WAAW,GAAG,cAAc,GAAG;IACnC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,wBAAwB,WAAW,4CAczD,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Background, ReactFlow } from '@xyflow/react';
|
|
3
|
+
import '@xyflow/react/dist/style.css';
|
|
4
|
+
import { Controls } from './controls';
|
|
5
|
+
export const Canvas = ({ children, ...props }) => (_jsxs(ReactFlow, { deleteKeyCode: ['Backspace', 'Delete'], fitView: true, panOnDrag: false, panOnScroll: true, selectionOnDrag: true, zoomOnDoubleClick: false, ...props, children: [_jsx(Background, { bgColor: "var(--sidebar)" }), _jsx(Controls, {}), children] }));
|
|
6
|
+
//# sourceMappingURL=canvas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canvas.js","sourceRoot":"","sources":["../../../src/components/ai-elements/canvas.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAuB,MAAM,eAAe,CAAC;AAE3E,OAAO,8BAA8B,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAMtC,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAe,EAAE,EAAE,CAAC,CAC9D,MAAC,SAAS,IACT,aAAa,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,EACtC,OAAO,QACP,SAAS,EAAE,KAAK,EAChB,WAAW,QACX,eAAe,EAAE,IAAI,EACrB,iBAAiB,EAAE,KAAK,KACpB,KAAK,aAET,KAAC,UAAU,IAAC,OAAO,EAAC,gBAAgB,GAAG,EACvC,KAAC,QAAQ,KAAG,EACX,QAAQ,IACE,CACZ,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Badge } from '../ui/badge';
|
|
2
|
+
import { CollapsibleContent, CollapsibleTrigger } from '../ui/collapsible';
|
|
3
|
+
import { type LucideIcon } from 'lucide-react';
|
|
4
|
+
import type { ComponentProps } from 'react';
|
|
5
|
+
export type ChainOfThoughtProps = ComponentProps<'div'> & {
|
|
6
|
+
open?: boolean;
|
|
7
|
+
defaultOpen?: boolean;
|
|
8
|
+
onOpenChange?: (open: boolean) => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const ChainOfThought: import("react").MemoExoticComponent<({ className, open, defaultOpen, onOpenChange, children, ...props }: ChainOfThoughtProps) => import("react/jsx-runtime").JSX.Element>;
|
|
11
|
+
export type ChainOfThoughtHeaderProps = ComponentProps<typeof CollapsibleTrigger>;
|
|
12
|
+
export declare const ChainOfThoughtHeader: import("react").MemoExoticComponent<({ className, children, ...props }: ChainOfThoughtHeaderProps) => import("react/jsx-runtime").JSX.Element>;
|
|
13
|
+
export type ChainOfThoughtStepProps = ComponentProps<'div'> & {
|
|
14
|
+
icon?: LucideIcon;
|
|
15
|
+
label: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
status?: 'complete' | 'active' | 'pending';
|
|
18
|
+
};
|
|
19
|
+
export declare const ChainOfThoughtStep: import("react").MemoExoticComponent<({ className, icon: Icon, label, description, status, children, ...props }: ChainOfThoughtStepProps) => import("react/jsx-runtime").JSX.Element>;
|
|
20
|
+
export type ChainOfThoughtSearchResultsProps = ComponentProps<'div'>;
|
|
21
|
+
export declare const ChainOfThoughtSearchResults: import("react").MemoExoticComponent<({ className, ...props }: ChainOfThoughtSearchResultsProps) => import("react/jsx-runtime").JSX.Element>;
|
|
22
|
+
export type ChainOfThoughtSearchResultProps = ComponentProps<typeof Badge>;
|
|
23
|
+
export declare const ChainOfThoughtSearchResult: import("react").MemoExoticComponent<({ className, children, ...props }: ChainOfThoughtSearchResultProps) => import("react/jsx-runtime").JSX.Element>;
|
|
24
|
+
export type ChainOfThoughtContentProps = ComponentProps<typeof CollapsibleContent>;
|
|
25
|
+
export declare const ChainOfThoughtContent: import("react").MemoExoticComponent<({ className, children, ...props }: ChainOfThoughtContentProps) => import("react/jsx-runtime").JSX.Element>;
|
|
26
|
+
export type ChainOfThoughtImageProps = ComponentProps<'div'> & {
|
|
27
|
+
caption?: string;
|
|
28
|
+
};
|
|
29
|
+
export declare const ChainOfThoughtImage: import("react").MemoExoticComponent<({ className, children, caption, ...props }: ChainOfThoughtImageProps) => import("react/jsx-runtime").JSX.Element>;
|
|
30
|
+
//# sourceMappingURL=chain-of-thought.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain-of-thought.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/chain-of-thought.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAe,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAExF,OAAO,EAAuC,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AACpF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAkB5C,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACzD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACvC,CAAC;AAEF,eAAO,MAAM,cAAc,2GAQvB,mBAAmB,6CAiBtB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,cAAc,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAElF,eAAO,MAAM,oBAAoB,0EACI,yBAAyB,6CAqB7D,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IAC7D,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;CAC3C,CAAC;AAEF,eAAO,MAAM,kBAAkB,kHAS3B,uBAAuB,6CA6B1B,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAErE,eAAO,MAAM,2BAA2B,gEACb,gCAAgC,6CAG1D,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG,cAAc,CAAC,OAAO,KAAK,CAAC,CAAC;AAE3E,eAAO,MAAM,0BAA0B,0EACF,+BAA+B,6CASnE,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,cAAc,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEnF,eAAO,MAAM,qBAAqB,0EACG,0BAA0B,6CAkB9D,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,mBAAmB,mFACc,wBAAwB,6CAQrE,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useControllableState } from '@radix-ui/react-use-controllable-state';
|
|
4
|
+
import { Badge } from '../ui/badge';
|
|
5
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '../ui/collapsible';
|
|
6
|
+
import { cn } from '../../lib/utils';
|
|
7
|
+
import { BrainIcon, ChevronDownIcon, DotIcon } from 'lucide-react';
|
|
8
|
+
import { createContext, memo, useContext, useMemo } from 'react';
|
|
9
|
+
const ChainOfThoughtContext = createContext(null);
|
|
10
|
+
const useChainOfThought = () => {
|
|
11
|
+
const context = useContext(ChainOfThoughtContext);
|
|
12
|
+
if (!context) {
|
|
13
|
+
throw new Error('ChainOfThought components must be used within ChainOfThought');
|
|
14
|
+
}
|
|
15
|
+
return context;
|
|
16
|
+
};
|
|
17
|
+
export const ChainOfThought = memo(({ className, open, defaultOpen = false, onOpenChange, children, ...props }) => {
|
|
18
|
+
const [isOpen, setIsOpen] = useControllableState({
|
|
19
|
+
prop: open,
|
|
20
|
+
defaultProp: defaultOpen,
|
|
21
|
+
onChange: onOpenChange,
|
|
22
|
+
});
|
|
23
|
+
const chainOfThoughtContext = useMemo(() => ({ isOpen, setIsOpen }), [isOpen, setIsOpen]);
|
|
24
|
+
return (_jsx(ChainOfThoughtContext.Provider, { value: chainOfThoughtContext, children: _jsx("div", { className: cn('not-prose max-w-prose space-y-4', className), ...props, children: children }) }));
|
|
25
|
+
});
|
|
26
|
+
export const ChainOfThoughtHeader = memo(({ className, children, ...props }) => {
|
|
27
|
+
const { isOpen, setIsOpen } = useChainOfThought();
|
|
28
|
+
return (_jsx(Collapsible, { onOpenChange: setIsOpen, open: isOpen, children: _jsxs(CollapsibleTrigger, { className: cn('flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground', className), ...props, children: [_jsx(BrainIcon, { className: "size-4" }), _jsx("span", { className: "flex-1 text-left", children: children ?? 'Chain of Thought' }), _jsx(ChevronDownIcon, { className: cn('size-4 transition-transform', isOpen ? 'rotate-180' : 'rotate-0') })] }) }));
|
|
29
|
+
});
|
|
30
|
+
export const ChainOfThoughtStep = memo(({ className, icon: Icon = DotIcon, label, description, status = 'complete', children, ...props }) => {
|
|
31
|
+
const statusStyles = {
|
|
32
|
+
complete: 'text-muted-foreground',
|
|
33
|
+
active: 'text-foreground',
|
|
34
|
+
pending: 'text-muted-foreground/50',
|
|
35
|
+
};
|
|
36
|
+
return (_jsxs("div", { className: cn('flex gap-2 text-sm', statusStyles[status], 'fade-in-0 slide-in-from-top-2 animate-in', className), ...props, children: [_jsxs("div", { className: "relative mt-0.5", children: [_jsx(Icon, { className: "size-4" }), _jsx("div", { className: "-mx-px absolute top-7 bottom-0 left-1/2 w-px bg-border" })] }), _jsxs("div", { className: "flex-1 space-y-2", children: [_jsx("div", { children: label }), description && _jsx("div", { className: "text-muted-foreground text-xs", children: description }), children] })] }));
|
|
37
|
+
});
|
|
38
|
+
export const ChainOfThoughtSearchResults = memo(({ className, ...props }) => (_jsx("div", { className: cn('flex items-center gap-2', className), ...props })));
|
|
39
|
+
export const ChainOfThoughtSearchResult = memo(({ className, children, ...props }) => (_jsx(Badge, { className: cn('gap-1 px-2 py-0.5 font-normal text-xs', className), variant: "secondary", ...props, children: children })));
|
|
40
|
+
export const ChainOfThoughtContent = memo(({ className, children, ...props }) => {
|
|
41
|
+
const { isOpen } = useChainOfThought();
|
|
42
|
+
return (_jsx(Collapsible, { open: isOpen, children: _jsx(CollapsibleContent, { className: cn('mt-2 space-y-3', 'data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in', className), ...props, children: children }) }));
|
|
43
|
+
});
|
|
44
|
+
export const ChainOfThoughtImage = memo(({ className, children, caption, ...props }) => (_jsxs("div", { className: cn('mt-2 space-y-2', className), ...props, children: [_jsx("div", { className: "relative flex max-h-[22rem] items-center justify-center overflow-hidden rounded-lg bg-muted p-3", children: children }), caption && _jsx("p", { className: "text-muted-foreground text-xs", children: caption })] })));
|
|
45
|
+
ChainOfThought.displayName = 'ChainOfThought';
|
|
46
|
+
ChainOfThoughtHeader.displayName = 'ChainOfThoughtHeader';
|
|
47
|
+
ChainOfThoughtStep.displayName = 'ChainOfThoughtStep';
|
|
48
|
+
ChainOfThoughtSearchResults.displayName = 'ChainOfThoughtSearchResults';
|
|
49
|
+
ChainOfThoughtSearchResult.displayName = 'ChainOfThoughtSearchResult';
|
|
50
|
+
ChainOfThoughtContent.displayName = 'ChainOfThoughtContent';
|
|
51
|
+
ChainOfThoughtImage.displayName = 'ChainOfThoughtImage';
|
|
52
|
+
//# sourceMappingURL=chain-of-thought.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain-of-thought.js","sourceRoot":"","sources":["../../../src/components/ai-elements/chain-of-thought.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACxF,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAmB,MAAM,cAAc,CAAC;AAEpF,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAOjE,MAAM,qBAAqB,GAAG,aAAa,CAAoC,IAAI,CAAC,CAAC;AAErF,MAAM,iBAAiB,GAAG,GAAG,EAAE;IAC9B,MAAM,OAAO,GAAG,UAAU,CAAC,qBAAqB,CAAC,CAAC;IAClD,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;IACjF,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC;AAQF,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CACjC,CAAC,EACA,SAAS,EACT,IAAI,EACJ,WAAW,GAAG,KAAK,EACnB,YAAY,EACZ,QAAQ,EACR,GAAG,KAAK,EACa,EAAE,EAAE;IACzB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,oBAAoB,CAAC;QAChD,IAAI,EAAE,IAAI;QACV,WAAW,EAAE,WAAW;QACxB,QAAQ,EAAE,YAAY;KACtB,CAAC,CAAC;IAEH,MAAM,qBAAqB,GAAG,OAAO,CAAC,G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B,EAChB,+MAA+M,EAC/M,SAAS,CACT,KACG,KAAK,YAER,QAAQ,GACW,GACR,CACd,CAAC;AACH,CAAC,CACD,CAAC;AAMF,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CACtC,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK,EAA4B,EAAE,EAAE,CAAC,CACzE,eAAK,SAAS,EAAE,EAAE,CAAC,gBAAgB,EAAE,SAAS,CAAC,KAAM,KAAK,aACzD,cAAK,SAAS,EAAC,iGAAiG,YAC9G,QAAQ,GACJ,EACL,OAAO,IAAI,YAAG,SAAS,EAAC,+BAA+B,YAAE,OAAO,GAAK,IACjE,CACN,CACD,CAAC;AAEF,cAAc,CAAC,WAAW,GAAG,gBAAgB,CAAC;AAC9C,oBAAoB,CAAC,WAAW,GAAG,sBAAsB,CAAC;AAC1D,kBAAkB,CAAC,WAAW,GAAG,oBAAoB,CAAC;AACtD,2BAA2B,CAAC,WAAW,GAAG,6BAA6B,CAAC;AACxE,0BAA0B,CAAC,WAAW,GAAG,4BAA4B,CAAC;AACtE,qBAAqB,CAAC,WAAW,GAAG,uBAAuB,CAAC;AAC5D,mBAAmB,CAAC,WAAW,GAAG,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Button } from '../ui/button';
|
|
2
|
+
import { type ComponentProps, type HTMLAttributes } from 'react';
|
|
3
|
+
import { type BundledLanguage } from 'shiki';
|
|
4
|
+
type CodeBlockProps = HTMLAttributes<HTMLDivElement> & {
|
|
5
|
+
code: string;
|
|
6
|
+
language: BundledLanguage;
|
|
7
|
+
showLineNumbers?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare function highlightCode(code: string, language: BundledLanguage, showLineNumbers?: boolean): Promise<[string, string]>;
|
|
10
|
+
export declare const CodeBlock: ({ code, language, showLineNumbers, className, children, ...props }: CodeBlockProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export type CodeBlockCopyButtonProps = ComponentProps<typeof Button> & {
|
|
12
|
+
onCopy?: () => void;
|
|
13
|
+
onError?: (error: Error) => void;
|
|
14
|
+
timeout?: number;
|
|
15
|
+
};
|
|
16
|
+
export declare const CodeBlockCopyButton: ({ onCopy, onError, timeout, children, className, ...props }: CodeBlockCopyButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=code-block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-block.d.ts","sourceRoot":"","sources":["../../../src/components/ai-elements/code-block.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAItC,OAAO,EACN,KAAK,cAAc,EAEnB,KAAK,cAAc,EAKnB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,KAAK,eAAe,EAAqC,MAAM,OAAO,CAAC;AAEhF,KAAK,cAAc,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,eAAe,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AA+BF,wBAAsB,aAAa,CAClC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,eAAe,EACzB,eAAe,UAAQ,6BAgBvB;AAED,eAAO,MAAM,SAAS,GAAI,oEAOvB,cAAc,4CA8ChB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,cAAc,CAAC,OAAO,MAAM,CAAC,GAAG;IACtE,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,6DAOjC,wBAAwB,4CAiC1B,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button } from '../ui/button';
|
|
4
|
+
import { cn } from '../../lib/utils';
|
|
5
|
+
import { CheckIcon, CopyIcon } from 'lucide-react';
|
|
6
|
+
import { createContext, useContext, useEffect, useRef, useState, } from 'react';
|
|
7
|
+
import { codeToHtml } from 'shiki';
|
|
8
|
+
const CodeBlockContext = createContext({
|
|
9
|
+
code: '',
|
|
10
|
+
});
|
|
11
|
+
const lineNumberTransformer = {
|
|
12
|
+
name: 'line-numbers',
|
|
13
|
+
line(node, line) {
|
|
14
|
+
node.children.unshift({
|
|
15
|
+
type: 'element',
|
|
16
|
+
tagName: 'span',
|
|
17
|
+
properties: {
|
|
18
|
+
className: [
|
|
19
|
+
'inline-block',
|
|
20
|
+
'min-w-10',
|
|
21
|
+
'mr-4',
|
|
22
|
+
'text-right',
|
|
23
|
+
'select-none',
|
|
24
|
+
'text-muted-foreground',
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
children: [{ type: 'text', value: String(line) }],
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
export async function highlightCode(code, language, showLineNumbers = false) {
|
|
32
|
+
const transformers = showLineNumbers ? [lineNumberTransformer] : [];
|
|
33
|
+
return await Promise.all([
|
|
34
|
+
codeToHtml(code, {
|
|
35
|
+
lang: language,
|
|
36
|
+
theme: 'one-light',
|
|
37
|
+
transformers,
|
|
38
|
+
}),
|
|
39
|
+
codeToHtml(code, {
|
|
40
|
+
lang: language,
|
|
41
|
+
theme: 'one-dark-pro',
|
|
42
|
+
transformers,
|
|
43
|
+
}),
|
|
44
|
+
]);
|
|
45
|
+
}
|
|
46
|
+
export const CodeBlock = ({ code, language, showLineNumbers = false, className, children, ...props }) => {
|
|
47
|
+
const [html, setHtml] = useState('');
|
|
48
|
+
const [darkHtml, setDarkHtml] = useState('');
|
|
49
|
+
const mounted = useRef(false);
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
highlightCode(code, language, showLineNumbers).then(([light, dark]) => {
|
|
52
|
+
if (!mounted.current) {
|
|
53
|
+
setHtml(light);
|
|
54
|
+
setDarkHtml(dark);
|
|
55
|
+
mounted.current = true;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return () => {
|
|
59
|
+
mounted.current = false;
|
|
60
|
+
};
|
|
61
|
+
}, [code, language, showLineNumbers]);
|
|
62
|
+
return (_jsx(CodeBlockContext.Provider, { value: { code }, children: _jsx("div", { className: cn('group relative w-full overflow-hidden rounded-md border bg-background text-foreground', className), ...props, children: _jsxs("div", { className: "relative", children: [_jsx("div", { className: "overflow-hidden dark:hidden [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm",
|
|
63
|
+
// biome-ignore lint/security/noDangerouslySetInnerHtml: "this is needed."
|
|
64
|
+
dangerouslySetInnerHTML: { __html: html } }), _jsx("div", { className: "hidden overflow-hidden dark:block [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm",
|
|
65
|
+
// biome-ignore lint/security/noDangerouslySetInnerHtml: "this is needed."
|
|
66
|
+
dangerouslySetInnerHTML: { __html: darkHtml } }), children && (_jsx("div", { className: "absolute top-2 right-2 flex items-center gap-2", children: children }))] }) }) }));
|
|
67
|
+
};
|
|
68
|
+
export const CodeBlockCopyButton = ({ onCopy, onError, timeout = 2000, children, className, ...props }) => {
|
|
69
|
+
const [isCopied, setIsCopied] = useState(false);
|
|
70
|
+
const { code } = useContext(CodeBlockContext);
|
|
71
|
+
const copyToClipboard = async () => {
|
|
72
|
+
if (typeof window === 'undefined' || !navigator?.clipboard?.writeText) {
|
|
73
|
+
onError?.(new Error('Clipboard API not available'));
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
await navigator.clipboard.writeText(code);
|
|
78
|
+
setIsCopied(true);
|
|
79
|
+
onCopy?.();
|
|
80
|
+
setTimeout(() => setIsCopied(false), timeout);
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
onError?.(error);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
const Icon = isCopied ? CheckIcon : CopyIcon;
|
|
87
|
+
return (_jsx(Button, { className: cn('shrink-0', className), onClick: copyToClipboard, size: "icon", variant: "ghost", ...props, children: children ?? _jsx(Icon, { size: 14 }) }));
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=code-block.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-block.js","sourceRoot":"","sources":["../../../src/components/ai-elements/code-block.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAEN,aAAa,EAEb,UAAU,EACV,SAAS,EACT,MAAM,EACN,QAAQ,GACR,MAAM,OAAO,CAAC;AACf,OAAO,EAAwB,UAAU,EAAyB,MAAM,OAAO,CAAC;AAYhF,MAAM,gBAAgB,GAAG,aAAa,CAAuB;IAC5D,IAAI,EAAE,EAAE;CACR,CAAC,CAAC;AAEH,MAAM,qBAAqB,GAAqB;IAC/C,IAAI,EAAE,cAAc;IACpB,IAAI,CAAC,IAAa,EAAE,IAAY;QAC/B,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;YACrB,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,MAAM;YACf,UAAU,EAAE;gBACX,SAAS,EAAE;oBACV,cAAc;oBACd,UAAU;oBACV,MAAM;oBACN,YAAY;oBACZ,aAAa;oBACb,uBAAuB;iBACvB;aACD;YACD,QAAQ,EAAE,CAAC,EAAE,IAAI,EA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