{% from "_macros.html" import icon %} {# What the model did before answering. Rendered both live (streamed as a whole block, like the reasoning and the answer) and from the stored message afterwards, so the sources behind an answer stay in the transcript rather than vanishing when the stream ends. EVERYTHING in here is third-party text and is untrusted, exactly as much as model output is -- a search provider's results, an administrator's HTTP tool relaying whatever it was pointed at, an MCP server's reply. Jinja autoescaping covers it. Two things are handled separately: the URL, because `is_linkable` is the only thing standing between a result carrying a javascript: URL and an anchor pointing at it, and `event.text`, which is rendered as preformatted text and deliberately NOT through services/markdown.py -- markdown is the one path allowed to emit HTML, and this is the last content that should be given it. `kind` says how to label the event. Rows written before it existed have none, so web_search reads as a search and everything else falls to the generic branch: an old notes_search event used to claim it had searched the web. #} {% for event in tool_events %} {% set kind = event.kind or ('search' if event.name == 'web_search' else 'tool') %}
{% if kind == 'search' %} {{ icon("globe", "icon--sm tool-activity__icon") }} {% elif kind == 'custom' %} {{ icon("link", "icon--sm tool-activity__icon") }} {% elif kind == 'mcp' %} {{ icon("server", "icon--sm tool-activity__icon") }} {% else %} {{ icon("sparkle", "icon--sm tool-activity__icon") }} {% endif %} {% if kind == 'search' %} {% if event.status == "error" %} Web search failed {% elif event.query %} Searched the web for “{{ event.query }}” {% else %} Searched the web {% endif %} {% else %} {% set label = event.label or event.name %} {% if event.status == "error" %} {{ label }} failed {% else %} {{ label }} {% endif %} {% if event.query %} · {{ event.query }} {% endif %} {% endif %} {% if event.results %} · {{ event.results | length }} result{{ '' if event.results | length == 1 else 's' }} {% endif %} {{ icon("chevron-down", "icon--sm reasoning__chevron") }}
{% if event.detail and kind != 'search' %}

{{ event.detail }}

{% endif %} {% if event.error %}

{{ event.error }}

{% elif not event.results and not event.text %}

Nothing was found.

{% endif %} {% if event.text %}
{{ event.text }}
{% endif %} {% for result in event.results %}
{% set scheme = (result.url or "").split(":")[0] | lower %} {% if scheme in ("http", "https") %} {{ result.title }} {% else %} {# Not a link. A result is third-party text and its URL is not trusted to be safe to click. #} {{ result.title }} {% endif %} {{ result.host }} {% if result.snippet %}

{{ result.snippet }}

{% endif %}
{% endfor %}
{% endfor %}