@datalayer/agent-runtimes 0.0.10 → 0.0.11

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 (36) hide show
  1. package/lib/components/AgentConfiguration.d.ts +30 -0
  2. package/lib/components/AgentConfiguration.js +71 -16
  3. package/lib/components/chat/components/AgentDetails.js +159 -1
  4. package/lib/components/chat/components/ContextDistribution.js +2 -2
  5. package/lib/components/chat/components/ContextInspector.js +4 -2
  6. package/lib/components/chat/components/ContextPanel.js +1 -6
  7. package/lib/components/index.d.ts +2 -2
  8. package/lib/components/index.js +1 -1
  9. package/lib/config/agents/code-ai/agents.d.ts +25 -0
  10. package/lib/config/agents/code-ai/agents.js +70 -0
  11. package/lib/config/agents/code-ai/index.d.ts +1 -0
  12. package/lib/config/agents/code-ai/index.js +5 -0
  13. package/lib/config/{agents.d.ts → agents/codemode-paper/agents.d.ts} +1 -5
  14. package/lib/config/{agents.js → agents/codemode-paper/agents.js} +29 -165
  15. package/lib/config/agents/codemode-paper/index.d.ts +1 -0
  16. package/lib/config/agents/codemode-paper/index.js +5 -0
  17. package/lib/config/agents/datalayer-ai/agents.d.ts +29 -0
  18. package/lib/config/agents/datalayer-ai/agents.js +267 -0
  19. package/lib/config/agents/datalayer-ai/index.d.ts +1 -0
  20. package/lib/config/agents/datalayer-ai/index.js +5 -0
  21. package/lib/config/agents/index.d.ts +19 -0
  22. package/lib/config/agents/index.js +38 -0
  23. package/lib/config/envvars.d.ts +28 -0
  24. package/lib/config/envvars.js +115 -0
  25. package/lib/config/index.d.ts +1 -0
  26. package/lib/config/index.js +1 -0
  27. package/lib/config/mcpServers.js +26 -2
  28. package/lib/config/skills.d.ts +2 -0
  29. package/lib/config/skills.js +6 -0
  30. package/lib/examples/AgentSpaceFormExample.js +51 -9
  31. package/lib/types.d.ts +10 -2
  32. package/package.json +2 -2
  33. package/scripts/codegen/generate_agents.py +565 -154
  34. package/scripts/codegen/generate_envvars.py +302 -0
  35. package/scripts/codegen/generate_mcp_servers.py +28 -16
  36. package/scripts/codegen/generate_skills.py +19 -6
