@datalayer/core 1.1.66 → 1.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/README.md +41 -18
  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/connectedAgents.d.ts +29 -0
  21. package/lib/api/iam/connectedAgents.js +35 -0
  22. package/lib/api/iam/identityProviders.d.ts +76 -0
  23. package/lib/api/iam/identityProviders.js +187 -0
  24. package/lib/api/iam/index.d.ts +1 -0
  25. package/lib/api/iam/index.js +1 -0
  26. package/lib/api/iam/mcpPolicy.d.ts +102 -1
  27. package/lib/api/iam/mcpPolicy.js +38 -2
  28. package/lib/api/iam/profile.d.ts +17 -1
  29. package/lib/api/iam/profile.js +27 -0
  30. package/lib/api/iam/scimTokens.d.ts +79 -0
  31. package/lib/api/iam/scimTokens.js +141 -0
  32. package/lib/api/iam/secrets.js +9 -21
  33. package/lib/api/iam/trials.d.ts +38 -0
  34. package/lib/api/iam/trials.js +66 -0
  35. package/lib/api/index.d.ts +4 -0
  36. package/lib/api/index.js +4 -0
  37. package/lib/api/mcp/observability.d.ts +25 -9
  38. package/lib/api/mcp/observability.js +63 -50
  39. package/lib/api/orchestration/client.d.ts +53 -0
  40. package/lib/api/orchestration/client.js +105 -0
  41. package/lib/api/orchestration/events.d.ts +88 -0
  42. package/lib/api/orchestration/events.js +245 -0
  43. package/lib/api/orchestration/generated.d.ts +693 -0
  44. package/lib/api/orchestration/generated.js +687 -0
  45. package/lib/api/orchestration/index.d.ts +30 -0
  46. package/lib/api/orchestration/index.js +34 -0
  47. package/lib/api/orchestration/lifecycle.d.ts +39 -0
  48. package/lib/api/orchestration/lifecycle.js +57 -0
  49. package/lib/api/orchestration/measures.d.ts +55 -0
  50. package/lib/api/orchestration/measures.js +99 -0
  51. package/lib/api/otel/dashboards.d.ts +56 -0
  52. package/lib/api/otel/dashboards.js +50 -0
  53. package/lib/api/otel/index.d.ts +1 -0
  54. package/lib/api/otel/index.js +1 -0
  55. package/lib/api/otel/metrics.d.ts +16 -0
  56. package/lib/api/otel/metrics.js +15 -0
  57. package/lib/api/scheduler/client.d.ts +32 -0
  58. package/lib/api/scheduler/client.js +42 -0
  59. package/lib/api/scheduler/index.d.ts +8 -0
  60. package/lib/api/scheduler/index.js +16 -0
  61. package/lib/api/scheduler/request.d.ts +28 -0
  62. package/lib/api/scheduler/request.js +50 -0
  63. package/lib/api/scheduler/types.d.ts +88 -0
  64. package/lib/api/scheduler/types.js +5 -0
  65. package/lib/api/spacer/comments.d.ts +97 -0
  66. package/lib/api/spacer/comments.js +45 -0
  67. package/lib/api/spacer/index.d.ts +9 -0
  68. package/lib/api/spacer/index.js +17 -0
  69. package/lib/api/spacer/notebooks.d.ts +33 -0
  70. package/lib/api/spacer/notebooks.js +39 -0
  71. package/lib/api/spacer/request.d.ts +25 -0
  72. package/lib/api/spacer/request.js +46 -0
  73. package/lib/api/spacer/spaces.d.ts +68 -0
  74. package/lib/api/spacer/spaces.js +45 -0
  75. package/lib/api/utils/validation.d.ts +4 -4
  76. package/lib/api/utils/validation.js +10 -7
  77. package/lib/client/constants.d.ts +1 -0
  78. package/lib/client/constants.js +1 -0
  79. package/lib/components/animation/AnimatedText.d.ts +1 -44
  80. package/lib/components/animation/AnimatedText.js +6 -122
  81. package/lib/components/anonymous/AnonymousKeyExpired.d.ts +56 -0
  82. package/lib/components/anonymous/AnonymousKeyExpired.js +96 -0
  83. package/lib/components/anonymous/AnonymousKeyTimer.d.ts +63 -0
  84. package/lib/components/anonymous/AnonymousKeyTimer.js +140 -0
  85. package/lib/components/anonymous/index.d.ts +7 -0
  86. package/lib/components/anonymous/index.js +15 -0
  87. package/lib/components/avatars/UserAvatar.d.ts +7 -1
  88. package/lib/components/avatars/UserAvatar.js +15 -1
  89. package/lib/components/billing/BillingEntitySelect.d.ts +6 -0
  90. package/lib/components/billing/BillingEntitySelect.js +49 -10
  91. package/lib/components/billing/eligibility.d.ts +22 -0
  92. package/lib/components/billing/eligibility.js +27 -0
  93. package/lib/components/billing/index.d.ts +1 -0
  94. package/lib/components/billing/index.js +1 -0
  95. package/lib/components/collaboration/LiveEditorCollaborators.d.ts +5 -0
  96. package/lib/components/collaboration/LiveEditorCollaborators.js +3 -1
  97. package/lib/components/display/DatalayerBox.d.ts +2 -3
  98. package/lib/components/display/DatalayerBox.js +1 -1
  99. package/lib/components/display/NavLink.js +3 -2
  100. package/lib/components/labels/StatusLabels.d.ts +2 -10
  101. package/lib/components/labels/StatusLabels.js +2 -26
  102. package/lib/components/principal/PrincipalAppearance.d.ts +21 -42
  103. package/lib/components/principal/PrincipalAppearance.js +232 -174
  104. package/lib/components/principal/PrincipalAvatar.d.ts +8 -1
  105. package/lib/components/principal/PrincipalAvatar.js +2 -2
  106. package/lib/components/principal/PrincipalDetailsOverlay.d.ts +8 -1
  107. package/lib/components/principal/PrincipalDetailsOverlay.js +2 -2
  108. package/lib/components/screencapture/Screencapture.js +46 -3
  109. package/lib/components/sharing/ShareAccessComponent.d.ts +45 -4
  110. package/lib/components/sharing/ShareAccessComponent.js +110 -78
  111. package/lib/components/sharing/SharingEditor.d.ts +5 -1
  112. package/lib/components/sharing/SharingEditor.js +9 -4
  113. package/lib/components/sharing/index.d.ts +1 -0
  114. package/lib/components/sharing/index.js +1 -0
  115. package/lib/components/sharing/sandboxSharing.d.ts +26 -0
  116. package/lib/components/sharing/sandboxSharing.js +41 -0
  117. package/lib/components/spaces/SpaceDetailsOverlay.d.ts +39 -0
  118. package/lib/components/spaces/SpaceDetailsOverlay.js +80 -0
  119. package/lib/components/spaces/SpaceDisplay.d.ts +38 -0
  120. package/lib/components/spaces/SpaceDisplay.js +92 -0
  121. package/lib/components/spaces/index.d.ts +4 -0
  122. package/lib/components/spaces/index.js +7 -0
  123. package/lib/components/spaces/spaceDisplayModel.d.ts +93 -0
  124. package/lib/components/spaces/spaceDisplayModel.js +170 -0
  125. package/lib/hooks/cacheConverters.d.ts +0 -7
  126. package/lib/hooks/cacheConverters.js +0 -25
  127. package/lib/hooks/index.d.ts +1 -0
  128. package/lib/hooks/index.js +1 -0
  129. package/lib/hooks/useBillingEntityStore.js +3 -0
  130. package/lib/hooks/useCache.d.ts +168 -25
  131. package/lib/hooks/useCache.js +1424 -307
  132. package/lib/hooks/useContents.d.ts +22 -1
  133. package/lib/hooks/useContents.js +90 -21
  134. package/lib/hooks/useMcp.d.ts +87 -1
  135. package/lib/hooks/useMcp.js +247 -12
  136. package/lib/hooks/useNavigate.d.ts +41 -3
  137. package/lib/hooks/useNavigate.js +106 -52
  138. package/lib/hooks/usePrincipalCacheStore.js +3 -0
  139. package/lib/hooks/usePrincipalStore.js +3 -0
  140. package/lib/hooks/useSpaceCacheStore.d.ts +50 -0
  141. package/lib/hooks/useSpaceCacheStore.js +85 -0
  142. package/lib/models/CreditsDTO.d.ts +6 -5
  143. package/lib/models/CreditsDTO.js +7 -5
  144. package/lib/models/McpBinding.d.ts +6 -0
  145. package/lib/models/Organization.d.ts +69 -0
  146. package/lib/models/Organization.js +96 -0
  147. package/lib/models/Secret.d.ts +1 -2
  148. package/lib/models/Secret.js +2 -18
  149. package/lib/models/StartedBy.d.ts +34 -0
  150. package/lib/models/StartedBy.js +36 -0
  151. package/lib/models/Team.d.ts +2 -0
  152. package/lib/models/Team.js +2 -0
  153. package/lib/models/User.d.ts +4 -0
  154. package/lib/models/User.js +3 -0
  155. package/lib/models/UserSettings.d.ts +13 -0
  156. package/lib/models/UserSettings.js +9 -0
  157. package/lib/models/contents/__fixtures__/v1-contracts.json +158 -30
  158. package/lib/navigation/components.js +2 -3
  159. package/lib/routes/publicPaths.js +4 -0
  160. package/lib/state/index.d.ts +1 -0
  161. package/lib/state/index.js +1 -0
  162. package/lib/state/sessionEnd.d.ts +55 -0
  163. package/lib/state/sessionEnd.js +162 -0
  164. package/lib/state/substates/CoreState.js +3 -3
  165. package/lib/state/substates/IAMState.js +7 -0
  166. package/lib/state/substates/LayoutState.js +12 -0
  167. package/lib/state/substates/ProfileState.d.ts +1 -0
  168. package/lib/state/substates/ProfileState.js +1 -0
  169. package/lib/utils/Lazy.d.ts +20 -0
  170. package/lib/utils/Lazy.js +32 -6
  171. package/lib/utils/Screencapture.js +3 -0
  172. package/lib/utils/WithSuspense.d.ts +11 -1
  173. package/lib/utils/WithSuspense.js +11 -1
  174. package/lib/views/mcp/AdmittedClients.d.ts +44 -0
  175. package/lib/views/mcp/AdmittedClients.js +59 -0
  176. package/lib/views/mcp/ApprovalQueue.d.ts +66 -0
  177. package/lib/views/mcp/ApprovalQueue.js +95 -0
  178. package/lib/views/mcp/ConnectedAgents.js +38 -3
  179. package/lib/views/mcp/EnterpriseConsole.d.ts +1 -1
  180. package/lib/views/mcp/EnterpriseConsole.js +23 -1
  181. package/lib/views/mcp/IdentityProviders.d.ts +33 -0
  182. package/lib/views/mcp/IdentityProviders.js +299 -0
  183. package/lib/views/mcp/McpDashboard.js +90 -7
  184. package/lib/views/mcp/McpObservability.d.ts +30 -1
  185. package/lib/views/mcp/McpObservability.js +105 -19
  186. package/lib/views/mcp/NotebookRuns.d.ts +39 -0
  187. package/lib/views/mcp/NotebookRuns.js +44 -0
  188. package/lib/views/mcp/OrganizationPolicy.js +2 -1
  189. package/lib/views/mcp/PersonalPolicy.js +2 -1
  190. package/lib/views/mcp/PolicyForm.d.ts +17 -1
  191. package/lib/views/mcp/PolicyForm.js +25 -3
  192. package/lib/views/mcp/PolicyHistory.d.ts +13 -0
  193. package/lib/views/mcp/PolicyHistory.js +14 -1
  194. package/lib/views/mcp/RunDetail.d.ts +87 -0
  195. package/lib/views/mcp/RunDetail.js +186 -0
  196. package/lib/views/mcp/ScimProvisioning.d.ts +54 -0
  197. package/lib/views/mcp/ScimProvisioning.js +173 -0
  198. package/lib/views/mcp/TeamPolicies.js +66 -5
  199. package/lib/views/mcp/ToolAccess.d.ts +60 -0
  200. package/lib/views/mcp/ToolAccess.js +101 -0
  201. package/lib/views/mcp/TraceTimeline.d.ts +81 -0
  202. package/lib/views/mcp/TraceTimeline.js +132 -0
  203. package/lib/views/mcp/index.d.ts +5 -0
  204. package/lib/views/mcp/index.js +5 -0
  205. package/lib/views/otel/simpleAuthStore.js +3 -0
  206. package/lib/views/secrets/SecretEdit.js +3 -2
  207. package/lib/views/secrets/SecretNew.js +5 -1
  208. package/package.json +269 -264
  209. package/scripts/generate-mcp-types.py +1 -1
  210. package/scripts/generate-orchestration-types.py +920 -0
