@datalayer/core 1.1.66 → 1.2.12

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.
Files changed (237) hide show
  1. package/README.md +43 -20
  2. package/lib/api/constants.d.ts +1 -1
  3. package/lib/api/constants.js +1 -1
  4. package/lib/api/contents/attachments.js +3 -7
  5. package/lib/api/contents/datasets.d.ts +48 -0
  6. package/lib/api/contents/datasets.js +44 -7
  7. package/lib/api/contents/runtimeMounts.js +1 -1
  8. package/lib/api/contents/sandboxUid.d.ts +13 -45
  9. package/lib/api/contents/sandboxUid.js +14 -65
  10. package/lib/api/evals/client.d.ts +402 -0
  11. package/lib/api/evals/client.js +359 -0
  12. package/lib/api/evals/index.d.ts +10 -0
  13. package/lib/api/evals/index.js +18 -0
  14. package/lib/api/evals/request.d.ts +43 -0
  15. package/lib/api/evals/request.js +67 -0
  16. package/lib/api/evals/status.d.ts +27 -0
  17. package/lib/api/evals/status.js +122 -0
  18. package/lib/api/evals/types.d.ts +1335 -0
  19. package/lib/api/evals/types.js +5 -0
  20. package/lib/api/iam/authentication.js +6 -4
  21. package/lib/api/iam/connectedAgents.d.ts +29 -0
  22. package/lib/api/iam/connectedAgents.js +35 -0
  23. package/lib/api/iam/healthz.js +2 -2
  24. package/lib/api/iam/identityProviders.d.ts +76 -0
  25. package/lib/api/iam/identityProviders.js +187 -0
  26. package/lib/api/iam/index.d.ts +1 -0
  27. package/lib/api/iam/index.js +1 -0
  28. package/lib/api/iam/mcpPolicy.d.ts +102 -1
  29. package/lib/api/iam/mcpPolicy.js +38 -2
  30. package/lib/api/iam/oauth2.js +18 -12
  31. package/lib/api/iam/profile.d.ts +17 -1
  32. package/lib/api/iam/profile.js +27 -0
  33. package/lib/api/iam/scimTokens.d.ts +79 -0
  34. package/lib/api/iam/scimTokens.js +141 -0
  35. package/lib/api/iam/secrets.js +10 -23
  36. package/lib/api/iam/trials.d.ts +38 -0
  37. package/lib/api/iam/trials.js +66 -0
  38. package/lib/api/index.d.ts +4 -0
  39. package/lib/api/index.js +4 -0
  40. package/lib/api/mcp/observability.d.ts +34 -11
  41. package/lib/api/mcp/observability.js +97 -59
  42. package/lib/api/orchestration/client.d.ts +53 -0
  43. package/lib/api/orchestration/client.js +105 -0
  44. package/lib/api/orchestration/events.d.ts +88 -0
  45. package/lib/api/orchestration/events.js +245 -0
  46. package/lib/api/orchestration/generated.d.ts +693 -0
  47. package/lib/api/orchestration/generated.js +687 -0
  48. package/lib/api/orchestration/index.d.ts +30 -0
  49. package/lib/api/orchestration/index.js +34 -0
  50. package/lib/api/orchestration/lifecycle.d.ts +39 -0
  51. package/lib/api/orchestration/lifecycle.js +57 -0
  52. package/lib/api/orchestration/measures.d.ts +55 -0
  53. package/lib/api/orchestration/measures.js +99 -0
  54. package/lib/api/otel/dashboards.d.ts +56 -0
  55. package/lib/api/otel/dashboards.js +50 -0
  56. package/lib/api/otel/index.d.ts +1 -0
  57. package/lib/api/otel/index.js +1 -0
  58. package/lib/api/otel/metrics.d.ts +16 -0
  59. package/lib/api/otel/metrics.js +15 -0
  60. package/lib/api/scheduler/client.d.ts +32 -0
  61. package/lib/api/scheduler/client.js +42 -0
  62. package/lib/api/scheduler/index.d.ts +8 -0
  63. package/lib/api/scheduler/index.js +16 -0
  64. package/lib/api/scheduler/request.d.ts +28 -0
  65. package/lib/api/scheduler/request.js +50 -0
  66. package/lib/api/scheduler/types.d.ts +88 -0
  67. package/lib/api/scheduler/types.js +5 -0
  68. package/lib/api/spacer/comments.d.ts +97 -0
  69. package/lib/api/spacer/comments.js +45 -0
  70. package/lib/api/spacer/index.d.ts +9 -0
  71. package/lib/api/spacer/index.js +17 -0
  72. package/lib/api/spacer/notebooks.d.ts +33 -0
  73. package/lib/api/spacer/notebooks.js +39 -0
  74. package/lib/api/spacer/request.d.ts +25 -0
  75. package/lib/api/spacer/request.js +46 -0
  76. package/lib/api/spacer/spaces.d.ts +68 -0
  77. package/lib/api/spacer/spaces.js +45 -0
  78. package/lib/api/utils/validation.d.ts +4 -4
  79. package/lib/api/utils/validation.js +10 -7
  80. package/lib/client/auth/strategies.js +1 -1
  81. package/lib/client/constants.d.ts +1 -0
  82. package/lib/client/constants.js +1 -0
  83. package/lib/client/mixins/IAMMixin.js +2 -2
  84. package/lib/components/animation/AnimatedText.d.ts +1 -44
  85. package/lib/components/animation/AnimatedText.js +6 -122
  86. package/lib/components/anonymous/AnonymousKeyExpired.d.ts +56 -0
  87. package/lib/components/anonymous/AnonymousKeyExpired.js +96 -0
  88. package/lib/components/anonymous/AnonymousKeyTimer.d.ts +63 -0
  89. package/lib/components/anonymous/AnonymousKeyTimer.js +140 -0
  90. package/lib/components/anonymous/index.d.ts +7 -0
  91. package/lib/components/anonymous/index.js +15 -0
  92. package/lib/components/avatars/UserAvatar.d.ts +7 -1
  93. package/lib/components/avatars/UserAvatar.js +15 -1
  94. package/lib/components/billing/BillingEntitySelect.d.ts +6 -0
  95. package/lib/components/billing/BillingEntitySelect.js +49 -10
  96. package/lib/components/billing/eligibility.d.ts +22 -0
  97. package/lib/components/billing/eligibility.js +27 -0
  98. package/lib/components/billing/index.d.ts +1 -0
  99. package/lib/components/billing/index.js +1 -0
  100. package/lib/components/checkout/StripeCheckout.d.ts +1 -1
  101. package/lib/components/checkout/StripeCheckout.js +1 -1
  102. package/lib/components/collaboration/LiveEditorCollaborators.d.ts +5 -0
  103. package/lib/components/collaboration/LiveEditorCollaborators.js +3 -1
  104. package/lib/components/display/DatalayerBox.d.ts +2 -3
  105. package/lib/components/display/DatalayerBox.js +1 -1
  106. package/lib/components/display/NavLink.js +3 -2
  107. package/lib/components/display/VisuallyHidden.d.ts +1 -2
  108. package/lib/components/labels/StatusLabels.d.ts +2 -10
  109. package/lib/components/labels/StatusLabels.js +2 -26
  110. package/lib/components/principal/PrincipalAppearance.d.ts +21 -42
  111. package/lib/components/principal/PrincipalAppearance.js +232 -174
  112. package/lib/components/principal/PrincipalAvatar.d.ts +8 -1
  113. package/lib/components/principal/PrincipalAvatar.js +2 -2
  114. package/lib/components/principal/PrincipalDetailsOverlay.d.ts +8 -1
  115. package/lib/components/principal/PrincipalDetailsOverlay.js +2 -2
  116. package/lib/components/screencapture/Screencapture.js +46 -3
  117. package/lib/components/sharing/ShareAccessComponent.d.ts +45 -4
  118. package/lib/components/sharing/ShareAccessComponent.js +110 -78
  119. package/lib/components/sharing/SharingEditor.d.ts +5 -1
  120. package/lib/components/sharing/SharingEditor.js +9 -4
  121. package/lib/components/sharing/index.d.ts +1 -0
  122. package/lib/components/sharing/index.js +1 -0
  123. package/lib/components/sharing/sandboxSharing.d.ts +26 -0
  124. package/lib/components/sharing/sandboxSharing.js +47 -0
  125. package/lib/components/spaces/SpaceDetailsOverlay.d.ts +39 -0
  126. package/lib/components/spaces/SpaceDetailsOverlay.js +80 -0
  127. package/lib/components/spaces/SpaceDisplay.d.ts +38 -0
  128. package/lib/components/spaces/SpaceDisplay.js +92 -0
  129. package/lib/components/spaces/index.d.ts +4 -0
  130. package/lib/components/spaces/index.js +7 -0
  131. package/lib/components/spaces/spaceDisplayModel.d.ts +93 -0
  132. package/lib/components/spaces/spaceDisplayModel.js +170 -0
  133. package/lib/config/Configuration.d.ts +4 -4
  134. package/lib/config/Configuration.js +7 -7
  135. package/lib/config/index.d.ts +1 -0
  136. package/lib/config/index.js +1 -0
  137. package/lib/config/planes.d.ts +45 -0
  138. package/lib/config/planes.js +53 -0
  139. package/lib/hooks/cacheConverters.d.ts +0 -7
  140. package/lib/hooks/cacheConverters.js +0 -25
  141. package/lib/hooks/index.d.ts +1 -0
  142. package/lib/hooks/index.js +1 -0
  143. package/lib/hooks/useBackdrop.d.ts +4 -5
  144. package/lib/hooks/useBillingEntityStore.js +3 -0
  145. package/lib/hooks/useCache.d.ts +197 -44
  146. package/lib/hooks/useCache.js +1586 -494
  147. package/lib/hooks/useContents.d.ts +22 -1
  148. package/lib/hooks/useContents.js +90 -21
  149. package/lib/hooks/useMcp.d.ts +87 -1
  150. package/lib/hooks/useMcp.js +248 -13
  151. package/lib/hooks/useNavigate.d.ts +41 -3
  152. package/lib/hooks/useNavigate.js +116 -52
  153. package/lib/hooks/usePrincipalCacheStore.js +3 -0
  154. package/lib/hooks/usePrincipalStore.js +3 -0
  155. package/lib/hooks/useSpaceCacheStore.d.ts +50 -0
  156. package/lib/hooks/useSpaceCacheStore.js +85 -0
  157. package/lib/hooks/useWindowSize.js +1 -1
  158. package/lib/models/CreditsDTO.d.ts +6 -5
  159. package/lib/models/CreditsDTO.js +7 -5
  160. package/lib/models/IAMProvidersSpecs.d.ts +10 -5
  161. package/lib/models/IAMProvidersSpecs.js +0 -23
  162. package/lib/models/McpBinding.d.ts +6 -0
  163. package/lib/models/Organization.d.ts +69 -0
  164. package/lib/models/Organization.js +96 -0
  165. package/lib/models/Secret.d.ts +1 -2
  166. package/lib/models/Secret.js +2 -18
  167. package/lib/models/StartedBy.d.ts +34 -0
  168. package/lib/models/StartedBy.js +36 -0
  169. package/lib/models/Team.d.ts +2 -0
  170. package/lib/models/Team.js +2 -0
  171. package/lib/models/User.d.ts +4 -0
  172. package/lib/models/User.js +3 -0
  173. package/lib/models/UserSettings.d.ts +13 -0
  174. package/lib/models/UserSettings.js +9 -0
  175. package/lib/models/contents/__fixtures__/v1-contracts.json +158 -30
  176. package/lib/navigation/adapters/react-router.d.ts +1 -1
  177. package/lib/navigation/adapters/react-router.js +3 -0
  178. package/lib/navigation/components.js +2 -3
  179. package/lib/routes/publicPaths.js +4 -0
  180. package/lib/state/index.d.ts +1 -0
  181. package/lib/state/index.js +1 -0
  182. package/lib/state/sessionEnd.d.ts +55 -0
  183. package/lib/state/sessionEnd.js +162 -0
  184. package/lib/state/substates/CoreState.js +3 -16
  185. package/lib/state/substates/IAMState.d.ts +3 -3
  186. package/lib/state/substates/IAMState.js +7 -0
  187. package/lib/state/substates/LayoutState.js +12 -0
  188. package/lib/state/substates/NavigationState.d.ts +82 -0
  189. package/lib/state/substates/NavigationState.js +255 -0
  190. package/lib/state/substates/ProfileState.d.ts +1 -0
  191. package/lib/state/substates/ProfileState.js +1 -0
  192. package/lib/state/substates/index.d.ts +1 -0
  193. package/lib/state/substates/index.js +1 -0
  194. package/lib/utils/Lazy.d.ts +20 -0
  195. package/lib/utils/Lazy.js +32 -6
  196. package/lib/utils/Screencapture.d.ts +15 -0
  197. package/lib/utils/Screencapture.js +26 -20
  198. package/lib/utils/WithSuspense.d.ts +11 -1
  199. package/lib/utils/WithSuspense.js +11 -1
  200. package/lib/views/mcp/AdmittedClients.d.ts +44 -0
  201. package/lib/views/mcp/AdmittedClients.js +59 -0
  202. package/lib/views/mcp/ApprovalQueue.d.ts +66 -0
  203. package/lib/views/mcp/ApprovalQueue.js +95 -0
  204. package/lib/views/mcp/ConnectedAgents.js +38 -3
  205. package/lib/views/mcp/EnterpriseConsole.d.ts +1 -1
  206. package/lib/views/mcp/EnterpriseConsole.js +23 -1
  207. package/lib/views/mcp/IdentityProviders.d.ts +33 -0
  208. package/lib/views/mcp/IdentityProviders.js +299 -0
  209. package/lib/views/mcp/McpDashboard.js +90 -7
  210. package/lib/views/mcp/McpHome.js +1 -1
  211. package/lib/views/mcp/McpObservability.d.ts +30 -1
  212. package/lib/views/mcp/McpObservability.js +105 -19
  213. package/lib/views/mcp/NotebookRuns.d.ts +39 -0
  214. package/lib/views/mcp/NotebookRuns.js +44 -0
  215. package/lib/views/mcp/OrganizationPolicy.js +2 -1
  216. package/lib/views/mcp/PersonalPolicy.js +2 -1
  217. package/lib/views/mcp/PolicyForm.d.ts +17 -1
  218. package/lib/views/mcp/PolicyForm.js +25 -3
  219. package/lib/views/mcp/PolicyHistory.d.ts +13 -0
  220. package/lib/views/mcp/PolicyHistory.js +14 -1
  221. package/lib/views/mcp/RunDetail.d.ts +87 -0
  222. package/lib/views/mcp/RunDetail.js +186 -0
  223. package/lib/views/mcp/ScimProvisioning.d.ts +54 -0
  224. package/lib/views/mcp/ScimProvisioning.js +173 -0
  225. package/lib/views/mcp/TeamPolicies.js +66 -5
  226. package/lib/views/mcp/ToolAccess.d.ts +60 -0
  227. package/lib/views/mcp/ToolAccess.js +101 -0
  228. package/lib/views/mcp/TraceTimeline.d.ts +81 -0
  229. package/lib/views/mcp/TraceTimeline.js +132 -0
  230. package/lib/views/mcp/index.d.ts +5 -0
  231. package/lib/views/mcp/index.js +5 -0
  232. package/lib/views/otel/simpleAuthStore.js +3 -0
  233. package/lib/views/secrets/SecretEdit.js +3 -2
  234. package/lib/views/secrets/SecretNew.js +5 -1
  235. package/package.json +271 -264
  236. package/scripts/generate-mcp-types.py +16 -10
  237. package/scripts/generate-orchestration-types.py +920 -0
