@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
package/README.md CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
  ## Overview
20
20
 
21
- Datalayer Core is the foundational package that powers the [Datalayer AI Platform](https://datalayer.ai). It provides TypeScript and Python packages as a Command Line Interface (CLI) for AI engineers, data scientists, and researchers to seamlessly integrate scalable compute runtimes into their workflows.
21
+ Datalayer Core is the foundational package that powers the [Datalayer AI Platform](https://datalayer.app/). It provides a TypesScript and Python packages as a Command Line Interface (CLI) for AI engineers, data scientists, and researchers to seamlessly integrate scalable compute runtimes into their workflows.
22
22
 
23
23
  This package serves as the base foundation used by many other Datalayer packages, containing core application classes, configuration, and unified APIs for authentication, runtime management, and code execution in cloud-based environments.
24
24
 
@@ -66,6 +66,8 @@ npm install
66
66
 
67
67
  ## Quick Start with Python
68
68
 
69
+ ### 1. Authentication
70
+
69
71
  Set your Datalayer token as an environment variable:
70
72
 
71
73
  ```bash
@@ -87,19 +89,31 @@ if client.authenticate():
87
89
  print("Successfully authenticated!")
88
90
  ```
89
91
 
90
- ## Architecture
92
+ ### 2. Runtime, Snapshots, and Evals
91
93
 
92
- Datalayer Core serves as the foundation for the entire Datalayer ecosystem:
94
+ Runtime execution, snapshot workflows, and evals CLI are now documented and maintained in:
93
95
 
94
- - **Base Classes**: Core application classes inherited by other Datalayer packages
95
- - **Configuration Management**: Centralized configuration system for all Datalayer components
96
- - **Authentication Layer**: Unified authentication across all Datalayer services
97
- - **Runtime Abstraction**: Common interface for different types of compute runtimes
98
- - **Resource Management**: Automatic cleanup and lifecycle management
96
+ - [agent-runtimes README](https://github.com/datalayer/agent-runtimes/blob/main/README.md)
97
+ - [agent-runtimes CLI docs](https://agent-runtimes.datalayer.tech/cli)
98
+
99
+ Use `agent-runtimes` for runtime workloads (`RuntimeClient`, `@datalayer`, snapshots, and evals), and use `datalayer-core` for account/platform operations (authentication, secrets, API keys, usage, profile).
99
100
 
100
101
  ## Examples
101
102
 
102
- - [OTEL example README](https://github.com/datalayer/core/blob/main/examples/otel/README.md)
103
+ Examples have moved to Agent Runtimes:
104
+
105
+ - [Agent Runtimes examples README](https://github.com/datalayer/agent-runtimes/blob/main/examples/README.md)
106
+ - [Agent Runtimes examples directory](https://github.com/datalayer/agent-runtimes/tree/main/examples)
107
+
108
+ ## Platform Integration
109
+
110
+ Datalayer adds AI capabilities and scalable compute runtimes to your development workflows. The platform is designed to seamlessly integrate into your existing processes and supercharge your computations with the processing power you need.
111
+
112
+ Key platform features accessible through this Client and CLI:
113
+
114
+ - **Remote Runtimes**: Execute code on powerful remote machines with CPU, RAM, and GPU resources
115
+ - **Multiple Interfaces**: Access and consume runtimes through Python Client, CLI, or other integrated tools
116
+ - **Scalable Compute**: Dynamically scale your computational resources based on workload requirements
103
117
 
104
118
  ## Documentation
105
119
 
@@ -179,6 +193,16 @@ This Client is designed to be simple and extensible. We welcome contributions! P
179
193
 
180
194
  For issues and enhancement requests, please use the [GitHub issue tracker](https://github.com/datalayer/core/issues).
181
195
 
196
+ ## Architecture
197
+
198
+ Datalayer Core serves as the foundation for the entire Datalayer ecosystem:
199
+
200
+ - **Base Classes**: Core application classes inherited by other Datalayer packages
201
+ - **Configuration Management**: Centralized configuration system for all Datalayer components
202
+ - **Authentication Layer**: Unified authentication across all Datalayer services
203
+ - **Runtime Abstraction**: Common interface for different types of compute runtimes
204
+ - **Resource Management**: Automatic cleanup and lifecycle management
205
+
182
206
  ## Use Cases
183
207
 
184
208
  - **AI/ML Development**: Scale your machine learning workflows with cloud compute using Client or CLI
@@ -195,16 +219,15 @@ This project is licensed under the [BSD 3-Clause License](https://github.com/dat
195
219
 
196
220
  - **Documentation**: [Datalayer Platform Documentation](https://datalayer.ai/docs/)
197
221
  - **Issues**: [GitHub Issues](https://github.com/datalayer/core/issues)
198
- - **Community**: [Datalayer Platform](https://datalayer.ai)
222
+ - **Community**: [Datalayer Platform](https://datalayer.app/)
199
223
 
200
224
  ---
201
225
 
202
- <div align="center">
203
-
204
- **If this project is helpful to you, please give us a ⭐️**
205
-
206
- Made with ❤️ by [Datalayer](https://datalayer.ai)
207
-
208
- <img src="https://assets.datalayer.tech/datalayer-25.svg" alt="Datalayer Logo" width="200"></img>
226
+ <p align="center">
227
+ <img src="https://assets.datalayer.tech/datalayer-25.svg" alt="Datalayer Logo" width="200"></img>
228
+ </p>
209
229
 
210
- </div>
230
+ <p align="center">
231
+ <strong>🚀 AI Agents for Data Analysis</strong><br></br>
232
+ <a href="https://datalayer.app/">Get started with Datalayer today!</a>
233
+ </p>
@@ -16,7 +16,7 @@ export declare const API_BASE_PATHS: {
16
16
  */
17
17
  export declare const DEFAULT_SERVICE_URLS: {
18
18
  /** Default URL for AI Agents (durable agent management) service */
19
- readonly AI_AGENTS: "https://prod1.datalayer.run";
19
+ readonly AI_AGENTS: "https://r1.datalayer.run";
20
20
  /**
21
21
  * Default URL for the Contents service.
22
22
  *
@@ -20,7 +20,7 @@ export const API_BASE_PATHS = {
20
20
  */
21
21
  export const DEFAULT_SERVICE_URLS = {
22
22
  /** Default URL for AI Agents (durable agent management) service */
23
- AI_AGENTS: 'https://prod1.datalayer.run',
23
+ AI_AGENTS: 'https://r1.datalayer.run',
24
24
  /**
25
25
  * Default URL for the Contents service.
26
26
  *
@@ -4,8 +4,7 @@
4
4
  */
5
5
  import { requestDatalayerAPI } from '../DatalayerApi.js';
6
6
  import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
7
- import { contentsToCamelCase, contentsToSnakeCase } from '../../models/contents/index.js';
8
- import { assertSandboxUid } from './sandboxUid.js';
7
+ import { contentsToCamelCase, contentsToSnakeCase, } from '../../models/contents/index.js';
9
8
  const convert = (value) => contentsToCamelCase(value);
10
9
  const url = (baseUrl, suffix = '') => `${baseUrl}${API_BASE_PATHS.CONTENTS}/attachments${suffix}`;
11
10
  export const createAttachment = async (token, request, idempotencyKey, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convert(await requestDatalayerAPI({
@@ -18,7 +17,7 @@ export const createAttachment = async (token, request, idempotencyKey, baseUrl =
18
17
  export const listAttachments = async (token, options = {}, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => {
19
18
  const parameters = new URLSearchParams();
20
19
  if (options.sandboxUid)
21
- parameters.set('sandbox_uid', assertSandboxUid(options.sandboxUid));
20
+ parameters.set('sandbox_uid', options.sandboxUid);
22
21
  if (options.sourceUid)
23
22
  parameters.set('source_uid', options.sourceUid);
24
23
  parameters.set('active', String(options.active ?? false));
@@ -29,10 +28,7 @@ export const listAttachments = async (token, options = {}, baseUrl = DEFAULT_SER
29
28
  }));
30
29
  };
31
30
  export const getAttachmentManifest = async (token, sandboxUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convert(await requestDatalayerAPI({
32
- // Throws on a Pod name. Contents validates this while building its
33
- // reply, so sending the wrong spelling produced a 500 the caller could
34
- // not read; this fails where the caller can be seen.
35
- url: url(baseUrl, `/manifest/${encodeURIComponent(assertSandboxUid(sandboxUid))}`),
31
+ url: url(baseUrl, `/manifest/${encodeURIComponent(sandboxUid)}`),
36
32
  method: 'GET',
37
33
  token,
38
34
  }));
@@ -5,6 +5,25 @@ export declare const getDatasetRevision: (token: string, sourceUid: string, revi
5
5
  export declare const createDatasetPublication: (token: string, sourceUid: string, request: DatasetPublicationCreate, idempotencyKey: string, baseUrl?: string) => Promise<DatasetPublication>;
6
6
  export declare const listDatasetPublications: (token: string, sourceUid: string, baseUrl?: string) => Promise<DatasetPublicationList>;
7
7
  export declare const unpublishDataset: (token: string, sourceUid: string, publicationUid: string, baseUrl?: string) => Promise<DatasetPublication>;
8
+ /** The Dataset a clone produced, and where it came from. */
9
+ export type DatasetClone = {
10
+ uid: string;
11
+ name: string;
12
+ sourceUid: string;
13
+ publicationUid: string;
14
+ revisionUid: string;
15
+ fileCount: number;
16
+ totalSize: number;
17
+ };
18
+ /**
19
+ * Take a published Dataset into your own catalog.
20
+ *
21
+ * A publication names one immutable revision, so the clone is a Dataset of
22
+ * the caller's own whose first revision names the same objects. Nothing is
23
+ * copied: the bytes cannot change, which is what makes sharing them safe, and
24
+ * the record and its permissions belong to the caller from that moment.
25
+ */
26
+ export declare const cloneDatasetPublication: (token: string, sourceUid: string, publicationUid: string, idempotencyKey: string, baseUrl?: string) => Promise<DatasetClone>;
8
27
  /**
9
28
  * Every Dataset currently published, across sources.
10
29
  *
@@ -13,3 +32,32 @@ export declare const unpublishDataset: (token: string, sourceUid: string, public
13
32
  * Any signed-in caller may read it — published means public.
14
33
  */
15
34
  export declare const listPublishedDatasets: (token: string, baseUrl?: string) => Promise<DatasetPublicationList>;
35
+ /** A published Data Server's catalog, as the library shows it. */
36
+ export type DataServerPublication = {
37
+ uid: string;
38
+ sourceUid: string;
39
+ actorUid: string;
40
+ ownerUid: string;
41
+ name: string;
42
+ description?: string | null;
43
+ tags: string[];
44
+ connectors: string[];
45
+ relations: string[];
46
+ status: string;
47
+ createdAt: string;
48
+ };
49
+ /** The Datasource an attach produced, naming the published Data Server. */
50
+ export type DataServerAttachment = {
51
+ uid: string;
52
+ name: string;
53
+ sourceUid: string;
54
+ publicationUid: string;
55
+ };
56
+ /**
57
+ * Attach a published Data Server as a Datasource of your own.
58
+ *
59
+ * The Datasource names it and the relations it publishes, and carries no
60
+ * credential: the Data Server's own mTLS still decides whether a query
61
+ * reaches it. That is what makes publishing a catalog safe.
62
+ */
63
+ export declare const attachDataServerPublication: (token: string, sourceUid: string, publicationUid: string, idempotencyKey: string, baseUrl?: string) => Promise<DataServerAttachment>;
@@ -4,32 +4,56 @@
4
4
  */
5
5
  import { requestDatalayerAPI } from '../DatalayerApi.js';
6
6
  import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants.js';
7
- import { contentsToCamelCase, contentsToSnakeCase } from '../../models/contents/index.js';
7
+ import { contentsToCamelCase, contentsToSnakeCase, } from '../../models/contents/index.js';
8
8
  const convert = (value) => contentsToCamelCase(value);
9
9
  const resourceUrl = (baseUrl, sourceUid, resource, suffix = '') => `${baseUrl}${API_BASE_PATHS.CONTENTS}/sources/${encodeURIComponent(sourceUid)}/${resource}${suffix}`;
10
10
  export const createDatasetRevision = async (token, sourceUid, request, idempotencyKey, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convert(await requestDatalayerAPI({
11
- url: resourceUrl(baseUrl, sourceUid, 'revisions'), method: 'POST', token,
11
+ url: resourceUrl(baseUrl, sourceUid, 'revisions'),
12
+ method: 'POST',
13
+ token,
12
14
  headers: { 'Idempotency-Key': idempotencyKey },
13
15
  body: contentsToSnakeCase(request),
14
16
  }));
15
17
  export const listDatasetRevisions = async (token, sourceUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convert(await requestDatalayerAPI({
16
- url: resourceUrl(baseUrl, sourceUid, 'revisions'), method: 'GET', token,
18
+ url: resourceUrl(baseUrl, sourceUid, 'revisions'),
19
+ method: 'GET',
20
+ token,
17
21
  }));
18
22
  export const getDatasetRevision = async (token, sourceUid, revisionUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convert(await requestDatalayerAPI({
19
23
  url: resourceUrl(baseUrl, sourceUid, 'revisions', `/${encodeURIComponent(revisionUid)}`),
20
- method: 'GET', token,
24
+ method: 'GET',
25
+ token,
21
26
  }));
22
27
  export const createDatasetPublication = async (token, sourceUid, request, idempotencyKey, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convert(await requestDatalayerAPI({
23
- url: resourceUrl(baseUrl, sourceUid, 'publications'), method: 'POST', token,
28
+ url: resourceUrl(baseUrl, sourceUid, 'publications'),
29
+ method: 'POST',
30
+ token,
24
31
  headers: { 'Idempotency-Key': idempotencyKey },
25
32
  body: contentsToSnakeCase(request),
26
33
  }));
27
34
  export const listDatasetPublications = async (token, sourceUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convert(await requestDatalayerAPI({
28
- url: resourceUrl(baseUrl, sourceUid, 'publications'), method: 'GET', token,
35
+ url: resourceUrl(baseUrl, sourceUid, 'publications'),
36
+ method: 'GET',
37
+ token,
29
38
  }));
30
39
  export const unpublishDataset = async (token, sourceUid, publicationUid, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convert(await requestDatalayerAPI({
31
40
  url: resourceUrl(baseUrl, sourceUid, 'publications', `/${encodeURIComponent(publicationUid)}`),
32
- method: 'DELETE', token,
41
+ method: 'DELETE',
42
+ token,
43
+ }));
44
+ /**
45
+ * Take a published Dataset into your own catalog.
46
+ *
47
+ * A publication names one immutable revision, so the clone is a Dataset of
48
+ * the caller's own whose first revision names the same objects. Nothing is
49
+ * copied: the bytes cannot change, which is what makes sharing them safe, and
50
+ * the record and its permissions belong to the caller from that moment.
51
+ */
52
+ export const cloneDatasetPublication = async (token, sourceUid, publicationUid, idempotencyKey, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convert(await requestDatalayerAPI({
53
+ url: resourceUrl(baseUrl, sourceUid, 'publications', `/${encodeURIComponent(publicationUid)}/clone`),
54
+ method: 'POST',
55
+ token,
56
+ headers: { 'Idempotency-Key': idempotencyKey },
33
57
  }));
34
58
  /**
35
59
  * Every Dataset currently published, across sources.
@@ -43,3 +67,16 @@ export const listPublishedDatasets = async (token, baseUrl = DEFAULT_SERVICE_URL
43
67
  method: 'GET',
44
68
  token,
45
69
  }));
70
+ /**
71
+ * Attach a published Data Server as a Datasource of your own.
72
+ *
73
+ * The Datasource names it and the relations it publishes, and carries no
74
+ * credential: the Data Server's own mTLS still decides whether a query
75
+ * reaches it. That is what makes publishing a catalog safe.
76
+ */
77
+ export const attachDataServerPublication = async (token, sourceUid, publicationUid, idempotencyKey, baseUrl = DEFAULT_SERVICE_URLS.CONTENTS) => convert(await requestDatalayerAPI({
78
+ url: `${baseUrl}/api/contents/v1/sources/${encodeURIComponent(sourceUid)}/dataserver-publications/${encodeURIComponent(publicationUid)}/attach`,
79
+ method: 'POST',
80
+ token,
81
+ headers: { 'Idempotency-Key': idempotencyKey },
82
+ }));
@@ -8,7 +8,7 @@
8
8
  * A Pod's volumes are fixed when it is created, so for most of a sandbox's
9
9
  * life its mounts were decided before it existed. The mount gateway lifts
10
10
  * that for the Home Folder: the platform binds a folder into a running pod
11
- * and the sandbox sees it at `/home/jovyan/{handle}` within a second or two,
11
+ * and the sandbox sees it at `/home/datalayer/{handle}` within a second or two,
12
12
  * with no restart.
13
13
  *
14
14
  * Not every Runtime can take one — a pod created before the gateway cannot,
@@ -1,53 +1,21 @@
1
1
  /**
2
- * A sandbox is identified by its uid, never by its runtime's Pod name.
2
+ * A sandbox is identified by its uid, a ULID.
3
3
  *
4
- * A Datalayer runtime has a ULID; its Kubernetes Pod is named
5
- * `runtime-<ulid>`, because a Pod name has to be a DNS label. Route
6
- * parameters and `runtime_name` fields carry the Pod name, and every Contents
7
- * record keyed on a sandbox is keyed on the ULID.
8
- *
9
- * Passing the Pod name where a uid belongs used to *work* at the call site
10
- * and fail far away: Contents validates `sandbox_uid` while building its
11
- * reply, so a Pod name became an unhandled 500 that reached the browser as
12
- * "Network Error", with nothing readable in it and nothing pointing at the
13
- * caller. Throwing here names the caller in the stack instead.
4
+ * A Datalayer runtime has one name: its uid. The Pod is called by it, the
5
+ * `runtime_name` field and every `/runtimes/{uid}` route carry it, and
6
+ * Contents keys an attachment on it. There used to be a second spelling — a
7
+ * Pod name `runtime-<ulid>` — and every place the two met needed a
8
+ * converter; the converters went with the prefix.
14
9
  *
15
10
  * The server half of this is `datalayer_common.runtime_names`.
16
11
  */
17
- /** What a runtime Pod's name is prefixed with. */
18
- export declare const RUNTIME_NAME_PREFIX = "runtime-";
19
- /** Thrown when a Pod name is given where a sandbox uid is required. */
20
- export declare class RuntimeNameNotAUid extends Error {
21
- readonly value: string;
22
- constructor(value: string);
23
- }
24
- /**
25
- * Assert that a value is a sandbox uid, and return it.
26
- *
27
- * Use this wherever a `sandbox_uid` is sent. A non-Datalayer identifier —
28
- * Daytona, E2B and Modal name their own sandboxes — passes through: there is
29
- * no ULID to check it against, and inventing one would be worse.
30
- */
31
- export declare function assertSandboxUid(value: string): string;
32
- /**
33
- * The Pod name for a sandbox uid, converting on purpose.
34
- *
35
- * The mirror of {@link sandboxUidFromRuntimeName}, and the direction that was
36
- * missing: route parameters and `runtime_name` fields carry the **Pod name**,
37
- * so anything addressing `/runtimes/{name}/…` needs one. Without this, a
38
- * caller holding only a uid either wrote the prefix itself or — the version
39
- * that was here — passed the uid and hoped, which is a `404` from a route
40
- * whose parameter looked plausible.
41
- *
42
- * Idempotent, like the server's `runtime_name()`: a name that has been
43
- * through here stays one name rather than growing a second prefix.
44
- */
45
- export declare function runtimeNameFromSandboxUid(value: string): string;
12
+ /** Crockford base32, 26 characters — a ULID, in either case. */
13
+ export declare const SANDBOX_UID_PATTERN: RegExp;
46
14
  /**
47
- * The sandbox uid for a Pod name, converting on purpose.
15
+ * Whether a value is a sandbox uid.
48
16
  *
49
- * For the few callers that genuinely only hold the Pod name — a route
50
- * parameter, a label read off a Pod. Everywhere else should already have the
51
- * uid, and {@link assertSandboxUid} is what says so.
17
+ * What tells a runtime apart from anything else that can stand in a route:
18
+ * an agentspec id, a word the listing itself addresses. A sandbox at an
19
+ * external provider is named `external-<provider>-<uid>` and is not one.
52
20
  */
53
- export declare function sandboxUidFromRuntimeName(value: string): string;
21
+ export declare function isSandboxUid(value: string | undefined | null): boolean;
@@ -3,76 +3,25 @@
3
3
  * Distributed under the terms of the Modified BSD License.
4
4
  */
5
5
  /**
6
- * A sandbox is identified by its uid, never by its runtime's Pod name.
6
+ * A sandbox is identified by its uid, a ULID.
7
7
  *
8
- * A Datalayer runtime has a ULID; its Kubernetes Pod is named
9
- * `runtime-<ulid>`, because a Pod name has to be a DNS label. Route
10
- * parameters and `runtime_name` fields carry the Pod name, and every Contents
11
- * record keyed on a sandbox is keyed on the ULID.
12
- *
13
- * Passing the Pod name where a uid belongs used to *work* at the call site
14
- * and fail far away: Contents validates `sandbox_uid` while building its
15
- * reply, so a Pod name became an unhandled 500 that reached the browser as
16
- * "Network Error", with nothing readable in it and nothing pointing at the
17
- * caller. Throwing here names the caller in the stack instead.
8
+ * A Datalayer runtime has one name: its uid. The Pod is called by it, the
9
+ * `runtime_name` field and every `/runtimes/{uid}` route carry it, and
10
+ * Contents keys an attachment on it. There used to be a second spelling — a
11
+ * Pod name `runtime-<ulid>` — and every place the two met needed a
12
+ * converter; the converters went with the prefix.
18
13
  *
19
14
  * The server half of this is `datalayer_common.runtime_names`.
20
15
  */
21
- /** What a runtime Pod's name is prefixed with. */
22
- export const RUNTIME_NAME_PREFIX = 'runtime-';
23
- /** Thrown when a Pod name is given where a sandbox uid is required. */
24
- export class RuntimeNameNotAUid extends Error {
25
- value;
26
- constructor(value) {
27
- super(`'${value}' is a runtime Pod name, not a sandbox uid. A sandbox is ` +
28
- `identified by its ULID ('${value.slice(RUNTIME_NAME_PREFIX.length)}'). ` +
29
- 'If all you hold is the Pod name, convert it deliberately with ' +
30
- 'sandboxUidFromRuntimeName().');
31
- this.name = 'RuntimeNameNotAUid';
32
- this.value = value;
33
- }
34
- }
35
- /**
36
- * Assert that a value is a sandbox uid, and return it.
37
- *
38
- * Use this wherever a `sandbox_uid` is sent. A non-Datalayer identifier —
39
- * Daytona, E2B and Modal name their own sandboxes — passes through: there is
40
- * no ULID to check it against, and inventing one would be worse.
41
- */
42
- export function assertSandboxUid(value) {
43
- if (value.startsWith(RUNTIME_NAME_PREFIX)) {
44
- throw new RuntimeNameNotAUid(value);
45
- }
46
- return value;
47
- }
48
- /**
49
- * The Pod name for a sandbox uid, converting on purpose.
50
- *
51
- * The mirror of {@link sandboxUidFromRuntimeName}, and the direction that was
52
- * missing: route parameters and `runtime_name` fields carry the **Pod name**,
53
- * so anything addressing `/runtimes/{name}/…` needs one. Without this, a
54
- * caller holding only a uid either wrote the prefix itself or — the version
55
- * that was here — passed the uid and hoped, which is a `404` from a route
56
- * whose parameter looked plausible.
57
- *
58
- * Idempotent, like the server's `runtime_name()`: a name that has been
59
- * through here stays one name rather than growing a second prefix.
60
- */
61
- export function runtimeNameFromSandboxUid(value) {
62
- if (!value || value.startsWith(RUNTIME_NAME_PREFIX)) {
63
- return value;
64
- }
65
- return `${RUNTIME_NAME_PREFIX}${value}`;
66
- }
16
+ /** Crockford base32, 26 characters — a ULID, in either case. */
17
+ export const SANDBOX_UID_PATTERN = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
67
18
  /**
68
- * The sandbox uid for a Pod name, converting on purpose.
19
+ * Whether a value is a sandbox uid.
69
20
  *
70
- * For the few callers that genuinely only hold the Pod name — a route
71
- * parameter, a label read off a Pod. Everywhere else should already have the
72
- * uid, and {@link assertSandboxUid} is what says so.
21
+ * What tells a runtime apart from anything else that can stand in a route:
22
+ * an agentspec id, a word the listing itself addresses. A sandbox at an
23
+ * external provider is named `external-<provider>-<uid>` and is not one.
73
24
  */
74
- export function sandboxUidFromRuntimeName(value) {
75
- return value.startsWith(RUNTIME_NAME_PREFIX)
76
- ? value.slice(RUNTIME_NAME_PREFIX.length)
77
- : value;
25
+ export function isSandboxUid(value) {
26
+ return !!value && SANDBOX_UID_PATTERN.test(value);
78
27
  }