@datalayer/agent-runtimes 1.6.9 → 1.6.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.
@@ -1102,6 +1102,8 @@ function toAgentSkillSpec(skill: SkillSpec) {
1102
1102
  tags: skill.tags,
1103
1103
  enabled: skill.enabled,
1104
1104
  requiredEnvVars: skill.requiredEnvVars,
1105
+ icon: skill.icon,
1106
+ emoji: skill.emoji,
1105
1107
  };
1106
1108
  }
1107
1109
  """
@@ -22,6 +22,40 @@ import yaml
22
22
  from marks import check_marks
23
23
  from versioning import ensure_spec_version, version_suffix
24
24
 
25
+ #: What an ``install`` says is installed (agentspecs: mcp-servers, skills).
26
+ INSTALL_TYPES = ("npm", "python", "docker", "git", "remote", "built-in", "other")
27
+
28
+
29
+ def install_of(spec: dict) -> dict | None:
30
+ """A spec's ``install``, checked: ``{type, command, note?}``; None when it has none.
31
+
32
+ Raises
33
+ ------
34
+ ValueError
35
+ When it is not of that shape, in a sentence naming the spec.
36
+ """
37
+ install = spec.get("install")
38
+ if install is None:
39
+ return None
40
+ where = f"{spec.get('id')}: install"
41
+ if not isinstance(install, dict) or set(install) - {"type", "command", "note"}:
42
+ raise ValueError(f"{where} is {{type, command, note}}, not {install!r}")
43
+ if install.get("type") not in INSTALL_TYPES:
44
+ raise ValueError(
45
+ f"{where}.type is one of {', '.join(INSTALL_TYPES)}, not {install.get('type')!r}"
46
+ )
47
+ command = install.get("command", "")
48
+ if not isinstance(command, str):
49
+ raise ValueError(f"{where}.command is a shell command, a string")
50
+ if not command.strip() and install["type"] not in ("remote", "built-in", "other"):
51
+ raise ValueError(
52
+ f"{where}.command says how a {install['type']} install is run: it is empty"
53
+ )
54
+ out = {"type": install["type"], "command": command.strip()}
55
+ if install.get("note"):
56
+ out["note"] = " ".join(str(install["note"]).split())
57
+ return out
58
+
25
59
 
26
60
  def load_mcp_specs(specs_dir: Path) -> list[dict[str, Any]]:
27
61
  """Load all MCP server YAML specifications from a directory."""
@@ -53,7 +87,9 @@ def generate_python_code(specs: list[dict[str, Any]]) -> str:
53
87
  "import tempfile",
54
88
  "from typing import Dict",
55
89
  "",
56
- "from agent_runtimes.types import MCPServer"
90
+ "from agent_runtimes.types import "
91
+ + ("InstallSpec, " if any(spec.get("install") for spec in specs) else "")
92
+ + "MCPServer"
57
93
  + (", MCPServerAuth" if any(spec.get("auth") for spec in specs) else ""),
58
94
  "",
59
95
  "# " + "=" * 76,
@@ -170,6 +206,13 @@ def generate_python_code(specs: list[dict[str, Any]]) -> str:
170
206
  for key in ("documentation_url", "signup_url", "api_key_url", "setup"):
171
207
  if spec.get(key):
172
208
  lines.append(f" {key}={str(spec[key])!r},")
209
+ install = install_of(spec)
210
+ if install:
211
+ lines.append(
212
+ " install=InstallSpec("
213
+ + ", ".join(f"{k}={v!r}" for k, v in install.items())
214
+ + "),"
215
+ )
173
216
  if spec.get("actions"):
174
217
  lines.append(f" actions={_actions_of(spec)!r},")
175
218
  lines.extend([")", ""])
@@ -379,6 +422,11 @@ def generate_typescript_code(specs: list[dict[str, Any]]) -> str:
379
422
  )
380
423
  if spec.get(key)
381
424
  ],
425
+ *(
426
+ [f" install: {json.dumps(install_of(spec), ensure_ascii=False)},"]
427
+ if spec.get("install")
428
+ else []
429
+ ),
382
430
  *(
383
431
  [f" actions: {json.dumps(_actions_of(spec), ensure_ascii=False)},"]
384
432
  if spec.get("actions")
@@ -76,6 +76,7 @@ tags:
76
76
  enabled: false
77
77
  model: "bedrock:us.anthropic.claude-sonnet-4-6"
78
78
  harness: pydantic-ai
79
+ identity: datalayer-acting-agent
79
80
 
80
81
  sandbox_variant: {variant}
81
82
  memory: ephemeral
@@ -13,6 +13,7 @@ Usage:
13
13
  """