@@ -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
+ * How the Scheduler API is reached.
11
+ *
12
+ * The origin, the `/api/scheduler/v1` prefix and the caller's credential in
13
+ * one place, as `api/evals/request` holds them for the AI Agents service.
14
+ *
15
+ * @module api/scheduler/request
16
+ */
17
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
18
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
19
+ /** The Scheduler origin, with no trailing slash. */
20
+ export const schedulerOrigin = (baseUrl) => String(baseUrl || DEFAULT_SERVICE_URLS.SCHEDULER)
21
+ .trim()
22
+ .replace(/\/+$/, '');
23
+ /**
24
+ * A full URL under `/api/scheduler/v1`, with the query merged in. Empty,
25
+ * null and undefined values are left out.
26
+ */
27
+ export const schedulerUrl = (options, path, query = {}) => {
28
+ const [pathname, inlineSearch = ''] = path.split('?');
29
+ const parameters = new URLSearchParams(inlineSearch);
30
+ for (const [key, value] of Object.entries(query)) {
31
+ if (value !== undefined && value !== null && value !== '') {
32
+ parameters.set(key, String(value));
33
+ }
34
+ }
35
+ const search = parameters.toString();
36
+ return `${schedulerOrigin(options.baseUrl)}${API_BASE_PATHS.SCHEDULER}${pathname}${search ? `?${search}` : ''}`;
37
+ };
38
+ /**
39
+ * One request to the Scheduler service, `path` relative to
40
+ * `/api/scheduler/v1`.
41
+ */
42
+ export const schedulerRequest = (options, path, init = {}) => requestDatalayerAPI({
43
+ url: schedulerUrl(options, path, init.query),
44
+ method: init.method ?? 'GET',
45
+ body: init.body,
46
+ token: options.token,
47
+ signal: init.signal,
48
+ });
49
+ /** A path segment, encoded once. */
50
+ export const scheduleSegment = (value) => encodeURIComponent(String(value ?? '').trim());
@@ -0,0 +1,88 @@
1
+ /**
2
+ * The Scheduler API's own shapes.
3
+ *
4
+ * A schedule and a schedule run are Solr documents the service answers
5
+ * as they are stored — field suffixes and all — rather than a projection:
6
+ * `views/schedules/Schedules.tsx` has always read them this way, and these
7
+ * types describe that wire shape rather than inventing a cleaner one the
8
+ * service does not actually send.
9
+ *
10
+ * @module api/scheduler/types
11
+ */
12
+ /** What a schedule runs. `notebook` is every schedule from before B2-16. */
13
+ export type ScheduleTargetKind = 'notebook' | 'evalset';
14
+ /** One schedule, as the service answers it. */
15
+ export interface ScheduleRecord {
16
+ uid: string;
17
+ owner_uid_s: string;
18
+ owner_handle_s?: string;
19
+ owner_display_name_s?: string;
20
+ principal_kind_s?: string;
21
+ billing_entity_uid_s?: string;
22
+ target_kind_s: ScheduleTargetKind | string;
23
+ /** The evalset id or, for a notebook schedule, the notebook uid. */
24
+ target_uid_s: string;
25
+ /** Set only for a notebook schedule. */
26
+ notebook_uid_s?: string;
27
+ cron_expression_s: string;
28
+ preset_s: string;
29
+ enabled_b: boolean;
30
+ /** What the target is run with, as JSON text — parse with `scheduleConfigOf`. */
31
+ config_json_t?: string;
32
+ next_planned_ts_dt?: string;
33
+ creation_ts_dt?: string;
34
+ last_update_ts_dt?: string;
35
+ }
36
+ /** What an `evalset` schedule's `config_json_t` holds (BENCHMARK.md, B2-16). */
37
+ export interface EvalsetScheduleConfig {
38
+ /** Empty means every live experiment of the evalset, resolved at run time. */
39
+ experiment_ids?: string[];
40
+ run_mode?: 'batch' | 'interactive';
41
+ config?: Record<string, unknown>;
42
+ }
43
+ export type ScheduleRunState = 'planned' | 'running' | 'dispatched' | 'executed' | 'executed_with_failure' | 'failed';
44
+ /** One run of a schedule, as the service answers it. */
45
+ export interface ScheduleRunRecord {
46
+ uid: string;
47
+ schedule_uid_s: string;
48
+ owner_uid_s: string;
49
+ target_kind_s: ScheduleTargetKind | string;
50
+ target_uid_s: string;
51
+ notebook_uid_s?: string;
52
+ state_s: ScheduleRunState | string;
53
+ success_b?: boolean | null;
54
+ result_s?: string;
55
+ planned_ts_dt?: string;
56
+ executed_ts_dt?: string;
57
+ last_update_ts_dt?: string;
58
+ }
59
+ export interface ScheduleListResponse {
60
+ success: boolean;
61
+ message: string;
62
+ schedules: ScheduleRecord[];
63
+ }
64
+ export interface ScheduleResponse {
65
+ success: boolean;
66
+ message: string;
67
+ schedule: ScheduleRecord;
68
+ }
69
+ export interface ScheduleRunListResponse {
70
+ success: boolean;
71
+ message: string;
72
+ runs: ScheduleRunRecord[];
73
+ }
74
+ /** `POST /schedules`: create, or replace the one schedule a target has. */
75
+ export interface UpsertScheduleRequest {
76
+ targetUid: string;
77
+ targetKind?: ScheduleTargetKind;
78
+ cronExpression: string;
79
+ preset?: string;
80
+ enabled?: boolean;
81
+ config?: EvalsetScheduleConfig;
82
+ }
83
+ /** `PUT /schedules/{uid}`: change one field or more of an existing schedule. */
84
+ export interface UpdateScheduleRequest {
85
+ cronExpression?: string;
86
+ preset?: string;
87
+ enabled?: boolean;
88
+ }
@@ -0,0 +1,5 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ export {};
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Comments on documents and notebooks (BENCHMARK.md, B4-01).
3
+ *
4
+ * A thread is its first comment, about one anchor — the highlighted text, a
5
+ * report's evidence block, a cell, a task, a data point — and a reply names
6
+ * its thread. The comments of an item are read and written on the item's
7
+ * route, changed and settled on the comment's, and followed on a websocket
8
+ * that says `subscribed` once it listens and then each comment written.
9
+ *
10
+ * @module api/spacer/comments
11
+ */
12
+ import { type SpacerClientOptions } from './request';
13
+ export type CommentItemType = 'lexical' | 'notebook';
14
+ export type CommentAnchorKind = 'mark_id' | 'block_id' | 'cell_id' | 'case_id' | 'datum';
15
+ /** What a thread is about: exactly one kind. */
16
+ export type CommentAnchor = Partial<Record<CommentAnchorKind, string>>;
17
+ export type CommentStatus = 'open' | 'resolved';
18
+ export interface SpacerComment {
19
+ uid: string;
20
+ item_uid: string;
21
+ item_type: CommentItemType;
22
+ /** The uid of the thread's first comment; that comment's own. */
23
+ thread_uid: string;
24
+ /** A thread's; `null` on a reply. */
25
+ anchor: CommentAnchor | null;
26
+ quote: string | null;
27
+ /** Empty once deleted. */
28
+ body: string;
29
+ author: SpacerCommentPerson;
30
+ mentions: string[];
31
+ /** A thread's; `null` on a reply and on a thread nobody is assigned. */
32
+ assignee: SpacerCommentPerson | null;
33
+ /** The page a thread is read on; `null` on a reply. */
34
+ link: string | null;
35
+ /** A thread's; `null` on a reply. */
36
+ status: CommentStatus | null;
37
+ resolution: string | null;
38
+ resolved_by_uid: string | null;
39
+ resolved_at: string | null;
40
+ deleted: boolean;
41
+ created_at: string;
42
+ updated_at: string;
43
+ }
44
+ /** Somebody a comment names: its author, a thread's assignee. */
45
+ export interface SpacerCommentPerson {
46
+ uid: string;
47
+ handle: string | null;
48
+ name: string | null;
49
+ /** On an author: the agent that wrote the comment for them, when one did. */
50
+ agent_uid?: string;
51
+ }
52
+ export interface AddCommentRequest {
53
+ body: string;
54
+ /** A new thread's. */
55
+ anchor?: CommentAnchor;
56
+ quote?: string;
57
+ /**
58
+ * The page a new thread is read on, a path of the app: where a mention or
59
+ * an assignment sends the person it names.
60
+ */
61
+ link?: string;
62
+ /** A reply's thread. */
63
+ thread_uid?: string;
64
+ mentions?: string[];
65
+ assignee_uid?: string;
66
+ }
67
+ /** What is named changes; `assignee_uid: null` unassigns. */
68
+ export interface UpdateCommentRequest {
69
+ body?: string;
70
+ mentions?: string[];
71
+ assignee_uid?: string | null;
72
+ deleted?: true;
73
+ }
74
+ export interface CommentsResponse {
75
+ success: boolean;
76
+ comments: SpacerComment[];
77
+ }
78
+ export interface CommentResponse {
79
+ success: boolean;
80
+ comment: SpacerComment;
81
+ }
82
+ export type CommentsChannelMessage = {
83
+ type: 'subscribed';
84
+ item_uid: string;
85
+ } | {
86
+ type: 'comment';
87
+ comment: SpacerComment;
88
+ };
89
+ /** An item's comments in the order written, deleted ones in their place. */
90
+ export declare const listComments: (options: SpacerClientOptions, itemType: CommentItemType, itemUid: string, status?: CommentStatus) => Promise<CommentsResponse>;
91
+ /** Open a thread on an item, or reply in one of its threads. */
92
+ export declare const addComment: (options: SpacerClientOptions, itemType: CommentItemType, itemUid: string, body: AddCommentRequest) => Promise<CommentResponse>;
93
+ export declare const updateComment: (options: SpacerClientOptions, uid: string, body: UpdateCommentRequest) => Promise<CommentResponse>;
94
+ export declare const resolveComment: (options: SpacerClientOptions, uid: string, resolution?: string) => Promise<CommentResponse>;
95
+ export declare const reopenComment: (options: SpacerClientOptions, uid: string) => Promise<CommentResponse>;
96
+ /** The websocket an item's comments are followed on, carrying the token. */
97
+ export declare const commentsChannelUrl: (options: SpacerClientOptions, itemUid: string) => string;
@@ -0,0 +1,45 @@
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
+ * Comments on documents and notebooks (BENCHMARK.md, B4-01).
11
+ *
12
+ * A thread is its first comment, about one anchor — the highlighted text, a
13
+ * report's evidence block, a cell, a task, a data point — and a reply names
14
+ * its thread. The comments of an item are read and written on the item's
15
+ * route, changed and settled on the comment's, and followed on a websocket
16
+ * that says `subscribed` once it listens and then each comment written.
17
+ *
18
+ * @module api/spacer/comments
19
+ */
20
+ import { spacerRequest, spacerSegment, spacerUrl, } from './request.js';
21
+ const itemComments = (itemType, itemUid) => `/${itemType === 'lexical' ? 'lexicals' : 'notebooks'}/${spacerSegment(itemUid)}/comments`;
22
+ /** An item's comments in the order written, deleted ones in their place. */
23
+ export const listComments = (options, itemType, itemUid, status) => spacerRequest(options, itemComments(itemType, itemUid), {
24
+ query: { status },
25
+ });
26
+ /** Open a thread on an item, or reply in one of its threads. */
27
+ export const addComment = (options, itemType, itemUid, body) => spacerRequest(options, itemComments(itemType, itemUid), {
28
+ method: 'POST',
29
+ body,
30
+ });
31
+ export const updateComment = (options, uid, body) => spacerRequest(options, `/comments/${spacerSegment(uid)}`, {
32
+ method: 'PATCH',
33
+ body,
34
+ });
35
+ export const resolveComment = (options, uid, resolution) => spacerRequest(options, `/comments/${spacerSegment(uid)}/resolve`, {
36
+ method: 'POST',
37
+ body: resolution ? { resolution } : {},
38
+ });
39
+ export const reopenComment = (options, uid) => spacerRequest(options, `/comments/${spacerSegment(uid)}/reopen`, {
40
+ method: 'POST',
41
+ });
42
+ /** The websocket an item's comments are followed on, carrying the token. */
43
+ export const commentsChannelUrl = (options, itemUid) => spacerUrl(options, `/comments/ws/${spacerSegment(itemUid)}`, {
44
+ token: options.token,
45
+ }).replace(/^http/, 'ws');
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The Spacer API: documents, notebooks and what is said about them.
3
+ *
4
+ * @module api/spacer
5
+ */
6
+ export * from './request';
7
+ export * from './comments';
8
+ export * from './spaces';
9
+ export * from './notebooks';
@@ -0,0 +1,17 @@
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 Spacer API: documents, notebooks and what is said about them.
11
+ *
12
+ * @module api/spacer
13
+ */
14
+ export * from './request.js';
15
+ export * from './comments.js';
16
+ export * from './spaces.js';
17
+ export * from './notebooks.js';
@@ -0,0 +1,33 @@
1
+ /**
2
+ * A notebook's content, read by its uid.
3
+ *
4
+ * What a view needs when it shows a notebook it did not open — the outputs of
5
+ * a notebook an agent produced, previewed in its execution's report — without
6
+ * starting an editor or a kernel.
7
+ *
8
+ * @module api/spacer/notebooks
9
+ */
10
+ import { type SpacerClientOptions } from './request';
11
+ /** One cell, as nbformat writes it. */
12
+ export interface NotebookCell {
13
+ cell_type: string;
14
+ source?: string | string[];
15
+ outputs?: Array<Record<string, unknown>>;
16
+ metadata?: Record<string, unknown>;
17
+ [key: string]: unknown;
18
+ }
19
+ /** A notebook, as nbformat writes it. */
20
+ export interface NotebookModel {
21
+ cells: NotebookCell[];
22
+ metadata?: Record<string, unknown>;
23
+ nbformat?: number;
24
+ nbformat_minor?: number;
25
+ }
26
+ /**
27
+ * The notebook's content, or `undefined` when Spacer holds none that parses.
28
+ *
29
+ * @param options - The Spacer origin and the caller's token.
30
+ * @param notebookUid - The notebook.
31
+ * @returns The notebook's model.
32
+ */
33
+ export declare const getNotebookModel: (options: SpacerClientOptions, notebookUid: string) => Promise<NotebookModel | undefined>;
@@ -0,0 +1,39 @@
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
+ * A notebook's content, read by its uid.
11
+ *
12
+ * What a view needs when it shows a notebook it did not open — the outputs of
13
+ * a notebook an agent produced, previewed in its execution's report — without
14
+ * starting an editor or a kernel.
15
+ *
16
+ * @module api/spacer/notebooks
17
+ */
18
+ import { spacerRequest, spacerSegment, } from './request.js';
19
+ /**
20
+ * The notebook's content, or `undefined` when Spacer holds none that parses.
21
+ *
22
+ * @param options - The Spacer origin and the caller's token.
23
+ * @param notebookUid - The notebook.
24
+ * @returns The notebook's model.
25
+ */
26
+ export const getNotebookModel = async (options, notebookUid) => {
27
+ const answer = await spacerRequest(options, `/notebooks/${spacerSegment(notebookUid)}`);
28
+ const raw = answer.notebook?.model_s;
29
+ if (!raw) {
30
+ return undefined;
31
+ }
32
+ try {
33
+ const parsed = JSON.parse(raw);
34
+ return parsed && Array.isArray(parsed.cells) ? parsed : undefined;
35
+ }
36
+ catch {
37
+ return undefined;
38
+ }
39
+ };
@@ -0,0 +1,25 @@
1
+ /** What every Spacer call needs to know. */
2
+ export interface SpacerClientOptions {
3
+ /** The Spacer service origin, e.g. `https://prod1.datalayer.run`. */
4
+ baseUrl?: string;
5
+ /** The caller's IAM token. */
6
+ token?: string;
7
+ }
8
+ export type SpacerQuery = Record<string, string | number | boolean | undefined | null>;
9
+ export interface SpacerRequestInit {
10
+ method?: 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
11
+ body?: unknown;
12
+ query?: SpacerQuery;
13
+ signal?: AbortSignal;
14
+ }
15
+ /** The Spacer origin, with no trailing slash. */
16
+ export declare const spacerOrigin: (baseUrl?: string) => string;
17
+ /**
18
+ * A full URL under `/api/spacer/v1`, with the query merged in. Empty, null
19
+ * and undefined values are left out.
20
+ */
21
+ export declare const spacerUrl: (options: SpacerClientOptions, path: string, query?: SpacerQuery) => string;
22
+ /** One request to Spacer, `path` relative to `/api/spacer/v1`. */
23
+ export declare const spacerRequest: <T>(options: SpacerClientOptions, path: string, init?: SpacerRequestInit) => Promise<T>;
24
+ /** A path segment, encoded once. */
25
+ export declare const spacerSegment: (value: string) => string;
@@ -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
+ * How the Spacer API is reached.
11
+ *
12
+ * The origin, the `/api/spacer/v1` prefix and the caller's credential in one
13
+ * place, as `api/evals/request` holds them for the AI Agents service.
14
+ *
15
+ * @module api/spacer/request
16
+ */
17
+ import { requestDatalayerAPI } from '../DatalayerApi.js';
18
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
19
+ /** The Spacer origin, with no trailing slash. */
20
+ export const spacerOrigin = (baseUrl) => String(baseUrl || DEFAULT_SERVICE_URLS.SPACER)
21
+ .trim()
22
+ .replace(/\/+$/, '');
23
+ /**
24
+ * A full URL under `/api/spacer/v1`, with the query merged in. Empty, null
25
+ * and undefined values are left out.
26
+ */
27
+ export const spacerUrl = (options, path, query = {}) => {
28
+ const parameters = new URLSearchParams();
29
+ for (const [key, value] of Object.entries(query)) {
30
+ if (value !== undefined && value !== null && value !== '') {
31
+ parameters.set(key, String(value));
32
+ }
33
+ }
34
+ const search = parameters.toString();
35
+ return `${spacerOrigin(options.baseUrl)}${API_BASE_PATHS.SPACER}${path}${search ? `?${search}` : ''}`;
36
+ };
37
+ /** One request to Spacer, `path` relative to `/api/spacer/v1`. */
38
+ export const spacerRequest = (options, path, init = {}) => requestDatalayerAPI({
39
+ url: spacerUrl(options, path, init.query),
40
+ method: init.method ?? 'GET',
41
+ body: init.body,
42
+ token: options.token,
43
+ signal: init.signal,
44
+ });
45
+ /** A path segment, encoded once. */
46
+ export const spacerSegment = (value) => encodeURIComponent(String(value ?? '').trim());
@@ -0,0 +1,68 @@
1
+ /**
2
+ * An account's managed spaces: the benchmarks space, where a launch's reports
3
+ * and evidence are written, and the orchestration space, where what agents
4
+ * produced for the account's executions is written.
5
+ *
6
+ * One of each per account — the person, or an organization or a team they
7
+ * belong to — made by Spacer on first use, following the account's membership
8
+ * and never offered in the create flow. The answer names the two path
9
+ * segments the app opens an object of the space under:
10
+ * `/{account_handle}/{handle}/documents/{uid}`.
11
+ *
12
+ * @module api/spacer/spaces
13
+ */
14
+ import { type SpacerClientOptions } from './request';
15
+ export type ManagedSpaceKind = 'benchmarks' | 'orchestration';
16
+ export interface ManagedSpace {
17
+ uid: string;
18
+ id?: string;
19
+ handle: string;
20
+ name: string;
21
+ variant: string;
22
+ account_uid: string;
23
+ account_type: 'user' | 'organization' | 'team';
24
+ /** The handle of the account the space belongs to, as the app's paths start. */
25
+ account_handle: string;
26
+ organization_uid?: string;
27
+ team_uid?: string;
28
+ }
29
+ /**
30
+ * An account's managed space of a kind, made by Spacer on first use.
31
+ *
32
+ * @param options - The Spacer origin and the caller's token.
33
+ * @param kind - `benchmarks` or `orchestration`.
34
+ * @param accountUid - The organization or team; the caller when omitted.
35
+ * @returns The space.
36
+ */
37
+ export declare const getManagedSpace: (options: SpacerClientOptions, kind: ManagedSpaceKind, accountUid?: string) => Promise<ManagedSpace>;
38
+ /** One item of somebody's workspace, as Spacer answers it. */
39
+ export interface WorkspaceItem {
40
+ uid: string;
41
+ type_s?: string;
42
+ name_t?: string;
43
+ description_t?: string;
44
+ notebook_name_s?: string;
45
+ document_name_s?: string;
46
+ creator_handle_s?: string;
47
+ space_uid?: string;
48
+ last_update_ts_dt?: string;
49
+ [key: string]: unknown;
50
+ }
51
+ export interface WorkspaceSearchResponse {
52
+ success: boolean;
53
+ message?: string;
54
+ items: WorkspaceItem[];
55
+ }
56
+ /**
57
+ * Search the caller's own workspace: notebooks, documents, datasets, files
58
+ * (BENCHMARKS.md, B5-11, section 19).
59
+ *
60
+ * Scoped by the service to what this person may open — never other people's
61
+ * public items, which the Library's own search answers. An empty query lists
62
+ * what the scope allows.
63
+ */
64
+ export declare const searchWorkspace: (options: SpacerClientOptions, query?: {
65
+ q?: string;
66
+ types?: string;
67
+ max?: number;
68
+ }) => Promise<WorkspaceSearchResponse>;
@@ -0,0 +1,45 @@
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
+ * An account's managed spaces: the benchmarks space, where a launch's reports
11
+ * and evidence are written, and the orchestration space, where what agents
12
+ * produced for the account's executions is written.
13
+ *
14
+ * One of each per account — the person, or an organization or a team they
15
+ * belong to — made by Spacer on first use, following the account's membership
16
+ * and never offered in the create flow. The answer names the two path
17
+ * segments the app opens an object of the space under:
18
+ * `/{account_handle}/{handle}/documents/{uid}`.
19
+ *
20
+ * @module api/spacer/spaces
21
+ */
22
+ import { spacerRequest, spacerSegment, } from './request.js';
23
+ /**
24
+ * An account's managed space of a kind, made by Spacer on first use.
25
+ *
26
+ * @param options - The Spacer origin and the caller's token.
27
+ * @param kind - `benchmarks` or `orchestration`.
28
+ * @param accountUid - The organization or team; the caller when omitted.
29
+ * @returns The space.
30
+ */
31
+ export const getManagedSpace = async (options, kind, accountUid) => {
32
+ const answer = await spacerRequest(options, `/spaces/${spacerSegment(kind)}`, { query: { account_uid: accountUid } });
33
+ return answer.space;
34
+ };
35
+ /**
36
+ * Search the caller's own workspace: notebooks, documents, datasets, files
37
+ * (BENCHMARKS.md, B5-11, section 19).
38
+ *
39
+ * Scoped by the service to what this person may open — never other people's
40
+ * public items, which the Library's own search answers. An empty query lists
41
+ * what the scope allows.
42
+ */
43
+ export const searchWorkspace = (options, query = {}) => spacerRequest(options, '/spaces/items/search', {
44
+ query,
45
+ });
@@ -15,7 +15,7 @@ export declare const validateToken: (token: string | undefined | null) => void;
15
15
  * @param paramName - The name of the parameter for error messages
