{# AGENT DETAIL — the selected run's LIVE WORK TRANSCRIPT pane (the prominent content of the agent-detail center). Included by _agent_detail.html. Pinning a different run from the recent-run strip re-requests the whole agent-detail center with ?run= — no separate panel route needed. Reuses the /crew transcript markup + CSS (`cr-tx-*` / `cr-seg-*`) so an agent's run renders identically to the Crew view. The segments come from the RunState SSOT store's run_span rows (mapped 1:1 to seg-{kind}); the seg-{kind} renderer covers: "output" — the reply text (worker / chat output spans) "thinking" — inline thinking block (worker thinking spans, server-rendered) "tool" — tool call / result (worker tool spans) (The legacy feed-stream-only kinds think / chat-in / chat-reply / status went away with the ~/.cortex-feed feed at T12; their .cr-seg.seg-{kind} CSS is left harmless.) Context (from main._agent_runs_view_store, merged into the agent-detail context): agent_run_selected : the selected run's transcript (header + segments + body) or None. Same shape as crew_selected. #} {% if agent_run_selected %} {% set t = agent_run_selected %}
{{ t.agent_display }} {{ t.status_label }} {% if t.running %} {% endif %} {% if t.handoff_short %}{{ t.handoff_short }}{% endif %} {% if t.harness %}{{ t.harness }}{% endif %} {% if t.model %}{{ t.model }}{% endif %} {% if t.running %}started {{ t.started_ago }}{% else %}ended {{ t.ended_ago or t.updated_ago }}{% endif %}
{% if t.segments %}
{% for seg in t.segments %} {# The `input` span (multi-turn chat, feature-gap step 6) is the USER's message — label it 'you' so the transcript reads as a dialogue, not agent output. Other kinds (output/tool/thinking) render as before. #}
{% if seg.kind == 'input' %}you{% elif seg.kind != 'output' %}{{ seg.kind }}{% endif %} {{ seg.text }}
{% endfor %} {% if t.running %}{% endif %} {% if t.truncated %}
… transcript truncated (per-run cap reached)
{% endif %}
{% elif t.running %}
{{ t.agent_display }} is starting — waiting for the first output…
{% else %}
{% if t.status == 'error' %} This run produced no output before it errored{% if t.error %}: {{ t.error }}{% endif %}. {% else %} This run completed without streaming any text output. {% endif %}
{% endif %} {% if t.status == 'error' and t.error and t.segments %}
errored: {{ t.error }}
{% endif %}
{% else %} {# No run selected / none captured yet for this agent. #}
No run to show yet

Dispatch {{ agent.display_name }} (chat below) or turn project dispatch ON — the moment it runs, its output streams in right here.

{% endif %}