14
14
 
15
15
  import argparse
16
+ import json
16
17
  import sys
17
18
  from pathlib import Path
18
19
  from typing import Any
@@ -21,6 +22,40 @@ import yaml
21
22
  from marks import check_marks
22
23
  from versioning import ensure_spec_version, version_suffix
23
24
 
25
+ #: What an ``install`` says is installed (agentspecs: mcp-servers, skills).
26
+ INSTALL_TYPES = ("npm", "python", "docker", "git", "remote", "built-in", "other")
27
+
28
+
29
+ def install_of(spec: dict) -> dict | None:
30
+ """A spec's ``install``, checked: ``{type, command, note?}``; None when it has none.
31
+
32
+ Raises
33
+ ------
34
+ ValueError
35
+ When it is not of that shape, in a sentence naming the spec.
36
+ """
37
+ install = spec.get("install")
38
+ if install is None:
39
+ return None
40
+ where = f"{spec.get('id')}: install"
41
+ if not isinstance(install, dict) or set(install) - {"type", "command", "note"}:
42
+ raise ValueError(f"{where} is {{type, command, note}}, not {install!r}")
43
+ if install.get("type") not in INSTALL_TYPES:
44
+ raise ValueError(
45
+ f"{where}.type is one of {', '.join(INSTALL_TYPES)}, not {install.get('type')!r}"
46
+ )
47
+ command = install.get("command", "")
48
+ if not isinstance(command, str):
49
+ raise ValueError(f"{where}.command is a shell command, a string")
50
+ if not command.strip() and install["type"] not in ("remote", "built-in", "other"):
51
+ raise ValueError(
52
+ f"{where}.command says how a {install['type']} install is run: it is empty"
53
+ )
54
+ out = {"type": install["type"], "command": command.strip()}
55
+ if install.get("note"):
56
+ out["note"] = " ".join(str(install["note"]).split())
57
+ return out
58
+
24
59
 
25
60
  def _fmt_list(items: list[str]) -> str:
26
61
  """Format a list of strings with double quotes for ruff compliance."""
@@ -57,7 +92,9 @@ def generate_python_code(specs: list[dict[str, Any]]) -> str:
57
92
  "import os",
58
93
  "from typing import Dict, List",
59
94
  "",
60
- "from agent_runtimes.types import SkillSpec",
95
+ "from agent_runtimes.types import "
96
+ + ("InstallSpec, " if any(spec.get("install") for spec in specs) else "")
97
+ + "SkillSpec",
61
98
  "",
62
99
  "",
63
100
  "# " + "=" * 76,
@@ -113,6 +150,15 @@ def generate_python_code(specs: list[dict[str, Any]]) -> str:
113
150
  f" envvars={_fmt_list(spec.get('envvars', []))},",
114
151
  f" optional_env_vars={_fmt_list(spec.get('optional_env_vars', []))},",
115
152
  f" dependencies={_fmt_list(spec.get('dependencies', []))},",
153
+ *(
154
+ [
155
+ " install=InstallSpec("
156
+ + ", ".join(f"{k}={v!r}" for k, v in install_of(spec).items())
157
+ + "),"
158
+ ]
159
+ if spec.get("install")
160
+ else []
161
+ ),
116
162
  f" tags={_fmt_list(spec.get('tags', []))},",
117
163
  f" icon={icon},",
118
164
  f" emoji={emoji},",
@@ -277,6 +323,11 @@ def generate_typescript_code(specs: list[dict[str, Any]]) -> str:
277
323
  f" requiredEnvVars: {envvars_json},",
278
324
  f" optionalEnvVars: {optional_env_vars_json},",
279
325
  f" dependencies: {dependencies_json},",
326
+ *(
327
+ [f" install: {json.dumps(install_of(spec), ensure_ascii=False)},"]
328
+ if spec.get("install")
329
+ else []
330
+ ),
280
331
  f" tags: {tags_json},",
281
332
  f" icon: {icon},",
282
333
  f" emoji: {emoji},",