@datalayer/agent-runtimes 1.0.28 → 1.0.29

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 (31) hide show
  1. package/lib/api/index.js +16 -4
  2. package/lib/components/code-sandboxes/CodeSandboxEnvironmentSelect.d.ts +41 -0
  3. package/lib/components/code-sandboxes/CodeSandboxEnvironmentSelect.js +83 -0
  4. package/lib/components/code-sandboxes/CodeSandboxLauncher.d.ts +11 -0
  5. package/lib/components/code-sandboxes/CodeSandboxLauncher.js +96 -12
  6. package/lib/components/code-sandboxes/CodeSandboxNames.js +68 -23
  7. package/lib/components/code-sandboxes/CodeSandboxPicker.d.ts +14 -1
  8. package/lib/components/code-sandboxes/CodeSandboxPicker.js +155 -21
  9. package/lib/components/code-sandboxes/CodeSandboxUtils.d.ts +3 -0
  10. package/lib/components/code-sandboxes/CodeSandboxUtils.js +62 -11
  11. package/lib/components/code-sandboxes/NewCodeSandboxControls.js +2 -2
  12. package/lib/components/code-sandboxes/codeSandboxProviders.d.ts +29 -0
  13. package/lib/components/code-sandboxes/codeSandboxProviders.js +81 -0
  14. package/lib/components/code-sandboxes/index.d.ts +2 -0
  15. package/lib/components/code-sandboxes/index.js +2 -0
  16. package/lib/examples/AgentspecsExample.js +3 -3
  17. package/lib/identity/index.d.ts +1 -1
  18. package/lib/identity/index.js +1 -1
  19. package/lib/identity/types.d.ts +1 -1
  20. package/lib/identity/types.js +1 -1
  21. package/lib/models/CodeSandboxVariant.d.ts +45 -0
  22. package/lib/models/CodeSandboxVariant.js +65 -0
  23. package/lib/models/index.d.ts +1 -0
  24. package/lib/models/index.js +1 -0
  25. package/lib/runtimes/actions.js +14 -2
  26. package/lib/specs/envvars.d.ts +1 -1
  27. package/lib/specs/envvars.js +3 -3
  28. package/lib/specs/mcpServers.js +2 -2
  29. package/lib/state/substates/RuntimesState.js +4 -1
  30. package/package.json +1 -1
  31. package/scripts/gen_workers.py +1 -1
