@datalayer/agent-runtimes 1.6.9 → 1.6.12
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.
- package/dist-embed/datalayer-app-main.js +7 -7
- package/lib/specs/actions.js +7 -0
- package/lib/specs/agents/agents.js +6 -2
- package/lib/specs/backendTools.d.ts +1 -0
- package/lib/specs/backendTools.js +19 -0
- package/lib/specs/cogs.js +5 -0
- package/lib/specs/envvars.js +1 -1
- package/lib/specs/mcpServers.d.ts +1 -0
- package/lib/specs/mcpServers.js +127 -1
- package/lib/specs/policies.d.ts +5 -0
- package/lib/specs/policies.js +85 -0
- package/lib/specs/skills.js +46 -1
- package/lib/specs/stages.js +1 -1
- package/lib/types/agentspecs.d.ts +13 -0
- package/lib/types/mcp.d.ts +3 -0
- package/lib/types/skills.d.ts +12 -0
- package/package.json +1 -1
- package/scripts/codegen/generate_agents.py +2 -0
- package/scripts/codegen/generate_mcp_servers.py +49 -1
- package/scripts/codegen/generate_sandbox_agents.py +1 -0
- package/scripts/codegen/generate_skills.py +52 -1
package/lib/specs/stages.js
CHANGED
|
@@ -167,7 +167,7 @@ export const PONG_STAGE_0_0_1 = {
|
|
|
167
167
|
id: 'pong',
|
|
168
168
|
version: '0.0.1',
|
|
169
169
|
name: 'Pong',
|
|
170
|
-
description: "Two
|
|
170
|
+
description: "Two players at the Pong arena, each with a paddle: Blue, a Player with the arena's tools; Red, played by Jev, a decision model choosing its moves. The arena keeps the score; the first to eleven wins.",
|
|
171
171
|
scene: '',
|
|
172
172
|
app: '',
|
|
173
173
|
battle: 'pong:0.0.1',
|
|
@@ -295,6 +295,19 @@ export interface PolicySpec {
|
|
|
295
295
|
headers?: Record<string, string>;
|
|
296
296
|
};
|
|
297
297
|
} | null;
|
|
298
|
+
/**
|
|
299
|
+
* A Dogwood policy set deciding every classed action over the session's
|
|
300
|
+
* history (AgentCore Policy's language): `enforce` refuses what it denies,
|
|
301
|
+
* `log_only` records it and lets it through.
|
|
302
|
+
*/
|
|
303
|
+
dogwood?: {
|
|
304
|
+
policies: string;
|
|
305
|
+
mode?: 'enforce' | 'log_only';
|
|
306
|
+
} | null;
|
|
307
|
+
/** Per user, through the organization's AgentCore Gateways: requests, tokens and connections per second or minute. */
|
|
308
|
+
rate_limits?: Record<string, unknown> | null;
|
|
309
|
+
/** The Shield firewall's document, as agent-shield takes it. */
|
|
310
|
+
firewall?: Record<string, unknown> | null;
|
|
298
311
|
};
|
|
299
312
|
}
|
|
300
313
|
/**
|
package/lib/types/mcp.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A tool provided by an MCP server.
|
|
3
3
|
*/
|
|
4
|
+
import type { InstallSpec } from './skills';
|
|
4
5
|
export interface MCPServerTool {
|
|
5
6
|
/** Tool name/identifier */
|
|
6
7
|
name: string;
|
|
@@ -70,6 +71,8 @@ export interface MCPServer {
|
|
|
70
71
|
apiKeyUrl?: string;
|
|
71
72
|
/** How it is set up, in a sentence: which key, where it goes */
|
|
72
73
|
setup?: string;
|
|
74
|
+
/** How it is installed where an agent runs it */
|
|
75
|
+
install?: InstallSpec;
|
|
73
76
|
/** What each tool does to the world (agentspecs.actions): its class by tool name, when it was checked, and a note */
|
|
74
77
|
actions?: MCPServerActions;
|
|
75
78
|
}
|
package/lib/types/skills.d.ts
CHANGED
|
@@ -105,6 +105,8 @@ export interface SkillSpec {
|
|
|
105
105
|
optionalEnvVars?: string[];
|
|
106
106
|
/** Python package dependencies */
|
|
107
107
|
dependencies?: string[];
|
|
108
|
+
/** How it is installed where an agent runs it */
|
|
109
|
+
install?: InstallSpec;
|
|
108
110
|
/** Tags for categorization */
|
|
109
111
|
tags: string[];
|
|
110
112
|
/** The icon, `<package>:<name>` — `@datalayer/icons-react:odoo` (agentspecs.marks; see `SpecMark`) */
|
|
@@ -114,3 +116,13 @@ export interface SkillSpec {
|
|
|
114
116
|
/** Whether the skill is enabled */
|
|
115
117
|
enabled: boolean;
|
|
116
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* How an MCP server or a skill is installed where an agent runs it: what is
|
|
121
|
+
* installed, the shell command that installs it on a person's own machine
|
|
122
|
+
* (`''` when nothing is run), and what else to know.
|
|
123
|
+
*/
|
|
124
|
+
export interface InstallSpec {
|
|
125
|
+
type: 'npm' | 'python' | 'docker' | 'git' | 'remote' | 'built-in' | 'other';
|
|
126
|
+
command: string;
|
|
127
|
+
note?: string;
|
|
128
|
+
}
|
package/package.json
CHANGED
|
@@ -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
|
|
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")
|
|
@@ -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
|
|
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},",
|