@@ -0,0 +1,30 @@
1
+ /**
2
+ * The canonical orchestration model: what one agent says to another about
3
+ * work it is delegating, supervising, steering, recovering or stopping.
4
+ *
5
+ * Every type here is generated from the pydantic models in
6
+ * `datalayer_core/orchestration`, which are the source of truth
7
+ * (PLAN_ORCHESTRATOR.md, 19.8), and from the control plane's OpenAPI
8
+ * document for the answers it wraps them in and the operations it serves.
9
+ * Regenerate with `npm run generate:orchestration`;
10
+ * `npm run check:orchestration-generated` is the gate that fails when the
11
+ * checked-in file is not what the models and the document say. Do not edit
12
+ * `generated.ts` by hand.
13
+ *
14
+ * The wire is camel case, so nothing here converts anything: unlike the MCP
15
+ * and Contents clients, which speak a snake case wire and camel case in the
16
+ * browser, an orchestration document is the same in both places.
17
+ *
18
+ * `client` is the control plane's twelve commands and two reads, every path
19
+ * taken from the generated operations; `events` is the subscription that
20
+ * resumes after a dropped connection, and the user channel's tree
21
+ * announcement; `measures` is how delegated work is doing, read from the
22
+ * OTEL service's orchestration dashboard.
23
+ *
24
+ * @module api/orchestration
25
+ */
26
+ export * from './generated';
27
+ export * from './lifecycle';
28
+ export * from './client';
29
+ export * from './events';
30
+ export * from './measures';
@@ -0,0 +1,34 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /**
6
+ * The canonical orchestration model: what one agent says to another about
7
+ * work it is delegating, supervising, steering, recovering or stopping.
8
+ *
9
+ * Every type here is generated from the pydantic models in
10
+ * `datalayer_core/orchestration`, which are the source of truth
11
+ * (PLAN_ORCHESTRATOR.md, 19.8), and from the control plane's OpenAPI
12
+ * document for the answers it wraps them in and the operations it serves.
13
+ * Regenerate with `npm run generate:orchestration`;
14
+ * `npm run check:orchestration-generated` is the gate that fails when the
15
+ * checked-in file is not what the models and the document say. Do not edit
16
+ * `generated.ts` by hand.
17
+ *
18
+ * The wire is camel case, so nothing here converts anything: unlike the MCP
19
+ * and Contents clients, which speak a snake case wire and camel case in the
20
+ * browser, an orchestration document is the same in both places.
21
+ *
22
+ * `client` is the control plane's twelve commands and two reads, every path
23
+ * taken from the generated operations; `events` is the subscription that
24
+ * resumes after a dropped connection, and the user channel's tree
25
+ * announcement; `measures` is how delegated work is doing, read from the
26
+ * OTEL service's orchestration dashboard.
27
+ *
28
+ * @module api/orchestration
29
+ */
30
+ export * from './generated.js';
31
+ export * from './lifecycle.js';
32
+ export * from './client.js';
33
+ export * from './events.js';
34
+ export * from './measures.js';
@@ -0,0 +1,39 @@
1
+ /**
2
+ * The canonical execution lifecycle (PLAN_ORCHESTRATOR.md, section 6.1, O0-02).
3
+ *
4
+ * The states and the moves between them are not written here: they are
5
+ * generated from `datalayer_core/orchestration/lifecycle.py`, which is the
6
+ * source of truth, and this module is the function that reads them. A
7
+ * mirror that restated the table would be a second place for it to be
8
+ * wrong, and the whole point of one state machine is that there is one.
9
+ *
10
+ * A browser observes; it does not decide. This is here so that a view can
11
+ * tell whether a control it is about to enable would be refused — a cancel
12
+ * button on a completed execution — without asking the control plane and
13
+ * without inventing an answer.
14
+ *
15
+ * @module api/orchestration/lifecycle
16
+ */
17
+ import { type ExecutionState, type LifecycleEvent, type LifecycleMoves } from './generated';
18
+ /** A move the lifecycle does not allow, refused rather than performed. */
19
+ export declare class InvalidTransitionError extends Error {
20
+ readonly current: ExecutionState;
21
+ readonly event: LifecycleEvent;
22
+ constructor(current: ExecutionState, event: LifecycleEvent);
23
+ }
24
+ /** The state of an execution that has been created and nothing more. */
25
+ export declare const INITIAL_STATE: ExecutionState;
26
+ /** The states from which nothing more happens. */
27
+ export declare const TERMINAL_STATES: ReadonlySet<ExecutionState>;
28
+ /** Whether nothing more happens from this state. */
29
+ export declare const isTerminal: (state: ExecutionState) => boolean;
30
+ /** Every event this state accepts, and where each one leads. */
31
+ export declare const movesFrom: (state: ExecutionState) => LifecycleMoves;
32
+ /** Whether the event applies to the state, without moving anything. */
33
+ export declare const canTransition: (current: ExecutionState, event: LifecycleEvent) => boolean;
34
+ /**
35
+ * The state this event leads to, or a refusal.
36
+ *
37
+ * @throws InvalidTransitionError - When the lifecycle does not allow the move.
38
+ */
39
+ export declare const transition: (current: ExecutionState, event: LifecycleEvent) => ExecutionState;
@@ -0,0 +1,57 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /**
6
+ * The canonical execution lifecycle (PLAN_ORCHESTRATOR.md, section 6.1, O0-02).
7
+ *
8
+ * The states and the moves between them are not written here: they are
9
+ * generated from `datalayer_core/orchestration/lifecycle.py`, which is the
10
+ * source of truth, and this module is the function that reads them. A
11
+ * mirror that restated the table would be a second place for it to be
12
+ * wrong, and the whole point of one state machine is that there is one.
13
+ *
14
+ * A browser observes; it does not decide. This is here so that a view can
15
+ * tell whether a control it is about to enable would be refused — a cancel
16
+ * button on a completed execution — without asking the control plane and
17
+ * without inventing an answer.
18
+ *
19
+ * @module api/orchestration/lifecycle
20
+ */
21
+ import { ORCHESTRATION_LIFECYCLE, } from './generated.js';
22
+ /** A move the lifecycle does not allow, refused rather than performed. */
23
+ export class InvalidTransitionError extends Error {
24
+ current;
25
+ event;
26
+ constructor(current, event) {
27
+ const reason = isTerminal(current)
28
+ ? 'it is terminal'
29
+ : 'that event does not apply there';
30
+ super(`An execution in '${current}' cannot take '${event}': ${reason}.`);
31
+ this.name = 'InvalidTransitionError';
32
+ this.current = current;
33
+ this.event = event;
34
+ }
35
+ }
36
+ /** The state of an execution that has been created and nothing more. */
37
+ export const INITIAL_STATE = ORCHESTRATION_LIFECYCLE.initial;
38
+ /** The states from which nothing more happens. */
39
+ export const TERMINAL_STATES = new Set(ORCHESTRATION_LIFECYCLE.terminal);
40
+ /** Whether nothing more happens from this state. */
41
+ export const isTerminal = (state) => TERMINAL_STATES.has(state);
42
+ /** Every event this state accepts, and where each one leads. */
43
+ export const movesFrom = (state) => ORCHESTRATION_LIFECYCLE.transitions[state];
44
+ /** Whether the event applies to the state, without moving anything. */
45
+ export const canTransition = (current, event) => movesFrom(current)[event] !== undefined;
46
+ /**
47
+ * The state this event leads to, or a refusal.
48
+ *
49
+ * @throws InvalidTransitionError - When the lifecycle does not allow the move.
50
+ */
51
+ export const transition = (current, event) => {
52
+ const next = movesFrom(current)[event];
53
+ if (next === undefined) {
54
+ throw new InvalidTransitionError(current, event);
55
+ }
56
+ return next;
57
+ };
@@ -0,0 +1,55 @@
1
+ import { type DashboardData, type DashboardDataOptions } from '../otel/dashboards';
2
+ /** The built-in dashboard the measures are read from. */
3
+ export declare const ORCHESTRATION_DASHBOARD = "orchestration";
4
+ /** The panels each measure is read from, by the dashboard's ids. */
5
+ export declare const ORCHESTRATION_PANELS: {
6
+ readonly afterDisconnect: "orchestration-executions-settled-by-state-where-recovery-disconnected";
7
+ readonly afterWorkerLost: "orchestration-executions-settled-by-state-where-recovery-worker_lost";
8
+ readonly delegations: "orchestration-delegations-by-outcome";
9
+ readonly artifacts: "orchestration-artifacts-by-outcome";
10
+ readonly acceptance: "orchestration-acceptance_seconds-by-protocol";
11
+ readonly firstWorkerEvent: "orchestration-first_worker_event_seconds-by-protocol";
12
+ readonly conformancePassed: "orchestration-conformance-scenarios-by-binding-where-outcome-passed";
13
+ readonly conformanceFailed: "orchestration-conformance-scenarios-by-binding-where-outcome-failed";
14
+ };
15
+ /** A part of a whole, and the rate when there is a whole to divide by. */
16
+ export interface Share {
17
+ part: number;
18
+ of: number;
19
+ /** `null` when nothing was counted, which is not the same as none. */
20
+ rate: number | null;
21
+ }
22
+ export interface OrchestrationMeasures {
23
+ /** Executions that lost sight of their worker, and how many completed. */
24
+ completedAfterDisconnect: Share;
25
+ /** Executions whose worker was lost, and how many completed anyway. */
26
+ completedAfterWorkerLost: Share;
27
+ /** Delegations, and how many repeated a command already received. */
28
+ duplicateDelegations: Share;
29
+ /** Artifacts a commit settled, and how many another attempt superseded. */
30
+ supersededArtifacts: Share;
31
+ /** Mean seconds from an execution's creation to its acceptance, by protocol. */
32
+ acceptanceSeconds: Record<string, number>;
33
+ /** Mean seconds from an execution's creation to its worker's first milestone, by protocol. */
34
+ firstWorkerEventSeconds: Record<string, number>;
35
+ /** Conformance scenarios run against each binding, and how many passed. */
36
+ conformance: Record<string, Share>;
37
+ /** The panels the service could not answer, by id, and why. */
38
+ unanswered: Record<string, string>;
39
+ }
40
+ /**
41
+ * The six measures, from the dashboard's answer.
42
+ *
43
+ * @param data - The orchestration dashboard, as `getDashboardData` returns it.
44
+ * @returns The measures, with the panels that did not answer named.
45
+ */
46
+ export declare const orchestrationMeasures: (data: DashboardData) => OrchestrationMeasures;
47
+ /**
48
+ * The six measures for the caller's account, or the one named.
49
+ *
50
+ * @param token - Authentication token.
51
+ * @param options - The window and the account to read as.
52
+ * @param otelUrl - The OTEL service.
53
+ * @returns The measures.
54
+ */
55
+ export declare const fetchOrchestrationMeasures: (token: string, options?: DashboardDataOptions, otelUrl?: string) => Promise<OrchestrationMeasures>;
@@ -0,0 +1,99 @@
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
+ * How delegated work is doing, read from the OTEL service's orchestration
11
+ * dashboard.
12
+ *
13
+ * Six measures: the share of executions that completed after losing sight
14
+ * of their worker, the share of delegations that were repeats and of
15
+ * artifacts that were superseded, the share that completed when the worker
16
+ * itself was lost, how long workers take to accept work and to report
17
+ * anything, and the share of the conformance scenarios each binding passes.
18
+ *
19
+ * The execution store records them wherever executions are held — the
20
+ * agents service, the durable service — under the account the executions
21
+ * belong to, and the service computes each panel from the series as they were
22
+ * exported. Nothing here adds metric points up: the panels arrive summarised,
23
+ * and this module only divides one panel's labels by another's. The panel ids
24
+ * are the dashboard's own, which a contract test in the OTEL service holds to
25
+ * the ones named here.
26
+ *
27
+ * @module api/orchestration/measures
28
+ */
29
+ import { DEFAULT_SERVICE_URLS } from '../constants.js';
30
+ import { getDashboardData, } from '../otel/dashboards.js';
31
+ /** The built-in dashboard the measures are read from. */
32
+ export const ORCHESTRATION_DASHBOARD = 'orchestration';
33
+ /** The panels each measure is read from, by the dashboard's ids. */
34
+ export const ORCHESTRATION_PANELS = {
35
+ afterDisconnect: 'orchestration-executions-settled-by-state-where-recovery-disconnected',
36
+ afterWorkerLost: 'orchestration-executions-settled-by-state-where-recovery-worker_lost',
37
+ delegations: 'orchestration-delegations-by-outcome',
38
+ artifacts: 'orchestration-artifacts-by-outcome',
39
+ acceptance: 'orchestration-acceptance_seconds-by-protocol',
40
+ firstWorkerEvent: 'orchestration-first_worker_event_seconds-by-protocol',
41
+ conformancePassed: 'orchestration-conformance-scenarios-by-binding-where-outcome-passed',
42
+ conformanceFailed: 'orchestration-conformance-scenarios-by-binding-where-outcome-failed',
43
+ };
44
+ const share = (part, of) => ({
45
+ part,
46
+ of,
47
+ rate: of > 0 ? part / of : null,
48
+ });
49
+ /**
50
+ * The six measures, from the dashboard's answer.
51
+ *
52
+ * @param data - The orchestration dashboard, as `getDashboardData` returns it.
53
+ * @returns The measures, with the panels that did not answer named.
54
+ */
55
+ export const orchestrationMeasures = (data) => {
56
+ const panels = new Map(data.panels.map(panel => [panel.id, panel]));
57
+ const unanswered = {};
58
+ const byLabel = (id) => {
59
+ const panel = panels.get(id);
60
+ if (!panel || panel.error) {
61
+ unanswered[id] = panel?.error ?? 'The dashboard has no such panel.';
62
+ return {};
63
+ }
64
+ return Object.fromEntries(panel.series
65
+ .filter(entry => entry.summary !== null)
66
+ .map(entry => [entry.label, entry.summary]));
67
+ };
68
+ const total = (values) => Object.values(values).reduce((sum, value) => sum + value, 0);
69
+ const afterDisconnect = byLabel(ORCHESTRATION_PANELS.afterDisconnect);
70
+ const afterWorkerLost = byLabel(ORCHESTRATION_PANELS.afterWorkerLost);
71
+ const delegations = byLabel(ORCHESTRATION_PANELS.delegations);
72
+ const artifacts = byLabel(ORCHESTRATION_PANELS.artifacts);
73
+ const passed = byLabel(ORCHESTRATION_PANELS.conformancePassed);
74
+ const failed = byLabel(ORCHESTRATION_PANELS.conformanceFailed);
75
+ const conformance = {};
76
+ for (const binding of new Set([...Object.keys(passed), ...Object.keys(failed)])) {
77
+ const ok = passed[binding] ?? 0;
78
+ conformance[binding] = share(ok, ok + (failed[binding] ?? 0));
79
+ }
80
+ return {
81
+ completedAfterDisconnect: share(afterDisconnect.completed ?? 0, total(afterDisconnect)),
82
+ completedAfterWorkerLost: share(afterWorkerLost.completed ?? 0, total(afterWorkerLost)),
83
+ duplicateDelegations: share(delegations.duplicate ?? 0, total(delegations)),
84
+ supersededArtifacts: share(artifacts.superseded ?? 0, total(artifacts)),
85
+ acceptanceSeconds: byLabel(ORCHESTRATION_PANELS.acceptance),
86
+ firstWorkerEventSeconds: byLabel(ORCHESTRATION_PANELS.firstWorkerEvent),
87
+ conformance,
88
+ unanswered,
89
+ };
90
+ };
91
+ /**
92
+ * The six measures for the caller's account, or the one named.
93
+ *
94
+ * @param token - Authentication token.
95
+ * @param options - The window and the account to read as.
96
+ * @param otelUrl - The OTEL service.
97
+ * @returns The measures.
98
+ */
99
+ export const fetchOrchestrationMeasures = async (token, options = {}, otelUrl = DEFAULT_SERVICE_URLS.OTEL) => orchestrationMeasures(await getDashboardData(token, ORCHESTRATION_DASHBOARD, options, otelUrl));
@@ -0,0 +1,56 @@
1
+ /** What one export of a series added, for a chart. */
2
+ export interface DashboardPoint {
3
+ /** Unix nanoseconds, which a JavaScript number holds only approximately. */
4
+ t: number;
5
+ v: number;
6
+ }
7
+ /** One label value of a panel: its series combined one way. */
8
+ export interface DashboardSeries {
9
+ label: string;
10
+ /** `null` when there was nothing to divide by, as for a duration never measured. */
11
+ summary: number | null;
12
+ /** How many series (processes, attribute sets) the summary combines. */
13
+ series: number;
14
+ points: DashboardPoint[];
15
+ }
16
+ /** One panel and its answer. */
17
+ export interface DashboardPanelData {
18
+ id: string;
19
+ title: string;
20
+ metric: string;
21
+ by: string | null;
22
+ where: Record<string, string>;
23
+ agg: string;
24
+ kind: string;
25
+ series: DashboardSeries[];
26
+ /** The limit cut the points a chart draws; the summaries are whole. */
27
+ points_truncated?: boolean;
28
+ /** Why the service could not answer this panel; the others still answer. */
29
+ error?: string;
30
+ }
31
+ /** A dashboard's every panel, answered under one account. */
32
+ export interface DashboardData {
33
+ success: boolean;
34
+ id: string;
35
+ title: string;
36
+ account_uid: string;
37
+ panels: DashboardPanelData[];
38
+ }
39
+ export interface DashboardDataOptions {
40
+ /** The window opens here; all of the retained history without it. */
41
+ since?: Date;
42
+ /** The window closes here; now without it. */
43
+ until?: Date;
44
+ /** Read as this organization or team rather than the caller. */
45
+ accountUid?: string;
46
+ }
47
+ /**
48
+ * Every panel of one dashboard, answered under the caller's account scope.
49
+ *
50
+ * @param token - Authentication token.
51
+ * @param dashboardId - A built-in dashboard's id, or one the account saved.
52
+ * @param options - The window and the account to read as.
53
+ * @param baseUrl - The OTEL service.
54
+ * @returns The panels and their summaries.
55
+ */
56
+ export declare const getDashboardData: (token: string, dashboardId: string, options?: DashboardDataOptions, baseUrl?: string) => Promise<DashboardData>;
@@ -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
+ * OTEL dashboards, read under an account.
11
+ *
12
+ * A panel's numbers come back computed by the OTEL service, which reads
13
+ * each series the way it was exported: a running total's increase over the
14
+ * window, a level's latest reading, a duration's total over its count.
15
+ * Services export counters as running totals, so adding raw metric points up
16
+ * counts every earlier report again; a view reads these summaries instead.
17
+ *
18
+ * @module api/otel/dashboards
19
+ */
20
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
21
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
22
+ import { validateToken } from '../utils/validation.js';
23
+ /** A date as the unix nanoseconds the service takes, spelled exactly. */
24
+ const nanoseconds = (date) => `${Math.floor(date.getTime())}000000`;
25
+ /**
26
+ * Every panel of one dashboard, answered under the caller's account scope.
27
+ *
28
+ * @param token - Authentication token.
29
+ * @param dashboardId - A built-in dashboard's id, or one the account saved.
30
+ * @param options - The window and the account to read as.
31
+ * @param baseUrl - The OTEL service.
32
+ * @returns The panels and their summaries.
33
+ */
34
+ export const getDashboardData = async (token, dashboardId, options = {}, baseUrl = DEFAULT_SERVICE_URLS.OTEL) => {
35
+ validateToken(token);
36
+ const params = new URLSearchParams();
37
+ if (options.since)
38
+ params.set('start', nanoseconds(options.since));
39
+ if (options.until)
40
+ params.set('end', nanoseconds(options.until));
41
+ if (options.accountUid)
42
+ params.set('account_uid', options.accountUid);
43
+ const queryString = params.toString();
44
+ const url = `${baseUrl}${API_BASE_PATHS.OTEL}/dashboards/${encodeURIComponent(dashboardId)}/data${queryString ? `?${queryString}` : ''}`;
45
+ return requestDatalayerAPI({
46
+ url,
47
+ method: 'GET',
48
+ token,
49
+ });
50
+ };
@@ -10,3 +10,4 @@ export * as metrics from './metrics';
10
10
  export * as logs from './logs';
