{#- A task's comment thread, refetched on live events. Expects: t (the task), comments, optional error. The form that adds a comment lives outside it (_comments.html), so a draft survives. -#} {%- macro stamp(ts) -%}{%- endmacro -%}
{% if error %}{% endif %} {% if comments %}
    {% for c in comments %}
  1. {{ "You" if c.from_owner else c.author }} #{{ c.id }}{% if c.in_reply_to %} · re #{{ c.in_reply_to }}{% endif %}
    {{ c.body_md|markdown }}

    {%- if c.from_owner %} sent {{ stamp(c.created_at) }} {%- if c.delivered_at %} · delivered {{ stamp(c.delivered_at) }}{% if c.delivered_to_name %} to {{ c.delivered_to_name }}{% endif %} {%- else %} · not delivered yet{% endif %} {%- if c.read_at %} · read {{ stamp(c.read_at) }}{% endif %} {%- else %} reply {{ stamp(c.created_at) }} {%- if not c.read_at %} · unread{% endif %} {%- endif %}

  2. {% endfor %}
{% if comments|rejectattr("from_owner")|selectattr("read_at", "none")|list %}
{% endif %} {% else %}

No comments yet.

{% endif %}

{% if t.session_name %}A new comment reaches {{ t.session_name }} through its hooks on its next prompt or tool call.{% else %}No session is bound to this task: a comment waits until one is.{% endif %}