@@ -0,0 +1,302 @@
1
+ #!/usr/bin/env python3
2
+ # Copyright (c) 2025-2026 Datalayer, Inc.
3
+ # Distributed under the terms of the Modified BSD License.
4
+
5
+ """
6
+ Generate Python and TypeScript code from YAML environment variable specifications.
7
+
8
+ Usage:
9
+ python generate_envvars.py \\
10
+ --specs-dir specs/envvars \\
11
+ --python-output agent_runtimes/config/envvars.py \\
12
+ --typescript-output src/config/envvars.ts
13
+ """
14
+
15
+ import argparse
16
+ import sys
17
+ from pathlib import Path
18
+ from typing import Any
19
+
20
+ import yaml
21
+
22
+
23
+ def _fmt_list(items: list[str]) -> str:
24
+ """Format a list of strings with double quotes for ruff compliance."""
25
+ if not items:
26
+ return "[]"
27
+ return "[" + ", ".join(f'"{item}"' for item in items) + "]"
28
+
29
+
30
+ def load_envvar_specs(specs_dir: Path) -> list[dict[str, Any]]:
31
+ """Load all envvar YAML specifications from a directory."""
32
+ specs = []
33
+ for yaml_file in sorted(specs_dir.glob("*.yaml")):
34
+ with open(yaml_file) as f:
35
+ spec = yaml.safe_load(f)
36
+ specs.append(spec)
37
+ return specs
38
+
39
+
40
+ def generate_python_code(specs: list[dict[str, Any]]) -> str:
41
+ """Generate Python code from environment variable specifications."""
42
+ lines = [
43
+ "# Copyright (c) 2025-2026 Datalayer, Inc.",
44
+ "# Distributed under the terms of the Modified BSD License.",
45
+ '"""',
46
+ "Environment Variable Catalog.",
47
+ "",
48
+ "Predefined environment variable specifications.",
49
+ "",
50
+ "This file is AUTO-GENERATED from YAML specifications.",
51
+ "DO NOT EDIT MANUALLY - run 'make specs' to regenerate.",
52
+ '"""',
53
+ "",
54
+ "from dataclasses import dataclass",
55
+ "from typing import Dict, List, Optional",
56
+ "",
57
+ "",
58
+ "# " + "=" * 76,
59
+ "# Environment Variable Specification",
60
+ "# " + "=" * 76,
61
+ "",
62
+ "@dataclass",
63
+ "class EnvvarSpec:",
64
+ ' """Environment variable specification."""',
65
+ "",
66
+ " id: str",
67
+ " name: str",
68
+ " description: str",
69
+ " registrationUrl: Optional[str]",
70
+ " tags: List[str]",
71
+ " icon: Optional[str]",
72
+ " emoji: Optional[str]",
73
+ "",
74
+ "",
75
+ "# " + "=" * 76,
76
+ "# Environment Variable Definitions",
77
+ "# " + "=" * 76,
78
+ "",
79
+ ]
80
+
81
+ # Generate envvar constants
82
+ for spec in specs:
83
+ envvar_id = spec["id"]
84
+ const_name = f"{envvar_id}_SPEC"
85
+
86
+ registration_url_value = (
87
+ f'"{spec.get("registrationUrl")}"'
88
+ if spec.get("registrationUrl")
89
+ else "None"
90
+ )
91
+
92
+ # Format optional fields
93
+ icon = f'"{spec.get("icon")}"' if spec.get("icon") else "None"
94
+ emoji = f'"{spec.get("emoji")}"' if spec.get("emoji") else "None"
95
+
96
+ lines.extend(
97
+ [
98
+ f"{const_name} = EnvvarSpec(",
99
+ f' id="{envvar_id}",',
100
+ f' name="{spec["name"]}",',
101
+ f' description="{spec["description"]}",',
102
+ f" registrationUrl={registration_url_value},",
103
+ f" tags={_fmt_list(spec.get('tags', []))},",
104
+ f" icon={icon},",
105
+ f" emoji={emoji},",
106
+ ")",
107
+ "",
108
+ ]
109
+ )
110
+
111
+ # Generate catalog dictionary
112
+ lines.extend(
113
+ [
114
+ "# " + "=" * 76,
115
+ "# Environment Variable Catalog",
116
+ "# " + "=" * 76,
117
+ "",
118
+ "ENVVAR_CATALOG: Dict[str, EnvvarSpec] = {",
119
+ ]
120
+ )
121
+
122
+ for spec in specs:
123
+ envvar_id = spec["id"]
124
+ const_name = f"{envvar_id}_SPEC"
125
+ lines.append(f' "{envvar_id}": {const_name},')
126
+
127
+ lines.extend(
128
+ [
129
+ "}",
130
+ "",
131
+ "",
132
+ "def get_envvar_spec(envvar_id: str) -> EnvvarSpec:",
133
+ ' """Get environment variable specification by ID."""',
134
+ " if envvar_id not in ENVVAR_CATALOG:",
135
+ f' raise ValueError(f"Unknown environment variable: {{envvar_id}}")',
136
+ " return ENVVAR_CATALOG[envvar_id]",
137
+ "",
138
+ ]
139
+ )
140
+
141
+ return "\n".join(lines)
142
+
143
+
144
+ def generate_typescript_code(specs: list[dict[str, Any]]) -> str:
145
+ """Generate TypeScript code from environment variable specifications."""
146
+ lines = [
147
+ "/*",
148
+ " * Copyright (c) 2025-2026 Datalayer, Inc.",
149
+ " * Distributed under the terms of the Modified BSD License.",
150
+ " */",
151
+ "",
152
+ "/**",
153
+ " * Environment Variable Catalog",
154
+ " *",
155
+ " * Predefined environment variable specifications.",
156
+ " *",
157
+ " * This file is AUTO-GENERATED from YAML specifications.",
158
+ " * DO NOT EDIT MANUALLY - run 'make specs' to regenerate.",
159
+ " */",
160
+ "",
161
+ "export interface EnvvarSpec {",
162
+ " id: string;",
163
+ " name: string;",
164
+ " description: string;",
165
+ " registrationUrl?: string;",
166
+ " tags: string[];",
167
+ " icon?: string;",
168
+ " emoji?: string;",
169
+ "}",
170
+ "",
171
+ "// " + "=" * 76,
172
+ "// Environment Variable Definitions",
173
+ "// " + "=" * 76,
174
+ "",
175
+ ]
176
+
177
+ # Generate envvar constants
178
+ for spec in specs:
179
+ envvar_id = spec["id"]
180
+ const_name = f"{envvar_id}_SPEC"
181
+
182
+ # Format arrays for TypeScript
183
+ tags_json = str(spec.get("tags", [])).replace("'", '"')
184
+ registration_url = (
185
+ f"registrationUrl: '{spec['registrationUrl']}',"
186
+ if spec.get("registrationUrl")
187
+ else ""
188
+ )
189
+
190
+ # Format optional fields
191
+ icon = f"'{spec.get('icon')}'" if spec.get("icon") else "undefined"
192
+ emoji = f"'{spec.get('emoji')}'" if spec.get("emoji") else "undefined"
193
+
194
+ lines.extend(
195
+ [
196
+ f"export const {const_name}: EnvvarSpec = {{",
197
+ f" id: '{envvar_id}',",
198
+ f" name: '{spec['name']}',",
199
+ f" description: '{spec['description']}',",
200
+ ]
201
+ )
202
+
203
+ if registration_url:
204
+ lines.append(f" {registration_url}")
205
+
206
+ lines.extend(
207
+ [
208
+ f" tags: {tags_json},",
209
+ f" icon: {icon},",
210
+ f" emoji: {emoji},",
211
+ "};",
212
+ "",
213
+ ]
214
+ )
215
+
216
+ # Generate catalog object
217
+ lines.extend(
218
+ [
219
+ "// " + "=" * 76,
220
+ "// Environment Variable Catalog",
221
+ "// " + "=" * 76,
222
+ "",
223
+ "export const ENVVAR_CATALOG: Record<string, EnvvarSpec> = {",
224
+ ]
225
+ )
226
+
227
+ for spec in specs:
228
+ envvar_id = spec["id"]
229
+ const_name = f"{envvar_id}_SPEC"
230
+ lines.append(f" '{envvar_id}': {const_name},")
231
+
232
+ lines.extend(
233
+ [
234
+ "};",
235
+ "",
236
+ "export function getEnvvarSpec(envvarId: string): EnvvarSpec {",
237
+ " const spec = ENVVAR_CATALOG[envvarId];",
238
+ " if (!spec) {",
239
+ " throw new Error(`Unknown environment variable: ${envvarId}`);",
240
+ " }",
241
+ " return spec;",
242
+ "}",
243
+ "",
244
+ ]
245
+ )
246
+
247
+ return "\n".join(lines)
248
+
249
+
250
+ def main():
251
+ parser = argparse.ArgumentParser(
252
+ description="Generate Python and TypeScript code from YAML environment variable specifications"
253
+ )
254
+ parser.add_argument(
255
+ "--specs-dir",
256
+ type=Path,
257
+ required=True,
258
+ help="Directory containing envvar YAML files",
259
+ )
260
+ parser.add_argument(
261
+ "--python-output",
262
+ type=Path,
263
+ required=True,
264
+ help="Output path for Python file",
265
+ )
266
+ parser.add_argument(
267
+ "--typescript-output",
268
+ type=Path,
269
+ required=True,
270
+ help="Output path for TypeScript file",
271
+ )
272
+
273
+ args = parser.parse_args()
274
+
275
+ if not args.specs_dir.exists():
276
+ print(f"Error: Specs directory not found: {args.specs_dir}", file=sys.stderr)
277
+ sys.exit(1)
278
+
279
+ # Load specs
280
+ specs = load_envvar_specs(args.specs_dir)
281
+ if not specs:
282
+ print(
283
+ f"Warning: No envvar specifications found in {args.specs_dir}",
284
+ file=sys.stderr,
285
+ )
286
+ return
287
+
288
+ # Generate Python code
289
+ python_code = generate_python_code(specs)
290
+ args.python_output.parent.mkdir(parents=True, exist_ok=True)
291
+ args.python_output.write_text(python_code)
292
+ print(f"Generated Python code: {args.python_output}")
293
+
294
+ # Generate TypeScript code
295
+ typescript_code = generate_typescript_code(specs)
296
+ args.typescript_output.parent.mkdir(parents=True, exist_ok=True)
297
+ args.typescript_output.write_text(typescript_code)
298
+ print(f"Generated TypeScript code: {args.typescript_output}")
299
+
300
+
301
+ if __name__ == "__main__":
302
+ main()
@@ -88,14 +88,16 @@ def generate_python_code(specs: list[dict[str, Any]]) -> str:
88
88
  else:
