@datalayer/agent-runtimes 1.0.29 → 1.3.10
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 +385 -4
- package/lib/api/runtimes/environments.js +610 -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 +13 -2
- package/lib/chat/ChatFloating.js +192 -117
- 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/EmptyState.d.ts +15 -1
- package/lib/chat/display/EmptyState.js +78 -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 +67 -96
- package/lib/chat/index.d.ts +4 -1
- package/lib/chat/index.js +8 -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 +1 -0
- package/lib/components/code-sandboxes/CodeSandboxLauncher.js +42 -19
- 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 +86 -0
- package/lib/components/code-sandboxes/codeSandboxEnvironments.js +147 -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/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 +894 -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 +118 -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 +1670 -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 +35 -0
- package/lib/loop/plugins/page-layout/index.js +80 -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 +167 -0
- package/lib/loop/presets.js +139 -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/Environment.d.ts +561 -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/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 +11 -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 +1 -2
- package/lib/models/environments.generated.d.ts +113 -0
- package/lib/models/environments.generated.js +13 -0
- package/lib/models/index.d.ts +0 -1
- package/lib/models/index.js +0 -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 +117 -0
- package/lib/protocols/BrowserAgentAdapter.js +310 -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 +3 -3
- package/lib/runtimes/actions.js +27 -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 +128 -112
- package/lib/specs/agents/agents.js +8024 -5052
- package/lib/specs/evals.js +9 -0
- package/lib/specs/frontendTools.d.ts +3 -0
- package/lib/specs/frontendTools.js +46 -3
- package/lib/specs/mcpServers.d.ts +1 -0
- package/lib/specs/mcpServers.js +25 -2
- 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 +22 -0
- package/lib/specs/personas.js +1 -1
- 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/{models/Dataset.js → tools/adapters/commands/index.js} +1 -1
- 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/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/__pycache__/compose.cpython-313.pyc +0 -0
- package/scripts/codegen/__pycache__/versioning.cpython-313.pyc +0 -0
- 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_models.py +40 -15
- package/scripts/codegen/generate_sandbox_agents.py +76 -62
- 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
|
@@ -30,16 +30,22 @@ import { DEFAULT_SERVICE_URLS } from '@datalayer/core/lib/api/constants';
|
|
|
30
30
|
import { useChatStore } from '../../stores/chatStore';
|
|
31
31
|
import { useConversationStore } from '../../stores/conversationStore';
|
|
32
32
|
import { generateMessageId, createUserMessage, createAssistantMessage, } from '../../types/messages';
|
|
33
|
+
import { AgentDetails } from '../../agents/AgentDetails';
|
|
34
|
+
import { AI_MODEL_CATALOGUE } from '../../specs/models';
|
|
33
35
|
import { internalQueryClient, isToolCallMessage, convertHistoryToDisplayItems, createProtocolAdapter, getApiBaseFromConfig, sanitizeAssistantContent, } from '../../utils';
|
|
34
36
|
import { useConfig, useSkills, useSkillActions, useContextSnapshot, useSandbox, } from '../../hooks';
|
|
35
37
|
import { useAgentRuntimeWebSocket } from '../../hooks/useAgentRuntimes';
|
|
36
38
|
import { agentRuntimeStore, useAgentRuntimeStore, useAgentRuntimeWsState, } from '../../stores/agentRuntimeStore';
|
|
37
|
-
import { ChatBaseHeader } from '../header/ChatHeaderBase';
|
|
39
|
+
import { ChatBaseHeader, } from '../header/ChatHeaderBase';
|
|
40
|
+
import { useChatAvailability } from './ChatAvailability';
|
|
38
41
|
import { ChatEmptyState } from '../display/EmptyState';
|
|
42
|
+
import { notebookToolSurfacesRenderer } from '../messages/NotebookToolSurfaces';
|
|
39
43
|
import { FloatingBrandButton } from '../display/FloatingBrandButton';
|
|
40
44
|
import { PoweredByTag } from '../display/PoweredByTag';
|
|
45
|
+
import { EphemeralSurfaceControl } from '../EphemeralSurfaceControl';
|
|
41
46
|
import { ChatMessageList, } from '../messages/ChatMessageList';
|
|
42
|
-
import {
|
|
47
|
+
import { InputPrompt } from '../prompt/InputPrompt';
|
|
48
|
+
import { isFloatingChatViewMode } from '../viewModes';
|
|
43
49
|
import { ToolApprovalBanner, ToolApprovalDialog, } from '../tools';
|
|
44
50
|
import { EphemeralNotebook } from '../notebook/EphemeralNotebook';
|
|
45
51
|
// EphemeralDocument statically imports `@datalayer/jupyter-lexical` (which
|
|
@@ -492,11 +498,11 @@ export function ChatBase(props) {
|
|
|
492
498
|
// ---------------------------------------------------------------------------
|
|
493
499
|
// ChatBaseInner — contains all actual logic
|
|
494
500
|
// ---------------------------------------------------------------------------
|
|
495
|
-
function ChatBaseInner({ title, subtitle, showHeader = false, showTokenUsage = true, showLoadingIndicator = true, showErrors = true, showInput = true, showModelSelector = true, showToolsMenu = true, showSkillsMenu = true, disableInputPrompt = false, overlay, launching = false, launchingMessage, autoConnect = true, codemodeEnabled = false, onToggleCodemode, initialModel, availableModels, mcpServers, initialSkills: _initialSkills, className, loadingState, headerActions, kernelIndicatorState, kernelIndicatorPlacement = 'left', kernel, kernelEnvironmentName, kernelCpu, kernelMemory, kernelGpu, themeVariant, colorMode, chatViewMode, onChatViewModeChange,
|
|
501
|
+
function ChatBaseInner({ title, subtitle, showHeader = false, showTokenUsage = true, showContextRing = false, showLoadingIndicator = true, showErrors = true, showInput = true, showModelSelector = true, showToolsMenu = true, showSkillsMenu = true, disableInputPrompt = false, promptVariant, mentionableAgents: mentionableAgentsProp, showAgentsMenu = true, agents: agentsProp, selectedAgentId, onSelectAgent, disabled: disabledProp, disableReason: disableReasonProp, overlay, launching = false, launchingMessage, autoConnect = true, codemodeEnabled = false, onToggleCodemode, initialModel, availableModels, mcpServers, initialSkills: _initialSkills, className, loadingState, headerActions, kernelIndicatorState, kernelIndicatorPlacement = 'left', kernel, kernelEnvironmentName, kernelCpu, kernelMemory, kernelGpu, themeVariant, colorMode, chatViewMode, onChatViewModeChange, disabledViewModes,
|
|
496
502
|
// Mode selection
|
|
497
|
-
useStore: useStoreMode = true, protocol: protocolRaw, onSendMessage, enableStreaming = false,
|
|
503
|
+
useStore: useStoreMode = true, protocol: protocolRaw, onSendMessage, onSendReady, onLoadingChange, onContextSnapshot, enableStreaming = false,
|
|
498
504
|
// Extended props
|
|
499
|
-
brandIcon, avatarConfig, headerButtons, showPoweredBy = false, poweredByProps, emptyState, renderToolResult, footerContent, showInformation = false, onInformationClick, headerContent, children, borderRadius, backgroundColor, border, boxShadow, compact = false, placeholder, description = 'Start a conversation with the AI agent.', onStateUpdate, onNewChat, onClear, onMessagesChange, autoFocus = false, suggestions, submitOnSuggestionClick = true, hideMessagesAfterToolUI = false, focusTrigger, frontendTools: frontendToolsProp, enableEphemeralNotebook = false, initialEphemeralNotebookOpen = true, onEphemeralNotebookOpenChange, enableEphemeralDocument = false, initialEphemeralSurfaceMode, onEphemeralSurfaceModeChange, collapsed = false, onExpandFromCollapsed, ephemeralNotebookToolbar, ephemeralNotebookToolbarExtraItems, ephemeralDocumentToolbarExtraItems, ephemeralNotebookCollaborationProvider, ephemeralNotebookCollaborationDocumentId, ephemeralDocumentCollaboration, ephemeralRuntimeOverride,
|
|
505
|
+
brandIcon, avatarConfig, headerButtons, showPoweredBy = false, poweredByProps, emptyState, renderToolResult, renderHeader, showTurnFooter = true, notebookToolSurfacesId, footerContent, showInformation = false, onInformationClick, headerContent, children, borderRadius, backgroundColor, border, boxShadow, compact = false, placeholder, description = 'Start a conversation with the AI agent.', onStateUpdate, onNewChat, onClear, onMessagesChange, onItemsChange, onDisplayItemsChange, autoFocus = false, suggestions, submitOnSuggestionClick = true, hideMessagesAfterToolUI = false, focusTrigger, frontendTools: frontendToolsProp, enableEphemeralNotebook = false, initialEphemeralNotebookOpen = true, onEphemeralNotebookOpenChange, enableEphemeralDocument = false, initialEphemeralSurfaceMode, onEphemeralSurfaceModeChange, collapsed = false, onExpandFromCollapsed, ephemeralNotebookToolbar, ephemeralNotebookToolbarExtraItems, ephemeralDocumentToolbarExtraItems, ephemeralNotebookCollaborationProvider, ephemeralNotebookCollaborationDocumentId, ephemeralDocumentCollaboration, ephemeralRuntimeOverride,
|
|
500
506
|
// Tool invocation hooks
|
|
501
507
|
onToolCallStart, onToolCallComplete,
|
|
502
508
|
// Identity/Authorization props
|
|
@@ -510,12 +516,20 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
510
516
|
useEffect(() => {
|
|
511
517
|
setupPrimerPortals();
|
|
512
518
|
}, []);
|
|
519
|
+
// Whether there is anything to talk to. The host usually knows — a browser
|
|
520
|
+
// sandbox has no agent beside it — and says so once for everything beneath
|
|
521
|
+
// it; an explicit prop still wins for one particular chat.
|
|
522
|
+
const ambientAvailability = useChatAvailability();
|
|
523
|
+
const disabled = disabledProp ?? ambientAvailability.disabled;
|
|
524
|
+
const disableReason = disableReasonProp ?? ambientAvailability.disableReason;
|
|
513
525
|
const { theme } = useThemeStore();
|
|
514
526
|
const assistantIconColor = getColorPalette(theme, 'dark').textLight;
|
|
515
527
|
// ── Built-in pending approvals from the agent-runtime Zustand store ──
|
|
516
528
|
// When the parent doesn't supply the `pendingApprovals` prop, derive them
|
|
517
529
|
// from the shared store so the banner works out-of-the-box.
|
|
518
530
|
const storeApprovals = useAgentRuntimeStore(s => s.approvals);
|
|
531
|
+
// Bumped when the transcript changed on the server outside a run.
|
|
532
|
+
const historyVersion = useAgentRuntimeStore(s => s.historyVersion);
|
|
519
533
|
const storeMcpStatus = useAgentRuntimeStore(s => s.mcpStatus);
|
|
520
534
|
const effectiveMcpStatusData = mcpStatusData ?? storeMcpStatus;
|
|
521
535
|
const protocolConfig = typeof protocolRaw === 'object'
|
|
@@ -578,7 +592,40 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
578
592
|
const notebookVisible = enableEphemeralNotebook && ephemeralSurfaceMode === 'notebook';
|
|
579
593
|
const documentVisible = enableEphemeralDocument && ephemeralSurfaceMode === 'document';
|
|
580
594
|
const surfaceVisible = notebookVisible || documentVisible;
|
|
581
|
-
|
|
595
|
+
/*
|
|
596
|
+
* Collapsed means collapsed, whether or not there is a way back.
|
|
597
|
+
*
|
|
598
|
+
* Offering to reopen the conversation is what `onExpandFromCollapsed`
|
|
599
|
+
* decides, and the affordance below is guarded by it. Requiring it HERE
|
|
600
|
+
* meant a surface asked to collapse with nothing to expand into — a Code
|
|
601
|
+
* Sandbox, where nothing is listening — kept the conversation on screen
|
|
602
|
+
* instead.
|
|
603
|
+
*/
|
|
604
|
+
const surfaceCollapsed = surfaceVisible && collapsed;
|
|
605
|
+
/*
|
|
606
|
+
* The switch between the notebook and the document, for a collapsed chat.
|
|
607
|
+
*
|
|
608
|
+
* It normally sits in the chat's header, which is exactly what a collapsed
|
|
609
|
+
* chat does not draw — so a page without a conversation opened whichever
|
|
610
|
+
* surface came first and could never leave it. On the surface's own toolbar
|
|
611
|
+
* it is reachable either way. "Chat only" is not among the choices here:
|
|
612
|
+
* closing the surface would leave nothing at all.
|
|
613
|
+
*/
|
|
614
|
+
const collapsedSurfaceControl = surfaceCollapsed
|
|
615
|
+
? {
|
|
616
|
+
key: 'ephemeral-surface',
|
|
617
|
+
type: 'custom',
|
|
618
|
+
// Last of the toolbar, away from what acts on the surface itself.
|
|
619
|
+
order: 900,
|
|
620
|
+
render: () => (_jsx(EphemeralSurfaceControl, { mode: ephemeralSurfaceMode, onChange: handleEphemeralSurfaceModeChange, enableNotebook: enableEphemeralNotebook, enableDocument: enableEphemeralDocument, enableChatOnly: false })),
|
|
621
|
+
}
|
|
622
|
+
: null;
|
|
623
|
+
const notebookToolbarItems = collapsedSurfaceControl
|
|
624
|
+
? [...(ephemeralNotebookToolbarExtraItems ?? []), collapsedSurfaceControl]
|
|
625
|
+
: ephemeralNotebookToolbarExtraItems;
|
|
626
|
+
const documentToolbarItems = collapsedSurfaceControl
|
|
627
|
+
? [...(ephemeralDocumentToolbarExtraItems ?? []), collapsedSurfaceControl]
|
|
628
|
+
: ephemeralDocumentToolbarExtraItems;
|
|
582
629
|
// Track the ephemeral notebook's live kernel connection so the chat header
|
|
583
630
|
// renders the same rich `KernelIndicator` details (kernel id, client id,
|
|
584
631
|
// server/ws url, status) as the notebook editor. Without this the header
|
|
@@ -624,8 +671,9 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
624
671
|
}, [documentVisible]);
|
|
625
672
|
// When a companion surface is shown, the chat can be docked as a sidebar
|
|
626
673
|
// (default) or floated over it, driven by the header view-mode toggle.
|
|
627
|
-
const surfaceChatFloating = surfaceVisible &&
|
|
628
|
-
|
|
674
|
+
const surfaceChatFloating = surfaceVisible && isFloatingChatViewMode(chatViewMode);
|
|
675
|
+
// The two smaller floating modes share the compact card over a surface.
|
|
676
|
+
const compactFloating = chatViewMode === 'floating-small' || chatViewMode === 'floating-draggable';
|
|
629
677
|
// Notebook frontend tools are always created (hooks must be unconditional)
|
|
630
678
|
// but only merged into the tools sent to the agent while the notebook is
|
|
631
679
|
// visible, so the agent can manipulate the live notebook cells. Document
|
|
@@ -1110,6 +1158,18 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
1110
1158
|
const isA2AProtocol = protocol?.type === 'a2a';
|
|
1111
1159
|
// ---- Component state ----
|
|
1112
1160
|
const [displayItems, setDisplayItems] = useState([]);
|
|
1161
|
+
/*
|
|
1162
|
+
* What the harness itself reported, for an agent with no server behind it.
|
|
1163
|
+
*
|
|
1164
|
+
* The last turn *and* the running session. Both, because the bar shows both
|
|
1165
|
+
* — "· 12k ▲ 900 ▼" is the conversation so far and "· turn 800 ▲ 120 ▼" is
|
|
1166
|
+
* what the last exchange cost — and a snapshot carrying only a total leaves
|
|
1167
|
+
* those two lines out entirely.
|
|
1168
|
+
*/
|
|
1169
|
+
const [localUsage, setLocalUsage] = useState(null);
|
|
1170
|
+
/* Whether the (i) has been pressed. Its own state rather than a view mode:
|
|
1171
|
+
it is a detour from the conversation, not a place the chat lives. */
|
|
1172
|
+
const [showDetails, setShowDetails] = useState(false);
|
|
1113
1173
|
const [isLoading, setIsLoading] = useState(false);
|
|
1114
1174
|
const [liveKernelStatus, setLiveKernelStatus] = useState();
|
|
1115
1175
|
const [isStreaming, setIsStreaming] = useState(false);
|
|
@@ -1231,8 +1291,247 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
1231
1291
|
});
|
|
1232
1292
|
return set;
|
|
1233
1293
|
}, [localSkillApproval, skillsQuery.data]);
|
|
1294
|
+
/*
|
|
1295
|
+
* What the Tools menu lists.
|
|
1296
|
+
*
|
|
1297
|
+
* The server's builtin tools when there are any, and otherwise the tools
|
|
1298
|
+
* this page gave the agent. An in-page agent has no config endpoint to ask
|
|
1299
|
+
* — that is the whole point of it — so the menu was empty for the one kind
|
|
1300
|
+
* of agent whose tools the browser already knows in full.
|
|
1301
|
+
*/
|
|
1302
|
+
const builtinTools = useMemo(() => {
|
|
1303
|
+
/*
|
|
1304
|
+
* Both lists, not one or the other.
|
|
1305
|
+
*
|
|
1306
|
+
* The server's builtin tools and the ones this page handed the agent are
|
|
1307
|
+
* both things it can call, and a menu naming only the first was wrong for
|
|
1308
|
+
* every agent given frontend tools — which is every notebook agent, whose
|
|
1309
|
+
* ability to run a cell lives entirely on this side.
|
|
1310
|
+
*
|
|
1311
|
+
* Server first, because that is the order they were introduced in and a
|
|
1312
|
+
* list that reorders itself as a request lands is one nobody can scan.
|
|
1313
|
+
* De-duplicated by name: a tool implemented on both sides is one tool.
|
|
1314
|
+
*/
|
|
1315
|
+
const fromConfig = configQuery.data?.builtinTools ?? [];
|
|
1316
|
+
/*
|
|
1317
|
+
* Including the tools this chat does *not* run.
|
|
1318
|
+
*
|
|
1319
|
+
* An in-page agent's tools are handed to the harness rather than to the
|
|
1320
|
+
* chat — the SDK owns the loop and calls them directly, and giving them
|
|
1321
|
+
* to both would run each one twice — so `frontendTools` is empty for
|
|
1322
|
+
* exactly the agent whose tools live entirely in the page. The menu was
|
|
1323
|
+
* therefore emptiest where the tools were most real.
|
|
1324
|
+
*
|
|
1325
|
+
* Executing a tool and listing it are different jobs. The protocol config
|
|
1326
|
+
* names what the agent can call, which is the question this menu asks.
|
|
1327
|
+
*/
|
|
1328
|
+
const inProtocol = protocol?.options
|
|
1329
|
+
?.frontendTools ?? [];
|
|
1330
|
+
const seen = new Set(fromConfig.map(tool => tool.name));
|
|
1331
|
+
const fromPage = [...(frontendTools ?? []), ...inProtocol]
|
|
1332
|
+
.filter(tool => {
|
|
1333
|
+
if (seen.has(tool.name)) {
|
|
1334
|
+
return false;
|
|
1335
|
+
}
|
|
1336
|
+
seen.add(tool.name);
|
|
1337
|
+
return true;
|
|
1338
|
+
})
|
|
1339
|
+
.map(tool => ({ id: tool.name, name: tool.name }));
|
|
1340
|
+
return [...fromConfig, ...fromPage];
|
|
1341
|
+
}, [configQuery.data?.builtinTools, frontendTools, protocol?.options]);
|
|
1342
|
+
/*
|
|
1343
|
+
* Who is answering, as one row when that is all there is.
|
|
1344
|
+
*
|
|
1345
|
+
* A host with a team passes its own list. Everything else gets the agent
|
|
1346
|
+
* this chat is actually talking to — which the control states rather than
|
|
1347
|
+
* switches, and which nothing else on screen said. It used to be omitted
|
|
1348
|
+
* entirely, so the chip and the footer menu were both simply absent.
|
|
1349
|
+
*/
|
|
1350
|
+
const footerAgents = useMemo(() => agentsProp ??
|
|
1351
|
+
(activeAgentId
|
|
1352
|
+
? [
|
|
1353
|
+
{
|
|
1354
|
+
id: activeAgentId,
|
|
1355
|
+
name: title || activeAgentId,
|
|
1356
|
+
/*
|
|
1357
|
+
What this agent is for, beside its name.
|
|
1358
|
+
|
|
1359
|
+
The menu renders a description when there is one and a bare
|
|
1360
|
+
name when there is not, and a single-agent list built from the
|
|
1361
|
+
id alone therefore opened onto one word. `subtitle` is what a
|
|
1362
|
+
host writes to say what its chat does, which is the same
|
|
1363
|
+
sentence a person clicking the agent control is asking for.
|
|
1364
|
+
*/
|
|
1365
|
+
description: subtitle || description,
|
|
1366
|
+
},
|
|
1367
|
+
]
|
|
1368
|
+
: []), [agentsProp, activeAgentId, title, subtitle, description]);
|
|
1369
|
+
/*
|
|
1370
|
+
* The models on offer.
|
|
1371
|
+
*
|
|
1372
|
+
* An in-page agent has no config endpoint, and asking one for a catalogue is
|
|
1373
|
+
* asking a page about itself. It does know the model it was built with — the
|
|
1374
|
+
* protocol carries it — so the control names that rather than disappearing.
|
|
1375
|
+
*/
|
|
1376
|
+
const browserModel = typeof protocol?.options?.model ===
|
|
1377
|
+
'string'
|
|
1378
|
+
? (protocol?.options).model
|
|
1379
|
+
: undefined;
|
|
1380
|
+
const offeredModels = useMemo(() => {
|
|
1381
|
+
const fromConfig = availableModels || configQuery.data?.models;
|
|
1382
|
+
if (fromConfig?.length) {
|
|
1383
|
+
return fromConfig;
|
|
1384
|
+
}
|
|
1385
|
+
/*
|
|
1386
|
+
* The catalogue, filtered to what is worth offering.
|
|
1387
|
+
*
|
|
1388
|
+
* A server tells the chat which models it can reach and that answer wins.
|
|
1389
|
+
* Without one — an in-page agent, or a server that has not answered yet —
|
|
1390
|
+
* this used to offer the single model the protocol was built with, which
|
|
1391
|
+
* is a menu with nothing to choose.
|
|
1392
|
+
*
|
|
1393
|
+
* `available` is the filter, not the whole catalogue: twenty-six models,
|
|
1394
|
+
* most of them superseded, is a list nobody reads. The specs say which
|
|
1395
|
+
* four are current.
|
|
1396
|
+
*/
|
|
1397
|
+
const catalogued = Object.values(AI_MODEL_CATALOGUE)
|
|
1398
|
+
.filter(model => model.available)
|
|
1399
|
+
.map(model => ({
|
|
1400
|
+
id: model.id,
|
|
1401
|
+
name: model.name,
|
|
1402
|
+
provider: model.provider,
|
|
1403
|
+
}));
|
|
1404
|
+
if (catalogued.length > 0) {
|
|
1405
|
+
return catalogued;
|
|
1406
|
+
}
|
|
1407
|
+
return browserModel
|
|
1408
|
+
? [{ id: browserModel, name: browserModel, provider: 'inference' }]
|
|
1409
|
+
: [];
|
|
1410
|
+
}, [availableModels, configQuery.data?.models, browserModel]);
|
|
1411
|
+
/*
|
|
1412
|
+
* Who `@` may address.
|
|
1413
|
+
*
|
|
1414
|
+
* The same people the footer offers, unless a host supplies its own list.
|
|
1415
|
+
* It used to be the host's or nothing, so a chat that had not been told
|
|
1416
|
+
* about mentions had no menu at all — and the menu is also how a person
|
|
1417
|
+
* *discovers* that agents can be addressed.
|
|
1418
|
+
*
|
|
1419
|
+
* The one being addressed is listed and disabled rather than dropped: a
|
|
1420
|
+
* menu of one that hides its only row is a menu that looks broken, and
|
|
1421
|
+
* "you are already talking to this one" is a useful thing to be told.
|
|
1422
|
+
*/
|
|
1423
|
+
const mentionableAgents = useMemo(() => mentionableAgentsProp ??
|
|
1424
|
+
footerAgents.map(agent => ({
|
|
1425
|
+
name: agent.name,
|
|
1426
|
+
description: agent.description,
|
|
1427
|
+
icon: agent.icon,
|
|
1428
|
+
disabled: agent.id === (selectedAgentId ?? footerAgents[0]?.id),
|
|
1429
|
+
disabledReason: `You are already talking to ${agent.name}`,
|
|
1430
|
+
})), [mentionableAgentsProp, footerAgents, selectedAgentId]);
|
|
1234
1431
|
const contextSnapshotQuery = useContextSnapshot(configQueriesEnabled && showTokenUsage, protocol?.configEndpoint, protocol?.agentId, protocol?.authToken);
|
|
1235
|
-
|
|
1432
|
+
/*
|
|
1433
|
+
* The window, from whoever can account for it.
|
|
1434
|
+
*
|
|
1435
|
+
* A host's own snapshot first, then the server's, then what the harness
|
|
1436
|
+
* reported as it finished. The last is a partial picture — it knows the
|
|
1437
|
+
* turn's tokens and the model's window, not how they divide between the
|
|
1438
|
+
* system prompt, the tools and the history — so the fields it cannot
|
|
1439
|
+
* honestly fill are left at zero rather than guessed at.
|
|
1440
|
+
*/
|
|
1441
|
+
const localSnapshot = useMemo(() => {
|
|
1442
|
+
/*
|
|
1443
|
+
* Only for a harness that has no server keeping the account.
|
|
1444
|
+
*
|
|
1445
|
+
* `enableConfigQuery` is what says a runtime is reporting its own context
|
|
1446
|
+
* over the socket; where one is, this must not shadow it with a partial
|
|
1447
|
+
* picture assembled from turn totals.
|
|
1448
|
+
*/
|
|
1449
|
+
if (protocol?.enableConfigQuery) {
|
|
1450
|
+
return undefined;
|
|
1451
|
+
}
|
|
1452
|
+
/* A conservative window. The harness reports what a turn cost, not what
|
|
1453
|
+
the model can hold, and 200k is the smaller of the sizes the models
|
|
1454
|
+
this reaches actually offer — so the bar reads as fuller than the truth
|
|
1455
|
+
rather than emptier, which is the safer way to be wrong about a
|
|
1456
|
+
limit. */
|
|
1457
|
+
const contextWindow = 200_000;
|
|
1458
|
+
return {
|
|
1459
|
+
totalTokens: localUsage?.totalTokens ?? 0,
|
|
1460
|
+
contextWindow,
|
|
1461
|
+
sumResponseInputTokens: localUsage?.sessionInput ?? 0,
|
|
1462
|
+
sumResponseOutputTokens: localUsage?.sessionOutput ?? 0,
|
|
1463
|
+
systemPromptTokens: 0,
|
|
1464
|
+
userMessageTokens: 0,
|
|
1465
|
+
assistantMessageTokens: 0,
|
|
1466
|
+
toolTokens: 0,
|
|
1467
|
+
toolCallTokens: 0,
|
|
1468
|
+
toolReturnTokens: 0,
|
|
1469
|
+
historyToolCallTokens: 0,
|
|
1470
|
+
historyToolReturnTokens: 0,
|
|
1471
|
+
currentToolCallTokens: 0,
|
|
1472
|
+
currentToolReturnTokens: 0,
|
|
1473
|
+
turnUsage: {
|
|
1474
|
+
inputTokens: localUsage?.turnInput ?? 0,
|
|
1475
|
+
outputTokens: localUsage?.turnOutput ?? 0,
|
|
1476
|
+
// Not counted by the harness, and left at zero rather than invented:
|
|
1477
|
+
// the bar reads these only for the numbers it prints beside the ring.
|
|
1478
|
+
requests: 0,
|
|
1479
|
+
toolCalls: 0,
|
|
1480
|
+
toolNames: [],
|
|
1481
|
+
durationSeconds: 0,
|
|
1482
|
+
},
|
|
1483
|
+
sessionUsage: {
|
|
1484
|
+
inputTokens: localUsage?.sessionInput ?? 0,
|
|
1485
|
+
outputTokens: localUsage?.sessionOutput ?? 0,
|
|
1486
|
+
requests: 0,
|
|
1487
|
+
toolCalls: 0,
|
|
1488
|
+
turns: 0,
|
|
1489
|
+
durationSeconds: 0,
|
|
1490
|
+
},
|
|
1491
|
+
};
|
|
1492
|
+
}, [localUsage, protocol?.enableConfigQuery]);
|
|
1493
|
+
/*
|
|
1494
|
+
* Nothing carried over from the agent before this one.
|
|
1495
|
+
*
|
|
1496
|
+
* The runtime store keeps one snapshot, not one per agent, so after a
|
|
1497
|
+
* switch it still holds whatever the previous agent last reported — and the
|
|
1498
|
+
* bar went on showing that conversation's numbers under a new agent's name
|
|
1499
|
+
* until the new one answered. `localUsage` had the same problem from the
|
|
1500
|
+
* other direction: it accumulates a session, and a session belongs to an
|
|
1501
|
+
* agent.
|
|
1502
|
+
*
|
|
1503
|
+
* So the local tally is cleared on a switch, and the store's snapshot is
|
|
1504
|
+
* ignored until it is replaced by a different object — which is the only
|
|
1505
|
+
* signal available that it is the new agent's and not the old one's.
|
|
1506
|
+
*/
|
|
1507
|
+
const seenAgent = useRef(activeAgentId);
|
|
1508
|
+
const snapshotAtSwitch = useRef(null);
|
|
1509
|
+
const storeSnapshot = contextSnapshotQuery.data;
|
|
1510
|
+
const storeSnapshotRef = useRef(storeSnapshot);
|
|
1511
|
+
storeSnapshotRef.current = storeSnapshot;
|
|
1512
|
+
useEffect(() => {
|
|
1513
|
+
if (seenAgent.current === activeAgentId) {
|
|
1514
|
+
return;
|
|
1515
|
+
}
|
|
1516
|
+
seenAgent.current = activeAgentId;
|
|
1517
|
+
setLocalUsage(null);
|
|
1518
|
+
snapshotAtSwitch.current = storeSnapshotRef.current ?? null;
|
|
1519
|
+
}, [activeAgentId]);
|
|
1520
|
+
const freshStoreSnapshot = storeSnapshot && storeSnapshot !== snapshotAtSwitch.current
|
|
1521
|
+
? storeSnapshot
|
|
1522
|
+
: undefined;
|
|
1523
|
+
const agentUsage = externalContextSnapshot ?? freshStoreSnapshot ?? localSnapshot;
|
|
1524
|
+
/*
|
|
1525
|
+
* Handed on to a host that draws its own prompt.
|
|
1526
|
+
*
|
|
1527
|
+
* The loop workspace is one: it renders the composer itself, so the usage
|
|
1528
|
+
* bar beside it can only show what this component passes out. Without this
|
|
1529
|
+
* an in-page agent — whose only account of the window is the totals the
|
|
1530
|
+
* harness reports here — left that bar permanently empty.
|
|
1531
|
+
*/
|
|
1532
|
+
useEffect(() => {
|
|
1533
|
+
onContextSnapshot?.(agentUsage);
|
|
1534
|
+
}, [agentUsage, onContextSnapshot]);
|
|
1236
1535
|
const sandboxStatusQuery = useSandbox(configQueriesEnabled && showHeader, protocol?.configEndpoint, protocol?.authToken, protocol?.agentId);
|
|
1237
1536
|
// ---- Refs ----
|
|
1238
1537
|
const adapterRef = useRef(null);
|
|
@@ -1266,6 +1565,36 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
1266
1565
|
const onToolCallCompleteRef = useRef(onToolCallComplete);
|
|
1267
1566
|
onToolCallCompleteRef.current = onToolCallComplete;
|
|
1268
1567
|
const handleRespondRef = useRef(null);
|
|
1568
|
+
// A decision made outside the chat — a host page's own approval banner —
|
|
1569
|
+
// is answered exactly as the tool card's buttons answer it: through the
|
|
1570
|
+
// run's continuation, addressed to the tool call the approval belongs to.
|
|
1571
|
+
useEffect(() => {
|
|
1572
|
+
let lastSeq = agentRuntimeStore.getState().toolDecisionRequest?.seq ?? 0;
|
|
1573
|
+
return agentRuntimeStore.subscribe(state => state.toolDecisionRequest, request => {
|
|
1574
|
+
if (!request || request.seq === lastSeq)
|
|
1575
|
+
return;
|
|
1576
|
+
lastSeq = request.seq;
|
|
1577
|
+
const respond = handleRespondRef.current;
|
|
1578
|
+
if (!respond)
|
|
1579
|
+
return;
|
|
1580
|
+
const normalize = (name) => (name ?? '').toLowerCase().replace(/[-_]/g, '');
|
|
1581
|
+
const calls = Array.from(toolCallsRef.current.values());
|
|
1582
|
+
// By the approval id the tool result carries, else by the tool
|
|
1583
|
+
// name of a call still waiting — the same two matches the card makes.
|
|
1584
|
+
const call = calls.find(entry => entry.result
|
|
1585
|
+
?.approvalId === request.approvalId) ??
|
|
1586
|
+
calls.find(entry => normalize(entry.toolName) === normalize(request.toolName) &&
|
|
1587
|
+
(entry.status === 'executing' || entry.status === 'inProgress'));
|
|
1588
|
+
if (!call)
|
|
1589
|
+
return;
|
|
1590
|
+
void respond(call.toolCallId, {
|
|
1591
|
+
type: 'tool-approval-decision',
|
|
1592
|
+
approved: request.approved,
|
|
1593
|
+
approvalId: request.approvalId,
|
|
1594
|
+
toolName: call.toolName,
|
|
1595
|
+
});
|
|
1596
|
+
});
|
|
1597
|
+
}, []);
|
|
1269
1598
|
const applyServerApprovalDecision = useCallback((approval, approved, note) => {
|
|
1270
1599
|
if (!approval?.id) {
|
|
1271
1600
|
return false;
|
|
@@ -1394,8 +1723,17 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
1394
1723
|
}, [adjustTextareaHeight]);
|
|
1395
1724
|
// ---- Initialize model and tools when config is available ----
|
|
1396
1725
|
useEffect(() => {
|
|
1397
|
-
|
|
1398
|
-
|
|
1726
|
+
/*
|
|
1727
|
+
* `offeredModels`, not the two sources it is built from.
|
|
1728
|
+
*
|
|
1729
|
+
* It also carries the model an in-page agent was built with, for the case
|
|
1730
|
+
* where there is no config endpoint to ask — and this gate read the raw
|
|
1731
|
+
* sources, so that model was offered by the menu and never selected. The
|
|
1732
|
+
* menu draws nothing without a selection, so a browser agent had a model
|
|
1733
|
+
* list of one and no model control at all.
|
|
1734
|
+
*/
|
|
1735
|
+
if (offeredModels.length > 0 && !selectedModel) {
|
|
1736
|
+
const modelsList = offeredModels;
|
|
1399
1737
|
const preferredModel = initialModel || configQuery.data?.defaultModel;
|
|
1400
1738
|
if (preferredModel) {
|
|
1401
1739
|
const modelExists = modelsList.some(m => m.id === preferredModel);
|
|
@@ -1439,6 +1777,7 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
1439
1777
|
}
|
|
1440
1778
|
}, [
|
|
1441
1779
|
configQuery.data,
|
|
1780
|
+
offeredModels,
|
|
1442
1781
|
selectedModel,
|
|
1443
1782
|
initialModel,
|
|
1444
1783
|
availableModels,
|
|
@@ -1729,6 +2068,10 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
1729
2068
|
}, [useStoreMode, runtimeId]);
|
|
1730
2069
|
// ---- Conversation history loading ----
|
|
1731
2070
|
const prevHistoryScopeRef = useRef(undefined);
|
|
2071
|
+
const historyVersionRef = useRef(0);
|
|
2072
|
+
// Set when the next load must come from a fresh snapshot, not the one in
|
|
2073
|
+
// the store: what the store holds is the transcript before the change.
|
|
2074
|
+
const freshSnapshotRef = useRef(false);
|
|
1732
2075
|
useEffect(() => {
|
|
1733
2076
|
if (historyScopeId !== prevHistoryScopeRef.current) {
|
|
1734
2077
|
if (historyScopeId) {
|
|
@@ -1742,6 +2085,18 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
1742
2085
|
}
|
|
1743
2086
|
if (!historyScopeId)
|
|
1744
2087
|
return;
|
|
2088
|
+
if (historyVersion !== historyVersionRef.current) {
|
|
2089
|
+
historyVersionRef.current = historyVersion;
|
|
2090
|
+
if (historyVersion > 0) {
|
|
2091
|
+
// The transcript changed on the server outside a run — a rewind to a
|
|
2092
|
+
// checkpoint. Forget what is shown and load what the agent now has.
|
|
2093
|
+
useConversationStore.getState().clearMessages(historyScopeId);
|
|
2094
|
+
setDisplayItems([]);
|
|
2095
|
+
toolCallsRef.current.clear();
|
|
2096
|
+
historyRetryAttemptsRef.current.set(historyScopeId, 0);
|
|
2097
|
+
freshSnapshotRef.current = true;
|
|
2098
|
+
}
|
|
2099
|
+
}
|
|
1745
2100
|
const store = useConversationStore.getState();
|
|
1746
2101
|
const currentlyFetching = store.isFetching(historyScopeId);
|
|
1747
2102
|
const storedMessages = store.getMessages(historyScopeId);
|
|
@@ -1770,7 +2125,10 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
1770
2125
|
store.markFetched(historyScopeId);
|
|
1771
2126
|
setHistoryLoaded(true);
|
|
1772
2127
|
};
|
|
1773
|
-
const existingMessages =
|
|
2128
|
+
const existingMessages = freshSnapshotRef.current
|
|
2129
|
+
? []
|
|
2130
|
+
: fullContextToMessages();
|
|
2131
|
+
freshSnapshotRef.current = false;
|
|
1774
2132
|
if (existingMessages.length > 0) {
|
|
1775
2133
|
applyMessages(existingMessages);
|
|
1776
2134
|
return;
|
|
@@ -1859,6 +2217,7 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
1859
2217
|
wsState,
|
|
1860
2218
|
activeAgentId,
|
|
1861
2219
|
historyRefreshTick,
|
|
2220
|
+
historyVersion,
|
|
1862
2221
|
]);
|
|
1863
2222
|
// Keep in-memory store in sync with displayItems
|
|
1864
2223
|
useEffect(() => {
|
|
@@ -1882,6 +2241,15 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
1882
2241
|
onMessagesChange?.(messages);
|
|
1883
2242
|
}
|
|
1884
2243
|
}, [displayItems, messages, onMessagesChange]);
|
|
2244
|
+
// Every change, streaming included — for a caller following the reply as
|
|
2245
|
+
// it arrives rather than counting messages. See `onItemsChange`.
|
|
2246
|
+
useEffect(() => {
|
|
2247
|
+
onItemsChange?.(displayItems.filter((item) => !isToolCallMessage(item)));
|
|
2248
|
+
}, [displayItems, onItemsChange]);
|
|
2249
|
+
// And everything, tool calls included — see `onDisplayItemsChange`.
|
|
2250
|
+
useEffect(() => {
|
|
2251
|
+
onDisplayItemsChange?.(displayItems);
|
|
2252
|
+
}, [displayItems, onDisplayItemsChange]);
|
|
1885
2253
|
const padding = compact ? 2 : 3;
|
|
1886
2254
|
// Derive approval config from protocol for built-in tool approval support
|
|
1887
2255
|
const approvalConfig = useMemo(() => {
|
|
@@ -1912,12 +2280,42 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
1912
2280
|
// surface and launching overlay still render; we simply do not connect.
|
|
1913
2281
|
if (!autoConnect)
|
|
1914
2282
|
return;
|
|
2283
|
+
// Nor when there is nothing to connect to. A browser sandbox has no agent
|
|
2284
|
+
// behind it, and dialling one would only produce errors the person cannot
|
|
2285
|
+
// act on — the header already says why the chat is off.
|
|
2286
|
+
if (disabled)
|
|
2287
|
+
return;
|
|
1915
2288
|
const adapter = createProtocolAdapter(protocol);
|
|
1916
2289
|
if (!adapter)
|
|
1917
2290
|
return;
|
|
1918
2291
|
adapterRef.current = adapter;
|
|
1919
2292
|
setAdapterReady(true);
|
|
1920
2293
|
unsubscribeRef.current = adapter.subscribe((event) => {
|
|
2294
|
+
/*
|
|
2295
|
+
* Nothing more from a turn the reader has stopped.
|
|
2296
|
+
*
|
|
2297
|
+
* Stopping aborts the request and asks the backend to cancel, and
|
|
2298
|
+
* neither is instant: an SSE stream already in flight keeps delivering,
|
|
2299
|
+
* and a model mid-sentence keeps being paid for tokens that are on the
|
|
2300
|
+
* wire. Until this guard, every one of those still ran through the
|
|
2301
|
+
* handler below — so the transcript went on typing itself for as long
|
|
2302
|
+
* as the turn had left, which is the whole of the "I pressed stop and
|
|
2303
|
+
* it kept going" report. `stoppedRef` was already set here and only two
|
|
2304
|
+
* places downstream ever read it.
|
|
2305
|
+
*
|
|
2306
|
+
* `state-update` and `error` are still let through: they carry the
|
|
2307
|
+
* connection's own condition rather than the turn's output, and a chat
|
|
2308
|
+
* that stops listening to those after a stop is a chat that cannot tell
|
|
2309
|
+
* you it has since disconnected. `done` too — it is what closes the
|
|
2310
|
+
* turn out; suppressing it would leave the session believing a stopped
|
|
2311
|
+
* turn is still running.
|
|
2312
|
+
*/
|
|
2313
|
+
if (stoppedRef.current &&
|
|
2314
|
+
event.type !== 'state-update' &&
|
|
2315
|
+
event.type !== 'error' &&
|
|
2316
|
+
event.type !== 'done') {
|
|
2317
|
+
return;
|
|
2318
|
+
}
|
|
1921
2319
|
switch (event.type) {
|
|
1922
2320
|
case 'message':
|
|
1923
2321
|
if (event.usage) {
|
|
@@ -2206,6 +2604,34 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
2206
2604
|
}
|
|
2207
2605
|
break;
|
|
2208
2606
|
case 'done':
|
|
2607
|
+
/*
|
|
2608
|
+
* What the turn cost, when nobody else is counting.
|
|
2609
|
+
*
|
|
2610
|
+
* A server-side agent reports its context through
|
|
2611
|
+
* `/configure/context`, and that answer wins. An in-page agent has
|
|
2612
|
+
* no server to ask — so the usage the harness reports here was the
|
|
2613
|
+
* only account of the window there was, and it was being dropped.
|
|
2614
|
+
* The bar and its ring simply never appeared for a browser agent.
|
|
2615
|
+
*/
|
|
2616
|
+
{
|
|
2617
|
+
const turnInput = event.usage?.promptTokens ?? 0;
|
|
2618
|
+
const turnOutput = event.usage?.completionTokens ?? 0;
|
|
2619
|
+
// The parts sum to the total when the harness did not send one:
|
|
2620
|
+
// keying on `totalTokens` alone dropped turns whose provider
|
|
2621
|
+
// counted input and output but never totalled them.
|
|
2622
|
+
const total = event.usage?.totalTokens ?? turnInput + turnOutput;
|
|
2623
|
+
if (total > 0) {
|
|
2624
|
+
setLocalUsage(previous => ({
|
|
2625
|
+
turnInput,
|
|
2626
|
+
turnOutput,
|
|
2627
|
+
// Added up, not replaced: the session is every turn so far,
|
|
2628
|
+
// and the harness reports one turn at a time.
|
|
2629
|
+
sessionInput: (previous?.sessionInput ?? 0) + turnInput,
|
|
2630
|
+
sessionOutput: (previous?.sessionOutput ?? 0) + turnOutput,
|
|
2631
|
+
totalTokens: total,
|
|
2632
|
+
}));
|
|
2633
|
+
}
|
|
2634
|
+
}
|
|
2209
2635
|
// The adapter signals the entire multi-turn conversation
|
|
2210
2636
|
// (including all continuations) has finished.
|
|
2211
2637
|
if (suppressAssistantTextForToolOnlyRef.current &&
|
|
@@ -2584,13 +3010,27 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
2584
3010
|
setIsLoading(false);
|
|
2585
3011
|
setIsStreaming(false);
|
|
2586
3012
|
agentRuntimeStore.getState().requestRefresh(activeAgentId);
|
|
3013
|
+
// The boxes under the delegation cards read the runtime store, not the
|
|
3014
|
+
// tool calls above; without this they keep their dots until the server's
|
|
3015
|
+
// own stop event arrives — if it ever does.
|
|
3016
|
+
agentRuntimeStore.getState().stopSubagentActivity();
|
|
2587
3017
|
suppressAssistantTextForToolOnlyRef.current = false;
|
|
2588
3018
|
currentAssistantMessageRef.current = null;
|
|
2589
3019
|
// Also interrupt any code running in the sandbox (best-effort).
|
|
2590
3020
|
sandboxStatusQuery.interrupt();
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
3021
|
+
/*
|
|
3022
|
+
* Interrupt the connected notebook kernel too, whatever it claims to be
|
|
3023
|
+
* doing.
|
|
3024
|
+
*
|
|
3025
|
+
* This used to fire only when `kernel.status === 'busy'`, and that status
|
|
3026
|
+
* is a value pushed from the server: a cell submitted a moment ago is
|
|
3027
|
+
* running while the client still reads `idle`, which is precisely the
|
|
3028
|
+
* window somebody hits Stop in. The check therefore skipped the interrupt
|
|
3029
|
+
* exactly when it was wanted. Interrupting an idle kernel costs nothing —
|
|
3030
|
+
* there is no execution to raise `KeyboardInterrupt` in — so the test was
|
|
3031
|
+
* only ever able to do harm.
|
|
3032
|
+
*/
|
|
3033
|
+
if (kernel) {
|
|
2594
3034
|
void kernel.interrupt().catch(() => { });
|
|
2595
3035
|
}
|
|
2596
3036
|
}, [
|
|
@@ -2615,6 +3055,39 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
2615
3055
|
onNewChat?.();
|
|
2616
3056
|
headerButtons?.onNewChat?.();
|
|
2617
3057
|
}, [clearStoreMessages, onNewChat, headerButtons, useStoreMode, runtimeId]);
|
|
3058
|
+
// Hand the send function to a host that owns the input box (the LOOP
|
|
3059
|
+
// workspace). Withdrawn on unmount so nothing holds a stale sender.
|
|
3060
|
+
useEffect(() => {
|
|
3061
|
+
if (!onSendReady)
|
|
3062
|
+
return undefined;
|
|
3063
|
+
if (!adapterReady && !onSendMessage) {
|
|
3064
|
+
onSendReady(null);
|
|
3065
|
+
return undefined;
|
|
3066
|
+
}
|
|
3067
|
+
onSendReady({
|
|
3068
|
+
send: (message) => {
|
|
3069
|
+
void handleSend(message);
|
|
3070
|
+
},
|
|
3071
|
+
stop: handleStop,
|
|
3072
|
+
// The same reset the header's + performs, for a host whose controls
|
|
3073
|
+
// live outside this component — the LOOP prompt's + reaches it here.
|
|
3074
|
+
newChat: handleNewChat,
|
|
3075
|
+
});
|
|
3076
|
+
return () => {
|
|
3077
|
+
onSendReady(null);
|
|
3078
|
+
};
|
|
3079
|
+
}, [
|
|
3080
|
+
onSendReady,
|
|
3081
|
+
adapterReady,
|
|
3082
|
+
onSendMessage,
|
|
3083
|
+
handleSend,
|
|
3084
|
+
handleStop,
|
|
3085
|
+
handleNewChat,
|
|
3086
|
+
]);
|
|
3087
|
+
// Streaming state, for a host that draws the prompt.
|
|
3088
|
+
useEffect(() => {
|
|
3089
|
+
onLoadingChange?.(isLoading);
|
|
3090
|
+
}, [onLoadingChange, isLoading]);
|
|
2618
3091
|
// ---- handleClear ----
|
|
2619
3092
|
const handleClear = useCallback(() => {
|
|
2620
3093
|
if (window.confirm('Clear all messages?')) {
|
|
@@ -2628,6 +3101,18 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
2628
3101
|
headerButtons?.onClear?.();
|
|
2629
3102
|
}
|
|
2630
3103
|
}, [clearStoreMessages, onClear, headerButtons, useStoreMode, runtimeId]);
|
|
3104
|
+
// ---- Turn removal (the TurnFooter's remove action) ----
|
|
3105
|
+
const handleRemoveItems = useCallback((ids) => {
|
|
3106
|
+
const drop = new Set(ids);
|
|
3107
|
+
setDisplayItems(prev => prev.filter(item => !drop.has(item.id)));
|
|
3108
|
+
// The tool-call registry mirrors the transcript; a removed turn's calls
|
|
3109
|
+
// must not linger there or a late protocol event would resurrect them.
|
|
3110
|
+
for (const [toolCallId, toolCall] of toolCallsRef.current.entries()) {
|
|
3111
|
+
if (drop.has(toolCall.id)) {
|
|
3112
|
+
toolCallsRef.current.delete(toolCallId);
|
|
3113
|
+
}
|
|
3114
|
+
}
|
|
3115
|
+
}, []);
|
|
2631
3116
|
// ---- HITL respond handler (passed to MessageList) ----
|
|
2632
3117
|
const handleRespond = useCallback(async (toolCallId, result) => {
|
|
2633
3118
|
const existingToolCall = toolCallsRef.current.get(toolCallId);
|
|
@@ -2812,7 +3297,7 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
2812
3297
|
// Decision dispatch happens here; continuation is resumed on server echo.
|
|
2813
3298
|
await onRejectApproval?.(approvalId, note);
|
|
2814
3299
|
}, [onRejectApproval]);
|
|
2815
|
-
// ---- Compute data for
|
|
3300
|
+
// ---- Compute data for the prompt ----
|
|
2816
3301
|
// Merge real-time WebSocket MCP status into the cached config data so the
|
|
2817
3302
|
// dropdown reflects live availability even when the config query was cached
|
|
2818
3303
|
// before the MCP servers finished starting.
|
|
@@ -2875,6 +3360,17 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
2875
3360
|
return merged;
|
|
2876
3361
|
}, [configMcpServers, effectiveMcpStatusData, mcpServers]);
|
|
2877
3362
|
// ---- Not ready ----
|
|
3363
|
+
/*
|
|
3364
|
+
* The transcript's tool renderer: the host's own, or — when a notebook was
|
|
3365
|
+
* named — the built-in surfaces that show what each cell tool did. Baked
|
|
3366
|
+
* in here rather than in any workspace, so every chat with a headless
|
|
3367
|
+
* notebook gets the same transcript. Above the early return below, as
|
|
3368
|
+
* every hook must be.
|
|
3369
|
+
*/
|
|
3370
|
+
const effectiveRenderToolResult = useMemo(() => renderToolResult ??
|
|
3371
|
+
(notebookToolSurfacesId
|
|
3372
|
+
? notebookToolSurfacesRenderer(notebookToolSurfacesId)
|
|
3373
|
+
: undefined), [renderToolResult, notebookToolSurfacesId]);
|
|
2878
3374
|
if (!ready) {
|
|
2879
3375
|
return (_jsx(Box, { className: className, sx: {
|
|
2880
3376
|
display: 'flex',
|
|
@@ -2896,8 +3392,21 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
2896
3392
|
const indicatorApiBase = protocol?.configEndpoint
|
|
2897
3393
|
? protocol.configEndpoint.replace(/\/api\/v1\/(config|configure)\/?$/, '')
|
|
2898
3394
|
: undefined;
|
|
3395
|
+
/*
|
|
3396
|
+
* Whether the composer may be typed in.
|
|
3397
|
+
*
|
|
3398
|
+
* It waits for the config query because that is the round trip proving the
|
|
3399
|
+
* agent is reachable. The condition has to mirror `configQueriesEnabled`
|
|
3400
|
+
* exactly, though: a protocol that never runs the query has nothing to wait
|
|
3401
|
+
* for, and waiting anyway leaves the input `readOnly` for good — selectable,
|
|
3402
|
+
* focusable, and silently ignoring every keystroke.
|
|
3403
|
+
*
|
|
3404
|
+
* `=== false` was too narrow for that. A config that simply omits the flag —
|
|
3405
|
+
* an in-page agent has no endpoint to ask — is equally never going to
|
|
3406
|
+
* produce data.
|
|
3407
|
+
*/
|
|
2899
3408
|
const connectionConfirmed = !protocol ||
|
|
2900
|
-
protocol.enableConfigQuery
|
|
3409
|
+
!protocol.enableConfigQuery ||
|
|
2901
3410
|
!!configQuery.data ||
|
|
2902
3411
|
!!skillsQuery.data;
|
|
2903
3412
|
const resolvedDescription = description || configQuery.data?.welcomeMessage || '';
|
|
@@ -2906,26 +3415,112 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
2906
3415
|
? suggestions
|
|
2907
3416
|
: Array.isArray(serverSuggestions) && serverSuggestions.length > 0
|
|
2908
3417
|
? serverSuggestions
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
3418
|
+
/*
|
|
3419
|
+
Either shape. A running agent may be older than the catalogue it
|
|
3420
|
+
was built from, where a suggestion was a bare string —
|
|
3421
|
+
`String(item)` on the mapping form yields "[object Object]",
|
|
3422
|
+
which is a chip that sends nonsense rather than one that is
|
|
3423
|
+
absent.
|
|
3424
|
+
*/
|
|
3425
|
+
.map(item => {
|
|
3426
|
+
if (typeof item === 'string') {
|
|
3427
|
+
const text = item.trim();
|
|
3428
|
+
return { title: text, message: text };
|
|
3429
|
+
}
|
|
3430
|
+
const text = (item?.text ?? '').trim();
|
|
3431
|
+
// The summary is the label when the spec gave one.
|
|
3432
|
+
const summary = (item?.summary ?? '').trim();
|
|
3433
|
+
return { title: summary || text, message: text };
|
|
3434
|
+
})
|
|
3435
|
+
.filter(item => item.message)
|
|
2912
3436
|
: undefined;
|
|
2913
3437
|
const messagesContent = children ? (children) : (_jsx(Box, { sx: {
|
|
2914
3438
|
display: 'flex',
|
|
2915
3439
|
flexDirection: 'column',
|
|
2916
3440
|
minHeight: 0,
|
|
3441
|
+
/*
|
|
3442
|
+
A reading column, not a full-bleed sheet.
|
|
3443
|
+
|
|
3444
|
+
The transcript keeps a book-page width and centres itself; on a
|
|
3445
|
+
narrow chat column the cap never binds and nothing changes. The
|
|
3446
|
+
rows inside carry their own horizontal padding, which becomes the
|
|
3447
|
+
margin once the cap does bind.
|
|
3448
|
+
*/
|
|
3449
|
+
width: '100%',
|
|
3450
|
+
maxWidth: 920,
|
|
3451
|
+
mx: 'auto',
|
|
2917
3452
|
bg: 'canvas.default',
|
|
2918
|
-
}, children: _jsx(ChatMessageList, { displayItems: displayItems, isLoading: isLoading, isStreaming: isStreaming, showLoadingIndicator: showLoadingIndicator, hideMessagesAfterToolUI: hideMessagesAfterToolUI, avatarConfig: defaultAvatarConfig, padding: padding, renderToolResult:
|
|
2919
|
-
const inputToolbar = showInput ? (_jsx(
|
|
3453
|
+
}, children: _jsx(ChatMessageList, { displayItems: displayItems, isLoading: isLoading, isStreaming: isStreaming, showLoadingIndicator: showLoadingIndicator, hideMessagesAfterToolUI: hideMessagesAfterToolUI, avatarConfig: defaultAvatarConfig, padding: padding, renderToolResult: effectiveRenderToolResult, approvalConfig: approvalConfig, messagesEndRef: messagesEndRef, onRespond: handleRespond, showTurnFooters: showTurnFooter, agentUsage: agentUsage, onRemoveItems: handleRemoveItems, emptyContent: launching ? null : (_jsx(ChatEmptyState, { emptyState: emptyState, brandIcon: brandIcon, description: resolvedDescription, suggestions: resolvedSuggestions, submitOnSuggestionClick: submitOnSuggestionClick, onSuggestionSubmit: handleSuggestionSubmit, onSuggestionFill: handleSuggestionFill })) }) }));
|
|
3454
|
+
const inputToolbar = showInput ? (_jsx(InputPrompt, { input: input, setInput: setInput, isLoading: isLoading, kernelStatus: liveKernelStatus, connectionConfirmed: connectionConfirmed, placeholder: placeholder,
|
|
3455
|
+
/*
|
|
3456
|
+
The same openers the empty state offers, typed into the box they would
|
|
3457
|
+
be typed into.
|
|
3458
|
+
|
|
3459
|
+
`message` rather than `title`: the animation is meant to look like
|
|
3460
|
+
somebody typing, and what they would have typed is the message the
|
|
3461
|
+
chip sends, not the label on it.
|
|
3462
|
+
*/
|
|
3463
|
+
typingSuggestions: resolvedSuggestions?.map(item => item.message || item.title), autoFocus: autoFocus, focusTrigger: focusTrigger, padding: padding, onSend: () => handleSend(), onStop: handleStop, disableInputPrompt: disableInputPrompt || disabled || !!overlay || launching, promptVariant: promptVariant, mentionableAgents: mentionableAgents,
|
|
3464
|
+
// The runtime's memory of what was sent to this agent, for the arrow
|
|
3465
|
+
// keys — part of the same initial state as the models and tools.
|
|
3466
|
+
promptHistory: configQuery.data?.promptHistory, showTokenUsage: showTokenUsage, showContextRing: showContextRing, agentUsage: agentUsage, showModelSelector: showModelSelector, showToolsMenu: showToolsMenu, showSkillsMenu: showSkillsMenu, codemodeEnabled: codemodeEnabled, onToggleCodemode: onToggleCodemode, isA2AProtocol: isA2AProtocol, showAgentsMenu: showAgentsMenu, agents: footerAgents, selectedAgentId: selectedAgentId ?? footerAgents[0]?.id, onSelectAgent: onSelectAgent, hasConfigData: !!configQuery.data, hasSkillsData: !!skillsQuery.data,
|
|
3467
|
+
// So the bar can tell "not here yet" from "not coming": a chat whose
|
|
3468
|
+
// agent has no config endpoint waits for ever otherwise.
|
|
3469
|
+
configLoading: configQuery.isLoading, models: offeredModels, selectedModel: selectedModel, onModelSelect: setSelectedModel, availableTools: builtinTools, mcpServers: filteredMcpServers, enabledMcpTools: enabledMcpTools, enabledMcpToolCount: getEnabledMcpToolNames().length, onToggleMcpTool: toggleMcpTool, onToggleAllMcpServerTools: toggleAllMcpServerTools, approvedMcpTools: approvedMcpTools, onToggleMcpToolApproval: toggleMcpToolApproval, skills: skillsQuery.data?.skills || [], skillsLoading: !!skillsQuery.isLoading, enabledSkills: enabledSkills, onToggleSkill: toggleSkill, onToggleAllSkills: toggleAllSkills, approvedSkills: approvedSkills, onToggleSkillApproval: toggleSkillApproval, apiBase: indicatorApiBase, authToken: protocol?.authToken, mcpStatusData: effectiveMcpStatusData })) : null;
|
|
2920
3470
|
// Shared header element. It is rendered either at the top of the chat (when
|
|
2921
3471
|
// no ephemeral notebook is shown) or INSIDE the chat body column (when the
|
|
2922
3472
|
// notebook is visible) so the header always follows the chat body across all
|
|
2923
3473
|
// view modes (docked sidebar, floating popup, floating-small).
|
|
2924
|
-
|
|
3474
|
+
//
|
|
3475
|
+
// Assembled as a props object first: `renderHeader` lets a host take these
|
|
3476
|
+
// exact props — kernel indicator, runtime status, actions, all of it — and
|
|
3477
|
+
// draw the bar itself. The loop's chat-header plugin is that host: the
|
|
3478
|
+
// header then *arrives as a plugin* without this component re-deriving any
|
|
3479
|
+
// of what only it knows.
|
|
3480
|
+
const chatHeaderProps = {
|
|
3481
|
+
title,
|
|
3482
|
+
subtitle,
|
|
3483
|
+
disableReason: disabled ? disableReason : undefined,
|
|
3484
|
+
brandIcon,
|
|
3485
|
+
headerContent,
|
|
3486
|
+
headerActions,
|
|
3487
|
+
showInformation,
|
|
3488
|
+
/*
|
|
3489
|
+
A default, so the button does something.
|
|
3490
|
+
|
|
3491
|
+
`showInformation` drew an (i) and then forwarded a click to whatever
|
|
3492
|
+
the host supplied — and a host that supplied nothing got a button that
|
|
3493
|
+
did nothing at all, which is worse than no button. `Chat` still passes
|
|
3494
|
+
its own handler and keeps its own pane; everything else gets this one.
|
|
3495
|
+
*/
|
|
3496
|
+
onInformationClick: onInformationClick ?? (() => setShowDetails(true)),
|
|
3497
|
+
padding,
|
|
3498
|
+
kernelIndicatorState,
|
|
3499
|
+
kernelIndicatorPlacement,
|
|
3500
|
+
runtimeStatus: sandboxStatusData ?? sandboxStatusQuery.data,
|
|
3501
|
+
kernel: notebookVisible
|
|
2925
3502
|
? (notebookKernel ?? kernel)
|
|
2926
3503
|
: documentVisible
|
|
2927
3504
|
? (documentKernel ?? kernel)
|
|
2928
|
-
: kernel,
|
|
3505
|
+
: kernel,
|
|
3506
|
+
kernelEnvironmentName,
|
|
3507
|
+
kernelCpu,
|
|
3508
|
+
kernelMemory,
|
|
3509
|
+
kernelGpu,
|
|
3510
|
+
headerButtons,
|
|
3511
|
+
messageCount: messages.length,
|
|
3512
|
+
onNewChat: handleNewChat,
|
|
3513
|
+
onClear: handleClear,
|
|
3514
|
+
chatViewMode,
|
|
3515
|
+
onChatViewModeChange,
|
|
3516
|
+
disabledViewModes,
|
|
3517
|
+
showEphemeralSurfaceControl: enableEphemeralNotebook || enableEphemeralDocument,
|
|
3518
|
+
enableEphemeralNotebookOption: enableEphemeralNotebook,
|
|
3519
|
+
enableEphemeralDocumentOption: enableEphemeralDocument,
|
|
3520
|
+
ephemeralSurfaceMode,
|
|
3521
|
+
onEphemeralSurfaceModeChange: handleEphemeralSurfaceModeChange,
|
|
3522
|
+
};
|
|
3523
|
+
const chatHeaderElement = showHeader ? (renderHeader ? (renderHeader(chatHeaderProps)) : (_jsx(ChatBaseHeader, { ...chatHeaderProps }))) : null;
|
|
2929
3524
|
// ========================================================================
|
|
2930
3525
|
// Render
|
|
2931
3526
|
// ========================================================================
|
|
@@ -2936,12 +3531,46 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
2936
3531
|
height: '100%',
|
|
2937
3532
|
maxHeight: '100%',
|
|
2938
3533
|
minHeight: 0,
|
|
3534
|
+
/*
|
|
3535
|
+
As wide as the host, always.
|
|
3536
|
+
|
|
3537
|
+
The root set its height and said nothing about width, so mounted in
|
|
3538
|
+
a flex row — which is how the LOOP chat mounts it — it was a
|
|
3539
|
+
shrink-to-fit item: as wide as its widest line and no wider,
|
|
3540
|
+
anchored to the left of a row it should have filled, and re-sizing
|
|
3541
|
+
with every streamed chunk. That is what made the person's own
|
|
3542
|
+
bubble drift while the agent answered. A chat fills the column it
|
|
3543
|
+
is given; the column decides the width, not the transcript.
|
|
3544
|
+
*/
|
|
3545
|
+
flex: '1 1 auto',
|
|
3546
|
+
width: '100%',
|
|
3547
|
+
minWidth: 0,
|
|
2939
3548
|
bg: backgroundColor || 'canvas.default',
|
|
2940
3549
|
borderRadius,
|
|
2941
3550
|
border,
|
|
2942
3551
|
boxShadow,
|
|
2943
3552
|
overflow: 'hidden',
|
|
2944
|
-
}, children: [!surfaceVisible && chatHeaderElement,
|
|
3553
|
+
}, children: [!surfaceVisible && chatHeaderElement, showDetails && (
|
|
3554
|
+
/*
|
|
3555
|
+
A column, not a row.
|
|
3556
|
+
|
|
3557
|
+
This is a flex container holding one child, and `AgentDetails` sets a
|
|
3558
|
+
height but no width — so in a row it was a flex item with `flex-basis:
|
|
3559
|
+
auto` and no grow, which is to say it was as wide as its longest line
|
|
3560
|
+
of text and no wider. On the LOOP workspace, where the chat column is
|
|
3561
|
+
already narrow, that read as the panel occupying half the space it was
|
|
3562
|
+
given, with the rest of the surface blank beside it.
|
|
3563
|
+
|
|
3564
|
+
Turning the axis makes width the *cross* axis, and a flex item
|
|
3565
|
+
stretches across that by default. `Chat.tsx` mounts the same component
|
|
3566
|
+
the same way and has always looked right for exactly this reason.
|
|
3567
|
+
*/
|
|
3568
|
+
_jsx(Box, { sx: {
|
|
3569
|
+
flex: '1 1 auto',
|
|
3570
|
+
minHeight: 0,
|
|
3571
|
+
display: 'flex',
|
|
3572
|
+
flexDirection: 'column',
|
|
3573
|
+
}, children: _jsx(AgentDetails, { name: title || 'AI Agent', icon: brandIcon, protocol: protocol?.type ?? 'unknown', url: protocol?.endpoint || '', messageCount: displayItems.length, agentId: activeAgentId, apiBase: protocol?.configEndpoint, onBack: () => setShowDetails(false) }) })), showToolApprovalBanner &&
|
|
2945
3574
|
pendingApprovals &&
|
|
2946
3575
|
pendingApprovals.length > 0 && (_jsx(ToolApprovalBannerSection, { pendingApprovals: pendingApprovals, onApprove: handleBannerApprove, onReject: handleBannerReject })), showErrors && error && (_jsxs(Box, { sx: {
|
|
2947
3576
|
display: 'flex',
|
|
@@ -2972,13 +3601,13 @@ showToolApprovalBanner = true, pendingApprovals: pendingApprovalsProp, onApprove
|
|
|
2972
3601
|
borderRight: '1px solid',
|
|
2973
3602
|
borderColor: 'border.default',
|
|
2974
3603
|
}),
|
|
2975
|
-
}, children: launching || overlay ? (_jsx(CompanionSurfaceSkeleton, { mode: notebookVisible ? 'notebook' : 'document' })) : notebookVisible ? (_jsx(EphemeralNotebook, { notebookId: ephemeralNotebookId,
|
|
3604
|
+
}, children: launching || overlay ? (_jsx(CompanionSurfaceSkeleton, { mode: notebookVisible ? 'notebook' : 'document' })) : notebookVisible ? (_jsx(EphemeralNotebook, { notebookId: ephemeralNotebookId, runtimeName: runtimeId || activeAgentId, runtimeOverride: ephemeralRuntimeOverride, themeVariant: themeVariant, colorMode: colorMode, nbformat: persistedEphemeralNbformat ?? undefined, onNbformatChange: handleEphemeralNotebookChange, toolbarComponent: ephemeralNotebookToolbar, toolbarExtraItems: notebookToolbarItems, collaborationProvider: ephemeralNotebookCollaborationProvider })) : (_jsx(React.Suspense, { fallback: null, children: _jsx(EphemeralDocument, { documentId: ephemeralDocumentId, runtimeName: runtimeId || activeAgentId, runtimeOverride: ephemeralRuntimeOverride, themeVariant: themeVariant, colorMode: colorMode, content: persistedEphemeralDocument ?? undefined, onContentChange: handleEphemeralDocumentChange, onToolsReady: handleDocumentToolsReady, onKernelChange: handleDocumentKernelChange, collaboration: ephemeralDocumentCollaboration, toolbarExtraItems: documentToolbarItems }) })) }), !surfaceCollapsed && (_jsxs(Box, { sx: surfaceChatFloating
|
|
2976
3605
|
? {
|
|
2977
3606
|
position: 'absolute',
|
|
2978
3607
|
right: 16,
|
|
2979
|
-
width:
|
|
3608
|
+
width: compactFloating ? 360 : 440,
|
|
2980
3609
|
maxWidth: 'calc(100% - 32px)',
|
|
2981
|
-
...(
|
|
3610
|
+
...(compactFloating
|
|
2982
3611
|
? { bottom: 16, height: '62%' }
|
|
2983
3612
|
: { top: 16, bottom: 16 }),
|
|
2984
3613
|
display: 'flex',
|