diff options
| author | Claude Code <noreply@anthropic.com> | 2026-11-24 21:53:37 +0530 |
|---|---|---|
| committer | Claude Code <noreply@anthropic.com> | 2026-11-24 21:53:37 +0530 |
| commit | 3493801b302e6a1957c61b710d17897b719a5da5 (patch) | |
| tree | ec76ba495b2851fcf462638774f2ebcbc4d1c5a3 /src/agentux/solo_engine.py | |
| parent | 607e0cae6ea96c939baf34ffe9eac2a5978a6a3e (diff) | |
Add Lua addon system and full coding toolset to Solo engine
- src/agentux/addons.py: sandboxed LuaJIT addon manager with seven lifecycle
hooks (on_start, on_prompt, on_system_prompt, on_tool_call,
on_tool_result, on_answer, on_event). Addons load from
~/.agentux/addons/ or <workspace>/.agentux/addons/.
- src/agentux/solo_engine.py: Solo now gets the full workspace toolset
(filesystem, shell, git, project, search, outline_symbols, todo,
view_image, repomap, checkpoint) plus shadow checkpointing, so it can
read, edit, run, and test code rather than only researching.
- src/agentux/agent.py: wires AddonManager into the agent lifecycle.
- tests/test_addons.py: 22 tests for loading, hooks, sandbox isolation,
and agent integration.
- tests/test_solo_engine.py: 6 tests for Solo's coding tools and
checkpointing.
547 tests pass.
Co-Authored-By: Claude Code <noreply@anthropic.com>
Diffstat (limited to 'src/agentux/solo_engine.py')
| -rw-r--r-- | src/agentux/solo_engine.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/agentux/solo_engine.py b/src/agentux/solo_engine.py index 7e66d43..e526086 100644 --- a/src/agentux/solo_engine.py +++ b/src/agentux/solo_engine.py @@ -24,6 +24,7 @@ and injecting a nudge when the model tries to skip a step. from __future__ import annotations import asyncio +import os import time from dataclasses import dataclass, field from typing import Any, Callable, Dict, List, Optional @@ -49,6 +50,21 @@ from .tools.knowledge_tool import ( from .tools.registry import ToolRegistry from .tools.web import FetchWebPageTool, WebSearchTool +# Coding tools are shared with the main agent. They are imported lazily so +# that Solo keeps working on a minimal install that only needs the web and +# knowledge tooling. +from .checkpoint import CheckpointManager +from .tools.checkpoint_tool import CheckpointTool +from .tools.filesystem import FilesystemTool +from .tools.git import GitTool +from .tools.image import ViewImageTool +from .tools.project import ProjectTool +from .tools.repomap_tool import RepomapTool +from .tools.search import SearchTool +from .tools.shell import ShellTool +from .tools.symbols import OutlineSymbolsTool +from .tools.todo import TodoTool + #: Maximum wall-clock seconds for a whole Solo run. DEFAULT_TIMEOUT = 180.0 #: Maximum model round trips per run. @@ -131,6 +147,22 @@ class SoloEngine: self.registry.register(self._web_search) self.registry.register(self._fetch_web_page) self.registry.register(SearchMultipleTool(self._web_search.search)) + + # Solo is a coding agent, not a research-only one. Give it the same + # workspace tools the main agent gets so it can read, edit, run, and + # test code rather than only looking things up. + self._root = project or os.getcwd() + self._checkpoint_manager = CheckpointManager(self._root) + self.registry.register(FilesystemTool(root=self._root)) + self.registry.register(ShellTool(cwd=self._root, timeout=self.timeout)) + self.registry.register(ProjectTool(root=self._root)) + self.registry.register(SearchTool(root=self._root)) + self.registry.register(OutlineSymbolsTool(root=self._root)) + self.registry.register(GitTool(root=self._root, timeout=self.timeout)) + self.registry.register(TodoTool()) + self.registry.register(ViewImageTool(root=self._root)) + self.registry.register(RepomapTool(root=self._root)) + self.registry.register(CheckpointTool(self._checkpoint_manager)) self._last_search_output = "" # ------------------------------------------------------------------ @@ -391,6 +423,20 @@ class SoloEngine: except Exception: return f"ERROR: unknown tool '{call.name}'" + # Automatic shadow checkpoint before a mutating filesystem call, + # mirroring the main agent so Solo changes are reversible. + if call.name == "filesystem": + op = call.arguments.get("operation") + path = call.arguments.get("path") + if op in ("write", "edit") and path: + if not getattr(self, "_current_turn_checkpoint", None): + self._current_turn_checkpoint = self._checkpoint_manager.create_checkpoint( + f"Before {op} on {path}" + ) + self._checkpoint_manager.capture_file_before( + path, self._current_turn_checkpoint.id + ) + record(SoloEvent("tool_start", f"Running {call.name}...")) try: result = await tool.execute(**call.arguments) |
