@datalayer/agent-runtimes 0.0.2
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/LICENSE +32 -0
- package/README.md +56 -0
- package/lib/App.css +47 -0
- package/lib/App.d.ts +3 -0
- package/lib/App.js +18 -0
- package/lib/components/chat/components/AgentDetails.d.ts +19 -0
- package/lib/components/chat/components/AgentDetails.js +170 -0
- package/lib/components/chat/components/Chat.d.ts +105 -0
- package/lib/components/chat/components/Chat.js +275 -0
- package/lib/components/chat/components/ChatFloating.d.ts +146 -0
- package/lib/components/chat/components/ChatFloating.js +381 -0
- package/lib/components/chat/components/ChatInline.d.ts +42 -0
- package/lib/components/chat/components/ChatInline.js +327 -0
- package/lib/components/chat/components/ChatPopupStandalone.d.ts +110 -0
- package/lib/components/chat/components/ChatPopupStandalone.js +422 -0
- package/lib/components/chat/components/ChatSidebar.d.ts +78 -0
- package/lib/components/chat/components/ChatSidebar.js +224 -0
- package/lib/components/chat/components/ChatStandalone.d.ts +105 -0
- package/lib/components/chat/components/ChatStandalone.js +320 -0
- package/lib/components/chat/components/base/ChatBase.d.ts +285 -0
- package/lib/components/chat/components/base/ChatBase.js +1192 -0
- package/lib/components/chat/components/display/ToolCallDisplay.d.ts +26 -0
- package/lib/components/chat/components/display/ToolCallDisplay.js +225 -0
- package/lib/components/chat/components/display/index.d.ts +6 -0
- package/lib/components/chat/components/display/index.js +10 -0
- package/lib/components/chat/components/elements/ChatHeader.d.ts +43 -0
- package/lib/components/chat/components/elements/ChatHeader.js +67 -0
- package/lib/components/chat/components/elements/ChatInputPrompt.d.ts +26 -0
- package/lib/components/chat/components/elements/ChatInputPrompt.js +145 -0
- package/lib/components/chat/components/elements/ChatMessages.d.ts +36 -0
- package/lib/components/chat/components/elements/ChatMessages.js +195 -0
- package/lib/components/chat/components/elements/FloatingBrandButton.d.ts +34 -0
- package/lib/components/chat/components/elements/FloatingBrandButton.js +88 -0
- package/lib/components/chat/components/elements/MessagePart.d.ts +50 -0
- package/lib/components/chat/components/elements/MessagePart.js +48 -0
- package/lib/components/chat/components/elements/PoweredByTag.d.ts +26 -0
- package/lib/components/chat/components/elements/PoweredByTag.js +33 -0
- package/lib/components/chat/components/elements/ToolApprovalDialog.d.ts +42 -0
- package/lib/components/chat/components/elements/ToolApprovalDialog.js +96 -0
- package/lib/components/chat/components/index.d.ts +21 -0
- package/lib/components/chat/components/index.js +34 -0
- package/lib/components/chat/components/parts/DynamicToolPart.d.ts +20 -0
- package/lib/components/chat/components/parts/DynamicToolPart.js +13 -0
- package/lib/components/chat/components/parts/ReasoningPart.d.ts +17 -0
- package/lib/components/chat/components/parts/ReasoningPart.js +69 -0
- package/lib/components/chat/components/parts/TextPart.d.ts +28 -0
- package/lib/components/chat/components/parts/TextPart.js +103 -0
- package/lib/components/chat/components/parts/ToolPart.d.ts +17 -0
- package/lib/components/chat/components/parts/ToolPart.js +163 -0
- package/lib/components/chat/components/parts/index.d.ts +9 -0
- package/lib/components/chat/components/parts/index.js +13 -0
- package/lib/components/chat/extensions/A2UIExtension.d.ts +87 -0
- package/lib/components/chat/extensions/A2UIExtension.js +312 -0
- package/lib/components/chat/extensions/ExtensionRegistry.d.ts +66 -0
- package/lib/components/chat/extensions/ExtensionRegistry.js +128 -0
- package/lib/components/chat/extensions/MCPUIExtension.d.ts +77 -0
- package/lib/components/chat/extensions/MCPUIExtension.js +212 -0
- package/lib/components/chat/extensions/index.d.ts +9 -0
- package/lib/components/chat/extensions/index.js +12 -0
- package/lib/components/chat/handler.d.ts +20 -0
- package/lib/components/chat/handler.js +56 -0
- package/lib/components/chat/index.d.ts +61 -0
- package/lib/components/chat/index.js +76 -0
- package/lib/components/chat/inference/BaseInferenceProvider.d.ts +57 -0
- package/lib/components/chat/inference/BaseInferenceProvider.js +69 -0
- package/lib/components/chat/inference/DatalayerInferenceProvider.d.ts +83 -0
- package/lib/components/chat/inference/DatalayerInferenceProvider.js +305 -0
- package/lib/components/chat/inference/SelfHostedInferenceProvider.d.ts +54 -0
- package/lib/components/chat/inference/SelfHostedInferenceProvider.js +246 -0
- package/lib/components/chat/inference/index.d.ts +9 -0
- package/lib/components/chat/inference/index.js +12 -0
- package/lib/components/chat/middleware/MiddlewarePipeline.d.ts +118 -0
- package/lib/components/chat/middleware/MiddlewarePipeline.js +255 -0
- package/lib/components/chat/middleware/index.d.ts +7 -0
- package/lib/components/chat/middleware/index.js +10 -0
- package/lib/components/chat/protocols/A2AAdapter.d.ts +79 -0
- package/lib/components/chat/protocols/A2AAdapter.js +388 -0
- package/lib/components/chat/protocols/ACPAdapter.d.ts +161 -0
- package/lib/components/chat/protocols/ACPAdapter.js +504 -0
- package/lib/components/chat/protocols/AGUIAdapter.d.ts +82 -0
- package/lib/components/chat/protocols/AGUIAdapter.js +518 -0
- package/lib/components/chat/protocols/BaseProtocolAdapter.d.ts +75 -0
- package/lib/components/chat/protocols/BaseProtocolAdapter.js +119 -0
- package/lib/components/chat/protocols/VercelAIAdapter.d.ts +77 -0
- package/lib/components/chat/protocols/VercelAIAdapter.js +252 -0
- package/lib/components/chat/protocols/index.d.ts +11 -0
- package/lib/components/chat/protocols/index.js +14 -0
- package/lib/components/chat/store/chatStore.d.ts +158 -0
- package/lib/components/chat/store/chatStore.js +313 -0
- package/lib/components/chat/store/index.d.ts +6 -0
- package/lib/components/chat/store/index.js +10 -0
- package/lib/components/chat/tools/ToolExecutor.d.ts +49 -0
- package/lib/components/chat/tools/ToolExecutor.js +151 -0
- package/lib/components/chat/tools/index.d.ts +8 -0
- package/lib/components/chat/tools/index.js +11 -0
- package/lib/components/chat/types/extension.d.ts +181 -0
- package/lib/components/chat/types/extension.js +46 -0
- package/lib/components/chat/types/index.d.ts +11 -0
- package/lib/components/chat/types/index.js +16 -0
- package/lib/components/chat/types/inference.d.ts +117 -0
- package/lib/components/chat/types/inference.js +5 -0
- package/lib/components/chat/types/message.d.ts +117 -0
- package/lib/components/chat/types/message.js +50 -0
- package/lib/components/chat/types/middleware.d.ts +153 -0
- package/lib/components/chat/types/middleware.js +32 -0
- package/lib/components/chat/types/protocol.d.ts +209 -0
- package/lib/components/chat/types/protocol.js +5 -0
- package/lib/components/chat/types/tool.d.ts +140 -0
- package/lib/components/chat/types/tool.js +23 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +6 -0
- package/lib/components/sparklines/Sparklines.d.ts +16 -0
- package/lib/components/sparklines/Sparklines.js +65 -0
- package/lib/components/sparklines/SparklinesLine.d.ts +8 -0
- package/lib/components/sparklines/SparklinesLine.js +37 -0
- package/lib/components/sparklines/dataProcessing.d.ts +25 -0
- package/lib/components/sparklines/dataProcessing.js +35 -0
- package/lib/components/sparklines/index.d.ts +4 -0
- package/lib/components/sparklines/index.js +7 -0
- package/lib/components/sparklines/types.d.ts +36 -0
- package/lib/components/sparklines/types.js +5 -0
- package/lib/components/ui/accordion.d.ts +7 -0
- package/lib/components/ui/accordion.js +22 -0
- package/lib/components/ui/alert-dialog.d.ts +14 -0
- package/lib/components/ui/alert-dialog.js +43 -0
- package/lib/components/ui/alert.d.ts +9 -0
- package/lib/components/ui/alert.js +24 -0
- package/lib/components/ui/aspect-ratio.d.ts +3 -0
- package/lib/components/ui/aspect-ratio.js +11 -0
- package/lib/components/ui/avatar.d.ts +6 -0
- package/lib/components/ui/avatar.js +18 -0
- package/lib/components/ui/badge.d.ts +9 -0
- package/lib/components/ui/badge.js +22 -0
- package/lib/components/ui/breadcrumb.d.ts +11 -0
- package/lib/components/ui/breadcrumb.js +27 -0
- package/lib/components/ui/button-group.d.ts +11 -0
- package/lib/components/ui/button-group.js +31 -0
- package/lib/components/ui/button.d.ts +13 -0
- package/lib/components/ui/button.js +39 -0
- package/lib/components/ui/calendar.d.ts +8 -0
- package/lib/components/ui/calendar.js +80 -0
- package/lib/components/ui/card.d.ts +9 -0
- package/lib/components/ui/card.js +24 -0
- package/lib/components/ui/carousel.d.ts +19 -0
- package/lib/components/ui/carousel.js +95 -0
- package/lib/components/ui/chart.d.ts +53 -0
- package/lib/components/ui/chart.js +136 -0
- package/lib/components/ui/checkbox.d.ts +4 -0
- package/lib/components/ui/checkbox.js +13 -0
- package/lib/components/ui/collapsible.d.ts +5 -0
- package/lib/components/ui/collapsible.js +17 -0
- package/lib/components/ui/command.d.ts +18 -0
- package/lib/components/ui/command.js +38 -0
- package/lib/components/ui/context-menu.d.ts +25 -0
- package/lib/components/ui/context-menu.js +55 -0
- package/lib/components/ui/dialog.d.ts +15 -0
- package/lib/components/ui/dialog.js +40 -0
- package/lib/components/ui/drawer.d.ts +13 -0
- package/lib/components/ui/drawer.js +39 -0
- package/lib/components/ui/dropdown-menu.d.ts +25 -0
- package/lib/components/ui/dropdown-menu.js +55 -0
- package/lib/components/ui/empty.d.ts +11 -0
- package/lib/components/ui/empty.js +37 -0
- package/lib/components/ui/field.d.ts +24 -0
- package/lib/components/ui/field.js +80 -0
- package/lib/components/ui/form.d.ts +24 -0
- package/lib/components/ui/form.js +63 -0
- package/lib/components/ui/hover-card.d.ts +6 -0
- package/lib/components/ui/hover-card.js +18 -0
- package/lib/components/ui/input-group.d.ts +19 -0
- package/lib/components/ui/input-group.js +69 -0
- package/lib/components/ui/input-otp.d.ts +11 -0
- package/lib/components/ui/input-otp.js +25 -0
- package/lib/components/ui/input.d.ts +3 -0
- package/lib/components/ui/input.js +6 -0
- package/lib/components/ui/item.d.ts +23 -0
- package/lib/components/ui/item.js +66 -0
- package/lib/components/ui/kbd.d.ts +3 -0
- package/lib/components/ui/kbd.js +13 -0
- package/lib/components/ui/label.d.ts +4 -0
- package/lib/components/ui/label.js +12 -0
- package/lib/components/ui/menubar.d.ts +26 -0
- package/lib/components/ui/menubar.js +58 -0
- package/lib/components/ui/navigation-menu.d.ts +14 -0
- package/lib/components/ui/navigation-menu.js +31 -0
- package/lib/components/ui/pagination.d.ts +13 -0
- package/lib/components/ui/pagination.js +29 -0
- package/lib/components/ui/popover.d.ts +7 -0
- package/lib/components/ui/popover.js +21 -0
- package/lib/components/ui/progress.d.ts +4 -0
- package/lib/components/ui/progress.js +12 -0
- package/lib/components/ui/radio-group.d.ts +5 -0
- package/lib/components/ui/radio-group.js +16 -0
- package/lib/components/ui/resizable.d.ts +8 -0
- package/lib/components/ui/resizable.js +19 -0
- package/lib/components/ui/scroll-area.d.ts +5 -0
- package/lib/components/ui/scroll-area.js +17 -0
- package/lib/components/ui/select.d.ts +15 -0
- package/lib/components/ui/select.js +42 -0
- package/lib/components/ui/separator.d.ts +4 -0
- package/lib/components/ui/separator.js +12 -0
- package/lib/components/ui/sheet.d.ts +13 -0
- package/lib/components/ui/sheet.js +44 -0
- package/lib/components/ui/sidebar.d.ts +69 -0
- package/lib/components/ui/sidebar.js +216 -0
- package/lib/components/ui/skeleton.d.ts +2 -0
- package/lib/components/ui/skeleton.js +10 -0
- package/lib/components/ui/slider.d.ts +4 -0
- package/lib/components/ui/slider.js +18 -0
- package/lib/components/ui/sonner.d.ts +3 -0
- package/lib/components/ui/sonner.js +25 -0
- package/lib/components/ui/spinner.d.ts +2 -0
- package/lib/components/ui/spinner.js +11 -0
- package/lib/components/ui/switch.d.ts +4 -0
- package/lib/components/ui/switch.js +12 -0
- package/lib/components/ui/table.d.ts +10 -0
- package/lib/components/ui/table.js +32 -0
- package/lib/components/ui/tabs.d.ts +7 -0
- package/lib/components/ui/tabs.js +21 -0
- package/lib/components/ui/textarea.d.ts +3 -0
- package/lib/components/ui/textarea.js +6 -0
- package/lib/components/ui/toast.d.ts +15 -0
- package/lib/components/ui/toast.js +38 -0
- package/lib/components/ui/toaster.d.ts +1 -0
- package/lib/components/ui/toaster.js +14 -0
- package/lib/components/ui/toggle-group.d.ts +9 -0
- package/lib/components/ui/toggle-group.js +26 -0
- package/lib/components/ui/toggle.d.ts +9 -0
- package/lib/components/ui/toggle.js +30 -0
- package/lib/components/ui/tooltip.d.ts +7 -0
- package/lib/components/ui/tooltip.js +21 -0
- package/lib/components/vercel-ai-elements/artifact.d.ts +23 -0
- package/lib/components/vercel-ai-elements/artifact.js +24 -0
- package/lib/components/vercel-ai-elements/code-block.d.ts +17 -0
- package/lib/components/vercel-ai-elements/code-block.js +94 -0
- package/lib/components/vercel-ai-elements/conversation.d.ts +15 -0
- package/lib/components/vercel-ai-elements/conversation.js +21 -0
- package/lib/components/vercel-ai-elements/loader.d.ts +5 -0
- package/lib/components/vercel-ai-elements/loader.js +8 -0
- package/lib/components/vercel-ai-elements/message.d.ts +46 -0
- package/lib/components/vercel-ai-elements/message.js +109 -0
- package/lib/components/vercel-ai-elements/model-selector.d.ts +35 -0
- package/lib/components/vercel-ai-elements/model-selector.js +22 -0
- package/lib/components/vercel-ai-elements/prompt-input.d.ts +195 -0
- package/lib/components/vercel-ai-elements/prompt-input.js +589 -0
- package/lib/components/vercel-ai-elements/reasoning.d.ts +26 -0
- package/lib/components/vercel-ai-elements/reasoning.js +80 -0
- package/lib/components/vercel-ai-elements/shimmer.d.ts +9 -0
- package/lib/components/vercel-ai-elements/shimmer.js +22 -0
- package/lib/components/vercel-ai-elements/sources.d.ts +12 -0
- package/lib/components/vercel-ai-elements/sources.js +13 -0
- package/lib/components/vercel-ai-elements/suggestion.d.ts +10 -0
- package/lib/components/vercel-ai-elements/suggestion.js +16 -0
- package/lib/components/vercel-ai-elements/tool.d.ts +23 -0
- package/lib/components/vercel-ai-elements/tool.js +52 -0
- package/lib/examples/A2UiRestaurantExample.d.ts +25 -0
- package/lib/examples/A2UiRestaurantExample.js +305 -0
- package/lib/examples/AgUiAgenticExample.d.ts +25 -0
- package/lib/examples/AgUiAgenticExample.js +63 -0
- package/lib/examples/AgUiBackendToolRenderingExample.d.ts +30 -0
- package/lib/examples/AgUiBackendToolRenderingExample.js +103 -0
- package/lib/examples/AgUiHaikuGenUIExample.d.ts +44 -0
- package/lib/examples/AgUiHaikuGenUIExample.js +151 -0
- package/lib/examples/AgUiHumanInTheLoopExample.d.ts +26 -0
- package/lib/examples/AgUiHumanInTheLoopExample.js +220 -0
- package/lib/examples/AgUiSharedStateExample.d.ts +25 -0
- package/lib/examples/AgUiSharedStateExample.js +181 -0
- package/lib/examples/AgUiToolsBasedGenUIExample.d.ts +25 -0
- package/lib/examples/AgUiToolsBasedGenUIExample.js +257 -0
- package/lib/examples/AgentRuntimeCustomExample.d.ts +9 -0
- package/lib/examples/AgentRuntimeCustomExample.js +68 -0
- package/lib/examples/AgentRuntimeLexical2Example.d.ts +42 -0
- package/lib/examples/AgentRuntimeLexical2Example.js +236 -0
- package/lib/examples/AgentRuntimeLexicalExample.d.ts +36 -0
- package/lib/examples/AgentRuntimeLexicalExample.js +260 -0
- package/lib/examples/AgentRuntimeLexicalSidebarExample.d.ts +41 -0
- package/lib/examples/AgentRuntimeLexicalSidebarExample.js +166 -0
- package/lib/examples/AgentRuntimeNotebookExample.d.ts +9 -0
- package/lib/examples/AgentRuntimeNotebookExample.js +148 -0
- package/lib/examples/AgentRuntimeNotebookSidebarExample.d.ts +13 -0
- package/lib/examples/AgentRuntimeNotebookSidebarExample.js +121 -0
- package/lib/examples/AgentRuntimeStandaloneExample.d.ts +21 -0
- package/lib/examples/AgentRuntimeStandaloneExample.js +158 -0
- package/lib/examples/AgentSpaceFormExample.d.ts +22 -0
- package/lib/examples/AgentSpaceFormExample.js +296 -0
- package/lib/examples/AgentSpaceHomeExample.d.ts +8 -0
- package/lib/examples/AgentSpaceHomeExample.js +171 -0
- package/lib/examples/CopilotKitLexicalExample.d.ts +38 -0
- package/lib/examples/CopilotKitLexicalExample.js +161 -0
- package/lib/examples/CopilotKitNotebookExample.d.ts +11 -0
- package/lib/examples/CopilotKitNotebookExample.js +70 -0
- package/lib/examples/DatalayerNotebookExample.d.ts +16 -0
- package/lib/examples/DatalayerNotebookExample.js +99 -0
- package/lib/examples/JupyterCellExample.d.ts +6 -0
- package/lib/examples/JupyterCellExample.js +19 -0
- package/lib/examples/JupyterNotebookExample.d.ts +6 -0
- package/lib/examples/JupyterNotebookExample.js +21 -0
- package/lib/examples/ag-ui/haiku/HaikuDisplay.d.ts +18 -0
- package/lib/examples/ag-ui/haiku/HaikuDisplay.js +110 -0
- package/lib/examples/ag-ui/haiku/InlineHaikuCard.d.ts +39 -0
- package/lib/examples/ag-ui/haiku/InlineHaikuCard.js +117 -0
- package/lib/examples/ag-ui/haiku/index.d.ts +11 -0
- package/lib/examples/ag-ui/haiku/index.js +15 -0
- package/lib/examples/ag-ui/index.d.ts +10 -0
- package/lib/examples/ag-ui/index.js +16 -0
- package/lib/examples/ag-ui/weather/InlineWeatherCard.d.ts +43 -0
- package/lib/examples/ag-ui/weather/InlineWeatherCard.js +180 -0
- package/lib/examples/ag-ui/weather/index.d.ts +9 -0
- package/lib/examples/ag-ui/weather/index.js +13 -0
- package/lib/examples/components/AgentConfiguration.d.ts +50 -0
- package/lib/examples/components/AgentConfiguration.js +115 -0
- package/lib/examples/components/AgentsDataTable.d.ts +13 -0
- package/lib/examples/components/AgentsDataTable.js +74 -0
- package/lib/examples/components/FooterMetrics.d.ts +12 -0
- package/lib/examples/components/FooterMetrics.js +17 -0
- package/lib/examples/components/Header.d.ts +27 -0
- package/lib/examples/components/Header.js +294 -0
- package/lib/examples/components/HeaderControls.d.ts +11 -0
- package/lib/examples/components/HeaderControls.js +24 -0
- package/lib/examples/components/LexicalEditor.d.ts +27 -0
- package/lib/examples/components/LexicalEditor.js +118 -0
- package/lib/examples/components/MainContent.d.ts +19 -0
- package/lib/examples/components/MainContent.js +68 -0
- package/lib/examples/components/MockFileBrowser.d.ts +12 -0
- package/lib/examples/components/MockFileBrowser.js +131 -0
- package/lib/examples/components/Rating.d.ts +14 -0
- package/lib/examples/components/Rating.js +12 -0
- package/lib/examples/components/SessionTabs.d.ts +21 -0
- package/lib/examples/components/SessionTabs.js +11 -0
- package/lib/examples/components/TimeTravel.d.ts +15 -0
- package/lib/examples/components/TimeTravel.js +23 -0
- package/lib/examples/components/index.d.ts +11 -0
- package/lib/examples/components/index.js +14 -0
- package/lib/examples/example-selector.d.ts +22 -0
- package/lib/examples/example-selector.js +62 -0
- package/lib/examples/index.d.ts +21 -0
- package/lib/examples/index.js +25 -0
- package/lib/examples/lexical/editorConfig.d.ts +76 -0
- package/lib/examples/lexical/editorConfig.js +55 -0
- package/lib/examples/lexical/lexical-theme.css +436 -0
- package/lib/examples/lexical/theme.d.ts +61 -0
- package/lib/examples/lexical/theme.js +72 -0
- package/lib/examples/main.d.ts +2 -0
- package/lib/examples/main.js +334 -0
- package/lib/examples/stores/agents/earthquake-detector.ipynb.json +111 -0
- package/lib/examples/stores/agents/earthquake-detector.json +13 -0
- package/lib/examples/stores/agents/earthquake-detector.lexical.json +2988 -0
- package/lib/examples/stores/agents/sales-forecaster.ipynb.json +111 -0
- package/lib/examples/stores/agents/sales-forecaster.json +13 -0
- package/lib/examples/stores/agents/sales-forecaster.lexical.json +2988 -0
- package/lib/examples/stores/agents/social-post-generator.ipynb.json +111 -0
- package/lib/examples/stores/agents/social-post-generator.json +13 -0
- package/lib/examples/stores/agents/social-post-generator.lexical.json +2988 -0
- package/lib/examples/stores/agents/stock-market.ipynb.json +56 -0
- package/lib/examples/stores/agents/stock-market.json +13 -0
- package/lib/examples/stores/agents/stock-market.lexical.json +1026 -0
- package/lib/examples/stores/examplesStore.d.ts +26 -0
- package/lib/examples/stores/examplesStore.js +60 -0
- package/lib/examples/stores/notebooks/Empty.ipynb.json +33 -0
- package/lib/examples/stores/notebooks/IPyWidgetsExample.ipynb.json +101 -0
- package/lib/examples/stores/notebooks/IPyWidgetsExampleWithState.ipynb.json +112 -0
- package/lib/examples/stores/notebooks/Lite.ipynb.json +128 -0
- package/lib/examples/stores/notebooks/Matplotlib.ipynb.json +137 -0
- package/lib/examples/stores/notebooks/NotebookExample1.ipynb.json +126 -0
- package/lib/examples/stores/notebooks/NotebookExample2.ipynb.json +48 -0
- package/lib/examples/stores/notebooks/NotebookOutputs.ipynb.json +49 -0
- package/lib/examples/stores/notebooks/NotebookToCExample.ipynb.json +102 -0
- package/lib/examples/stores/notebooks/OutputIPyWidgetsExample.d.ts +145 -0
- package/lib/examples/stores/notebooks/OutputIPyWidgetsExample.js +153 -0
- package/lib/examples/stores/notebooks/PyGWalker.ipynb.json +55 -0
- package/lib/examples/vercel-ai-elements/VercelAiElementsShowcase.d.ts +12 -0
- package/lib/examples/vercel-ai-elements/VercelAiElementsShowcase.js +69 -0
- package/lib/examples/vercel-ai-elements/components/ArtifactShowcase.d.ts +1 -0
- package/lib/examples/vercel-ai-elements/components/ArtifactShowcase.js +85 -0
- package/lib/examples/vercel-ai-elements/components/CodeBlockShowcase.d.ts +1 -0
- package/lib/examples/vercel-ai-elements/components/CodeBlockShowcase.js +62 -0
- package/lib/examples/vercel-ai-elements/components/ConversationShowcase.d.ts +1 -0
- package/lib/examples/vercel-ai-elements/components/ConversationShowcase.js +51 -0
- package/lib/examples/vercel-ai-elements/components/LoaderShowcase.d.ts +1 -0
- package/lib/examples/vercel-ai-elements/components/LoaderShowcase.js +9 -0
- package/lib/examples/vercel-ai-elements/components/MessageShowcase.d.ts +1 -0
- package/lib/examples/vercel-ai-elements/components/MessageShowcase.js +56 -0
- package/lib/examples/vercel-ai-elements/components/ModelSelectorShowcase.d.ts +1 -0
- package/lib/examples/vercel-ai-elements/components/ModelSelectorShowcase.js +50 -0
- package/lib/examples/vercel-ai-elements/components/PromptInputShowcase.d.ts +1 -0
- package/lib/examples/vercel-ai-elements/components/PromptInputShowcase.js +16 -0
- package/lib/examples/vercel-ai-elements/components/ReasoningShowcase.d.ts +1 -0
- package/lib/examples/vercel-ai-elements/components/ReasoningShowcase.js +72 -0
- package/lib/examples/vercel-ai-elements/components/ShimmerShowcase.d.ts +1 -0
- package/lib/examples/vercel-ai-elements/components/ShimmerShowcase.js +9 -0
- package/lib/examples/vercel-ai-elements/components/SourcesShowcase.d.ts +1 -0
- package/lib/examples/vercel-ai-elements/components/SourcesShowcase.js +43 -0
- package/lib/examples/vercel-ai-elements/components/SuggestionShowcase.d.ts +1 -0
- package/lib/examples/vercel-ai-elements/components/SuggestionShowcase.js +31 -0
- package/lib/examples/vercel-ai-elements/components/ToolShowcase.d.ts +1 -0
- package/lib/examples/vercel-ai-elements/components/ToolShowcase.js +54 -0
- package/lib/examples/vercel-ai-elements/index.d.ts +13 -0
- package/lib/examples/vercel-ai-elements/index.js +17 -0
- package/lib/examples/vercel-ai-elements/main.d.ts +1 -0
- package/lib/examples/vercel-ai-elements/main.js +9 -0
- package/lib/examples/vercel-ai-elements/showcase.css +128 -0
- package/lib/hooks/index.d.ts +68 -0
- package/lib/hooks/index.js +81 -0
- package/lib/hooks/useA2A.d.ts +75 -0
- package/lib/hooks/useA2A.js +368 -0
- package/lib/hooks/useAGUI.d.ts +63 -0
- package/lib/hooks/useAGUI.js +162 -0
- package/lib/hooks/useAcp.d.ts +121 -0
- package/lib/hooks/useAcp.js +459 -0
- package/lib/hooks/useAgents.d.ts +13 -0
- package/lib/hooks/useAgents.js +71 -0
- package/lib/hooks/useChat.d.ts +62 -0
- package/lib/hooks/useChat.js +363 -0
- package/lib/hooks/useKeyboardShortcuts.d.ts +47 -0
- package/lib/hooks/useKeyboardShortcuts.js +153 -0
- package/lib/hooks/useMobile.d.ts +1 -0
- package/lib/hooks/useMobile.js +19 -0
- package/lib/hooks/useNotebookAIAgent.d.ts +8 -0
- package/lib/hooks/useNotebookAIAgent.js +56 -0
- package/lib/hooks/useToast.d.ts +44 -0
- package/lib/hooks/useToast.js +128 -0
- package/lib/hooks/useTools.d.ts +107 -0
- package/lib/hooks/useTools.js +130 -0
- package/lib/hooks/useVercelChat.d.ts +45 -0
- package/lib/hooks/useVercelChat.js +62 -0
- package/lib/index.css +73 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +5 -0
- package/lib/lexical/ChatInlinePlugin.d.ts +21 -0
- package/lib/lexical/ChatInlinePlugin.js +379 -0
- package/lib/lexical/index.d.ts +6 -0
- package/lib/lexical/index.js +10 -0
- package/lib/lib/utils.d.ts +2 -0
- package/lib/lib/utils.js +9 -0
- package/lib/main.d.ts +1 -0
- package/lib/main.js +12 -0
- package/lib/models/AIAgent.d.ts +17 -0
- package/lib/models/AIAgent.js +5 -0
- package/lib/models/index.d.ts +1 -0
- package/lib/models/index.js +5 -0
- package/lib/renderers/a2ui/components/A2UIRenderer.d.ts +7 -0
- package/lib/renderers/a2ui/components/A2UIRenderer.js +102 -0
- package/lib/renderers/a2ui/components/SurfaceRenderer.d.ts +7 -0
- package/lib/renderers/a2ui/components/SurfaceRenderer.js +101 -0
- package/lib/renderers/a2ui/components/content/AudioPlayer.d.ts +9 -0
- package/lib/renderers/a2ui/components/content/AudioPlayer.js +38 -0
- package/lib/renderers/a2ui/components/content/Divider.d.ts +9 -0
- package/lib/renderers/a2ui/components/content/Divider.js +35 -0
- package/lib/renderers/a2ui/components/content/Icon.d.ts +9 -0
- package/lib/renderers/a2ui/components/content/Icon.js +110 -0
- package/lib/renderers/a2ui/components/content/Image.d.ts +9 -0
- package/lib/renderers/a2ui/components/content/Image.js +61 -0
- package/lib/renderers/a2ui/components/content/Text.d.ts +9 -0
- package/lib/renderers/a2ui/components/content/Text.js +64 -0
- package/lib/renderers/a2ui/components/content/Video.d.ts +9 -0
- package/lib/renderers/a2ui/components/content/Video.js +37 -0
- package/lib/renderers/a2ui/components/content/index.d.ts +6 -0
- package/lib/renderers/a2ui/components/content/index.js +25 -0
- package/lib/renderers/a2ui/components/index.d.ts +5 -0
- package/lib/renderers/a2ui/components/index.js +24 -0
- package/lib/renderers/a2ui/components/interactive/Button.d.ts +11 -0
- package/lib/renderers/a2ui/components/interactive/Button.js +71 -0
- package/lib/renderers/a2ui/components/interactive/CheckBox.d.ts +9 -0
- package/lib/renderers/a2ui/components/interactive/CheckBox.js +48 -0
- package/lib/renderers/a2ui/components/interactive/DateTimeInput.d.ts +9 -0
- package/lib/renderers/a2ui/components/interactive/DateTimeInput.js +62 -0
- package/lib/renderers/a2ui/components/interactive/MultipleChoice.d.ts +9 -0
- package/lib/renderers/a2ui/components/interactive/MultipleChoice.js +73 -0
- package/lib/renderers/a2ui/components/interactive/Slider.d.ts +9 -0
- package/lib/renderers/a2ui/components/interactive/Slider.js +53 -0
- package/lib/renderers/a2ui/components/interactive/TextField.d.ts +9 -0
- package/lib/renderers/a2ui/components/interactive/TextField.js +72 -0
- package/lib/renderers/a2ui/components/interactive/index.d.ts +6 -0
- package/lib/renderers/a2ui/components/interactive/index.js +25 -0
- package/lib/renderers/a2ui/components/layout/Card.d.ts +11 -0
- package/lib/renderers/a2ui/components/layout/Card.js +30 -0
- package/lib/renderers/a2ui/components/layout/Column.d.ts +11 -0
- package/lib/renderers/a2ui/components/layout/Column.js +65 -0
- package/lib/renderers/a2ui/components/layout/List.d.ts +11 -0
- package/lib/renderers/a2ui/components/layout/List.js +55 -0
- package/lib/renderers/a2ui/components/layout/Modal.d.ts +11 -0
- package/lib/renderers/a2ui/components/layout/Modal.js +58 -0
- package/lib/renderers/a2ui/components/layout/Row.d.ts +11 -0
- package/lib/renderers/a2ui/components/layout/Row.js +65 -0
- package/lib/renderers/a2ui/components/layout/Tabs.d.ts +11 -0
- package/lib/renderers/a2ui/components/layout/Tabs.js +48 -0
- package/lib/renderers/a2ui/components/layout/index.d.ts +6 -0
- package/lib/renderers/a2ui/components/layout/index.js +25 -0
- package/lib/renderers/a2ui/context/A2UIContext.d.ts +17 -0
- package/lib/renderers/a2ui/context/A2UIContext.js +54 -0
- package/lib/renderers/a2ui/context/ThemeContext.d.ts +20 -0
- package/lib/renderers/a2ui/context/ThemeContext.js +333 -0
- package/lib/renderers/a2ui/hooks/useA2UI.d.ts +36 -0
- package/lib/renderers/a2ui/hooks/useA2UI.js +62 -0
- package/lib/renderers/a2ui/hooks/useDataBinding.d.ts +8 -0
- package/lib/renderers/a2ui/hooks/useDataBinding.js +83 -0
- package/lib/renderers/a2ui/index.d.ts +9 -0
- package/lib/renderers/a2ui/index.js +28 -0
- package/lib/renderers/a2ui/lib/utils.d.ts +11 -0
- package/lib/renderers/a2ui/lib/utils.js +38 -0
- package/lib/renderers/a2ui/types/index.d.ts +17 -0
- package/lib/renderers/a2ui/types/index.js +5 -0
- package/lib/renderers/index.d.ts +1 -0
- package/lib/renderers/index.js +5 -0
- package/lib/state/index.d.ts +1 -0
- package/lib/state/index.js +5 -0
- package/lib/state/substates/AIAgentState.d.ts +11 -0
- package/lib/state/substates/AIAgentState.js +42 -0
- package/lib/state/substates/index.d.ts +1 -0
- package/lib/state/substates/index.js +5 -0
- package/lib/stories/Button.d.ts +15 -0
- package/lib/stories/Button.js +13 -0
- package/lib/stories/Button.stories.d.ts +23 -0
- package/lib/stories/Button.stories.js +48 -0
- package/lib/stories/Cell.stories.d.ts +12 -0
- package/lib/stories/Cell.stories.js +123 -0
- package/lib/stories/Header.d.ts +12 -0
- package/lib/stories/Header.js +8 -0
- package/lib/stories/Header.stories.d.ts +18 -0
- package/lib/stories/Header.stories.js +30 -0
- package/lib/stories/Page.d.ts +3 -0
- package/lib/stories/Page.js +12 -0
- package/lib/stories/Page.stories.d.ts +12 -0
- package/lib/stories/Page.stories.js +28 -0
- package/lib/stories/assets/accessibility.png +0 -0
- package/lib/stories/assets/accessibility.svg +1 -0
- package/lib/stories/assets/addon-library.png +0 -0
- package/lib/stories/assets/assets.png +0 -0
- package/lib/stories/assets/context.png +0 -0
- package/lib/stories/assets/discord.svg +1 -0
- package/lib/stories/assets/docs.png +0 -0
- package/lib/stories/assets/figma-plugin.png +0 -0
- package/lib/stories/assets/github.svg +1 -0
- package/lib/stories/assets/share.png +0 -0
- package/lib/stories/assets/styling.png +0 -0
- package/lib/stories/assets/testing.png +0 -0
- package/lib/stories/assets/theming.png +0 -0
- package/lib/stories/assets/tutorials.svg +1 -0
- package/lib/stories/assets/youtube.svg +1 -0
- package/lib/stories/button.css +35 -0
- package/lib/stories/header.css +37 -0
- package/lib/stories/page.css +73 -0
- package/lib/test-setup.d.ts +1 -0
- package/lib/test-setup.js +80 -0
- package/lib/tools/adapters/agent-runtimes/AgentRuntimesToolAdapter.d.ts +40 -0
- package/lib/tools/adapters/agent-runtimes/AgentRuntimesToolAdapter.js +110 -0
- package/lib/tools/adapters/agent-runtimes/index.d.ts +9 -0
- package/lib/tools/adapters/agent-runtimes/index.js +13 -0
- package/lib/tools/adapters/agent-runtimes/lexicalHooks.d.ts +24 -0
- package/lib/tools/adapters/agent-runtimes/lexicalHooks.js +50 -0
- package/lib/tools/adapters/agent-runtimes/notebookHooks.d.ts +24 -0
- package/lib/tools/adapters/agent-runtimes/notebookHooks.js +51 -0
- package/lib/tools/adapters/copilotkit/CopilotKitToolAdapter.d.ts +73 -0
- package/lib/tools/adapters/copilotkit/CopilotKitToolAdapter.js +244 -0
- package/lib/tools/adapters/copilotkit/index.d.ts +10 -0
- package/lib/tools/adapters/copilotkit/index.js +14 -0
- package/lib/tools/adapters/copilotkit/lexicalHooks.d.ts +27 -0
- package/lib/tools/adapters/copilotkit/lexicalHooks.js +59 -0
- package/lib/tools/adapters/copilotkit/notebookHooks.d.ts +27 -0
- package/lib/tools/adapters/copilotkit/notebookHooks.js +58 -0
- package/lib/tools/adapters/index.d.ts +1 -0
- package/lib/tools/adapters/index.js +5 -0
- package/lib/tools/index.d.ts +6 -0
- package/lib/tools/index.js +18 -0
- package/lib/types.d.ts +5 -0
- package/lib/types.js +5 -0
- package/package.json +327 -0
- package/style/animation/Animation.module.css +174 -0
- package/style/base.css +204 -0
- package/style/index.css +6 -0
- package/style/showcase-vercel-ai.css +137 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { IconButton, Avatar, Box } from '@primer/react';
|
|
3
|
+
import { PlayIcon, PauseIcon } from '@primer/octicons-react';
|
|
4
|
+
import { useAgentsStore } from '../stores/examplesStore';
|
|
5
|
+
/**
|
|
6
|
+
* Agents Data Table Component
|
|
7
|
+
*
|
|
8
|
+
* Displays agents in a table format with status controls.
|
|
9
|
+
*/
|
|
10
|
+
export const AgentsDataTable = ({ onToggleStatus, showAuthor = true, showLastEdited = true, }) => {
|
|
11
|
+
const agents = useAgentsStore(state => state.agents);
|
|
12
|
+
const toggleAgentStatus = useAgentsStore(state => state.toggleAgentStatus);
|
|
13
|
+
const handleToggle = (agentId) => {
|
|
14
|
+
toggleAgentStatus(agentId);
|
|
15
|
+
onToggleStatus?.(agentId);
|
|
16
|
+
};
|
|
17
|
+
return (_jsx(Box, { sx: {
|
|
18
|
+
border: '1px solid',
|
|
19
|
+
borderColor: 'border.default',
|
|
20
|
+
borderRadius: 2,
|
|
21
|
+
overflow: 'hidden',
|
|
22
|
+
}, children: _jsxs("table", { style: {
|
|
23
|
+
width: '100%',
|
|
24
|
+
borderCollapse: 'collapse',
|
|
25
|
+
}, children: [_jsx("thead", { style: {
|
|
26
|
+
backgroundColor: 'var(--bgColor-muted)',
|
|
27
|
+
borderBottom: '1px solid var(--borderColor-default)',
|
|
28
|
+
}, children: _jsxs("tr", { children: [_jsx("th", { style: {
|
|
29
|
+
padding: '12px 16px',
|
|
30
|
+
textAlign: 'left',
|
|
31
|
+
fontWeight: 600,
|
|
32
|
+
fontSize: '14px',
|
|
33
|
+
}, children: "Agent" }), showAuthor && (_jsx("th", { style: {
|
|
34
|
+
padding: '12px 16px',
|
|
35
|
+
textAlign: 'left',
|
|
36
|
+
fontWeight: 600,
|
|
37
|
+
fontSize: '14px',
|
|
38
|
+
}, children: "Author" })), showLastEdited && (_jsx("th", { style: {
|
|
39
|
+
padding: '12px 16px',
|
|
40
|
+
textAlign: 'left',
|
|
41
|
+
fontWeight: 600,
|
|
42
|
+
fontSize: '14px',
|
|
43
|
+
}, children: "Last Edited" })), _jsx("th", { style: {
|
|
44
|
+
padding: '12px 16px',
|
|
45
|
+
textAlign: 'left',
|
|
46
|
+
fontWeight: 600,
|
|
47
|
+
fontSize: '14px',
|
|
48
|
+
}, children: "Status" }), _jsx("th", { style: {
|
|
49
|
+
padding: '12px 16px',
|
|
50
|
+
textAlign: 'left',
|
|
51
|
+
fontWeight: 600,
|
|
52
|
+
fontSize: '14px',
|
|
53
|
+
}, children: "Actions" })] }) }), _jsx("tbody", { children: agents.map(agent => (_jsxs("tr", { style: {
|
|
54
|
+
borderBottom: '1px solid var(--borderColor-default)',
|
|
55
|
+
}, children: [_jsx("td", { style: { padding: '12px 16px' }, children: _jsxs("div", { style: {
|
|
56
|
+
display: 'flex',
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
gap: '12px',
|
|
59
|
+
}, children: [_jsx(Avatar, { src: agent.avatarUrl, size: 32 }), _jsx("span", { style: { fontWeight: 600 }, children: agent.name })] }) }), showAuthor && (_jsx("td", { style: { padding: '12px 16px' }, children: _jsx("span", { style: { color: 'var(--fgColor-muted)' }, children: agent.author }) })), showLastEdited && (_jsx("td", { style: { padding: '12px 16px' }, children: _jsx("span", { style: { color: 'var(--fgColor-muted)' }, children: agent.lastEdited }) })), _jsx("td", { style: { padding: '12px 16px' }, children: _jsx("span", { style: {
|
|
60
|
+
display: 'inline-flex',
|
|
61
|
+
alignItems: 'center',
|
|
62
|
+
gap: '6px',
|
|
63
|
+
padding: '2px 8px',
|
|
64
|
+
borderRadius: '12px',
|
|
65
|
+
fontSize: '12px',
|
|
66
|
+
fontWeight: 500,
|
|
67
|
+
backgroundColor: agent.status === 'running'
|
|
68
|
+
? 'var(--bgColor-success-muted)'
|
|
69
|
+
: 'var(--bgColor-attention-muted)',
|
|
70
|
+
color: agent.status === 'running'
|
|
71
|
+
? 'var(--fgColor-success)'
|
|
72
|
+
: 'var(--fgColor-attention)',
|
|
73
|
+
}, children: agent.status === 'running' ? 'Running' : 'Paused' }) }), _jsx("td", { style: { padding: '12px 16px' }, children: _jsx(IconButton, { icon: agent.status === 'running' ? PauseIcon : PlayIcon, "aria-label": agent.status === 'running' ? 'Pause agent' : 'Start agent', onClick: () => handleToggle(agent.id), variant: "invisible" }) })] }, agent.id))) })] }) }));
|
|
74
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface FooterMetricsProps {
|
|
3
|
+
tokens: number;
|
|
4
|
+
cost: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Footer Metrics Component
|
|
8
|
+
*
|
|
9
|
+
* Displays token usage and cost.
|
|
10
|
+
*/
|
|
11
|
+
export declare const FooterMetrics: React.FC<FooterMetricsProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from '@primer/react';
|
|
3
|
+
import { Box } from '@datalayer/primer-addons';
|
|
4
|
+
/**
|
|
5
|
+
* Footer Metrics Component
|
|
6
|
+
*
|
|
7
|
+
* Displays token usage and cost.
|
|
8
|
+
*/
|
|
9
|
+
export const FooterMetrics = ({ tokens, cost, }) => {
|
|
10
|
+
return (_jsxs(Box, { sx: {
|
|
11
|
+
display: 'flex',
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
gap: 3,
|
|
14
|
+
py: 2,
|
|
15
|
+
px: 3,
|
|
16
|
+
}, children: [_jsxs(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: ["Tokens:", ' ', _jsx(Text, { as: "span", sx: { fontWeight: 'bold', color: 'fg.default' }, children: tokens.toLocaleString() })] }), _jsxs(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: ["Cost:", ' ', _jsxs(Text, { as: "span", sx: { fontWeight: 'bold', color: 'fg.default' }, children: ["$", cost.toFixed(2), " USD"] })] })] }));
|
|
17
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface HeaderProps {
|
|
3
|
+
activeSession: string;
|
|
4
|
+
agentName?: string;
|
|
5
|
+
agentDescription?: string;
|
|
6
|
+
agentStatus?: 'running' | 'paused';
|
|
7
|
+
richEditor: boolean;
|
|
8
|
+
durable: boolean;
|
|
9
|
+
codemode: boolean;
|
|
10
|
+
showContextTree: boolean;
|
|
11
|
+
isNewAgent?: boolean;
|
|
12
|
+
isConfigured?: boolean;
|
|
13
|
+
onSessionChange: (sessionId: string) => void;
|
|
14
|
+
onRichEditorChange: (value: boolean) => void;
|
|
15
|
+
onDurableChange: (value: boolean) => void;
|
|
16
|
+
onCodemodeChange: (value: boolean) => void;
|
|
17
|
+
onToggleContextTree: () => void;
|
|
18
|
+
onToggleStatus?: () => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Header Component
|
|
22
|
+
*
|
|
23
|
+
* Main header for the agent runtime interface with session tabs,
|
|
24
|
+
* toggle switches, controls, and optional context treemap.
|
|
25
|
+
*/
|
|
26
|
+
export declare const Header: React.FC<HeaderProps>;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
4
|
+
* Distributed under the terms of the Modified BSD License.
|
|
5
|
+
*/
|
|
6
|
+
import { useState, useRef } from 'react';
|
|
7
|
+
import { Text, Button, PageLayout, ToggleSwitch, AvatarStack, Avatar, Spinner, TextInput, FormControl, AnchoredOverlay, IconButton, } from '@primer/react';
|
|
8
|
+
import { ZapIcon, ListUnorderedIcon, InfoIcon, PlayIcon, PauseIcon, } from '@primer/octicons-react';
|
|
9
|
+
import { Box } from '@datalayer/primer-addons';
|
|
10
|
+
import ReactECharts from 'echarts-for-react';
|
|
11
|
+
import { SessionTabs } from './SessionTabs';
|
|
12
|
+
import { HeaderControls } from './HeaderControls';
|
|
13
|
+
// Mock session data
|
|
14
|
+
const MOCK_SESSIONS = [
|
|
15
|
+
{ id: 'session-1', name: 'Session 1', active: true },
|
|
16
|
+
{ id: 'session-2', name: 'Session 2', active: false },
|
|
17
|
+
{ id: 'session-3', name: 'Session 3', active: false },
|
|
18
|
+
];
|
|
19
|
+
// Mock context data for treemap
|
|
20
|
+
const MOCK_CONTEXT_DATA = {
|
|
21
|
+
name: 'Context',
|
|
22
|
+
children: [
|
|
23
|
+
{
|
|
24
|
+
name: 'Files',
|
|
25
|
+
value: 450000,
|
|
26
|
+
children: [
|
|
27
|
+
{ name: 'app.py', value: 125000 },
|
|
28
|
+
{ name: 'models.py', value: 98000 },
|
|
29
|
+
{ name: 'routes.py', value: 112000 },
|
|
30
|
+
{ name: 'utils.py', value: 115000 },
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'Messages',
|
|
35
|
+
value: 380000,
|
|
36
|
+
children: [
|
|
37
|
+
{ name: 'User messages', value: 180000 },
|
|
38
|
+
{ name: 'Assistant responses', value: 200000 },
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'Tools',
|
|
43
|
+
value: 220000,
|
|
44
|
+
children: [
|
|
45
|
+
{ name: 'Code execution', value: 95000 },
|
|
46
|
+
{ name: 'File operations', value: 75000 },
|
|
47
|
+
{ name: 'Search', value: 50000 },
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'Memory',
|
|
52
|
+
value: 473552,
|
|
53
|
+
children: [
|
|
54
|
+
{ name: 'Short term', value: 150000 },
|
|
55
|
+
{ name: 'Long term', value: 323552 },
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'Free space',
|
|
60
|
+
value: 996448,
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
};
|
|
64
|
+
// Optimized context data with more free space
|
|
65
|
+
const OPTIMIZED_CONTEXT_DATA = {
|
|
66
|
+
name: 'Context',
|
|
67
|
+
children: [
|
|
68
|
+
{
|
|
69
|
+
name: 'Files',
|
|
70
|
+
value: 280000,
|
|
71
|
+
children: [
|
|
72
|
+
{ name: 'app.py', value: 85000 },
|
|
73
|
+
{ name: 'models.py', value: 65000 },
|
|
74
|
+
{ name: 'routes.py', value: 70000 },
|
|
75
|
+
{ name: 'utils.py', value: 60000 },
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'Messages',
|
|
80
|
+
value: 250000,
|
|
81
|
+
children: [
|
|
82
|
+
{ name: 'User messages', value: 120000 },
|
|
83
|
+
{ name: 'Assistant responses', value: 130000 },
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: 'Tools',
|
|
88
|
+
value: 150000,
|
|
89
|
+
children: [
|
|
90
|
+
{ name: 'Code execution', value: 65000 },
|
|
91
|
+
{ name: 'File operations', value: 50000 },
|
|
92
|
+
{ name: 'Search', value: 35000 },
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'Memory',
|
|
97
|
+
value: 320000,
|
|
98
|
+
children: [
|
|
99
|
+
{ name: 'Short term', value: 100000 },
|
|
100
|
+
{ name: 'Long term', value: 220000 },
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: 'Free space',
|
|
105
|
+
value: 1520000,
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Header Component
|
|
111
|
+
*
|
|
112
|
+
* Main header for the agent runtime interface with session tabs,
|
|
113
|
+
* toggle switches, controls, and optional context treemap.
|
|
114
|
+
*/
|
|
115
|
+
export const Header = ({ activeSession, agentName, agentDescription, agentStatus, richEditor, durable, codemode, showContextTree, isNewAgent = false, isConfigured = false, onSessionChange, onRichEditorChange, onDurableChange, onCodemodeChange, onToggleContextTree, onToggleStatus, }) => {
|
|
116
|
+
const [isOptimizing, setIsOptimizing] = useState(false);
|
|
117
|
+
const [contextData, setContextData] = useState(MOCK_CONTEXT_DATA);
|
|
118
|
+
const [totalTokens, setTotalTokens] = useState('1.52M');
|
|
119
|
+
const [showDetails, setShowDetails] = useState(false);
|
|
120
|
+
const [showAvatarView, setShowAvatarView] = useState(false);
|
|
121
|
+
const [openOverlay, setOpenOverlay] = useState(null);
|
|
122
|
+
const richEditorRef = useRef(null);
|
|
123
|
+
const durableRef = useRef(null);
|
|
124
|
+
const codemodeRef = useRef(null);
|
|
125
|
+
const handleOptimize = () => {
|
|
126
|
+
setIsOptimizing(true);
|
|
127
|
+
setTimeout(() => {
|
|
128
|
+
setContextData(OPTIMIZED_CONTEXT_DATA);
|
|
129
|
+
setTotalTokens('1.00M');
|
|
130
|
+
setIsOptimizing(false);
|
|
131
|
+
}, 2000);
|
|
132
|
+
};
|
|
133
|
+
return (_jsxs(PageLayout.Header, { divider: "none", children: [_jsxs(Box, { sx: {
|
|
134
|
+
display: 'flex',
|
|
135
|
+
alignItems: 'center',
|
|
136
|
+
gap: 3,
|
|
137
|
+
py: 2,
|
|
138
|
+
}, children: [agentName && (_jsx(SessionTabs, { sessions: MOCK_SESSIONS, activeSession: activeSession, agentName: agentName, agentDescription: agentDescription, onSessionChange: onSessionChange, onAddSession: () => {
|
|
139
|
+
/* Add session */
|
|
140
|
+
} })), _jsxs(Box, { sx: {
|
|
141
|
+
display: 'flex',
|
|
142
|
+
alignItems: 'center',
|
|
143
|
+
gap: 3,
|
|
144
|
+
marginLeft: 'auto',
|
|
145
|
+
}, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(ToggleSwitch, { size: "small", checked: codemode, onClick: () => onCodemodeChange(!codemode), "aria-labelledby": "codemode-label", disabled: isNewAgent || !isConfigured }), _jsx(Text, { id: "codemode-label", sx: { fontSize: 0 }, children: "Codemode" }), _jsx(IconButton, { ref: codemodeRef, icon: InfoIcon, size: "small", variant: "invisible", "aria-label": "Codemode info", onClick: () => setOpenOverlay(openOverlay === 'codemode' ? null : 'codemode') }), _jsx(AnchoredOverlay, { open: openOverlay === 'codemode', onOpen: () => setOpenOverlay('codemode'), onClose: () => setOpenOverlay(null), renderAnchor: () => _jsx("span", {}), anchorRef: codemodeRef, children: _jsxs(Box, { sx: {
|
|
146
|
+
p: 3,
|
|
147
|
+
maxWidth: '300px',
|
|
148
|
+
bg: 'canvas.overlay',
|
|
149
|
+
border: '1px solid',
|
|
150
|
+
borderColor: 'border.default',
|
|
151
|
+
borderRadius: 2,
|
|
152
|
+
boxShadow: 'shadow.large',
|
|
153
|
+
}, children: [_jsx(Text, { sx: {
|
|
154
|
+
fontSize: 0,
|
|
155
|
+
display: 'block',
|
|
156
|
+
mb: 1,
|
|
157
|
+
fontWeight: 'bold',
|
|
158
|
+
}, children: "Codemode" }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Optimize the agent for code-focused tasks including code generation, debugging, and technical problem-solving." })] }) })] }), _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(ToggleSwitch, { size: "small", checked: richEditor, onClick: () => onRichEditorChange(!richEditor), "aria-labelledby": "rich-editor-label", disabled: isNewAgent || !isConfigured }), _jsx(Text, { id: "rich-editor-label", sx: { fontSize: 0 }, children: "Rich Editor" }), _jsx(IconButton, { ref: richEditorRef, icon: InfoIcon, size: "small", variant: "invisible", "aria-label": "Rich Editor info", onClick: () => setOpenOverlay(openOverlay === 'richEditor' ? null : 'richEditor') }), _jsx(AnchoredOverlay, { open: openOverlay === 'richEditor', onOpen: () => setOpenOverlay('richEditor'), onClose: () => setOpenOverlay(null), renderAnchor: () => _jsx("span", {}), anchorRef: richEditorRef, children: _jsxs(Box, { sx: {
|
|
159
|
+
p: 3,
|
|
160
|
+
maxWidth: '300px',
|
|
161
|
+
bg: 'canvas.overlay',
|
|
162
|
+
border: '1px solid',
|
|
163
|
+
borderColor: 'border.default',
|
|
164
|
+
borderRadius: 2,
|
|
165
|
+
boxShadow: 'shadow.large',
|
|
166
|
+
}, children: [_jsx(Text, { sx: {
|
|
167
|
+
fontSize: 0,
|
|
168
|
+
display: 'block',
|
|
169
|
+
mb: 1,
|
|
170
|
+
fontWeight: 'bold',
|
|
171
|
+
}, children: "Rich Editor" }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Enable rich text editing with formatting options, markdown support, and visual enhancements for a better editing experience." })] }) })] }), _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(ToggleSwitch, { size: "small", checked: durable, onClick: () => onDurableChange(!durable), "aria-labelledby": "durable-label", disabled: isNewAgent || !isConfigured }), _jsx(Text, { id: "durable-label", sx: { fontSize: 0 }, children: "Durable" }), _jsx(IconButton, { ref: durableRef, icon: InfoIcon, size: "small", variant: "invisible", "aria-label": "Durable info", onClick: () => setOpenOverlay(openOverlay === 'durable' ? null : 'durable') }), _jsx(AnchoredOverlay, { open: openOverlay === 'durable', onOpen: () => setOpenOverlay('durable'), onClose: () => setOpenOverlay(null), renderAnchor: () => _jsx("span", {}), anchorRef: durableRef, children: _jsxs(Box, { sx: {
|
|
172
|
+
p: 3,
|
|
173
|
+
maxWidth: '300px',
|
|
174
|
+
bg: 'canvas.overlay',
|
|
175
|
+
border: '1px solid',
|
|
176
|
+
borderColor: 'border.default',
|
|
177
|
+
borderRadius: 2,
|
|
178
|
+
boxShadow: 'shadow.large',
|
|
179
|
+
}, children: [_jsx(Text, { sx: {
|
|
180
|
+
fontSize: 0,
|
|
181
|
+
display: 'block',
|
|
182
|
+
mb: 1,
|
|
183
|
+
fontWeight: 'bold',
|
|
184
|
+
}, children: "Durable" }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Persist agent state and conversation history across sessions. Your work is automatically saved and restored when you return." })] }) })] })] }), agentName && (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [agentStatus && onToggleStatus && (_jsx(IconButton, { "aria-label": agentStatus === 'running' ? 'Pause agent' : 'Play agent', icon: agentStatus === 'running' ? PauseIcon : PlayIcon, onClick: onToggleStatus, variant: "invisible", size: "small", sx: {
|
|
185
|
+
color: agentStatus === 'running' ? 'attention.fg' : 'success.fg',
|
|
186
|
+
} })), _jsx(HeaderControls, { onToggleContextTree: onToggleContextTree })] })), agentName && (_jsx(Box, { onClick: () => setShowAvatarView(!showAvatarView), sx: { cursor: 'pointer' }, children: _jsxs(AvatarStack, { size: 24, disableExpand: true, children: [_jsx(Avatar, { alt: "Primer logo", src: "https://avatars.githubusercontent.com/primer" }), _jsx(Avatar, { alt: "GitHub logo", src: "https://avatars.githubusercontent.com/github" }), _jsx(Avatar, { alt: "Atom logo", src: "https://avatars.githubusercontent.com/atom" }), _jsx(Avatar, { alt: "GitHub Desktop logo", src: "https://avatars.githubusercontent.com/desktop" })] }) }))] }), agentName && showContextTree && (_jsxs(Box, { sx: {
|
|
187
|
+
mt: 2,
|
|
188
|
+
p: 2,
|
|
189
|
+
border: '1px solid',
|
|
190
|
+
borderColor: 'border.default',
|
|
191
|
+
borderRadius: 2,
|
|
192
|
+
bg: 'canvas.subtle',
|
|
193
|
+
}, children: [_jsxs(Box, { sx: {
|
|
194
|
+
display: 'flex',
|
|
195
|
+
justifyContent: 'space-between',
|
|
196
|
+
alignItems: 'center',
|
|
197
|
+
mb: 2,
|
|
198
|
+
}, children: [_jsxs(Text, { sx: {
|
|
199
|
+
fontSize: 1,
|
|
200
|
+
fontWeight: 'bold',
|
|
201
|
+
}, children: ["Context Distribution (", totalTokens, " tokens)"] }), _jsxs(Box, { sx: { display: 'flex', gap: 2 }, children: [_jsx(Button, { size: "small", onClick: () => setShowDetails(!showDetails), leadingVisual: ListUnorderedIcon, children: "Details" }), _jsx(Button, { size: "small", onClick: handleOptimize, disabled: isOptimizing, leadingVisual: isOptimizing ? Spinner : ZapIcon, children: "Optimize" })] })] }), _jsx(ReactECharts, { option: {
|
|
202
|
+
series: [
|
|
203
|
+
{
|
|
204
|
+
type: 'treemap',
|
|
205
|
+
data: contextData.children,
|
|
206
|
+
roam: false,
|
|
207
|
+
breadcrumb: {
|
|
208
|
+
show: false,
|
|
209
|
+
},
|
|
210
|
+
label: {
|
|
211
|
+
show: true,
|
|
212
|
+
formatter: '{b}',
|
|
213
|
+
},
|
|
214
|
+
itemStyle: {
|
|
215
|
+
borderColor: '#fff',
|
|
216
|
+
borderWidth: 2,
|
|
217
|
+
},
|
|
218
|
+
levels: [
|
|
219
|
+
{
|
|
220
|
+
itemStyle: {
|
|
221
|
+
borderColor: '#777',
|
|
222
|
+
borderWidth: 0,
|
|
223
|
+
gapWidth: 1,
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
itemStyle: {
|
|
228
|
+
borderColor: '#555',
|
|
229
|
+
borderWidth: 5,
|
|
230
|
+
gapWidth: 1,
|
|
231
|
+
},
|
|
232
|
+
colorSaturation: [0.35, 0.5],
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
colorSaturation: [0.35, 0.5],
|
|
236
|
+
},
|
|
237
|
+
],
|
|
238
|
+
},
|
|
239
|
+
],
|
|
240
|
+
}, style: { height: '300px' } }), showDetails && (_jsxs(Box, { sx: {
|
|
241
|
+
mt: 3,
|
|
242
|
+
p: 2,
|
|
243
|
+
border: '1px solid',
|
|
244
|
+
borderColor: 'border.default',
|
|
245
|
+
borderRadius: 2,
|
|
246
|
+
bg: 'canvas.default',
|
|
247
|
+
fontFamily: 'mono',
|
|
248
|
+
fontSize: 0,
|
|
249
|
+
}, children: [_jsx(Text, { sx: { fontWeight: 'bold', display: 'block', mb: 2 }, children: "Context Breakdown:" }), contextData.children.map((category) => (_jsxs(Box, { sx: { mb: 2 }, children: [_jsxs(Text, { sx: { fontWeight: 'bold' }, children: [category.name, ": ", (category.value / 1000).toFixed(0), "K tokens"] }), category.children && (_jsx(Box, { sx: { ml: 3, mt: 1 }, children: category.children.map((item) => (_jsxs(Text, { sx: { display: 'block' }, children: ["\u2022 ", item.name, ": ", (item.value / 1000).toFixed(0), "K tokens"] }, item.name))) }))] }, category.name)))] }))] })), agentName && showAvatarView && (_jsxs(Box, { sx: {
|
|
250
|
+
mt: 2,
|
|
251
|
+
p: 3,
|
|
252
|
+
border: '1px solid',
|
|
253
|
+
borderColor: 'border.default',
|
|
254
|
+
borderRadius: 2,
|
|
255
|
+
bg: 'canvas.subtle',
|
|
256
|
+
}, children: [_jsx(Text, { sx: {
|
|
257
|
+
fontSize: 1,
|
|
258
|
+
fontWeight: 'bold',
|
|
259
|
+
display: 'block',
|
|
260
|
+
mb: 3,
|
|
261
|
+
}, children: "Share and Collaborate" }), _jsxs(Box, { sx: { mb: 3 }, children: [_jsx(Text, { sx: {
|
|
262
|
+
fontSize: 0,
|
|
263
|
+
fontWeight: 'semibold',
|
|
264
|
+
display: 'block',
|
|
265
|
+
mb: 2,
|
|
266
|
+
}, children: "Current Members" }), _jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 2 }, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Avatar, { size: 32, alt: "Primer logo", src: "https://avatars.githubusercontent.com/primer" }), _jsxs(Box, { sx: { flex: 1 }, children: [_jsx(Text, { sx: {
|
|
267
|
+
fontSize: 0,
|
|
268
|
+
fontWeight: 'semibold',
|
|
269
|
+
display: 'block',
|
|
270
|
+
}, children: "Primer" }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "primer@github.com" })] }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Admin" })] }), _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Avatar, { size: 32, alt: "GitHub logo", src: "https://avatars.githubusercontent.com/github" }), _jsxs(Box, { sx: { flex: 1 }, children: [_jsx(Text, { sx: {
|
|
271
|
+
fontSize: 0,
|
|
272
|
+
fontWeight: 'semibold',
|
|
273
|
+
display: 'block',
|
|
274
|
+
}, children: "GitHub" }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "support@github.com" })] }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Read-Write" })] }), _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Avatar, { size: 32, alt: "Atom logo", src: "https://avatars.githubusercontent.com/atom" }), _jsxs(Box, { sx: { flex: 1 }, children: [_jsx(Text, { sx: {
|
|
275
|
+
fontSize: 0,
|
|
276
|
+
fontWeight: 'semibold',
|
|
277
|
+
display: 'block',
|
|
278
|
+
}, children: "Atom" }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "atom@github.com" })] }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Read-Only" })] }), _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Avatar, { size: 32, alt: "GitHub Desktop logo", src: "https://avatars.githubusercontent.com/desktop" }), _jsxs(Box, { sx: { flex: 1 }, children: [_jsx(Text, { sx: {
|
|
279
|
+
fontSize: 0,
|
|
280
|
+
fontWeight: 'semibold',
|
|
281
|
+
display: 'block',
|
|
282
|
+
}, children: "GitHub Desktop" }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "desktop@github.com" })] }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Read-Write" })] })] })] }), _jsx(Box, { sx: { mb: 3 }, children: _jsxs(FormControl, { children: [_jsx(FormControl.Label, { children: "Add people" }), _jsx(TextInput, { placeholder: "Enter email address", sx: { width: '100%' } })] }) }), _jsx(Box, { sx: { mb: 3 }, children: _jsxs(FormControl, { children: [_jsx(FormControl.Label, { children: "Message" }), _jsx(TextInput, { placeholder: "Optional message for invitees", sx: { width: '100%' } })] }) }), _jsxs(Box, { children: [_jsx(Text, { sx: {
|
|
283
|
+
fontSize: 0,
|
|
284
|
+
fontWeight: 'semibold',
|
|
285
|
+
display: 'block',
|
|
286
|
+
mb: 2,
|
|
287
|
+
}, children: "General Access" }), _jsx(Box, { sx: {
|
|
288
|
+
p: 2,
|
|
289
|
+
border: '1px solid',
|
|
290
|
+
borderColor: 'border.default',
|
|
291
|
+
borderRadius: 2,
|
|
292
|
+
bg: 'canvas.default',
|
|
293
|
+
}, children: _jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 2 }, children: [_jsxs(Box, { sx: { display: 'flex', justifyContent: 'space-between' }, children: [_jsx(Text, { sx: { fontSize: 0 }, children: "foo" }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Read-Only" })] }), _jsxs(Box, { sx: { display: 'flex', justifyContent: 'space-between' }, children: [_jsx(Text, { sx: { fontSize: 0 }, children: "bar" }), _jsx(Text, { sx: { fontSize: 0, color: 'fg.muted' }, children: "Read-Write" })] })] }) })] })] }))] }));
|
|
294
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface HeaderControlsProps {
|
|
3
|
+
onToggleContextTree: () => void;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Header Controls Component
|
|
7
|
+
*
|
|
8
|
+
* Contains the context toggle sparkline.
|
|
9
|
+
*/
|
|
10
|
+
export declare const HeaderControls: React.FC<HeaderControlsProps>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from '@datalayer/primer-addons';
|
|
3
|
+
import { Sparklines, SparklinesLine } from '../../components/sparklines';
|
|
4
|
+
/**
|
|
5
|
+
* Header Controls Component
|
|
6
|
+
*
|
|
7
|
+
* Contains the context toggle sparkline.
|
|
8
|
+
*/
|
|
9
|
+
export const HeaderControls = ({ onToggleContextTree, }) => {
|
|
10
|
+
// Sample data for the sparkline - in production, this would come from props or state
|
|
11
|
+
const sparklineData = [
|
|
12
|
+
120, 200, 150, 180, 170, 210, 200, 220, 180, 210, 230, 250, 260, 270, 280,
|
|
13
|
+
290, 300, 320, 310, 330,
|
|
14
|
+
];
|
|
15
|
+
return (_jsx(Box, { sx: {
|
|
16
|
+
display: 'flex',
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
gap: 2,
|
|
19
|
+
cursor: 'pointer',
|
|
20
|
+
'&:hover': {
|
|
21
|
+
opacity: 0.8,
|
|
22
|
+
},
|
|
23
|
+
}, onClick: onToggleContextTree, children: _jsx(Box, { sx: { width: '120px', height: '30px' }, children: _jsx(Sparklines, { data: sparklineData, width: 120, height: 30, children: _jsx(SparklinesLine, { color: "#0969da", style: { strokeWidth: '2' } }) }) }) }));
|
|
24
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import 'prismjs';
|
|
2
|
+
import 'prismjs/components/prism-clike';
|
|
3
|
+
import 'prismjs/components/prism-javascript';
|
|
4
|
+
import 'prismjs/components/prism-markup';
|
|
5
|
+
import 'prismjs/components/prism-markdown';
|
|
6
|
+
import 'prismjs/components/prism-c';
|
|
7
|
+
import 'prismjs/components/prism-css';
|
|
8
|
+
import 'prismjs/components/prism-objectivec';
|
|
9
|
+
import 'prismjs/components/prism-sql';
|
|
10
|
+
import 'prismjs/components/prism-python';
|
|
11
|
+
import 'prismjs/components/prism-rust';
|
|
12
|
+
import 'prismjs/components/prism-swift';
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import type { ServiceManager } from '@jupyterlab/services';
|
|
15
|
+
import '@datalayer/jupyter-lexical/style/index.css';
|
|
16
|
+
import '../lexical/lexical-theme.css';
|
|
17
|
+
interface LexicalEditorProps {
|
|
18
|
+
content?: string;
|
|
19
|
+
serviceManager?: ServiceManager.IManager;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Lexical Editor Component
|
|
23
|
+
*
|
|
24
|
+
* Rich text editor with Simple integration.
|
|
25
|
+
*/
|
|
26
|
+
export declare const LexicalEditor: React.FC<LexicalEditorProps>;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
4
|
+
* Distributed under the terms of the Modified BSD License.
|
|
5
|
+
*/
|
|
6
|
+
import 'prismjs';
|
|
7
|
+
import 'prismjs/components/prism-clike';
|
|
8
|
+
import 'prismjs/components/prism-javascript';
|
|
9
|
+
import 'prismjs/components/prism-markup';
|
|
10
|
+
import 'prismjs/components/prism-markdown';
|
|
11
|
+
import 'prismjs/components/prism-c';
|
|
12
|
+
import 'prismjs/components/prism-css';
|
|
13
|
+
import 'prismjs/components/prism-objectivec';
|
|
14
|
+
import 'prismjs/components/prism-sql';
|
|
15
|
+
import 'prismjs/components/prism-python';
|
|
16
|
+
import 'prismjs/components/prism-rust';
|
|
17
|
+
import 'prismjs/components/prism-swift';
|
|
18
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
19
|
+
import { $getRoot, $createParagraphNode } from 'lexical';
|
|
20
|
+
import { LexicalComposer } from '@lexical/react/LexicalComposer';
|
|
21
|
+
import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin';
|
|
22
|
+
import { ContentEditable } from '@lexical/react/LexicalContentEditable';
|
|
23
|
+
import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin';
|
|
24
|
+
import { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin';
|
|
25
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
26
|
+
import { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary';
|
|
27
|
+
import { AutoFocusPlugin } from '@lexical/react/LexicalAutoFocusPlugin';
|
|
28
|
+
import { MarkdownShortcutPlugin } from '@lexical/react/LexicalMarkdownShortcutPlugin';
|
|
29
|
+
import { TRANSFORMERS } from '@lexical/markdown';
|
|
30
|
+
import { registerCodeHighlighting } from '@lexical/code';
|
|
31
|
+
import { ListPlugin } from '@lexical/react/LexicalListPlugin';
|
|
32
|
+
import { CheckListPlugin } from '@lexical/react/LexicalCheckListPlugin';
|
|
33
|
+
import { LinkPlugin } from '@lexical/react/LexicalLinkPlugin';
|
|
34
|
+
import { Box } from '@datalayer/primer-addons';
|
|
35
|
+
import { JupyterReactTheme, useJupyter } from '@datalayer/jupyter-react';
|
|
36
|
+
import { ComponentPickerMenuPlugin, JupyterCellPlugin, JupyterInputOutputPlugin, DraggableBlockPlugin, ImagesPlugin, HorizontalRulePlugin, EquationsPlugin, YouTubePlugin, AutoLinkPlugin, AutoEmbedPlugin, LexicalConfigProvider, LexicalStatePlugin, FloatingTextFormatToolbarPlugin, CodeActionMenuPlugin, ListMaxIndentLevelPlugin, } from '@datalayer/jupyter-lexical';
|
|
37
|
+
import { editorConfig } from '../lexical/editorConfig';
|
|
38
|
+
import '@datalayer/jupyter-lexical/style/index.css';
|
|
39
|
+
import '../lexical/lexical-theme.css';
|
|
40
|
+
const LEXICAL_ID = 'agent-runtime-lexical-editor';
|
|
41
|
+
const INITIAL_CONTENT = undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Lexical plugin for loading initial content into the editor.
|
|
44
|
+
*/
|
|
45
|
+
function LoadContentPlugin({ content }) {
|
|
46
|
+
const [editor] = useLexicalComposerContext();
|
|
47
|
+
const isFirstRender = useRef(true);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (!content || !isFirstRender.current) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
isFirstRender.current = false;
|
|
53
|
+
try {
|
|
54
|
+
const parsed = JSON.parse(content);
|
|
55
|
+
if (parsed && typeof parsed === 'object' && parsed.root) {
|
|
56
|
+
const editorState = editor.parseEditorState(content);
|
|
57
|
+
editor.setEditorState(editorState, {
|
|
58
|
+
tag: 'history-merge',
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
throw new Error('Invalid Lexical editor state format');
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
editor.update(() => {
|
|
67
|
+
const root = $getRoot();
|
|
68
|
+
root.clear();
|
|
69
|
+
const paragraph = $createParagraphNode();
|
|
70
|
+
root.append(paragraph);
|
|
71
|
+
}, {
|
|
72
|
+
tag: 'history-merge',
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}, [content, editor]);
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Lexical plugin for Simple code syntax highlighting.
|
|
80
|
+
*/
|
|
81
|
+
function CodeHighlightPlugin() {
|
|
82
|
+
const [editor] = useLexicalComposerContext();
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
return registerCodeHighlighting(editor);
|
|
85
|
+
}, [editor]);
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Wrapper component for kernel-dependent Simple plugins.
|
|
90
|
+
*/
|
|
91
|
+
function SimpleKernelPluginsInner() {
|
|
92
|
+
const { defaultKernel } = useJupyter();
|
|
93
|
+
return (_jsxs(_Fragment, { children: [_jsx(ComponentPickerMenuPlugin, { kernel: defaultKernel }), _jsx(JupyterInputOutputPlugin, { kernel: defaultKernel })] }));
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Lexical Editor Component
|
|
97
|
+
*
|
|
98
|
+
* Rich text editor with Simple integration.
|
|
99
|
+
*/
|
|
100
|
+
export const LexicalEditor = ({ content = INITIAL_CONTENT, serviceManager, }) => {
|
|
101
|
+
const [floatingAnchorElem, setFloatingAnchorElem] = useState(null);
|
|
102
|
+
const onRef = (_floatingAnchorElem) => {
|
|
103
|
+
if (_floatingAnchorElem !== null) {
|
|
104
|
+
setFloatingAnchorElem(_floatingAnchorElem);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const handleChange = useCallback((_editorState) => {
|
|
108
|
+
// onChange handler - can be used for tracking changes
|
|
109
|
+
}, []);
|
|
110
|
+
return (_jsx(Box, { sx: {
|
|
111
|
+
border: '1px solid',
|
|
112
|
+
borderColor: 'border.default',
|
|
113
|
+
borderRadius: 2,
|
|
114
|
+
padding: 3,
|
|
115
|
+
backgroundColor: 'canvas.default',
|
|
116
|
+
minHeight: '600px',
|
|
117
|
+
}, children: _jsx(LexicalConfigProvider, { lexicalId: LEXICAL_ID, serviceManager: serviceManager, children: _jsx(LexicalComposer, { initialConfig: editorConfig, children: _jsxs("div", { className: "lexical-editor-inner", ref: onRef, children: [_jsx(LexicalStatePlugin, {}), _jsx(RichTextPlugin, { contentEditable: _jsx(ContentEditable, { className: "lexical-editor-content", "aria-label": "Lexical Editor" }), ErrorBoundary: LexicalErrorBoundary }), _jsx(OnChangePlugin, { onChange: handleChange }), _jsx(HistoryPlugin, {}), _jsx(AutoFocusPlugin, {}), _jsx(ListPlugin, {}), _jsx(CheckListPlugin, {}), _jsx(LinkPlugin, {}), _jsx(AutoLinkPlugin, {}), _jsx(ListMaxIndentLevelPlugin, { maxDepth: 7 }), _jsx(MarkdownShortcutPlugin, { transformers: TRANSFORMERS }), _jsx(LoadContentPlugin, { content: content }), _jsx(CodeHighlightPlugin, {}), _jsx(ImagesPlugin, { captionsEnabled: false }), _jsx(HorizontalRulePlugin, {}), _jsx(EquationsPlugin, {}), _jsx(YouTubePlugin, {}), _jsx(AutoEmbedPlugin, {}), _jsx(JupyterCellPlugin, {}), _jsx(JupyterReactTheme, { children: _jsx(SimpleKernelPluginsInner, {}) }), floatingAnchorElem && (_jsxs(_Fragment, { children: [_jsx(DraggableBlockPlugin, { anchorElem: floatingAnchorElem }), _jsx(FloatingTextFormatToolbarPlugin, { anchorElem: floatingAnchorElem }), _jsx(CodeActionMenuPlugin, { anchorElem: floatingAnchorElem })] }))] }) }) }) }));
|
|
118
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ServiceManager } from '@jupyterlab/services';
|
|
3
|
+
interface MainContentProps {
|
|
4
|
+
showNotebook: boolean;
|
|
5
|
+
timeTravel: number;
|
|
6
|
+
onTimeTravelChange: (value: number) => void;
|
|
7
|
+
richEditor: boolean;
|
|
8
|
+
notebookFile?: string;
|
|
9
|
+
lexicalFile?: string;
|
|
10
|
+
isNewAgent?: boolean;
|
|
11
|
+
serviceManager?: ServiceManager.IManager;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Main Content Component
|
|
15
|
+
*
|
|
16
|
+
* Displays the main content area with Simple notebook viewer or Lexical editor and time travel.
|
|
17
|
+
*/
|
|
18
|
+
export declare const MainContent: React.FC<MainContentProps>;
|
|
19
|
+
export {};
|