89
89
  env_formatted = None
90
90
 
91
- # Format required env vars
92
- required_env = spec.get("required_env_vars", [])
93
- if required_env:
94
- required_env_formatted = (
95
- "[" + ", ".join(f'"{v}"' for v in required_env) + "]"
96
- )
91
+ # Format envvars
92
+ envvars = spec.get("envvars", [])
93
+ if envvars:
94
+ envvars_formatted = "[" + ", ".join(f'"{v}"' for v in envvars) + "]"
97
95
  else:
98
- required_env_formatted = "[]"
96
+ envvars_formatted = "[]"
97
+
98
+ # Format optional fields
99
+ icon = f'"{spec.get("icon")}"' if spec.get("icon") else "None"
100
+ emoji = f'"{spec.get("emoji")}"' if spec.get("emoji") else "None"
99
101
 
100
102
  lines.extend(
101
103
  [
@@ -103,6 +105,8 @@ def generate_python_code(specs: list[dict[str, Any]]) -> str:
103
105
  f' id="{server_id}",',
104
106
  f' name="{spec["name"]}",',
105
107
  f' description="{spec["description"]}",',
108
+ f" icon={icon},",
109
+ f" emoji={emoji},",
106
110
  f' command="{spec["command"]}",',
107
111
  f" args={args_formatted},",
108
112
  f' transport="{spec.get("transport", "stdio")}",',
@@ -117,7 +121,7 @@ def generate_python_code(specs: list[dict[str, Any]]) -> str:
117
121
 
118
122
  lines.extend(
119
123
  [
120
- f" required_env_vars={required_env_formatted},",
124
+ f" required_env_vars={envvars_formatted},",
121
125
  ")",
122
126
  "",
123
127
  ]
@@ -230,20 +234,28 @@ def generate_typescript_code(specs: list[dict[str, Any]]) -> str:
230
234
  args_list = spec.get("args", [])
231
235
  args_formatted = "[" + ", ".join(f"'{arg}'" for arg in args_list) + "]"
232
236
 
233
- # Format required env vars
234
- required_env = spec.get("required_env_vars", [])
235
- if required_env:
236
- required_env_formatted = (
237
- "[" + ", ".join(f"'{v}'" for v in required_env) + "]"
238
- )
237
+ # Format envvars
238
+ envvars = spec.get("envvars", [])
239
+ if envvars:
240
+ envvars_formatted = "[" + ", ".join(f"'{v}'" for v in envvars) + "]"
239
241
  else:
240
- required_env_formatted = "[]"
242
+ envvars_formatted = "[]"
243
+
244
+ # Format optional fields
245
+ icon = f"'{spec.get('icon')}'" if spec.get("icon") else "undefined"
246
+ emoji = f"'{spec.get('emoji')}'" if spec.get("emoji") else "undefined"
247
+
248
+ # Escape description for TypeScript
249
+ description = spec.get("description", "").replace("'", "\\'")
241
250
 
242
251
  lines.extend(
243
252
  [
244
253
  f"export const {const_name}: MCPServer = {{",
245
254
  f" id: '{server_id}',",
246
255
  f" name: '{spec['name']}',",
256
+ f" description: '{description}',",
257
+ f" icon: {icon},",
258
+ f" emoji: {emoji},",
247
259
  f" url: '',",
248
260
  f" command: '{spec['command']}',",
249
261
  f" args: {args_formatted},",
@@ -251,7 +263,7 @@ def generate_typescript_code(specs: list[dict[str, Any]]) -> str:
251
263
  f" enabled: {str(spec.get('enabled', True)).lower()},",
252
264
  " isAvailable: false,",
253
265
  " tools: [],",
254
- f" requiredEnvVars: {required_env_formatted},",
266
+ f" requiredEnvVars: {envvars_formatted},",
255
267
  "};",
256
268
  "",
257
269
  ]
@@ -64,10 +64,12 @@ def generate_python_code(specs: list[dict[str, Any]]) -> str:
64
64
  " name: str",
65
65
  " description: str",
66
66
  " module: str",
67
- " required_env_vars: List[str]",
67
+ " envvars: List[str]",
68
68
  " optional_env_vars: List[str]",
69
69
  " dependencies: List[str]",
70
70
  " tags: List[str]",
71
+ " icon: str | None",
72
+ " emoji: str | None",
71
73
  " enabled: bool",
72
74
  "",
73
75
  "",
@@ -82,6 +84,9 @@ def generate_python_code(specs: list[dict[str, Any]]) -> str:
82
84
  skill_id = spec["id"]
83
85
  const_name = f"{skill_id.upper().replace('-', '_')}_SKILL_SPEC"
84
86
 
87
+ icon = f'"{spec.get("icon")}"' if spec.get("icon") else "None"
88
+ emoji = f'"{spec.get("emoji")}"' if spec.get("emoji") else "None"
89
+
85
90
  lines.extend(
86
91
  [
87
92
  f"{const_name} = SkillSpec(",
@@ -89,10 +94,12 @@ def generate_python_code(specs: list[dict[str, Any]]) -> str:
89
94
  f' name="{spec["name"]}",',
90
95
  f' description="{spec["description"]}",',
91
96
  f' module="{spec.get("module", "")}",',
92
- f" required_env_vars={_fmt_list(spec.get('required_env_vars', []))},",
97
+ f" envvars={_fmt_list(spec.get('envvars', []))},",
93
98
  f" optional_env_vars={_fmt_list(spec.get('optional_env_vars', []))},",
94
99
  f" dependencies={_fmt_list(spec.get('dependencies', []))},",
95
100
  f" tags={_fmt_list(spec.get('tags', []))},",
101
+ f" icon={icon},",
102
+ f" emoji={emoji},",
96
103
  f" enabled={spec.get('enabled', True)},",
97
104
  ")",
98
105
  "",
@@ -189,6 +196,8 @@ def generate_typescript_code(specs: list[dict[str, Any]]) -> str:
189
196
  " optionalEnvVars: string[];",
190
197
  " dependencies: string[];",
191
198
  " tags: string[];",
199
+ " icon?: string;",
200
+ " emoji?: string;",
192
201
  " enabled: boolean;",
193
202
  "}",
194
203
  "",
@@ -204,15 +213,17 @@ def generate_typescript_code(specs: list[dict[str, Any]]) -> str:
204
213
  const_name = f"{skill_id.upper().replace('-', '_')}_SKILL_SPEC"
205
214
 
206
215
  # Format arrays for TypeScript
207
- required_env_vars_json = str(spec.get("required_env_vars", [])).replace(
208
- "'", '"'
209
- )
216
+ envvars_json = str(spec.get("envvars", [])).replace("'", '"')
210
217
  optional_env_vars_json = str(spec.get("optional_env_vars", [])).replace(
211
218
  "'", '"'
212
219
  )
213
220
  dependencies_json = str(spec.get("dependencies", [])).replace("'", '"')
214
221
  tags_json = str(spec.get("tags", [])).replace("'", '"')
215
222
 
223
+ # Format optional fields
224
+ icon = f"'{spec.get('icon')}'" if spec.get("icon") else "undefined"
225
+ emoji = f"'{spec.get('emoji')}'" if spec.get("emoji") else "undefined"
226
+
216
227
  lines.extend(
217
228
  [
218
229
  f"export const {const_name}: SkillSpec = {{",
@@ -220,10 +231,12 @@ def generate_typescript_code(specs: list[dict[str, Any]]) -> str:
220
231
  f" name: '{spec['name']}',",
221
232
  f" description: '{spec['description']}',",
222
233
  f" module: '{spec.get('module', '')}',",
223
- f" requiredEnvVars: {required_env_vars_json},",
234
+ f" requiredEnvVars: {envvars_json},",
224
235
  f" optionalEnvVars: {optional_env_vars_json},",
225
236
  f" dependencies: {dependencies_json},",
226
237
  f" tags: {tags_json},",
238
+ f" icon: {icon},",
239
+ f" emoji: {emoji},",
227
240
  f" enabled: {str(spec.get('enabled', True)).lower()},",
228
241
  "};",
229
242
  "",