From 369b598af750a9c4fa23e58606acbab41a705f26 Mon Sep 17 00:00:00 2001 From: hardness1020 Date: Thu, 28 May 2026 16:42:17 -0700 Subject: [PATCH] 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) --- s06_subagent/code.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/s06_subagent/code.py b/s06_subagent/code.py index 7c9749f..009e263 100644 --- a/s06_subagent/code.py +++ b/s06_subagent/code.py @@ -136,12 +136,6 @@ def run_todo_write(todos: list) -> str: print("\n".join(lines)) 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 = [ {"name": "bash", "description": "Run a shell command.", "input_schema": {"type": "object", "properties": {"command": {"type": "string"}}, "required": ["command"]}}, @@ -186,6 +180,12 @@ SUB_HANDLERS = { "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: """Spawn a subagent with fresh messages[], return summary only.""" print(f"\n\033[35m[Subagent spawned]\033[0m")