mirror of
https://github.com/shareAI-lab/analysis_claude_code.git
synced 2026-05-06 16:26:16 +08:00
Separate tool name from output across all agent sessions (s03-s_full)
Extends the readability fix from PR #128 (s02) to all remaining sessions. Tool name and output are now on separate lines, consistent with s01's existing pattern and improving readability for multi-line tool output.
This commit is contained in:
@@ -181,7 +181,8 @@ def agent_loop(messages: list):
|
||||
output = handler(**block.input) if handler else f"Unknown tool: {block.name}"
|
||||
except Exception as e:
|
||||
output = f"Error: {e}"
|
||||
print(f"> {block.name}: {str(output)[:200]}")
|
||||
print(f"> {block.name}:")
|
||||
print(str(output)[:200])
|
||||
results.append({"type": "tool_result", "tool_use_id": block.id, "content": str(output)})
|
||||
if block.name == "todo":
|
||||
used_todo = True
|
||||
|
||||
@@ -202,7 +202,8 @@ def agent_loop(messages: list):
|
||||
output = handler(**block.input) if handler else f"Unknown tool: {block.name}"
|
||||
except Exception as e:
|
||||
output = f"Error: {e}"
|
||||
print(f"> {block.name}: {str(output)[:200]}")
|
||||
print(f"> {block.name}:")
|
||||
print(str(output)[:200])
|
||||
results.append({"type": "tool_result", "tool_use_id": block.id, "content": str(output)})
|
||||
messages.append({"role": "user", "content": results})
|
||||
|
||||
|
||||
@@ -220,7 +220,8 @@ def agent_loop(messages: list):
|
||||
output = handler(**block.input) if handler else f"Unknown tool: {block.name}"
|
||||
except Exception as e:
|
||||
output = f"Error: {e}"
|
||||
print(f"> {block.name}: {str(output)[:200]}")
|
||||
print(f"> {block.name}:")
|
||||
print(str(output)[:200])
|
||||
results.append({"type": "tool_result", "tool_use_id": block.id, "content": str(output)})
|
||||
messages.append({"role": "user", "content": results})
|
||||
# Layer 3: manual compact triggered by the compact tool
|
||||
|
||||
@@ -228,7 +228,8 @@ def agent_loop(messages: list):
|
||||
output = handler(**block.input) if handler else f"Unknown tool: {block.name}"
|
||||
except Exception as e:
|
||||
output = f"Error: {e}"
|
||||
print(f"> {block.name}: {str(output)[:200]}")
|
||||
print(f"> {block.name}:")
|
||||
print(str(output)[:200])
|
||||
results.append({"type": "tool_result", "tool_use_id": block.id, "content": str(output)})
|
||||
messages.append({"role": "user", "content": results})
|
||||
|
||||
|
||||
@@ -210,7 +210,8 @@ def agent_loop(messages: list):
|
||||
output = handler(**block.input) if handler else f"Unknown tool: {block.name}"
|
||||
except Exception as e:
|
||||
output = f"Error: {e}"
|
||||
print(f"> {block.name}: {str(output)[:200]}")
|
||||
print(f"> {block.name}:")
|
||||
print(str(output)[:200])
|
||||
results.append({"type": "tool_result", "tool_use_id": block.id, "content": str(output)})
|
||||
messages.append({"role": "user", "content": results})
|
||||
|
||||
|
||||
@@ -372,7 +372,8 @@ def agent_loop(messages: list):
|
||||
output = handler(**block.input) if handler else f"Unknown tool: {block.name}"
|
||||
except Exception as e:
|
||||
output = f"Error: {e}"
|
||||
print(f"> {block.name}: {str(output)[:200]}")
|
||||
print(f"> {block.name}:")
|
||||
print(str(output)[:200])
|
||||
results.append({
|
||||
"type": "tool_result",
|
||||
"tool_use_id": block.id,
|
||||
|
||||
@@ -453,7 +453,8 @@ def agent_loop(messages: list):
|
||||
output = handler(**block.input) if handler else f"Unknown tool: {block.name}"
|
||||
except Exception as e:
|
||||
output = f"Error: {e}"
|
||||
print(f"> {block.name}: {str(output)[:200]}")
|
||||
print(f"> {block.name}:")
|
||||
print(str(output)[:200])
|
||||
results.append({
|
||||
"type": "tool_result",
|
||||
"tool_use_id": block.id,
|
||||
|
||||
@@ -537,7 +537,8 @@ def agent_loop(messages: list):
|
||||
output = handler(**block.input) if handler else f"Unknown tool: {block.name}"
|
||||
except Exception as e:
|
||||
output = f"Error: {e}"
|
||||
print(f"> {block.name}: {str(output)[:200]}")
|
||||
print(f"> {block.name}:")
|
||||
print(str(output)[:200])
|
||||
results.append({
|
||||
"type": "tool_result",
|
||||
"tool_use_id": block.id,
|
||||
|
||||
@@ -747,7 +747,8 @@ def agent_loop(messages: list):
|
||||
output = handler(**block.input) if handler else f"Unknown tool: {block.name}"
|
||||
except Exception as e:
|
||||
output = f"Error: {e}"
|
||||
print(f"> {block.name}: {str(output)[:200]}")
|
||||
print(f"> {block.name}:")
|
||||
print(str(output)[:200])
|
||||
results.append(
|
||||
{
|
||||
"type": "tool_result",
|
||||
|
||||
@@ -692,7 +692,8 @@ def agent_loop(messages: list):
|
||||
output = handler(**block.input) if handler else f"Unknown tool: {block.name}"
|
||||
except Exception as e:
|
||||
output = f"Error: {e}"
|
||||
print(f"> {block.name}: {str(output)[:200]}")
|
||||
print(f"> {block.name}:")
|
||||
print(str(output)[:200])
|
||||
results.append({"type": "tool_result", "tool_use_id": block.id, "content": str(output)})
|
||||
if block.name == "TodoWrite":
|
||||
used_todo = True
|
||||
|
||||
Reference in New Issue
Block a user