Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/a2a_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def send(
try:
task = asyncio.run(http_client.send_task(params))
if not wait:
display_task_info(task, color)
display_task_info(task, color=color)
except JSONRPCError as exc:
logging.getLogger("a2a-cli").error("Send failed: %s", exc)
raise typer.Exit(1)
Expand Down Expand Up @@ -251,7 +251,7 @@ def get(

task = asyncio.run(A2AClient.over_http(rpc_url).get_task(TaskQueryParams(id=id)))
if json_output:
print(json.dumps(task.model_dump(by_alias=True), indent=2))
print(json.dumps(task.model_dump(mode="json", by_alias=True), indent=2))
else:
display_task_info(task, color)

Expand Down
13 changes: 10 additions & 3 deletions src/a2a_cli/ui/ui_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def _extract_part_text(part: Any) -> Optional[str]:
2. Fallback to ``model_dump()`` → ``{"text": …}`` for Pydantic types.
"""
for attr in ("text", "value", "content", "data"):
txt = getattr(part, attr, None)
txt = getattr(part, attr, None) or (part.get(attr) if isinstance(part, dict) else None)
if isinstance(txt, str) and txt.strip():
return txt

Expand Down Expand Up @@ -134,8 +134,15 @@ def display_task_info(task: Any, *, color: bool = True, console: Console | None
if getattr(task, "artifacts", None):
details.append("\nArtifacts:")
for art in task.artifacts:
details.append(f" • [{ARTIFACT_COLOR}]{art.name or '<unnamed>'}[/{ARTIFACT_COLOR}]")
for part in art.parts:
# Pydantic may leave artifacts as raw dicts when the field is typed Any
art_name = (
art.get("name") if isinstance(art, dict) else getattr(art, "name", None)
) or "<unnamed>"
art_parts = (
art.get("parts", []) if isinstance(art, dict) else getattr(art, "parts", [])
) or []
details.append(f" • [{ARTIFACT_COLOR}]{art_name}[/{ARTIFACT_COLOR}]")
for part in art_parts:
snippet = _extract_part_text(part)
if snippet:
snippet = snippet[:200] + ("…" if len(snippet) > 200 else "")
Expand Down