@datalayer/agent-runtimes 1.0.29 → 1.3.11
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/lib/AgentDocument.js +5 -22
- package/lib/AgentNode.d.ts +1 -1
- package/lib/AgentNode.js +193 -23
- package/lib/AgentNotebook.js +1 -1
- package/lib/App.d.ts +1 -1
- package/lib/AppExamples2.d.ts +1 -1
- package/lib/agent-node/AgentNodeGallery.d.ts +14 -1
- package/lib/agent-node/AgentNodeGallery.js +19 -15
- package/lib/agent-node/themeStore.js +7 -6
- package/lib/agents/AgentDetails.d.ts +8 -2
- package/lib/agents/AgentDetails.js +41 -11
- package/lib/agents/AgentRuntimeChat.d.ts +3 -3
- package/lib/agents/AgentRuntimeChat.js +15 -15
- package/lib/api/agents.d.ts +10 -10
- package/lib/api/agents.js +15 -15
- package/lib/api/checkpoints.d.ts +40 -0
- package/lib/api/checkpoints.js +75 -0
- package/lib/api/index.d.ts +1 -0
- package/lib/api/index.js +2 -1
- package/lib/api/notifications.d.ts +21 -6
- package/lib/api/notifications.js +32 -14
- package/lib/api/runtimes/environments.d.ts +406 -4
- package/lib/api/runtimes/environments.js +641 -9
- package/lib/api/runtimes/runtimes.d.ts +19 -19
- package/lib/api/runtimes/runtimes.js +47 -46
- package/lib/api/spacer/notebooks.js +1 -1
- package/lib/chat/Chat.d.ts +16 -4
- package/lib/chat/Chat.js +18 -5
- package/lib/chat/ChatFloating.d.ts +20 -2
- package/lib/chat/ChatFloating.js +196 -118
- package/lib/chat/ChatInline.d.ts +15 -0
- package/lib/chat/ChatInline.js +0 -18
- package/lib/chat/ChatPopupStandalone.d.ts +1 -1
- package/lib/chat/ChatSidebar.d.ts +14 -2
- package/lib/chat/ChatSidebar.js +1 -1
- package/lib/chat/ChatStandalone.d.ts +1 -1
- package/lib/chat/EphemeralSurfaceControl.d.ts +30 -0
- package/lib/chat/EphemeralSurfaceControl.js +55 -0
- package/lib/chat/base/ChatAvailability.d.ts +34 -0
- package/lib/chat/base/ChatAvailability.js +18 -0
- package/lib/chat/base/ChatBase.d.ts +2 -1
- package/lib/chat/base/ChatBase.js +657 -28
- package/lib/chat/display/ButtonGlow.d.ts +9 -0
- package/lib/chat/display/ButtonGlow.js +60 -0
- package/lib/chat/display/EmptyState.d.ts +15 -1
- package/lib/chat/display/EmptyState.js +81 -12
- package/lib/chat/display/FloatingBrandButton.d.ts +1 -1
- package/lib/chat/display/PoweredByTag.d.ts +1 -1
- package/lib/chat/display/groupSuggestions.d.ts +21 -0
- package/lib/chat/display/groupSuggestions.js +18 -0
- package/lib/chat/document/EphemeralDocument.d.ts +70 -6
- package/lib/chat/document/EphemeralDocument.js +154 -52
- package/lib/chat/header/ChatHeader.d.ts +1 -1
- package/lib/chat/header/ChatHeaderBase.d.ts +10 -1
- package/lib/chat/header/ChatHeaderBase.js +21 -102
- package/lib/chat/header/ChatViewModeToggle.d.ts +29 -0
- package/lib/chat/header/ChatViewModeToggle.js +55 -0
- package/lib/chat/index.d.ts +5 -1
- package/lib/chat/index.js +9 -1
- package/lib/chat/indicators/McpStatusIndicator.d.ts +1 -1
- package/lib/chat/indicators/SandboxStatusIndicator.d.ts +1 -1
- package/lib/chat/indicators/SandboxStatusIndicator.js +1 -1
- package/lib/chat/indicators/SkillsStatusIndicator.d.ts +1 -1
- package/lib/chat/messages/ChatMessageList.d.ts +22 -1
- package/lib/chat/messages/ChatMessageList.js +370 -166
- package/lib/chat/messages/ChatMessages.d.ts +1 -1
- package/lib/chat/messages/NotebookToolSurfaces.d.ts +68 -0
- package/lib/chat/messages/NotebookToolSurfaces.js +302 -0
- package/lib/chat/messages/TurnFooter.d.ts +42 -0
- package/lib/chat/messages/TurnFooter.js +75 -0
- package/lib/chat/messages/assistantMarkdown.d.ts +22 -0
- package/lib/chat/messages/assistantMarkdown.js +56 -0
- package/lib/chat/notebook/EphemeralNotebook.d.ts +67 -6
- package/lib/chat/notebook/EphemeralNotebook.js +194 -61
- package/lib/chat/parts/DynamicToolPart.d.ts +1 -1
- package/lib/chat/parts/MessagePart.d.ts +1 -1
- package/lib/chat/parts/ReasoningPart.d.ts +8 -1
- package/lib/chat/parts/TextPart.d.ts +1 -1
- package/lib/chat/parts/ToolPart.d.ts +8 -1
- package/lib/chat/prompt/FloatingCard.d.ts +26 -0
- package/lib/chat/prompt/FloatingCard.js +80 -0
- package/lib/chat/prompt/InputPrompt.d.ts +206 -53
- package/lib/chat/prompt/InputPrompt.js +161 -80
- package/lib/chat/prompt/InputPromptBase.d.ts +112 -0
- package/lib/chat/prompt/InputPromptBase.js +225 -0
- package/lib/chat/prompt/InputPromptLexical.d.ts +18 -1
- package/lib/chat/prompt/InputPromptLexical.js +227 -30
- package/lib/chat/prompt/InputPromptText.d.ts +10 -2
- package/lib/chat/prompt/InputPromptText.js +35 -3
- package/lib/chat/prompt/footer/BelowPromptFooter.d.ts +25 -0
- package/lib/chat/prompt/footer/BelowPromptFooter.js +12 -0
- package/lib/chat/prompt/footer/InPromptFooter.d.ts +35 -0
- package/lib/chat/prompt/footer/InPromptFooter.js +16 -0
- package/lib/chat/prompt/footer/index.d.ts +7 -0
- package/lib/chat/prompt/footer/index.js +11 -0
- package/lib/chat/prompt/header/BelowPromptHeader.d.ts +23 -0
- package/lib/chat/prompt/header/BelowPromptHeader.js +12 -0
- package/lib/chat/prompt/header/InPromptHeader.d.ts +31 -0
- package/lib/chat/prompt/header/InPromptHeader.js +14 -0
- package/lib/chat/prompt/header/index.d.ts +7 -0
- package/lib/chat/prompt/header/index.js +11 -0
- package/lib/chat/prompt/index.d.ts +8 -4
- package/lib/chat/prompt/index.js +15 -3
- package/lib/chat/prompt/menus/AgentsMenu.d.ts +14 -0
- package/lib/chat/prompt/menus/AgentsMenu.js +42 -0
- package/lib/chat/prompt/menus/InlineAgentsMenu.d.ts +22 -0
- package/lib/chat/prompt/menus/InlineAgentsMenu.js +24 -0
- package/lib/chat/prompt/menus/ModelSelector.d.ts +7 -0
- package/lib/chat/prompt/menus/ModelSelector.js +27 -0
- package/lib/chat/prompt/menus/SkillsMenu.d.ts +10 -0
- package/lib/chat/prompt/menus/SkillsMenu.js +75 -0
- package/lib/chat/prompt/menus/SuggestionsMenu.d.ts +13 -0
- package/lib/chat/prompt/menus/SuggestionsMenu.js +31 -0
- package/lib/chat/prompt/menus/ToolsMenu.d.ts +13 -0
- package/lib/chat/prompt/menus/ToolsMenu.js +103 -0
- package/lib/chat/prompt/menus/index.d.ts +15 -0
- package/lib/chat/prompt/menus/index.js +19 -0
- package/lib/chat/prompt/plugins/AgentMentionPlugin.d.ts +54 -0
- package/lib/chat/prompt/plugins/AgentMentionPlugin.js +370 -0
- package/lib/chat/prompt/plugins/CommandPlugin.d.ts +52 -0
- package/lib/chat/prompt/plugins/CommandPlugin.js +359 -0
- package/lib/chat/prompt/plugins/MentionChip.d.ts +15 -0
- package/lib/chat/prompt/plugins/MentionChip.js +24 -0
- package/lib/chat/prompt/plugins/MentionNode.d.ts +66 -0
- package/lib/chat/prompt/plugins/MentionNode.js +77 -0
- package/lib/chat/prompt/promptHistory.d.ts +52 -0
- package/lib/chat/prompt/promptHistory.js +123 -0
- package/lib/chat/prompt/stack.d.ts +81 -0
- package/lib/chat/prompt/stack.js +41 -0
- package/lib/chat/prompt/useTypingPlaceholder.d.ts +52 -0
- package/lib/chat/prompt/useTypingPlaceholder.js +180 -0
- package/lib/chat/tools/A2AAgentDialog.d.ts +60 -0
- package/lib/chat/tools/A2AAgentDialog.js +265 -0
- package/lib/chat/tools/ToolApprovalBanner.d.ts +1 -1
- package/lib/chat/tools/ToolApprovalDialog.d.ts +1 -1
- package/lib/chat/tools/ToolCallDisplay.d.ts +8 -1
- package/lib/chat/tools/index.d.ts +1 -0
- package/lib/chat/tools/index.js +1 -0
- package/lib/chat/usage/ContextPie.d.ts +17 -0
- package/lib/chat/usage/{TokenUsageBar.js → ContextPie.js} +20 -14
- package/lib/chat/useViewportDrag.d.ts +11 -0
- package/lib/chat/useViewportDrag.js +61 -0
- package/lib/chat/viewModes.d.ts +51 -0
- package/lib/chat/viewModes.js +57 -0
- package/lib/client/AgentRuntimesClient.d.ts +10 -9
- package/lib/client/AgentRuntimesClient.js +1 -1
- package/lib/client/AgentRuntimesClientContext.d.ts +1 -0
- package/lib/client/AgentsMixin.d.ts +12 -12
- package/lib/client/AgentsMixin.js +31 -31
- package/lib/client/IAgentRuntimesClient.d.ts +10 -10
- package/lib/client/SdkAgentRuntimesClient.d.ts +10 -10
- package/lib/client/SdkAgentRuntimesClient.js +10 -10
- package/lib/client/mixins/RuntimesMixin.d.ts +37 -10
- package/lib/client/mixins/RuntimesMixin.js +54 -21
- package/lib/components/a2ui/A2uiSurfaceComposed.d.ts +1 -1
- package/lib/components/agents/AgentSummary.d.ts +13 -0
- package/lib/components/agents/AgentSummary.js +21 -4
- package/lib/components/cards/NotificationEventCard.d.ts +1 -1
- package/lib/components/cards/OutputCard.d.ts +1 -1
- package/lib/components/cards/ToolApprovalCard.d.ts +2 -2
- package/lib/components/cards/ToolApprovalCard.js +1 -0
- package/lib/components/code-sandboxes/CodeSandboxCellVariables.d.ts +1 -0
- package/lib/components/code-sandboxes/CodeSandboxCellVariables.js +0 -4
- package/lib/components/code-sandboxes/CodeSandboxCellVariablesDialog.d.ts +1 -0
- package/lib/components/code-sandboxes/CodeSandboxCellVariablesDialog.js +0 -4
- package/lib/components/code-sandboxes/CodeSandboxEnvironmentSelect.d.ts +35 -0
- package/lib/components/code-sandboxes/CodeSandboxEnvironmentSelect.js +27 -29
- package/lib/components/code-sandboxes/CodeSandboxLauncher.d.ts +9 -0
- package/lib/components/code-sandboxes/CodeSandboxLauncher.js +95 -23
- package/lib/components/code-sandboxes/CodeSandboxNames.js +7 -6
- package/lib/components/code-sandboxes/CodeSandboxPicker.js +89 -42
- package/lib/components/code-sandboxes/CodeSandboxPickerCell.d.ts +1 -0
- package/lib/components/code-sandboxes/CodeSandboxPickerCell.js +0 -4
- package/lib/components/code-sandboxes/CodeSandboxReservationControl.d.ts +1 -0
- package/lib/components/code-sandboxes/CodeSandboxReservationControl.js +5 -7
- package/lib/components/code-sandboxes/CodeSandboxTransfer.d.ts +5 -0
- package/lib/components/code-sandboxes/CodeSandboxUtils.d.ts +13 -1
- package/lib/components/code-sandboxes/CodeSandboxUtils.js +10 -4
- package/lib/components/code-sandboxes/NewCodeSandboxControls.d.ts +21 -15
- package/lib/components/code-sandboxes/NewCodeSandboxControls.js +28 -51
- package/lib/components/code-sandboxes/codeSandboxAllowance.d.ts +33 -0
- package/lib/components/code-sandboxes/codeSandboxAllowance.js +37 -0
- package/lib/components/code-sandboxes/codeSandboxEnvironments.d.ts +97 -0
- package/lib/components/code-sandboxes/codeSandboxEnvironments.js +184 -0
- package/lib/components/code-sandboxes/codeSandboxProviders.js +14 -5
- package/lib/components/code-sandboxes/index.d.ts +1 -0
- package/lib/components/code-sandboxes/index.js +1 -0
- package/lib/components/context/SpaceSelect.d.ts +1 -1
- package/lib/components/flashes/FlashDisclaimer.d.ts +1 -1
- package/lib/components/icons/ArtifactIcon.d.ts +1 -0
- package/lib/components/icons/ArtifactIcon.js +2 -1
- package/lib/components/nbgrader/NbGradesDetails.d.ts +1 -1
- package/lib/components/progress/CreditsIndicator.d.ts +1 -0
- package/lib/components/progress/CreditsIndicator.js +0 -4
- package/lib/components/scheduler/ScheduleMenu.d.ts +1 -1
- package/lib/components/snapshots/SandboxSnapshotMenu.d.ts +3 -2
- package/lib/components/snapshots/SandboxSnapshotMenu.js +11 -15
- package/lib/components/snippets/SnippetDialog.d.ts +1 -0
- package/lib/components/snippets/SnippetDialog.js +0 -4
- package/lib/components/specs/SpecPayloadPreview.d.ts +34 -0
- package/lib/components/specs/SpecPayloadPreview.js +102 -0
- package/lib/components/tokens/SpaceVariantToken.d.ts +1 -1
- package/lib/context/ContextDistribution.d.ts +1 -1
- package/lib/context/ContextInspector.d.ts +2 -1
- package/lib/context/ContextPanel.d.ts +1 -1
- package/lib/context/ContextUsage.d.ts +1 -1
- package/lib/context/CostTracker.d.ts +1 -1
- package/lib/context/CostUsageChart.d.ts +1 -1
- package/lib/context/CostUsageChart.js +4 -4
- package/lib/context/MessageHistory.d.ts +3 -2
- package/lib/context/TokenUsageChart.d.ts +1 -1
- package/lib/context/TokenUsageChart.js +4 -4
- package/lib/examples/A2UiAgentExample.js +15 -6
- package/lib/examples/A2UiComponentsGalleryExample.d.ts +10 -0
- package/lib/examples/A2UiComponentsGalleryExample.js +24 -855
- package/lib/examples/A2UiContactCardExample.d.ts +10 -0
- package/lib/examples/A2UiContactCardExample.js +23 -170
- package/lib/examples/A2UiJupyterOutputExample.d.ts +3 -0
- package/lib/examples/A2UiJupyterOutputExample.js +792 -0
- package/lib/examples/A2UiRestaurantExample.d.ts +10 -0
- package/lib/examples/A2UiRestaurantExample.js +24 -179
- package/lib/examples/A2UiViewerExample.d.ts +10 -0
- package/lib/examples/A2UiViewerExample.js +24 -378
- package/lib/examples/AgUiAgenticExample.js +2 -4
- package/lib/examples/AgUiBackendToolRenderingExample.js +3 -5
- package/lib/examples/AgUiHaikuGenUiExample.js +2 -4
- package/lib/examples/AgUiHumanInTheLoopExample.js +2 -4
- package/lib/examples/AgUiSharedStateExample.js +2 -4
- package/lib/examples/AgUiToolsBasedGenUiExample.js +2 -4
- package/lib/examples/AgentA2AExample.d.ts +17 -0
- package/lib/examples/AgentA2AExample.js +56 -0
- package/lib/examples/AgentCheckpointsExample.d.ts +9 -10
- package/lib/examples/AgentCheckpointsExample.js +72 -54
- package/lib/examples/AgentCodeSandboxExample.d.ts +7 -7
- package/lib/examples/AgentCodeSandboxExample.js +93 -303
- package/lib/examples/AgentCodeSandboxesExample.d.ts +10 -0
- package/lib/examples/AgentCodeSandboxesExample.js +56 -162
- package/lib/examples/AgentCodemodeExample.d.ts +7 -2
- package/lib/examples/AgentCodemodeExample.js +60 -125
- package/lib/examples/AgentCompactionExample.js +19 -135
- package/lib/examples/AgentEvalsExample.js +34 -66
- package/lib/examples/AgentGuardrailsExample.js +64 -112
- package/lib/examples/AgentHooksExample.d.ts +11 -0
- package/lib/examples/AgentHooksExample.js +30 -67
- package/lib/examples/AgentInferenceProviderExample.js +8 -32
- package/lib/examples/AgentLoopExample.d.ts +4 -2
- package/lib/examples/AgentLoopExample.js +45 -93
- package/lib/examples/AgentMCPExample.js +30 -79
- package/lib/examples/AgentMemoryExample.js +21 -64
- package/lib/examples/AgentMonitoringExample.js +33 -94
- package/lib/examples/AgentNotificationsExample.js +56 -95
- package/lib/examples/AgentOtelExample.js +35 -88
- package/lib/examples/AgentOutputsExample.d.ts +2 -1
- package/lib/examples/AgentOutputsExample.js +16 -137
- package/lib/examples/AgentParametersExample.js +7 -17
- package/lib/examples/AgentSkillsExample.js +40 -154
- package/lib/examples/AgentSubagentsExample.d.ts +7 -6
- package/lib/examples/AgentSubagentsExample.js +80 -191
- package/lib/examples/AgentToolApprovalsExample.js +35 -91
- package/lib/examples/AgentTriggersExample.js +43 -59
- package/lib/examples/AgentspecsExample.js +4 -4
- package/lib/examples/CellExample.d.ts +1 -1
- package/lib/examples/ChatExample.d.ts +12 -5
- package/lib/examples/ChatExample.js +38 -13
- package/lib/examples/CopilotKitLexicalExample.d.ts +1 -0
- package/lib/examples/CopilotKitLexicalExample.js +4 -41
- package/lib/examples/CopilotKitNotebookExample.d.ts +10 -0
- package/lib/examples/CopilotKitNotebookExample.js +2 -14
- package/lib/examples/DecksAgent.d.ts +21 -0
- package/lib/examples/DecksAgent.js +23 -0
- package/lib/examples/DocumentPageAgent.d.ts +19 -0
- package/lib/examples/DocumentPageAgent.js +15 -0
- package/lib/examples/Lexical2Example.d.ts +2 -2
- package/lib/examples/Lexical2Example.js +17 -38
- package/lib/examples/LexicalAgentExample.d.ts +2 -1
- package/lib/examples/LexicalAgentExample.js +29 -102
- package/lib/examples/LexicalAgentSidebarExample.d.ts +16 -5
- package/lib/examples/LexicalAgentSidebarExample.js +99 -131
- package/lib/examples/LoopShellExample.d.ts +38 -0
- package/lib/examples/LoopShellExample.js +68 -0
- package/lib/examples/LoopWorkspaceEmbed.d.ts +50 -0
- package/lib/examples/LoopWorkspaceEmbed.js +73 -0
- package/lib/examples/LoopWorkspaceExample.d.ts +150 -0
- package/lib/examples/LoopWorkspaceExample.js +151 -0
- package/lib/examples/NotebookAgentExample.d.ts +13 -0
- package/lib/examples/NotebookAgentExample.js +36 -86
- package/lib/examples/NotebookAgentSidebarExample.d.ts +10 -4
- package/lib/examples/NotebookAgentSidebarExample.js +39 -83
- package/lib/examples/NotebookCollaborationExample.d.ts +1 -1
- package/lib/examples/NotebookCollaborationExample.js +108 -20
- package/lib/examples/NotebookExample.d.ts +1 -1
- package/lib/examples/NotebookExample.js +20 -10
- package/lib/examples/NotebookPageAgent.d.ts +23 -0
- package/lib/examples/NotebookPageAgent.js +17 -0
- package/lib/examples/components/ExampleWrapper.d.ts +5 -0
- package/lib/examples/components/ExampleWrapper.js +36 -28
- package/lib/examples/components/LexicalEditor.d.ts +1 -1
- package/lib/examples/components/LexicalEditor.js +4 -24
- package/lib/examples/components/haiku/HaikuDisplay.d.ts +1 -1
- package/lib/examples/components/haiku/InlineHaikuCard.d.ts +1 -1
- package/lib/examples/components/weather/InlineWeatherCard.d.ts +1 -1
- package/lib/examples/example-selector.js +26 -6
- package/lib/examples/hooks/useCreateAgentOnce.d.ts +41 -0
- package/lib/examples/hooks/useCreateAgentOnce.js +51 -0
- package/lib/examples/hooks/useExampleAgentProtocol.d.ts +35 -0
- package/lib/examples/hooks/useExampleAgentProtocol.js +63 -0
- package/lib/examples/hooks/useExampleAgentRuntime.d.ts +16 -16
- package/lib/examples/hooks/useExampleAgentRuntime.js +26 -25
- package/lib/examples/hooks/useExampleAgentRuntimes.js +45 -61
- package/lib/examples/hooks/useExampleJupyterAgent.d.ts +91 -0
- package/lib/examples/hooks/useExampleJupyterAgent.js +151 -0
- package/lib/examples/index.d.ts +4 -0
- package/lib/examples/index.js +6 -0
- package/lib/examples/lexical/editorConfig.d.ts +2 -75
- package/lib/examples/lexical/editorConfig.js +26 -48
- package/lib/examples/lexical/lexical-theme.css +65 -47
- package/lib/examples/main.js +450 -322
- package/lib/examples/scenes/A2UiComponentsGalleryScene.d.ts +3 -0
- package/lib/examples/scenes/A2UiComponentsGalleryScene.js +872 -0
- package/lib/examples/scenes/A2UiContactCardScene.d.ts +3 -0
- package/lib/examples/scenes/A2UiContactCardScene.js +188 -0
- package/lib/examples/scenes/A2UiRestaurantScene.d.ts +3 -0
- package/lib/examples/scenes/A2UiRestaurantScene.js +196 -0
- package/lib/examples/scenes/A2UiViewerScene.d.ts +3 -0
- package/lib/examples/scenes/A2UiViewerScene.js +395 -0
- package/lib/examples/utils/agentSummaryStore.d.ts +7 -1
- package/lib/examples/utils/agents/earthquake-detector.ipynb.json +1 -1
- package/lib/examples/utils/agents/earthquake-detector.lexical.json +1 -1
- package/lib/examples/utils/agents/sales-forecaster.ipynb.json +1 -1
- package/lib/examples/utils/agents/sales-forecaster.lexical.json +1 -1
- package/lib/examples/utils/agents/social-post-generator.ipynb.json +1 -1
- package/lib/examples/utils/agents/social-post-generator.lexical.json +1 -1
- package/lib/examples/utils/exampleSurfaces.d.ts +31 -0
- package/lib/examples/utils/exampleSurfaces.js +38 -0
- package/lib/examples/utils/jupyterSandboxUrl.d.ts +27 -0
- package/lib/examples/utils/jupyterSandboxUrl.js +55 -0
- package/lib/examples/utils/localUrl.d.ts +2 -0
- package/lib/examples/utils/localUrl.js +49 -0
- package/lib/examples/utils/notebookToolbarItems.d.ts +46 -0
- package/lib/examples/utils/notebookToolbarItems.js +129 -0
- package/lib/examples/utils/runtimeTargetStore.d.ts +40 -1
- package/lib/examples/utils/runtimeTargetStore.js +82 -1
- package/lib/examples/utils/themedProvider.d.ts +7 -0
- package/lib/examples/utils/themedProvider.js +57 -4
- package/lib/examples/utils/useExampleAgentRuntimesUrl.js +30 -5
- package/lib/examples/utils/waitForAgent.d.ts +23 -0
- package/lib/examples/utils/waitForAgent.js +24 -0
- package/lib/examples2/CellExample.d.ts +1 -1
- package/lib/examples2/DatalayerNotebookExample.d.ts +1 -1
- package/lib/examples2/NotebookExample.d.ts +1 -1
- package/lib/examples2/NotebookMutationsKernel.d.ts +1 -1
- package/lib/examples2/NotebookMutationsServiceManager.d.ts +1 -1
- package/lib/examples2/main.js +24 -4
- package/lib/extensions/A2UIExtension.d.ts +1 -1
- package/lib/hooks/index.d.ts +8 -5
- package/lib/hooks/index.js +20 -5
- package/lib/hooks/useAgentRuntimes.d.ts +49 -22
- package/lib/hooks/useAgentRuntimes.js +214 -90
- package/lib/hooks/useAgentsCatalog.js +32 -4
- package/lib/hooks/useBrowserAgent.d.ts +26 -0
- package/lib/hooks/useBrowserAgent.js +75 -0
- package/lib/hooks/useBrowserInference.d.ts +27 -0
- package/lib/hooks/useBrowserInference.js +67 -0
- package/lib/hooks/useCheckpoints.d.ts +8 -17
- package/lib/hooks/useCheckpoints.js +25 -59
- package/lib/hooks/useConfig.d.ts +1 -1
- package/lib/hooks/useConfig.js +5 -1
- package/lib/hooks/useContextSnapshot.d.ts +18 -7
- package/lib/hooks/useContextSnapshot.js +14 -10
- package/lib/hooks/useNotifications.d.ts +11 -11
- package/lib/hooks/useNotifications.js +1 -1
- package/lib/hooks/useProjects.d.ts +7 -19
- package/lib/hooks/useProjects.js +5 -5
- package/lib/hooks/useSkills.d.ts +0 -1
- package/lib/hooks/useSkills.js +6 -2
- package/lib/hooks/useToolApprovals.d.ts +8 -8
- package/lib/hooks/useToolApprovals.js +3 -3
- package/lib/identity/AgentIdentity.d.ts +9 -2
- package/lib/index.d.ts +1 -0
- package/lib/index.js +4 -0
- package/lib/jupyter/index.d.ts +2 -1
- package/lib/jupyter/index.js +2 -1
- package/lib/jupyter/serverExecution.d.ts +78 -0
- package/lib/jupyter/serverExecution.js +258 -0
- package/lib/jupyter/useResumeServerExecutions.d.ts +11 -0
- package/lib/jupyter/useResumeServerExecutions.js +64 -0
- package/lib/lexical/ChatInlinePlugin.d.ts +33 -0
- package/lib/lexical/ChatInlinePlugin.js +0 -36
- package/lib/loop/core/focusRequests.d.ts +10 -0
- package/lib/loop/core/focusRequests.js +46 -0
- package/lib/loop/core/index.d.ts +903 -0
- package/lib/loop/core/index.js +264 -0
- package/lib/loop/core/promptStore.d.ts +44 -0
- package/lib/loop/core/promptStore.js +63 -0
- package/lib/loop/core/surfaceRequests.d.ts +33 -0
- package/lib/loop/core/surfaceRequests.js +29 -0
- package/lib/loop/core/toolbar.d.ts +28 -0
- package/lib/loop/core/toolbar.js +59 -0
- package/lib/loop/embed/LoopEmbed.d.ts +57 -0
- package/lib/loop/embed/LoopEmbed.js +124 -0
- package/lib/loop/extensions.d.ts +10 -0
- package/lib/loop/extensions.js +49 -0
- package/lib/loop/index.d.ts +68 -0
- package/lib/loop/index.js +87 -0
- package/lib/loop/plugins/a2a-sidebar/A2ASidebar.d.ts +48 -0
- package/lib/loop/plugins/a2a-sidebar/A2ASidebar.js +190 -0
- package/lib/loop/plugins/a2a-sidebar/index.d.ts +5 -0
- package/lib/loop/plugins/a2a-sidebar/index.js +39 -0
- package/lib/loop/plugins/a2ui/A2uiView.d.ts +12 -0
- package/lib/loop/plugins/a2ui/A2uiView.js +97 -0
- package/lib/loop/plugins/a2ui/index.d.ts +3 -0
- package/lib/loop/plugins/a2ui/index.js +50 -0
- package/lib/loop/plugins/a2ui-scene/index.d.ts +36 -0
- package/lib/loop/plugins/a2ui-scene/index.js +28 -0
- package/lib/loop/plugins/agent-a2a/index.d.ts +3 -0
- package/lib/loop/plugins/agent-a2a/index.js +26 -0
- package/lib/loop/plugins/agent-a2ui/index.d.ts +3 -0
- package/lib/loop/plugins/agent-a2ui/index.js +42 -0
- package/lib/loop/plugins/agent-a2ui-jupyter-output/index.d.ts +3 -0
- package/lib/loop/plugins/agent-a2ui-jupyter-output/index.js +53 -0
- package/lib/loop/plugins/agent-capacity/index.d.ts +39 -0
- package/lib/loop/plugins/agent-capacity/index.js +52 -0
- package/lib/loop/plugins/agent-checkpoints/index.d.ts +3 -0
- package/lib/loop/plugins/agent-checkpoints/index.js +26 -0
- package/lib/loop/plugins/agent-code-sandbox/index.d.ts +3 -0
- package/lib/loop/plugins/agent-code-sandbox/index.js +24 -0
- package/lib/loop/plugins/agent-code-sandboxes/index.d.ts +13 -0
- package/lib/loop/plugins/agent-code-sandboxes/index.js +85 -0
- package/lib/loop/plugins/agent-codemode/index.d.ts +5 -0
- package/lib/loop/plugins/agent-codemode/index.js +41 -0
- package/lib/loop/plugins/agent-compaction/index.d.ts +10 -0
- package/lib/loop/plugins/agent-compaction/index.js +34 -0
- package/lib/loop/plugins/agent-evals/index.d.ts +3 -0
- package/lib/loop/plugins/agent-evals/index.js +25 -0
- package/lib/loop/plugins/agent-guardrails/index.d.ts +3 -0
- package/lib/loop/plugins/agent-guardrails/index.js +25 -0
- package/lib/loop/plugins/agent-hooks/index.d.ts +3 -0
- package/lib/loop/plugins/agent-hooks/index.js +28 -0
- package/lib/loop/plugins/agent-inference/index.d.ts +7 -0
- package/lib/loop/plugins/agent-inference/index.js +29 -0
- package/lib/loop/plugins/agent-mcp/index.d.ts +3 -0
- package/lib/loop/plugins/agent-mcp/index.js +25 -0
- package/lib/loop/plugins/agent-memory/index.d.ts +3 -0
- package/lib/loop/plugins/agent-memory/index.js +25 -0
- package/lib/loop/plugins/agent-monitoring/index.d.ts +3 -0
- package/lib/loop/plugins/agent-monitoring/index.js +25 -0
- package/lib/loop/plugins/agent-notifications/index.d.ts +3 -0
- package/lib/loop/plugins/agent-notifications/index.js +25 -0
- package/lib/loop/plugins/agent-otel/index.d.ts +3 -0
- package/lib/loop/plugins/agent-otel/index.js +25 -0
- package/lib/loop/plugins/agent-outputs/index.d.ts +3 -0
- package/lib/loop/plugins/agent-outputs/index.js +25 -0
- package/lib/loop/plugins/agent-parameters/index.d.ts +3 -0
- package/lib/loop/plugins/agent-parameters/index.js +25 -0
- package/lib/loop/plugins/agent-skills/index.d.ts +3 -0
- package/lib/loop/plugins/agent-skills/index.js +25 -0
- package/lib/loop/plugins/agent-subagents/index.d.ts +3 -0
- package/lib/loop/plugins/agent-subagents/index.js +25 -0
- package/lib/loop/plugins/agent-tool-approvals/index.d.ts +11 -0
- package/lib/loop/plugins/agent-tool-approvals/index.js +38 -0
- package/lib/loop/plugins/agent-triggers/index.d.ts +3 -0
- package/lib/loop/plugins/agent-triggers/index.js +26 -0
- package/lib/loop/plugins/agents/AgentSummaryPanel.d.ts +20 -0
- package/lib/loop/plugins/agents/AgentSummaryPanel.js +50 -0
- package/lib/loop/plugins/agents/AnonymousKeyBadge.d.ts +35 -0
- package/lib/loop/plugins/agents/AnonymousKeyBadge.js +53 -0
- package/lib/loop/plugins/agents/DatalayerAgentBridge.d.ts +24 -0
- package/lib/loop/plugins/agents/DatalayerAgentBridge.js +102 -0
- package/lib/loop/plugins/agents/DatalayerAgentMount.d.ts +18 -0
- package/lib/loop/plugins/agents/DatalayerAgentMount.js +12 -0
- package/lib/loop/plugins/agents/SandboxSelector.d.ts +18 -0
- package/lib/loop/plugins/agents/SandboxSelector.js +99 -0
- package/lib/loop/plugins/agents/SandboxStatusBridge.d.ts +19 -0
- package/lib/loop/plugins/agents/SandboxStatusBridge.js +23 -0
- package/lib/loop/plugins/agents/SandboxView.d.ts +11 -0
- package/lib/loop/plugins/agents/SandboxView.js +43 -0
- package/lib/loop/plugins/agents/TeamMemberPicker.d.ts +17 -0
- package/lib/loop/plugins/agents/TeamMemberPicker.js +60 -0
- package/lib/loop/plugins/agents/agentIcons.d.ts +23 -0
- package/lib/loop/plugins/agents/agentIcons.js +88 -0
- package/lib/loop/plugins/agents/browserService.d.ts +50 -0
- package/lib/loop/plugins/agents/browserService.js +233 -0
- package/lib/loop/plugins/agents/index.d.ts +13 -0
- package/lib/loop/plugins/agents/index.js +17 -0
- package/lib/loop/plugins/agents/plugin.d.ts +91 -0
- package/lib/loop/plugins/agents/plugin.js +201 -0
- package/lib/loop/plugins/agents/service.d.ts +99 -0
- package/lib/loop/plugins/agents/service.js +167 -0
- package/lib/loop/plugins/agents/specSubagents.d.ts +18 -0
- package/lib/loop/plugins/agents/specSubagents.js +33 -0
- package/lib/loop/plugins/agents/switchable.d.ts +107 -0
- package/lib/loop/plugins/agents/switchable.js +405 -0
- package/lib/loop/plugins/agents/team.d.ts +87 -0
- package/lib/loop/plugins/agents/team.js +143 -0
- package/lib/loop/plugins/agents/useSandboxService.d.ts +11 -0
- package/lib/loop/plugins/agents/useSandboxService.js +36 -0
- package/lib/loop/plugins/agents/useTeamSelection.d.ts +10 -0
- package/lib/loop/plugins/agents/useTeamSelection.js +27 -0
- package/lib/loop/plugins/agentspecs/AgentspecPicker.d.ts +15 -0
- package/lib/loop/plugins/agentspecs/AgentspecPicker.js +90 -0
- package/lib/loop/plugins/agentspecs/index.d.ts +6 -0
- package/lib/loop/plugins/agentspecs/index.js +63 -0
- package/lib/loop/plugins/chat/ChatView.d.ts +20 -0
- package/lib/loop/plugins/chat/ChatView.js +1679 -0
- package/lib/loop/plugins/chat/chatViewTools.d.ts +41 -0
- package/lib/loop/plugins/chat/chatViewTools.js +92 -0
- package/lib/loop/plugins/chat/index.d.ts +111 -0
- package/lib/loop/plugins/chat/index.js +143 -0
- package/lib/loop/plugins/chat/turnState.d.ts +41 -0
- package/lib/loop/plugins/chat/turnState.js +90 -0
- package/lib/loop/plugins/chat-extras/index.d.ts +14 -0
- package/lib/loop/plugins/chat-extras/index.js +51 -0
- package/lib/loop/plugins/chat-header/HeaderView.d.ts +13 -0
- package/lib/loop/plugins/chat-header/HeaderView.js +6 -0
- package/lib/loop/plugins/chat-header/index.d.ts +3 -0
- package/lib/loop/plugins/chat-header/index.js +21 -0
- package/lib/loop/plugins/chat-view/index.d.ts +10 -0
- package/lib/loop/plugins/chat-view/index.js +29 -0
- package/lib/loop/plugins/checkpoints-sidebar/CheckpointsSidebar.d.ts +27 -0
- package/lib/loop/plugins/checkpoints-sidebar/CheckpointsSidebar.js +174 -0
- package/lib/loop/plugins/checkpoints-sidebar/index.d.ts +5 -0
- package/lib/loop/plugins/checkpoints-sidebar/index.js +39 -0
- package/lib/loop/plugins/commands/index.d.ts +20 -0
- package/lib/loop/plugins/commands/index.js +148 -0
- package/lib/loop/plugins/decks/DeckSurface.d.ts +10 -0
- package/lib/loop/plugins/decks/DeckSurface.js +6 -0
- package/lib/loop/plugins/decks/DecksMenu.d.ts +11 -0
- package/lib/loop/plugins/decks/DecksMenu.js +42 -0
- package/lib/loop/plugins/decks/index.d.ts +19 -0
- package/lib/loop/plugins/decks/index.js +133 -0
- package/lib/loop/plugins/decks/surface.d.ts +7 -0
- package/lib/loop/plugins/decks/surface.js +11 -0
- package/lib/loop/plugins/document/DocumentView.d.ts +12 -0
- package/lib/loop/plugins/document/DocumentView.js +68 -0
- package/lib/loop/plugins/document/index.d.ts +3 -0
- package/lib/loop/plugins/document/index.js +86 -0
- package/lib/loop/plugins/document/openingDocument.d.ts +28 -0
- package/lib/loop/plugins/document/openingDocument.js +122 -0
- package/lib/loop/plugins/document-toolbar/SandboxStatusItem.d.ts +16 -0
- package/lib/loop/plugins/document-toolbar/SandboxStatusItem.js +31 -0
- package/lib/loop/plugins/document-toolbar/index.d.ts +4 -0
- package/lib/loop/plugins/document-toolbar/index.js +35 -0
- package/lib/loop/plugins/document-toolbar/names.d.ts +6 -0
- package/lib/loop/plugins/document-toolbar/names.js +10 -0
- package/lib/loop/plugins/document-toolbar/plugin.d.ts +2 -0
- package/lib/loop/plugins/document-toolbar/plugin.js +38 -0
- package/lib/loop/plugins/document-view/index.d.ts +10 -0
- package/lib/loop/plugins/document-view/index.js +28 -0
- package/lib/loop/plugins/graph/GraphToggle.d.ts +17 -0
- package/lib/loop/plugins/graph/GraphToggle.js +22 -0
- package/lib/loop/plugins/graph/GraphView.d.ts +16 -0
- package/lib/loop/plugins/graph/GraphView.js +6 -0
- package/lib/loop/plugins/graph/index.d.ts +5 -0
- package/lib/loop/plugins/graph/index.js +80 -0
- package/lib/loop/plugins/graph/viewType.d.ts +10 -0
- package/lib/loop/plugins/graph/viewType.js +14 -0
- package/lib/loop/plugins/input-prompt/ComposerView.d.ts +15 -0
- package/lib/loop/plugins/input-prompt/ComposerView.js +25 -0
- package/lib/loop/plugins/input-prompt/index.d.ts +25 -0
- package/lib/loop/plugins/input-prompt/index.js +26 -0
- package/lib/loop/plugins/models/index.d.ts +3 -0
- package/lib/loop/plugins/models/index.js +49 -0
- package/lib/loop/plugins/notebook/NotebookView.d.ts +9 -0
- package/lib/loop/plugins/notebook/NotebookView.js +189 -0
- package/lib/loop/plugins/notebook/index.d.ts +3 -0
- package/lib/loop/plugins/notebook/index.js +91 -0
- package/lib/loop/plugins/notebook/openingNotebook.d.ts +72 -0
- package/lib/loop/plugins/notebook/openingNotebook.js +90 -0
- package/lib/loop/plugins/notebook-toolbar/index.d.ts +4 -0
- package/lib/loop/plugins/notebook-toolbar/index.js +45 -0
- package/lib/loop/plugins/notebook-toolbar/items.d.ts +10 -0
- package/lib/loop/plugins/notebook-toolbar/items.js +45 -0
- package/lib/loop/plugins/notebook-toolbar/names.d.ts +9 -0
- package/lib/loop/plugins/notebook-toolbar/names.js +13 -0
- package/lib/loop/plugins/notebook-toolbar/plugin.d.ts +2 -0
- package/lib/loop/plugins/notebook-toolbar/plugin.js +24 -0
- package/lib/loop/plugins/notebook-view/index.d.ts +10 -0
- package/lib/loop/plugins/notebook-view/index.js +30 -0
- package/lib/loop/plugins/page-layout/TurnPanel.d.ts +25 -0
- package/lib/loop/plugins/page-layout/TurnPanel.js +126 -0
- package/lib/loop/plugins/page-layout/index.d.ts +71 -0
- package/lib/loop/plugins/page-layout/index.js +160 -0
- package/lib/loop/plugins/plugins-panel/index.d.ts +14 -0
- package/lib/loop/plugins/plugins-panel/index.js +74 -0
- package/lib/loop/plugins/prompt/NewChatAction.d.ts +19 -0
- package/lib/loop/plugins/prompt/NewChatAction.js +10 -0
- package/lib/loop/plugins/prompt/index.d.ts +11 -0
- package/lib/loop/plugins/prompt/index.js +73 -0
- package/lib/loop/plugins/shell/editorChoice.d.ts +31 -0
- package/lib/loop/plugins/shell/editorChoice.js +58 -0
- package/lib/loop/plugins/shell/index.d.ts +47 -0
- package/lib/loop/plugins/shell/index.js +142 -0
- package/lib/loop/plugins/shell/useEditorPreviews.d.ts +32 -0
- package/lib/loop/plugins/shell/useEditorPreviews.js +217 -0
- package/lib/loop/plugins/subagent-activity/SubagentPulse.d.ts +16 -0
- package/lib/loop/plugins/subagent-activity/SubagentPulse.js +45 -0
- package/lib/loop/plugins/subagent-activity/index.d.ts +12 -0
- package/lib/loop/plugins/subagent-activity/index.js +42 -0
- package/lib/loop/plugins/view-switch/index.d.ts +46 -0
- package/lib/loop/plugins/view-switch/index.js +68 -0
- package/lib/loop/plugins/window-frame/WindowFrame.d.ts +48 -0
- package/lib/loop/plugins/window-frame/WindowFrame.js +63 -0
- package/lib/loop/plugins/window-frame/index.d.ts +6 -0
- package/lib/loop/plugins/window-frame/index.js +79 -0
- package/lib/loop/plugins/window-frame/slots.d.ts +26 -0
- package/lib/loop/plugins/window-frame/slots.js +30 -0
- package/lib/loop/presets.d.ts +181 -0
- package/lib/loop/presets.js +141 -0
- package/lib/loop/shell/LoopWorkspace.d.ts +109 -0
- package/lib/loop/shell/LoopWorkspace.js +231 -0
- package/lib/loop/shell/PluginToggles.d.ts +21 -0
- package/lib/loop/shell/PluginToggles.js +41 -0
- package/lib/loop/shell/ViewSwitcher.d.ts +24 -0
- package/lib/loop/shell/ViewSwitcher.js +43 -0
- package/lib/loop/shell/WorkspaceFullScreenAction.d.ts +25 -0
- package/lib/loop/shell/WorkspaceFullScreenAction.js +24 -0
- package/lib/loop/shell/index.d.ts +10 -0
- package/lib/loop/shell/index.js +14 -0
- package/lib/loop/shell/useWorkspaceFullScreen.d.ts +93 -0
- package/lib/loop/shell/useWorkspaceFullScreen.js +167 -0
- package/lib/loop-example-main.d.ts +1 -0
- package/lib/loop-example-main.js +42 -0
- package/lib/loop-main.d.ts +1 -0
- package/lib/loop-main.js +138 -0
- package/lib/mcp/McpServerManager.d.ts +1 -1
- package/lib/models/CodeSandboxSnapshotDTO.d.ts +1 -1
- package/lib/models/CodeSandboxVariant.d.ts +13 -5
- package/lib/models/CodeSandboxVariant.js +17 -5
- package/lib/models/Content.d.ts +26 -0
- package/lib/models/Deck.d.ts +14 -0
- package/lib/models/Environment.d.ts +678 -5
- package/lib/models/Environment.js +12 -1
- package/lib/models/EnvironmentDTO.d.ts +24 -6
- package/lib/models/EnvironmentDTO.js +13 -2
- package/lib/models/Exercise.d.ts +0 -2
- package/lib/models/ItemType.d.ts +1 -1
- package/lib/models/Library.d.ts +0 -2
- package/lib/models/Notebook.d.ts +0 -2
- package/lib/models/ProjectDTO.d.ts +2 -2
- package/lib/models/ProjectDTO.js +4 -4
- package/lib/models/Runtime.d.ts +17 -11
- package/lib/models/RuntimeDTO.d.ts +16 -7
- package/lib/models/RuntimeDTO.js +9 -9
- package/lib/models/Space.d.ts +10 -0
- package/lib/models/Space.js +1 -1
- package/lib/models/SpaceDTO.d.ts +1 -1
- package/lib/models/SpaceItem.d.ts +2 -2
- package/lib/models/environments.generated.d.ts +141 -0
- package/lib/models/environments.generated.js +13 -0
- package/lib/models/index.d.ts +1 -1
- package/lib/models/index.js +1 -1
- package/lib/protocols/A2AAdapter.d.ts +39 -6
- package/lib/protocols/A2AAdapter.js +180 -11
- package/lib/protocols/ACPAdapter.js +40 -37
- package/lib/protocols/AGUIAdapter.d.ts +14 -0
- package/lib/protocols/AGUIAdapter.js +34 -9
- package/lib/protocols/BrowserAgentAdapter.d.ts +125 -0
- package/lib/protocols/BrowserAgentAdapter.js +317 -0
- package/lib/protocols/VercelAIAdapter.d.ts +10 -0
- package/lib/protocols/VercelAIAdapter.js +27 -7
- package/lib/protocols/index.d.ts +1 -0
- package/lib/protocols/index.js +1 -0
- package/lib/runtimes/actions.d.ts +8 -3
- package/lib/runtimes/actions.js +46 -14
- package/lib/runtimes/apis.d.ts +13 -4
- package/lib/runtimes/browser/agent.d.ts +54 -0
- package/lib/runtimes/browser/agent.js +63 -0
- package/lib/runtimes/browser/anonymousToken.d.ts +121 -0
- package/lib/runtimes/browser/anonymousToken.js +300 -0
- package/lib/runtimes/browser/frontendTools.d.ts +61 -0
- package/lib/runtimes/browser/frontendTools.js +152 -0
- package/lib/runtimes/browser/index.d.ts +11 -0
- package/lib/runtimes/browser/index.js +20 -0
- package/lib/runtimes/browser/model.d.ts +52 -0
- package/lib/runtimes/browser/model.js +110 -0
- package/lib/runtimes/browser/protocol.d.ts +54 -0
- package/lib/runtimes/browser/protocol.js +35 -0
- package/lib/runtimes/browser/subagents.d.ts +131 -0
- package/lib/runtimes/browser/subagents.js +241 -0
- package/lib/runtimes/index.d.ts +3 -0
- package/lib/runtimes/index.js +3 -0
- package/lib/runtimes/lifecycle.d.ts +76 -0
- package/lib/runtimes/lifecycle.js +99 -0
- package/lib/runtimes/variants.d.ts +172 -0
- package/lib/runtimes/variants.js +187 -0
- package/lib/services/reconnectToRuntime.d.ts +2 -2
- package/lib/services/reconnectToRuntime.js +3 -3
- package/lib/services/sandboxServiceManagers.d.ts +2 -2
- package/lib/services/sandboxServiceManagers.js +11 -11
- package/lib/specs/agents/agents.d.ts +129 -112
- package/lib/specs/agents/agents.js +8200 -5044
- package/lib/specs/evals.js +9 -0
- package/lib/specs/frontendTools.d.ts +4 -0
- package/lib/specs/frontendTools.js +77 -3
- package/lib/specs/mcpServers.d.ts +1 -0
- package/lib/specs/mcpServers.js +38 -15
- package/lib/specs/models.d.ts +18 -0
- package/lib/specs/models.js +154 -0
- package/lib/specs/outputs.d.ts +2 -0
- package/lib/specs/outputs.js +31 -0
- package/lib/specs/personas.js +1 -1
- package/lib/specs/skills.js +7 -7
- package/lib/specs/teams/teams.d.ts +2 -0
- package/lib/specs/teams/teams.js +628 -111
- package/lib/state/index.d.ts +1 -1
- package/lib/state/index.js +1 -1
- package/lib/state/substates/RuntimesState.d.ts +5 -5
- package/lib/state/substates/RuntimesState.js +14 -14
- package/lib/state/substates/index.d.ts +1 -1
- package/lib/state/substates/index.js +1 -1
- package/lib/stores/agentRuntimeStore.d.ts +43 -1
- package/lib/stores/agentRuntimeStore.js +100 -11
- package/lib/stores/index.d.ts +1 -1
- package/lib/stores/index.js +1 -1
- package/lib/stories/Button.d.ts +1 -1
- package/lib/stories/Button.stories.d.ts +1 -1
- package/lib/stories/Header.d.ts +1 -1
- package/lib/stories/Header.stories.d.ts +1 -1
- package/lib/test-setup.js +66 -0
- package/lib/tools/adapters/agent-runtimes/lexicalHooks.d.ts +15 -0
- package/lib/tools/adapters/agent-runtimes/lexicalHooks.js +43 -2
- package/lib/tools/adapters/agent-runtimes/notebookHooks.d.ts +9 -0
- package/lib/tools/adapters/agent-runtimes/notebookHooks.js +12 -0
- package/lib/tools/adapters/commands/frontendCommandTools.d.ts +11 -0
- package/lib/tools/adapters/commands/frontendCommandTools.js +60 -0
- package/lib/tools/adapters/commands/index.d.ts +1 -0
- package/lib/tools/adapters/commands/index.js +5 -0
- package/lib/tools/adapters/copilotkit/lexicalHooks.js +7 -3
- package/lib/tools/index.d.ts +1 -0
- package/lib/tools/index.js +1 -0
- package/lib/types/a2a.d.ts +15 -1
- package/lib/types/agents-lifecycle.d.ts +11 -6
- package/lib/types/agents.d.ts +31 -6
- package/lib/types/agentspecs.d.ts +120 -4
- package/lib/types/chat.d.ts +251 -3
- package/lib/types/checkpoints.d.ts +20 -0
- package/lib/types/config.d.ts +13 -1
- package/lib/types/connection.d.ts +1 -1
- package/lib/types/evals.d.ts +2 -0
- package/lib/types/messages.d.ts +60 -0
- package/lib/types/models.d.ts +26 -0
- package/lib/types/notifications.d.ts +15 -6
- package/lib/types/outputs.d.ts +2 -0
- package/lib/types/protocol.d.ts +7 -2
- package/lib/types/stream.d.ts +48 -3
- package/lib/types/stream.js +5 -0
- package/lib/types/teams.d.ts +102 -4
- package/lib/types/tool-approvals.d.ts +1 -1
- package/lib/types/tools.d.ts +8 -2
- package/lib/utils/utils.js +7 -1
- package/package.json +376 -361
- package/scripts/codegen/compose.py +208 -0
- package/scripts/codegen/generate_agents.py +202 -31
- package/scripts/codegen/generate_evals.py +2 -0
- package/scripts/codegen/generate_frontend_tools.py +35 -6
- package/scripts/codegen/generate_mcp_servers.py +2 -2
- package/scripts/codegen/generate_models.py +40 -15
- package/scripts/codegen/generate_outputs.py +2 -0
- package/scripts/codegen/generate_sandbox_agents.py +76 -62
- package/scripts/codegen/generate_skills.py +2 -2
- package/scripts/codegen/generate_teams.py +178 -4
- package/scripts/codegen/generate_tools.py +6 -4
- package/scripts/gen_workers.py +278 -110
- package/scripts/generate-environments-types.py +404 -0
- package/lib/chat/prompt/InputFooter.d.ts +0 -58
- package/lib/chat/prompt/InputFooter.js +0 -194
- package/lib/chat/prompt/InputPromptFooter.d.ts +0 -27
- package/lib/chat/prompt/InputPromptFooter.js +0 -15
- package/lib/chat/prompt/InputPromptHeader.d.ts +0 -15
- package/lib/chat/prompt/InputPromptHeader.js +0 -15
- package/lib/chat/usage/TokenUsageBar.d.ts +0 -8
- package/lib/hooks/useRuntimes.d.ts +0 -5
- package/lib/hooks/useRuntimes.js +0 -34
- package/lib/jupyter/kernelsHandler.d.ts +0 -8
- package/lib/jupyter/kernelsHandler.js +0 -39
- package/lib/models/Dataset.d.ts +0 -16
- package/lib/utils/Cells.d.ts +0 -2
- package/lib/utils/Cells.js +0 -28
- /package/lib/models/{Dataset.js → Deck.js} +0 -0
package/lib/examples/main.js
CHANGED
|
@@ -4,14 +4,20 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
6
|
/// <reference types="vite/client" />
|
|
7
|
-
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
7
|
+
import { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
|
|
8
8
|
import { createRoot } from 'react-dom/client';
|
|
9
|
-
|
|
9
|
+
// From the lean `/core` entry: the barrel drags the whole component
|
|
10
|
+
// library (notebook, CodeMirror, cells) into the gallery's first paint,
|
|
11
|
+
// and the gallery only needs the theme and the server config helpers.
|
|
12
|
+
import { loadJupyterConfig, JupyterReactTheme, createServerSettings, jupyterReactStore, setJupyterServerUrl, setJupyterServerToken, getJupyterServerUrl, getJupyterServerToken, } from '@datalayer/jupyter-react/core';
|
|
10
13
|
import { ServiceManager } from '@jupyterlab/services';
|
|
11
14
|
import { DatalayerThemeProvider, DatalayerLogoText, getLogoColors, themeConfigs, Box, SlidingPanel, } from '@datalayer/primer-addons';
|
|
12
|
-
|
|
15
|
+
// Straight from its module: the components barrel re-exports the
|
|
16
|
+
// code-sandbox gallery and friends, none of which belong in the
|
|
17
|
+
// example gallery's first paint.
|
|
18
|
+
import { AgentSummary } from '../components/agents/AgentSummary';
|
|
13
19
|
import { HomeIcon, SignInIcon, SignOutIcon } from '@primer/octicons-react';
|
|
14
|
-
import { Button, SegmentedControl, Spinner, Text } from '@primer/react';
|
|
20
|
+
import { ActionList, ActionMenu, Button, SegmentedControl, Spinner, Text, TextInput, } from '@primer/react';
|
|
15
21
|
import { AppearanceControlsWithStore } from '@datalayer/primer-addons/lib/components/appearance';
|
|
16
22
|
import { coreStore, iamStore } from '@datalayer/core';
|
|
17
23
|
import { DATALAYER_IAM_TOKEN_KEY, DATALAYER_IAM_USER_KEY, } from '../state/substates';
|
|
@@ -21,14 +27,18 @@ import { useSimpleAuthStore } from '@datalayer/core/lib/views/otel';
|
|
|
21
27
|
import { teardownExampleAgents } from './utils/teardownAgents';
|
|
22
28
|
import { OAuthCallback } from '../identity';
|
|
23
29
|
import { EXAMPLES, getExampleEntries, } from './example-selector';
|
|
24
|
-
import { runtimeTargetStore, useRuntimeTargetStore, } from './utils/runtimeTargetStore';
|
|
30
|
+
import { RUNTIME_TARGETS, runtimeTargetCapabilities, runtimeTargetStore, targetHasAgent, useRuntimeTargetStore, } from './utils/runtimeTargetStore';
|
|
25
31
|
import { resolveExampleAgentRuntimesUrl } from './utils/useExampleAgentRuntimesUrl';
|
|
32
|
+
import { isLocalUrl } from './utils/localUrl';
|
|
26
33
|
import { agentSummaryStore } from './utils/agentSummaryStore';
|
|
34
|
+
import { isSandboxOnlyExample } from './utils/exampleSurfaces';
|
|
27
35
|
import { useAgentSummaryStore } from './utils/agentSummaryStore';
|
|
28
36
|
import { useExampleThemeStore } from './utils/themeStore';
|
|
37
|
+
import HomeExample from './HomeExample';
|
|
29
38
|
import { ExampleWrapper } from './components/ExampleWrapper';
|
|
30
39
|
import { ExampleErrorBoundary } from './components/ExampleErrorBoundary';
|
|
31
40
|
import { createServiceManagerFromAgentSandbox } from '../hooks/useAgentRuntimes';
|
|
41
|
+
import { useAgentRuntimes } from '../hooks/useAgentRuntimes';
|
|
32
42
|
import { DEFAULT_MODEL } from '../specs/models';
|
|
33
43
|
import nbformatExample from './utils/notebooks/NotebookExample1.ipynb.json';
|
|
34
44
|
import '../../style/primer-primitives.css';
|
|
@@ -36,9 +46,68 @@ const DEFAULT_RUNTIMES_URL = 'https://r1.datalayer.run';
|
|
|
36
46
|
const DEFAULT_LOCAL_JUPYTER_SERVER_URL = 'http://localhost:8888/api/jupyter-server';
|
|
37
47
|
const DEFAULT_LOCAL_JUPYTER_SERVER_TOKEN = '60c1661cc408f978c309d04157af55c9588ff9557c9380e4fb50785750703da6';
|
|
38
48
|
const DEFAULT_CLOUD_RUNTIME_ENVIRONMENT = 'ai-agents-env';
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
49
|
+
const EXAMPLE_GROUP_ORDER = [
|
|
50
|
+
'Loop',
|
|
51
|
+
'A2UI',
|
|
52
|
+
'A2A',
|
|
53
|
+
'AG-UI',
|
|
54
|
+
'Capabilities',
|
|
55
|
+
'Chat',
|
|
56
|
+
'Document',
|
|
57
|
+
'Notebook',
|
|
58
|
+
'Cell',
|
|
59
|
+
'CopilotKit',
|
|
60
|
+
];
|
|
61
|
+
/**
|
|
62
|
+
* The examples that open without an account.
|
|
63
|
+
*
|
|
64
|
+
* A list, not a rule: most examples here allocate a runtime somebody pays
|
|
65
|
+
* for, and this one happens to run entirely in the visitor's browser. Adding
|
|
66
|
+
* another is adding an id.
|
|
67
|
+
*/
|
|
68
|
+
const ANONYMOUS_EXAMPLES = new Set([
|
|
69
|
+
'LoopWorkspaceExample',
|
|
70
|
+
// Runs on the browser sandbox: nothing to allocate, nothing to sign into.
|
|
71
|
+
'LoopShellExample',
|
|
72
|
+
// Temporarily anonymous so the Jupyter output surface can be driven and
|
|
73
|
+
// debugged without a session. Remove once that work is finished.
|
|
74
|
+
'A2UiJupyterOutputExample',
|
|
75
|
+
// The two page layouts, on the browser sandbox like the shell.
|
|
76
|
+
'NotebookPageAgent',
|
|
77
|
+
'DocumentPageAgent',
|
|
78
|
+
// The decks plugin in a Loop; the agent and the decks both live in the page.
|
|
79
|
+
'DecksAgent',
|
|
80
|
+
]);
|
|
81
|
+
const getExampleGroup = (id) => {
|
|
82
|
+
if (id === 'AgentspecsExample' ||
|
|
83
|
+
id === 'AgentLoopExample' ||
|
|
84
|
+
id === 'LoopWorkspaceExample' ||
|
|
85
|
+
id === 'LoopShellExample' ||
|
|
86
|
+
id === 'DecksAgent') {
|
|
87
|
+
return 'Loop';
|
|
88
|
+
}
|
|
89
|
+
if (id.startsWith('A2Ui'))
|
|
90
|
+
return 'A2UI';
|
|
91
|
+
// Agents reached over the A2A protocol: their own category, after A2UI.
|
|
92
|
+
if (id.startsWith('AgentA2A'))
|
|
93
|
+
return 'A2A';
|
|
94
|
+
if (id.startsWith('AgUi'))
|
|
95
|
+
return 'AG-UI';
|
|
96
|
+
if (id.startsWith('CopilotKit'))
|
|
97
|
+
return 'CopilotKit';
|
|
98
|
+
// Each remaining Agent* example demonstrates one capability of the
|
|
99
|
+
// runtime: checkpoints, hooks, memory, guardrails…
|
|
100
|
+
if (id.startsWith('Agent'))
|
|
101
|
+
return 'Capabilities';
|
|
102
|
+
if (id.startsWith('Chat'))
|
|
103
|
+
return 'Chat';
|
|
104
|
+
// The document examples: the ones on the Lexical editor, and the page
|
|
105
|
+
// with a document on it.
|
|
106
|
+
if (id.startsWith('Lexical') || id.startsWith('Document'))
|
|
107
|
+
return 'Document';
|
|
108
|
+
if (id.startsWith('Notebook'))
|
|
109
|
+
return 'Notebook';
|
|
110
|
+
return 'Cell';
|
|
42
111
|
};
|
|
43
112
|
const wait = (ms) => new Promise(resolve => {
|
|
44
113
|
window.setTimeout(resolve, ms);
|
|
@@ -50,22 +119,6 @@ const safeExampleId = (value) => {
|
|
|
50
119
|
.replace(/^-+|-+$/g, '')
|
|
51
120
|
.slice(0, 40);
|
|
52
121
|
};
|
|
53
|
-
const toAgentApiBaseUrl = (ingress) => {
|
|
54
|
-
const normalized = ingress.replace(/\/$/, '');
|
|
55
|
-
if (normalized.includes('/api/agent-runtimes')) {
|
|
56
|
-
return normalized;
|
|
57
|
-
}
|
|
58
|
-
if (normalized.includes('/api/jupyter-server')) {
|
|
59
|
-
return normalized.replace('/api/jupyter-server', '/api/agent-runtimes');
|
|
60
|
-
}
|
|
61
|
-
if (normalized.includes('/jupyter/server/')) {
|
|
62
|
-
return normalized.replace('/jupyter/server/', '/agent-runtimes/');
|
|
63
|
-
}
|
|
64
|
-
if (normalized.includes('/jupyter-server/')) {
|
|
65
|
-
return normalized.replace('/jupyter-server/', '/agent-runtimes/');
|
|
66
|
-
}
|
|
67
|
-
return normalized.replace('/jupyter/', '/agent-runtimes/');
|
|
68
|
-
};
|
|
69
122
|
const toSurfaceLabel = (exampleId) => {
|
|
70
123
|
if (exampleId.toLowerCase().includes('cell')) {
|
|
71
124
|
return 'cell';
|
|
@@ -94,24 +147,6 @@ const normalizeSandboxBaseUrl = (sandboxBaseUrl, agentBaseUrl) => {
|
|
|
94
147
|
return sandboxRaw;
|
|
95
148
|
}
|
|
96
149
|
};
|
|
97
|
-
const withTokenQueryParam = (rawUrl, token) => {
|
|
98
|
-
const normalizedUrl = String(rawUrl || '').trim();
|
|
99
|
-
const normalizedToken = String(token || '').trim();
|
|
100
|
-
if (!normalizedUrl || !normalizedToken) {
|
|
101
|
-
return normalizedUrl;
|
|
102
|
-
}
|
|
103
|
-
try {
|
|
104
|
-
const parsed = new URL(normalizedUrl);
|
|
105
|
-
if (!parsed.searchParams.get('token') &&
|
|
106
|
-
!parsed.searchParams.get('jupyter_token')) {
|
|
107
|
-
parsed.searchParams.set('token', normalizedToken);
|
|
108
|
-
}
|
|
109
|
-
return parsed.toString();
|
|
110
|
-
}
|
|
111
|
-
catch {
|
|
112
|
-
return normalizedUrl;
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
150
|
const resolveRuntimesUrl = (configured) => {
|
|
116
151
|
const envRuntimeUrl = import.meta.env.VITE_DATALAYER_RUNTIMES_URL;
|
|
117
152
|
const envBaseUrl = import.meta.env.VITE_DATALAYER_IAM_URL;
|
|
@@ -134,17 +169,16 @@ const toAgentRuntimesBaseUrl = (value) => {
|
|
|
134
169
|
}
|
|
135
170
|
return normalized;
|
|
136
171
|
};
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
};
|
|
172
|
+
/**
|
|
173
|
+
* The anonymous Jupyter server the `jupyter` target uses.
|
|
174
|
+
*
|
|
175
|
+
* The same one the jupyter-react examples point at: a real server, reachable
|
|
176
|
+
* without an account, so an example can execute code with nothing installed
|
|
177
|
+
* and nobody signed in. It is a sandbox and only a sandbox — no agent lives
|
|
178
|
+
* there, which is why that target shows the chat switched off.
|
|
179
|
+
*/
|
|
180
|
+
const ANONYMOUS_JUPYTER_SERVER_URL = 'https://prod1.datalayer.run/api/jupyter-server';
|
|
181
|
+
const ANONYMOUS_JUPYTER_SERVER_TOKEN = '60c1661cc408f978c309d04157af55c9588ff9557c9380e4fb50785750703da6';
|
|
148
182
|
const resolveLocalJupyterServerUrl = () => {
|
|
149
183
|
const normalizeLoopbackHost = (raw) => {
|
|
150
184
|
const trimmed = raw.trim().replace(/\/$/, '');
|
|
@@ -167,11 +201,58 @@ const resolveLocalJupyterServerUrl = () => {
|
|
|
167
201
|
return normalizeLoopbackHost(envLocalUrl);
|
|
168
202
|
}
|
|
169
203
|
const configured = getJupyterServerUrl();
|
|
170
|
-
if (configured &&
|
|
204
|
+
if (configured && isLocalUrl(configured)) {
|
|
171
205
|
return normalizeLoopbackHost(configured);
|
|
172
206
|
}
|
|
173
207
|
return normalizeLoopbackHost(DEFAULT_LOCAL_JUPYTER_SERVER_URL);
|
|
174
208
|
};
|
|
209
|
+
/**
|
|
210
|
+
* The one in-page JupyterLite manager, created at most once.
|
|
211
|
+
*
|
|
212
|
+
* A `LiteServer` registers a mock WebSocket server per kernel URL, so building
|
|
213
|
+
* a second one on the same page throws `A mock server is already listening on
|
|
214
|
+
* this url` and leaves the notebook without a kernel. Switching to Browser,
|
|
215
|
+
* away, and back is an ordinary thing to do, so the manager is remembered
|
|
216
|
+
* rather than rebuilt — which is what jupyter-react does behind `<Jupyter
|
|
217
|
+
* lite>`, where it is created only `if (!serviceManager)`.
|
|
218
|
+
*
|
|
219
|
+
* The promise is cached, not the resolved value: a second switch arriving
|
|
220
|
+
* mid-start awaits the same start instead of racing it into the same error.
|
|
221
|
+
*/
|
|
222
|
+
let browserServiceManager = null;
|
|
223
|
+
/** A sandbox in this page: JupyterLite over a Pyodide kernel, no server. */
|
|
224
|
+
const createBrowserServiceManager = async () => {
|
|
225
|
+
// The in-page server is this page. Whichever target ran before left the
|
|
226
|
+
// Jupyter base url pointing at its own server — `prod1`, or localhost —
|
|
227
|
+
// and JupyterLite builds its kernel WebSocket addresses from that, so
|
|
228
|
+
// without this the browser sandbox dials a remote host for a kernel that
|
|
229
|
+
// only exists here.
|
|
230
|
+
setJupyterServerUrl(window.location.origin);
|
|
231
|
+
setJupyterServerToken('');
|
|
232
|
+
browserServiceManager =
|
|
233
|
+
browserServiceManager ??
|
|
234
|
+
// JupyterLite and the Pyodide kernel are megabytes; a person who never
|
|
235
|
+
// picks this target should not pay for them.
|
|
236
|
+
import('@datalayer/jupyter-react')
|
|
237
|
+
.then(({ createLiteServiceManager }) => createLiteServiceManager())
|
|
238
|
+
.then(manager => manager)
|
|
239
|
+
.catch(error => {
|
|
240
|
+
// A failed start must not be cached, or the target stays dead for
|
|
241
|
+
// the rest of the session.
|
|
242
|
+
browserServiceManager = null;
|
|
243
|
+
throw error;
|
|
244
|
+
});
|
|
245
|
+
return browserServiceManager;
|
|
246
|
+
};
|
|
247
|
+
/** A sandbox on the anonymous Jupyter server — real server, no account. */
|
|
248
|
+
const createAnonymousJupyterServiceManager = async () => {
|
|
249
|
+
setJupyterServerUrl(ANONYMOUS_JUPYTER_SERVER_URL);
|
|
250
|
+
setJupyterServerToken(ANONYMOUS_JUPYTER_SERVER_TOKEN);
|
|
251
|
+
const serverSettings = createServerSettings(ANONYMOUS_JUPYTER_SERVER_URL, ANONYMOUS_JUPYTER_SERVER_TOKEN);
|
|
252
|
+
const manager = new ServiceManager({ serverSettings });
|
|
253
|
+
await manager.ready;
|
|
254
|
+
return manager;
|
|
255
|
+
};
|
|
175
256
|
const ensureLocalJupyterToken = () => {
|
|
176
257
|
const token = (getJupyterServerToken() || '').trim();
|
|
177
258
|
if (!token) {
|
|
@@ -253,6 +334,15 @@ const loadConfigurations = () => {
|
|
|
253
334
|
}
|
|
254
335
|
};
|
|
255
336
|
const getExampleEntriesList = () => getExampleEntries();
|
|
337
|
+
/**
|
|
338
|
+
* Those examples, as cards.
|
|
339
|
+
*
|
|
340
|
+
* Module scope, not a `useMemo`: the list is a constant, and computing it in
|
|
341
|
+
* the component put a hook after three early returns — so a render that took
|
|
342
|
+
* one of them called fewer hooks than the render before it, which React
|
|
343
|
+
* refuses outright. A value that never changes has no business being a hook.
|
|
344
|
+
*/
|
|
345
|
+
const ANONYMOUS_EXAMPLE_ENTRIES = getExampleEntriesList().filter(entry => ANONYMOUS_EXAMPLES.has(entry.id));
|
|
256
346
|
const getInitialSearchQuery = () => {
|
|
257
347
|
const params = new URLSearchParams(window.location.search);
|
|
258
348
|
return (params.get('q') || '').trim();
|
|
@@ -481,11 +571,11 @@ const NotebookOnlyApp = () => {
|
|
|
481
571
|
}
|
|
482
572
|
}
|
|
483
573
|
// Create service manager
|
|
484
|
-
if (runtimeTargetStore.getState().target === '
|
|
574
|
+
if (runtimeTargetStore.getState().target === 'datalayer' &&
|
|
485
575
|
configuration?.token) {
|
|
486
576
|
try {
|
|
487
577
|
const activeSummary = agentSummaryStore.getState().active;
|
|
488
|
-
if (!activeSummary || activeSummary.location !== '
|
|
578
|
+
if (!activeSummary || activeSummary.location !== 'datalayer') {
|
|
489
579
|
throw new Error('No active cloud agent sandbox found for notebook-only mode.');
|
|
490
580
|
}
|
|
491
581
|
const manager = await createServiceManagerFromAgentSandbox({
|
|
@@ -504,11 +594,21 @@ const NotebookOnlyApp = () => {
|
|
|
504
594
|
}
|
|
505
595
|
}
|
|
506
596
|
else {
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
const
|
|
510
|
-
const manager =
|
|
511
|
-
|
|
597
|
+
// Notebook-only mode has no agent of its own, but it still runs on
|
|
598
|
+
// whichever sandbox the person picked.
|
|
599
|
+
const target = runtimeTargetStore.getState().target;
|
|
600
|
+
const manager = target === 'browser'
|
|
601
|
+
? await createBrowserServiceManager()
|
|
602
|
+
: target === 'jupyter'
|
|
603
|
+
? await createAnonymousJupyterServiceManager()
|
|
604
|
+
: await (async () => {
|
|
605
|
+
setJupyterServerUrl(resolveLocalJupyterServerUrl());
|
|
606
|
+
ensureLocalJupyterToken();
|
|
607
|
+
const serverSettings = createServerSettings(getJupyterServerUrl(), getJupyterServerToken());
|
|
608
|
+
const local = new ServiceManager({ serverSettings });
|
|
609
|
+
await local.ready;
|
|
610
|
+
return local;
|
|
611
|
+
})();
|
|
512
612
|
setServiceManager(manager);
|
|
513
613
|
}
|
|
514
614
|
setLoading(false);
|
|
@@ -546,11 +646,19 @@ export const ExampleApp = () => {
|
|
|
546
646
|
const [error, setError] = useState(null);
|
|
547
647
|
const [serviceManager, setServiceManager] = useState(null);
|
|
548
648
|
const [selectedExample, setSelectedExample] = useState(getDefaultExampleName());
|
|
649
|
+
// The example on screen, readable from closures that were frozen at the
|
|
650
|
+
// first render — see `createCloudServiceManager`.
|
|
651
|
+
const selectedExampleRef = useRef(selectedExample);
|
|
652
|
+
selectedExampleRef.current = selectedExample;
|
|
549
653
|
const [searchQuery, setSearchQuery] = useState(getInitialSearchQuery());
|
|
550
654
|
const [isChangingExample, setIsChangingExample] = useState(false);
|
|
551
655
|
const [topNotice, setTopNotice] = useState(null);
|
|
552
656
|
const runtimeTarget = useRuntimeTargetStore(state => state.target);
|
|
553
657
|
const setRuntimeTarget = useRuntimeTargetStore(state => state.setTarget);
|
|
658
|
+
const shellRuntime = useAgentRuntimes({
|
|
659
|
+
autoCreateAgent: false,
|
|
660
|
+
runtimeCreationTarget: 'backend-services',
|
|
661
|
+
});
|
|
554
662
|
const showTopNotice = useCallback((message, tone = 'info', durationMs = 4500, details) => {
|
|
555
663
|
setTopNotice({
|
|
556
664
|
id: Date.now() + Math.floor(Math.random() * 1000),
|
|
@@ -606,6 +714,12 @@ export const ExampleApp = () => {
|
|
|
606
714
|
return manager;
|
|
607
715
|
};
|
|
608
716
|
const createCloudServiceManager = async () => {
|
|
717
|
+
// Read, not captured: `createServiceManagerForTarget` is a `useCallback`
|
|
718
|
+
// with no dependencies, so anything this closure takes from render scope
|
|
719
|
+
// is frozen at the first render. Switching example and then switching
|
|
720
|
+
// target would otherwise bootstrap a sandbox for whichever example was
|
|
721
|
+
// on screen when the app started.
|
|
722
|
+
const exampleId = selectedExampleRef.current;
|
|
609
723
|
const { configuration } = coreStore.getState();
|
|
610
724
|
if (!configuration?.token) {
|
|
611
725
|
throw new Error('Cloud runtime requires authentication. Please sign in.');
|
|
@@ -645,108 +759,34 @@ export const ExampleApp = () => {
|
|
|
645
759
|
throw lastError;
|
|
646
760
|
};
|
|
647
761
|
const bootstrapCloudSandbox = async () => {
|
|
648
|
-
const
|
|
649
|
-
const
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
'Content-Type': 'application/json',
|
|
655
|
-
},
|
|
656
|
-
body: JSON.stringify({
|
|
657
|
-
environment: {
|
|
658
|
-
name: DEFAULT_CLOUD_RUNTIME_ENVIRONMENT,
|
|
659
|
-
},
|
|
660
|
-
given_name: `${exampleSlug}-sandbox`,
|
|
661
|
-
credits_limit: 5,
|
|
662
|
-
type: 'notebook',
|
|
663
|
-
editor_variant: 'none',
|
|
664
|
-
}),
|
|
762
|
+
const exampleSlug = safeExampleId(exampleId || 'example');
|
|
763
|
+
const connection = await shellRuntime.launchRuntime({
|
|
764
|
+
environmentName: DEFAULT_CLOUD_RUNTIME_ENVIRONMENT,
|
|
765
|
+
givenName: `${exampleSlug}-sandbox`,
|
|
766
|
+
creditsLimit: 5,
|
|
767
|
+
type: 'notebook',
|
|
665
768
|
});
|
|
666
|
-
if (!runtimeResp.ok) {
|
|
667
|
-
const failure = await runtimeResp.json().catch(() => ({}));
|
|
668
|
-
throw new Error(String(failure.detail ||
|
|
669
|
-
`Failed to launch cloud runtime (${runtimeResp.status}).`));
|
|
670
|
-
}
|
|
671
|
-
const runtimePayload = (await runtimeResp.json());
|
|
672
|
-
const ingress = String(runtimePayload.runtime?.ingress || runtimePayload.ingress || '').trim();
|
|
673
|
-
if (!ingress) {
|
|
674
|
-
throw new Error('Cloud runtime launched but did not expose a Jupyter ingress URL.');
|
|
675
|
-
}
|
|
676
|
-
const agentBaseUrl = toAgentApiBaseUrl(ingress);
|
|
677
769
|
const agentId = `${exampleSlug}-cloud-agent`;
|
|
678
|
-
const
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
name: agentId,
|
|
686
|
-
description: `Cloud sandbox agent for ${selectedExample}`,
|
|
687
|
-
agent_library: 'pydantic-ai',
|
|
688
|
-
transport: 'ag-ui',
|
|
689
|
-
model: DEFAULT_MODEL,
|
|
690
|
-
system_prompt: 'You are a helpful AI assistant.',
|
|
691
|
-
}),
|
|
770
|
+
const agent = await shellRuntime.createAgent({
|
|
771
|
+
name: agentId,
|
|
772
|
+
description: `Cloud sandbox agent for ${exampleId}`,
|
|
773
|
+
agentLibrary: 'pydantic-ai',
|
|
774
|
+
protocol: 'ag-ui',
|
|
775
|
+
model: DEFAULT_MODEL,
|
|
776
|
+
systemPrompt: 'You are a helpful AI assistant.',
|
|
692
777
|
});
|
|
693
|
-
if (!agentResp.ok &&
|
|
694
|
-
agentResp.status !== 400 &&
|
|
695
|
-
agentResp.status !== 409) {
|
|
696
|
-
const failure = await agentResp.json().catch(() => ({}));
|
|
697
|
-
throw new Error(String(failure.detail ||
|
|
698
|
-
`Cloud runtime launched but agent creation failed (${agentResp.status}).`));
|
|
699
|
-
}
|
|
700
|
-
const agentPayload = (await agentResp
|
|
701
|
-
.clone()
|
|
702
|
-
.json()
|
|
703
|
-
.catch(() => ({})));
|
|
704
|
-
const resolvedAgentId = String(agentPayload.agent_id ||
|
|
705
|
-
agentPayload.id ||
|
|
706
|
-
agentPayload.agent?.agent_id ||
|
|
707
|
-
agentPayload.agent?.id ||
|
|
708
|
-
'').trim() || agentId;
|
|
709
|
-
const resolvedJupyterToken = String(agentPayload.jupyter_token ||
|
|
710
|
-
agentPayload.token ||
|
|
711
|
-
runtimePayload.runtime?.jupyter_token ||
|
|
712
|
-
runtimePayload.runtime?.token ||
|
|
713
|
-
runtimePayload.jupyter_token ||
|
|
714
|
-
runtimePayload.token ||
|
|
715
|
-
'').trim();
|
|
716
778
|
const runtimeEnvironment = {
|
|
717
|
-
environmentName:
|
|
718
|
-
undefined,
|
|
719
|
-
environmentTitle: String(runtimePayload.runtime?.environment?.title || '').trim() ||
|
|
720
|
-
undefined,
|
|
721
|
-
cpu: String(runtimePayload.runtime?.environment?.cpu ||
|
|
722
|
-
runtimePayload.runtime?.environment?.resources?.cpu ||
|
|
723
|
-
'').trim() || undefined,
|
|
724
|
-
memory: String(runtimePayload.runtime?.environment?.memory ||
|
|
725
|
-
runtimePayload.runtime?.environment?.resources?.memory ||
|
|
726
|
-
'').trim() || undefined,
|
|
727
|
-
gpu: [
|
|
728
|
-
runtimePayload.runtime?.environment?.gpu ||
|
|
729
|
-
runtimePayload.runtime?.environment?.resources?.gpu ||
|
|
730
|
-
runtimePayload.runtime?.environment?.resources?.gpu_count ||
|
|
731
|
-
runtimePayload.runtime?.environment?.resources?.['nvidia.com/gpu'] ||
|
|
732
|
-
'',
|
|
733
|
-
runtimePayload.runtime?.environment?.resources?.gpu_type || '',
|
|
734
|
-
runtimePayload.runtime?.environment?.resources?.gpu_memory ||
|
|
735
|
-
'',
|
|
736
|
-
]
|
|
737
|
-
.map(value => String(value || '').trim())
|
|
738
|
-
.filter(Boolean)
|
|
739
|
-
.join(' ') || undefined,
|
|
779
|
+
environmentName: connection.environmentName,
|
|
740
780
|
};
|
|
741
781
|
return {
|
|
742
|
-
agentBaseUrl,
|
|
743
|
-
agentId:
|
|
744
|
-
ingress:
|
|
782
|
+
agentBaseUrl: connection.agentBaseUrl,
|
|
783
|
+
agentId: agent.agentId || agentId,
|
|
784
|
+
ingress: connection.jupyterBaseUrl,
|
|
745
785
|
runtimeEnvironment,
|
|
746
786
|
};
|
|
747
787
|
};
|
|
748
788
|
const activeSummary = agentSummaryStore.getState().active;
|
|
749
|
-
if (activeSummary?.location === '
|
|
789
|
+
if (activeSummary?.location === 'datalayer' &&
|
|
750
790
|
(activeSummary.sandboxBaseUrl || activeSummary.baseUrl)) {
|
|
751
791
|
try {
|
|
752
792
|
return await connectFromSummary({
|
|
@@ -756,30 +796,27 @@ export const ExampleApp = () => {
|
|
|
756
796
|
runtimeEnvironment: activeSummary.runtimeEnvironment,
|
|
757
797
|
});
|
|
758
798
|
}
|
|
759
|
-
catch
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
799
|
+
catch {
|
|
800
|
+
// The published sandbox is gone or unreachable. A fresh one is
|
|
801
|
+
// always allowed: an agent needs a runtime to run on, not a
|
|
802
|
+
// particular kind of example to run in.
|
|
763
803
|
showTopNotice('Existing cloud sandbox is unavailable. Launching a fresh sandbox...', 'warning', 3500);
|
|
764
804
|
}
|
|
765
805
|
}
|
|
766
|
-
if (!isNotebookOrCellExample(selectedExample)) {
|
|
767
|
-
throw new Error('No active cloud agent sandbox found. Open an agent example and launch a cloud agent first.');
|
|
768
|
-
}
|
|
769
806
|
showTopNotice('Starting a cloud agent sandbox...', 'info', 2600);
|
|
770
807
|
const launched = await bootstrapCloudSandbox();
|
|
771
808
|
agentSummaryStore.getState().setActive({
|
|
772
|
-
exampleId
|
|
809
|
+
exampleId,
|
|
773
810
|
agentName: launched.agentId,
|
|
774
811
|
agentId: launched.agentId,
|
|
775
|
-
location: '
|
|
812
|
+
location: 'datalayer',
|
|
776
813
|
baseUrl: launched.agentBaseUrl,
|
|
777
814
|
sandboxBaseUrl: launched.ingress,
|
|
778
815
|
runtimeEnvironment: launched.runtimeEnvironment,
|
|
779
816
|
status: 'running',
|
|
780
817
|
isReady: true,
|
|
781
818
|
});
|
|
782
|
-
showTopNotice(`Cloud sandbox ready. Connecting ${toSurfaceLabel(
|
|
819
|
+
showTopNotice(`Cloud sandbox ready. Connecting ${toSurfaceLabel(exampleId)} to it...`, 'success', 2600);
|
|
783
820
|
return connectFromSummary({
|
|
784
821
|
baseUrl: launched.agentBaseUrl,
|
|
785
822
|
sandboxBaseUrl: launched.ingress,
|
|
@@ -787,6 +824,54 @@ export const ExampleApp = () => {
|
|
|
787
824
|
runtimeEnvironment: launched.runtimeEnvironment,
|
|
788
825
|
});
|
|
789
826
|
};
|
|
827
|
+
/**
|
|
828
|
+
* The service manager for a target.
|
|
829
|
+
*
|
|
830
|
+
* The single place that knows what each of the four positions means. The
|
|
831
|
+
* examples never see this: they read the target and what it offers, and the
|
|
832
|
+
* shell hands them a connected manager.
|
|
833
|
+
*/
|
|
834
|
+
const createServiceManagerForTarget = useCallback(async (target) => {
|
|
835
|
+
const manager = await (() => {
|
|
836
|
+
switch (target) {
|
|
837
|
+
case 'browser':
|
|
838
|
+
return createBrowserServiceManager();
|
|
839
|
+
case 'jupyter':
|
|
840
|
+
return createAnonymousJupyterServiceManager();
|
|
841
|
+
case 'datalayer':
|
|
842
|
+
return createCloudServiceManager();
|
|
843
|
+
case 'local':
|
|
844
|
+
default:
|
|
845
|
+
return createLocalServiceManager();
|
|
846
|
+
}
|
|
847
|
+
})();
|
|
848
|
+
/*
|
|
849
|
+
* Say out loud which manager this page is using.
|
|
850
|
+
*
|
|
851
|
+
* A component that calls `useJupyter()` without one of its own — and
|
|
852
|
+
* jupyter-react's `Output` is one, so any document holding a Jupyter
|
|
853
|
+
* output node reaches it — first looks for a manager published in the
|
|
854
|
+
* jupyter-react store, and builds its own from the page's
|
|
855
|
+
* `jupyter-config-data` only if it finds none. Nothing published one,
|
|
856
|
+
* so it built one; and that page config defaults to
|
|
857
|
+
* `<VITE_DATALAYER_RUNTIMES_URL>/api/jupyter-server`, which is the
|
|
858
|
+
* cloud. The Document Agent Sidebar was therefore opening a second
|
|
859
|
+
* service manager against `r1.datalayer.run` while the shell's own
|
|
860
|
+
* pointed at localhost — twenty-odd cross-origin requests, all refused,
|
|
861
|
+
* on the target whose whole meaning is "this machine".
|
|
862
|
+
*
|
|
863
|
+
* Publishing here is the mechanism the store already documents for
|
|
864
|
+
* exactly this ("adopt it rather than racing it with a second
|
|
865
|
+
* manager"), and it covers every target rather than the one that
|
|
866
|
+
* happened to show the symptom.
|
|
867
|
+
*/
|
|
868
|
+
jupyterReactStore.getState().setServiceManager(manager);
|
|
869
|
+
return manager;
|
|
870
|
+
},
|
|
871
|
+
// The factories close over stable setters and store reads; re-creating this
|
|
872
|
+
// on every render would restart the sandbox on each keystroke.
|
|
873
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
874
|
+
[]);
|
|
790
875
|
useEffect(() => {
|
|
791
876
|
// Load configurations
|
|
792
877
|
loadConfigurations();
|
|
@@ -794,30 +879,22 @@ export const ExampleApp = () => {
|
|
|
794
879
|
const initializeApp = async () => {
|
|
795
880
|
try {
|
|
796
881
|
const runtimeTarget = runtimeTargetStore.getState().target;
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
showTopNotice('Code sandbox connected successfully (cloud).', 'success', 2600);
|
|
804
|
-
// Load initial example
|
|
805
|
-
await loadExample(selectedExample, manager);
|
|
806
|
-
}
|
|
807
|
-
catch (error) {
|
|
808
|
-
console.error('Failed to create DatalayerServiceManager:', error);
|
|
809
|
-
showTopNotice(`Cloud runtime unavailable, using local instead: ${error instanceof Error ? error.message : String(error)}`, 'warning', 5500);
|
|
810
|
-
const manager = await createLocalServiceManager();
|
|
811
|
-
setServiceManager(manager);
|
|
812
|
-
// Load initial example
|
|
813
|
-
await loadExample(selectedExample, manager);
|
|
814
|
-
}
|
|
882
|
+
const capabilities = runtimeTargetCapabilities(runtimeTarget);
|
|
883
|
+
try {
|
|
884
|
+
const manager = await createServiceManagerForTarget(runtimeTarget);
|
|
885
|
+
setServiceManager(manager);
|
|
886
|
+
showTopNotice(`Code sandbox connected successfully (${capabilities.label.toLowerCase()}).`, 'success', 2600);
|
|
887
|
+
await loadExample(selectedExample, manager);
|
|
815
888
|
}
|
|
816
|
-
|
|
817
|
-
|
|
889
|
+
catch (error) {
|
|
890
|
+
console.error(`Failed to create a service manager for ${runtimeTarget}:`, error);
|
|
891
|
+
// Local is the fallback because it needs neither an account nor the
|
|
892
|
+
// network. Falling back to the target that just failed would only
|
|
893
|
+
// fail again.
|
|
894
|
+
showTopNotice(`${capabilities.label} unavailable, using local instead: ${error instanceof Error ? error.message : String(error)}`, 'warning', 5500);
|
|
895
|
+
setRuntimeTarget('local');
|
|
818
896
|
const manager = await createLocalServiceManager();
|
|
819
897
|
setServiceManager(manager);
|
|
820
|
-
// Load initial example
|
|
821
898
|
await loadExample(selectedExample, manager);
|
|
822
899
|
}
|
|
823
900
|
setLoading(false);
|
|
@@ -846,9 +923,15 @@ export const ExampleApp = () => {
|
|
|
846
923
|
});
|
|
847
924
|
// 2) Tear down any server-side agents created by the previous example and
|
|
848
925
|
// wipe in-process agent state so the next example boots fresh.
|
|
849
|
-
const
|
|
926
|
+
const currentTarget = runtimeTargetStore.getState().target;
|
|
927
|
+
const activeRuntime = agentSummaryStore.getState().active;
|
|
928
|
+
const agentBaseUrl = activeRuntime?.location === currentTarget && activeRuntime.baseUrl
|
|
929
|
+
? activeRuntime.baseUrl
|
|
930
|
+
: resolveExampleAgentRuntimesUrl(currentTarget);
|
|
850
931
|
const token = useSimpleAuthStore.getState().token;
|
|
851
|
-
|
|
932
|
+
if (targetHasAgent(currentTarget)) {
|
|
933
|
+
await teardownExampleAgents(agentBaseUrl, token ?? undefined);
|
|
934
|
+
}
|
|
852
935
|
// 3) Load and mount the new example.
|
|
853
936
|
setSelectedExample(newExample);
|
|
854
937
|
localStorage.setItem('selectedExample', newExample);
|
|
@@ -857,33 +940,51 @@ export const ExampleApp = () => {
|
|
|
857
940
|
const handleRuntimeTargetChange = async (newTarget) => {
|
|
858
941
|
if (newTarget === runtimeTarget || !serviceManager)
|
|
859
942
|
return;
|
|
943
|
+
const previousManager = serviceManager;
|
|
944
|
+
// 1) Unmount the current example FIRST so its cleanup hooks run against the
|
|
945
|
+
// still-valid OLD runtime (AG-UI disconnect, abort fetches, sandboxes).
|
|
946
|
+
setIsChangingExample(true);
|
|
947
|
+
setExampleComponent(null);
|
|
948
|
+
await new Promise(resolve => {
|
|
949
|
+
requestAnimationFrame(() => resolve());
|
|
950
|
+
});
|
|
951
|
+
// 2) Tear down the agents created on the OLD target, then wipe in-process
|
|
952
|
+
// agent state.
|
|
953
|
+
const activeRuntime = agentSummaryStore.getState().active;
|
|
954
|
+
const oldAgentBaseUrl = activeRuntime?.location === runtimeTarget && activeRuntime.baseUrl
|
|
955
|
+
? activeRuntime.baseUrl
|
|
956
|
+
: resolveExampleAgentRuntimesUrl(runtimeTarget);
|
|
957
|
+
const token = useSimpleAuthStore.getState().token;
|
|
958
|
+
if (targetHasAgent(runtimeTarget)) {
|
|
959
|
+
await teardownExampleAgents(oldAgentBaseUrl, token ?? undefined);
|
|
960
|
+
}
|
|
961
|
+
/*
|
|
962
|
+
* 3) Only now build the new target's sandbox.
|
|
963
|
+
*
|
|
964
|
+
* The order matters and used to be the other way round. Creating the
|
|
965
|
+
* manager first meant that for the cloud target — where building one
|
|
966
|
+
* launches a runtime and registers an agent, writing them into the shared
|
|
967
|
+
* `agentRuntimeStore` — the teardown above then wiped the runtime that had
|
|
968
|
+
* just been created for the *new* target while cleaning up after the old
|
|
969
|
+
* one. The example mounted with no runtime connected, could not create its
|
|
970
|
+
* agent on one, and showed no chat at all.
|
|
971
|
+
*/
|
|
860
972
|
let nextManager;
|
|
861
973
|
try {
|
|
862
|
-
nextManager =
|
|
863
|
-
newTarget === 'cloud'
|
|
864
|
-
? await createCloudServiceManager()
|
|
865
|
-
: await createLocalServiceManager();
|
|
974
|
+
nextManager = await createServiceManagerForTarget(newTarget);
|
|
866
975
|
}
|
|
867
976
|
catch (switchError) {
|
|
868
977
|
showTopNotice(`Failed to switch to ${newTarget}: ${switchError instanceof Error
|
|
869
978
|
? switchError.message
|
|
870
979
|
: String(switchError)}`, 'error', 6000);
|
|
980
|
+
// Put the person back where they were. The example is already unmounted
|
|
981
|
+
// and the old agents are gone, so the old target is re-entered from
|
|
982
|
+
// scratch rather than left half-torn-down.
|
|
983
|
+
await loadExample(selectedExample, previousManager);
|
|
871
984
|
return;
|
|
872
985
|
}
|
|
873
|
-
//
|
|
874
|
-
//
|
|
875
|
-
setIsChangingExample(true);
|
|
876
|
-
setExampleComponent(null);
|
|
877
|
-
await new Promise(resolve => {
|
|
878
|
-
requestAnimationFrame(() => resolve());
|
|
879
|
-
});
|
|
880
|
-
// 2) Tear down the agents created on the OLD target, then wipe state so a
|
|
881
|
-
// brand-new runtime is launched for the new target.
|
|
882
|
-
const oldAgentBaseUrl = resolveExampleAgentRuntimesUrl(runtimeTarget);
|
|
883
|
-
const token = useSimpleAuthStore.getState().token;
|
|
884
|
-
await teardownExampleAgents(oldAgentBaseUrl, token ?? undefined);
|
|
885
|
-
// 3) Switch the target and re-mount the example (its key includes the
|
|
886
|
-
// target, so this launches/connects a fresh runtime).
|
|
986
|
+
// 4) Switch the target and re-mount the example (its key includes the
|
|
987
|
+
// target, so this connects to the runtime built above).
|
|
887
988
|
setRuntimeTarget(newTarget);
|
|
888
989
|
setServiceManager(nextManager);
|
|
889
990
|
setError(null);
|
|
@@ -911,22 +1012,87 @@ export const ExampleApp = () => {
|
|
|
911
1012
|
exampleProps.onSelectExample = (name) => {
|
|
912
1013
|
void handleExampleChange(name);
|
|
913
1014
|
};
|
|
914
|
-
return (_jsx(ExampleAppThemed, { selectedExample: selectedExample, isChangingExample: isChangingExample, error: error, ExampleComponent: ExampleComponent, exampleProps: exampleProps, serviceManager: serviceManager, onExampleChange: handleExampleChange, onRuntimeTargetChange: handleRuntimeTargetChange, availableExamples: getExampleEntriesList(), topNotice: topNotice, onDismissTopNotice: () => setTopNotice(null) }));
|
|
1015
|
+
return (_jsx(ExampleAppThemed, { selectedExample: selectedExample, isChangingExample: isChangingExample, error: error, ExampleComponent: ExampleComponent, exampleProps: exampleProps, serviceManager: serviceManager, onExampleChange: handleExampleChange, anonymousExampleEntries: ANONYMOUS_EXAMPLE_ENTRIES, onRuntimeTargetChange: handleRuntimeTargetChange, availableExamples: getExampleEntriesList(), topNotice: topNotice, onDismissTopNotice: () => setTopNotice(null) }));
|
|
915
1016
|
};
|
|
916
1017
|
/**
|
|
917
1018
|
* Inner shell that reads from the theme store and wires
|
|
918
1019
|
* DatalayerThemeProvider + the header bar with selectors.
|
|
919
1020
|
*/
|
|
920
|
-
const ExampleAppThemed = ({ selectedExample, isChangingExample, error, ExampleComponent, exampleProps, serviceManager, onExampleChange, onRuntimeTargetChange, availableExamples, topNotice, onDismissTopNotice, }) => {
|
|
1021
|
+
const ExampleAppThemed = ({ selectedExample, isChangingExample, error, ExampleComponent, exampleProps, serviceManager, onExampleChange, anonymousExampleEntries, onRuntimeTargetChange, availableExamples, topNotice, onDismissTopNotice, }) => {
|
|
921
1022
|
const { colorMode, theme: themeVariant } = useExampleThemeStore();
|
|
922
1023
|
const runtimeTarget = useRuntimeTargetStore(state => state.target);
|
|
923
1024
|
const agentSummary = useAgentSummaryStore(state => state.active);
|
|
1025
|
+
// Some examples bring their own sandbox switch — the LOOP workspace has one
|
|
1026
|
+
// in its header. Two controls for one sandbox is one too many, and the
|
|
1027
|
+
// second would not agree with the first.
|
|
1028
|
+
const exampleOwnsSandboxControl = Boolean(availableExamples
|
|
1029
|
+
.find(entry => entry.id === selectedExample)
|
|
1030
|
+
?.tags?.includes('owns-sandbox-control'));
|
|
924
1031
|
const isHome = selectedExample === 'HomeExample';
|
|
1032
|
+
// The one example that describes its own agent — see the header below.
|
|
1033
|
+
const isLoopWorkspace = selectedExample === 'LoopWorkspaceExample';
|
|
925
1034
|
const cfg = themeConfigs[themeVariant];
|
|
926
1035
|
const logoColors = getLogoColors(themeVariant, colorMode);
|
|
927
1036
|
const { token, setAuth, clearAuth } = useSimpleAuthStore();
|
|
928
1037
|
const [showSignIn, setShowSignIn] = useState(false);
|
|
929
|
-
const
|
|
1038
|
+
const [exampleSearch, setExampleSearch] = useState('');
|
|
1039
|
+
/*
|
|
1040
|
+
* The sign-in screen stands aside for an example that needs no account.
|
|
1041
|
+
*
|
|
1042
|
+
* Without this the screen offered the Loop workspace as a card and then
|
|
1043
|
+
* stayed put when it was chosen: the example *was* selected, and nothing
|
|
1044
|
+
* rendered it, because `showSignIn` knows only that nobody is signed in.
|
|
1045
|
+
* Offering a way through and then not taking it is worse than not offering
|
|
1046
|
+
* it.
|
|
1047
|
+
*/
|
|
1048
|
+
const shouldShowAuthScreen = showSignIn && !token && !ANONYMOUS_EXAMPLES.has(selectedExample);
|
|
1049
|
+
const selectedExampleEntry = availableExamples.find(example => example.id === selectedExample);
|
|
1050
|
+
const exampleMenuGroups = useMemo(() => {
|
|
1051
|
+
const groups = new Map();
|
|
1052
|
+
for (const example of availableExamples) {
|
|
1053
|
+
if (example.id === 'HomeExample')
|
|
1054
|
+
continue;
|
|
1055
|
+
const groupName = getExampleGroup(example.id);
|
|
1056
|
+
const group = groups.get(groupName) ?? [];
|
|
1057
|
+
group.push(example);
|
|
1058
|
+
groups.set(groupName, group);
|
|
1059
|
+
}
|
|
1060
|
+
for (const [groupName, examples] of groups) {
|
|
1061
|
+
examples.sort((left, right) => {
|
|
1062
|
+
if (groupName === 'Loop') {
|
|
1063
|
+
// The shells first, most naked first; then the loop that drives a
|
|
1064
|
+
// notebook; then the library of specs behind them all.
|
|
1065
|
+
const LOOP_ORDER = [
|
|
1066
|
+
'LoopShellExample',
|
|
1067
|
+
'LoopWorkspaceExample',
|
|
1068
|
+
'AgentLoopExample',
|
|
1069
|
+
'AgentspecsExample',
|
|
1070
|
+
];
|
|
1071
|
+
const loopOrder = (id) => {
|
|
1072
|
+
const index = LOOP_ORDER.indexOf(id);
|
|
1073
|
+
return index === -1 ? LOOP_ORDER.length : index;
|
|
1074
|
+
};
|
|
1075
|
+
const order = loopOrder(left.id) - loopOrder(right.id);
|
|
1076
|
+
if (order !== 0)
|
|
1077
|
+
return order;
|
|
1078
|
+
}
|
|
1079
|
+
return left.title.localeCompare(right.title);
|
|
1080
|
+
});
|
|
1081
|
+
}
|
|
1082
|
+
return groups;
|
|
1083
|
+
}, [availableExamples]);
|
|
1084
|
+
const filteredExampleMenuGroups = useMemo(() => {
|
|
1085
|
+
const query = exampleSearch.trim().toLowerCase();
|
|
1086
|
+
if (!query)
|
|
1087
|
+
return exampleMenuGroups;
|
|
1088
|
+
const filtered = new Map();
|
|
1089
|
+
for (const [groupName, examples] of exampleMenuGroups) {
|
|
1090
|
+
const matches = examples.filter(example => example.title.toLowerCase().includes(query));
|
|
1091
|
+
if (matches.length)
|
|
1092
|
+
filtered.set(groupName, matches);
|
|
1093
|
+
}
|
|
1094
|
+
return filtered;
|
|
1095
|
+
}, [exampleMenuGroups, exampleSearch]);
|
|
930
1096
|
const syncTokenToIamStore = useCallback((newToken) => {
|
|
931
1097
|
import('../state/substates').then(({ iamStore: coreIamStore }) => {
|
|
932
1098
|
coreIamStore.setState({ token: newToken });
|
|
@@ -935,9 +1101,7 @@ const ExampleAppThemed = ({ selectedExample, isChangingExample, error, ExampleCo
|
|
|
935
1101
|
useEffect(() => {
|
|
936
1102
|
const jupyterSandboxBaseUrl = toAgentRuntimesBaseUrl(serviceManager?.serverSettings.baseUrl);
|
|
937
1103
|
const agentApiBaseUrl = resolveExampleAgentRuntimesUrl(runtimeTarget);
|
|
938
|
-
const
|
|
939
|
-
selectedExample.includes('Cell')) &&
|
|
940
|
-
!selectedExample.includes('Agent');
|
|
1104
|
+
const sandboxOnly = isSandboxOnlyExample(selectedExample);
|
|
941
1105
|
// Seed a base summary for the selected example. Do NOT clobber a richer
|
|
942
1106
|
// summary that the mounted example already published (spec id, agent id,
|
|
943
1107
|
// readiness) for the same example + target — otherwise fast-settling local
|
|
@@ -956,8 +1120,8 @@ const ExampleAppThemed = ({ selectedExample, isChangingExample, error, ExampleCo
|
|
|
956
1120
|
exampleId: selectedExample,
|
|
957
1121
|
agentName: selectedExample,
|
|
958
1122
|
location: runtimeTarget,
|
|
959
|
-
baseUrl:
|
|
960
|
-
sandboxBaseUrl:
|
|
1123
|
+
baseUrl: sandboxOnly ? '' : agentApiBaseUrl,
|
|
1124
|
+
sandboxBaseUrl: sandboxOnly ? jupyterSandboxBaseUrl : undefined,
|
|
961
1125
|
status: isChangingExample ? 'switching' : 'selected',
|
|
962
1126
|
});
|
|
963
1127
|
}, [selectedExample, runtimeTarget, isChangingExample, serviceManager]);
|
|
@@ -1007,7 +1171,13 @@ const ExampleAppThemed = ({ selectedExample, isChangingExample, error, ExampleCo
|
|
|
1007
1171
|
bg: 'canvas.default',
|
|
1008
1172
|
borderBottom: '1px solid',
|
|
1009
1173
|
borderColor: 'border.default',
|
|
1010
|
-
}, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Box, { as: "button", onClick: () =>
|
|
1174
|
+
}, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Box, { as: "button", onClick: () => {
|
|
1175
|
+
// Also the way back out of the sign-in view, which nothing
|
|
1176
|
+
// else dismisses: with the example chooser hidden behind it,
|
|
1177
|
+
// a person who changed their mind would otherwise be stuck.
|
|
1178
|
+
setShowSignIn(false);
|
|
1179
|
+
void onExampleChange('HomeExample');
|
|
1180
|
+
}, title: "Home", "aria-label": "Go to examples home", sx: {
|
|
1011
1181
|
display: 'inline-flex',
|
|
1012
1182
|
alignItems: 'center',
|
|
1013
1183
|
justifyContent: 'center',
|
|
@@ -1019,128 +1189,86 @@ const ExampleAppThemed = ({ selectedExample, isChangingExample, error, ExampleCo
|
|
|
1019
1189
|
bg: 'canvas.default',
|
|
1020
1190
|
color: 'fg.default',
|
|
1021
1191
|
cursor: isChangingExample ? 'not-allowed' : 'pointer',
|
|
1022
|
-
}, disabled: isChangingExample, children: _jsx(HomeIcon, { size: 16 }) }), _jsx(
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
if (id === 'AgentspecsExample' || id === 'AgentLoopExample')
|
|
1044
|
-
return 'Personas';
|
|
1045
|
-
if (id.startsWith('A2Ui'))
|
|
1046
|
-
return 'A2UI';
|
|
1047
|
-
if (id.startsWith('AgUi'))
|
|
1048
|
-
return 'AG-UI';
|
|
1049
|
-
if (id.startsWith('CopilotKit'))
|
|
1050
|
-
return 'CopilotKit';
|
|
1051
|
-
if (id.startsWith('Agent'))
|
|
1052
|
-
return 'Agent';
|
|
1053
|
-
if (id.startsWith('Chat'))
|
|
1054
|
-
return 'Chat';
|
|
1055
|
-
if (id.startsWith('Lexical'))
|
|
1056
|
-
return 'Lexical';
|
|
1057
|
-
if (id.startsWith('Notebook') ||
|
|
1058
|
-
id === 'NotebookCollaborationExample')
|
|
1059
|
-
return 'Notebook';
|
|
1060
|
-
return 'Cell';
|
|
1061
|
-
};
|
|
1062
|
-
const groupOrder = [
|
|
1063
|
-
'Personas',
|
|
1064
|
-
'A2UI',
|
|
1065
|
-
'AG-UI',
|
|
1066
|
-
'Agent',
|
|
1067
|
-
'Chat',
|
|
1068
|
-
'Lexical',
|
|
1069
|
-
'Notebook',
|
|
1070
|
-
'Cell',
|
|
1071
|
-
'CopilotKit',
|
|
1072
|
-
];
|
|
1073
|
-
const grouped = new Map();
|
|
1074
|
-
for (const ex of rest) {
|
|
1075
|
-
const g = groupOf(ex.id);
|
|
1076
|
-
const group = grouped.get(g);
|
|
1077
|
-
if (group) {
|
|
1078
|
-
group.push(ex);
|
|
1079
|
-
}
|
|
1080
|
-
else {
|
|
1081
|
-
grouped.set(g, [ex]);
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
for (const [groupName, list] of grouped.entries()) {
|
|
1085
|
-
if (groupName === 'Personas') {
|
|
1086
|
-
const personaOrder = (id) => {
|
|
1087
|
-
if (id === 'AgentspecsExample')
|
|
1088
|
-
return 0;
|
|
1089
|
-
if (id === 'AgentLoopExample')
|
|
1090
|
-
return 1;
|
|
1091
|
-
return 2;
|
|
1092
|
-
};
|
|
1093
|
-
list.sort((a, b) => {
|
|
1094
|
-
const orderDelta = personaOrder(a.id) - personaOrder(b.id);
|
|
1095
|
-
if (orderDelta !== 0)
|
|
1096
|
-
return orderDelta;
|
|
1097
|
-
return a.title.localeCompare(b.title);
|
|
1098
|
-
});
|
|
1099
|
-
}
|
|
1100
|
-
else {
|
|
1101
|
-
list.sort((a, b) => a.title.localeCompare(b.title));
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
const nodes = [];
|
|
1105
|
-
if (home) {
|
|
1106
|
-
nodes.push(_jsx("option", { value: home.id, disabled: home.id === selectedExample, children: home.title }, home.id));
|
|
1107
|
-
}
|
|
1108
|
-
let sepIndex = 0;
|
|
1109
|
-
for (const g of groupOrder) {
|
|
1110
|
-
const items = grouped.get(g);
|
|
1111
|
-
if (!items || items.length === 0)
|
|
1112
|
-
continue;
|
|
1113
|
-
nodes.push(_jsxs("option", { disabled: true, value: `__sep_${sepIndex}`, children: ["\u2500\u2500\u2500\u2500\u2500\u2500 ", g, " \u2500\u2500\u2500\u2500\u2500\u2500"] }, `__sep_${sepIndex++}`));
|
|
1114
|
-
for (const example of items) {
|
|
1115
|
-
nodes.push(_jsx("option", { value: example.id, disabled: example.id === selectedExample, children: example.title }, example.id));
|
|
1116
|
-
}
|
|
1117
|
-
}
|
|
1118
|
-
return _jsx(_Fragment, { children: nodes });
|
|
1119
|
-
})() }), _jsx(Box, { "aria-label": "Runtime target", title: "Runtime target", sx: {
|
|
1120
|
-
minWidth: '160px',
|
|
1192
|
+
}, disabled: isChangingExample, children: _jsx(HomeIcon, { size: 16 }) }), !shouldShowAuthScreen && (_jsxs(ActionMenu, { children: [_jsx(ActionMenu.Button, { disabled: isChangingExample, "aria-label": "Select example", sx: { minWidth: '250px', justifyContent: 'space-between' }, onClick: () => setExampleSearch(''), children: selectedExampleEntry?.title ?? selectedExample }), _jsxs(ActionMenu.Overlay, { width: "large", sx: {
|
|
1193
|
+
maxHeight: 'calc(100vh - 72px)',
|
|
1194
|
+
overflowY: 'auto',
|
|
1195
|
+
overscrollBehavior: 'contain',
|
|
1196
|
+
}, children: [_jsx(Box, { sx: {
|
|
1197
|
+
p: 2,
|
|
1198
|
+
borderBottom: '1px solid',
|
|
1199
|
+
borderColor: 'border.default',
|
|
1200
|
+
}, children: _jsx(TextInput, { autoFocus: true, block: true, "aria-label": "Filter examples", placeholder: "Filter examples...", value: exampleSearch, onChange: event => setExampleSearch(event.target.value) }) }), _jsxs(ActionList, { selectionVariant: "single", children: [availableExamples
|
|
1201
|
+
.filter(example => example.id === 'HomeExample' &&
|
|
1202
|
+
(!exampleSearch.trim() ||
|
|
1203
|
+
example.title
|
|
1204
|
+
.toLowerCase()
|
|
1205
|
+
.includes(exampleSearch.trim().toLowerCase())))
|
|
1206
|
+
.map(example => (_jsx(ActionList.Item, { selected: example.id === selectedExample, onSelect: () => void onExampleChange(example.id), children: example.title }, example.id))), _jsx(ActionList.Divider, {}), EXAMPLE_GROUP_ORDER.map(groupName => {
|
|
1207
|
+
const examples = filteredExampleMenuGroups.get(groupName);
|
|
1208
|
+
if (!examples?.length)
|
|
1209
|
+
return null;
|
|
1210
|
+
return (_jsx(ActionList.Group, { title: groupName, children: examples.map(example => (_jsx(ActionList.Item, { selected: example.id === selectedExample, onSelect: () => void onExampleChange(example.id), children: example.title }, example.id))) }, groupName));
|
|
1211
|
+
})] })] })] })), !shouldShowAuthScreen && !exampleOwnsSandboxControl && (_jsx(Box, { "aria-label": "Where the example runs", sx: {
|
|
1212
|
+
minWidth: '320px',
|
|
1121
1213
|
opacity: isHome || isChangingExample ? 0.6 : 1,
|
|
1122
|
-
}, children:
|
|
1123
|
-
|
|
1124
|
-
|
|
1214
|
+
}, children: _jsx(SegmentedControl, { "aria-label": "Where the example runs", fullWidth: true, size: "small", children: RUNTIME_TARGETS.map(target => {
|
|
1215
|
+
const capabilities = runtimeTargetCapabilities(target);
|
|
1216
|
+
// Signing in is what the Datalayer target needs; saying so on
|
|
1217
|
+
// the button beats letting the switch fail and explaining
|
|
1218
|
+
// afterwards.
|
|
1219
|
+
const needsSignIn = capabilities.requiresAuth && !token;
|
|
1220
|
+
const unavailable = isHome || needsSignIn;
|
|
1221
|
+
return (_jsx(SegmentedControl.Button, { selected: runtimeTarget === target, disabled: unavailable, title: needsSignIn
|
|
1222
|
+
? `${capabilities.hint} Sign in to use it.`
|
|
1223
|
+
: capabilities.hint, onClick: () => {
|
|
1224
|
+
if (!unavailable && !isChangingExample) {
|
|
1225
|
+
void onRuntimeTargetChange(target);
|
|
1125
1226
|
}
|
|
1126
|
-
}, children:
|
|
1127
|
-
|
|
1128
|
-
void onRuntimeTargetChange('cloud');
|
|
1129
|
-
}
|
|
1130
|
-
}, children: "Cloud" })] }) }), !isHome && _jsx(AgentSummary, { summary: agentSummary }), isChangingExample && (_jsx(Box, { as: "span", sx: { color: 'fg.muted', fontSize: 0 }, children: "Loading\u2026" }))] }), _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 3 }, children: [_jsx(AppearanceControlsWithStore, { useStore: useExampleThemeStore }), _jsx(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: token ? (_jsxs(_Fragment, { children: [_jsx(UserBadge, { token: token, variant: "small", onTokenExpired: () => {
|
|
1227
|
+
}, children: capabilities.label }, target));
|
|
1228
|
+
}) }) })), !isHome && !shouldShowAuthScreen && !isLoopWorkspace && (_jsx(AgentSummary, { summary: agentSummary })), isChangingExample && (_jsx(Box, { as: "span", sx: { color: 'fg.muted', fontSize: 0 }, children: "Loading\u2026" }))] }), _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 3 }, children: [_jsx(AppearanceControlsWithStore, { useStore: useExampleThemeStore }), _jsx(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: token ? (_jsxs(_Fragment, { children: [_jsx(UserBadge, { token: token, variant: "small", onTokenExpired: () => {
|
|
1131
1229
|
handleHeaderLogout();
|
|
1132
1230
|
setShowSignIn(true);
|
|
1133
1231
|
} }), _jsx(Button, { size: "small", variant: "invisible", onClick: handleHeaderLogout, leadingVisual: SignOutIcon, sx: { color: 'fg.muted' }, children: "Sign out" })] })) : (_jsx(Button, { size: "small", variant: "invisible", onClick: () => setShowSignIn(true), leadingVisual: SignInIcon, sx: { color: 'fg.muted' }, children: "Sign in" })) }), _jsx(Box, { as: "a", href: "https://datalayer.ai", target: "_blank", rel: "noopener noreferrer", "aria-label": "Open Datalayer website", sx: { display: 'inline-flex', alignItems: 'center' }, children: _jsx(DatalayerLogoText, { size: 24, variant: themeVariant, colorMode: colorMode, primaryColor: logoColors.primary, secondaryColor: logoColors.secondary, textColor: logoColors.textColor, primaryGradient: logoColors.primaryGradient, secondaryGradient: logoColors.secondaryGradient, gradient: true }) })] })] }), _jsx(Box, { sx: {
|
|
1134
1232
|
marginTop: '60px',
|
|
1135
1233
|
height: 'calc(100vh - 60px)',
|
|
1136
1234
|
overflow: 'hidden',
|
|
1137
|
-
}, children: shouldShowAuthScreen ? (
|
|
1235
|
+
}, children: shouldShowAuthScreen ? (
|
|
1236
|
+
/*
|
|
1237
|
+
Signing in, beside what can be seen without it.
|
|
1238
|
+
|
|
1239
|
+
A sign-in screen on its own says only "not yet". Most of these
|
|
1240
|
+
examples do need an account — they allocate runtimes somebody
|
|
1241
|
+
pays for — but the Loop workspace runs entirely in the page, so
|
|
1242
|
+
putting it here turns a closed door into a choice: sign in for
|
|
1243
|
+
the rest, or try this one now.
|
|
1244
|
+
*/
|
|
1245
|
+
_jsx(Box, { sx: {
|
|
1138
1246
|
width: '100%',
|
|
1139
1247
|
height: '100%',
|
|
1140
1248
|
bg: 'canvas.backdrop',
|
|
1141
1249
|
p: 3,
|
|
1142
1250
|
overflow: 'auto',
|
|
1143
|
-
}, children:
|
|
1251
|
+
}, children: _jsxs(Box, { sx: {
|
|
1252
|
+
display: 'grid',
|
|
1253
|
+
// Stacked on a narrow window, sign-in first: it is what the
|
|
1254
|
+
// reader came here for, and a column of cards above the form
|
|
1255
|
+
// would bury it.
|
|
1256
|
+
gridTemplateColumns: ['1fr', '1fr', '440px minmax(0, 1fr)'],
|
|
1257
|
+
gap: 4,
|
|
1258
|
+
maxWidth: 1400,
|
|
1259
|
+
mx: 'auto',
|
|
1260
|
+
alignItems: 'start',
|
|
1261
|
+
}, children: [_jsx(SignInSimple, { onSignIn: handleHeaderSignIn, onApiKeySignIn: apiKey => handleHeaderSignIn(apiKey, 'api-key-user'), title: "Agent Runtimes Examples", description: "Sign in to run authenticated examples and tools.", leadingIcon: _jsx(HomeIcon, { size: 24 }),
|
|
1262
|
+
// Level with the cards beside it. Left to itself the form
|
|
1263
|
+
// centres in `100vh`, which put it half a screen below the
|
|
1264
|
+
// column it shares a row with.
|
|
1265
|
+
fillHeight: false }), _jsx(Box, { sx: {
|
|
1266
|
+
border: '1px solid',
|
|
1267
|
+
borderColor: 'border.default',
|
|
1268
|
+
borderRadius: 2,
|
|
1269
|
+
overflow: 'hidden',
|
|
1270
|
+
bg: 'canvas.default',
|
|
1271
|
+
}, children: _jsx(HomeExample, { examples: anonymousExampleEntries, searchQuery: "", onSelectExample: name => void onExampleChange(name) }) })] }) })) : isChangingExample ? (_jsxs(Box, { sx: { p: 5, textAlign: 'center', color: 'fg.muted' }, children: [_jsxs("h3", { children: ["Loading ", selectedExample, "\u2026"] }), _jsx("p", { children: "Please wait while the example loads." })] })) : ExampleComponent ? (_jsx(ExampleErrorBoundary, { children: _jsx(ExampleWrapper, { children: _jsx(ExampleComponent, { ...exampleProps }, `${selectedExample}:${runtimeTarget}`) }, `${selectedExample}:${runtimeTarget}`) }, `${selectedExample}:${runtimeTarget}`)) : null }), _jsx(SlidingPanel, { isOpen: Boolean(topNotice), onDismiss: onDismissTopNotice, position: "north", variant: topNotice?.tone ?? 'info', durationMs: topNotice?.durationMs ?? 0, fullWidth: true, offset: 60, zIndex: 160, message: topNotice?.message || '', details: topNotice?.details })] }) }));
|
|
1144
1272
|
};
|
|
1145
1273
|
// Mount the app - check route to determine which app to render
|
|
1146
1274
|
const root = document.getElementById('root');
|