16
16
  * @throws {Error} If the value is missing, null, or undefined
17
17
  */
18
- export declare const validateRequired: (value: any, paramName: string) => void;
18
+ export declare const validateRequired: (value: unknown, paramName: string) => void;
19
19
  /**
20
20
  * Validates that a string parameter is provided and not empty
21
21
  * @param value - The string value to validate
@@ -36,12 +36,12 @@ export declare const validateRequiredString: (value: string | undefined | null,
36
36
  * @example
37
37
  * ```typescript
38
38
  * const runtimeData = {
39
- * uid: 'abc123',
40
- * runtimeName: 'runtime-abc123',
39
+ * uid: '01m1dzmb1anqzp1v1ng97x7214',
40
+ * runtimeName: '01m1dzmb1anqzp1v1ng97x7214',
41
41
  * environmentName: undefined // This will throw
42
42
  * };
43
43
  * validateJSON(runtimeData, 'Runtime');
44
44
  * // Error: Runtime.toJSON(): Property 'environmentName' is undefined
45
45
  * ```
46
46
  */
47
- export declare const validateJSON: (obj: Record<string, any>, modelName: string, path?: string) => void;
47
+ export declare const validateJSON: (obj: object, modelName: string, path?: string) => void;
@@ -66,7 +66,7 @@ export const validateToken = (token) => {
66
66
  e.message === 'Invalid token format: Missing algorithm in JWT header') {
67
67
  throw e;
68
68
  }
