seed-toolbox 1.0.2__tar.gz
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.
- seed_toolbox-1.0.2/PKG-INFO +16 -0
- seed_toolbox-1.0.2/README.md +46 -0
- seed_toolbox-1.0.2/pyproject.toml +29 -0
- seed_toolbox-1.0.2/seed_toolbox.egg-info/PKG-INFO +16 -0
- seed_toolbox-1.0.2/seed_toolbox.egg-info/SOURCES.txt +67 -0
- seed_toolbox-1.0.2/seed_toolbox.egg-info/dependency_links.txt +1 -0
- seed_toolbox-1.0.2/seed_toolbox.egg-info/requires.txt +11 -0
- seed_toolbox-1.0.2/seed_toolbox.egg-info/top_level.txt +1 -0
- seed_toolbox-1.0.2/seed_tools/__init__.py +12 -0
- seed_toolbox-1.0.2/seed_tools/_builtin_checks.py +70 -0
- seed_toolbox-1.0.2/seed_tools/_preset_helpers.py +68 -0
- seed_toolbox-1.0.2/seed_tools/_registration.py +262 -0
- seed_toolbox-1.0.2/seed_tools/api_docs.py +196 -0
- seed_toolbox-1.0.2/seed_tools/artifact.py +114 -0
- seed_toolbox-1.0.2/seed_tools/artifact_helpers.py +116 -0
- seed_toolbox-1.0.2/seed_tools/bash.py +84 -0
- seed_toolbox-1.0.2/seed_tools/browser.py +1265 -0
- seed_toolbox-1.0.2/seed_tools/code_check.py +304 -0
- seed_toolbox-1.0.2/seed_tools/cron.py +141 -0
- seed_toolbox-1.0.2/seed_tools/db.py +299 -0
- seed_toolbox-1.0.2/seed_tools/deploy.py +248 -0
- seed_toolbox-1.0.2/seed_tools/deps_check.py +229 -0
- seed_toolbox-1.0.2/seed_tools/diagram.py +197 -0
- seed_toolbox-1.0.2/seed_tools/file.py +477 -0
- seed_toolbox-1.0.2/seed_tools/git.py +196 -0
- seed_toolbox-1.0.2/seed_tools/hub.py +55 -0
- seed_toolbox-1.0.2/seed_tools/image_gen.py +254 -0
- seed_toolbox-1.0.2/seed_tools/imports.py +18 -0
- seed_toolbox-1.0.2/seed_tools/instruction.py +62 -0
- seed_toolbox-1.0.2/seed_tools/lsp.py +134 -0
- seed_toolbox-1.0.2/seed_tools/mcp.py +221 -0
- seed_toolbox-1.0.2/seed_tools/media.py +453 -0
- seed_toolbox-1.0.2/seed_tools/memory_search.py +147 -0
- seed_toolbox-1.0.2/seed_tools/misc.py +180 -0
- seed_toolbox-1.0.2/seed_tools/music_gen.py +194 -0
- seed_toolbox-1.0.2/seed_tools/notebook.py +53 -0
- seed_toolbox-1.0.2/seed_tools/patch.py +157 -0
- seed_toolbox-1.0.2/seed_tools/pipeline.py +159 -0
- seed_toolbox-1.0.2/seed_tools/project.py +292 -0
- seed_toolbox-1.0.2/seed_tools/refactor.py +184 -0
- seed_toolbox-1.0.2/seed_tools/scaffold.py +114 -0
- seed_toolbox-1.0.2/seed_tools/self_reflect.py +68 -0
- seed_toolbox-1.0.2/seed_tools/shell_helpers.py +151 -0
- seed_toolbox-1.0.2/seed_tools/shell_runner.py +56 -0
- seed_toolbox-1.0.2/seed_tools/symbol.py +89 -0
- seed_toolbox-1.0.2/seed_tools/team.py +214 -0
- seed_toolbox-1.0.2/seed_tools/templates/__init__.py +17 -0
- seed_toolbox-1.0.2/seed_tools/templates/cli.py +37 -0
- seed_toolbox-1.0.2/seed_tools/templates/fastapi.py +30 -0
- seed_toolbox-1.0.2/seed_tools/templates/flask.py +28 -0
- seed_toolbox-1.0.2/seed_tools/templates/package.py +36 -0
- seed_toolbox-1.0.2/seed_tools/templates/react_shadcn.py +937 -0
- seed_toolbox-1.0.2/seed_tools/templates/wx_minigame.py +96 -0
- seed_toolbox-1.0.2/seed_tools/test_gen.py +290 -0
- seed_toolbox-1.0.2/seed_tools/test_run.py +136 -0
- seed_toolbox-1.0.2/seed_tools/todo.py +128 -0
- seed_toolbox-1.0.2/seed_tools/tool_search.py +40 -0
- seed_toolbox-1.0.2/seed_tools/video_gen.py +236 -0
- seed_toolbox-1.0.2/seed_tools/vision.py +450 -0
- seed_toolbox-1.0.2/seed_tools/web.py +165 -0
- seed_toolbox-1.0.2/setup.cfg +4 -0
- seed_toolbox-1.0.2/tests/test_instruction_tools.py +15 -0
- seed_toolbox-1.0.2/tests/test_mcp_tools.py +81 -0
- seed_toolbox-1.0.2/tests/test_patch_tools.py +37 -0
- seed_toolbox-1.0.2/tests/test_search_tools.py +63 -0
- seed_toolbox-1.0.2/tests/test_shell_tool.py +17 -0
- seed_toolbox-1.0.2/tests/test_symbol_tools.py +12 -0
- seed_toolbox-1.0.2/tests/test_test_run.py +17 -0
- seed_toolbox-1.0.2/tests/test_web_tools.py +62 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: seed-toolbox
|
|
3
|
+
Version: 1.0.2
|
|
4
|
+
Summary: Builtin LLM-callable tools for the Seed kernel (depends on seed only; hosts like CodeAgent consume this package)
|
|
5
|
+
Author: Seed Contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
Requires-Dist: seed-kernel
|
|
9
|
+
Requires-Dist: seed-model-providers>=1.0.0
|
|
10
|
+
Provides-Extra: code
|
|
11
|
+
Requires-Dist: ruff>=0.4.0; extra == "code"
|
|
12
|
+
Requires-Dist: bandit>=1.7.0; extra == "code"
|
|
13
|
+
Requires-Dist: pip-audit>=2.7.0; extra == "code"
|
|
14
|
+
Requires-Dist: pytest>=7.0; extra == "code"
|
|
15
|
+
Provides-Extra: dev
|
|
16
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# seed-tools
|
|
2
|
+
|
|
3
|
+
Builtin LLM-callable tools for the [Seed](https://github.com/tagword/seed) kernel.
|
|
4
|
+
|
|
5
|
+
This package provides a comprehensive set of tools that LLM agents can use to interact with the filesystem, shell, browser, database, git, and more. It depends only on `seed`; hosts like CodeAgent consume this package.
|
|
6
|
+
|
|
7
|
+
## Tools
|
|
8
|
+
|
|
9
|
+
| Category | Tools |
|
|
10
|
+
|----------|-------|
|
|
11
|
+
| **File** | file_read, file_write, file_search, grep_tool, glob_tool, artifact_read |
|
|
12
|
+
| **Shell** | bash_tool, bash |
|
|
13
|
+
| **Code** | code_check, project, refactor, test_gen |
|
|
14
|
+
| **Web** | web_search_tool, web_fetch |
|
|
15
|
+
| **Browser** | browser_ensure_running, browser_connect, browser_navigate, browser_screenshot, browser_new_page, browser_targets, browser_status |
|
|
16
|
+
| **DB** | db (SQLite / PostgreSQL / MySQL) |
|
|
17
|
+
| **Git** | git (full operations) |
|
|
18
|
+
| **DevOps** | deploy, deps_check, api_docs, diagram, scaffold, pipeline |
|
|
19
|
+
| **Project** | todo_tool, wbs_draft |
|
|
20
|
+
| **Memory** | memory_search, self_reflect |
|
|
21
|
+
| **Cron** | seed_cron_path, seed_cron_reload, seed_cron_apply |
|
|
22
|
+
| **Misc** | echo, calculate, counter, whoami, tool_search_tool, hub_send, notebook_edit_tool |
|
|
23
|
+
|
|
24
|
+
## License
|
|
25
|
+
|
|
26
|
+
MIT License
|
|
27
|
+
|
|
28
|
+
Copyright (c) 2025 Seed Contributors
|
|
29
|
+
|
|
30
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
31
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
32
|
+
in the Software without restriction, including without limitation the rights
|
|
33
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
34
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
35
|
+
furnished to do so, subject to the following conditions:
|
|
36
|
+
|
|
37
|
+
The above copyright notice and this permission notice shall be included in all
|
|
38
|
+
copies or substantial portions of the Software.
|
|
39
|
+
|
|
40
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
41
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
42
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
43
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
44
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
45
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
46
|
+
SOFTWARE.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "seed-toolbox"
|
|
3
|
+
version = "1.0.2"
|
|
4
|
+
description = "Builtin LLM-callable tools for the Seed kernel (depends on seed only; hosts like CodeAgent consume this package)"
|
|
5
|
+
requires-python = ">=3.9"
|
|
6
|
+
license = { text = "MIT" }
|
|
7
|
+
authors = [{ name = "Seed Contributors" }]
|
|
8
|
+
dependencies = [
|
|
9
|
+
"seed-kernel",
|
|
10
|
+
"seed-model-providers>=1.0.0",
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
[project.optional-dependencies]
|
|
14
|
+
code = ["ruff>=0.4.0", "bandit>=1.7.0", "pip-audit>=2.7.0", "pytest>=7.0"]
|
|
15
|
+
dev = ["pytest>=7.0"]
|
|
16
|
+
|
|
17
|
+
[build-system]
|
|
18
|
+
requires = ["setuptools>=64"]
|
|
19
|
+
build-backend = "setuptools.build_meta"
|
|
20
|
+
|
|
21
|
+
[tool.setuptools.packages.find]
|
|
22
|
+
where = ["."]
|
|
23
|
+
include = ["seed_tools*"]
|
|
24
|
+
|
|
25
|
+
[tool.pytest.ini_options]
|
|
26
|
+
minversion = "7.0"
|
|
27
|
+
testpaths = ["tests"]
|
|
28
|
+
pythonpath = ["."]
|
|
29
|
+
addopts = "-v --tb=short"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: seed-toolbox
|
|
3
|
+
Version: 1.0.2
|
|
4
|
+
Summary: Builtin LLM-callable tools for the Seed kernel (depends on seed only; hosts like CodeAgent consume this package)
|
|
5
|
+
Author: Seed Contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
Requires-Dist: seed-kernel
|
|
9
|
+
Requires-Dist: seed-model-providers>=1.0.0
|
|
10
|
+
Provides-Extra: code
|
|
11
|
+
Requires-Dist: ruff>=0.4.0; extra == "code"
|
|
12
|
+
Requires-Dist: bandit>=1.7.0; extra == "code"
|
|
13
|
+
Requires-Dist: pip-audit>=2.7.0; extra == "code"
|
|
14
|
+
Requires-Dist: pytest>=7.0; extra == "code"
|
|
15
|
+
Provides-Extra: dev
|
|
16
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
seed_toolbox.egg-info/PKG-INFO
|
|
4
|
+
seed_toolbox.egg-info/SOURCES.txt
|
|
5
|
+
seed_toolbox.egg-info/dependency_links.txt
|
|
6
|
+
seed_toolbox.egg-info/requires.txt
|
|
7
|
+
seed_toolbox.egg-info/top_level.txt
|
|
8
|
+
seed_tools/__init__.py
|
|
9
|
+
seed_tools/_builtin_checks.py
|
|
10
|
+
seed_tools/_preset_helpers.py
|
|
11
|
+
seed_tools/_registration.py
|
|
12
|
+
seed_tools/api_docs.py
|
|
13
|
+
seed_tools/artifact.py
|
|
14
|
+
seed_tools/artifact_helpers.py
|
|
15
|
+
seed_tools/bash.py
|
|
16
|
+
seed_tools/browser.py
|
|
17
|
+
seed_tools/code_check.py
|
|
18
|
+
seed_tools/cron.py
|
|
19
|
+
seed_tools/db.py
|
|
20
|
+
seed_tools/deploy.py
|
|
21
|
+
seed_tools/deps_check.py
|
|
22
|
+
seed_tools/diagram.py
|
|
23
|
+
seed_tools/file.py
|
|
24
|
+
seed_tools/git.py
|
|
25
|
+
seed_tools/hub.py
|
|
26
|
+
seed_tools/image_gen.py
|
|
27
|
+
seed_tools/imports.py
|
|
28
|
+
seed_tools/instruction.py
|
|
29
|
+
seed_tools/lsp.py
|
|
30
|
+
seed_tools/mcp.py
|
|
31
|
+
seed_tools/media.py
|
|
32
|
+
seed_tools/memory_search.py
|
|
33
|
+
seed_tools/misc.py
|
|
34
|
+
seed_tools/music_gen.py
|
|
35
|
+
seed_tools/notebook.py
|
|
36
|
+
seed_tools/patch.py
|
|
37
|
+
seed_tools/pipeline.py
|
|
38
|
+
seed_tools/project.py
|
|
39
|
+
seed_tools/refactor.py
|
|
40
|
+
seed_tools/scaffold.py
|
|
41
|
+
seed_tools/self_reflect.py
|
|
42
|
+
seed_tools/shell_helpers.py
|
|
43
|
+
seed_tools/shell_runner.py
|
|
44
|
+
seed_tools/symbol.py
|
|
45
|
+
seed_tools/team.py
|
|
46
|
+
seed_tools/test_gen.py
|
|
47
|
+
seed_tools/test_run.py
|
|
48
|
+
seed_tools/todo.py
|
|
49
|
+
seed_tools/tool_search.py
|
|
50
|
+
seed_tools/video_gen.py
|
|
51
|
+
seed_tools/vision.py
|
|
52
|
+
seed_tools/web.py
|
|
53
|
+
seed_tools/templates/__init__.py
|
|
54
|
+
seed_tools/templates/cli.py
|
|
55
|
+
seed_tools/templates/fastapi.py
|
|
56
|
+
seed_tools/templates/flask.py
|
|
57
|
+
seed_tools/templates/package.py
|
|
58
|
+
seed_tools/templates/react_shadcn.py
|
|
59
|
+
seed_tools/templates/wx_minigame.py
|
|
60
|
+
tests/test_instruction_tools.py
|
|
61
|
+
tests/test_mcp_tools.py
|
|
62
|
+
tests/test_patch_tools.py
|
|
63
|
+
tests/test_search_tools.py
|
|
64
|
+
tests/test_shell_tool.py
|
|
65
|
+
tests/test_symbol_tools.py
|
|
66
|
+
tests/test_test_run.py
|
|
67
|
+
tests/test_web_tools.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
seed_tools
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Builtin tools package (``seed-tools`` distribution).
|
|
3
|
+
|
|
4
|
+
Registry / executor contracts live in ``seed.core.tool_runtime``.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
__version__ = "1.0.2"
|
|
8
|
+
from seed.core.tool_runtime import ToolExecutionError, ToolExecutor, ToolRegistry
|
|
9
|
+
|
|
10
|
+
from seed_tools._registration import setup_builtin_tools
|
|
11
|
+
|
|
12
|
+
__all__ = ("ToolRegistry", "ToolExecutor", "ToolExecutionError", "setup_builtin_tools")
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
def _builtin_checks(source_code: str, lang: str, lines: list) -> list:
|
|
2
|
+
"""内置基础检查(所有语言通用)"""
|
|
3
|
+
issues = []
|
|
4
|
+
for i, line_text in enumerate(lines, 1):
|
|
5
|
+
stripped = line_text.strip()
|
|
6
|
+
if stripped.startswith(("#", "//", "/*")):
|
|
7
|
+
for kw in ("TODO", "FIXME", "HACK", "XXX"):
|
|
8
|
+
if kw in stripped:
|
|
9
|
+
issues.append(f"📌 第 {i} 行: 待办注释「{stripped[:60]}」")
|
|
10
|
+
break
|
|
11
|
+
if len(line_text.rstrip()) > 200:
|
|
12
|
+
issues.append(f"📏 第 {i} 行: 行过长 ({len(line_text.rstrip())} 字符)")
|
|
13
|
+
trailing = sum(1 for i, l in enumerate(lines, 1) if l.rstrip() != l and l.strip())
|
|
14
|
+
if trailing > 0:
|
|
15
|
+
issues.append(f"🧹 发现 {trailing} 行有尾部空白")
|
|
16
|
+
if not source_code.endswith("\n"):
|
|
17
|
+
issues.append("📄 文件末尾缺少换行符")
|
|
18
|
+
if lang == "python":
|
|
19
|
+
for i, line_text in enumerate(lines, 1):
|
|
20
|
+
stripped = line_text.strip()
|
|
21
|
+
if stripped == "except:":
|
|
22
|
+
issues.append(f"⚠️ 第 {i} 行: 裸 except: 应指定异常类型")
|
|
23
|
+
if "import *" in stripped and not stripped.startswith("#"):
|
|
24
|
+
issues.append(f"⚠️ 第 {i} 行: 避免使用 from X import *")
|
|
25
|
+
if "\t" in line_text:
|
|
26
|
+
issues.append(f"⚠️ 第 {i} 行: 混入了 Tab 缩进")
|
|
27
|
+
if lang in ("javascript", "typescript"):
|
|
28
|
+
for i, line_text in enumerate(lines, 1):
|
|
29
|
+
stripped = line_text.strip()
|
|
30
|
+
if "==" in stripped and "===" not in stripped and "!==" not in stripped:
|
|
31
|
+
issues.append(f"⚠️ 第 {i} 行: 建议用 === 代替 ==")
|
|
32
|
+
if "var " in stripped and not stripped.startswith("//"):
|
|
33
|
+
issues.append(f"⚠️ 第 {i} 行: 建议用 const/let 代替 var")
|
|
34
|
+
if "\t" in line_text:
|
|
35
|
+
issues.append(f"⚠️ 第 {i} 行: 混入了 Tab 缩进")
|
|
36
|
+
if lang == "html":
|
|
37
|
+
if "<!DOCTYPE html>" not in source_code.upper():
|
|
38
|
+
issues.append("⚠️ 缺少 DOCTYPE 声明")
|
|
39
|
+
return issues
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
code_check_tool_def = {
|
|
43
|
+
"name": "code_check",
|
|
44
|
+
"description": "Check code for issues using real linters (ruff for Python, eslint for JS/TS) and built-in heuristics. Supports auto-fix.",
|
|
45
|
+
"parameters": {
|
|
46
|
+
"code": {"type": "string", "required": False, "description": "Code string to check"},
|
|
47
|
+
"filepath": {"type": "string", "required": False, "description": "Path to file to check. Language auto-detected from extension."},
|
|
48
|
+
"language": {"type": "string", "required": False, "description": "Programming language (auto = detect from extension or default python)"},
|
|
49
|
+
"fix": {"type": "boolean", "required": False, "description": "Auto-fix fixable issues. Default: false"}
|
|
50
|
+
},
|
|
51
|
+
"returns": "string: Structured report of issues found"
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
# 兼容旧的 code_analyze
|
|
55
|
+
code_analyze_tool_def = {
|
|
56
|
+
"name": "code_analyze",
|
|
57
|
+
"description": "[Legacy] Analyze code for issues. Consider using 'code_check' instead.",
|
|
58
|
+
"parameters": {
|
|
59
|
+
"code": {"type": "string", "required": False, "description": "Code to analyze"},
|
|
60
|
+
"filepath": {"type": "string", "required": False, "description": "Path to file to analyze"},
|
|
61
|
+
"language": {"type": "string", "required": False, "description": "Programming language (default: python)"},
|
|
62
|
+
"focus": {"type": "string", "required": False, "description": "'issues', 'suggestions', 'explain', or 'fix' (default: issues)"}
|
|
63
|
+
},
|
|
64
|
+
"returns": "string: Analysis results"
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
# =============================================================================
|
|
68
|
+
# Tool 7: git — 统一的 git 操作工具
|
|
69
|
+
# =============================================================================
|
|
70
|
+
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""Common preset resolution helpers for seed-tools multimedia tools.
|
|
2
|
+
|
|
3
|
+
Replaces the thin wrapper layer previously in ``codeagent.core.*_models``
|
|
4
|
+
so that seed-tools depends only on ``seed.core``, not on any host product.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import os
|
|
10
|
+
from typing import Any, Callable, Optional
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def resolve_capability_preset(
|
|
14
|
+
capability_key: str,
|
|
15
|
+
env_var: str,
|
|
16
|
+
get_active_fn: Callable[[], str],
|
|
17
|
+
error_desc: str,
|
|
18
|
+
) -> dict[str, Any]:
|
|
19
|
+
"""Resolve a preset by capability flag.
|
|
20
|
+
|
|
21
|
+
Resolution order:
|
|
22
|
+
1. Preset id from ``get_active_fn()`` (context var, set by Web UI / bootstrap)
|
|
23
|
+
2. Preset id from ``env_var`` (fallback env override)
|
|
24
|
+
3. If no id specified: the **single** preset matching ``capability_key``
|
|
25
|
+
4. If multiple match: error asking to disambiguate via env var
|
|
26
|
+
5. If none match: error
|
|
27
|
+
|
|
28
|
+
Returns a **copy** of the matched preset dict (safe to mutate).
|
|
29
|
+
"""
|
|
30
|
+
from seed.core.llm_presets import load_presets
|
|
31
|
+
|
|
32
|
+
pid = get_active_fn() or os.environ.get(env_var, "").strip()
|
|
33
|
+
|
|
34
|
+
if pid:
|
|
35
|
+
for p in load_presets():
|
|
36
|
+
if str(p.get("id") or "").strip() == pid:
|
|
37
|
+
if p.get(capability_key) is True:
|
|
38
|
+
return dict(p)
|
|
39
|
+
raise ValueError(
|
|
40
|
+
f"preset {pid!r} does not support {capability_key}"
|
|
41
|
+
)
|
|
42
|
+
raise ValueError(f"{error_desc}: preset not found: {pid}")
|
|
43
|
+
|
|
44
|
+
# No id specified — find the single matching preset
|
|
45
|
+
matching = [p for p in load_presets() if p.get(capability_key) is True]
|
|
46
|
+
if len(matching) == 1:
|
|
47
|
+
return dict(matching[0])
|
|
48
|
+
if len(matching) > 1:
|
|
49
|
+
raise ValueError(
|
|
50
|
+
f"{error_desc}: multiple presets support {capability_key}, "
|
|
51
|
+
f"set {env_var} to disambiguate"
|
|
52
|
+
)
|
|
53
|
+
raise ValueError(
|
|
54
|
+
f"{error_desc}: no preset with {capability_key}=True found"
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def resolve_preset_by_id(preset_id: str) -> Optional[dict[str, Any]]:
|
|
59
|
+
"""Look up a preset by exact id match. Returns copy or None."""
|
|
60
|
+
from seed.core.llm_presets import load_presets
|
|
61
|
+
|
|
62
|
+
pid = (preset_id or "").strip()
|
|
63
|
+
if not pid:
|
|
64
|
+
return None
|
|
65
|
+
for p in load_presets():
|
|
66
|
+
if str(p.get("id") or "").strip() == pid:
|
|
67
|
+
return dict(p)
|
|
68
|
+
return None
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
"""Tool registration helpers"""
|
|
2
|
+
from dataclasses import replace
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
from seed.core.models import Tool
|
|
6
|
+
from seed.core.tool_runtime import ToolExecutor, ToolRegistry
|
|
7
|
+
|
|
8
|
+
logger = logging.getLogger(__name__)
|
|
9
|
+
|
|
10
|
+
# ── Import all tool modules ──
|
|
11
|
+
from seed_tools.misc import (
|
|
12
|
+
echo_tool, echo_tool_def, calculate_tool, calc_tool_def,
|
|
13
|
+
counter_tool, counter_tool_def, whoami_tool, whoami_tool_def,
|
|
14
|
+
wbs_draft_tool, wbs_def, workspace_verify_handler, workspace_verify_def,
|
|
15
|
+
)
|
|
16
|
+
from seed_tools.file import file_read_handler, file_read_def
|
|
17
|
+
from seed_tools.file import (
|
|
18
|
+
file_write_handler, file_write_def, file_edit_handler, file_edit_def,
|
|
19
|
+
file_search_handler, file_search_def, glob_handler, glob_def,
|
|
20
|
+
grep_handler, grep_def,
|
|
21
|
+
)
|
|
22
|
+
from seed_tools.artifact import artifact_read_handler, artifact_read_def
|
|
23
|
+
from seed_tools.web import web_fetch_handler, web_fetch_def, web_search_handler, web_search_def
|
|
24
|
+
from seed_tools.code_check import (
|
|
25
|
+
code_analyze_handler,
|
|
26
|
+
code_analyze_def,
|
|
27
|
+
code_check_handler,
|
|
28
|
+
code_check_def,
|
|
29
|
+
)
|
|
30
|
+
from seed_tools.todo import todo_handler, todo_def
|
|
31
|
+
from seed_tools.tool_search import tool_search_handler, tool_search_def
|
|
32
|
+
from seed_tools.notebook import notebook_edit_handler, notebook_edit_def
|
|
33
|
+
from seed_tools.memory_search import memory_search_handler, memory_search_def
|
|
34
|
+
from seed_tools.self_reflect import self_reflect_tool, reflect_def
|
|
35
|
+
from seed_tools.cron import (
|
|
36
|
+
codeagent_cron_path_def,
|
|
37
|
+
codeagent_cron_path_handler,
|
|
38
|
+
codeagent_cron_reload_def,
|
|
39
|
+
codeagent_cron_reload_handler,
|
|
40
|
+
seed_cron_path_def,
|
|
41
|
+
seed_cron_path_handler,
|
|
42
|
+
seed_cron_reload_def,
|
|
43
|
+
seed_cron_reload_handler,
|
|
44
|
+
)
|
|
45
|
+
from seed_tools.cron import (
|
|
46
|
+
codeagent_cron_apply_def,
|
|
47
|
+
codeagent_cron_apply_handler,
|
|
48
|
+
seed_cron_apply_def,
|
|
49
|
+
seed_cron_apply_handler,
|
|
50
|
+
)
|
|
51
|
+
from seed_tools.hub import hub_send, hub_send_def
|
|
52
|
+
from seed_tools.team import (
|
|
53
|
+
call_agent, call_agent_tool_def,
|
|
54
|
+
dispatch, dispatch_tool_def,
|
|
55
|
+
parallel, parallel_tool_def,
|
|
56
|
+
)
|
|
57
|
+
from seed_tools.git import git_handler
|
|
58
|
+
from seed_tools.vision import (
|
|
59
|
+
vision_analyze,
|
|
60
|
+
vision_analyze_def,
|
|
61
|
+
vision_analyze_directory,
|
|
62
|
+
vision_analyze_directory_def,
|
|
63
|
+
)
|
|
64
|
+
from seed_tools.image_gen import image_generate, image_generate_def
|
|
65
|
+
from seed_tools.music_gen import music_generate, music_generate_def
|
|
66
|
+
from seed_tools.video_gen import video_generate, video_generate_def
|
|
67
|
+
from seed_tools.media import (
|
|
68
|
+
attachment_resolve_path,
|
|
69
|
+
attachment_resolve_path_def,
|
|
70
|
+
audio_transcribe,
|
|
71
|
+
audio_transcribe_def,
|
|
72
|
+
video_analyze,
|
|
73
|
+
video_analyze_def,
|
|
74
|
+
)
|
|
75
|
+
from seed_tools.browser import (
|
|
76
|
+
browser_status,
|
|
77
|
+
browser_status_def,
|
|
78
|
+
browser_connect,
|
|
79
|
+
browser_connect_def,
|
|
80
|
+
browser_ensure_running,
|
|
81
|
+
browser_ensure_running_def,
|
|
82
|
+
browser_targets,
|
|
83
|
+
browser_targets_def,
|
|
84
|
+
browser_new_page,
|
|
85
|
+
browser_new_page_def,
|
|
86
|
+
browser_navigate,
|
|
87
|
+
browser_navigate_def,
|
|
88
|
+
browser_screenshot,
|
|
89
|
+
browser_screenshot_def,
|
|
90
|
+
)
|
|
91
|
+
from seed_tools.bash import bash_def, bash_handler
|
|
92
|
+
|
|
93
|
+
# ── Migrated tool_modules tools ──
|
|
94
|
+
from seed_tools.refactor import refactor_handler, refactor_tool_def
|
|
95
|
+
from seed_tools.diagram import diagram_handler, diagram_tool_def
|
|
96
|
+
from seed_tools.api_docs import api_docs_handler, api_docs_tool_def
|
|
97
|
+
from seed_tools.scaffold import scaffold_handler, scaffold_tool_def
|
|
98
|
+
from seed_tools.project import project_handler, project_tool_def
|
|
99
|
+
from seed_tools.db import db_handler, db_tool_def
|
|
100
|
+
from seed_tools.deps_check import deps_check_handler, deps_check_tool_def
|
|
101
|
+
from seed_tools.test_gen import test_gen_handler, test_gen_tool_def
|
|
102
|
+
from seed_tools.test_run import test_run_handler, test_run_def
|
|
103
|
+
from seed_tools.symbol import (
|
|
104
|
+
symbol_index_refresh_def,
|
|
105
|
+
symbol_index_refresh_handler,
|
|
106
|
+
symbol_search_def,
|
|
107
|
+
symbol_search_handler,
|
|
108
|
+
)
|
|
109
|
+
from seed_tools.lsp import (
|
|
110
|
+
lsp_definition_def,
|
|
111
|
+
lsp_definition_handler,
|
|
112
|
+
lsp_diagnostics_def,
|
|
113
|
+
lsp_diagnostics_handler,
|
|
114
|
+
)
|
|
115
|
+
from seed_tools.patch import apply_patch_def, apply_patch_handler
|
|
116
|
+
from seed_tools.mcp import (
|
|
117
|
+
mcp_call_def,
|
|
118
|
+
mcp_call_handler,
|
|
119
|
+
mcp_list_skills_def,
|
|
120
|
+
mcp_list_skills_handler,
|
|
121
|
+
mcp_list_tools_def,
|
|
122
|
+
mcp_list_tools_handler,
|
|
123
|
+
mcp_skill_def,
|
|
124
|
+
mcp_skill_handler,
|
|
125
|
+
mcp_servers_def,
|
|
126
|
+
mcp_servers_handler,
|
|
127
|
+
)
|
|
128
|
+
from seed_tools.pipeline import pipeline_handler, pipeline_tool_def
|
|
129
|
+
from seed_tools.instruction import instruction_read_def, instruction_read_handler
|
|
130
|
+
from seed_tools.deploy import deploy_handler, deploy_tool_def
|
|
131
|
+
|
|
132
|
+
# ── Create missing tool definitions ──
|
|
133
|
+
git_tool_def = Tool(
|
|
134
|
+
name="git",
|
|
135
|
+
description="Git operations tool",
|
|
136
|
+
parameters={
|
|
137
|
+
"command": {"type": "string", "required": True, "description": "Git subcommand"},
|
|
138
|
+
"args": {"type": "string", "required": False, "description": "Arguments"},
|
|
139
|
+
"message": {"type": "string", "required": False, "description": "Commit message"},
|
|
140
|
+
},
|
|
141
|
+
returns="string",
|
|
142
|
+
category="git",
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def setup_builtin_tools():
|
|
147
|
+
"""Setup and register all builtin tools."""
|
|
148
|
+
registry = ToolRegistry()
|
|
149
|
+
|
|
150
|
+
# Misc tools
|
|
151
|
+
registry.register(echo_tool_def, echo_tool)
|
|
152
|
+
registry.register(calc_tool_def, calculate_tool)
|
|
153
|
+
registry.register(counter_tool_def, counter_tool)
|
|
154
|
+
registry.register(whoami_tool_def, whoami_tool)
|
|
155
|
+
registry.register(wbs_def, wbs_draft_tool)
|
|
156
|
+
registry.register(workspace_verify_def, workspace_verify_handler)
|
|
157
|
+
|
|
158
|
+
# Shell (bash + bash alias for prompts / acquired-tool policy)
|
|
159
|
+
registry.register(bash_def, bash_handler)
|
|
160
|
+
|
|
161
|
+
# File tools
|
|
162
|
+
registry.register(file_read_def, file_read_handler)
|
|
163
|
+
registry.register(file_write_def, file_write_handler)
|
|
164
|
+
registry.register(file_edit_def, file_edit_handler)
|
|
165
|
+
registry.register(file_search_def, file_search_handler)
|
|
166
|
+
registry.register(glob_def, glob_handler)
|
|
167
|
+
registry.register(grep_def, grep_handler)
|
|
168
|
+
|
|
169
|
+
# Artifact tools
|
|
170
|
+
registry.register(artifact_read_def, artifact_read_handler)
|
|
171
|
+
|
|
172
|
+
# Web tools
|
|
173
|
+
registry.register(web_fetch_def, web_fetch_handler)
|
|
174
|
+
registry.register(web_search_def, web_search_handler)
|
|
175
|
+
|
|
176
|
+
# Code tools
|
|
177
|
+
registry.register(code_check_def, code_check_handler)
|
|
178
|
+
registry.register(code_analyze_def, code_analyze_handler)
|
|
179
|
+
|
|
180
|
+
# Todo tools
|
|
181
|
+
registry.register(todo_def, todo_handler)
|
|
182
|
+
|
|
183
|
+
# Search tools
|
|
184
|
+
registry.register(tool_search_def, tool_search_handler)
|
|
185
|
+
|
|
186
|
+
# Notebook tools
|
|
187
|
+
registry.register(notebook_edit_def, notebook_edit_handler)
|
|
188
|
+
|
|
189
|
+
# Memory tools
|
|
190
|
+
registry.register(memory_search_def, memory_search_handler)
|
|
191
|
+
registry.register(reflect_def, self_reflect_tool)
|
|
192
|
+
|
|
193
|
+
# Cron tools
|
|
194
|
+
registry.register(seed_cron_path_def, seed_cron_path_handler)
|
|
195
|
+
registry.register(seed_cron_reload_def, seed_cron_reload_handler)
|
|
196
|
+
registry.register(seed_cron_apply_def, seed_cron_apply_handler)
|
|
197
|
+
registry.register(codeagent_cron_path_def, codeagent_cron_path_handler)
|
|
198
|
+
registry.register(codeagent_cron_reload_def, codeagent_cron_reload_handler)
|
|
199
|
+
registry.register(codeagent_cron_apply_def, codeagent_cron_apply_handler)
|
|
200
|
+
|
|
201
|
+
# Git tool
|
|
202
|
+
registry.register(git_tool_def, git_handler)
|
|
203
|
+
|
|
204
|
+
# Hub tools
|
|
205
|
+
registry.register(hub_send_def, hub_send)
|
|
206
|
+
|
|
207
|
+
# Team tools
|
|
208
|
+
registry.register(call_agent_tool_def, call_agent)
|
|
209
|
+
registry.register(dispatch_tool_def, dispatch)
|
|
210
|
+
registry.register(parallel_tool_def, parallel)
|
|
211
|
+
|
|
212
|
+
# Browser tools
|
|
213
|
+
registry.register(browser_status_def, browser_status)
|
|
214
|
+
registry.register(browser_connect_def, browser_connect)
|
|
215
|
+
registry.register(browser_ensure_running_def, browser_ensure_running)
|
|
216
|
+
registry.register(browser_targets_def, browser_targets)
|
|
217
|
+
registry.register(browser_new_page_def, browser_new_page)
|
|
218
|
+
registry.register(browser_navigate_def, browser_navigate)
|
|
219
|
+
registry.register(browser_screenshot_def, browser_screenshot)
|
|
220
|
+
|
|
221
|
+
registry.register(vision_analyze_def, vision_analyze)
|
|
222
|
+
registry.register(vision_analyze_directory_def, vision_analyze_directory)
|
|
223
|
+
registry.register(image_generate_def, image_generate)
|
|
224
|
+
registry.register(music_generate_def, music_generate)
|
|
225
|
+
registry.register(video_generate_def, video_generate)
|
|
226
|
+
registry.register(attachment_resolve_path_def, attachment_resolve_path)
|
|
227
|
+
registry.register(audio_transcribe_def, audio_transcribe)
|
|
228
|
+
registry.register(video_analyze_def, video_analyze)
|
|
229
|
+
|
|
230
|
+
# ── Migrated tool_modules (dev tools) ──
|
|
231
|
+
registry.register(project_tool_def, project_handler)
|
|
232
|
+
registry.register(refactor_tool_def, refactor_handler)
|
|
233
|
+
registry.register(scaffold_tool_def, scaffold_handler)
|
|
234
|
+
registry.register(test_gen_tool_def, test_gen_handler)
|
|
235
|
+
registry.register(test_run_def, test_run_handler)
|
|
236
|
+
|
|
237
|
+
# MCP bridge
|
|
238
|
+
registry.register(mcp_servers_def, mcp_servers_handler)
|
|
239
|
+
registry.register(mcp_list_tools_def, mcp_list_tools_handler)
|
|
240
|
+
registry.register(mcp_call_def, mcp_call_handler)
|
|
241
|
+
registry.register(mcp_list_skills_def, mcp_list_skills_handler)
|
|
242
|
+
registry.register(mcp_skill_def, mcp_skill_handler)
|
|
243
|
+
|
|
244
|
+
# Code intelligence (Phase 4)
|
|
245
|
+
registry.register(symbol_search_def, symbol_search_handler)
|
|
246
|
+
registry.register(symbol_index_refresh_def, symbol_index_refresh_handler)
|
|
247
|
+
registry.register(lsp_definition_def, lsp_definition_handler)
|
|
248
|
+
registry.register(lsp_diagnostics_def, lsp_diagnostics_handler)
|
|
249
|
+
registry.register(apply_patch_def, apply_patch_handler)
|
|
250
|
+
registry.register(deploy_tool_def, deploy_handler)
|
|
251
|
+
registry.register(deps_check_tool_def, deps_check_handler)
|
|
252
|
+
registry.register(api_docs_tool_def, api_docs_handler)
|
|
253
|
+
registry.register(diagram_tool_def, diagram_handler)
|
|
254
|
+
registry.register(pipeline_tool_def, pipeline_handler)
|
|
255
|
+
registry.register(db_tool_def, db_handler)
|
|
256
|
+
|
|
257
|
+
# Instruction releases (taskagent)
|
|
258
|
+
registry.register(instruction_read_def, instruction_read_handler)
|
|
259
|
+
|
|
260
|
+
executor = ToolExecutor(registry)
|
|
261
|
+
return registry, executor
|
|
262
|
+
|