fix(s06): move extract_text() next to its only caller

extract_text() is new in s06 (listed in the docstring under "Changes
from s05") but was defined under the "FROM s02-s05 (unchanged)" banner.
Move it into the "NEW in s06: Subagent" section, directly above its only
caller spawn_subagent(). Pure move, no logic change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
hardness1020
2026-05-28 16:42:17 -07:00
parent c586792bbb
commit 369b598af7

View File

@@ -136,12 +136,6 @@ def run_todo_write(todos: list) -> str:
print("\n".join(lines)) print("\n".join(lines))
return f"Updated {len(CURRENT_TODOS)} tasks" return f"Updated {len(CURRENT_TODOS)} tasks"
def extract_text(content) -> str:
"""Extract text from message content blocks."""
if not isinstance(content, list):
return str(content)
return "\n".join(getattr(b, "text", "") for b in content if getattr(b, "type", None) == "text")
TOOLS = [ TOOLS = [
{"name": "bash", "description": "Run a shell command.", {"name": "bash", "description": "Run a shell command.",
"input_schema": {"type": "object", "properties": {"command": {"type": "string"}}, "required": ["command"]}}, "input_schema": {"type": "object", "properties": {"command": {"type": "string"}}, "required": ["command"]}},
@@ -186,6 +180,12 @@ SUB_HANDLERS = {
"edit_file": run_edit, "glob": run_glob, "edit_file": run_edit, "glob": run_glob,
} }
def extract_text(content) -> str:
"""Extract text from message content blocks."""
if not isinstance(content, list):
return str(content)
return "\n".join(getattr(b, "text", "") for b in content if getattr(b, "type", None) == "text")
def spawn_subagent(description: str) -> str: def spawn_subagent(description: str) -> str:
"""Spawn a subagent with fresh messages[], return summary only.""" """Spawn a subagent with fresh messages[], return summary only."""
print(f"\n\033[35m[Subagent spawned]\033[0m") print(f"\n\033[35m[Subagent spawned]\033[0m")