@@ -0,0 +1,45 @@
1
+ /**
2
+ * The kinds of code sandbox, as the Python `code_sandboxes` package names them.
3
+ *
4
+ * A sandbox is a place code runs, and the VARIANT names the kind of place:
5
+ * the Datalayer platform, a Jupyter Server, Kaggle, Modal, and so on. The
6
+ * values mirror `code_sandboxes.models.SandboxVariant` verbatim — one naming
7
+ * for the CLI, the services and the applications, so an environment tagged
8
+ * `kaggle` by the operator reads as `kaggle` here and nowhere becomes a
9
+ * synonym.
10
+ *
11
+ * @module models/CodeSandboxVariant
12
+ */
13
+ /** The kinds of code sandbox, by the value the platform tags them with. */
14
+ export declare enum CodeSandboxVariant {
15
+ /** In-process evaluation: tests and examples, isolates nothing. */
16
+ Eval = "eval",
17
+ /** A container on the Docker daemon of a machine. */
18
+ Docker = "docker",
19
+ /** A kernel of a Jupyter Server. */
20
+ JupyterServer = "jupyter-server",
21
+ /** A runtime of the Datalayer platform. */
22
+ Datalayer = "datalayer",
23
+ /** A Google Colab runtime. */
24
+ GoogleColab = "google_colab",
25
+ /** A Kaggle notebook session. */
26
+ Kaggle = "kaggle",
27
+ /** The Monty in-browser interpreter. */
28
+ Monty = "monty",
29
+ /** A container on Modal. */
30
+ Modal = "modal"
31
+ }
32
+ /** What each variant is called where a person reads it. */
33
+ export declare const CODE_SANDBOX_VARIANT_TITLES: Record<CodeSandboxVariant, string>;
34
+ /**
35
+ * The variant an environment belongs to, read off its `owner` tag.
36
+ *
37
+ * The operator tags an external environment with its provider through the
38
+ * environment's `owner` — `kaggle`, `modal` — while the platform's own carry
39
+ * `datalayer`. An owner nothing here recognises reads as Datalayer, which is
40
+ * what every environment was before providers existed.
41
+ */
42
+ export declare function codeSandboxVariantOf(owner?: string | null): CodeSandboxVariant;
43
+ /** A short label for the chip beside an environment's name. */
44
+ export declare function codeSandboxVariantTitle(variant: CodeSandboxVariant): string;
45
+ export default CodeSandboxVariant;
@@ -0,0 +1,65 @@
1
+ /*
2
+ * Copyright (c) 2025-2026 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /**
6
+ * The kinds of code sandbox, as the Python `code_sandboxes` package names them.
7
+ *
8
+ * A sandbox is a place code runs, and the VARIANT names the kind of place:
9
+ * the Datalayer platform, a Jupyter Server, Kaggle, Modal, and so on. The
10
+ * values mirror `code_sandboxes.models.SandboxVariant` verbatim — one naming
11
+ * for the CLI, the services and the applications, so an environment tagged
12
+ * `kaggle` by the operator reads as `kaggle` here and nowhere becomes a
13
+ * synonym.
14
+ *
15
+ * @module models/CodeSandboxVariant
16
+ */
17
+ /** The kinds of code sandbox, by the value the platform tags them with. */
18
+ export var CodeSandboxVariant;
19
+ (function (CodeSandboxVariant) {
20
+ /** In-process evaluation: tests and examples, isolates nothing. */
21
+ CodeSandboxVariant["Eval"] = "eval";
22
+ /** A container on the Docker daemon of a machine. */
23
+ CodeSandboxVariant["Docker"] = "docker";
24
+ /** A kernel of a Jupyter Server. */
25
+ CodeSandboxVariant["JupyterServer"] = "jupyter-server";
26
+ /** A runtime of the Datalayer platform. */
27
+ CodeSandboxVariant["Datalayer"] = "datalayer";
28
+ /** A Google Colab runtime. */
29
+ CodeSandboxVariant["GoogleColab"] = "google_colab";
30
+ /** A Kaggle notebook session. */
31
+ CodeSandboxVariant["Kaggle"] = "kaggle";
32
+ /** The Monty in-browser interpreter. */
33
+ CodeSandboxVariant["Monty"] = "monty";
34
+ /** A container on Modal. */
35
+ CodeSandboxVariant["Modal"] = "modal";
36
+ })(CodeSandboxVariant || (CodeSandboxVariant = {}));
37
+ /** What each variant is called where a person reads it. */
38
+ export const CODE_SANDBOX_VARIANT_TITLES = {
39
+ [CodeSandboxVariant.Eval]: 'Eval',
40
+ [CodeSandboxVariant.Docker]: 'Docker',
41
+ [CodeSandboxVariant.JupyterServer]: 'Jupyter Server',
42
+ [CodeSandboxVariant.Datalayer]: 'Datalayer',
43
+ [CodeSandboxVariant.GoogleColab]: 'Google Colab',
44
+ [CodeSandboxVariant.Kaggle]: 'Kaggle',
45
+ [CodeSandboxVariant.Monty]: 'Monty',
46
+ [CodeSandboxVariant.Modal]: 'Modal'
47
+ };
48
+ /**
49
+ * The variant an environment belongs to, read off its `owner` tag.
50
+ *
51
+ * The operator tags an external environment with its provider through the
52
+ * environment's `owner` — `kaggle`, `modal` — while the platform's own carry
53
+ * `datalayer`. An owner nothing here recognises reads as Datalayer, which is
54
+ * what every environment was before providers existed.
55
+ */
56
+ export function codeSandboxVariantOf(owner) {
57
+ const normalized = (owner ?? '').replace('_', '-').toLowerCase();
58
+ const match = Object.values(CodeSandboxVariant).find(value => value.replace('_', '-') === normalized);
59
+ return match ?? CodeSandboxVariant.Datalayer;
60
+ }
61
+ /** A short label for the chip beside an environment's name. */
62
+ export function codeSandboxVariantTitle(variant) {
63
+ return CODE_SANDBOX_VARIANT_TITLES[variant] ?? variant;
64
+ }
65
+ export default CodeSandboxVariant;
@@ -22,6 +22,7 @@ export * from './NotebookDTO';
22
22
  export * from './Page';
