Skip to content
Merged
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
29 changes: 29 additions & 0 deletions src/ai_agent/features/evolve/status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""Status rendering for the evolve organism."""

from __future__ import annotations

from collections.abc import Mapping
from typing import Any


def render_status(state: Mapping[str, Any]) -> str:
"""Render the public evolve status in a stable, human-readable format."""
lines = [
f"organism_id: {state.get('organism_id', '')}",
f"stopped: {state.get('stopped', False)}",
f"goals_queue: {state.get('goals_queue', [])}",
f"evolves_today: {state.get('evolves_today', 0)}/{state.get('max_evolves_today', 0)}",
f"merges_today: {state.get('merges_today', 0)}",
f"next_wake_at: {state.get('next_wake_at', '')}",
f"last_run_id: {state.get('last_run_id', '')}",
]
last_run = state.get("last_run")
if isinstance(last_run, Mapping):
lines.extend(
[
f"status: {last_run.get('status', '')}",
f"pr_url: {last_run.get('pr_url', '')}",
f"intent: {last_run.get('intent', '')}",
]
)
return "\n".join(lines)
Loading