{{/* Renders a single historical message row. Used for full-page loads. Tool messages get a collapsible
card (native HTML — no JS needed) instead of a plain bubble, since a run_bash_command or search_codebase result can be long and isn't usually what you want to read first when scrolling a past conversation. */}} {{ define "message" }} {{ if eq .Role "tool" }}
{{ .ToolName }}
{{ .RenderedHTML }}
{{ else if eq .Role "user" }}
{{ .RenderedHTML }}
{{ else }}
enkly
{{ .RenderedHTML }}
{{ end }} {{ end }} {{/* Renders a tool-call card (used for live streaming and by tests). Data: ToolName, Summary, Body (already-escaped HTML), IsError. */}} {{ define "tool_call" }}
{{ .ToolName }} {{ .Summary }}
{{ .Body }}
{{ end }} {{/* The SSE "tool" payload. htmx applies an out-of-band swap by moving the CONTENT of the hx-swap-oob element (for any strategy other than outerHTML), so the target-carrying wrapper is a bare
and the real .message-row lives inside it. "beforebegin" on the assistant row puts each card above the still-streaming bubble, in execution order. Data: StreamID plus the tool_call fields. */}} {{ define "tool_call_oob" }}
{{ template "tool_call" . }}
{{ end }} {{/* A single round's standalone reasoning trace, rendered as its own collapsible card — the per-step counterpart to the single auto-collapsing "thinking-card" in chat_response.html's assistant_stream, which only ever shows one running cumulative blob. This one instead gives each round its own card, inserted above the assistant bubble in execution order via the same "beforebegin" OOB-swap trick tool_call_oob uses — so a card for round 0's reasoning lands right before the tool card it led to, then round 1's reasoning card lands before round 1's tool card, and so on: discrete, positioned reasoning steps rather than one blob for the whole turn, the same interleaved-thinking shape Claude's own UI gives a tool-using turn. Reuses .tool-card's chrome (border, summary, chevron) with a thinking-specific icon and a round number, rather than introducing a parallel set of card styles for what is structurally the same kind of row. Data: Round (int), Thinking (plain text). */}} {{ define "thinking_round" }}
Thinking round {{ .Round }}

{{ .Thinking }}

{{ end }} {{/* The SSE "thinking_round" payload — same OOB wrapper as tool_call_oob. */}} {{ define "thinking_round_oob" }}
{{ template "thinking_round" . }}
{{ end }} {{/* Inline error row returned by POST /chat for validation problems. */}} {{ define "chat_error" }}
{{ .Message }}
{{ end }}