优化 Agent 代码编辑工具 (#6218)

This commit is contained in:
jxxghp
2026-08-01 09:02:05 +08:00
committed by GitHub
parent 593139faac
commit 93761fe7e4
11 changed files with 465 additions and 44 deletions
+16
View File
@@ -27,6 +27,7 @@ def test_modified_builtin_skills_have_incremented_versions() -> None:
"moviepilot-cli": "6",
"moviepilot-update": "3",
"transfer-failed-retry": "2",
"create-moviepilot-plugin": "3",
}
for skill_name, expected_version in expected_versions.items():
@@ -76,3 +77,18 @@ def test_agent_core_prompt_does_not_block_plugin_source_edits() -> None:
assert "file editing tools, or generated patches to change code" not in core_prompt
assert "write_file" in allowed_tools
assert "edit_file" in allowed_tools
assert "search_web" in allowed_tools
assert "browse_webpage" in allowed_tools
def test_agent_core_prompt_routes_code_tools_safely() -> None:
"""核心提示词应区分代码搜索、精确编辑和交互式命令场景。"""
core_prompt = CORE_PROMPT_PATH.read_text(encoding="utf-8")
assert '`execute_command(action="run")` with `rg`' in core_prompt
assert "`replace_all=true` only when every match must change" in core_prompt
assert "Use `action=run` for short bounded commands" in core_prompt
assert "including SSH" in core_prompt
assert "Never use shell redirection" in core_prompt
assert "matching version of the official documentation" in core_prompt
assert "Do not guess signatures from memory" in core_prompt