11
11
  export * as services from './services';
12
12
  export * as query from './query';
13
+ export * as dashboards from './dashboards';
@@ -14,3 +14,4 @@ export * as metrics from './metrics.js';
14
14
  export * as logs from './logs.js';
15
15
  export * as services from './services.js';
16
16
  export * as query from './query.js';
17
+ export * as dashboards from './dashboards.js';
@@ -13,6 +13,22 @@ export declare const listMetrics: (token: string, options?: {
13
13
  serviceName?: string;
14
14
  limit?: number;
15
15
  }, baseUrl?: string) => Promise<ListMetricsResponse>;
16
+ /** One metric the OTEL service holds points of. */
17
+ export interface MetricName {
18
+ metric_name: string;
19
+ metric_type?: string;
20
+ metric_unit?: string;
21
+ }
22
+ /**
23
+ * The metrics the OTEL service holds points of, under the caller's account.
24
+ *
25
+ * @param token - Authentication token
26
+ * @param baseUrl - Base URL for the OTEL service
27
+ * @returns Promise resolving to the distinct metric names
28
+ */
29
+ export declare const listMetricNames: (token: string, baseUrl?: string) => Promise<{
30
+ data: MetricName[];
31
+ }>;
16
32
  /**
17
33
  * Query metric data points with filters.
18
34
  *
@@ -35,6 +35,21 @@ export const listMetrics = async (token, options = {}, baseUrl = DEFAULT_SERVICE
35
35
  token,
36
36
  });
37
37
  };
38
+ /**
39
+ * The metrics the OTEL service holds points of, under the caller's account.
40
+ *
41
+ * @param token - Authentication token
42
+ * @param baseUrl - Base URL for the OTEL service
43
+ * @returns Promise resolving to the distinct metric names
44
+ */
45
+ export const listMetricNames = async (token, baseUrl = DEFAULT_SERVICE_URLS.OTEL) => {
46
+ validateToken(token);
47
+ return requestDatalayerAPI({
48
+ url: `${baseUrl}${API_BASE_PATHS.OTEL}/metrics/names`,
49
+ method: 'GET',
50
+ token,
51
+ });
52
+ };
38
53
  /**
39
54
  * Query metric data points with filters.
40
55
  *
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The Scheduler API, one function per endpoint this UI uses.
3
+ *
4
+ * Paths mirror `datalayer_scheduler/api/v1/endpoints/schedules.py`. Only
5
+ * the routes a schedule's own management needs are wrapped here — the
6
+ * notebook-run reading and reporting routes `views/schedules/Schedules.tsx`
7
+ * already reaches directly stay as they are.
8
+ *
9
+ * @module api/scheduler/client
10
+ */
11
+ import { type SchedulerClientOptions } from './request';
12
+ import type { ScheduleListResponse, ScheduleResponse, ScheduleRunListResponse, UpdateScheduleRequest, UpsertScheduleRequest } from './types';
13
+ /** Every schedule the caller owns, `notebook` and `evalset` alike. */
14
+ export declare const listSchedules: (options: SchedulerClientOptions, query?: {
15
+ includeDisabled?: boolean;
16
+ }) => Promise<ScheduleListResponse>;
17
+ /** One schedule. */
18
+ export declare const getSchedule: (options: SchedulerClientOptions, scheduleUid: string) => Promise<ScheduleResponse>;
19
+ /**
20
+ * Create the one schedule a target has, or replace it (BENCHMARK.md, B2-16):
21
+ * a schedule is unique per owner and target, so upserting is how a person
22
+ * changes an `evalset` schedule's cron or configuration too.
23
+ */
24
+ export declare const upsertSchedule: (options: SchedulerClientOptions, body: UpsertScheduleRequest) => Promise<ScheduleResponse>;
25
+ /** Change a schedule's cron expression, preset or enabled flag. */
26
+ export declare const updateSchedule: (options: SchedulerClientOptions, scheduleUid: string, body: UpdateScheduleRequest) => Promise<ScheduleResponse>;
27
+ /** Turn a schedule off, without losing its cron and configuration. */
28
+ export declare const disableSchedule: (options: SchedulerClientOptions, scheduleUid: string) => Promise<ScheduleResponse>;
29
+ /** The runs of one schedule, newest first. */
30
+ export declare const listScheduleRuns: (options: SchedulerClientOptions, scheduleUid: string) => Promise<ScheduleRunListResponse>;
31
+ /** Every run of every schedule the caller owns, newest first. */
32
+ export declare const listAllScheduleRuns: (options: SchedulerClientOptions) => Promise<ScheduleRunListResponse>;
@@ -0,0 +1,42 @@
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 Scheduler API, one function per endpoint this UI uses.
11
+ *
12
+ * Paths mirror `datalayer_scheduler/api/v1/endpoints/schedules.py`. Only
13
+ * the routes a schedule's own management needs are wrapped here — the
14
+ * notebook-run reading and reporting routes `views/schedules/Schedules.tsx`
15
+ * already reaches directly stay as they are.
16
+ *
17
+ * @module api/scheduler/client
18
+ */
19
+ import { schedulerRequest, scheduleSegment, } from './request.js';
20
+ /** Every schedule the caller owns, `notebook` and `evalset` alike. */
21
+ export const listSchedules = (options, query = {}) => schedulerRequest(options, '/schedules', {
22
+ query: { includeDisabled: query.includeDisabled },
23
+ });
24
+ /** One schedule. */
25
+ export const getSchedule = (options, scheduleUid) => schedulerRequest(options, `/schedules/${scheduleSegment(scheduleUid)}`);
26
+ /**
27
+ * Create the one schedule a target has, or replace it (BENCHMARK.md, B2-16):
28
+ * a schedule is unique per owner and target, so upserting is how a person
29
+ * changes an `evalset` schedule's cron or configuration too.
30
+ */
31
+ export const upsertSchedule = (options, body) => schedulerRequest(options, '/schedules', {
32
+ method: 'POST',
33
+ body,
34
+ });
35
+ /** Change a schedule's cron expression, preset or enabled flag. */
36
+ export const updateSchedule = (options, scheduleUid, body) => schedulerRequest(options, `/schedules/${scheduleSegment(scheduleUid)}`, { method: 'PUT', body });
37
+ /** Turn a schedule off, without losing its cron and configuration. */
38
+ export const disableSchedule = (options, scheduleUid) => schedulerRequest(options, `/schedules/${scheduleSegment(scheduleUid)}/disable`, { method: 'POST' });
39
+ /** The runs of one schedule, newest first. */
40
+ export const listScheduleRuns = (options, scheduleUid) => schedulerRequest(options, `/schedules/${scheduleSegment(scheduleUid)}/runs`);
41
+ /** Every run of every schedule the caller owns, newest first. */
42
+ export const listAllScheduleRuns = (options) => schedulerRequest(options, '/schedules/runs');
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The Scheduler API: what runs on a cron, and what it produced.
3
+ *
4
+ * @module api/scheduler
5
+ */
6
+ export * from './types';
7
+ export * from './request';
8
+ export * from './client';
@@ -0,0 +1,16 @@
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 Scheduler API: what runs on a cron, and what it produced.
11
+ *
12
+ * @module api/scheduler
13
+ */
14
+ export * from './types.js';
15
+ export * from './request.js';
16
+ export * from './client.js';
@@ -0,0 +1,28 @@
1
+ /** What every Scheduler call needs to know. */
2
+ export interface SchedulerClientOptions {
3
+ /** The Scheduler service origin, e.g. `https://prod1.datalayer.run`. */
4
+ baseUrl?: string;
5
+ /** The caller's IAM token. */
6
+ token?: string;
7
+ }
8
+ export type SchedulerQuery = Record<string, string | number | boolean | undefined | null>;
9
+ export interface SchedulerRequestInit {
10
+ method?: 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
11
+ body?: unknown;
12
+ query?: SchedulerQuery;
13
+ signal?: AbortSignal;
14
+ }
15
+ /** The Scheduler origin, with no trailing slash. */
16
+ export declare const schedulerOrigin: (baseUrl?: string) => string;
17
+ /**
18
+ * A full URL under `/api/scheduler/v1`, with the query merged in. Empty,
19
+ * null and undefined values are left out.
20
+ */
21
+ export declare const schedulerUrl: (options: SchedulerClientOptions, path: string, query?: SchedulerQuery) => string;
22
+ /**
23
+ * One request to the Scheduler service, `path` relative to
24
+ * `/api/scheduler/v1`.
25
+ */
26
+ export declare const schedulerRequest: <T>(options: SchedulerClientOptions, path: string, init?: SchedulerRequestInit) => Promise<T>;
27
+ /** A path segment, encoded once. */
28
+ export declare const scheduleSegment: (value: string) => string;