69
- throw new Error('Invalid token format: JWT header is not valid base64-encoded JSON');
69
+ throw new Error('Invalid token format: JWT header is not valid base64-encoded JSON', { cause: e });
70
70
  }
71
71
  // Validate payload structure (should be valid base64url JSON)
72
72
  try {
@@ -103,7 +103,7 @@ export const validateToken = (token) => {
103
103
  e.message === 'Token is not yet valid')) {
104
104
  throw e;
105
105
  }
106
- throw new Error('Invalid token format: JWT payload is not valid base64-encoded JSON');
106
+ throw new Error('Invalid token format: JWT payload is not valid base64-encoded JSON', { cause: e });
107
107
  }
108
108
  // Signature part validation (just check it exists and has reasonable length)
109
109
  if (parts[2].length < 20) {
@@ -145,8 +145,8 @@ export const validateRequiredString = (value, paramName) => {
145
145
  * @example
146
146
  * ```typescript
147
147
  * const runtimeData = {
148
- * uid: 'abc123',
149
- * runtimeName: 'runtime-abc123',
148
+ * uid: '01m1dzmb1anqzp1v1ng97x7214',
149
+ * runtimeName: '01m1dzmb1anqzp1v1ng97x7214',
150
150
  * environmentName: undefined // This will throw
151
151
  * };
152
152
  * validateJSON(runtimeData, 'Runtime');
@@ -154,12 +154,15 @@ export const validateRequiredString = (value, paramName) => {
154
154
  * ```
155
155
  */
156
156
  export const validateJSON = (obj, modelName, path = '') => {
157
+ // Any object: a model's JSON is an interface without an index signature,
158
+ // and an interface is not a `Record` — it is read as one here.
159
+ const record = obj;
157
160
  // Iterate over all enumerable properties
158
- for (const key in obj) {
159
- if (!Object.prototype.hasOwnProperty.call(obj, key)) {
161
+ for (const key in record) {
162
+ if (!Object.prototype.hasOwnProperty.call(record, key)) {
160
163
  continue;
161
164
  }
162
- const value = obj[key];
165
+ const value = record[key];
163
166
  const currentPath = path ? `${path}.${key}` : key;
164
167
  // Check if value is undefined - this is the error case
165
168
  if (value === undefined) {
@@ -11,6 +11,7 @@
11
11
  export declare const ItemTypes: {
12
12
  readonly NOTEBOOK: "notebook";
13
13
  readonly LEXICAL: "document";
14
+ readonly DECK: "deck";
14
15
  readonly EXERCISE: "exercise";
15
16
  readonly CELL: "cell";
16
17
  readonly SPACE: "space";
@@ -15,6 +15,7 @@
15
15
  export const ItemTypes = {
16
16
  NOTEBOOK: 'notebook',
17
17
  LEXICAL: 'document',
18
+ DECK: 'deck',
18
19
  EXERCISE: 'exercise',
19
20
  CELL: 'cell',
20
21
  SPACE: 'space',