23
23
  export * from './PageTag';
24
24
  export * from './ProjectDTO';
25
+ export * from './CodeSandboxVariant';
25
26
  export * from './Runtime';
26
27
  export * from './RuntimeDTO';
27
28
  export * from './Space';
@@ -27,6 +27,7 @@ export * from './NotebookDTO';
27
27
  export * from './Page';
28
28
  export * from './PageTag';
29
29
  export * from './ProjectDTO';
30
+ export * from './CodeSandboxVariant';
30
31
  export * from './Runtime';
31
32
  export * from './RuntimeDTO';
32
33
  export * from './Space';
@@ -30,11 +30,23 @@ export async function getEnvironments() {
30
30
  */
31
31
  export async function createRuntime(options) {
32
32
  const { externalToken, token } = iamStore.getState();
33
+ /*
34
+ * A limit is required; ZERO is one of the answers.
35
+ *
36
+ * The environments of an external provider — Kaggle, Modal — burn no
37
+ * credits of the platform: their sandbox runs on the account of the user,
38
+ * at their provider, and the platform only records it. Their burning rate
39
+ * is `0`, so the limit computed for them is `0` too, and refusing that
40
+ * threw here — before any request was made, which is why the failure
41
+ * showed as a sandbox that could not be created with nothing in the
42
+ * network log to explain it. What is still refused is a limit that is not
43
+ * a number at all, or one below zero.
44
+ */
33
45
  if (typeof options.creditsLimit !== 'number' ||
34
46
  !Number.isFinite(options.creditsLimit) ||
35
- options.creditsLimit <= 0) {
47
+ options.creditsLimit < 0) {
36
48
  throw new Error(`Invalid runtime creditsLimit for environment ${options.environmentName}. ` +
37
- 'A positive number is required.');
49
+ 'A number of zero or more is required.');
38
50
  }
39
51
  const body = {
40
52
  environment: {
@@ -12,7 +12,7 @@ export declare const GITHUB_TOKEN_SPEC_0_0_1: EnvvarSpec;
12
12
  export declare const GOOGLE_OAUTH_CLIENT_ID_SPEC_0_0_1: EnvvarSpec;
13
13
  export declare const GOOGLE_OAUTH_CLIENT_SECRET_SPEC_0_0_1: EnvvarSpec;
14
14
  export declare const HF_TOKEN_SPEC_0_0_1: EnvvarSpec;
15
- export declare const KAGGLE_TOKEN_SPEC_0_0_1: EnvvarSpec;
15
+ export declare const KAGGLE_API_TOKEN_SPEC_0_0_1: EnvvarSpec;
16
16
  export declare const SLACK_BOT_TOKEN_SPEC_0_0_1: EnvvarSpec;
17
17
  export declare const SLACK_CHANNEL_IDS_SPEC_0_0_1: EnvvarSpec;
18
18
  export declare const SLACK_TEAM_ID_SPEC_0_0_1: EnvvarSpec;
@@ -62,8 +62,8 @@ export const HF_TOKEN_SPEC_0_0_1 = {
62
62
  icon: 'key',
63
63
  emoji: '🔑',
64
64
  };
65
- export const KAGGLE_TOKEN_SPEC_0_0_1 = {
66
- id: 'KAGGLE_TOKEN',
65
+ export const KAGGLE_API_TOKEN_SPEC_0_0_1 = {
66
+ id: 'KAGGLE_API_TOKEN',
67
67
  version: '0.0.1',
68
68
  name: 'Kaggle API Token',
69
69
  description: 'API token for accessing Kaggle datasets, competitions, notebooks, and models. Required for Kaggle MCP server authentication.',
@@ -120,7 +120,7 @@ export const ENVVAR_CATALOG = {
120
120
  GOOGLE_OAUTH_CLIENT_ID: GOOGLE_OAUTH_CLIENT_ID_SPEC_0_0_1,
121
121
  GOOGLE_OAUTH_CLIENT_SECRET: GOOGLE_OAUTH_CLIENT_SECRET_SPEC_0_0_1,
122
122
  HF_TOKEN: HF_TOKEN_SPEC_0_0_1,
123
- KAGGLE_TOKEN: KAGGLE_TOKEN_SPEC_0_0_1,
123
+ KAGGLE_API_TOKEN: KAGGLE_API_TOKEN_SPEC_0_0_1,
124
124
  SLACK_BOT_TOKEN: SLACK_BOT_TOKEN_SPEC_0_0_1,
125
125
  SLACK_CHANNEL_IDS: SLACK_CHANNEL_IDS_SPEC_0_0_1,
126
126
  SLACK_TEAM_ID: SLACK_TEAM_ID_SPEC_0_0_1,
@@ -163,13 +163,13 @@ export const KAGGLE_MCP_SERVER_0_0_1 = {
163
163
  'mcp-remote',
164
164
  'https://www.kaggle.com/mcp',
165
165
  '--header',
166
- 'Authorization: Bearer ${KAGGLE_TOKEN}',
166
+ 'Authorization: Bearer ${KAGGLE_API_TOKEN}',
167
167
  ],
168
168
  transport: 'stdio',
169
169
  enabled: true,
170
170
  isAvailable: false,
171
171
  tools: [],
172
- requiredEnvVars: ['KAGGLE_TOKEN:0.0.1'],
172
+ requiredEnvVars: ['KAGGLE_API_TOKEN:0.0.1'],
173
173
  };
174
174
  export const ODOO_MCP_SERVER_0_0_1 = {
175
175
  id: 'odoo',
@@ -77,7 +77,10 @@ export const runtimesStore = createStore((set, get) => {
77
77
  */
78
78
  removeRuntimeModel: (id) => {
79
79
  const kernels = [...get().runtimeModels];
80
- const index = kernels?.findIndex(model => id === model.id) ?? -1;
80
+ // By the kernel it runs, or by the pod it is: a sandbox of an external
81
+ // provider has no kernel, so its pod name is the only name it answers
82
+ // to — matched on the kernel alone it was never removed from the list.
83
+ const index = kernels?.findIndex(model => (!!model.id && id === model.id) || id === model.pod_name) ?? -1;
81
84
  if (index >= 0) {
82
85
  kernels.splice(index, 1);
83
86
  set({ runtimeModels: kernels });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datalayer/agent-runtimes",
3
- "version": "1.0.28",
3
+ "version": "1.0.29",
4
4
  "type": "module",
5
5
  "workspaces": [
6
6
  ".",
@@ -40,7 +40,7 @@ VERTICALS = {
40
40
  "emoji": "🧬", "icon": "beaker", "color": "#06B6D4",
41
41
  "mcp": ["huggingface:0.0.1", "kaggle:0.0.1"],
42
42
  "skills": ["text-summarizer:0.0.1", "pdf:0.0.1"],
43
- "envvars": ["HF_TOKEN:0.0.1", "KAGGLE_TOKEN:0.0.1"],
43
+ "envvars": ["HF_TOKEN:0.0.1", "KAGGLE_API_TOKEN:0.0.1"],
44
44
  },
45
45
  "capital-markets": {
46
46
  "emoji": "📈", "icon": "graph", "color": "#3B82F6",