@datalayer/core 1.1.59 → 1.1.66
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 +2 -2
- package/lib/api/DatalayerApi.d.ts +42 -1
- package/lib/api/DatalayerApi.js +90 -3
- package/lib/api/constants.d.ts +18 -0
- package/lib/api/constants.js +18 -0
- package/lib/api/contents/attachments.d.ts +9 -0
- package/lib/api/contents/attachments.js +43 -0
- package/lib/api/contents/bridges.d.ts +22 -0
- package/lib/api/contents/bridges.js +79 -0
- package/lib/api/contents/capabilities.d.ts +11 -0
- package/lib/api/contents/capabilities.js +21 -0
- package/lib/api/contents/cloudStorage.d.ts +31 -0
- package/lib/api/contents/cloudStorage.js +89 -0
- package/lib/api/contents/dataservers.d.ts +37 -0
- package/lib/api/contents/dataservers.js +121 -0
- package/lib/api/contents/datasets.d.ts +15 -0
- package/lib/api/contents/datasets.js +45 -0
- package/lib/api/contents/datasources.d.ts +70 -0
- package/lib/api/contents/datasources.js +149 -0
- package/lib/api/contents/generated.d.ts +1070 -0
- package/lib/api/contents/index.d.ts +16 -0
- package/lib/api/contents/index.js +20 -0
- package/lib/api/contents/mcp.d.ts +46 -0
- package/lib/api/contents/mcp.js +157 -0
- package/lib/api/contents/objects.d.ts +31 -0
- package/lib/api/contents/objects.js +88 -0
- package/lib/api/contents/operations.d.ts +3 -0
- package/lib/api/contents/operations.js +19 -0
- package/lib/api/contents/runtimeMounts.d.ts +40 -0
- package/lib/api/contents/runtimeMounts.js +59 -0
- package/lib/api/contents/sandboxUid.d.ts +53 -0
- package/lib/api/contents/sandboxUid.js +78 -0
- package/lib/api/contents/sources.d.ts +19 -0
- package/lib/api/contents/sources.js +119 -0
- package/lib/api/contents/sync.d.ts +18 -0
- package/lib/api/contents/sync.js +69 -0
- package/lib/api/contents/transfers.d.ts +38 -0
- package/lib/api/contents/transfers.js +123 -0
- package/lib/api/iam/connectedAgents.d.ts +39 -0
- package/lib/api/iam/connectedAgents.js +52 -0
- package/lib/api/iam/index.d.ts +2 -1
- package/lib/api/iam/index.js +2 -1
- package/lib/api/iam/mcpAlertRules.d.ts +51 -0
- package/lib/api/iam/mcpAlertRules.js +198 -0
- package/lib/api/iam/mcpAuditSettings.d.ts +46 -0
- package/lib/api/iam/mcpAuditSettings.js +120 -0
- package/lib/api/iam/mcpPolicy.d.ts +80 -0
- package/lib/api/iam/mcpPolicy.js +132 -0
- package/lib/api/iam/organizationTeams.d.ts +13 -0
- package/lib/api/iam/organizationTeams.js +43 -0
- package/lib/api/iam/serviceAgents.d.ts +68 -0
- package/lib/api/iam/serviceAgents.js +119 -0
- package/lib/api/index.d.ts +4 -1
- package/lib/api/index.js +3 -1
- package/lib/api/mcp/activity.d.ts +37 -0
- package/lib/api/mcp/activity.js +26 -0
- package/lib/api/mcp/alerts.d.ts +25 -0
- package/lib/api/mcp/alerts.js +51 -0
- package/lib/api/mcp/audit.d.ts +29 -0
- package/lib/api/mcp/audit.js +55 -0
- package/lib/api/mcp/bindings.d.ts +18 -0
- package/lib/api/mcp/bindings.js +42 -0
- package/lib/api/mcp/forwarding.d.ts +25 -0
- package/lib/api/mcp/forwarding.js +46 -0
- package/lib/api/mcp/gateway.d.ts +16 -0
- package/lib/api/mcp/gateway.js +70 -0
- package/lib/api/mcp/generated.d.ts +22 -0
- package/lib/api/mcp/generated.js +213 -0
- package/lib/api/mcp/index.d.ts +17 -0
- package/lib/api/mcp/index.js +25 -0
- package/lib/api/mcp/observability.d.ts +125 -0
- package/lib/api/mcp/observability.js +254 -0
- package/lib/api/mcp/operations.d.ts +83 -0
- package/lib/api/mcp/operations.js +50 -0
- package/lib/api/mcp/organizations.d.ts +102 -0
- package/lib/api/mcp/organizations.js +46 -0
- package/lib/api/mcp/policy.d.ts +9 -0
- package/lib/api/mcp/policy.js +23 -0
- package/lib/api/mcp/tasks.d.ts +49 -0
- package/lib/api/mcp/tasks.js +147 -0
- package/lib/api/utils/validation.d.ts +1 -1
- package/lib/api/utils/validation.js +1 -1
- package/lib/client/auth/index.js +0 -5
- package/lib/client/auth/storage.js +0 -5
- package/lib/client/auth/strategies.js +0 -5
- package/lib/client/base.d.ts +6 -0
- package/lib/client/base.js +8 -0
- package/lib/client/index.d.ts +0 -10
- package/lib/client/index.js +2 -2
- package/lib/client/mixins/ContentsMixin.d.ts +71 -0
- package/lib/client/mixins/ContentsMixin.js +157 -0
- package/lib/client/mixins/IAMMixin.d.ts +0 -31
- package/lib/client/mixins/IAMMixin.js +0 -58
- package/lib/components/animation/AnimatedText.d.ts +1 -0
- package/lib/components/animation/AnimatedText.js +0 -4
- package/lib/components/auth/SigInAPIKey.d.ts +1 -0
- package/lib/components/auth/SigInAPIKey.js +0 -6
- package/lib/components/auth/SignIn.d.ts +1 -0
- package/lib/components/auth/SignIn.js +0 -4
- package/lib/components/auth/SignIn.stories.d.ts +2 -2
- package/lib/components/avatars/BoringAvatar.d.ts +1 -1
- package/lib/components/avatars/BoringAvatar.stories.d.ts +1 -1
- package/lib/components/avatars/DLAvatar.d.ts +1 -1
- package/lib/components/avatars/DLAvatar.js +0 -4
- package/lib/components/avatars/UserAvatar.d.ts +18 -1
- package/lib/components/avatars/UserAvatar.js +14 -14
- package/lib/components/avatars/UserProfileAvatar.d.ts +1 -1
- package/lib/components/banners/NoAutomationBanner.d.ts +1 -1
- package/lib/components/billing/BillingEntitySelect.d.ts +10 -0
- package/lib/components/billing/BillingEntitySelect.js +0 -17
- package/lib/components/billing/index.js +0 -4
- package/lib/components/buttons/DownloadCSVButton.d.ts +1 -1
- package/lib/components/buttons/DownloadJsonButton.d.ts +1 -1
- package/lib/components/buttons/LongActionButton.d.ts +1 -0
- package/lib/components/buttons/LongActionButton.js +0 -4
- package/lib/components/buttons/UploadButton.d.ts +1 -0
- package/lib/components/buttons/UploadButton.js +0 -4
- package/lib/components/checkout/StripeCheckout.d.ts +1 -1
- package/lib/components/collaboration/LiveEditorCollaborators.d.ts +31 -0
- package/lib/components/collaboration/LiveEditorCollaborators.js +98 -53
- package/lib/components/collaboration/index.js +0 -4
- package/lib/components/confetti/ConfettiSuccess.d.ts +1 -1
- package/lib/components/contents/ContentSourceCard.d.ts +8 -0
- package/lib/components/contents/ContentSourceCard.js +23 -0
- package/lib/components/contents/HomeFolderObjectsBrowser.d.ts +10 -0
- package/lib/components/contents/HomeFolderObjectsBrowser.js +148 -0
- package/lib/components/contents/index.d.ts +2 -0
- package/lib/components/contents/index.js +6 -0
- package/lib/components/context/OrganizationSelect.d.ts +1 -1
- package/lib/components/display/AvatarSkeleton.d.ts +1 -1
- package/lib/components/display/BusyDots.d.ts +1 -1
- package/lib/components/display/CenteredSpinner.d.ts +1 -1
- package/lib/components/display/CodePreview.d.ts +1 -1
- package/lib/components/display/DatalayerBox.d.ts +7 -2
- package/lib/components/display/DatalayerBox.js +6 -6
- package/lib/components/display/HorizontalCenter.d.ts +1 -1
- package/lib/components/display/JupyterDialog.d.ts +1 -0
- package/lib/components/display/JupyterDialog.js +1 -7
- package/lib/components/display/Markdown.d.ts +1 -0
- package/lib/components/display/NotebookSkeleton.d.ts +1 -1
- package/lib/components/display/Placeholder.d.ts +1 -1
- package/lib/components/display/ToTopBranded.d.ts +1 -1
- package/lib/components/echarts/EChartsReact.d.ts +1 -1
- package/lib/components/flashes/FlashClosable.d.ts +1 -0
- package/lib/components/flashes/FlashClosable.js +0 -4
- package/lib/components/flashes/FlashGuest.d.ts +1 -1
- package/lib/components/flashes/FlashSurveys.d.ts +1 -1
- package/lib/components/flashes/FlashUnauthorized.d.ts +1 -0
- package/lib/components/flashes/FlashUnauthorized.js +0 -6
- package/lib/components/flashes/surveys/Survey2025_1.d.ts +1 -1
- package/lib/components/iam/ExternalTokenSilentLogin.d.ts +1 -1
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.js +2 -0
- package/lib/components/labels/StatusLabels.d.ts +10 -0
- package/lib/components/labels/StatusLabels.js +30 -1
- package/lib/components/labels/VisibilityLabel.d.ts +1 -1
- package/lib/components/landings/StepBlock.d.ts +1 -1
- package/lib/components/mcp/ClientBadge.d.ts +41 -0
- package/lib/components/mcp/ClientBadge.js +33 -0
- package/lib/components/mcp/McpErrorBlankslate.d.ts +21 -0
- package/lib/components/mcp/McpErrorBlankslate.js +17 -0
- package/lib/components/mcp/ScopeList.d.ts +28 -0
- package/lib/components/mcp/ScopeList.js +14 -0
- package/lib/components/mcp/index.d.ts +10 -0
- package/lib/components/mcp/index.js +18 -0
- package/lib/components/navbar/NavigationVisbilityObserver.d.ts +2 -1
- package/lib/components/navbar/SubdomainNavBar.d.ts +10 -5
- package/lib/components/navbar/SubdomainNavBar.js +2 -1
- package/lib/components/notebooks/JupyterNotebook.d.ts +1 -1
- package/lib/components/notebooks/JupyterNotebookToolbar.d.ts +1 -1
- package/lib/components/principal/PrincipalAppearance.d.ts +1 -0
- package/lib/components/principal/PrincipalAppearance.js +0 -8
- package/lib/components/principal/PrincipalAvatar.d.ts +9 -1
- package/lib/components/principal/PrincipalAvatar.js +25 -10
- package/lib/components/principal/PrincipalBadge.d.ts +1 -1
- package/lib/components/principal/PrincipalBanner.d.ts +1 -1
- package/lib/components/principal/PrincipalDetailsOverlay.d.ts +31 -1
- package/lib/components/principal/PrincipalDetailsOverlay.js +64 -33
- package/lib/components/principal/PrincipalHoverCard.d.ts +31 -0
- package/lib/components/principal/PrincipalHoverCard.js +52 -0
- package/lib/components/principal/PrincipalSwitcherMenu.d.ts +1 -0
- package/lib/components/principal/PrincipalSwitcherMenu.js +7 -15
- package/lib/components/principal/index.d.ts +2 -1
- package/lib/components/principal/index.js +2 -1
- package/lib/components/progress/ConsumptionBar.d.ts +1 -0
- package/lib/components/progress/ConsumptionBar.js +0 -4
- package/lib/components/progress/ProgressRing.d.ts +1 -0
- package/lib/components/progress/SpinnerBar.d.ts +1 -1
- package/lib/components/progress/Timer.d.ts +1 -0
- package/lib/components/progress/Timer.js +0 -4
- package/lib/components/screencapture/ScreencaptureButton.d.ts +1 -1
- package/lib/components/sharing/ShareAccessComponent.d.ts +15 -1
- package/lib/components/sharing/ShareAccessComponent.js +36 -23
- package/lib/components/sharing/SharingEditor.d.ts +17 -0
- package/lib/components/sharing/SharingEditor.js +0 -24
- package/lib/components/sparklines/Sparklines.js +3 -4
- package/lib/components/sparklines/index.js +0 -4
- package/lib/components/storage/ContentsBrowser.d.ts +25 -1
- package/lib/components/storage/ContentsBrowser.js +145 -52
- package/lib/components/storage/ContentsBrowserMock.d.ts +3 -0
- package/lib/components/storage/ContentsBrowserMock.js +75 -0
- package/lib/components/storage/ContentsItems.d.ts +2 -1
- package/lib/components/storage/ContentsItems.js +0 -4
- package/lib/components/storage/ContentsTable.d.ts +50 -0
- package/lib/components/storage/ContentsTable.js +134 -0
- package/lib/components/storage/HomeFolderDrive.d.ts +71 -0
- package/lib/components/storage/HomeFolderDrive.js +248 -0
- package/lib/components/storage/index.d.ts +2 -0
- package/lib/components/storage/index.js +2 -0
- package/lib/components/students/StudentItemStatus.d.ts +1 -1
- package/lib/components/students/StudentResultCircle.d.ts +1 -1
- package/lib/components/subnav/SubNav.d.ts +5 -5
- package/lib/components/subnav/SubNav.js +11 -9
- package/lib/components/tables/DataTable.d.ts +1 -1
- package/lib/components/text-reveal/TextRevealAnimation.d.ts +2 -2
- package/lib/components/text-reveal/useTextRevealAnimationLines.d.ts +1 -1
- package/lib/components/time/LiveRelativeTime.d.ts +1 -0
- package/lib/components/time/LiveRelativeTime.js +0 -8
- package/lib/components/time/index.js +0 -4
- package/lib/components/timeline/Timeline.d.ts +1 -1
- package/lib/components/timeline/index.js +0 -4
- package/lib/components/users/PeerIndicator.d.ts +1 -0
- package/lib/components/users/PeerIndicator.js +0 -4
- package/lib/config/Configuration.d.ts +15 -17
- package/lib/config/Configuration.js +7 -0
- package/lib/hooks/index.d.ts +2 -0
- package/lib/hooks/index.js +2 -0
- package/lib/hooks/layouts/LayoutBackdrop.d.ts +1 -1
- package/lib/hooks/layouts/LayoutScreencapture.d.ts +1 -1
- package/lib/hooks/useBackdrop.d.ts +1 -1
- package/lib/hooks/useBackdropJupyterLab.d.ts +3 -2
- package/lib/hooks/useBackdropJupyterLab.js +0 -4
- package/lib/hooks/useCache.d.ts +310 -105
- package/lib/hooks/useCache.js +142 -355
- package/lib/hooks/useContainsFocus.d.ts +1 -1
- package/lib/hooks/useContents.d.ts +313 -0
- package/lib/hooks/useContents.js +964 -0
- package/lib/hooks/useFocusTrap.d.ts +4 -4
- package/lib/hooks/useFocusTrap.js +1 -1
- package/lib/hooks/useMcp.d.ts +229 -0
- package/lib/hooks/useMcp.js +656 -0
- package/lib/hooks/useMobile.js +0 -5
- package/lib/hooks/useProjectStore.d.ts +3 -3
- package/lib/hooks/useProjectStore.js +4 -4
- package/lib/hooks/useRef.d.ts +1 -1
- package/lib/hooks/useRef.js +3 -0
- package/lib/hooks/useScreencapture.d.ts +2 -1
- package/lib/hooks/useScreencapture.js +0 -4
- package/lib/hooks/useToast.js +0 -4
- package/lib/hooks/useUser.js +42 -0
- package/lib/hooks/useVisibilityObserver.d.ts +1 -1
- package/lib/index.d.ts +4 -1
- package/lib/index.js +3 -1
- package/lib/mocks/components/FlashMock.d.ts +1 -1
- package/lib/mocks/views/ActionMenuMock.d.ts +1 -1
- package/lib/mocks/views/ChartMock.d.ts +1 -1
- package/lib/mocks/views/DashboardMock.d.ts +1 -1
- package/lib/mocks/views/FormMock.d.ts +1 -1
- package/lib/mocks/views/TableMock.d.ts +1 -1
- package/lib/mocks/views/WipMock.d.ts +1 -1
- package/lib/models/Credits.d.ts +16 -0
- package/lib/models/Credits.js +22 -0
- package/lib/models/McpAuditEvent.d.ts +52 -0
- package/lib/models/McpAuditEvent.js +5 -0
- package/lib/models/McpBinding.d.ts +51 -0
- package/lib/models/McpBinding.js +5 -0
- package/lib/models/McpPolicy.d.ts +77 -0
- package/lib/models/McpPolicy.js +5 -0
- package/lib/models/McpTask.d.ts +94 -0
- package/lib/models/McpTask.js +7 -0
- package/lib/models/StartedBy.d.ts +57 -0
- package/lib/models/StartedBy.js +81 -0
- package/lib/models/UserDTO.js +4 -2
- package/lib/models/contents/__fixtures__/solr-codec.json +57 -0
- package/lib/models/contents/__fixtures__/v1-contracts.json +66 -0
- package/lib/models/contents/fieldCase.d.ts +8 -0
- package/lib/models/contents/fieldCase.js +37 -0
- package/lib/models/contents/index.d.ts +2 -0
- package/lib/models/contents/index.js +6 -0
- package/lib/models/contents/permissions.d.ts +16 -0
- package/lib/models/contents/permissions.js +34 -0
- package/lib/models/index.d.ts +5 -1
- package/lib/models/index.js +5 -1
- package/lib/state/substates/CoreState.d.ts +15 -7
- package/lib/state/substates/CoreState.js +18 -14
- package/lib/state/substates/IAMState.d.ts +1 -1
- package/lib/state/substates/IAMState.js +5 -5
- package/lib/state/substates/ProfileState.js +0 -4
- package/lib/state/substates/index.d.ts +0 -1
- package/lib/state/substates/index.js +0 -1
- package/lib/utils/Jwt.d.ts +26 -0
- package/lib/utils/Jwt.js +37 -0
- package/lib/utils/WithSuspense.d.ts +1 -1
- package/lib/views/api-keys/APIKeyEdit.d.ts +1 -1
- package/lib/views/api-keys/APIKeyNew.d.ts +1 -1
- package/lib/views/api-keys/APIKeys.d.ts +1 -1
- package/lib/views/api-keys/APIKeys.js +30 -4
- package/lib/views/api-keys/APIKeysStandalone.d.ts +5 -1
- package/lib/views/api-keys/APIKeysStandalone.js +2 -2
- package/lib/views/datasources/DatasourceDetail.d.ts +12 -5
- package/lib/views/datasources/DatasourceDetail.js +80 -110
- package/lib/views/datasources/DatasourceNew.d.ts +14 -8
- package/lib/views/datasources/DatasourceNew.js +129 -118
- package/lib/views/datasources/Datasources.d.ts +39 -7
- package/lib/views/datasources/Datasources.js +95 -40
- package/lib/views/datasources/DatasourcesMock.d.ts +3 -0
- package/lib/views/datasources/DatasourcesMock.js +57 -0
- package/lib/views/iam/SignInSimple.d.ts +12 -0
- package/lib/views/iam/SignInSimple.js +4 -4
- package/lib/views/index.d.ts +1 -0
- package/lib/views/index.js +1 -0
- package/lib/views/mcp/AlertDestinations.d.ts +34 -0
- package/lib/views/mcp/AlertDestinations.js +75 -0
- package/lib/views/mcp/AlertRules.d.ts +32 -0
- package/lib/views/mcp/AlertRules.js +245 -0
- package/lib/views/mcp/AuditLog.d.ts +42 -0
- package/lib/views/mcp/AuditLog.js +144 -0
- package/lib/views/mcp/ConnectedAgents.d.ts +34 -0
- package/lib/views/mcp/ConnectedAgents.js +100 -0
- package/lib/views/mcp/EnterpriseConsole.d.ts +74 -0
- package/lib/views/mcp/EnterpriseConsole.js +173 -0
- package/lib/views/mcp/McpDashboard.d.ts +50 -0
- package/lib/views/mcp/McpDashboard.js +347 -0
- package/lib/views/mcp/McpHome.d.ts +92 -0
- package/lib/views/mcp/McpHome.js +153 -0
- package/lib/views/mcp/McpObservability.d.ts +50 -0
- package/lib/views/mcp/McpObservability.js +150 -0
- package/lib/views/mcp/OrganizationPolicy.d.ts +45 -0
- package/lib/views/mcp/OrganizationPolicy.js +107 -0
- package/lib/views/mcp/OrganizationUsage.d.ts +69 -0
- package/lib/views/mcp/OrganizationUsage.js +113 -0
- package/lib/views/mcp/PersonalPolicy.d.ts +54 -0
- package/lib/views/mcp/PersonalPolicy.js +125 -0
- package/lib/views/mcp/Policies.d.ts +53 -0
- package/lib/views/mcp/Policies.js +210 -0
- package/lib/views/mcp/PolicyForm.d.ts +67 -0
- package/lib/views/mcp/PolicyForm.js +91 -0
- package/lib/views/mcp/PolicyHistory.d.ts +45 -0
- package/lib/views/mcp/PolicyHistory.js +62 -0
- package/lib/views/mcp/ServiceAgents.d.ts +46 -0
- package/lib/views/mcp/ServiceAgents.js +194 -0
- package/lib/views/mcp/TeamPolicies.d.ts +33 -0
- package/lib/views/mcp/TeamPolicies.js +98 -0
- package/lib/views/mcp/format.d.ts +25 -0
- package/lib/views/mcp/format.js +77 -0
- package/lib/views/mcp/index.d.ts +29 -0
- package/lib/views/mcp/index.js +37 -0
- package/lib/views/mcp/types.d.ts +66 -0
- package/lib/views/mcp/types.js +5 -0
- package/lib/views/secrets/SecretEdit.d.ts +5 -1
- package/lib/views/secrets/SecretEdit.js +2 -2
- package/lib/views/secrets/SecretNew.d.ts +11 -1
- package/lib/views/secrets/SecretNew.js +2 -2
- package/lib/views/secrets/Secrets.d.ts +12 -1
- package/lib/views/secrets/Secrets.js +2 -2
- package/package.json +28 -24
- package/scripts/generate-contents-types.py +169 -0
- package/scripts/generate-mcp-types.py +233 -0
- package/lib/api/iam/datasources.d.ts +0 -86
- package/lib/api/iam/datasources.js +0 -185
- package/lib/components/toolbars/index.d.ts +0 -1
- package/lib/models/Datasource.d.ts +0 -181
- package/lib/models/Datasource.js +0 -154
- package/lib/state/substates/DatasourceState.d.ts +0 -11
- package/lib/state/substates/DatasourceState.js +0 -16
- /package/lib/{components/toolbars/index.js → api/contents/generated.js} +0 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export interface McpGatewayVersion {
|
|
2
|
+
version: string;
|
|
3
|
+
/** The MCP resource this gateway serves; what a token's `aud` must name. */
|
|
4
|
+
resource: string;
|
|
5
|
+
}
|
|
6
|
+
export interface McpGatewayHealth {
|
|
7
|
+
status: string;
|
|
8
|
+
version: string;
|
|
9
|
+
}
|
|
10
|
+
export type McpWorkerState = 'starting' | 'running' | 'idle' | 'draining' | 'stopped';
|
|
11
|
+
/** One worker process of the directory, keyed by user and by sandbox binding. */
|
|
12
|
+
export interface McpWorker {
|
|
13
|
+
uid: string;
|
|
14
|
+
userUid: string;
|
|
15
|
+
/** The `sb_…` binding whose sandbox this worker holds, when it holds one. */
|
|
16
|
+
sandboxBindingUid?: string | null;
|
|
17
|
+
replica: string;
|
|
18
|
+
state: McpWorkerState;
|
|
19
|
+
/** Tasks in `working`; a worker with one is never reaped. */
|
|
20
|
+
workingTasks: number;
|
|
21
|
+
startedAt: string;
|
|
22
|
+
lastUsedAt?: string | null;
|
|
23
|
+
version?: string | null;
|
|
24
|
+
}
|
|
25
|
+
export interface McpWorkerList {
|
|
26
|
+
items: McpWorker[];
|
|
27
|
+
/** The replica that answered. */
|
|
28
|
+
replica?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface McpWorkflowQueue {
|
|
31
|
+
name: string;
|
|
32
|
+
backlog: number;
|
|
33
|
+
/** Seconds the oldest waiting workflow has waited. */
|
|
34
|
+
oldestWaitSeconds?: number | null;
|
|
35
|
+
}
|
|
36
|
+
/** One periodic job on the replica that answered. */
|
|
37
|
+
export interface McpJob {
|
|
38
|
+
job: string;
|
|
39
|
+
/** Ticks this replica actually ran. */
|
|
40
|
+
ran: number;
|
|
41
|
+
/**
|
|
42
|
+
* Ticks this replica skipped because another held the lease. The ordinary
|
|
43
|
+
* outcome on every replica but one — read it per replica, never summed.
|
|
44
|
+
* Rising on *all* of them at once is the lease store refusing everybody.
|
|
45
|
+
*/
|
|
46
|
+
skipped: number;
|
|
47
|
+
failed: number;
|
|
48
|
+
lastRanAt?: number | null;
|
|
49
|
+
lastError?: string;
|
|
50
|
+
lastDurationSeconds?: number;
|
|
51
|
+
healthy: boolean;
|
|
52
|
+
}
|
|
53
|
+
export interface McpJobSchedule {
|
|
54
|
+
/** Whether this replica's scheduler loops are running. */
|
|
55
|
+
running: boolean;
|
|
56
|
+
/** The replica that answered; the counts below are only about it. */
|
|
57
|
+
holder: string;
|
|
58
|
+
jobs: McpJob[];
|
|
59
|
+
}
|
|
60
|
+
/** Engine health, queue backlog and worker versions. */
|
|
61
|
+
export interface McpWorkflowsHealth {
|
|
62
|
+
engine: 'temporal' | 'dbos' | string;
|
|
63
|
+
healthy: boolean;
|
|
64
|
+
detail?: string | null;
|
|
65
|
+
queues: McpWorkflowQueue[];
|
|
66
|
+
workerVersions: Record<string, number>;
|
|
67
|
+
checkedAt: string;
|
|
68
|
+
}
|
|
69
|
+
export declare const getGatewayVersion: (baseUrl?: string) => Promise<McpGatewayVersion>;
|
|
70
|
+
export declare const getGatewayHealth: (baseUrl?: string) => Promise<McpGatewayHealth>;
|
|
71
|
+
/** The worker directory across replicas; platform administrators only. */
|
|
72
|
+
export declare const listWorkers: (token: string, baseUrl?: string) => Promise<McpWorkerList>;
|
|
73
|
+
export declare const getWorkflowsHealth: (token: string, baseUrl?: string) => Promise<McpWorkflowsHealth>;
|
|
74
|
+
/**
|
|
75
|
+
* The periodic work on the replica that answers, and what it has done.
|
|
76
|
+
*
|
|
77
|
+
* Per replica by construction: only one replica holds each job's lease at a
|
|
78
|
+
* time, so `ran` on one and `skipped` on the others is the scheduler working.
|
|
79
|
+
* A caller that wants the platform's view has to ask every replica — there is
|
|
80
|
+
* no aggregate here, because an aggregate would hide the case worth seeing,
|
|
81
|
+
* which is every replica skipping at once.
|
|
82
|
+
*/
|
|
83
|
+
export declare const getJobSchedule: (token: string, baseUrl?: string) => Promise<McpJobSchedule>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
/*
|
|
6
|
+
* Copyright (c) 2023-2026 Datalayer, Inc.
|
|
7
|
+
* Distributed under the terms of the Modified BSD License.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* The gateway seen by a platform administrator: its version and liveness,
|
|
11
|
+
* the worker directory, the engine's health. No raw history, no secrets.
|
|
12
|
+
*
|
|
13
|
+
* @module api/mcp/operations
|
|
14
|
+
*/
|
|
15
|
+
import { requestDatalayerAPI } from '../DatalayerApi.js';
|
|
16
|
+
import { DEFAULT_SERVICE_URLS } from '../constants.js';
|
|
17
|
+
import { fromWire, mcpServiceUrl, mcpUrl } from './gateway.js';
|
|
18
|
+
export const getGatewayVersion = async (baseUrl = DEFAULT_SERVICE_URLS.JUPYTER_MCP_SERVER) => requestDatalayerAPI({
|
|
19
|
+
url: mcpServiceUrl(baseUrl, '/version'),
|
|
20
|
+
method: 'GET',
|
|
21
|
+
});
|
|
22
|
+
export const getGatewayHealth = async (baseUrl = DEFAULT_SERVICE_URLS.JUPYTER_MCP_SERVER) => requestDatalayerAPI({
|
|
23
|
+
url: mcpServiceUrl(baseUrl, '/healthz'),
|
|
24
|
+
method: 'GET',
|
|
25
|
+
});
|
|
26
|
+
/** The worker directory across replicas; platform administrators only. */
|
|
27
|
+
export const listWorkers = async (token, baseUrl = DEFAULT_SERVICE_URLS.JUPYTER_MCP_SERVER) => fromWire(await requestDatalayerAPI({
|
|
28
|
+
url: mcpUrl(baseUrl, '/operations/workers'),
|
|
29
|
+
method: 'GET',
|
|
30
|
+
token,
|
|
31
|
+
}));
|
|
32
|
+
export const getWorkflowsHealth = async (token, baseUrl = DEFAULT_SERVICE_URLS.JUPYTER_MCP_SERVER) => fromWire(await requestDatalayerAPI({
|
|
33
|
+
url: mcpUrl(baseUrl, '/operations/workflows'),
|
|
34
|
+
method: 'GET',
|
|
35
|
+
token,
|
|
36
|
+
}));
|
|
37
|
+
/**
|
|
38
|
+
* The periodic work on the replica that answers, and what it has done.
|
|
39
|
+
*
|
|
40
|
+
* Per replica by construction: only one replica holds each job's lease at a
|
|
41
|
+
* time, so `ran` on one and `skipped` on the others is the scheduler working.
|
|
42
|
+
* A caller that wants the platform's view has to ask every replica — there is
|
|
43
|
+
* no aggregate here, because an aggregate would hide the case worth seeing,
|
|
44
|
+
* which is every replica skipping at once.
|
|
45
|
+
*/
|
|
46
|
+
export const getJobSchedule = async (token, baseUrl = DEFAULT_SERVICE_URLS.JUPYTER_MCP_SERVER) => fromWire(await requestDatalayerAPI({
|
|
47
|
+
url: mcpUrl(baseUrl, '/operations/jobs'),
|
|
48
|
+
method: 'GET',
|
|
49
|
+
token,
|
|
50
|
+
}));
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/** One line of the compliance strip: green, or naming what is missing. */
|
|
2
|
+
export interface McpComplianceCheck {
|
|
3
|
+
/** The rule's name, e.g. `sso_required`, `admitted_clients_only`. */
|
|
4
|
+
name: string;
|
|
5
|
+
ok: boolean;
|
|
6
|
+
/** What is missing, when it is not `ok`. */
|
|
7
|
+
detail?: string | null;
|
|
8
|
+
}
|
|
9
|
+
/** How many principals act through MCP for the organization. */
|
|
10
|
+
export interface McpOverviewAgents {
|
|
11
|
+
delegated: number;
|
|
12
|
+
service: number;
|
|
13
|
+
activeToday: number;
|
|
14
|
+
}
|
|
15
|
+
export interface McpOverviewRuns {
|
|
16
|
+
today: number;
|
|
17
|
+
succeeded: number;
|
|
18
|
+
failed: number;
|
|
19
|
+
/** `completed` over terminal tasks; `null` when nothing ran. */
|
|
20
|
+
successRate?: number | null;
|
|
21
|
+
}
|
|
22
|
+
/** Milestone 3 fills the quota; until then only what was spent is known. */
|
|
23
|
+
export interface McpOverviewSpend {
|
|
24
|
+
creditsToday: number;
|
|
25
|
+
creditsMonth: number;
|
|
26
|
+
quotaMonth?: number | null;
|
|
27
|
+
}
|
|
28
|
+
export interface McpRefusalCount {
|
|
29
|
+
reason: string;
|
|
30
|
+
count: number;
|
|
31
|
+
}
|
|
32
|
+
export interface McpOrganizationOverview {
|
|
33
|
+
orgUid: string;
|
|
34
|
+
teamUid?: string | null;
|
|
35
|
+
/** The moment the answer was assembled. */
|
|
36
|
+
at: string;
|
|
37
|
+
agents: McpOverviewAgents;
|
|
38
|
+
runs: McpOverviewRuns;
|
|
39
|
+
spend?: McpOverviewSpend | null;
|
|
40
|
+
refusals: McpRefusalCount[];
|
|
41
|
+
approvalsWaiting?: number | null;
|
|
42
|
+
alertsFiring?: number | null;
|
|
43
|
+
compliance: McpComplianceCheck[];
|
|
44
|
+
}
|
|
45
|
+
export interface McpOrganizationOverviewFilters {
|
|
46
|
+
/** One team of the organization, rather than all of them. */
|
|
47
|
+
team?: string;
|
|
48
|
+
}
|
|
49
|
+
export declare const getOrganizationMcpOverview: (token: string, orgUid: string, filters?: McpOrganizationOverviewFilters, baseUrl?: string) => Promise<McpOrganizationOverview>;
|
|
50
|
+
/** One quota: what may be used, what is, and the share of the two.
|
|
51
|
+
*
|
|
52
|
+
* `used` is `null` where the figure could not be read, with `unknown` saying
|
|
53
|
+
* why. Absent and unreadable look identical in a dashboard — no number
|
|
54
|
+
* beside a heading — and mean opposite things: one is "no limit set", the
|
|
55
|
+
* other is "we cannot tell you what your limit is".
|
|
56
|
+
*/
|
|
57
|
+
export interface McpQuota {
|
|
58
|
+
limit?: number | null;
|
|
59
|
+
used?: number | null;
|
|
60
|
+
/** `used / limit`, computed by the gateway so a page and an alert cannot
|
|
61
|
+
* divide differently. */
|
|
62
|
+
fraction?: number | null;
|
|
63
|
+
/** Why the figure could not be read. Present only when it could not. */
|
|
64
|
+
unknown?: string;
|
|
65
|
+
}
|
|
66
|
+
/** What one agent spent of the day's credits. */
|
|
67
|
+
export interface McpAgentSpend {
|
|
68
|
+
/** The MCP client it connected as, e.g. `claude`. Empty for a service
|
|
69
|
+
* agent reaching Runtimes through the gateway. */
|
|
70
|
+
clientId: string;
|
|
71
|
+
/** The service agent's uid, where it is one. */
|
|
72
|
+
agentUid: string;
|
|
73
|
+
credits: number;
|
|
74
|
+
/** Usage records behind the figure. */
|
|
75
|
+
records: number;
|
|
76
|
+
}
|
|
77
|
+
export interface McpOrganizationUsage {
|
|
78
|
+
orgUid: string;
|
|
79
|
+
teamUid?: string | null;
|
|
80
|
+
window: {
|
|
81
|
+
seconds: number;
|
|
82
|
+
};
|
|
83
|
+
quotas: {
|
|
84
|
+
creditsPerDay?: McpQuota;
|
|
85
|
+
concurrentSandboxes?: McpQuota;
|
|
86
|
+
callsPerMinute?: McpQuota;
|
|
87
|
+
};
|
|
88
|
+
/** Which agents the day's credits went to, biggest spender first. Empty
|
|
89
|
+
* where the total could not be read — the parts under an unreadable whole
|
|
90
|
+
* make every agent look cheap. */
|
|
91
|
+
byAgent: McpAgentSpend[];
|
|
92
|
+
/** Where a limit is changed, which is not here. */
|
|
93
|
+
setAt: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* One organization's use against its quotas, and who spent it.
|
|
97
|
+
*
|
|
98
|
+
* Never throws for a figure it could not read: this is a page somebody opens
|
|
99
|
+
* when something is wrong, and the half of it that works is worth more than
|
|
100
|
+
* an error saying one number was unavailable.
|
|
101
|
+
*/
|
|
102
|
+
export declare const getOrganizationMcpUsage: (token: string, orgUid: string, filters?: McpOrganizationOverviewFilters, baseUrl?: string) => Promise<McpOrganizationUsage>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
/*
|
|
6
|
+
* Copyright (c) 2023-2026 Datalayer, Inc.
|
|
7
|
+
* Distributed under the terms of the Modified BSD License.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* What an administrator sees first: the organization's MCP overview.
|
|
11
|
+
*
|
|
12
|
+
* One answer for the Enterprise console's Overview page — the agents that
|
|
13
|
+
* acted today, the runs and their success rate, the refusals by reason, the
|
|
14
|
+
* approvals waiting and the compliance strip over what IAM knows. Spend,
|
|
15
|
+
* quota and alerts join the same answer in milestone 3; a field the gateway
|
|
16
|
+
* does not fill yet is absent rather than zero, so the page can say "not
|
|
17
|
+
* measured yet" instead of "none".
|
|
18
|
+
*
|
|
19
|
+
* `?team=` narrows every part of it to one team.
|
|
20
|
+
*
|
|
21
|
+
* @module api/mcp/organizations
|
|
22
|
+
*/
|
|
23
|
+
import { requestDatalayerAPI } from '../DatalayerApi.js';
|
|
24
|
+
import { DEFAULT_SERVICE_URLS } from '../constants.js';
|
|
25
|
+
import { fromWire, mcpUrl } from './gateway.js';
|
|
26
|
+
export const getOrganizationMcpOverview = async (token, orgUid, filters = {}, baseUrl = DEFAULT_SERVICE_URLS.JUPYTER_MCP_SERVER) => fromWire(await requestDatalayerAPI({
|
|
27
|
+
url: mcpUrl(baseUrl, `/organizations/${encodeURIComponent(orgUid)}/overview`, {
|
|
28
|
+
team: filters.team,
|
|
29
|
+
}),
|
|
30
|
+
method: 'GET',
|
|
31
|
+
token,
|
|
32
|
+
}));
|
|
33
|
+
/**
|
|
34
|
+
* One organization's use against its quotas, and who spent it.
|
|
35
|
+
*
|
|
36
|
+
* Never throws for a figure it could not read: this is a page somebody opens
|
|
37
|
+
* when something is wrong, and the half of it that works is worth more than
|
|
38
|
+
* an error saying one number was unavailable.
|
|
39
|
+
*/
|
|
40
|
+
export const getOrganizationMcpUsage = async (token, orgUid, filters = {}, baseUrl = DEFAULT_SERVICE_URLS.JUPYTER_MCP_SERVER) => fromWire(await requestDatalayerAPI({
|
|
41
|
+
url: mcpUrl(baseUrl, `/organizations/${encodeURIComponent(orgUid)}/usage`, {
|
|
42
|
+
team: filters.team,
|
|
43
|
+
}),
|
|
44
|
+
method: 'GET',
|
|
45
|
+
token,
|
|
46
|
+
}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { McpEffectivePolicy } from '../../models/McpPolicy';
|
|
2
|
+
export type { McpApprovalPolicy, McpEffectivePolicy, McpOrganizationPolicy, McpPersonalPolicy, McpPolicyLayer, McpPolicyRule, McpPolicyScope, McpToolRule, } from '../../models/McpPolicy';
|
|
3
|
+
export interface McpPolicyFilters {
|
|
4
|
+
/** Preview as: the `client_id` of an agent. */
|
|
5
|
+
agent?: string;
|
|
6
|
+
org?: string;
|
|
7
|
+
team?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const getEffectivePolicy: (token: string, filters?: McpPolicyFilters, baseUrl?: string) => Promise<McpEffectivePolicy>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
/*
|
|
6
|
+
* Copyright (c) 2023-2026 Datalayer, Inc.
|
|
7
|
+
* Distributed under the terms of the Modified BSD License.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* The effective policy for the caller's token, redacted, each rule naming
|
|
11
|
+
* the layer that decided it. `?agent=` previews the policy as one agent
|
|
12
|
+
* would see it.
|
|
13
|
+
*
|
|
14
|
+
* @module api/mcp/policy
|
|
15
|
+
*/
|
|
16
|
+
import { requestDatalayerAPI } from '../DatalayerApi.js';
|
|
17
|
+
import { DEFAULT_SERVICE_URLS } from '../constants.js';
|
|
18
|
+
import { fromWire, mcpUrl } from './gateway.js';
|
|
19
|
+
export const getEffectivePolicy = async (token, filters = {}, baseUrl = DEFAULT_SERVICE_URLS.JUPYTER_MCP_SERVER) => fromWire(await requestDatalayerAPI({
|
|
20
|
+
url: mcpUrl(baseUrl, '/policy', { ...filters }),
|
|
21
|
+
method: 'GET',
|
|
22
|
+
token,
|
|
23
|
+
}));
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { McpTask, McpTaskEvent, McpTaskInput, McpTaskList, McpTaskStatus } from '../../models/McpTask';
|
|
2
|
+
export { MCP_TERMINAL_TASK_STATUSES, isMcpTaskTerminal, } from '../../models/McpTask';
|
|
3
|
+
export type { McpCallToolResult, McpTask, McpTaskEvent, McpTaskInput, McpTaskList, McpTaskOutput, McpTaskStatus, McpWorkflowEngine, } from '../../models/McpTask';
|
|
4
|
+
export interface McpTaskListFilters {
|
|
5
|
+
notebook?: string;
|
|
6
|
+
sandbox?: string;
|
|
7
|
+
/** The `client_id` of the agent, or a service agent's uid. */
|
|
8
|
+
agent?: string;
|
|
9
|
+
status?: McpTaskStatus;
|
|
10
|
+
/** An owner's view of an organization. */
|
|
11
|
+
org?: string;
|
|
12
|
+
cursor?: string;
|
|
13
|
+
limit?: number;
|
|
14
|
+
}
|
|
15
|
+
/** The caller's tasks, newest first; an owner narrows to an organization. */
|
|
16
|
+
export declare const listTasks: (token: string, filters?: McpTaskListFilters, baseUrl?: string) => Promise<McpTaskList>;
|
|
17
|
+
export declare const getTask: (token: string, taskUid: string, baseUrl?: string) => Promise<McpTask>;
|
|
18
|
+
/** Stop a task that is still going. Idempotent: a finished task is answered as it is. */
|
|
19
|
+
export declare const cancelTask: (token: string, taskUid: string, baseUrl?: string) => Promise<McpTask>;
|
|
20
|
+
/**
|
|
21
|
+
* Answer a task that is `input_required`.
|
|
22
|
+
*
|
|
23
|
+
* The input is the tool's own and goes over as typed; only the envelope is
|
|
24
|
+
* converted. The idempotency key makes a retried answer one answer.
|
|
25
|
+
*/
|
|
26
|
+
export declare const answerTask: (token: string, taskUid: string, request: McpTaskInput, idempotencyKey: string, baseUrl?: string) => Promise<McpTask>;
|
|
27
|
+
/** The tasks of one notebook; empty until milestone 2 fills it. */
|
|
28
|
+
export declare const listNotebookTasks: (token: string, notebookUid: string, filters?: Pick<McpTaskListFilters, "status" | "cursor" | "limit">, baseUrl?: string) => Promise<McpTaskList>;
|
|
29
|
+
/** Where a task's server-sent events are. */
|
|
30
|
+
export declare const taskEventsUrl: (taskUid: string, baseUrl?: string) => string;
|
|
31
|
+
export interface McpTaskEventHandlers {
|
|
32
|
+
onEvent: (event: McpTaskEvent) => void;
|
|
33
|
+
onError?: (error: Error) => void;
|
|
34
|
+
/** The stream ended: the task reached a terminal status or the server closed. */
|
|
35
|
+
onClose?: () => void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* One SSE frame as the gateway writes it: `event:` then `data:` lines, a
|
|
39
|
+
* blank line between frames.
|
|
40
|
+
*/
|
|
41
|
+
export declare const parseTaskEventFrame: (frame: string) => McpTaskEvent | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Subscribe to a task's events.
|
|
44
|
+
*
|
|
45
|
+
* `EventSource` cannot carry a bearer token, so this reads the stream with
|
|
46
|
+
* `fetch`. The returned function closes the subscription; the stream also
|
|
47
|
+
* ends by itself when the task is terminal.
|
|
48
|
+
*/
|
|
49
|
+
export declare const subscribeTaskEvents: (token: string, taskUid: string, handlers: McpTaskEventHandlers, baseUrl?: string) => (() => void);
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
/*
|
|
6
|
+
* Copyright (c) 2023-2026 Datalayer, Inc.
|
|
7
|
+
* Distributed under the terms of the Modified BSD License.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Tasks of the Jupyter MCP Server: submitted by an agent, watched by anyone
|
|
11
|
+
* allowed to see the notebook.
|
|
12
|
+
*
|
|
13
|
+
* `GET /tasks` pages with a cursor and filters on notebook, sandbox, agent
|
|
14
|
+
* and status; `DELETE /tasks/{uid}` is cancel and is idempotent;
|
|
15
|
+
* `POST /tasks/{uid}/input` is the REST face of `tasks/update`;
|
|
16
|
+
* `GET /tasks/{uid}/events` is server-sent events carrying the same
|
|
17
|
+
* `notifications/tasks` payloads the MCP subscription does.
|
|
18
|
+
*
|
|
19
|
+
* @module api/mcp/tasks
|
|
20
|
+
*/
|
|
21
|
+
import { requestDatalayerAPI } from '../DatalayerApi.js';
|
|
22
|
+
import { DEFAULT_SERVICE_URLS } from '../constants.js';
|
|
23
|
+
import { fromWire, mcpUrl } from './gateway.js';
|
|
24
|
+
export { MCP_TERMINAL_TASK_STATUSES, isMcpTaskTerminal, } from '../../models/McpTask.js';
|
|
25
|
+
const taskUrl = (baseUrl, taskUid, suffix = '') => mcpUrl(baseUrl, `/tasks/${encodeURIComponent(taskUid)}${suffix}`);
|
|
26
|
+
/** The filters in the gateway's order, so a key and an URL are stable. */
|
|
27
|
+
const taskQuery = (filters) => ({
|
|
28
|
+
notebook: filters.notebook,
|
|
29
|
+
sandbox: filters.sandbox,
|
|
30
|
+
agent: filters.agent,
|
|
31
|
+
status: filters.status,
|
|
32
|
+
org: filters.org,
|
|
33
|
+
cursor: filters.cursor,
|
|
34
|
+
limit: filters.limit,
|
|
35
|
+
});
|
|
36
|
+
/** The caller's tasks, newest first; an owner narrows to an organization. */
|
|
37
|
+
export const listTasks = async (token, filters = {}, baseUrl = DEFAULT_SERVICE_URLS.JUPYTER_MCP_SERVER) => fromWire(await requestDatalayerAPI({
|
|
38
|
+
url: mcpUrl(baseUrl, '/tasks', taskQuery(filters)),
|
|
39
|
+
method: 'GET',
|
|
40
|
+
token,
|
|
41
|
+
}));
|
|
42
|
+
export const getTask = async (token, taskUid, baseUrl = DEFAULT_SERVICE_URLS.JUPYTER_MCP_SERVER) => fromWire(await requestDatalayerAPI({
|
|
43
|
+
url: taskUrl(baseUrl, taskUid),
|
|
44
|
+
method: 'GET',
|
|
45
|
+
token,
|
|
46
|
+
}));
|
|
47
|
+
/** Stop a task that is still going. Idempotent: a finished task is answered as it is. */
|
|
48
|
+
export const cancelTask = async (token, taskUid, baseUrl = DEFAULT_SERVICE_URLS.JUPYTER_MCP_SERVER) => fromWire(await requestDatalayerAPI({
|
|
49
|
+
url: taskUrl(baseUrl, taskUid),
|
|
50
|
+
method: 'DELETE',
|
|
51
|
+
token,
|
|
52
|
+
}));
|
|
53
|
+
/**
|
|
54
|
+
* Answer a task that is `input_required`.
|
|
55
|
+
*
|
|
56
|
+
* The input is the tool's own and goes over as typed; only the envelope is
|
|
57
|
+
* converted. The idempotency key makes a retried answer one answer.
|
|
58
|
+
*/
|
|
59
|
+
export const answerTask = async (token, taskUid, request, idempotencyKey, baseUrl = DEFAULT_SERVICE_URLS.JUPYTER_MCP_SERVER) => fromWire(await requestDatalayerAPI({
|
|
60
|
+
url: taskUrl(baseUrl, taskUid, '/input'),
|
|
61
|
+
method: 'POST',
|
|
62
|
+
token,
|
|
63
|
+
headers: { 'Idempotency-Key': idempotencyKey },
|
|
64
|
+
body: { input: request.input },
|
|
65
|
+
}));
|
|
66
|
+
/** The tasks of one notebook; empty until milestone 2 fills it. */
|
|
67
|
+
export const listNotebookTasks = async (token, notebookUid, filters = {}, baseUrl = DEFAULT_SERVICE_URLS.JUPYTER_MCP_SERVER) => fromWire(await requestDatalayerAPI({
|
|
68
|
+
url: mcpUrl(baseUrl, `/notebooks/${encodeURIComponent(notebookUid)}/tasks`, taskQuery(filters)),
|
|
69
|
+
method: 'GET',
|
|
70
|
+
token,
|
|
71
|
+
}));
|
|
72
|
+
/** Where a task's server-sent events are. */
|
|
73
|
+
export const taskEventsUrl = (taskUid, baseUrl = DEFAULT_SERVICE_URLS.JUPYTER_MCP_SERVER) => taskUrl(baseUrl, taskUid, '/events');
|
|
74
|
+
/**
|
|
75
|
+
* One SSE frame as the gateway writes it: `event:` then `data:` lines, a
|
|
76
|
+
* blank line between frames.
|
|
77
|
+
*/
|
|
78
|
+
export const parseTaskEventFrame = (frame) => {
|
|
79
|
+
let event = 'message';
|
|
80
|
+
const data = [];
|
|
81
|
+
for (const line of frame.split(/\r?\n/)) {
|
|
82
|
+
if (line.startsWith('event:')) {
|
|
83
|
+
event = line.slice('event:'.length).trim();
|
|
84
|
+
}
|
|
85
|
+
else if (line.startsWith('data:')) {
|
|
86
|
+
data.push(line.slice('data:'.length).replace(/^ /, ''));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (data.length === 0) {
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
const payload = fromWire(JSON.parse(data.join('\n')));
|
|
93
|
+
return { ...payload, event: payload.event ?? event, taskId: payload.taskId ?? '' };
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Subscribe to a task's events.
|
|
97
|
+
*
|
|
98
|
+
* `EventSource` cannot carry a bearer token, so this reads the stream with
|
|
99
|
+
* `fetch`. The returned function closes the subscription; the stream also
|
|
100
|
+
* ends by itself when the task is terminal.
|
|
101
|
+
*/
|
|
102
|
+
export const subscribeTaskEvents = (token, taskUid, handlers, baseUrl = DEFAULT_SERVICE_URLS.JUPYTER_MCP_SERVER) => {
|
|
103
|
+
const controller = new AbortController();
|
|
104
|
+
const run = async () => {
|
|
105
|
+
const response = await fetch(taskEventsUrl(taskUid, baseUrl), {
|
|
106
|
+
headers: { Authorization: `Bearer ${token}`, Accept: 'text/event-stream' },
|
|
107
|
+
signal: controller.signal,
|
|
108
|
+
});
|
|
109
|
+
if (!response.ok || !response.body) {
|
|
110
|
+
throw new Error(`Task events refused: ${response.status} ${response.statusText}`);
|
|
111
|
+
}
|
|
112
|
+
const reader = response.body.getReader();
|
|
113
|
+
const decoder = new TextDecoder();
|
|
114
|
+
let buffered = '';
|
|
115
|
+
for (;;) {
|
|
116
|
+
const { value, done } = await reader.read();
|
|
117
|
+
if (done) {
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
buffered += decoder.decode(value, { stream: true });
|
|
121
|
+
let boundary = buffered.indexOf('\n\n');
|
|
122
|
+
while (boundary >= 0) {
|
|
123
|
+
const frame = buffered.slice(0, boundary);
|
|
124
|
+
buffered = buffered.slice(boundary + 2);
|
|
125
|
+
const event = parseTaskEventFrame(frame);
|
|
126
|
+
if (event) {
|
|
127
|
+
handlers.onEvent(event);
|
|
128
|
+
}
|
|
129
|
+
boundary = buffered.indexOf('\n\n');
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
const last = parseTaskEventFrame(buffered);
|
|
133
|
+
if (last) {
|
|
134
|
+
handlers.onEvent(last);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
run()
|
|
138
|
+
.then(() => handlers.onClose?.())
|
|
139
|
+
.catch((error) => {
|
|
140
|
+
if (controller.signal.aborted) {
|
|
141
|
+
handlers.onClose?.();
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
handlers.onError?.(error instanceof Error ? error : new Error(String(error)));
|
|
145
|
+
});
|
|
146
|
+
return () => controller.abort();
|
|
147
|
+
};
|
|
@@ -37,7 +37,7 @@ export declare const validateRequiredString: (value: string | undefined | null,
|
|
|
37
37
|
* ```typescript
|
|
38
38
|
* const runtimeData = {
|
|
39
39
|
* uid: 'abc123',
|
|
40
|
-
*
|
|
40
|
+
* runtimeName: 'runtime-abc123',
|
|
41
41
|
* environmentName: undefined // This will throw
|
|
42
42
|
* };
|
|
43
43
|
* validateJSON(runtimeData, 'Runtime');
|
|
@@ -146,7 +146,7 @@ export const validateRequiredString = (value, paramName) => {
|
|
|
146
146
|
* ```typescript
|
|
147
147
|
* const runtimeData = {
|
|
148
148
|
* uid: 'abc123',
|
|
149
|
-
*
|
|
149
|
+
* runtimeName: 'runtime-abc123',
|
|
150
150
|
* environmentName: undefined // This will throw
|
|
151
151
|
* };
|
|
152
152
|
* validateJSON(runtimeData, 'Runtime');
|
package/lib/client/auth/index.js
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
3
|
* Distributed under the terms of the Modified BSD License.
|
|
4
4
|
*/
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
7
|
-
*
|
|
8
|
-
* Datalayer License
|
|
9
|
-
*/
|
|
10
5
|
/**
|
|
11
6
|
* Authentication module for Datalayer Client
|
|
12
7
|
* Provides unified authentication interface with multiple strategies
|
package/lib/client/base.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export interface DatalayerClientConfig {
|
|
|
19
19
|
runtimesUrl?: string;
|
|
20
20
|
/** URL for the Spacer service */
|
|
21
21
|
spacerUrl?: string;
|
|
22
|
+
/** URL for the Contents service */
|
|
23
|
+
contentsUrl?: string;
|
|
22
24
|
/** Custom token storage backend (optional, defaults to auto-detected) */
|
|
23
25
|
storage?: TokenStorage;
|
|
24
26
|
/** Handlers for intercepting Client method calls */
|
|
@@ -32,6 +34,8 @@ export declare class DatalayerClientBase {
|
|
|
32
34
|
readonly runtimesUrl: string;
|
|
33
35
|
/** URL for Spacer service */
|
|
34
36
|
readonly spacerUrl: string;
|
|
37
|
+
/** URL for Contents service */
|
|
38
|
+
readonly contentsUrl: string;
|
|
35
39
|
/** Authentication token */
|
|
36
40
|
token?: string;
|
|
37
41
|
/** Method lifecycle handlers */
|
|
@@ -54,6 +58,8 @@ export declare class DatalayerClientBase {
|
|
|
54
58
|
getRuntimesUrl(): string;
|
|
55
59
|
/** Get the Spacer service URL. */
|
|
56
60
|
getSpacerUrl(): string;
|
|
61
|
+
/** Get the Contents service URL. */
|
|
62
|
+
getContentsUrl(): string;
|
|
57
63
|
/** Get the current authentication token. */
|
|
58
64
|
getToken(): string | undefined;
|
|
59
65
|
/**
|
package/lib/client/base.js
CHANGED
|
@@ -16,6 +16,8 @@ export class DatalayerClientBase {
|
|
|
16
16
|
runtimesUrl;
|
|
17
17
|
/** URL for Spacer service */
|
|
18
18
|
spacerUrl;
|
|
19
|
+
/** URL for Contents service */
|
|
20
|
+
contentsUrl;
|
|
19
21
|
/** Authentication token */
|
|
20
22
|
token;
|
|
21
23
|
/** Method lifecycle handlers */
|
|
@@ -31,6 +33,7 @@ export class DatalayerClientBase {
|
|
|
31
33
|
this.runtimesUrl =
|
|
32
34
|
config.runtimesUrl || DEFAULT_SERVICE_URLS.RUNTIMES;
|
|
33
35
|
this.spacerUrl = config.spacerUrl || DEFAULT_SERVICE_URLS.SPACER;
|
|
36
|
+
this.contentsUrl = config.contentsUrl || DEFAULT_SERVICE_URLS.CONTENTS;
|
|
34
37
|
this.token = config.token;
|
|
35
38
|
this.handlers = config.handlers;
|
|
36
39
|
// Initialize authentication manager with custom storage if provided
|
|
@@ -49,6 +52,7 @@ export class DatalayerClientBase {
|
|
|
49
52
|
iamUrl: this.iamUrl,
|
|
50
53
|
runtimesUrl: this.runtimesUrl,
|
|
51
54
|
spacerUrl: this.spacerUrl,
|
|
55
|
+
contentsUrl: this.contentsUrl,
|
|
52
56
|
token: this.token,
|
|
53
57
|
};
|
|
54
58
|
}
|
|
@@ -64,6 +68,10 @@ export class DatalayerClientBase {
|
|
|
64
68
|
getSpacerUrl() {
|
|
65
69
|
return this.spacerUrl;
|
|
66
70
|
}
|
|
71
|
+
/** Get the Contents service URL. */
|
|
72
|
+
getContentsUrl() {
|
|
73
|
+
return this.contentsUrl;
|
|
74
|
+
}
|
|
67
75
|
/** Get the current authentication token. */
|
|
68
76
|
getToken() {
|
|
69
77
|
return this.token;
|
package/lib/client/index.d.ts
CHANGED
|
@@ -20,8 +20,6 @@ import type { CreditsDTO } from '../models/CreditsDTO';
|
|
|
20
20
|
import type { HealthCheck } from '../models/HealthCheck';
|
|
21
21
|
import type { SecretDTO } from '../models/Secret';
|
|
22
22
|
import type { CreateSecretRequest, UpdateSecretRequest } from '../models/Secret';
|
|
23
|
-
import type { DatasourceDTO } from '../models/Datasource';
|
|
24
|
-
import type { CreateDatasourceRequest, UpdateDatasourceRequest } from '../models/Datasource';
|
|
25
23
|
declare const DatalayerCoreClientWithMixins: typeof DatalayerClientBase;
|
|
26
24
|
/**
|
|
27
25
|
* Core Datalayer Client providing access to identity, plans and account
|
|
@@ -57,13 +55,10 @@ export { HealthCheck } from '../models/HealthCheck';
|
|
|
57
55
|
export type { HealthCheckJSON } from '../models/HealthCheck';
|
|
58
56
|
export { SecretDTO as Secret } from './../models/Secret';
|
|
59
57
|
export type { SecretJSON, SecretData, CreateSecretRequest, UpdateSecretRequest, CreateSecretResponse, GetSecretResponse, ListSecretsResponse, UpdateSecretResponse, DeleteSecretResponse, } from './../models/Secret';
|
|
60
|
-
export { DatasourceDTO as Datasource } from './../models/Datasource';
|
|
61
|
-
export type { DatasourceJSON, DatasourceData, DatasourceType, CreateDatasourceRequest, UpdateDatasourceRequest, CreateDatasourceResponse, GetDatasourceResponse, ListDatasourcesResponse, UpdateDatasourceResponse, } from './../models/Datasource';
|
|
62
58
|
export type { LoginRequest, LoginResponse, UserMeResponse, MembershipsResponse, WhoAmIResponse, } from '../models/IAM';
|
|
63
59
|
export type { HealthzPingResponse } from '../models/Common';
|
|
64
60
|
export { AuthenticationManager } from './auth/AuthenticationManager';
|
|
65
61
|
export type { IUser, IBaseUser } from '../models/User';
|
|
66
|
-
export type { IDatasource, IDatasourceVariant } from '../models/Datasource';
|
|
67
62
|
export type { ICredits, ICreditsReservation } from '../models/Credits';
|
|
68
63
|
export type { ISurvey } from '../models/Survey';
|
|
69
64
|
export type { IBaseTeam, IAnyTeam } from '../models/Team';
|
|
@@ -111,10 +106,5 @@ export interface DatalayerCoreClient {
|
|
|
111
106
|
getSecret(secretId: string): Promise<SecretDTO>;
|
|
112
107
|
updateSecret(secretId: string, updates: UpdateSecretRequest): Promise<SecretDTO>;
|
|
113
108
|
deleteSecret(secretId: string): Promise<void>;
|
|
114
|
-
createDatasource(data: CreateDatasourceRequest): Promise<DatasourceDTO>;
|
|
115
|
-
listDatasources(): Promise<DatasourceDTO[]>;
|
|
116
|
-
getDatasource(datasourceId: string): Promise<DatasourceDTO>;
|
|
117
|
-
updateDatasource(datasourceId: string, updates: UpdateDatasourceRequest): Promise<DatasourceDTO>;
|
|
118
|
-
deleteDatasource(datasourceId: string): Promise<void>;
|
|
119
109
|
calculateCreditsFromMinutes(minutes: number, burningRate: number): number;
|
|
120
110
|
}
|