{% macro badge_for(ev, view) %} {{ ev.badge }} {% endmacro %} {% macro meta_for(ev) %} {%- if ev.in_tokens or ev.out_tokens -%} {{ ev.in_tokens|fmt_tokens }} / {{ ev.out_tokens }} {%- endif -%} {%- if ev.duration_ms -%} {{ ev.duration_ms|fmt_duration }} {%- endif -%} {{ ev.ts|fmt_time or (ev.received_at|fmt_time) }} {% endmacro %} {% macro copyable(content, hl="json") %}
{# `json-maybe` on text blocks: the tree renders only when JSON.parse succeeds, so tool_result output that happens to be JSON gets the collapsible view while plain prose stays untouched. #}
{{ content }}
{% endmacro %} {% macro detail_panel(ev, did, results=None) %} {# When rendering subagent events the caller passes its own results_by_id so tool_use → tool_result lookups stay scoped to that sub-session instead of grabbing an unrelated parent result. #} {% set results_by_id = results if results is not none else results_by_id %} {% endmacro %}