{# Delivery: what recent packets delivered and how long they took. Built from the pipeline ring (collector._delivery_panel), so it describes the last few packets, not a lifetime. Replaces the old Tokens panel; the lifetime token count stays as one small line. #}

Delivery {% if state.delivery %} last {{ state.delivery.samples }} packet{{ '' if state.delivery.samples == 1 else 's' }} {% endif %}

{% if not state.delivery %}

No packets yet. Send a query through /context to fill this in.

{% else %}
Chunks per packet
{% if state.delivery.chunks %} {{ "{:,}".format(state.delivery.chunks.last) }} last / {{ state.delivery.chunks.avg }} avg {% else %}not reported by this engine{% endif %}
Characters per packet
{% if state.delivery.chars %} {{ "{:,}".format(state.delivery.chars.last) }} last / {{ "{:,.0f}".format(state.delivery.chars.avg) }} avg {% else %}not reported by this engine{% endif %}
Packet latency
{{ state.delivery.latency_ms.last }} ms last / {{ state.delivery.latency_ms.avg }} avg / {{ state.delivery.latency_ms.p95 }} p95
{% endif %} {% if state.tokens %}

Lifetime tokens {{ "{:,}".format(state.tokens.lifetime.total) }} {% if state.tokens.lifetime.estimated > 0 %} ({{ "{:,}".format(state.tokens.lifetime.exact) }} exact + {{ "{:,}".format(state.tokens.lifetime.estimated) }} estimated) {% endif %}

{% endif %}