feat(tools): use installed ripgrep for native file search (#5948)
* feat(tools): expose installed ripgrep through exec * refactor(tools): launch ripgrep with native argument vectors * refactor(tools): reuse the fresh exec parameter schema * fix(tools): select search backend in loader and display rg arguments * fix(ui): simplify rg previews and localize search completion * docs: simplify ripgrep configuration note * docs: keep ripgrep note on one line
This commit is contained in:
1 parent
b8893aba56
commit
e0b8efa0be
33 files changed
+514
-204
No files matched your search
@@ -207,33 +207,23 @@ class TestIsTemplateContent:
|
||||
|
||||
|
||||
class TestBundledToolContract:
|
||||
def test_tool_contract_balances_general_and_coding_workflows(self):
|
||||
def test_tool_contract_contains_shared_execution_policy(self):
|
||||
from importlib.resources import files as pkg_files
|
||||
|
||||
tpl = pkg_files("nanobot") / "templates" / "agent" / "tool_contract.md"
|
||||
content = tpl.read_text(encoding="utf-8")
|
||||
|
||||
assert "## General Tool Contract" in content
|
||||
assert "Use the narrowest structured tool" in content
|
||||
assert "Do not use `exec` as a universal workaround" in content
|
||||
assert "## File and Coding Workflows" in content
|
||||
assert "`grep` returns matches with five context lines by default" in content
|
||||
assert "apply_patch" in content
|
||||
assert "acceptance criteria into concrete checks" in content
|
||||
assert "visual evidence reaches the model" in content
|
||||
assert "clear user request as authorization" in content
|
||||
assert "Never invent missing records or measurements" in content
|
||||
assert "## Web and External Information" in content
|
||||
assert "## Messaging and Media" in content
|
||||
assert "## Scheduling and Background Work" in content
|
||||
assert "execution and verification" in content
|
||||
assert "irreversible action" in content
|
||||
assert "Wait for tool results" in content
|
||||
|
||||
def test_tool_contract_is_injected_without_workspace_file(self, tmp_path):
|
||||
builder = _builder(tmp_path)
|
||||
prompt = builder.build_system_prompt()
|
||||
|
||||
assert "# Tool Usage Notes" in prompt
|
||||
assert "## General Tool Contract" in prompt
|
||||
assert "Do not use `exec` as a universal workaround" in prompt
|
||||
assert "clear user request as authorization" in prompt
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -305,7 +295,6 @@ class TestBuildSystemPrompt:
|
||||
def test_default_identity_uses_relative_agent_paths(self, tmp_path):
|
||||
result = ContextBuilder(tmp_path)._get_identity()
|
||||
|
||||
assert str(tmp_path.resolve()) not in result
|
||||
assert "Agent profile: SOUL.md and USER.md" in result
|
||||
assert "History log: memory/history.jsonl" in result
|
||||
assert "Custom skills: skills/{skill-name}/SKILL.md" in result
|
||||
@@ -318,10 +307,9 @@ class TestBuildSystemPrompt:
|
||||
|
||||
result = ContextBuilder(agent_home)._get_identity(workspace=project)
|
||||
|
||||
assert str(project.resolve()) not in result
|
||||
assert f"agent workspace is at: {agent_home.resolve()}" in result
|
||||
assert f"{agent_home.resolve()}/SOUL.md" in result
|
||||
assert f"{project.resolve()}/SOUL.md" not in result
|
||||
assert f"Custom skills: {agent_home.resolve()}/skills/" in result
|
||||
|
||||
def test_includes_bootstrap_files(self, tmp_path):
|
||||
(tmp_path / "AGENTS.md").write_text("Be helpful and concise.", encoding="utf-8")
|
||||
|
||||
Reference in new issue
Block a user