{#- The polled region of /chains (#refresh-region): htmx re-fetches the view every 5s and the alpine-morph extension morphs the fresh fragment over the region in place. The route renders THIS template alone on an HX-Request (a poll is a cheap region render, never a full page). There is no filter form here, so the view's current params (window, session, expand) are baked into the region's hx-get URL — each poll re-requests exactly the slice the page rendered. -#} {% import "_links.html" as links with context %} {% import "_table.html" as tables with context %} {%- set chain_q = {} %} {%- if expand %}{% set _ = chain_q.update({'expand': expand}) %}{% endif %} {%- if session %}{% set _ = chain_q.update({'session': session}) %}{% endif %} {%- if window != "all" %}{% set _ = chain_q.update({'window': window}) %}{% endif %}
{% if chains_truncated %}

showing {{ chains | length }} of {{ total_chains }} chains

{% endif %} {% include "window_control.html" %} {% if chains %}
{% for chain in chains %}
{{ chain.session_id }} {{ chain.call_count }} call{{ "s" if chain.call_count != 1 }} · {{ chain.started_at | epoch }}{% if chain.call_count > 1 %} → {{ chain.ended_at | epoch }} · span {{ (chain.ended_at - chain.started_at) | span }}{% endif %}
    {% for c in chain.calls %}
  1. {{ c.tool_name }} {{ c.status }} {{ c.invoked_at | offset(chain.started_at) }} · {{ c.duration_ms | duration }}
  2. {% endfor %}
{% if chain.truncated_calls %} {#- FR-003: the expand anchor keeps the window AND the selected store (links.url); empty selection keeps the bare href. -#} {% set q = {'expand': chain.session_id} %} {%- if window != "all" %}{% set _ = q.update({'window': window}) %}{% endif %}

showing {{ chain.shown_calls }} of {{ chain.call_count }} calls · expand

{% endif %}
{% endfor %}
{% else %} {{ tables.empty_state('No tool calls recorded yet') }} {% endif %}