@datalayer/agent-runtimes 1.0.9 → 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 +468 -40
- 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.d.ts +4 -4
- package/lib/client/AgentsMixin.js +35 -35
- 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/ToolApprovalCard.js +13 -3
- 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/config/AgentConfiguration.d.ts +2 -2
- package/lib/config/index.d.ts +1 -1
- 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 +21 -22
- package/lib/examples/AgentCodemodeExample.js +3 -3
- package/lib/examples/AgentEvalsExample.js +8 -8
- package/lib/examples/AgentGuardrailsExample.js +22 -17
- package/lib/examples/AgentHooksExample.js +16 -57
- package/lib/examples/AgentInferenceProviderExample.js +8 -8
- package/lib/examples/AgentLoopExample.d.ts +10 -0
- package/lib/examples/AgentLoopExample.js +304 -0
- package/lib/examples/AgentMCPExample.js +9 -9
- package/lib/examples/AgentMemoryExample.js +6 -6
- package/lib/examples/AgentMonitoringExample.js +116 -46
- package/lib/examples/AgentNotificationsExample.js +6 -6
- package/lib/examples/AgentOtelExample.d.ts +3 -3
- package/lib/examples/AgentOtelExample.js +20 -15
- package/lib/examples/AgentOutputsExample.js +8 -8
- package/lib/examples/AgentParametersExample.js +24 -36
- package/lib/examples/AgentSandboxExample.js +7 -7
- package/lib/examples/AgentSkillsExample.js +9 -9
- package/lib/examples/AgentSubagentsExample.js +6 -6
- package/lib/examples/AgentToolApprovalsExample.js +37 -11
- package/lib/examples/AgentTriggersExample.js +12 -12
- package/lib/examples/AgentspecsExample.js +63 -41
- package/lib/examples/ChatCustomExample.js +23 -77
- package/lib/examples/ChatExample.js +15 -46
- 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 +188 -29
- package/lib/hooks/useAgentsCatalog.d.ts +3 -3
- package/lib/hooks/useAgentsCatalog.js +4 -4
- 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 +38 -28
- 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 +14 -6
- package/lib/hooks/useToolApprovals.js +20 -1
- package/lib/index.d.ts +2 -1
- 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 +95 -50
- package/lib/specs/agents/agents.js +4037 -1669
- package/lib/specs/agents/index.d.ts +5 -5
- package/lib/specs/agents/index.js +9 -9
- 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 +6 -6
- package/lib/types/agentspecs.d.ts +8 -4
- 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/teams.d.ts +2 -2
- 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/generate_agents.py +96 -61
- package/scripts/codegen/generate_loops.py +443 -0
- package/scripts/codegen/generate_teams.py +4 -4
- package/lib/examples/A2UiComponentGalleryExample.d.ts +0 -3
- package/lib/examples/A2UiComponentGalleryExample.js +0 -361
- package/scripts/codegen/__pycache__/generate_agents.cpython-313.pyc +0 -0
- package/scripts/codegen/__pycache__/generate_benchmarks.cpython-313.pyc +0 -0
- package/scripts/codegen/__pycache__/generate_evals.cpython-313.pyc +0 -0
- package/scripts/codegen/__pycache__/generate_events.cpython-313.pyc +0 -0
- /package/lib/{agent-lexical-main.d.ts → agent-document-main.d.ts} +0 -0
|
@@ -15,14 +15,14 @@ import { ThemedProvider } from './utils/themedProvider';
|
|
|
15
15
|
import { uniqueAgentId } from './utils/agentId';
|
|
16
16
|
import { Chat } from '../chat';
|
|
17
17
|
import { useAIAgentsWebSocket } from '../hooks';
|
|
18
|
+
import { useExampleAgentRuntimesUrl } from './utils/useExampleAgentRuntimesUrl';
|
|
18
19
|
import { parseAgentStreamMessage } from '../types/stream';
|
|
19
20
|
import { MCP_STATUS_COLORS, MCP_STATUS_LABELS } from '../types/mcp';
|
|
20
21
|
import { MCP_SERVER_LIBRARY } from '../specs/mcpServers';
|
|
21
22
|
const queryClient = new QueryClient();
|
|
22
23
|
const AGENT_NAME = 'mcp-example-agent';
|
|
23
24
|
// Must match agentspecs/agentspecs/agents/example-mcp.yaml `id`.
|
|
24
|
-
const
|
|
25
|
-
const DEFAULT_LOCAL_BASE_URL = import.meta.env.VITE_BASE_URL || 'http://localhost:8765';
|
|
25
|
+
const AGENTSPEC_ID = 'example-mcp';
|
|
26
26
|
/* ── Aggregate MCP status helpers ─────────────────────── */
|
|
27
27
|
function deriveAggregate(servers) {
|
|
28
28
|
if (!servers || servers.length === 0)
|
|
@@ -127,7 +127,7 @@ const AgentMCPInner = ({ onLogout }) => {
|
|
|
127
127
|
const [liveMcpStatus, setLiveMcpStatus] = useState(undefined);
|
|
128
128
|
// Pending approvals are now managed internally by ChatBase via the Zustand
|
|
129
129
|
// agent-runtime store — no local state needed.
|
|
130
|
-
const agentBaseUrl =
|
|
130
|
+
const agentBaseUrl = useExampleAgentRuntimesUrl();
|
|
131
131
|
const chatAuthToken = token === null ? undefined : token;
|
|
132
132
|
const authFetch = useCallback((url, opts = {}) => fetch(url, {
|
|
133
133
|
...opts,
|
|
@@ -153,7 +153,7 @@ const AgentMCPInner = ({ onLogout }) => {
|
|
|
153
153
|
description: 'MCP example agent – web crawling and research via Tavily',
|
|
154
154
|
agent_library: 'pydantic-ai',
|
|
155
155
|
transport: 'vercel-ai',
|
|
156
|
-
agent_spec_id:
|
|
156
|
+
agent_spec_id: AGENTSPEC_ID,
|
|
157
157
|
enable_codemode: false,
|
|
158
158
|
enable_skills: true,
|
|
159
159
|
tools: [],
|
|
@@ -371,7 +371,7 @@ const AgentMCPInner = ({ onLogout }) => {
|
|
|
371
371
|
flexDirection: 'column',
|
|
372
372
|
alignItems: 'center',
|
|
373
373
|
justifyContent: 'center',
|
|
374
|
-
height: '
|
|
374
|
+
height: '100%',
|
|
375
375
|
gap: 3,
|
|
376
376
|
}, children: [_jsx(Spinner, { size: "large" }), _jsx(Text, { sx: { color: 'fg.muted' }, children: "Launching MCP example agent..." })] }));
|
|
377
377
|
}
|
|
@@ -379,7 +379,7 @@ const AgentMCPInner = ({ onLogout }) => {
|
|
|
379
379
|
return _jsx(ErrorView, { error: hookError, onLogout: onLogout });
|
|
380
380
|
}
|
|
381
381
|
return (_jsxs(Box, { sx: {
|
|
382
|
-
height: '
|
|
382
|
+
height: '100%',
|
|
383
383
|
display: 'flex',
|
|
384
384
|
flexDirection: 'column',
|
|
385
385
|
}, children: [isReconnectedAgent && (_jsx(Box, { sx: {
|
|
@@ -387,7 +387,7 @@ const AgentMCPInner = ({ onLogout }) => {
|
|
|
387
387
|
py: 1,
|
|
388
388
|
borderBottom: '1px solid',
|
|
389
389
|
borderColor: 'border.default',
|
|
390
|
-
}, children: _jsx(Text, { sx: { color: 'fg.muted', fontSize: 0 }, children: "Agent already running - reconnected." }) })), _jsxs(Box, { sx: { flex: 1, minHeight: 0, display: 'flex' }, children: [_jsx(Box, { sx: { flex: 1, minWidth: 0 }, children: _jsx(Chat, { protocol: "vercel-ai", baseUrl: agentBaseUrl, agentId: agentId, authToken: chatAuthToken, title: "MCP Demo Agent", brandIcon: _jsx(GlobeIcon, { size: 16 }), placeholder: "Ask the agent to search the web or explore GitHub...", showHeader: true, showNewChatButton: true, showClearButton:
|
|
390
|
+
}, children: _jsx(Text, { sx: { color: 'fg.muted', fontSize: 0 }, children: "Agent already running - reconnected." }) })), _jsxs(Box, { sx: { flex: 1, minHeight: 0, display: 'flex' }, children: [_jsx(Box, { sx: { flex: 1, minWidth: 0 }, children: _jsx(Chat, { protocol: "vercel-ai", baseUrl: agentBaseUrl, agentId: agentId, authToken: chatAuthToken, title: "MCP Demo Agent", brandIcon: _jsx(GlobeIcon, { size: 16 }), placeholder: "Ask the agent to search the web or explore GitHub...", showHeader: true, showNewChatButton: true, showClearButton: true, showToolsMenu: true, showSkillsMenu: true, showTokenUsage: true, autoFocus: true, height: "100%", runtimeId: agentId, historyEndpoint: `${agentBaseUrl}/api/v1/history`, mcpStatusData: mcpStatusData, showToolApprovalBanner: true, headerActions: _jsx(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: _jsxs(Text, { sx: { color: 'fg.muted', fontSize: 1 }, children: ["MCP Tools: ", totalTools] }) }), suggestions: [
|
|
391
391
|
{
|
|
392
392
|
title: '🔍 Search the web',
|
|
393
393
|
message: 'Search the web for recent news about AI agents.',
|
|
@@ -453,7 +453,7 @@ const AgentMCPInner = ({ onLogout }) => {
|
|
|
453
453
|
}, children: [_jsx(ToolsIcon, { size: 12 }), _jsxs(Text, { children: [_jsx("strong", { children: "Tools:" }), " Individual capabilities exposed by each server (search, fetch, etc.)"] })] })] })] })] }))] })] })] })] }));
|
|
454
454
|
};
|
|
455
455
|
const syncTokenToIamStore = (token) => {
|
|
456
|
-
import('
|
|
456
|
+
import('../state/substates').then(({ iamStore }) => {
|
|
457
457
|
iamStore.setState({ token });
|
|
458
458
|
});
|
|
459
459
|
};
|
|
@@ -469,7 +469,7 @@ const AgentMCPExample = () => {
|
|
|
469
469
|
const handleLogout = useCallback(() => {
|
|
470
470
|
clearAuth();
|
|
471
471
|
hasSynced.current = false;
|
|
472
|
-
import('
|
|
472
|
+
import('../state/substates').then(({ iamStore }) => {
|
|
473
473
|
iamStore.setState({ token: undefined });
|
|
474
474
|
});
|
|
475
475
|
}, [clearAuth]);
|
|
@@ -28,7 +28,7 @@ import { Chat } from '../chat';
|
|
|
28
28
|
import { useExampleAgentRuntimesUrl } from './utils/useExampleAgentRuntimesUrl';
|
|
29
29
|
// ─── Constants ─────────────────────────────────────────────────────────────
|
|
30
30
|
const AGENT_NAME = 'memory-example-agent';
|
|
31
|
-
const
|
|
31
|
+
const AGENTSPEC_ID = 'example-memory';
|
|
32
32
|
// ─── Inner component (rendered after auth) ─────────────────────────────────
|
|
33
33
|
const AgentMemoryInner = ({ onLogout }) => {
|
|
34
34
|
const { token } = useSimpleAuthStore();
|
|
@@ -66,7 +66,7 @@ const AgentMemoryInner = ({ onLogout }) => {
|
|
|
66
66
|
description: 'Agent with Mem0 persistent memory',
|
|
67
67
|
agent_library: 'pydantic-ai',
|
|
68
68
|
transport: 'vercel-ai',
|
|
69
|
-
agent_spec_id:
|
|
69
|
+
agent_spec_id: AGENTSPEC_ID,
|
|
70
70
|
enable_skills: true,
|
|
71
71
|
tools: [],
|
|
72
72
|
}),
|
|
@@ -162,7 +162,7 @@ const AgentMemoryInner = ({ onLogout }) => {
|
|
|
162
162
|
flexDirection: 'column',
|
|
163
163
|
alignItems: 'center',
|
|
164
164
|
justifyContent: 'center',
|
|
165
|
-
height: '
|
|
165
|
+
height: '100%',
|
|
166
166
|
gap: 3,
|
|
167
167
|
}, children: [_jsx(Spinner, { size: "large" }), _jsx(Text, { sx: { color: 'fg.muted' }, children: "Launching local memory-enabled agent\u2026" })] }));
|
|
168
168
|
}
|
|
@@ -171,7 +171,7 @@ const AgentMemoryInner = ({ onLogout }) => {
|
|
|
171
171
|
}
|
|
172
172
|
// ── Main layout ──────────────────────────────────────────────────────────
|
|
173
173
|
return (_jsxs(Box, { sx: {
|
|
174
|
-
height: '
|
|
174
|
+
height: '100%',
|
|
175
175
|
display: 'flex',
|
|
176
176
|
flexDirection: 'column',
|
|
177
177
|
}, children: [_jsxs(Box, { sx: {
|
|
@@ -244,7 +244,7 @@ const AgentMemoryInner = ({ onLogout }) => {
|
|
|
244
244
|
};
|
|
245
245
|
// ─── Sync token to core IAM store ──────────────────────────────────────────
|
|
246
246
|
const syncTokenToIamStore = (token) => {
|
|
247
|
-
import('
|
|
247
|
+
import('../state/substates').then(({ iamStore }) => {
|
|
248
248
|
iamStore.setState({ token });
|
|
249
249
|
});
|
|
250
250
|
};
|
|
@@ -261,7 +261,7 @@ const AgentMemoryExample = () => {
|
|
|
261
261
|
const handleLogout = useCallback(() => {
|
|
262
262
|
clearAuth();
|
|
263
263
|
hasSynced.current = false;
|
|
264
|
-
import('
|
|
264
|
+
import('../state/substates').then(({ iamStore }) => {
|
|
265
265
|
iamStore.setState({ token: undefined });
|
|
266
266
|
});
|
|
267
267
|
}, [clearAuth]);
|
|
@@ -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
|
-
const
|
|
39
|
-
const DEFAULT_LOCAL_BASE_URL = import.meta.env.VITE_BASE_URL || 'http://localhost:8765';
|
|
39
|
+
const AGENTSPEC_ID = 'example-monitoring';
|
|
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
|
|
@@ -90,7 +95,7 @@ const AgentMonitoringInner = ({ onLogout, }) => {
|
|
|
90
95
|
description: 'MCP monitoring example – web crawling via Tavily with live cost/token metrics',
|
|
91
96
|
agent_library: 'pydantic-ai',
|
|
92
97
|
transport: 'vercel-ai',
|
|
93
|
-
agent_spec_id:
|
|
98
|
+
agent_spec_id: AGENTSPEC_ID,
|
|
94
99
|
enable_skills: true,
|
|
95
100
|
tools: [],
|
|
96
101
|
}),
|
|
@@ -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]);
|
|
@@ -28,7 +28,7 @@ import { Chat } from '../chat';
|
|
|
28
28
|
const queryClient = new QueryClient();
|
|
29
29
|
// ─── Constants ─────────────────────────────────────────────────────────────
|
|
30
30
|
const AGENT_NAME = 'notification-example-agent';
|
|
31
|
-
const
|
|
31
|
+
const AGENTSPEC_ID = 'example-notifications';
|
|
32
32
|
const alertVariant = (severity) => {
|
|
33
33
|
if (severity === 'critical')
|
|
34
34
|
return 'danger';
|
|
@@ -78,7 +78,7 @@ const AgentNotificationsInner = ({ onLogout, }) => {
|
|
|
78
78
|
description: 'Agent with multi-channel notification support',
|
|
79
79
|
agent_library: 'pydantic-ai',
|
|
80
80
|
transport: 'vercel-ai',
|
|
81
|
-
agent_spec_id:
|
|
81
|
+
agent_spec_id: AGENTSPEC_ID,
|
|
82
82
|
enable_skills: true,
|
|
83
83
|
tools: [],
|
|
84
84
|
}),
|
|
@@ -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.
|
|
@@ -43,7 +46,7 @@ const AGENT_BASE_URL_ENV = import.meta.env.VITE_BASE_URL || '';
|
|
|
43
46
|
const DEFAULT_AGENT_PROTOCOL = 'vercel-ai';
|
|
44
47
|
const DEFAULT_AGENT_LIBRARY = 'pydantic-ai';
|
|
45
48
|
/** Spec id this example always launches. */
|
|
46
|
-
const
|
|
49
|
+
const AGENTSPEC_ID = 'example-otel';
|
|
47
50
|
/**
|
|
48
51
|
* Small form for picking an agent spec and launching it.
|
|
49
52
|
* Renders as the `children` of the ChatSidebar so it appears above the chat.
|
|
@@ -61,11 +64,11 @@ const AgentLaunchPanel = ({ baseUrl, onConnected, onDisconnected, isConnected, c
|
|
|
61
64
|
method: 'POST',
|
|
62
65
|
headers: { 'Content-Type': 'application/json' },
|
|
63
66
|
body: JSON.stringify({
|
|
64
|
-
name:
|
|
67
|
+
name: AGENTSPEC_ID,
|
|
65
68
|
description: `Launched from AgentOtelExample`,
|
|
66
69
|
agent_library: DEFAULT_AGENT_LIBRARY,
|
|
67
70
|
transport,
|
|
68
|
-
agent_spec_id:
|
|
71
|
+
agent_spec_id: AGENTSPEC_ID,
|
|
69
72
|
}),
|
|
70
73
|
});
|
|
71
74
|
if (!res.ok) {
|
|
@@ -74,7 +77,7 @@ const AgentLaunchPanel = ({ baseUrl, onConnected, onDisconnected, isConnected, c
|
|
|
74
77
|
// Reuse existing agent when backend reports duplicate creation.
|
|
75
78
|
if (res.status === 409 || /already exists/i.test(detail)) {
|
|
76
79
|
const idMatch = detail.match(/Agent with ID '([^']+)' already exists/i);
|
|
77
|
-
const existingId = idMatch?.[1] ||
|
|
80
|
+
const existingId = idMatch?.[1] || AGENTSPEC_ID;
|
|
78
81
|
onConnected(existingId, transport);
|
|
79
82
|
return;
|
|
80
83
|
}
|
|
@@ -121,7 +124,7 @@ const AgentLaunchPanel = ({ baseUrl, onConnected, onDisconnected, isConnected, c
|
|
|
121
124
|
gap: 2,
|
|
122
125
|
flexShrink: 0,
|
|
123
126
|
bg: 'canvas.subtle',
|
|
124
|
-
}, children: [_jsx(Text, { sx: { fontSize: 0, fontWeight: 'bold', color: 'fg.muted' }, children: "AGENT" }), loading ? (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Spinner, { size: "small" }), _jsxs(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: ["Launching ",
|
|
127
|
+
}, children: [_jsx(Text, { sx: { fontSize: 0, fontWeight: 'bold', color: 'fg.muted' }, children: "AGENT" }), loading ? (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 2 }, children: [_jsx(Spinner, { size: "small" }), _jsxs(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: ["Launching ", AGENTSPEC_ID, "\u2026"] })] })) : error ? (_jsxs(_Fragment, { children: [_jsx(Text, { sx: { fontSize: 1, color: 'danger.fg' }, children: error }), _jsx(Button, { variant: "primary", size: "small", onClick: handleLaunch, leadingVisual: PlugIcon, sx: { width: '100%' }, children: "Retry" })] })) : (_jsxs(Text, { sx: { fontSize: 1, color: 'fg.muted' }, children: ["Launching ", AGENTSPEC_ID, "\u2026"] }))] }));
|
|
125
128
|
};
|
|
126
129
|
const TAB_SX = (active) => ({
|
|
127
130
|
px: 3,
|
|
@@ -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
|
-
const
|
|
38
|
-
const DEFAULT_LOCAL_BASE_URL = import.meta.env.VITE_BASE_URL || 'http://localhost:8765';
|
|
38
|
+
const AGENTSPEC_ID = 'demo-outputs';
|
|
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,
|
|
@@ -306,7 +306,7 @@ const AgentOutputsInner = ({ onLogout, }) => {
|
|
|
306
306
|
description: 'Agent with rich output rendering (table/JSON/chart/file)',
|
|
307
307
|
agent_library: 'pydantic-ai',
|
|
308
308
|
transport: 'vercel-ai',
|
|
309
|
-
agent_spec_id:
|
|
309
|
+
agent_spec_id: AGENTSPEC_ID,
|
|
310
310
|
enable_skills: true,
|
|
311
311
|
tools: [],
|
|
312
312
|
}),
|
|
@@ -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]);
|