@datalayer/agent-runtimes 1.3.58 → 1.3.60
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/lib/chat/ChatFloating.d.ts +11 -1
- package/lib/chat/ChatFloating.js +6 -2
- package/lib/chat/assistant/AssistantStage.d.ts +7 -1
- package/lib/chat/assistant/AssistantStage.js +5 -3
- package/lib/chat/assistant/DecisionAsk.d.ts +31 -0
- package/lib/chat/assistant/DecisionAsk.js +96 -0
- package/lib/chat/assistant/SpeechBalloon.d.ts +11 -2
- package/lib/chat/assistant/SpeechBalloon.js +5 -4
- package/lib/chat/assistant/decisions.d.ts +104 -0
- package/lib/chat/assistant/decisions.js +161 -0
- package/lib/chat/marks/toolMarks.js +2 -2
- package/lib/config/AgentConfiguration.d.ts +2 -1
- package/lib/config/AgentConfiguration.js +2 -2
- package/lib/examples/AgentDecideExample.d.ts +24 -0
- package/lib/examples/AgentDecideExample.js +73 -0
- package/lib/examples/AgentNotificationsExample.js +1 -1
- package/lib/examples/AgentSkillsExample.js +1 -1
- package/lib/examples/AgentspecsExample.js +3 -3
- package/lib/examples/ChatAssistantGalleryExample.d.ts +12 -0
- package/lib/examples/ChatAssistantGalleryExample.js +181 -0
- package/lib/examples/example-selector.js +2 -0
- package/lib/examples/index.d.ts +2 -0
- package/lib/examples/index.js +2 -0
- package/lib/examples/main.js +5 -0
- package/lib/examples/utils/AssistantGalleryGrid.d.ts +53 -0
- package/lib/examples/utils/AssistantGalleryGrid.js +123 -0
- package/lib/examples/utils/assistantGallery.d.ts +42 -0
- package/lib/examples/utils/assistantGallery.js +102 -0
- package/lib/examples/utils/testSpriteCharacter.d.ts +9 -0
- package/lib/examples/utils/testSpriteCharacter.js +60 -0
- package/lib/loop/apps/appspec.js +4 -4
- package/lib/loop/apps/checks.js +6 -6
- package/lib/loop/apps/rules.js +2 -2
- package/lib/loop/plugins/assistant/index.d.ts +14 -2
- package/lib/loop/plugins/assistant/index.js +13 -4
- package/lib/specs/actions.d.ts +1 -1
- package/lib/specs/actions.js +1 -1
- package/lib/specs/agents/agents.js +197 -192
- package/lib/specs/apps.js +13 -13
- package/lib/specs/appspecSchema.js +3 -3
- package/lib/specs/backendTools.d.ts +31 -0
- package/lib/specs/{tools.js → backendTools.js} +48 -48
- package/lib/specs/cogs.js +8 -7
- package/lib/specs/frames.js +5 -5
- package/lib/specs/index.d.ts +1 -1
- package/lib/specs/index.js +1 -1
- package/lib/stores/agentRuntimeStore.js +2 -2
- package/lib/stories/loop/pictures-main.js +16 -1
- package/lib/types/agentspecs.d.ts +7 -5
- package/lib/types/config.d.ts +2 -2
- package/lib/types/tools.d.ts +3 -3
- package/package.json +1 -1
- package/scripts/codegen/generate_agents.py +23 -12
- package/scripts/codegen/generate_apps.py +3 -2
- package/scripts/codegen/{generate_tools.py → generate_backend_tools.py} +29 -29
- package/scripts/codegen/generate_cogs.py +2 -2
- package/scripts/codegen/generate_frames.py +2 -2
- package/lib/specs/tools.d.ts +0 -31
package/package.json
CHANGED
|
@@ -234,6 +234,15 @@ def load_fragments(specs_dir: Path) -> List[Dict[str, Any]]:
|
|
|
234
234
|
return fragments
|
|
235
235
|
|
|
236
236
|
|
|
237
|
+
def refuse_tools_field(spec: Dict[str, Any], path: Path) -> None:
|
|
238
|
+
"""Refuse an agent spec that still says `tools`: it is `backend_tools` now."""
|
|
239
|
+
if "tools" in spec:
|
|
240
|
+
raise SystemExit(
|
|
241
|
+
f"Error: {path} says `tools`: the field is `backend_tools` — the tools "
|
|
242
|
+
"that run on the runtime, as `frontend_tools` are those that run on the page"
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
|
|
237
246
|
def load_yaml_specs(specs_dir: Path) -> List[tuple[str, Dict[str, Any]]]:
|
|
238
247
|
"""
|
|
239
248
|
Load all YAML agent specifications from directory and subdirectories.
|
|
@@ -254,6 +263,7 @@ def load_yaml_specs(specs_dir: Path) -> List[tuple[str, Dict[str, Any]]]:
|
|
|
254
263
|
spec = yaml.safe_load(f)
|
|
255
264
|
if spec: # Skip empty files
|
|
256
265
|
ensure_spec_version(spec)
|
|
266
|
+
refuse_tools_field(spec, yaml_file)
|
|
257
267
|
specs.append(("", spec))
|
|
258
268
|
|
|
259
269
|
# Then, load specs from subdirectories (one level deep)
|
|
@@ -264,6 +274,7 @@ def load_yaml_specs(specs_dir: Path) -> List[tuple[str, Dict[str, Any]]]:
|
|
|
264
274
|
spec = yaml.safe_load(f)
|
|
265
275
|
if spec: # Skip empty files
|
|
266
276
|
ensure_spec_version(spec)
|
|
277
|
+
refuse_tools_field(spec, yaml_file)
|
|
267
278
|
specs.append((subdir.name, spec))
|
|
268
279
|
|
|
269
280
|
fragments = load_fragments(specs_dir)
|
|
@@ -399,7 +410,7 @@ from agent_runtimes.types import (
|
|
|
399
410
|
for skill in spec.get("skills", [])
|
|
400
411
|
]
|
|
401
412
|
tool_refs = [
|
|
402
|
-
versioned_ref(*split_spec_ref(tool)) for tool in spec.get("
|
|
413
|
+
versioned_ref(*split_spec_ref(tool)) for tool in spec.get("backend_tools", [])
|
|
403
414
|
]
|
|
404
415
|
frontend_tool_refs = [
|
|
405
416
|
versioned_ref(*split_spec_ref(ft))
|
|
@@ -591,7 +602,7 @@ from agent_runtimes.types import (
|
|
|
591
602
|
{model_additionals_py_line} inference_provider={inference_provider_str},
|
|
592
603
|
mcp_servers=[{mcp_servers_str}],
|
|
593
604
|
skills={_fmt_list(skill_refs)},
|
|
594
|
-
|
|
605
|
+
backend_tools={_fmt_list(tool_refs)},
|
|
595
606
|
{disable_tool_approvals_line} frontend_tools={_fmt_list(frontend_tool_refs)},
|
|
596
607
|
{frontend_render_tools_py_line} environment_name="{spec.get("environment_name", "ai-agents-env")}",
|
|
597
608
|
icon={icon},
|
|
@@ -740,7 +751,7 @@ def generate_typescript_code(
|
|
|
740
751
|
used_mcp_servers.add(versioned_ref(*split_spec_ref(server)))
|
|
741
752
|
for skill in spec.get("skills", []):
|
|
742
753
|
used_skills.add(versioned_ref(*split_spec_ref(skill)))
|
|
743
|
-
for tool in spec.get("
|
|
754
|
+
for tool in spec.get("backend_tools", []):
|
|
744
755
|
used_tools.add(versioned_ref(*split_spec_ref(tool)))
|
|
745
756
|
for ft in spec.get("frontend_tools", []):
|
|
746
757
|
used_frontend_tools.add(versioned_ref(*split_spec_ref(ft)))
|
|
@@ -786,7 +797,7 @@ def generate_typescript_code(
|
|
|
786
797
|
if tref in used_tools:
|
|
787
798
|
const_name = (
|
|
788
799
|
tid.upper().replace("-", "_")
|
|
789
|
-
+ "
|
|
800
|
+
+ "_BACKEND_TOOL_SPEC"
|
|
790
801
|
+ version_suffix(spec["version"])
|
|
791
802
|
)
|
|
792
803
|
tool_imports.append(const_name)
|
|
@@ -830,7 +841,7 @@ def generate_typescript_code(
|
|
|
830
841
|
types_import_path = "../../types" if is_root_layout else "../../../types"
|
|
831
842
|
mcp_import_path = "../mcpServers" if is_root_layout else "../../mcpServers"
|
|
832
843
|
skills_import_path = "../skills" if is_root_layout else "../../skills"
|
|
833
|
-
tools_import_path = "../
|
|
844
|
+
tools_import_path = "../backendTools" if is_root_layout else "../../backendTools"
|
|
834
845
|
frontend_tools_import_path = (
|
|
835
846
|
"../frontendTools" if is_root_layout else "../../frontendTools"
|
|
836
847
|
)
|
|
@@ -929,7 +940,7 @@ function toAgentSkillSpec(skill: SkillSpec) {
|
|
|
929
940
|
if has_tools:
|
|
930
941
|
code += """
|
|
931
942
|
/**
|
|
932
|
-
* Map tool IDs to
|
|
943
|
+
* Map backend tool IDs to BackendToolSpec objects.
|
|
933
944
|
*/
|
|
934
945
|
const TOOL_MAP: Record<string, any> = {
|
|
935
946
|
"""
|
|
@@ -1019,9 +1030,9 @@ const FRONTEND_TOOL_MAP: Record<string, any> = {
|
|
|
1019
1030
|
else:
|
|
1020
1031
|
skills_str = ""
|
|
1021
1032
|
|
|
1022
|
-
# Get tools - resolve to
|
|
1033
|
+
# Get backend tools - resolve to BackendToolSpec via TOOL_MAP
|
|
1023
1034
|
tool_ids_list = [
|
|
1024
|
-
versioned_ref(*split_spec_ref(sid)) for sid in spec.get("
|
|
1035
|
+
versioned_ref(*split_spec_ref(sid)) for sid in spec.get("backend_tools", [])
|
|
1025
1036
|
]
|
|
1026
1037
|
if has_tools and tool_ids_list:
|
|
1027
1038
|
tools_str = ", ".join(f"TOOL_MAP['{tid}']" for tid in tool_ids_list)
|
|
@@ -1165,7 +1176,7 @@ const FRONTEND_TOOL_MAP: Record<string, any> = {
|
|
|
1165
1176
|
model: {model_ts},
|
|
1166
1177
|
{model_additionals_ts_line}{inference_provider_line} mcpServers: [{mcp_servers_str}],
|
|
1167
1178
|
skills: [{skills_str}].filter(Boolean) as SkillSpec[],
|
|
1168
|
-
|
|
1179
|
+
backendTools: [{tools_str}],
|
|
1169
1180
|
{disable_tool_approvals_line} frontendTools: [{frontend_tools_str}],
|
|
1170
1181
|
{frontend_render_tools_ts_line} environmentName: '{spec.get("environment_name", "ai-agents-env")}',
|
|
1171
1182
|
icon: {icon},
|
|
@@ -1338,7 +1349,7 @@ def generate_subfolder_structure(specs: List[tuple[str, Dict[str, Any]]], args):
|
|
|
1338
1349
|
# Get MCP and skills specs directories
|
|
1339
1350
|
mcp_specs_dir = args.specs_dir.parent / "mcp-servers"
|
|
1340
1351
|
skills_specs_dir = args.specs_dir.parent / "skills"
|
|
1341
|
-
tools_specs_dir = args.specs_dir.parent / "tools"
|
|
1352
|
+
tools_specs_dir = args.specs_dir.parent / "backend-tools"
|
|
1342
1353
|
|
|
1343
1354
|
# Determine base directories
|
|
1344
1355
|
python_base = args.python_output.parent / "agents"
|
|
@@ -1624,7 +1635,7 @@ export * from './modelProviders';
|
|
|
1624
1635
|
export * from './notifications';
|
|
1625
1636
|
export * from './outputs';
|
|
1626
1637
|
export * from './skills';
|
|
1627
|
-
export * from './
|
|
1638
|
+
export * from './backendTools';
|
|
1628
1639
|
export * from './triggers';
|
|
1629
1640
|
export * from './uiPlugins';
|
|
1630
1641
|
export * from './frames';
|
|
@@ -1698,7 +1709,7 @@ def main():
|
|
|
1698
1709
|
# Get MCP and skills specs directories (siblings to agents directory)
|
|
1699
1710
|
mcp_specs_dir = args.specs_dir.parent / "mcp-servers"
|
|
1700
1711
|
skills_specs_dir = args.specs_dir.parent / "skills"
|
|
1701
|
-
tools_specs_dir = args.specs_dir.parent / "tools"
|
|
1712
|
+
tools_specs_dir = args.specs_dir.parent / "backend-tools"
|
|
1702
1713
|
typescript_code = generate_typescript_code(
|
|
1703
1714
|
specs,
|
|
1704
1715
|
str(mcp_specs_dir),
|
|
@@ -52,6 +52,7 @@ CAMEL = {
|
|
|
52
52
|
"composed_at": "composedAt",
|
|
53
53
|
"min_confidence": "minConfidence",
|
|
54
54
|
"decision_model": "decisionModel",
|
|
55
|
+
"backend_tools": "backendTools",
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
#: The keys whose value is carried as it is written: a component tree, weights by name.
|
|
@@ -350,7 +351,7 @@ def generate_actions_python_code(actions: dict[str, Any]) -> str:
|
|
|
350
351
|
f"ACTION_CLASSES: List[str] = {actions['classes']!r}",
|
|
351
352
|
"",
|
|
352
353
|
"#: What each tool of the tools catalogue does, by id.",
|
|
353
|
-
f"
|
|
354
|
+
f"BACKEND_TOOL_ACTIONS: Dict[str, List[str]] = {actions['tools']!r}",
|
|
354
355
|
"",
|
|
355
356
|
"#: What each MCP server's tools do, by server id. `checked` is the day the",
|
|
356
357
|
"#: names were read off the running server, or None when nobody looked.",
|
|
@@ -401,7 +402,7 @@ def generate_actions_typescript_code(actions: dict[str, Any]) -> str:
|
|
|
401
402
|
f"export const ACTION_CLASSES: ActionClass[] = {json.dumps(actions['classes'])};",
|
|
402
403
|
"",
|
|
403
404
|
"/** What each tool of the tools catalogue does, by id. */",
|
|
404
|
-
"export const
|
|
405
|
+
"export const BACKEND_TOOL_ACTIONS: Record<string, ActionClass[]> = "
|
|
405
406
|
+ json.dumps(actions["tools"], indent=2)
|
|
406
407
|
+ ";",
|
|
407
408
|
"",
|
|
@@ -88,7 +88,7 @@ def generate_python_code(specs: list[dict[str, Any]]) -> str:
|
|
|
88
88
|
"# Copyright (c) 2025-2026 Datalayer, Inc.",
|
|
89
89
|
"# Distributed under the terms of the Modified BSD License.",
|
|
90
90
|
'"""',
|
|
91
|
-
"Tool Catalog.",
|
|
91
|
+
"Backend Tool Catalog.",
|
|
92
92
|
"",
|
|
93
93
|
"Predefined runtime tools that can be attached to agents.",
|
|
94
94
|
"",
|
|
@@ -98,11 +98,11 @@ def generate_python_code(specs: list[dict[str, Any]]) -> str:
|
|
|
98
98
|
"",
|
|
99
99
|
"from typing import Dict, List",
|
|
100
100
|
"",
|
|
101
|
-
"from agent_runtimes.types import
|
|
101
|
+
"from agent_runtimes.types import BackendToolRuntimeSpec, BackendToolSpec",
|
|
102
102
|
"",
|
|
103
103
|
"",
|
|
104
104
|
"# " + "=" * 76,
|
|
105
|
-
"# Tool Definitions",
|
|
105
|
+
"# Backend Tool Definitions",
|
|
106
106
|
"# " + "=" * 76,
|
|
107
107
|
"",
|
|
108
108
|
]
|
|
@@ -111,7 +111,7 @@ def generate_python_code(specs: list[dict[str, Any]]) -> str:
|
|
|
111
111
|
tool_id = spec["id"]
|
|
112
112
|
version = spec["version"]
|
|
113
113
|
const_name = (
|
|
114
|
-
f"{tool_id.upper().replace('-', '_')}
|
|
114
|
+
f"{tool_id.upper().replace('-', '_')}_BACKEND_TOOL_SPEC{version_suffix(version)}"
|
|
115
115
|
)
|
|
116
116
|
runtime = _require_runtime(spec)
|
|
117
117
|
requires_approval = _requires_approval(spec)
|
|
@@ -122,7 +122,7 @@ def generate_python_code(specs: list[dict[str, Any]]) -> str:
|
|
|
122
122
|
|
|
123
123
|
lines.extend(
|
|
124
124
|
[
|
|
125
|
-
f"{const_name} =
|
|
125
|
+
f"{const_name} = BackendToolSpec(",
|
|
126
126
|
f' id="{tool_id}",',
|
|
127
127
|
f' version="{version}",',
|
|
128
128
|
f" name={json.dumps(spec['name'], ensure_ascii=False)},",
|
|
@@ -132,7 +132,7 @@ def generate_python_code(specs: list[dict[str, Any]]) -> str:
|
|
|
132
132
|
f' approval="{spec.get("approval", "auto")}",',
|
|
133
133
|
f" timeout={timeout_py},",
|
|
134
134
|
f" requires_approval={requires_approval},",
|
|
135
|
-
" runtime=
|
|
135
|
+
" runtime=BackendToolRuntimeSpec(",
|
|
136
136
|
f' language="{runtime["language"]}",',
|
|
137
137
|
f' package="{runtime["package"]}",',
|
|
138
138
|
f' method="{runtime["method"]}",',
|
|
@@ -147,10 +147,10 @@ def generate_python_code(specs: list[dict[str, Any]]) -> str:
|
|
|
147
147
|
lines.extend(
|
|
148
148
|
[
|
|
149
149
|
"# " + "=" * 76,
|
|
150
|
-
"# Tool Catalog",
|
|
150
|
+
"# Backend Tool Catalog",
|
|
151
151
|
"# " + "=" * 76,
|
|
152
152
|
"",
|
|
153
|
-
"
|
|
153
|
+
"BACKEND_TOOL_CATALOG: Dict[str, BackendToolSpec] = {",
|
|
154
154
|
]
|
|
155
155
|
)
|
|
156
156
|
|
|
@@ -158,7 +158,7 @@ def generate_python_code(specs: list[dict[str, Any]]) -> str:
|
|
|
158
158
|
tool_id = spec["id"]
|
|
159
159
|
version = spec["version"]
|
|
160
160
|
const_name = (
|
|
161
|
-
f"{tool_id.upper().replace('-', '_')}
|
|
161
|
+
f"{tool_id.upper().replace('-', '_')}_BACKEND_TOOL_SPEC{version_suffix(version)}"
|
|
162
162
|
)
|
|
163
163
|
lines.append(f' "{tool_id}": {const_name},')
|
|
164
164
|
|
|
@@ -167,20 +167,20 @@ def generate_python_code(specs: list[dict[str, Any]]) -> str:
|
|
|
167
167
|
"}",
|
|
168
168
|
"",
|
|
169
169
|
"",
|
|
170
|
-
"def
|
|
170
|
+
"def get_backend_tool_spec(tool_id: str) -> BackendToolSpec | None:",
|
|
171
171
|
' """Get a tool specification by ID (accepts both bare and versioned refs)."""',
|
|
172
|
-
" spec =
|
|
172
|
+
" spec = BACKEND_TOOL_CATALOG.get(tool_id)",
|
|
173
173
|
" if spec is not None:",
|
|
174
174
|
" return spec",
|
|
175
175
|
" base, _, ver = tool_id.rpartition(':')",
|
|
176
176
|
" if base and '.' in ver:",
|
|
177
|
-
" return
|
|
177
|
+
" return BACKEND_TOOL_CATALOG.get(base)",
|
|
178
178
|
" return None",
|
|
179
179
|
"",
|
|
180
180
|
"",
|
|
181
|
-
"def
|
|
181
|
+
"def list_backend_tool_specs() -> List[BackendToolSpec]:",
|
|
182
182
|
' """List all tool specifications."""',
|
|
183
|
-
" return list(
|
|
183
|
+
" return list(BACKEND_TOOL_CATALOG.values())",
|
|
184
184
|
"",
|
|
185
185
|
]
|
|
186
186
|
)
|
|
@@ -196,7 +196,7 @@ def generate_typescript_code(specs: list[dict[str, Any]]) -> str:
|
|
|
196
196
|
" */",
|
|
197
197
|
"",
|
|
198
198
|
"/**",
|
|
199
|
-
" * Tool Catalog",
|
|
199
|
+
" * Backend Tool Catalog",
|
|
200
200
|
" *",
|
|
201
201
|
" * Predefined runtime tools that can be attached to agents.",
|
|
202
202
|
" *",
|
|
@@ -204,10 +204,10 @@ def generate_typescript_code(specs: list[dict[str, Any]]) -> str:
|
|
|
204
204
|
" * DO NOT EDIT MANUALLY - run 'make specs' to regenerate.",
|
|
205
205
|
" */",
|
|
206
206
|
"",
|
|
207
|
-
"import type {
|
|
207
|
+
"import type { BackendToolSpec } from '../types';",
|
|
208
208
|
"",
|
|
209
209
|
"// " + "=" * 76,
|
|
210
|
-
"// Tool Definitions",
|
|
210
|
+
"// Backend Tool Definitions",
|
|
211
211
|
"// " + "=" * 76,
|
|
212
212
|
"",
|
|
213
213
|
]
|
|
@@ -216,7 +216,7 @@ def generate_typescript_code(specs: list[dict[str, Any]]) -> str:
|
|
|
216
216
|
tool_id = spec["id"]
|
|
217
217
|
version = spec["version"]
|
|
218
218
|
const_name = (
|
|
219
|
-
f"{tool_id.upper().replace('-', '_')}
|
|
219
|
+
f"{tool_id.upper().replace('-', '_')}_BACKEND_TOOL_SPEC{version_suffix(version)}"
|
|
220
220
|
)
|
|
221
221
|
runtime = _require_runtime(spec)
|
|
222
222
|
requires_approval = _requires_approval(spec)
|
|
@@ -228,7 +228,7 @@ def generate_typescript_code(specs: list[dict[str, Any]]) -> str:
|
|
|
228
228
|
|
|
229
229
|
lines.extend(
|
|
230
230
|
[
|
|
231
|
-
f"export const {const_name}:
|
|
231
|
+
f"export const {const_name}: BackendToolSpec = {{",
|
|
232
232
|
f" id: '{tool_id}',",
|
|
233
233
|
f" version: '{version}',",
|
|
234
234
|
# JSON-escaped: an apostrophe in a description is not a syntax error.
|
|
@@ -254,10 +254,10 @@ def generate_typescript_code(specs: list[dict[str, Any]]) -> str:
|
|
|
254
254
|
lines.extend(
|
|
255
255
|
[
|
|
256
256
|
"// " + "=" * 76,
|
|
257
|
-
"// Tool Catalog",
|
|
257
|
+
"// Backend Tool Catalog",
|
|
258
258
|
"// " + "=" * 76,
|
|
259
259
|
"",
|
|
260
|
-
"export const
|
|
260
|
+
"export const BACKEND_TOOL_CATALOG: Record<string, BackendToolSpec> = {",
|
|
261
261
|
]
|
|
262
262
|
)
|
|
263
263
|
|
|
@@ -265,7 +265,7 @@ def generate_typescript_code(specs: list[dict[str, Any]]) -> str:
|
|
|
265
265
|
tool_id = spec["id"]
|
|
266
266
|
version = spec["version"]
|
|
267
267
|
const_name = (
|
|
268
|
-
f"{tool_id.upper().replace('-', '_')}
|
|
268
|
+
f"{tool_id.upper().replace('-', '_')}_BACKEND_TOOL_SPEC{version_suffix(version)}"
|
|
269
269
|
)
|
|
270
270
|
lines.append(f" '{tool_id}': {const_name},")
|
|
271
271
|
|
|
@@ -273,22 +273,22 @@ def generate_typescript_code(specs: list[dict[str, Any]]) -> str:
|
|
|
273
273
|
[
|
|
274
274
|
"};",
|
|
275
275
|
"",
|
|
276
|
-
"export function
|
|
277
|
-
" return Object.values(
|
|
276
|
+
"export function getBackendToolSpecs(): BackendToolSpec[] {",
|
|
277
|
+
" return Object.values(BACKEND_TOOL_CATALOG);",
|
|
278
278
|
"}",
|
|
279
279
|
"",
|
|
280
|
-
"function
|
|
281
|
-
" if (toolId in
|
|
280
|
+
"function resolveBackendToolId(toolId: string): string {",
|
|
281
|
+
" if (toolId in BACKEND_TOOL_CATALOG) return toolId;",
|
|
282
282
|
" const idx = toolId.lastIndexOf(':');",
|
|
283
283
|
" if (idx > 0) {",
|
|
284
284
|
" const base = toolId.slice(0, idx);",
|
|
285
|
-
" if (base in
|
|
285
|
+
" if (base in BACKEND_TOOL_CATALOG) return base;",
|
|
286
286
|
" }",
|
|
287
287
|
" return toolId;",
|
|
288
288
|
"}",
|
|
289
289
|
"",
|
|
290
|
-
"export function
|
|
291
|
-
" return
|
|
290
|
+
"export function getBackendToolSpec(toolId: string): BackendToolSpec | undefined {",
|
|
291
|
+
" return BACKEND_TOOL_CATALOG[resolveBackendToolId(toolId)];",
|
|
292
292
|
"}",
|
|
293
293
|
"",
|
|
294
294
|
]
|
|
@@ -168,7 +168,7 @@ def generate_typescript_code(specs: list[dict[str, Any]], specs_dir: Path) -> st
|
|
|
168
168
|
[("", spec) for spec in specs],
|
|
169
169
|
str(root / "mcp-servers"),
|
|
170
170
|
str(root / "skills"),
|
|
171
|
-
str(root / "tools"),
|
|
171
|
+
str(root / "backend-tools"),
|
|
172
172
|
)
|
|
173
173
|
marker = "// ============================================================================\n// Agent Specs Registry"
|
|
174
174
|
if marker not in code:
|
|
@@ -208,7 +208,7 @@ def generate_typescript_code(specs: list[dict[str, Any]], specs_dir: Path) -> st
|
|
|
208
208
|
# is one directory up, beside the catalogues it imports.
|
|
209
209
|
head = head.replace("from '../../types'", "from '../types'")
|
|
210
210
|
head = re.sub(
|
|
211
|
-
r"from '\.\./(mcpServers|skills|
|
|
211
|
+
r"from '\.\./(mcpServers|skills|backendTools|frontendTools)'", r"from './\1'", head
|
|
212
212
|
)
|
|
213
213
|
|
|
214
214
|
lines = [
|
|
@@ -53,13 +53,13 @@ FIELDS = (
|
|
|
53
53
|
"architecture",
|
|
54
54
|
"prompts",
|
|
55
55
|
"skills",
|
|
56
|
-
"
|
|
56
|
+
"backend_tools",
|
|
57
57
|
"mcp_servers",
|
|
58
58
|
"guards",
|
|
59
59
|
)
|
|
60
60
|
|
|
61
61
|
#: Python field → TypeScript property, where they differ.
|
|
62
|
-
CAMEL = {"mcp_servers": "mcpServers"}
|
|
62
|
+
CAMEL = {"mcp_servers": "mcpServers", "backend_tools": "backendTools"}
|
|
63
63
|
|
|
64
64
|
|
|
65
65
|
def load_frame_specs(specs_dir: Path) -> list[dict[str, Any]]:
|
package/lib/specs/tools.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tool Catalog
|
|
3
|
-
*
|
|
4
|
-
* Predefined runtime tools that can be attached to agents.
|
|
5
|
-
*
|
|
6
|
-
* This file is AUTO-GENERATED from YAML specifications.
|
|
7
|
-
* DO NOT EDIT MANUALLY - run 'make specs' to regenerate.
|
|
8
|
-
*/
|
|
9
|
-
import type { ToolSpec } from '../types';
|
|
10
|
-
export declare const CREATE_PLAN_TOOL_SPEC_0_0_1: ToolSpec;
|
|
11
|
-
export declare const CURRENT_TIME_TOOL_SPEC_0_0_1: ToolSpec;
|
|
12
|
-
export declare const DECIDE_TOOL_SPEC_0_0_1: ToolSpec;
|
|
13
|
-
export declare const DISPLAY_RECIPE_TOOL_SPEC_0_0_1: ToolSpec;
|
|
14
|
-
export declare const EXAMPLE_CREATE_PLAN_TOOL_SPEC_0_0_1: ToolSpec;
|
|
15
|
-
export declare const EXAMPLE_CURRENT_TIME_TOOL_SPEC_0_0_1: ToolSpec;
|
|
16
|
-
export declare const EXAMPLE_DISPLAY_RECIPE_TOOL_SPEC_0_0_1: ToolSpec;
|
|
17
|
-
export declare const EXAMPLE_GENERATE_HAIKU_TOOL_SPEC_0_0_1: ToolSpec;
|
|
18
|
-
export declare const EXAMPLE_GENERATE_TASK_STEPS_TOOL_SPEC_0_0_1: ToolSpec;
|
|
19
|
-
export declare const EXAMPLE_GET_WEATHER_TOOL_SPEC_0_0_1: ToolSpec;
|
|
20
|
-
export declare const EXAMPLE_RENDER_A2UI_SURFACE_TOOL_SPEC_0_0_1: ToolSpec;
|
|
21
|
-
export declare const EXAMPLE_UPDATE_PLAN_STEP_TOOL_SPEC_0_0_1: ToolSpec;
|
|
22
|
-
export declare const GENERATE_HAIKU_TOOL_SPEC_0_0_1: ToolSpec;
|
|
23
|
-
export declare const GENERATE_TASK_STEPS_TOOL_SPEC_0_0_1: ToolSpec;
|
|
24
|
-
export declare const GET_WEATHER_TOOL_SPEC_0_0_1: ToolSpec;
|
|
25
|
-
export declare const RUNTIME_ECHO_TOOL_SPEC_0_0_1: ToolSpec;
|
|
26
|
-
export declare const RUNTIME_SEND_MAIL_TOOL_SPEC_0_0_1: ToolSpec;
|
|
27
|
-
export declare const RUNTIME_SENSITIVE_ECHO_TOOL_SPEC_0_0_1: ToolSpec;
|
|
28
|
-
export declare const UPDATE_PLAN_STEP_TOOL_SPEC_0_0_1: ToolSpec;
|
|
29
|
-
export declare const TOOL_CATALOG: Record<string, ToolSpec>;
|
|
30
|
-
export declare function getToolSpecs(): ToolSpec[];
|
|
31
|
-
export declare function getToolSpec(toolId: string): ToolSpec | undefined;
|