@datalayer/agent-runtimes 1.0.10 → 1.0.17
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/README.md +82 -1
- package/lib/{AgentLexical.d.ts → AgentDocument.d.ts} +5 -5
- package/lib/{AgentLexical.js → AgentDocument.js} +156 -26
- package/lib/AgentNode.js +32 -31
- package/lib/AgentNotebook.js +172 -17
- package/lib/AppExamples2.css +47 -0
- package/lib/AppExamples2.d.ts +3 -0
- package/lib/AppExamples2.js +21 -0
- package/lib/{agent-lexical-main.js → agent-document-main.js} +2 -2
- package/lib/agents/AgentRuntimeChat.d.ts +73 -0
- package/lib/agents/AgentRuntimeChat.js +198 -0
- package/lib/api/index.d.ts +12 -0
- package/lib/api/index.js +46 -0
- package/lib/api/runtimes/checkpoints.d.ts +122 -0
- package/lib/api/runtimes/checkpoints.js +118 -0
- package/lib/api/runtimes/environments.d.ts +9 -0
- package/lib/api/runtimes/environments.js +29 -0
- package/lib/api/runtimes/healthz.d.ts +15 -0
- package/lib/api/runtimes/healthz.js +44 -0
- package/lib/api/runtimes/index.d.ts +12 -0
- package/lib/api/runtimes/index.js +16 -0
- package/lib/api/runtimes/runtimes.d.ts +138 -0
- package/lib/api/runtimes/runtimes.js +230 -0
- package/lib/api/runtimes/snapshots.d.ts +38 -0
- package/lib/api/runtimes/snapshots.js +82 -0
- package/lib/api/scheduler/index.d.ts +6 -0
- package/lib/api/scheduler/index.js +10 -0
- package/lib/api/scheduler/schedules.d.ts +85 -0
- package/lib/api/scheduler/schedules.js +78 -0
- package/lib/api/spacer/documents.d.ts +12 -0
- package/lib/api/spacer/documents.js +43 -0
- package/lib/api/spacer/healthz.d.ts +15 -0
- package/lib/api/spacer/healthz.js +44 -0
- package/lib/api/spacer/index.d.ts +15 -0
- package/lib/api/spacer/index.js +19 -0
- package/lib/api/spacer/items.d.ts +25 -0
- package/lib/api/spacer/items.js +55 -0
- package/lib/api/spacer/lexicals.d.ts +34 -0
- package/lib/api/spacer/lexicals.js +89 -0
- package/lib/api/spacer/notebooks.d.ts +34 -0
- package/lib/api/spacer/notebooks.js +89 -0
- package/lib/api/spacer/spaces.d.ts +84 -0
- package/lib/api/spacer/spaces.js +170 -0
- package/lib/api/spacer/users.d.ts +9 -0
- package/lib/api/spacer/users.js +29 -0
- package/lib/chat/Chat.d.ts +1 -1
- package/lib/chat/Chat.js +54 -54
- package/lib/chat/ChatFloating.d.ts +2 -2
- package/lib/chat/ChatFloating.js +136 -25
- package/lib/chat/ChatSidebar.js +20 -22
- package/lib/chat/base/ChatBase.js +429 -39
- package/lib/chat/display/EmptyState.js +21 -21
- package/lib/chat/document/EphemeralDocument.d.ts +23 -0
- package/lib/chat/document/EphemeralDocument.js +270 -0
- package/lib/chat/header/ChatHeaderBase.d.ts +12 -2
- package/lib/chat/header/ChatHeaderBase.js +78 -23
- package/lib/chat/index.d.ts +1 -0
- package/lib/chat/index.js +2 -0
- package/lib/chat/notebook/EphemeralNotebook.d.ts +24 -0
- package/lib/chat/notebook/EphemeralNotebook.js +252 -0
- package/lib/chat/prompt/InputFooter.js +4 -1
- package/lib/client/AgentRuntimesClient.d.ts +127 -0
- package/lib/client/AgentRuntimesClient.js +36 -0
- package/lib/client/AgentsMixin.js +28 -28
- package/lib/client/SdkAgentRuntimesClient.d.ts +1 -1
- package/lib/client/SdkAgentRuntimesClient.js +1 -1
- package/lib/client/mixins/RuntimesMixin.d.ts +93 -0
- package/lib/client/mixins/RuntimesMixin.js +229 -0
- package/lib/client/mixins/SpacerMixin.d.ts +210 -0
- package/lib/client/mixins/SpacerMixin.js +615 -0
- package/lib/client/utils/spacerUtils.d.ts +18 -0
- package/lib/client/utils/spacerUtils.js +32 -0
- package/lib/collaboration/DatalayerCollaboration.d.ts +13 -0
- package/lib/collaboration/DatalayerCollaboration.js +28 -0
- package/lib/collaboration/DatalayerCollaborationProvider.d.ts +58 -0
- package/lib/collaboration/DatalayerCollaborationProvider.js +148 -0
- package/lib/collaboration/index.d.ts +2 -0
- package/lib/collaboration/index.js +6 -0
- package/lib/components/AgentSummary.d.ts +19 -0
- package/lib/components/AgentSummary.js +89 -0
- package/lib/components/a2ui/A2uiSurfaceComposed.d.ts +13 -0
- package/lib/components/a2ui/A2uiSurfaceComposed.js +110 -0
- package/lib/components/a2ui/index.d.ts +2 -0
- package/lib/components/a2ui/index.js +6 -0
- package/lib/components/a2ui/styles.d.ts +14 -0
- package/lib/components/a2ui/styles.js +142 -0
- package/lib/components/context/SpaceSelect.d.ts +2 -0
- package/lib/components/context/SpaceSelect.js +42 -0
- package/lib/components/flashes/FlashDisclaimer.d.ts +2 -0
- package/lib/components/flashes/FlashDisclaimer.js +17 -0
- package/lib/components/icons/ArtifactIcon.d.ts +10 -0
- package/lib/components/icons/ArtifactIcon.js +58 -0
- package/lib/components/icons/index.d.ts +1 -0
- package/lib/components/icons/index.js +5 -0
- package/lib/components/index.d.ts +5 -0
- package/lib/components/index.js +5 -0
- package/lib/components/nbgrader/NbGradesDetails.d.ts +5 -0
- package/lib/components/nbgrader/NbGradesDetails.js +19 -0
- package/lib/components/nbgrader/index.d.ts +1 -0
- package/lib/components/nbgrader/index.js +5 -0
- package/lib/components/progress/CreditsIndicator.d.ts +33 -0
- package/lib/components/progress/CreditsIndicator.js +23 -0
- package/lib/components/progress/index.d.ts +2 -0
- package/lib/components/progress/index.js +6 -0
- package/lib/components/runtimes/RuntimeCellVariables.d.ts +39 -0
- package/lib/components/runtimes/RuntimeCellVariables.js +172 -0
- package/lib/components/runtimes/RuntimeCellVariablesDialog.d.ts +37 -0
- package/lib/components/runtimes/RuntimeCellVariablesDialog.js +101 -0
- package/lib/components/runtimes/RuntimeLauncherDialog.d.ts +57 -0
- package/lib/components/runtimes/RuntimeLauncherDialog.js +275 -0
- package/lib/components/runtimes/RuntimePickerBase.d.ts +69 -0
- package/lib/components/runtimes/RuntimePickerBase.js +122 -0
- package/lib/components/runtimes/RuntimePickerCell.d.ts +34 -0
- package/lib/components/runtimes/RuntimePickerCell.js +104 -0
- package/lib/components/runtimes/RuntimePickerNotebook.d.ts +42 -0
- package/lib/components/runtimes/RuntimePickerNotebook.js +232 -0
- package/lib/components/runtimes/RuntimeReservationControl.d.ts +47 -0
- package/lib/components/runtimes/RuntimeReservationControl.js +42 -0
- package/lib/components/runtimes/RuntimeSimplePicker.d.ts +38 -0
- package/lib/components/runtimes/RuntimeSimplePicker.js +155 -0
- package/lib/components/runtimes/RuntimeTransfer.d.ts +16 -0
- package/lib/components/runtimes/RuntimeTransfer.js +5 -0
- package/lib/components/runtimes/RuntimeUtils.d.ts +17 -0
- package/lib/components/runtimes/RuntimeUtils.js +178 -0
- package/lib/components/runtimes/RuntimeVariables.d.ts +38 -0
- package/lib/components/runtimes/RuntimeVariables.js +75 -0
- package/lib/components/runtimes/index.d.ts +11 -0
- package/lib/components/runtimes/index.js +15 -0
- package/lib/components/scheduler/ScheduleMenu.d.ts +54 -0
- package/lib/components/scheduler/ScheduleMenu.js +154 -0
- package/lib/components/scheduler/index.d.ts +1 -0
- package/lib/components/scheduler/index.js +5 -0
- package/lib/components/snapshots/SandboxSnapshotMenu.d.ts +33 -0
- package/lib/components/snapshots/SandboxSnapshotMenu.js +169 -0
- package/lib/components/snapshots/index.d.ts +1 -0
- package/lib/components/snapshots/index.js +5 -0
- package/lib/components/snippets/SnippetDialog.d.ts +42 -0
- package/lib/components/snippets/SnippetDialog.js +42 -0
- package/lib/components/students/StudentItemStatus.d.ts +7 -0
- package/lib/components/students/StudentItemStatus.js +68 -0
- package/lib/components/students/index.d.ts +1 -0
- package/lib/components/students/index.js +5 -0
- package/lib/components/tokens/SpaceVariantToken.d.ts +5 -0
- package/lib/components/tokens/SpaceVariantToken.js +23 -0
- package/lib/components/tokens/index.d.ts +1 -0
- package/lib/components/tokens/index.js +5 -0
- package/lib/components/toolbars/AssignmentEditorToolbar.d.ts +4 -0
- package/lib/components/toolbars/AssignmentEditorToolbar.js +18 -0
- package/lib/components/toolbars/DocumentEditorToolbar.d.ts +2 -0
- package/lib/components/toolbars/DocumentEditorToolbar.js +12 -0
- package/lib/components/toolbars/NotebookEditorToolbar.d.ts +29 -0
- package/lib/components/toolbars/NotebookEditorToolbar.js +30 -0
- package/lib/context/ContextInspector.d.ts +1 -14
- package/lib/context/ContextInspector.js +3 -73
- package/lib/context/CostUsageChart.d.ts +4 -3
- package/lib/context/CostUsageChart.js +236 -35
- package/lib/context/MessageHistory.d.ts +30 -0
- package/lib/context/MessageHistory.js +129 -0
- package/lib/context/TokenUsageChart.d.ts +4 -3
- package/lib/context/TokenUsageChart.js +180 -30
- package/lib/context/TurnGraphChart.d.ts +1 -1
- package/lib/context/TurnGraphChart.js +6 -6
- package/lib/examples/A2UiAgentExample.d.ts +22 -0
- package/lib/examples/A2UiAgentExample.js +442 -0
- package/lib/examples/A2UiComponentsGalleryExample.d.ts +3 -0
- package/lib/examples/A2UiComponentsGalleryExample.js +863 -0
- package/lib/examples/A2UiContactCardExample.js +9 -5
- package/lib/examples/A2UiRestaurantExample.js +23 -8
- package/lib/examples/A2UiViewerExample.js +75 -3
- package/lib/examples/AgUiAgenticExample.d.ts +1 -12
- package/lib/examples/AgUiAgenticExample.js +52 -8
- package/lib/examples/AgUiBackendToolRenderingExample.d.ts +1 -16
- package/lib/examples/AgUiBackendToolRenderingExample.js +32 -17
- package/lib/examples/AgUiHaikuGenUiExample.d.ts +1 -17
- package/lib/examples/AgUiHaikuGenUiExample.js +49 -33
- package/lib/examples/AgUiHumanInTheLoopExample.d.ts +1 -12
- package/lib/examples/AgUiHumanInTheLoopExample.js +21 -6
- package/lib/examples/AgUiSharedStateExample.d.ts +1 -14
- package/lib/examples/AgUiSharedStateExample.js +21 -6
- package/lib/examples/AgUiToolsBasedGenUiExample.d.ts +1 -14
- package/lib/examples/AgUiToolsBasedGenUiExample.js +21 -6
- package/lib/examples/AgentCheckpointsExample.d.ts +1 -1
- package/lib/examples/AgentCheckpointsExample.js +9 -10
- package/lib/examples/AgentCodemodeExample.js +3 -3
- package/lib/examples/AgentEvalsExample.js +5 -5
- package/lib/examples/AgentGuardrailsExample.js +17 -12
- package/lib/examples/AgentHooksExample.js +14 -55
- package/lib/examples/AgentInferenceProviderExample.js +4 -4
- package/lib/examples/AgentLoopExample.d.ts +10 -0
- package/lib/examples/AgentLoopExample.js +304 -0
- package/lib/examples/AgentMCPExample.js +7 -7
- package/lib/examples/AgentMemoryExample.js +4 -4
- package/lib/examples/AgentMonitoringExample.js +114 -44
- package/lib/examples/AgentNotificationsExample.js +4 -4
- package/lib/examples/AgentOtelExample.d.ts +3 -3
- package/lib/examples/AgentOtelExample.js +15 -10
- package/lib/examples/AgentOutputsExample.js +6 -6
- package/lib/examples/AgentParametersExample.js +21 -33
- package/lib/examples/AgentSandboxExample.js +5 -5
- package/lib/examples/AgentSkillsExample.js +7 -7
- package/lib/examples/AgentSubagentsExample.js +4 -4
- package/lib/examples/AgentToolApprovalsExample.js +5 -5
- package/lib/examples/AgentTriggersExample.js +9 -9
- package/lib/examples/AgentspecsExample.js +63 -41
- package/lib/examples/ChatCustomExample.js +23 -77
- package/lib/examples/ChatExample.js +13 -44
- package/lib/examples/LexicalAgentExample.js +43 -91
- package/lib/examples/LexicalAgentSidebarExample.js +45 -73
- package/lib/examples/NotebookAgentExample.js +52 -81
- package/lib/examples/NotebookAgentSidebarExample.js +43 -71
- package/lib/examples/NotebookCollaborationExample.js +11 -9
- package/lib/examples/NotebookExample.js +5 -2
- package/lib/examples/components/AuthRequiredView.js +1 -1
- package/lib/examples/components/ExampleErrorBoundary.d.ts +46 -0
- package/lib/examples/components/ExampleErrorBoundary.js +67 -0
- package/lib/examples/components/haiku/haiku-card.css +11 -0
- package/lib/examples/components/weather/weather-card.css +11 -0
- package/lib/examples/example-selector.js +3 -1
- package/lib/examples/hooks/useExampleAgentRuntime.d.ts +35 -0
- package/lib/examples/hooks/useExampleAgentRuntime.js +82 -0
- package/lib/examples/hooks/useSpecRenderToolResult.d.ts +30 -0
- package/lib/examples/hooks/useSpecRenderToolResult.js +61 -0
- package/lib/examples/index.d.ts +3 -1
- package/lib/examples/index.js +3 -1
- package/lib/examples/main.js +340 -93
- package/lib/examples/utils/a2ui.d.ts +2 -0
- package/lib/examples/utils/a2ui.js +97 -2
- package/lib/examples/utils/agentSummaryStore.d.ts +21 -0
- package/lib/examples/utils/agentSummaryStore.js +23 -0
- package/lib/examples/utils/notebooks/Empty.ipynb.json +30 -30
- package/lib/examples/utils/runtimeTargetStore.d.ts +9 -0
- package/lib/examples/utils/runtimeTargetStore.js +27 -0
- package/lib/examples/utils/teardownAgents.d.ts +13 -0
- package/lib/examples/utils/teardownAgents.js +78 -0
- package/lib/examples/utils/useExampleAgentRuntimesUrl.d.ts +2 -0
- package/lib/examples/utils/useExampleAgentRuntimesUrl.js +26 -7
- package/lib/examples2/CellExample.d.ts +6 -0
- package/lib/examples2/CellExample.js +20 -0
- package/lib/examples2/DatalayerNotebookExample.d.ts +16 -0
- package/lib/examples2/DatalayerNotebookExample.js +109 -0
- package/lib/examples2/NativeNavigationExample.d.ts +8 -0
- package/lib/examples2/NativeNavigationExample.js +97 -0
- package/lib/examples2/NotebookExample.d.ts +6 -0
- package/lib/examples2/NotebookExample.js +19 -0
- package/lib/examples2/NotebookMutationsKernel.d.ts +2 -0
- package/lib/examples2/NotebookMutationsKernel.js +105 -0
- package/lib/examples2/NotebookMutationsServiceManager.d.ts +2 -0
- package/lib/examples2/NotebookMutationsServiceManager.js +109 -0
- package/lib/examples2/ReactRouterExample.d.ts +6 -0
- package/lib/examples2/ReactRouterExample.js +175 -0
- package/lib/examples2/example-selector.d.ts +22 -0
- package/lib/examples2/example-selector.js +45 -0
- package/lib/examples2/index.d.ts +2 -0
- package/lib/examples2/index.js +6 -0
- package/lib/examples2/lexical-theme.css +436 -0
- package/lib/examples2/main.d.ts +2 -0
- package/lib/examples2/main.js +330 -0
- package/lib/examples2/notebooks/IPyWidgetsExample.ipynb.json +101 -0
- package/lib/examples2/notebooks/IPyWidgetsExampleWithState.ipynb.json +112 -0
- package/lib/examples2/notebooks/Lite.ipynb.json +128 -0
- package/lib/examples2/notebooks/Matplotlib.ipynb.json +137 -0
- package/lib/examples2/notebooks/NotebookExample1.ipynb.json +126 -0
- package/lib/examples2/notebooks/NotebookExample2.ipynb.json +48 -0
- package/lib/examples2/notebooks/NotebookOutputs.ipynb.json +49 -0
- package/lib/examples2/notebooks/NotebookToCExample.ipynb.json +102 -0
- package/lib/examples2/notebooks/OutputIPyWidgetsExample.d.ts +145 -0
- package/lib/examples2/notebooks/OutputIPyWidgetsExample.js +153 -0
- package/lib/examples2/notebooks/PyGWalker.ipynb.json +55 -0
- package/lib/hooks/index.d.ts +9 -1
- package/lib/hooks/index.js +13 -1
- package/lib/hooks/useAIAgentsWebSocket.d.ts +1 -1
- package/lib/hooks/useAIAgentsWebSocket.js +39 -3
- package/lib/hooks/useAgentRuntimes.d.ts +15 -3
- package/lib/hooks/useAgentRuntimes.js +186 -27
- package/lib/hooks/useAgentsService.js +5 -5
- package/lib/hooks/useCellOutputshot.d.ts +4 -0
- package/lib/hooks/useCellOutputshot.js +25 -0
- package/lib/hooks/useCheckpoints.d.ts +8 -8
- package/lib/hooks/useCheckpoints.js +36 -26
- package/lib/hooks/useConfig.d.ts +1 -1
- package/lib/hooks/useMonitoring.d.ts +7 -5
- package/lib/hooks/useMonitoring.js +16 -10
- package/lib/hooks/useNotifications.d.ts +11 -11
- package/lib/hooks/useNotifications.js +1 -1
- package/lib/hooks/useProgressStore.d.ts +25 -0
- package/lib/hooks/useProgressStore.js +58 -0
- package/lib/hooks/useProgressTask.d.ts +9 -0
- package/lib/hooks/useProgressTask.js +41 -0
- package/lib/hooks/useProjects.d.ts +628 -0
- package/lib/hooks/useProjects.js +190 -0
- package/lib/hooks/useRuntimes.d.ts +5 -0
- package/lib/hooks/useRuntimes.js +34 -0
- package/lib/hooks/useToolApprovals.d.ts +6 -6
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/jupyter/exec/Python.d.ts +5 -0
- package/lib/jupyter/exec/Python.js +100 -0
- package/lib/jupyter/exec/Snippets.d.ts +105 -0
- package/lib/jupyter/exec/Snippets.js +101 -0
- package/lib/jupyter/exec/index.d.ts +2 -0
- package/lib/jupyter/exec/index.js +6 -0
- package/lib/jupyter/index.d.ts +2 -0
- package/lib/jupyter/index.js +6 -0
- package/lib/jupyter/kernelsHandler.d.ts +8 -0
- package/lib/jupyter/kernelsHandler.js +39 -0
- package/lib/mocks/models/CourseMock.d.ts +6 -0
- package/lib/mocks/models/CourseMock.js +29 -0
- package/lib/mocks/models/SpaceMock.d.ts +6 -0
- package/lib/mocks/models/SpaceMock.js +25 -0
- package/lib/models/Assignment.d.ts +7 -0
- package/lib/models/Assignment.js +5 -0
- package/lib/models/Cell.d.ts +8 -0
- package/lib/models/Cell.js +5 -0
- package/lib/models/CodeBlock.d.ts +10 -0
- package/lib/models/CodeBlock.js +5 -0
- package/lib/models/CodeSandboxSnapshot.d.ts +92 -0
- package/lib/models/CodeSandboxSnapshot.js +13 -0
- package/lib/models/CodeSandboxSnapshotDTO.d.ts +173 -0
- package/lib/models/CodeSandboxSnapshotDTO.js +139 -0
- package/lib/models/CodefeedBlocks.d.ts +7 -0
- package/lib/models/CodefeedBlocks.js +5 -0
- package/lib/models/Content.d.ts +5 -0
- package/lib/models/Content.js +5 -0
- package/lib/models/Course.d.ts +17 -0
- package/lib/models/Course.js +5 -0
- package/lib/models/Dataset.d.ts +16 -0
- package/lib/models/Dataset.js +5 -0
- package/lib/models/Document.d.ts +8 -0
- package/lib/models/Document.js +5 -0
- package/lib/models/Environment.d.ts +86 -0
- package/lib/models/Environment.js +5 -0
- package/lib/models/EnvironmentDTO.d.ts +125 -0
- package/lib/models/EnvironmentDTO.js +88 -0
- package/lib/models/Exercise.d.ts +16 -0
- package/lib/models/Exercise.js +5 -0
- package/lib/models/Item.d.ts +20 -0
- package/lib/models/Item.js +5 -0
- package/lib/models/ItemDTO.d.ts +74 -0
- package/lib/models/ItemDTO.js +186 -0
- package/lib/models/ItemType.d.ts +2 -0
- package/lib/models/ItemType.js +5 -0
- package/lib/models/Lesson.d.ts +5 -0
- package/lib/models/Lesson.js +5 -0
- package/lib/models/LexicalDTO.d.ts +155 -0
- package/lib/models/LexicalDTO.js +157 -0
- package/lib/models/Library.d.ts +10 -0
- package/lib/models/Library.js +5 -0
- package/lib/models/Notebook.d.ts +11 -0
- package/lib/models/Notebook.js +5 -0
- package/lib/models/NotebookDTO.d.ts +96 -0
- package/lib/models/NotebookDTO.js +153 -0
- package/lib/models/Page.d.ts +41 -0
- package/lib/models/Page.js +25 -0
- package/lib/models/PageTag.d.ts +19 -0
- package/lib/models/PageTag.js +94 -0
- package/lib/models/ProjectDTO.d.ts +89 -0
- package/lib/models/ProjectDTO.js +131 -0
- package/lib/models/Runtime.d.ts +160 -0
- package/lib/models/Runtime.js +18 -0
- package/lib/models/RuntimeDTO.d.ts +172 -0
- package/lib/models/RuntimeDTO.js +204 -0
- package/lib/models/Space.d.ts +35 -0
- package/lib/models/Space.js +66 -0
- package/lib/models/SpaceDTO.d.ts +334 -0
- package/lib/models/SpaceDTO.js +244 -0
- package/lib/models/SpaceItem.d.ts +10 -0
- package/lib/models/SpaceItem.js +5 -0
- package/lib/models/SpaceMember.d.ts +6 -0
- package/lib/models/SpaceMember.js +5 -0
- package/lib/models/StudentItem.d.ts +21 -0
- package/lib/models/StudentItem.js +5 -0
- package/lib/models/index.d.ts +32 -0
- package/lib/models/index.js +39 -0
- package/lib/protocols/AGUIAdapter.js +1 -1
- package/lib/runtimes/actions.d.ts +102 -0
- package/lib/runtimes/actions.js +249 -0
- package/lib/runtimes/apis.d.ts +273 -0
- package/lib/runtimes/apis.js +5 -0
- package/lib/runtimes/index.d.ts +5 -0
- package/lib/runtimes/index.js +9 -0
- package/lib/runtimes/settings.d.ts +15 -0
- package/lib/runtimes/settings.js +31 -0
- package/lib/runtimes/snapshots.d.ts +25 -0
- package/lib/runtimes/snapshots.js +150 -0
- package/lib/runtimes/utils.d.ts +7 -0
- package/lib/runtimes/utils.js +14 -0
- package/lib/services/DatalayerServiceManager.d.ts +23 -0
- package/lib/services/DatalayerServiceManager.js +90 -0
- package/lib/services/reconnectToRuntime.d.ts +32 -0
- package/lib/services/reconnectToRuntime.js +59 -0
- package/lib/services/sandboxServiceManagers.d.ts +31 -0
- package/lib/services/sandboxServiceManagers.js +57 -0
- package/lib/specs/agents/agents.d.ts +70 -26
- package/lib/specs/agents/agents.js +3994 -1639
- package/lib/specs/index.d.ts +1 -0
- package/lib/specs/index.js +1 -0
- package/lib/specs/loops.d.ts +34 -0
- package/lib/specs/loops.js +188 -0
- package/lib/specs/mcpServers.d.ts +1 -0
- package/lib/specs/mcpServers.js +17 -0
- package/lib/specs/models.d.ts +4 -0
- package/lib/specs/models.js +30 -0
- package/lib/specs/skills.d.ts +1 -0
- package/lib/specs/skills.js +18 -0
- package/lib/specs/tools.d.ts +15 -0
- package/lib/specs/tools.js +285 -0
- package/lib/state/index.d.ts +4 -0
- package/lib/state/index.js +10 -0
- package/lib/state/substates/CellState.d.ts +12 -0
- package/lib/state/substates/CellState.js +22 -0
- package/lib/state/substates/DocumentState.d.ts +10 -0
- package/lib/state/substates/DocumentState.js +14 -0
- package/lib/state/substates/GradeState.d.ts +10 -0
- package/lib/state/substates/GradeState.js +14 -0
- package/lib/state/substates/JupyterLabState.d.ts +16 -0
- package/lib/state/substates/JupyterLabState.js +17 -0
- package/lib/state/substates/NbformatState.d.ts +13 -0
- package/lib/state/substates/NbformatState.js +16 -0
- package/lib/state/substates/RuntimesState.d.ts +87 -0
- package/lib/state/substates/RuntimesState.js +192 -0
- package/lib/state/substates/SpaceState.d.ts +11 -0
- package/lib/state/substates/SpaceState.js +16 -0
- package/lib/state/substates/index.d.ts +8 -0
- package/lib/state/substates/index.js +14 -0
- package/lib/stores/agentRuntimeStore.d.ts +25 -2
- package/lib/stores/agentRuntimeStore.js +114 -19
- package/lib/stories/Button.stories.d.ts +1 -1
- package/lib/stories/Header.stories.d.ts +3 -3
- package/lib/test-setup.js +10 -0
- package/lib/types/agents-lifecycle.d.ts +5 -5
- package/lib/types/agents.d.ts +3 -3
- package/lib/types/agentspecs.d.ts +3 -1
- package/lib/types/chat.d.ts +135 -3
- package/lib/types/config.d.ts +19 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -0
- package/lib/types/loops.d.ts +64 -0
- package/lib/types/loops.js +5 -0
- package/lib/types/tools.d.ts +16 -0
- package/lib/utils/Cells.d.ts +2 -0
- package/lib/utils/Cells.js +28 -0
- package/package.json +24 -18
- package/scripts/codegen/__pycache__/versioning.cpython-313.pyc +0 -0
- package/scripts/codegen/generate_agents.py +21 -4
- package/scripts/codegen/generate_loops.py +443 -0
- package/lib/examples/A2UiComponentGalleryExample.d.ts +0 -3
- package/lib/examples/A2UiComponentGalleryExample.js +0 -361
- /package/lib/{agent-lexical-main.d.ts → agent-document-main.d.ts} +0 -0
|
@@ -30,15 +30,18 @@ import { GraphFlowChart } from '../context/GraphFlowChart';
|
|
|
30
30
|
import { TurnGraphChart } from '../context/TurnGraphChart';
|
|
31
31
|
import { useAIAgentsWebSocket } from '../hooks';
|
|
32
32
|
import { parseAgentStreamMessage } from '../types/stream';
|
|
33
|
-
import { useCoreStore } from '
|
|
33
|
+
import { useCoreStore } from '../state/substates';
|
|
34
|
+
import { useExampleAgentRuntimesUrl } from './utils/useExampleAgentRuntimesUrl';
|
|
34
35
|
const queryClient = new QueryClient();
|
|
35
36
|
import { useSimpleAuthStore } from '@datalayer/core/lib/views/otel';
|
|
36
37
|
import { Chat } from '../chat';
|
|
37
38
|
const AGENT_NAME = 'monitoring-example-agent';
|
|
38
39
|
const AGENTSPEC_ID = 'example-monitoring';
|
|
39
|
-
const DEFAULT_LOCAL_BASE_URL = import.meta.env.VITE_BASE_URL || 'http://localhost:8765';
|
|
40
40
|
const OTEL_BASE_URL_ENV = import.meta.env.VITE_OTEL_BASE_URL;
|
|
41
|
-
|
|
41
|
+
// Consume-side OTEL override (DATALAYER_OTEL_IN_URL). When set, telemetry is
|
|
42
|
+
// read from here instead of VITE_OTEL_BASE_URL (e.g. prod during local dev).
|
|
43
|
+
const OTEL_IN_BASE_URL_ENV = import.meta.env.VITE_OTEL_IN_BASE_URL;
|
|
44
|
+
const DATALAYER_URL_ENV = import.meta.env.VITE_DATALAYER_URL;
|
|
42
45
|
const AgentMonitoringInner = ({ onLogout, }) => {
|
|
43
46
|
const { token } = useSimpleAuthStore();
|
|
44
47
|
const agentName = useRef(uniqueAgentId(AGENT_NAME)).current;
|
|
@@ -55,11 +58,13 @@ const AgentMonitoringInner = ({ onLogout, }) => {
|
|
|
55
58
|
const [liveMcpStatus, setLiveMcpStatus] = useState(undefined);
|
|
56
59
|
const [monitorLastSnapshotAt, setMonitorLastSnapshotAt] = useState(null);
|
|
57
60
|
const [liveGraphTelemetry, setLiveGraphTelemetry] = useState(undefined);
|
|
58
|
-
const agentBaseUrl =
|
|
59
|
-
const otelBaseUrl = configuration?.
|
|
60
|
-
|
|
61
|
+
const agentBaseUrl = useExampleAgentRuntimesUrl();
|
|
62
|
+
const otelBaseUrl = configuration?.otelInUrl ||
|
|
63
|
+
OTEL_IN_BASE_URL_ENV ||
|
|
64
|
+
configuration?.otelUrl ||
|
|
65
|
+
configuration?.datalayerUrl ||
|
|
61
66
|
OTEL_BASE_URL_ENV ||
|
|
62
|
-
|
|
67
|
+
DATALAYER_URL_ENV ||
|
|
63
68
|
'https://prod1.datalayer.run';
|
|
64
69
|
const podName = agentId;
|
|
65
70
|
// The OTEL service_name resource attribute is 'agent-runtimes' (the
|
|
@@ -139,54 +144,119 @@ const AgentMonitoringInner = ({ onLogout, }) => {
|
|
|
139
144
|
return () => {
|
|
140
145
|
isCancelled = true;
|
|
141
146
|
};
|
|
142
|
-
}, [agentBaseUrl, authFetch]);
|
|
147
|
+
}, [agentBaseUrl, agentName, authFetch]);
|
|
143
148
|
const handleMonitoringStreamMessage = useCallback((message) => {
|
|
144
149
|
try {
|
|
145
150
|
const stream = parseAgentStreamMessage(message?.raw ?? message);
|
|
146
151
|
if (!stream || stream.type !== 'agent.snapshot') {
|
|
147
152
|
return;
|
|
148
153
|
}
|
|
154
|
+
// Snapshot payloads may arrive with camelCase (TS types) or snake_case
|
|
155
|
+
// (Python backend) keys. Read both for consistency with the UI.
|
|
156
|
+
const asRecord = (value) => value && typeof value === 'object'
|
|
157
|
+
? value
|
|
158
|
+
: {};
|
|
159
|
+
const pick = (source, keys) => {
|
|
160
|
+
for (const key of keys) {
|
|
161
|
+
const value = source[key];
|
|
162
|
+
if (value !== undefined && value !== null) {
|
|
163
|
+
return value;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return undefined;
|
|
167
|
+
};
|
|
168
|
+
const pickNumber = (source, keys, fallback = 0) => {
|
|
169
|
+
const value = pick(source, keys);
|
|
170
|
+
const parsed = Number(value);
|
|
171
|
+
return Number.isFinite(parsed) ? parsed : fallback;
|
|
172
|
+
};
|
|
173
|
+
const pickOptionalNumber = (source, keys) => {
|
|
174
|
+
const value = pick(source, keys);
|
|
175
|
+
if (value === undefined || value === null) {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
const parsed = Number(value);
|
|
179
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
180
|
+
};
|
|
181
|
+
const payloadRecord = asRecord(stream.payload);
|
|
149
182
|
const payload = stream.payload;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
183
|
+
const contextSnapshot = pick(payloadRecord, [
|
|
184
|
+
'contextSnapshot',
|
|
185
|
+
'context_snapshot',
|
|
186
|
+
]);
|
|
187
|
+
if (contextSnapshot) {
|
|
188
|
+
setLiveContext(contextSnapshot);
|
|
189
|
+
setLiveContextSnapshot(contextSnapshot);
|
|
153
190
|
setMonitorLastSnapshotAt(Date.now());
|
|
154
191
|
}
|
|
155
|
-
|
|
156
|
-
|
|
192
|
+
const mcpStatus = pick(payloadRecord, ['mcpStatus', 'mcp_status']);
|
|
193
|
+
if (mcpStatus !== undefined) {
|
|
194
|
+
setLiveMcpStatus(mcpStatus ?? undefined);
|
|
157
195
|
}
|
|
158
196
|
if (payload.graphTelemetry) {
|
|
159
197
|
setLiveGraphTelemetry(payload.graphTelemetry);
|
|
160
198
|
}
|
|
161
|
-
const snapshotCost =
|
|
162
|
-
|
|
199
|
+
const snapshotCost = asRecord(pick(asRecord(contextSnapshot), ['costUsage', 'cost_usage']) ??
|
|
200
|
+
pick(payloadRecord, ['costUsage', 'cost_usage']));
|
|
201
|
+
if (!snapshotCost || Object.keys(snapshotCost).length === 0) {
|
|
163
202
|
return;
|
|
164
203
|
}
|
|
204
|
+
const modelBreakdown = pick(snapshotCost, [
|
|
205
|
+
'modelBreakdown',
|
|
206
|
+
'model_breakdown',
|
|
207
|
+
]);
|
|
208
|
+
const runs = pick(snapshotCost, ['runs']);
|
|
165
209
|
setLiveCost({
|
|
166
210
|
agentId,
|
|
167
|
-
lastTurnCostUsd:
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
211
|
+
lastTurnCostUsd: pickNumber(snapshotCost, [
|
|
212
|
+
'lastTurnCostUsd',
|
|
213
|
+
'last_turn_cost_usd',
|
|
214
|
+
]),
|
|
215
|
+
cumulativeCostUsd: pickNumber(snapshotCost, [
|
|
216
|
+
'cumulativeCostUsd',
|
|
217
|
+
'cumulative_cost_usd',
|
|
218
|
+
]),
|
|
219
|
+
perRunBudgetUsd: pickOptionalNumber(snapshotCost, [
|
|
220
|
+
'perRunBudgetUsd',
|
|
221
|
+
'per_run_budget_usd',
|
|
222
|
+
]),
|
|
223
|
+
cumulativeBudgetUsd: pickOptionalNumber(snapshotCost, [
|
|
224
|
+
'cumulativeBudgetUsd',
|
|
225
|
+
'cumulative_budget_usd',
|
|
226
|
+
]),
|
|
227
|
+
requestCount: pickNumber(snapshotCost, [
|
|
228
|
+
'requestCount',
|
|
229
|
+
'request_count',
|
|
230
|
+
]),
|
|
231
|
+
totalTokensUsed: pickNumber(snapshotCost, [
|
|
232
|
+
'totalTokensUsed',
|
|
233
|
+
'total_tokens_used',
|
|
234
|
+
]),
|
|
235
|
+
modelBreakdown: Array.isArray(modelBreakdown)
|
|
236
|
+
? modelBreakdown.map(entry => {
|
|
237
|
+
const item = asRecord(entry);
|
|
238
|
+
return {
|
|
239
|
+
model: String(pick(item, ['model']) ?? 'unknown'),
|
|
240
|
+
inputTokens: pickNumber(item, [
|
|
241
|
+
'inputTokens',
|
|
242
|
+
'input_tokens',
|
|
243
|
+
]),
|
|
244
|
+
outputTokens: pickNumber(item, [
|
|
245
|
+
'outputTokens',
|
|
246
|
+
'output_tokens',
|
|
247
|
+
]),
|
|
248
|
+
costUsd: pickNumber(item, ['costUsd', 'cost_usd']),
|
|
249
|
+
requests: pickNumber(item, ['requests']),
|
|
250
|
+
};
|
|
251
|
+
})
|
|
185
252
|
: [],
|
|
186
|
-
runs: Array.isArray(
|
|
187
|
-
?
|
|
188
|
-
|
|
189
|
-
|
|
253
|
+
runs: Array.isArray(runs)
|
|
254
|
+
? runs.map(entry => {
|
|
255
|
+
const item = asRecord(entry);
|
|
256
|
+
return {
|
|
257
|
+
pricingResolved: Boolean(pick(item, ['pricingResolved', 'pricing_resolved'])),
|
|
258
|
+
};
|
|
259
|
+
})
|
|
190
260
|
: undefined,
|
|
191
261
|
});
|
|
192
262
|
}
|
|
@@ -213,7 +283,7 @@ const AgentMonitoringInner = ({ onLogout, }) => {
|
|
|
213
283
|
flexDirection: 'column',
|
|
214
284
|
alignItems: 'center',
|
|
215
285
|
justifyContent: 'center',
|
|
216
|
-
height: '
|
|
286
|
+
height: '100%',
|
|
217
287
|
gap: 3,
|
|
218
288
|
}, children: [_jsx(Spinner, { size: "large" }), _jsx(Text, { sx: { color: 'fg.muted' }, children: "Launching local monitoring example agent..." })] }));
|
|
219
289
|
}
|
|
@@ -221,7 +291,7 @@ const AgentMonitoringInner = ({ onLogout, }) => {
|
|
|
221
291
|
return _jsx(ErrorView, { error: hookError, onLogout: onLogout });
|
|
222
292
|
}
|
|
223
293
|
return (_jsxs(Box, { sx: {
|
|
224
|
-
height: '
|
|
294
|
+
height: '100%',
|
|
225
295
|
display: 'flex',
|
|
226
296
|
flexDirection: 'column',
|
|
227
297
|
}, children: [_jsxs(Box, { sx: {
|
|
@@ -254,11 +324,11 @@ const AgentMonitoringInner = ({ onLogout, }) => {
|
|
|
254
324
|
p: 3,
|
|
255
325
|
borderBottom: '1px solid',
|
|
256
326
|
borderColor: 'border.default',
|
|
257
|
-
}, children: [_jsx(Heading, { as: "h4", sx: { fontSize: 1, mb: 2 }, children: "Token Usage" }), _jsx(TokenUsageChart, { serviceName: otelServiceName, agentId: agentId, apiKey: token ?? undefined,
|
|
327
|
+
}, children: [_jsx(Heading, { as: "h4", sx: { fontSize: 1, mb: 2 }, children: "Token Usage" }), _jsx(TokenUsageChart, { serviceName: otelServiceName, agentId: agentId, apiKey: token ?? undefined, datalayerUrl: otelBaseUrl, liveSystemPromptTokens: liveContextSnapshot?.systemPromptTokens, liveUserMessageTokens: liveContextSnapshot?.userMessageTokens, liveAgentMessageTokens: liveContextSnapshot?.assistantMessageTokens, liveToolsUsageTokens: liveContextSnapshot?.toolTokens, liveTimestampMs: monitorLastSnapshotAt, height: 180 })] }), _jsxs(Box, { sx: {
|
|
258
328
|
p: 3,
|
|
259
329
|
borderBottom: '1px solid',
|
|
260
330
|
borderColor: 'border.default',
|
|
261
|
-
}, children: [_jsx(Heading, { as: "h4", sx: { fontSize: 1, mb: 2 }, children: "Cost" }), _jsx(CostUsageChart, { serviceName: otelServiceName, agentId: agentId, apiKey: token ?? undefined,
|
|
331
|
+
}, children: [_jsx(Heading, { as: "h4", sx: { fontSize: 1, mb: 2 }, children: "Cost" }), _jsx(CostUsageChart, { serviceName: otelServiceName, agentId: agentId, apiKey: token ?? undefined, datalayerUrl: otelBaseUrl, liveCumulativeUsd: liveCost?.cumulativeCostUsd, liveTimestampMs: monitorLastSnapshotAt, height: 180 })] }), _jsxs(Box, { sx: {
|
|
262
332
|
p: 3,
|
|
263
333
|
borderBottom: '1px solid',
|
|
264
334
|
borderColor: 'border.default',
|
|
@@ -335,10 +405,10 @@ const AgentMonitoringInner = ({ onLogout, }) => {
|
|
|
335
405
|
p: 3,
|
|
336
406
|
borderBottom: '1px solid',
|
|
337
407
|
borderColor: 'border.default',
|
|
338
|
-
}, children: [_jsx(Heading, { as: "h4", sx: { fontSize: 1, mb: 2 }, children: "Turn Execution Graph (OTEL traces)" }), _jsx(TurnGraphChart, { serviceName: otelServiceName, agentId: agentId,
|
|
408
|
+
}, children: [_jsx(Heading, { as: "h4", sx: { fontSize: 1, mb: 2 }, children: "Turn Execution Graph (OTEL traces)" }), _jsx(TurnGraphChart, { serviceName: otelServiceName, agentId: agentId, datalayerUrl: otelBaseUrl, apiKey: token ?? undefined, autoRefreshMs: 10_000, height: 280 })] })] })] })] }));
|
|
339
409
|
};
|
|
340
410
|
const syncTokenToIamStore = (token) => {
|
|
341
|
-
import('
|
|
411
|
+
import('../state/substates').then(({ iamStore }) => {
|
|
342
412
|
iamStore.setState({ token });
|
|
343
413
|
});
|
|
344
414
|
};
|
|
@@ -354,7 +424,7 @@ const AgentMonitoringExample = () => {
|
|
|
354
424
|
const handleLogout = useCallback(() => {
|
|
355
425
|
clearAuth();
|
|
356
426
|
hasSynced.current = false;
|
|
357
|
-
import('
|
|
427
|
+
import('../state/substates').then(({ iamStore }) => {
|
|
358
428
|
iamStore.setState({ token: undefined });
|
|
359
429
|
});
|
|
360
430
|
}, [clearAuth]);
|
|
@@ -213,7 +213,7 @@ const AgentNotificationsInner = ({ onLogout, }) => {
|
|
|
213
213
|
flexDirection: 'column',
|
|
214
214
|
alignItems: 'center',
|
|
215
215
|
justifyContent: 'center',
|
|
216
|
-
height: '
|
|
216
|
+
height: '100%',
|
|
217
217
|
gap: 3,
|
|
218
218
|
}, children: [_jsx(Spinner, { size: "large" }), _jsx(Text, { sx: { color: 'fg.muted' }, children: "Launching local notification agent\u2026" })] }));
|
|
219
219
|
}
|
|
@@ -238,7 +238,7 @@ const AgentNotificationsInner = ({ onLogout, }) => {
|
|
|
238
238
|
}
|
|
239
239
|
};
|
|
240
240
|
return (_jsxs(Box, { sx: {
|
|
241
|
-
height: '
|
|
241
|
+
height: '100%',
|
|
242
242
|
display: 'flex',
|
|
243
243
|
flexDirection: 'column',
|
|
244
244
|
}, children: [_jsxs(Box, { sx: {
|
|
@@ -319,7 +319,7 @@ const AgentNotificationsInner = ({ onLogout, }) => {
|
|
|
319
319
|
};
|
|
320
320
|
// ─── Sync token to core IAM store ──────────────────────────────────────────
|
|
321
321
|
const syncTokenToIamStore = (token) => {
|
|
322
|
-
import('
|
|
322
|
+
import('../state/substates').then(({ iamStore }) => {
|
|
323
323
|
iamStore.setState({ token });
|
|
324
324
|
});
|
|
325
325
|
};
|
|
@@ -336,7 +336,7 @@ const AgentNotificationsExample = () => {
|
|
|
336
336
|
const handleLogout = useCallback(() => {
|
|
337
337
|
clearAuth();
|
|
338
338
|
hasSynced.current = false;
|
|
339
|
-
import('
|
|
339
|
+
import('../state/substates').then(({ iamStore }) => {
|
|
340
340
|
iamStore.setState({ token: undefined });
|
|
341
341
|
});
|
|
342
342
|
}, [clearAuth]);
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
* is a ChatSidebar whose agent is selected from the agent-runtimes library spec
|
|
8
8
|
* list and launched on demand.
|
|
9
9
|
*
|
|
10
|
-
* The OTEL backend is configured via `configuration.
|
|
11
|
-
* (falling back to `configuration.
|
|
12
|
-
* `
|
|
10
|
+
* The OTEL backend is configured via `configuration.otelUrl` when available
|
|
11
|
+
* (falling back to `configuration.datalayerUrl`, then `VITE_OTEL_BASE_URL`, then
|
|
12
|
+
* `VITE_DATALAYER_URL`, then https://prod1.datalayer.run).
|
|
13
13
|
* Agent routes use `VITE_BASE_URL` when provided, otherwise the same resolved
|
|
14
14
|
* direct run URL to avoid proxy-relative calls.
|
|
15
15
|
*
|
|
@@ -12,9 +12,9 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
12
12
|
* is a ChatSidebar whose agent is selected from the agent-runtimes library spec
|
|
13
13
|
* list and launched on demand.
|
|
14
14
|
*
|
|
15
|
-
* The OTEL backend is configured via `configuration.
|
|
16
|
-
* (falling back to `configuration.
|
|
17
|
-
* `
|
|
15
|
+
* The OTEL backend is configured via `configuration.otelUrl` when available
|
|
16
|
+
* (falling back to `configuration.datalayerUrl`, then `VITE_OTEL_BASE_URL`, then
|
|
17
|
+
* `VITE_DATALAYER_URL`, then https://prod1.datalayer.run).
|
|
18
18
|
* Agent routes use `VITE_BASE_URL` when provided, otherwise the same resolved
|
|
19
19
|
* direct run URL to avoid proxy-relative calls.
|
|
20
20
|
*
|
|
@@ -34,7 +34,10 @@ import { AuthRequiredView } from './components';
|
|
|
34
34
|
import { ChatSidebar } from '../chat';
|
|
35
35
|
// ─── Environment / defaults ────────────────────────────────────────────────
|
|
36
36
|
const OTEL_BASE_URL_ENV = import.meta.env.VITE_OTEL_BASE_URL ?? '';
|
|
37
|
-
|
|
37
|
+
// Consume-side OTEL override (DATALAYER_OTEL_IN_URL). When set, telemetry is
|
|
38
|
+
// read from here instead of VITE_OTEL_BASE_URL (e.g. prod during local dev).
|
|
39
|
+
const OTEL_IN_BASE_URL_ENV = import.meta.env.VITE_OTEL_IN_BASE_URL ?? '';
|
|
40
|
+
const DATALAYER_URL_ENV = import.meta.env.VITE_DATALAYER_URL ?? '';
|
|
38
41
|
/**
|
|
39
42
|
* Base URL of the agent-runtimes server.
|
|
40
43
|
* Defaults to proxy-relative calls when VITE_BASE_URL is unset.
|
|
@@ -136,12 +139,14 @@ const TAB_SX = (active) => ({
|
|
|
136
139
|
});
|
|
137
140
|
const AgentOtelExampleInner = ({ token }) => {
|
|
138
141
|
const { configuration } = useCoreStore();
|
|
139
|
-
const
|
|
140
|
-
|
|
142
|
+
const resolvedUrl = configuration?.otelInUrl ||
|
|
143
|
+
OTEL_IN_BASE_URL_ENV ||
|
|
144
|
+
configuration?.otelUrl ||
|
|
145
|
+
configuration?.datalayerUrl ||
|
|
141
146
|
OTEL_BASE_URL_ENV ||
|
|
142
|
-
|
|
147
|
+
DATALAYER_URL_ENV ||
|
|
143
148
|
'https://prod1.datalayer.run';
|
|
144
|
-
const otelBaseUrl =
|
|
149
|
+
const otelBaseUrl = resolvedUrl;
|
|
145
150
|
const agentBaseUrl = AGENT_BASE_URL_ENV;
|
|
146
151
|
// ── OTEL view state ─────────────────────────────────────────────
|
|
147
152
|
const [view, setView] = useState('dashboard');
|
|
@@ -180,7 +185,7 @@ const AgentOtelExampleInner = ({ token }) => {
|
|
|
180
185
|
if (connectedAgentTransport === 'ag-ui') {
|
|
181
186
|
return {
|
|
182
187
|
type: 'ag-ui',
|
|
183
|
-
endpoint: `${agentBaseUrl}/api/v1/
|
|
188
|
+
endpoint: `${agentBaseUrl}/api/v1/ag-ui/${connectedAgentId}/`,
|
|
184
189
|
agentId: connectedAgentId,
|
|
185
190
|
};
|
|
186
191
|
}
|
|
@@ -208,7 +213,7 @@ const AgentOtelExampleInner = ({ token }) => {
|
|
|
208
213
|
return (_jsxs(Box, { sx: {
|
|
209
214
|
display: 'flex',
|
|
210
215
|
flexDirection: 'column',
|
|
211
|
-
height: '
|
|
216
|
+
height: '100%',
|
|
212
217
|
overflow: 'hidden',
|
|
213
218
|
bg: 'canvas.default',
|
|
214
219
|
color: 'fg.default',
|
|
@@ -31,11 +31,11 @@ import { ThemedProvider } from './utils/themedProvider';
|
|
|
31
31
|
import { uniqueAgentId } from './utils/agentId';
|
|
32
32
|
import { Chat } from '../chat';
|
|
33
33
|
import { useChatStore } from '../stores/chatStore';
|
|
34
|
+
import { useExampleAgentRuntimesUrl } from './utils/useExampleAgentRuntimesUrl';
|
|
34
35
|
const queryClient = new QueryClient();
|
|
35
36
|
// ─── Constants ─────────────────────────────────────────────────────────────
|
|
36
37
|
const AGENT_NAME = 'outputs-example-agent';
|
|
37
38
|
const AGENTSPEC_ID = 'demo-outputs';
|
|
38
|
-
const DEFAULT_LOCAL_BASE_URL = import.meta.env.VITE_BASE_URL || 'http://localhost:8765';
|
|
39
39
|
// ─── Output detection ──────────────────────────────────────────────────────
|
|
40
40
|
const FENCE_RE = /```([a-zA-Z0-9_+-]*)\n([\s\S]*?)```/g;
|
|
41
41
|
const MD_TABLE_RE = /(^|\n)\s*\|[^\n]+\|\s*\n\s*\|[\s:|-]+\|\s*\n(\s*\|[^\n]+\|\s*\n?)+/;
|
|
@@ -281,7 +281,7 @@ const AgentOutputsInner = ({ onLogout, }) => {
|
|
|
281
281
|
const [hookError, setHookError] = useState(null);
|
|
282
282
|
const [agentId, setAgentId] = useState(agentName);
|
|
283
283
|
const [isReconnectedAgent, setIsReconnectedAgent] = useState(false);
|
|
284
|
-
const agentBaseUrl =
|
|
284
|
+
const agentBaseUrl = useExampleAgentRuntimesUrl();
|
|
285
285
|
const chatAuthToken = token === null ? undefined : token;
|
|
286
286
|
const authFetch = useCallback((url, opts = {}) => fetch(url, {
|
|
287
287
|
...opts,
|
|
@@ -399,7 +399,7 @@ const AgentOutputsInner = ({ onLogout, }) => {
|
|
|
399
399
|
flexDirection: 'column',
|
|
400
400
|
alignItems: 'center',
|
|
401
401
|
justifyContent: 'center',
|
|
402
|
-
height: '
|
|
402
|
+
height: '100%',
|
|
403
403
|
gap: 3,
|
|
404
404
|
}, children: [_jsx(Spinner, { size: "large" }), _jsx(Text, { sx: { color: 'fg.muted' }, children: runtimeStatus === 'launching'
|
|
405
405
|
? 'Launching outputs example agent...'
|
|
@@ -422,7 +422,7 @@ const AgentOutputsInner = ({ onLogout, }) => {
|
|
|
422
422
|
URL.revokeObjectURL(url);
|
|
423
423
|
};
|
|
424
424
|
return (_jsxs(Box, { sx: {
|
|
425
|
-
height: '
|
|
425
|
+
height: '100%',
|
|
426
426
|
display: 'flex',
|
|
427
427
|
flexDirection: 'column',
|
|
428
428
|
}, children: [isReconnectedAgent && (_jsx(Box, { sx: {
|
|
@@ -528,7 +528,7 @@ const AgentOutputsInner = ({ onLogout, }) => {
|
|
|
528
528
|
};
|
|
529
529
|
// ─── Sync token to core IAM store ──────────────────────────────────────────
|
|
530
530
|
const syncTokenToIamStore = (token) => {
|
|
531
|
-
import('
|
|
531
|
+
import('../state/substates').then(({ iamStore }) => {
|
|
532
532
|
iamStore.setState({ token });
|
|
533
533
|
});
|
|
534
534
|
};
|
|
@@ -545,7 +545,7 @@ const AgentOutputsExample = () => {
|
|
|
545
545
|
const handleLogout = useCallback(() => {
|
|
546
546
|
clearAuth();
|
|
547
547
|
hasSynced.current = false;
|
|
548
|
-
import('
|
|
548
|
+
import('../state/substates').then(({ iamStore }) => {
|
|
549
549
|
iamStore.setState({ token: undefined });
|
|
550
550
|
});
|
|
551
551
|
}, [clearAuth]);
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { useMemo, useState } from 'react';
|
|
7
7
|
import { Box, setupPrimerPortals } from '@datalayer/primer-addons';
|
|
8
8
|
import { Button, Heading, Label, Spinner, Text } from '@primer/react';
|
|
9
9
|
import { FileIcon } from '@primer/octicons-react';
|
|
@@ -12,6 +12,7 @@ import { Form, yamlSchemaToJsonSchema } from '@datalayer/primer-rjsf';
|
|
|
12
12
|
import { ThemedProvider } from './utils/themedProvider';
|
|
13
13
|
import { uniqueAgentId } from './utils/agentId';
|
|
14
14
|
import { useExampleAgentRuntimesUrl } from './utils/useExampleAgentRuntimesUrl';
|
|
15
|
+
import { useExampleAgentRuntime } from './hooks/useExampleAgentRuntime';
|
|
15
16
|
import { ErrorView } from './components';
|
|
16
17
|
import { Chat } from '../chat';
|
|
17
18
|
setupPrimerPortals();
|
|
@@ -103,14 +104,24 @@ function hasRequiredValues(schema, formData) {
|
|
|
103
104
|
}
|
|
104
105
|
const AgentParametersExample = () => {
|
|
105
106
|
const baseUrl = useExampleAgentRuntimesUrl();
|
|
107
|
+
const [agentName] = useState(() => uniqueAgentId(AGENT_NAME));
|
|
106
108
|
const [showSchemaForm, setShowSchemaForm] = useState(false);
|
|
107
109
|
const [isSchemaLoading, setIsSchemaLoading] = useState(false);
|
|
108
110
|
const [schema, setSchema] = useState(null);
|
|
109
111
|
const [formData, setFormData] = useState({});
|
|
110
|
-
const [agentId, setAgentId] = useState(null);
|
|
111
112
|
const [isCreating, setIsCreating] = useState(false);
|
|
112
113
|
const [error, setError] = useState(null);
|
|
113
114
|
const [formTouched, setFormTouched] = useState(false);
|
|
115
|
+
const { agentId, error: runtimeError, createAgent, } = useExampleAgentRuntime({
|
|
116
|
+
exampleId: 'AgentParametersExample',
|
|
117
|
+
agentName,
|
|
118
|
+
specId: AGENTSPEC_ID,
|
|
119
|
+
autoCreateAgent: false,
|
|
120
|
+
agentConfig: {
|
|
121
|
+
protocol: 'vercel-ai',
|
|
122
|
+
agentSpecId: AGENTSPEC_ID,
|
|
123
|
+
},
|
|
124
|
+
});
|
|
114
125
|
const hasRequired = useMemo(() => hasRequiredValues(schema, formData), [schema, formData]);
|
|
115
126
|
const canLaunch = useMemo(() => {
|
|
116
127
|
return showSchemaForm && schema !== null && !isSchemaLoading && hasRequired;
|
|
@@ -148,25 +159,14 @@ const AgentParametersExample = () => {
|
|
|
148
159
|
setIsCreating(true);
|
|
149
160
|
setError(null);
|
|
150
161
|
try {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
name,
|
|
157
|
-
agent_spec_id: AGENTSPEC_ID,
|
|
158
|
-
transport: 'vercel-ai',
|
|
162
|
+
await createAgent({
|
|
163
|
+
name: agentName,
|
|
164
|
+
protocol: 'vercel-ai',
|
|
165
|
+
agentSpecId: AGENTSPEC_ID,
|
|
166
|
+
createPayload: {
|
|
159
167
|
agent_parameters: formData,
|
|
160
|
-
}
|
|
168
|
+
},
|
|
161
169
|
});
|
|
162
|
-
if (!response.ok) {
|
|
163
|
-
const data = await response
|
|
164
|
-
.json()
|
|
165
|
-
.catch(() => ({ detail: 'Unknown error' }));
|
|
166
|
-
throw new Error(data.detail || `Failed to create agent: ${response.status}`);
|
|
167
|
-
}
|
|
168
|
-
const data = await response.json();
|
|
169
|
-
setAgentId(data.id);
|
|
170
170
|
}
|
|
171
171
|
catch (err) {
|
|
172
172
|
setError(err instanceof Error ? err.message : 'Failed to launch agent');
|
|
@@ -175,18 +175,7 @@ const AgentParametersExample = () => {
|
|
|
175
175
|
setIsCreating(false);
|
|
176
176
|
}
|
|
177
177
|
};
|
|
178
|
-
|
|
179
|
-
return () => {
|
|
180
|
-
if (!agentId) {
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
void fetch(`${baseUrl}/api/v1/agents/${encodeURIComponent(agentId)}`, {
|
|
184
|
-
method: 'DELETE',
|
|
185
|
-
}).catch(() => {
|
|
186
|
-
// Ignore teardown failures in example mode.
|
|
187
|
-
});
|
|
188
|
-
};
|
|
189
|
-
}, [agentId, baseUrl]);
|
|
178
|
+
const effectiveError = error || runtimeError;
|
|
190
179
|
if (!agentId) {
|
|
191
180
|
return (_jsx(ThemedProvider, { children: _jsxs(Box, { sx: {
|
|
192
181
|
maxWidth: 760,
|
|
@@ -231,8 +220,7 @@ const AgentParametersExample = () => {
|
|
|
231
220
|
}, onSubmit: (_, event) => {
|
|
232
221
|
event?.preventDefault();
|
|
233
222
|
event?.stopPropagation();
|
|
234
|
-
|
|
235
|
-
}, noHtml5Validate: true }) })), _jsx(Button, { variant: "primary", size: "small", type: "button", onClick: launchAgent, disabled: !canLaunch || isCreating, sx: { width: '100%' }, children: isCreating ? (_jsxs(_Fragment, { children: [_jsx(Spinner, { size: "small" }), " Launching..."] })) : ('Launch Agent') }), schema && formTouched && (_jsx(Text, { sx: { color: 'fg.muted', fontSize: 1 }, children: "Parameters are sent as agent_parameters in the create-agent request." })), error && _jsx(ErrorView, { error: "Launch failed", detail: error })] }) }));
|
|
223
|
+
}, noHtml5Validate: true }) })), _jsx(Button, { variant: "primary", size: "small", type: "button", onClick: launchAgent, disabled: !canLaunch || isCreating, sx: { width: '100%' }, children: isCreating ? (_jsxs(_Fragment, { children: [_jsx(Spinner, { size: "small" }), " Launching..."] })) : ('Launch Agent') }), schema && formTouched && (_jsx(Text, { sx: { color: 'fg.muted', fontSize: 1 }, children: "Parameters are sent as agent_parameters in the create-agent request." })), effectiveError && (_jsx(ErrorView, { error: "Launch failed", detail: effectiveError }))] }) }));
|
|
236
224
|
}
|
|
237
225
|
return (_jsx(Chat, { protocol: "vercel-ai", baseUrl: baseUrl, agentId: agentId, title: `Parameterized Agent: ${String(formData.project ?? 'Project')}`, brandIcon: _jsx(FileIcon, { size: 16 }), placeholder: "Ask something about your configured project...", description: `Role: ${String(formData.role ?? 'n/a')} · Tone: ${String(formData.tone ?? 'n/a')}`, showHeader: true, showModelSelector: true, showToolsMenu: true, showSkillsMenu: true, showTokenUsage: true, showInformation: true, autoFocus: true, height: "100vh", runtimeId: agentId, historyEndpoint: `${baseUrl}/api/v1/history`, suggestions: [
|
|
238
226
|
{
|
|
@@ -27,13 +27,13 @@ import { CodeIcon, StopIcon, TerminalIcon } from '@primer/octicons-react';
|
|
|
27
27
|
import { useSimpleAuthStore } from '@datalayer/core/lib/views/otel';
|
|
28
28
|
import { ThemedProvider } from './utils/themedProvider';
|
|
29
29
|
import { uniqueAgentId } from './utils/agentId';
|
|
30
|
+
import { useExampleAgentRuntimesUrl } from './utils/useExampleAgentRuntimesUrl';
|
|
30
31
|
import { Chat } from '../chat';
|
|
31
32
|
import { SANDBOX_STATUS_COLORS, SANDBOX_STATUS_LABELS } from '../types/sandbox';
|
|
32
33
|
// ─── Constants ─────────────────────────────────────────────────────────────
|
|
33
34
|
const queryClient = new QueryClient();
|
|
34
35
|
const AGENT_NAME = 'sandbox-example-agent';
|
|
35
36
|
const AGENTSPEC_ID = 'example-full';
|
|
36
|
-
const DEFAULT_LOCAL_BASE_URL = import.meta.env.VITE_BASE_URL || 'http://localhost:8765';
|
|
37
37
|
let _logId = 0;
|
|
38
38
|
function tsNow() {
|
|
39
39
|
return new Date().toISOString().slice(11, 23); // HH:MM:SS.mmm
|
|
@@ -63,7 +63,7 @@ const AgentSandboxInner = ({ onLogout, }) => {
|
|
|
63
63
|
const { token } = useSimpleAuthStore();
|
|
64
64
|
const agentName = useRef(uniqueAgentId(AGENT_NAME)).current;
|
|
65
65
|
const chatAuthToken = token === null ? undefined : token;
|
|
66
|
-
const agentBaseUrl =
|
|
66
|
+
const agentBaseUrl = useExampleAgentRuntimesUrl();
|
|
67
67
|
// ── Agent lifecycle ──
|
|
68
68
|
const [runtimeStatus, setRuntimeStatus] = useState('launching');
|
|
69
69
|
const [isReady, setIsReady] = useState(false);
|
|
@@ -463,7 +463,7 @@ const AgentSandboxInner = ({ onLogout, }) => {
|
|
|
463
463
|
py: 1,
|
|
464
464
|
borderBottom: '1px solid',
|
|
465
465
|
borderColor: 'border.default',
|
|
466
|
-
}, children: _jsx(Text, { sx: { color: 'fg.muted', fontSize: 0 }, children: "Agent already running \u2014 reconnected." }) })), _jsxs(Box, { sx: { flex: 1, minHeight: 0, display: 'flex' }, children: [_jsx(Box, { sx: { flex: 1, minWidth: 0 }, children: _jsxs(Box, { sx: { position: 'relative', height: '100%' }, children: [_jsx(Chat, { protocol: "vercel-ai", baseUrl: agentBaseUrl, agentId: agentId, authToken: chatAuthToken, title: "Sandbox Agent", brandIcon: _jsx(TerminalIcon, { size: 16 }), placeholder: "Ask the agent to write and run code\u2026", showHeader: true, showNewChatButton: true, showClearButton:
|
|
466
|
+
}, children: _jsx(Text, { sx: { color: 'fg.muted', fontSize: 0 }, children: "Agent already running \u2014 reconnected." }) })), _jsxs(Box, { sx: { flex: 1, minHeight: 0, display: 'flex' }, children: [_jsx(Box, { sx: { flex: 1, minWidth: 0 }, children: _jsxs(Box, { sx: { position: 'relative', height: '100%' }, children: [_jsx(Chat, { protocol: "vercel-ai", baseUrl: agentBaseUrl, agentId: agentId, authToken: chatAuthToken, title: "Sandbox Agent", brandIcon: _jsx(TerminalIcon, { size: 16 }), placeholder: "Ask the agent to write and run code\u2026", showHeader: true, showNewChatButton: true, showClearButton: true, showTokenUsage: true, autoFocus: true, height: "100%", runtimeId: agentId, historyEndpoint: `${agentBaseUrl}/api/v1/history`, headerActions: _jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsxs(SegmentedControl, { "aria-label": "Sandbox variant", size: "small", onChange: index => {
|
|
467
467
|
if (isTransitionLocked)
|
|
468
468
|
return;
|
|
469
469
|
void switchVariant(index === 0 ? 'eval' : 'jupyter');
|
|
@@ -491,7 +491,7 @@ const AgentSandboxInner = ({ onLogout, }) => {
|
|
|
491
491
|
};
|
|
492
492
|
// ─── Auth wrapper ──────────────────────────────────────────────────────────
|
|
493
493
|
const syncTokenToIamStore = (newToken) => {
|
|
494
|
-
import('
|
|
494
|
+
import('../state/substates').then(({ iamStore }) => {
|
|
495
495
|
iamStore.setState({ token: newToken });
|
|
496
496
|
});
|
|
497
497
|
};
|
|
@@ -507,7 +507,7 @@ const AgentSandboxExample = () => {
|
|
|
507
507
|
const handleLogout = useCallback(() => {
|
|
508
508
|
clearAuth();
|
|
509
509
|
hasSynced.current = false;
|
|
510
|
-
import('
|
|
510
|
+
import('../state/substates').then(({ iamStore }) => {
|
|
511
511
|
iamStore.setState({ token: undefined });
|
|
512
512
|
});
|
|
513
513
|
}, [clearAuth]);
|