feat: include item ids in cli logs
This commit is contained in:
@@ -228,11 +228,13 @@ def render_event_cli(
|
|||||||
elif itype == "command_execution":
|
elif itype == "command_execution":
|
||||||
command = _format_command(item.get("command", ""))
|
command = _format_command(item.get("command", ""))
|
||||||
if etype == "item.started":
|
if etype == "item.started":
|
||||||
lines.append(f"{STATUS_RUNNING} running: {command}")
|
lines.append(_with_id(_extract_numeric_id(item.get("id")), f"{STATUS_RUNNING} running: {command}"))
|
||||||
elif etype == "item.completed":
|
elif etype == "item.completed":
|
||||||
exit_code = item.get("exit_code")
|
exit_code = item.get("exit_code")
|
||||||
exit_part = f" (exit {exit_code})" if exit_code is not None else ""
|
exit_part = f" (exit {exit_code})" if exit_code is not None else ""
|
||||||
lines.append(f"{STATUS_DONE} ran: {command}{exit_part}")
|
lines.append(
|
||||||
|
_with_id(_extract_numeric_id(item.get(\"id\")), f\"{STATUS_DONE} ran: {command}{exit_part}\")
|
||||||
|
)
|
||||||
if show_output:
|
if show_output:
|
||||||
output = _truncate_output(item.get("aggregated_output", ""))
|
output = _truncate_output(item.get("aggregated_output", ""))
|
||||||
if output:
|
if output:
|
||||||
@@ -240,22 +242,24 @@ def render_event_cli(
|
|||||||
|
|
||||||
elif itype == "file_change" and etype == "item.completed":
|
elif itype == "file_change" and etype == "item.completed":
|
||||||
line = _format_file_change(item.get("changes", []))
|
line = _format_file_change(item.get("changes", []))
|
||||||
lines.append(f"{STATUS_DONE} {line}")
|
lines.append(_with_id(_extract_numeric_id(item.get(\"id\")), f\"{STATUS_DONE} {line}\"))
|
||||||
|
|
||||||
elif itype == "mcp_tool_call":
|
elif itype == "mcp_tool_call":
|
||||||
name = _format_tool_call(item.get("server", ""), item.get("tool", ""))
|
name = _format_tool_call(item.get("server", ""), item.get("tool", ""))
|
||||||
if etype == "item.started":
|
if etype == "item.started":
|
||||||
lines.append(f"{STATUS_RUNNING} tool: {name}")
|
lines.append(
|
||||||
|
_with_id(_extract_numeric_id(item.get(\"id\")), f\"{STATUS_RUNNING} tool: {name}\")
|
||||||
|
)
|
||||||
elif etype == "item.completed":
|
elif etype == "item.completed":
|
||||||
lines.append(f"{STATUS_DONE} tool: {name}")
|
lines.append(_with_id(_extract_numeric_id(item.get(\"id\")), f\"{STATUS_DONE} tool: {name}\"))
|
||||||
|
|
||||||
elif itype == "web_search" and etype == "item.completed":
|
elif itype == "web_search" and etype == "item.completed":
|
||||||
query = _format_query(item.get("query", ""))
|
query = _format_query(item.get("query", ""))
|
||||||
lines.append(f"{STATUS_DONE} searched: {query}")
|
lines.append(_with_id(_extract_numeric_id(item.get(\"id\")), f\"{STATUS_DONE} searched: {query}\"))
|
||||||
|
|
||||||
elif itype == "error" and etype == "item.completed":
|
elif itype == "error" and etype == "item.completed":
|
||||||
warning = _truncate(item.get("message", ""), 120)
|
warning = _truncate(item.get("message", ""), 120)
|
||||||
lines.append(f"{STATUS_DONE} warning: {warning}")
|
lines.append(_with_id(_extract_numeric_id(item.get(\"id\")), f\"{STATUS_DONE} warning: {warning}\"))
|
||||||
|
|
||||||
return lines
|
return lines
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user