Add Phase 6: write tools, shell, and edit tools with reasoning-only fix

Implement 6 new agent tools — write_file, make_dir, delete_file,
str_replace, patch_apply, run_command — bringing the agent from
read-only observer to active code modifier. All write/shell operations
are gated through the existing permissions service.

Also fix a bug where qwen3.5 thinking mode produces reasoning tokens
but no content after tool results, causing the agent to silently exit.
The loop now detects reasoning-only responses, retries twice, then
injects a nudge message to break the model out of its thinking loop.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-11 09:45:48 -05:00
parent 0cf0d01657
commit f60c47a85f
12 changed files with 956 additions and 3 deletions

View File

@@ -41,6 +41,13 @@ class SessionContext:
self._message_count += 1
return message
def pop_last_message(self) -> Message | None:
"""Remove and return the last message, or None if history is empty."""
if self._history:
self._message_count -= 1
return self._history.pop()
return None
def get_history(self) -> list[Message]:
"""Return a shallow copy of the conversation history."""
return list(self._history)