@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
|
@@ -0,0 +1,792 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
|
|
3
|
+
import { Box } from '@datalayer/primer-addons';
|
|
4
|
+
import { Button, Label, SegmentedControl, Spinner, Text, } from '@primer/react';
|
|
5
|
+
import { PlayIcon } from '@primer/octicons-react';
|
|
6
|
+
import { Output, OutputIPyWidgets } from '@datalayer/jupyter-react';
|
|
7
|
+
import { LoopEmbed } from '../loop';
|
|
8
|
+
import { AgentA2uiJupyterOutputPlugin } from '../loop/plugins/agent-a2ui-jupyter-output';
|
|
9
|
+
import { createChatExtrasPlugin } from '../loop/plugins/chat-extras';
|
|
10
|
+
import { A2UI_RENDER_SCOPE_SX, A2uiSurfaceComposed } from '../components/a2ui';
|
|
11
|
+
import { ThemedJupyterProvider, ThemedProvider } from './utils/themedProvider';
|
|
12
|
+
import { A2uiMarkdownProvider } from './utils/a2uiMarkdownProvider';
|
|
13
|
+
import { useA2uiProcessor } from './utils/a2ui';
|
|
14
|
+
import { useExampleAgentRuntime } from './hooks/useExampleAgentRuntime';
|
|
15
|
+
import { uniqueAgentId } from './utils/agentId';
|
|
16
|
+
import { useRuntimeTarget } from './utils/runtimeTargetStore';
|
|
17
|
+
const EXAMPLE_ID = 'A2UiJupyterOutputExample';
|
|
18
|
+
const AGENT_NAME = 'a2ui-jupyter-output';
|
|
19
|
+
const AGENTSPEC_ID = 'example-a2ui-jupyter-output';
|
|
20
|
+
/*
|
|
21
|
+
* The six kinds, as a value as well as a type.
|
|
22
|
+
*
|
|
23
|
+
* The list was written twice — once here and once in the tool's JSON schema
|
|
24
|
+
* `enum` — which is two places to forget one. Deriving both from this array
|
|
25
|
+
* keeps the schema the model is given and the check the handler performs
|
|
26
|
+
* describing the same six things.
|
|
27
|
+
*/
|
|
28
|
+
const DEMO_KINDS = [
|
|
29
|
+
'stream',
|
|
30
|
+
'figure',
|
|
31
|
+
'table',
|
|
32
|
+
'error',
|
|
33
|
+
'ipywidgets',
|
|
34
|
+
'interactive',
|
|
35
|
+
];
|
|
36
|
+
/** Whether a value the model sent is one of the kinds we know how to run. */
|
|
37
|
+
function isDemoKind(value) {
|
|
38
|
+
return (typeof value === 'string' &&
|
|
39
|
+
DEMO_KINDS.includes(value));
|
|
40
|
+
}
|
|
41
|
+
const SNIPPETS = [
|
|
42
|
+
{
|
|
43
|
+
id: 'stream',
|
|
44
|
+
label: 'Stream',
|
|
45
|
+
about: 'stdout and a returned value. The plainest case, and the one that reads worst as raw output.',
|
|
46
|
+
code: `import platform
|
|
47
|
+
import time
|
|
48
|
+
|
|
49
|
+
print("Python", platform.python_version())
|
|
50
|
+
planets = [("Mars", 2), ("Jupiter", 95), ("Saturn", 274)]
|
|
51
|
+
for index, (planet, moons) in enumerate(planets):
|
|
52
|
+
print(f"{planet:<8} {moons:>4} moons")
|
|
53
|
+
if index < len(planets) - 1:
|
|
54
|
+
for _ in range(6):
|
|
55
|
+
print(".", end="", flush=True)
|
|
56
|
+
time.sleep(0.25)
|
|
57
|
+
print()
|
|
58
|
+
|
|
59
|
+
sum(moons for _, moons in planets)
|
|
60
|
+
`,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: 'figure',
|
|
64
|
+
label: 'Figure',
|
|
65
|
+
about: 'An image/png mime bundle. As raw output this is a base64 blob; as a surface it is the plot.',
|
|
66
|
+
code: `import matplotlib
|
|
67
|
+
matplotlib.use("Agg")
|
|
68
|
+
import matplotlib.pyplot as plt
|
|
69
|
+
import numpy as np
|
|
70
|
+
from io import BytesIO
|
|
71
|
+
from IPython.display import Image, display
|
|
72
|
+
|
|
73
|
+
x = np.linspace(0, 4 * np.pi, 400)
|
|
74
|
+
figure, axes = plt.subplots(figsize=(5, 2.6))
|
|
75
|
+
axes.plot(x, np.sin(x), label="sin")
|
|
76
|
+
axes.plot(x, np.sin(x) * np.exp(-x / 8), label="damped")
|
|
77
|
+
axes.legend()
|
|
78
|
+
axes.set_title("Two waves")
|
|
79
|
+
png = BytesIO()
|
|
80
|
+
figure.savefig(png, format="png", bbox_inches="tight")
|
|
81
|
+
display(Image(data=png.getvalue()))
|
|
82
|
+
plt.close(figure)
|
|
83
|
+
`,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: 'table',
|
|
87
|
+
label: 'Table',
|
|
88
|
+
about: 'A DataFrame, which arrives as several representations of one value — text/plain beside text/html.',
|
|
89
|
+
code: `import pandas as pd
|
|
90
|
+
|
|
91
|
+
pd.DataFrame(
|
|
92
|
+
{
|
|
93
|
+
"environment": ["python-cpu", "python-gpu", "ai-agents"],
|
|
94
|
+
"runtimes": [12, 3, 27],
|
|
95
|
+
"credits": [4.5, 61.0, 18.25],
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
`,
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: 'error',
|
|
102
|
+
label: 'Error',
|
|
103
|
+
about: 'A traceback. The converter puts it first, above everything the code managed to print before it failed.',
|
|
104
|
+
code: `print("this much worked")
|
|
105
|
+
|
|
106
|
+
readings = {"north": 12.5, "south": 9.0}
|
|
107
|
+
readings["east"] / 2
|
|
108
|
+
`,
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: 'ipywidgets',
|
|
112
|
+
label: 'IPyWidgets',
|
|
113
|
+
about: 'An IntSlider with its widget view and manager state embedded in the output, rendered by jupyter-react as an actual interactive control.',
|
|
114
|
+
code: `from IPython.display import display
|
|
115
|
+
from ipywidgets import IntSlider
|
|
116
|
+
from ipywidgets.embed import embed_data
|
|
117
|
+
|
|
118
|
+
slider = IntSlider(
|
|
119
|
+
value=7,
|
|
120
|
+
min=0,
|
|
121
|
+
max=10,
|
|
122
|
+
step=1,
|
|
123
|
+
description="Count:",
|
|
124
|
+
continuous_update=True,
|
|
125
|
+
)
|
|
126
|
+
embedded = embed_data(views=[slider])
|
|
127
|
+
display(
|
|
128
|
+
{
|
|
129
|
+
"text/plain": repr(slider),
|
|
130
|
+
"application/vnd.jupyter.widget-view+json": embedded["view_specs"][0],
|
|
131
|
+
"application/vnd.jupyter.widget-state+json": embedded["manager_state"],
|
|
132
|
+
},
|
|
133
|
+
raw=True,
|
|
134
|
+
)
|
|
135
|
+
`,
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
id: 'interactive',
|
|
139
|
+
label: 'Interactive',
|
|
140
|
+
about: 'A surface you can press. The click comes back as `a2ui_action`, the code runs again knowing it, and the surface it returns replaces this one.',
|
|
141
|
+
actions: [
|
|
142
|
+
{ name: 'errors', label: 'Errors' },
|
|
143
|
+
{ name: 'warnings', label: 'Warnings' },
|
|
144
|
+
{ name: 'info', label: 'Info' },
|
|
145
|
+
],
|
|
146
|
+
code: `# \`a2ui_action\` is bound by the server when you press a button below.
|
|
147
|
+
choice = (globals().get("a2ui_action") or {}).get("name", "")
|
|
148
|
+
|
|
149
|
+
counts = {"errors": 3, "warnings": 11, "info": 240}
|
|
150
|
+
if choice in counts:
|
|
151
|
+
print(f"{choice}: {counts[choice]}")
|
|
152
|
+
else:
|
|
153
|
+
print("Pick a level to see its count.")
|
|
154
|
+
print("levels:", ", ".join(counts))
|
|
155
|
+
`,
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
id: 'chat',
|
|
159
|
+
label: 'Chat',
|
|
160
|
+
about: 'Ask the agent to run any demonstration. The suggestions call the same Jupyter execution path as the tabs above.',
|
|
161
|
+
code: '',
|
|
162
|
+
chat: true,
|
|
163
|
+
},
|
|
164
|
+
];
|
|
165
|
+
/*
|
|
166
|
+
* What to ask for, in the words somebody would actually use.
|
|
167
|
+
*
|
|
168
|
+
* These used to read 'Call run_jupyter_output_demo with kind "figure"' — a
|
|
169
|
+
* person reciting a function signature to a machine that already knows it,
|
|
170
|
+
* and a demonstration of the plumbing rather than of the product. Which tool
|
|
171
|
+
* answers a request is the agent's problem, and the agentspec's system prompt
|
|
172
|
+
* now tells it how to read each of these; a suggestion is for the reader.
|
|
173
|
+
*
|
|
174
|
+
* They name the code sandbox, because that is the thing being demonstrated
|
|
175
|
+
* and the reader can see it running.
|
|
176
|
+
*/
|
|
177
|
+
/** The surface this example draws into; re-running replaces rather than stacks. */
|
|
178
|
+
const SURFACE_ID = 'jupyter-output';
|
|
179
|
+
/**
|
|
180
|
+
* What the sandbox kernel returned, rendered through the same jupyter-react
|
|
181
|
+
* Output component applications use for notebook output.
|
|
182
|
+
*/
|
|
183
|
+
function JupyterOutputs({ execution, }) {
|
|
184
|
+
if (!execution) {
|
|
185
|
+
return (_jsx(Text, { sx: { color: 'fg.muted', fontSize: 1 }, children: "Nothing has run yet." }));
|
|
186
|
+
}
|
|
187
|
+
const outputs = [...(execution.outputs ?? [])];
|
|
188
|
+
const hasStdout = outputs.some(output => output.output_type === 'stream' && output.name === 'stdout');
|
|
189
|
+
if (!hasStdout && execution.stdout?.trim()) {
|
|
190
|
+
outputs.push({
|
|
191
|
+
output_type: 'stream',
|
|
192
|
+
name: 'stdout',
|
|
193
|
+
text: execution.stdout,
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
if (execution.stderr?.trim()) {
|
|
197
|
+
outputs.push({
|
|
198
|
+
output_type: 'stream',
|
|
199
|
+
name: 'stderr',
|
|
200
|
+
text: execution.stderr,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
if (execution.error &&
|
|
204
|
+
!outputs.some(output => output.output_type === 'error')) {
|
|
205
|
+
outputs.push({
|
|
206
|
+
output_type: 'error',
|
|
207
|
+
ename: 'ExecutionError',
|
|
208
|
+
evalue: execution.error,
|
|
209
|
+
traceback: [execution.error],
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
if (outputs.length === 0) {
|
|
213
|
+
return (_jsx(Text, { sx: { color: 'fg.muted', fontSize: 1 }, children: "The code ran and produced no output." }));
|
|
214
|
+
}
|
|
215
|
+
const widgetViewMime = 'application/vnd.jupyter.widget-view+json';
|
|
216
|
+
const widgetStateMime = 'application/vnd.jupyter.widget-state+json';
|
|
217
|
+
return (
|
|
218
|
+
/*
|
|
219
|
+
`ThemedJupyterProvider`, which is both halves of what this panel needs.
|
|
220
|
+
|
|
221
|
+
It had neither. The example's `ThemedProvider` supplies Primer and the
|
|
222
|
+
Datalayer theme and nothing Jupyter, so the JupyterLab stylesheets were
|
|
223
|
+
never loaded and no `--jp-*` variable existed on the page. `Output`
|
|
224
|
+
still rendered — its structure is React, and `OutputRenderer` colours an
|
|
225
|
+
error with an inline style needing no stylesheet — but everything that
|
|
226
|
+
makes it *look* like a notebook did not: `.jp-RenderedText`, an error's
|
|
227
|
+
background and padding, the mono stack, and the ipywidgets control CSS,
|
|
228
|
+
which is why a slider could arrive looking like text.
|
|
229
|
+
|
|
230
|
+
A bare `JupyterReactTheme` fixes that and brings its own problem: it
|
|
231
|
+
applies JupyterLab's palette, so the outputs stop matching the page
|
|
232
|
+
around them. This wrapper is the pairing that already exists for it —
|
|
233
|
+
the Datalayer theme outside, carrying the reader's chosen variant and
|
|
234
|
+
colormode, and a `JupyterReactTheme` inside it that loads the
|
|
235
|
+
stylesheets while taking its colormode and canvas from that theme, with
|
|
236
|
+
`useBaseStyles` off so the branded font survives.
|
|
237
|
+
*/
|
|
238
|
+
_jsx(ThemedJupyterProvider, { children: _jsx(Box, { sx: {
|
|
239
|
+
bg: 'canvas.default',
|
|
240
|
+
color: 'fg.default',
|
|
241
|
+
/*
|
|
242
|
+
The JupyterLab palette, pointed at the Datalayer one.
|
|
243
|
+
|
|
244
|
+
`JupyterLabCss` injects the `--jp-*` variables onto `document.body`,
|
|
245
|
+
for the whole page — so a wrapper's `backgroundColor` cannot reach
|
|
246
|
+
them, and the outputs kept JupyterLab's own white while the page
|
|
247
|
+
around them was the reader's theme. That is why an ipywidget arrived
|
|
248
|
+
sitting on a white band.
|
|
249
|
+
|
|
250
|
+
Redefining them here rather than fighting for specificity: custom
|
|
251
|
+
properties inherit, and the nearest definition wins for the subtree
|
|
252
|
+
below it. Everything Jupyter draws inside this panel — output areas,
|
|
253
|
+
rendered text, widget controls, which all resolve their colours
|
|
254
|
+
through these — therefore follows the theme the reader picked.
|
|
255
|
+
*/
|
|
256
|
+
'--jp-layout-color0': 'var(--bgColor-default)',
|
|
257
|
+
'--jp-layout-color1': 'var(--bgColor-default)',
|
|
258
|
+
'--jp-layout-color2': 'var(--bgColor-muted)',
|
|
259
|
+
'--jp-layout-color3': 'var(--bgColor-muted)',
|
|
260
|
+
'--jp-content-font-color0': 'var(--fgColor-default)',
|
|
261
|
+
'--jp-content-font-color1': 'var(--fgColor-default)',
|
|
262
|
+
'--jp-content-font-color2': 'var(--fgColor-muted)',
|
|
263
|
+
'--jp-ui-font-color0': 'var(--fgColor-default)',
|
|
264
|
+
'--jp-ui-font-color1': 'var(--fgColor-default)',
|
|
265
|
+
'--jp-ui-font-color2': 'var(--fgColor-muted)',
|
|
266
|
+
'--jp-border-color1': 'var(--borderColor-default)',
|
|
267
|
+
'--jp-border-color2': 'var(--borderColor-muted)',
|
|
268
|
+
'--jp-border-color3': 'var(--borderColor-muted)',
|
|
269
|
+
// ipywidgets keeps its own names, and a control left on the defaults
|
|
270
|
+
// is the one thing in the panel still wearing JupyterLab's palette.
|
|
271
|
+
'--jp-widgets-color': 'var(--fgColor-default)',
|
|
272
|
+
'--jp-widgets-label-color': 'var(--fgColor-default)',
|
|
273
|
+
'--jp-widgets-readout-color': 'var(--fgColor-default)',
|
|
274
|
+
'--jp-widgets-input-color': 'var(--fgColor-default)',
|
|
275
|
+
'--jp-widgets-input-background-color': 'var(--bgColor-default)',
|
|
276
|
+
'--jp-widgets-input-border-color': 'var(--borderColor-default)',
|
|
277
|
+
'--jp-widgets-border-color': 'var(--borderColor-default)',
|
|
278
|
+
'& .jp-OutputArea, & .jp-OutputArea-output': {
|
|
279
|
+
bg: 'canvas.default',
|
|
280
|
+
color: 'fg.default',
|
|
281
|
+
},
|
|
282
|
+
'& table, & th, & td': {
|
|
283
|
+
backgroundColor: 'canvas.default',
|
|
284
|
+
color: 'fg.default',
|
|
285
|
+
borderColor: 'border.default',
|
|
286
|
+
},
|
|
287
|
+
}, children: outputs.map((output, index) => {
|
|
288
|
+
const data = 'data' in output && output.data
|
|
289
|
+
? output.data
|
|
290
|
+
: undefined;
|
|
291
|
+
const view = data?.[widgetViewMime];
|
|
292
|
+
const state = data?.[widgetStateMime];
|
|
293
|
+
if (view && state) {
|
|
294
|
+
return (_jsx(OutputIPyWidgets, { view: view, state: state }, `${SURFACE_ID}-widget-${index}`));
|
|
295
|
+
}
|
|
296
|
+
const isError = output.output_type === 'error' ||
|
|
297
|
+
(output.output_type === 'stream' && output.name === 'stderr');
|
|
298
|
+
return (_jsx(Output, { id: `${SURFACE_ID}-output-${index}`, outputs: [output], autoRun: false, lumino: !isError, showControl: false, showEditor: false, showKernelProgressBar: false }, `${SURFACE_ID}-output-${index}`));
|
|
299
|
+
}) }) }));
|
|
300
|
+
}
|
|
301
|
+
function Panel({ title, caption, children, style, sx, }) {
|
|
302
|
+
return (_jsxs(Box, { sx: {
|
|
303
|
+
flex: '1 1 0',
|
|
304
|
+
height: '100%',
|
|
305
|
+
minWidth: 0,
|
|
306
|
+
minHeight: 0,
|
|
307
|
+
display: 'flex',
|
|
308
|
+
flexDirection: 'column',
|
|
309
|
+
border: '1px solid',
|
|
310
|
+
borderColor: 'border.default',
|
|
311
|
+
borderRadius: 2,
|
|
312
|
+
bg: 'canvas.default',
|
|
313
|
+
color: 'fg.default',
|
|
314
|
+
overflow: 'hidden',
|
|
315
|
+
}, children: [_jsxs(Box, { sx: {
|
|
316
|
+
px: 3,
|
|
317
|
+
py: 2,
|
|
318
|
+
borderBottom: '1px solid',
|
|
319
|
+
borderColor: 'border.default',
|
|
320
|
+
bg: 'canvas.default',
|
|
321
|
+
color: 'fg.default',
|
|
322
|
+
}, children: [_jsx(Text, { sx: { fontWeight: 'semibold' }, children: title }), _jsx(Text, { sx: { display: 'block', fontSize: 0, color: 'fg.muted' }, children: caption })] }), _jsx(Box, { style: style, sx: {
|
|
323
|
+
flex: '1 1 0',
|
|
324
|
+
minHeight: 0,
|
|
325
|
+
overflow: 'auto',
|
|
326
|
+
p: 3,
|
|
327
|
+
bg: 'canvas.default',
|
|
328
|
+
color: 'fg.default',
|
|
329
|
+
...sx,
|
|
330
|
+
}, children: children })] }));
|
|
331
|
+
}
|
|
332
|
+
const A2UiJupyterOutputExample = () => {
|
|
333
|
+
const { label: targetLabel } = useRuntimeTarget();
|
|
334
|
+
const agentName = useMemo(() => uniqueAgentId(AGENT_NAME), []);
|
|
335
|
+
const { agentId, isReady: agentReady, baseUrl: serverUrl, hasAgent, chatGate, error: agentError, } = useExampleAgentRuntime({
|
|
336
|
+
exampleId: EXAMPLE_ID,
|
|
337
|
+
agentName,
|
|
338
|
+
specId: AGENTSPEC_ID,
|
|
339
|
+
agentConfig: {
|
|
340
|
+
protocol: 'vercel-ai',
|
|
341
|
+
agentSpecId: AGENTSPEC_ID,
|
|
342
|
+
},
|
|
343
|
+
});
|
|
344
|
+
const unavailableReason = chatGate.disableReason;
|
|
345
|
+
const [snippetId, setSnippetId] = useState(SNIPPETS[0].id);
|
|
346
|
+
const snippet = useMemo(() => SNIPPETS.find(entry => entry.id === snippetId) ?? SNIPPETS[0], [snippetId]);
|
|
347
|
+
const [code, setCode] = useState(SNIPPETS[0].code);
|
|
348
|
+
const [running, setRunning] = useState(false);
|
|
349
|
+
const [failure, setFailure] = useState(null);
|
|
350
|
+
const [execution, setExecution] = useState(null);
|
|
351
|
+
// The code that drew what is on screen, so an action re-runs *it* rather
|
|
352
|
+
// than whatever happens to be in the editor by the time the click lands.
|
|
353
|
+
const sourceRef = useRef(SNIPPETS[0].code);
|
|
354
|
+
const actionsRef = useRef([]);
|
|
355
|
+
/* Which demonstration drew the surface, for the same reason `sourceRef` and
|
|
356
|
+
`actionsRef` exist: a click has to re-run the thing it was a click on.
|
|
357
|
+
Without it, pressing a button updated both panels and left the chat's copy
|
|
358
|
+
of that demonstration's output at whatever it was before the press. */
|
|
359
|
+
const kindRef = useRef(undefined);
|
|
360
|
+
const runRef = useRef(null);
|
|
361
|
+
const handleAction = useCallback((action) => {
|
|
362
|
+
void runRef.current?.(sourceRef.current, action, actionsRef.current, kindRef.current);
|
|
363
|
+
}, []);
|
|
364
|
+
const { surfaces, processMessages, resetSurfaces, themeStyle } = useA2uiProcessor(handleAction);
|
|
365
|
+
const run = useCallback(async (source, action, actions = [],
|
|
366
|
+
// Which demonstration this is, when it is one. The chat draws its output
|
|
367
|
+
// under the matching tool message, and needs the snapshots as they
|
|
368
|
+
// arrive rather than the result at the end.
|
|
369
|
+
kind) => {
|
|
370
|
+
if (!agentId) {
|
|
371
|
+
setFailure('The Jupyter agent is not ready yet.');
|
|
372
|
+
return null;
|
|
373
|
+
}
|
|
374
|
+
setRunning(true);
|
|
375
|
+
setFailure(null);
|
|
376
|
+
sourceRef.current = source;
|
|
377
|
+
actionsRef.current = actions;
|
|
378
|
+
kindRef.current = kind;
|
|
379
|
+
try {
|
|
380
|
+
const response = await fetch(`${serverUrl.replace(/\/$/, '')}/api/v1/sandbox/execute/a2ui`, {
|
|
381
|
+
method: 'POST',
|
|
382
|
+
headers: { 'content-type': 'application/json' },
|
|
383
|
+
body: JSON.stringify({
|
|
384
|
+
code: source,
|
|
385
|
+
action: action ?? null,
|
|
386
|
+
surface_id: SURFACE_ID,
|
|
387
|
+
agent_id: agentId,
|
|
388
|
+
actions,
|
|
389
|
+
// A2UI is a streaming protocol and its specification names the
|
|
390
|
+
// single POST as the one transport that cannot carry that. The
|
|
391
|
+
// stream demonstration prints a line at a time and was invisible
|
|
392
|
+
// until it had finished.
|
|
393
|
+
stream: true,
|
|
394
|
+
}),
|
|
395
|
+
});
|
|
396
|
+
if (!response.ok) {
|
|
397
|
+
setFailure(`The server could not run that (${response.status} ${response.statusText}).`);
|
|
398
|
+
return null;
|
|
399
|
+
}
|
|
400
|
+
// Replace rather than stack: a re-run is the same surface with new
|
|
401
|
+
// data, not a second one below the first. Done before the first
|
|
402
|
+
// message arrives, so the old surface is not on screen underneath the
|
|
403
|
+
// new one while it builds.
|
|
404
|
+
resetSurfaces();
|
|
405
|
+
/*
|
|
406
|
+
* Branch on what the server actually sent, not on what was asked for.
|
|
407
|
+
*
|
|
408
|
+
* A server that does not know the `stream` flag ignores it and answers
|
|
409
|
+
* with the whole surface as JSON — and a reader loop turned loose on
|
|
410
|
+
* that finds no `data:` lines, processes no messages, and renders an
|
|
411
|
+
* empty surface. Which is worse than not streaming: the feature would
|
|
412
|
+
* appear to have broken the example rather than simply not being
|
|
413
|
+
* there. The same branch covers an environment that gives no readable
|
|
414
|
+
* body at all.
|
|
415
|
+
*/
|
|
416
|
+
const streamed = (response.headers.get('content-type') ?? '').includes('text/event-stream');
|
|
417
|
+
const reader = streamed ? response.body?.getReader() : undefined;
|
|
418
|
+
if (!reader) {
|
|
419
|
+
const payload = await response.json();
|
|
420
|
+
const whole = (payload.execution ?? null);
|
|
421
|
+
setExecution(whole);
|
|
422
|
+
if (kind && whole) {
|
|
423
|
+
setExecutionsByKind(previous => ({ ...previous, [kind]: whole }));
|
|
424
|
+
}
|
|
425
|
+
processMessages((payload.messages ?? []));
|
|
426
|
+
return whole;
|
|
427
|
+
}
|
|
428
|
+
const decoder = new TextDecoder();
|
|
429
|
+
let buffer = '';
|
|
430
|
+
let nextExecution = null;
|
|
431
|
+
/*
|
|
432
|
+
* Surfaces already created, so a redelivered `createSurface` is not
|
|
433
|
+
* processed twice.
|
|
434
|
+
*
|
|
435
|
+
* The reference A2UI client keeps the same set for the same reason:
|
|
436
|
+
* the processor treats a second create for one id as an error, and a
|
|
437
|
+
* stream that re-announces its surface would otherwise fail partway
|
|
438
|
+
* through for a reason that looks nothing like its cause.
|
|
439
|
+
*/
|
|
440
|
+
const created = new Set();
|
|
441
|
+
while (true) {
|
|
442
|
+
const { done, value } = await reader.read();
|
|
443
|
+
if (done) {
|
|
444
|
+
break;
|
|
445
|
+
}
|
|
446
|
+
buffer += decoder.decode(value, { stream: true });
|
|
447
|
+
// Events are separated by a blank line; the last piece may be a
|
|
448
|
+
// partial event, so it stays in the buffer for the next read.
|
|
449
|
+
const chunks = buffer.split(/\r?\n\r?\n/);
|
|
450
|
+
buffer = chunks.pop() ?? '';
|
|
451
|
+
for (const chunk of chunks) {
|
|
452
|
+
for (const line of chunk.split(/\r?\n/)) {
|
|
453
|
+
if (!line.startsWith('data: ')) {
|
|
454
|
+
continue;
|
|
455
|
+
}
|
|
456
|
+
let event;
|
|
457
|
+
try {
|
|
458
|
+
event = JSON.parse(line.slice(6));
|
|
459
|
+
}
|
|
460
|
+
catch {
|
|
461
|
+
// A malformed event is not worth abandoning the run for.
|
|
462
|
+
continue;
|
|
463
|
+
}
|
|
464
|
+
/*
|
|
465
|
+
An execution snapshot, whether or not the run has finished.
|
|
466
|
+
|
|
467
|
+
The Jupyter Output panel renders from this rather than from
|
|
468
|
+
the A2UI surface, so applying it only on the final event left
|
|
469
|
+
one half of the comparison streaming and the other half
|
|
470
|
+
frozen until the end — which is the least useful place for the
|
|
471
|
+
difference to be.
|
|
472
|
+
*/
|
|
473
|
+
if (event.execution) {
|
|
474
|
+
nextExecution = event.execution;
|
|
475
|
+
setExecution(nextExecution);
|
|
476
|
+
if (kind) {
|
|
477
|
+
const snapshot = nextExecution;
|
|
478
|
+
setExecutionsByKind(previous => ({
|
|
479
|
+
...previous,
|
|
480
|
+
[kind]: snapshot,
|
|
481
|
+
}));
|
|
482
|
+
}
|
|
483
|
+
continue;
|
|
484
|
+
}
|
|
485
|
+
if (event.done) {
|
|
486
|
+
continue;
|
|
487
|
+
}
|
|
488
|
+
const create = event.createSurface;
|
|
489
|
+
if (create?.surfaceId) {
|
|
490
|
+
if (created.has(create.surfaceId)) {
|
|
491
|
+
continue;
|
|
492
|
+
}
|
|
493
|
+
created.add(create.surfaceId);
|
|
494
|
+
}
|
|
495
|
+
processMessages([event]);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
return nextExecution;
|
|
500
|
+
}
|
|
501
|
+
catch (error) {
|
|
502
|
+
setFailure(error instanceof Error ? error.message : String(error));
|
|
503
|
+
return null;
|
|
504
|
+
}
|
|
505
|
+
finally {
|
|
506
|
+
setRunning(false);
|
|
507
|
+
}
|
|
508
|
+
}, [agentId, processMessages, resetSurfaces, serverUrl]);
|
|
509
|
+
// Published for the processor's action callback, which is built once and
|
|
510
|
+
// cannot close over a `run` that changes with the server URL.
|
|
511
|
+
React.useEffect(() => {
|
|
512
|
+
runRef.current = run;
|
|
513
|
+
}, [run]);
|
|
514
|
+
const chooseSnippet = useCallback((next) => {
|
|
515
|
+
setSnippetId(next.id);
|
|
516
|
+
setCode(next.code);
|
|
517
|
+
setExecution(null);
|
|
518
|
+
setFailure(null);
|
|
519
|
+
resetSurfaces();
|
|
520
|
+
}, [resetSurfaces]);
|
|
521
|
+
/*
|
|
522
|
+
* Arguments typed as they actually arrive: unvalidated.
|
|
523
|
+
*
|
|
524
|
+
* This was declared `FrontendToolDefinition<{ kind: DemoKind }, …>`, and
|
|
525
|
+
* TypeScript was right to refuse it. Parameters are contravariant, so a
|
|
526
|
+
* handler that demands `{ kind: DemoKind }` cannot stand in for one the
|
|
527
|
+
* runner will call with an arbitrary `Record<string, unknown>` — and an
|
|
528
|
+
* arbitrary record is exactly what it gets, because these arguments are
|
|
529
|
+
* whatever the model emitted against the JSON schema below. Nothing between
|
|
530
|
+
* the model and here checks them.
|
|
531
|
+
*
|
|
532
|
+
* So the narrowing happens where the values are, at runtime. `isDemoKind`
|
|
533
|
+
* is the same check the lookup was doing implicitly, made explicit and made
|
|
534
|
+
* to say something useful when it fails.
|
|
535
|
+
*
|
|
536
|
+
* The result is left at the default `unknown` for a related reason: the
|
|
537
|
+
* optional `render` on this interface *consumes* the result, so the type is
|
|
538
|
+
* invariant in it, and a narrower result type cannot stand in for the wider
|
|
539
|
+
* one the tool list holds — whether or not this tool supplies a `render`.
|
|
540
|
+
* TypeScript checks the shape either way.
|
|
541
|
+
*/
|
|
542
|
+
/*
|
|
543
|
+
* Each kind's execution *as it arrives*, in state.
|
|
544
|
+
*
|
|
545
|
+
* This was a ref written once, after `run` resolved — two reasons the chat
|
|
546
|
+
* could not stream while the panels beside it did. A ref mutation does not
|
|
547
|
+
* re-render, so React had no reason to redraw the message; and there was
|
|
548
|
+
* nothing to draw until the run had finished anyway.
|
|
549
|
+
*
|
|
550
|
+
* The panels stream because they read `execution`, which `run` sets from
|
|
551
|
+
* every snapshot the server sends. This is the same thing, kept per kind so
|
|
552
|
+
* a second demonstration does not overwrite the first one's message.
|
|
553
|
+
*/
|
|
554
|
+
const [executionsByKind, setExecutionsByKind] = useState({});
|
|
555
|
+
/*
|
|
556
|
+
* Which surfaces the reader has opened, kept out of the DOM.
|
|
557
|
+
*
|
|
558
|
+
* A native `details` remembers being open only for as long as the element
|
|
559
|
+
* exists — and pressing a button in the surface calls `resetSurfaces`, which
|
|
560
|
+
* empties the list for a moment, unmounts the whole disclosure and mounts a
|
|
561
|
+
* new one for the replacement surface. So the fold shut itself on exactly
|
|
562
|
+
* the interaction it was open for, and had to be reopened to see the answer
|
|
563
|
+
* to the click.
|
|
564
|
+
*
|
|
565
|
+
* Keyed by tool call, so two demonstrations in one conversation stay
|
|
566
|
+
* independent of each other.
|
|
567
|
+
*/
|
|
568
|
+
const [openSurfaces, setOpenSurfaces] = useState({});
|
|
569
|
+
/*
|
|
570
|
+
* The output, drawn under the tool message in the conversation.
|
|
571
|
+
*
|
|
572
|
+
* Running a demonstration updated the two panels and left the chat saying
|
|
573
|
+
* only that a tool had been called — so a reader following the conversation
|
|
574
|
+
* was told something happened and shown none of it, and had to look away to
|
|
575
|
+
* find out what.
|
|
576
|
+
*
|
|
577
|
+
* This is `renderToolResult` on `Chat` rather than the `render` field on the
|
|
578
|
+
* tool definition. That field exists on `FrontendToolDefinition` and nothing
|
|
579
|
+
* in the chat ever calls it; the first version of this was written there and
|
|
580
|
+
* was simply dead code, which is only visible by grepping for the call site
|
|
581
|
+
* rather than by reading the type.
|
|
582
|
+
*
|
|
583
|
+
* The execution comes from a ref rather than from the tool's result, because
|
|
584
|
+
* a handler's return value is sent back to the model: putting a base64
|
|
585
|
+
* figure or a widget's manager state in there would spend the context window
|
|
586
|
+
* on bytes no model needs to read.
|
|
587
|
+
*/
|
|
588
|
+
const renderToolResult = useCallback(({ name, args, status, defaultUI, toolCallId }) => {
|
|
589
|
+
/*
|
|
590
|
+
The chat's own tool row, and the output underneath it.
|
|
591
|
+
|
|
592
|
+
Returning only the output replaced the row — so "Run Jupyter Output
|
|
593
|
+
Demo", its status and its arguments all disappeared, and any other
|
|
594
|
+
tool called in this chat would have rendered nothing at all, since
|
|
595
|
+
returning null here draws nothing rather than falling back.
|
|
596
|
+
*/
|
|
597
|
+
const kind = args.kind;
|
|
598
|
+
if (name !== 'run_jupyter_output_demo' || !isDemoKind(kind)) {
|
|
599
|
+
return defaultUI;
|
|
600
|
+
}
|
|
601
|
+
// Whatever has arrived so far, mid-run included: the row above says it
|
|
602
|
+
// is executing, and the output below should be filling in while it
|
|
603
|
+
// does, which is the whole point of streaming it.
|
|
604
|
+
const executed = executionsByKind[kind];
|
|
605
|
+
if (!executed) {
|
|
606
|
+
return defaultUI;
|
|
607
|
+
}
|
|
608
|
+
const demoActions = SNIPPETS.find(entry => entry.id === kind)?.actions ?? [];
|
|
609
|
+
return (_jsxs(_Fragment, { children: [defaultUI, demoActions.length > 0 ? (_jsxs(Box, { sx: { mt: 2 }, children: [_jsx(Text, { sx: { display: 'block', mb: 1, fontSize: 0, color: 'fg.muted' }, children: "Choose an action" }), _jsx(Box, { sx: { display: 'flex', flexWrap: 'wrap', gap: 2 }, children: demoActions.map((action, index) => (_jsx(Button, { size: "small", variant: index === 0 ? 'primary' : 'default', onClick: () =>
|
|
610
|
+
// A real client action, not a cast: the same shape the
|
|
611
|
+
// surface's own buttons emit, so the round-trip cannot
|
|
612
|
+
// tell the two apart. `sourceComponentId` says which
|
|
613
|
+
// button it was, which is the only field that differs.
|
|
614
|
+
handleAction({
|
|
615
|
+
name: action.name,
|
|
616
|
+
context: {},
|
|
617
|
+
surfaceId: SURFACE_ID,
|
|
618
|
+
sourceComponentId: `chat-action-${action.name}`,
|
|
619
|
+
timestamp: new Date().toISOString(),
|
|
620
|
+
}), children: action.label }, action.name))) })] })) : null, surfaces.length > 0 ? (
|
|
621
|
+
/*
|
|
622
|
+
Folded away, and shut to begin with.
|
|
623
|
+
|
|
624
|
+
The surface repeats the code, the status and the outputs, and in
|
|
625
|
+
a conversation that is a screenful of things the reader has just
|
|
626
|
+
read pushing the next message off the bottom. Open it when the
|
|
627
|
+
surface is the point — the interactive demonstration's buttons
|
|
628
|
+
live in here — and leave it out of the way when it is not.
|
|
629
|
+
|
|
630
|
+
A native `details`, so the disclosure keeps its keyboard
|
|
631
|
+
behaviour and its semantics for nothing, and so the surface
|
|
632
|
+
inside it stays mounted: the buttons remain live whether or not
|
|
633
|
+
anybody has opened it.
|
|
634
|
+
*/
|
|
635
|
+
_jsxs(Box, { as: "details",
|
|
636
|
+
// Shut to begin with, for every kind. What the interactive
|
|
637
|
+
// demonstration needed from being open — its buttons — is now
|
|
638
|
+
// above the fold, and what is left inside is the execution
|
|
639
|
+
// detail the reader has already been shown once.
|
|
640
|
+
open: openSurfaces[toolCallId] ?? false, onToggle: (event) => {
|
|
641
|
+
const isOpen = event.currentTarget.open;
|
|
642
|
+
setOpenSurfaces(previous => ({
|
|
643
|
+
...previous,
|
|
644
|
+
[toolCallId]: isOpen,
|
|
645
|
+
}));
|
|
646
|
+
}, sx: { mt: 2 }, children: [_jsx(Box, { as: "summary", sx: {
|
|
647
|
+
cursor: 'pointer',
|
|
648
|
+
fontSize: 0,
|
|
649
|
+
color: 'fg.muted',
|
|
650
|
+
// The marker is the affordance; without a list-style the
|
|
651
|
+
// triangle disappears in some browsers.
|
|
652
|
+
listStyle: 'revert',
|
|
653
|
+
'&:hover': { color: 'fg.default' },
|
|
654
|
+
}, children: "A2UI surface" }), _jsx(Box, { sx: { mt: 2, ...A2UI_RENDER_SCOPE_SX }, style: themeStyle, children: surfaces.map(surface => (_jsx(A2uiSurfaceComposed, { surface: surface }, surface.id))) })] })) : null, _jsxs(Box, { sx: { mt: 2 }, children: [_jsx(Text, { sx: { display: 'block', mb: 1, fontSize: 0, color: 'fg.muted' }, children: "Jupyter output" }), _jsx(JupyterOutputs, { execution: executed })] })] }));
|
|
655
|
+
}, [executionsByKind, handleAction, openSurfaces, surfaces, themeStyle]);
|
|
656
|
+
const runDemoTool = useMemo(() => ({
|
|
657
|
+
name: 'run_jupyter_output_demo',
|
|
658
|
+
description: 'Run one output demonstration in the connected Jupyter sandbox and display both its A2UI surface and jupyter-react Output.',
|
|
659
|
+
parameters: {
|
|
660
|
+
type: 'object',
|
|
661
|
+
properties: {
|
|
662
|
+
kind: {
|
|
663
|
+
type: 'string',
|
|
664
|
+
enum: [...DEMO_KINDS],
|
|
665
|
+
description: 'The Jupyter output demonstration to run.',
|
|
666
|
+
},
|
|
667
|
+
},
|
|
668
|
+
required: ['kind'],
|
|
669
|
+
additionalProperties: false,
|
|
670
|
+
},
|
|
671
|
+
handler: async (args) => {
|
|
672
|
+
const kind = args.kind;
|
|
673
|
+
if (!isDemoKind(kind)) {
|
|
674
|
+
throw new Error(`Unknown Jupyter output demonstration: ${String(kind)}. ` +
|
|
675
|
+
`Expected one of ${DEMO_KINDS.join(', ')}.`);
|
|
676
|
+
}
|
|
677
|
+
const demo = SNIPPETS.find((entry) => entry.id === kind && !entry.chat);
|
|
678
|
+
if (!demo) {
|
|
679
|
+
throw new Error(`Unknown Jupyter output demonstration: ${kind}`);
|
|
680
|
+
}
|
|
681
|
+
const result = await run(demo.code, undefined, demo.actions ?? [], kind);
|
|
682
|
+
if (!result) {
|
|
683
|
+
throw new Error('The Jupyter output demonstration could not run.');
|
|
684
|
+
}
|
|
685
|
+
return {
|
|
686
|
+
kind,
|
|
687
|
+
displayed: true,
|
|
688
|
+
executionSucceeded: result.success,
|
|
689
|
+
};
|
|
690
|
+
},
|
|
691
|
+
}), [run]);
|
|
692
|
+
// The chat column is the shared loop on the A2UI-jupyter-output capacity
|
|
693
|
+
// plugin; the bespoke run_jupyter_output_demo frontend tool and the surface
|
|
694
|
+
// renderer reach it through the chat-extras channel.
|
|
695
|
+
const { plugin: extrasPlugin, setExtras } = useMemo(() => createChatExtrasPlugin(), []);
|
|
696
|
+
const chatPlugins = useMemo(() => [AgentA2uiJupyterOutputPlugin, extrasPlugin], [extrasPlugin]);
|
|
697
|
+
useEffect(() => {
|
|
698
|
+
setExtras({ frontendTools: [runDemoTool], renderToolResult });
|
|
699
|
+
}, [runDemoTool, renderToolResult, setExtras]);
|
|
700
|
+
const outputPanels = (_jsxs(Box, { sx: {
|
|
701
|
+
flex: '1 1 0',
|
|
702
|
+
minHeight: 0,
|
|
703
|
+
height: '100%',
|
|
704
|
+
display: 'grid',
|
|
705
|
+
gridTemplateColumns: [
|
|
706
|
+
'minmax(0, 1fr)',
|
|
707
|
+
'minmax(0, 1fr)',
|
|
708
|
+
'repeat(2, minmax(0, 1fr))',
|
|
709
|
+
],
|
|
710
|
+
gridTemplateRows: [
|
|
711
|
+
'repeat(2, minmax(280px, auto))',
|
|
712
|
+
'repeat(2, minmax(280px, auto))',
|
|
713
|
+
'minmax(0, 1fr)',
|
|
714
|
+
],
|
|
715
|
+
gap: 3,
|
|
716
|
+
alignItems: 'stretch',
|
|
717
|
+
overflow: ['auto', 'auto', 'hidden'],
|
|
718
|
+
}, children: [_jsx(Panel, { title: "A2UI Surface", caption: "The outputs read by the server-side converter.", style: themeStyle, sx: A2UI_RENDER_SCOPE_SX, children: surfaces.length === 0 ? (_jsx(Text, { sx: { color: 'fg.muted', fontSize: 1 }, children: snippet.chat
|
|
719
|
+
? 'Choose a chat suggestion to see the surface.'
|
|
720
|
+
: 'Press Run to see the surface.' })) : (surfaces.map(surface => (_jsx(A2uiSurfaceComposed, { surface: surface }, surface.id)))) }), _jsx(Panel, { title: "Jupyter Output", caption: "The sandbox result rendered by jupyter-react Output.", children: _jsx(JupyterOutputs, { execution: execution }) })] }));
|
|
721
|
+
return (_jsx(ThemedProvider, { children: _jsx(A2uiMarkdownProvider, { children: _jsxs(Box, { sx: {
|
|
722
|
+
height: '100%',
|
|
723
|
+
display: 'flex',
|
|
724
|
+
flexDirection: 'column',
|
|
725
|
+
minHeight: 0,
|
|
726
|
+
overflow: 'hidden',
|
|
727
|
+
bg: 'canvas.default',
|
|
728
|
+
color: 'fg.default',
|
|
729
|
+
}, children: [_jsxs(Box, { sx: {
|
|
730
|
+
px: 3,
|
|
731
|
+
py: 3,
|
|
732
|
+
borderBottom: '1px solid',
|
|
733
|
+
borderColor: 'border.default',
|
|
734
|
+
bg: 'canvas.default',
|
|
735
|
+
color: 'fg.default',
|
|
736
|
+
}, children: [_jsx(Text, { as: "h1", sx: { fontSize: 3, fontWeight: 'bold' }, children: "\uD83D\uDCD3 Jupyter Output as a A2UI Surface" }), _jsx(Text, { sx: { color: 'fg.muted' }, children: "One execution, twice: what the kernel said, and what the A2UI converter made of it. The conversion runs on the server, so a terminal and a JupyterLab panel get the same surface from the same code." })] }), !hasAgent || unavailableReason || agentError ? (_jsx(Box, { sx: { p: 3, bg: 'canvas.default', color: 'fg.default' }, children: _jsx(Text, { sx: { color: 'fg.muted' }, children: unavailableReason || agentError || (_jsxs(_Fragment, { children: ["This example converts on the server, and the", ' ', _jsx("strong", { children: targetLabel }), " target has no agent-runtimes server beside its sandbox. Switch to ", _jsx("strong", { children: "Local" }), ' ', "or ", _jsx("strong", { children: "Datalayer" }), " in the header to run it."] })) }) })) : (_jsxs(Box, { sx: {
|
|
737
|
+
flex: '1 1 0',
|
|
738
|
+
minHeight: 0,
|
|
739
|
+
display: 'flex',
|
|
740
|
+
flexDirection: 'column',
|
|
741
|
+
gap: 3,
|
|
742
|
+
p: 3,
|
|
743
|
+
bg: 'canvas.default',
|
|
744
|
+
color: 'fg.default',
|
|
745
|
+
}, children: [_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 2 }, children: [_jsx(SegmentedControl, { "aria-label": "Output kind", fullWidth: true, children: SNIPPETS.map(entry => (_jsx(SegmentedControl.Button, { selected: entry.id === snippetId, onClick: () => chooseSnippet(entry), children: entry.label }, entry.id))) }), _jsx(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: snippet.about })] }), snippet.chat ? (_jsxs(Box, { sx: {
|
|
746
|
+
flex: '1 1 0',
|
|
747
|
+
minHeight: 0,
|
|
748
|
+
display: 'grid',
|
|
749
|
+
gridTemplateColumns: [
|
|
750
|
+
'minmax(0, 1fr)',
|
|
751
|
+
'minmax(0, 1fr)',
|
|
752
|
+
'minmax(320px, 0.7fr) minmax(0, 1.3fr)',
|
|
753
|
+
],
|
|
754
|
+
gridTemplateRows: [
|
|
755
|
+
'minmax(420px, auto) minmax(560px, auto)',
|
|
756
|
+
'minmax(420px, auto) minmax(560px, auto)',
|
|
757
|
+
'minmax(0, 1fr)',
|
|
758
|
+
],
|
|
759
|
+
gap: 3,
|
|
760
|
+
overflow: ['auto', 'auto', 'hidden'],
|
|
761
|
+
}, children: [_jsx(Box, { sx: {
|
|
762
|
+
minHeight: 0,
|
|
763
|
+
border: '1px solid',
|
|
764
|
+
borderColor: 'border.default',
|
|
765
|
+
borderRadius: 2,
|
|
766
|
+
overflow: 'hidden',
|
|
767
|
+
bg: 'canvas.default',
|
|
768
|
+
}, children: agentReady && agentId ? (_jsx(LoopEmbed, { serverUrl: serverUrl, target: "local", agentId: agentId, defaultEditor: "none", showHeader: true, plugins: chatPlugins })) : (_jsxs(Box, { sx: {
|
|
769
|
+
height: '100%',
|
|
770
|
+
display: 'flex',
|
|
771
|
+
alignItems: 'center',
|
|
772
|
+
justifyContent: 'center',
|
|
773
|
+
gap: 2,
|
|
774
|
+
}, children: [_jsx(Spinner, { size: "small" }), _jsx(Text, { sx: { color: 'fg.muted' }, children: "Starting Jupyter output agent\u2026" })] })) }), outputPanels] })) : (_jsxs(_Fragment, { children: [_jsx(Box, { as: "textarea", value: code, onChange: (event) => setCode(event.target.value), spellCheck: false, "aria-label": "Code to run", sx: {
|
|
775
|
+
width: '100%',
|
|
776
|
+
minHeight: '150px',
|
|
777
|
+
p: 2,
|
|
778
|
+
fontFamily: 'mono',
|
|
779
|
+
fontSize: 1,
|
|
780
|
+
borderRadius: 2,
|
|
781
|
+
border: '1px solid',
|
|
782
|
+
borderColor: 'border.default',
|
|
783
|
+
bg: 'canvas.default',
|
|
784
|
+
color: 'fg.default',
|
|
785
|
+
resize: 'vertical',
|
|
786
|
+
} }), _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Button, { variant: "primary", leadingVisual: PlayIcon, disabled: running || !agentReady || !agentId, onClick: () => void run(code, undefined, snippet.actions ?? []), children: running
|
|
787
|
+
? 'Running…'
|
|
788
|
+
: !agentReady
|
|
789
|
+
? 'Starting Jupyter…'
|
|
790
|
+
: 'Run' }), (running || !agentReady) && _jsx(Spinner, { size: "small" }), execution?.variant && (_jsx(Label, { variant: "secondary", children: execution.variant })), failure && (_jsx(Text, { sx: { color: 'danger.fg', fontSize: 1 }, children: failure }))] }), outputPanels] }))] }))] }) }) }));
|
|
791
|
+
};
|
|
792
|
+
export default A2UiJupyterOutputExample;
|