MCPcopy Create free account
hub / github.com/anthropics/defending-code-reference-harness / _progress_line

Function _progress_line

harness/agent.py:113–132  ·  view source on GitHub ↗

Print a one-line summary of an assistant message to stderr. Tool calls show name + key arg; text shows a truncated preview.

(msg: dict, prefix: str)

Source from the content-addressed store, hash-verified

111
112
113def _progress_line(msg: dict, prefix: str) -> None:
114 """Print a one-line summary of an assistant message to stderr.
115 Tool calls show name + key arg; text shows a truncated preview."""
116 if msg.get("type") != "assistant":
117 return
118 for b in msg.get("message", {}).get("content", []):
119 if not isinstance(b, dict):
120 continue
121 if b.get("type") == "tool_use":
122 inp = b.get("input") or {}
123 arg = (inp.get("command") or inp.get("file_path") or inp.get("path")
124 or inp.get("pattern") or "")
125 arg = str(arg).replace("\n", " ")[:120]
126 line = color(f"{prefix} → {b.get('name')}: {arg}", "dim", sys.stderr)
127 print(line, file=sys.stderr, flush=True)
128 elif b.get("type") == "text":
129 t = (b.get("text") or "").strip().replace("\n", " ")
130 if t:
131 line = color(f"{prefix} · {t[:140]}", "dim", sys.stderr)
132 print(line, file=sys.stderr, flush=True)
133
134
135# ──────────────────────────────────────────────────────────────────────────────

Callers 1

run_agentFunction · 0.85

Calls 1

colorFunction · 0.85

Tested by

no test coverage detected