- Extract inline CSS from layout.html into static/hermes-trace.css
(-42%, dead selectors from legacy side-panel/three-pane/waterfall removed)
- Fix fragile query-string building in openTurn (URLSearchParams)
- Fix payload race: beforeSwap guard drops stale JSON payloads when
switching turns mid-flight
- Show Loading placeholder and surface HTMX failures instead of
failing silently
- Extract inline x-data into Alpine.data("turnDetail") component
- a11y: keyboard-operable rows (tabindex + Enter/Space), Esc closes
overlay, aria-label on close button, focusable token tooltip,
higher-contrast latency-medium
- Table consistency: LLM latency renders with 's' unit, truncated
cells get title attributes
- Show all turns in session view (drop default limit of 100) and
remove now-dead _order offset logic
- Add X-Content-Type-Options: nosniff header and data: favicon
- Sync docs (frontend.md, database.md, AGENTS.md) with the above
125 lines
6.4 KiB
HTML
125 lines
6.4 KiB
HTML
{% extends "layout.html" %}
|
|
{% block title %}hermes-trace — Session {{ session_id[:48] }}{% endblock %}
|
|
{% block content %}
|
|
|
|
<div x-data="{
|
|
showDetail: false,
|
|
selectedTurn: null,
|
|
openTurn(turnId, order, tool, tcId) {
|
|
const params = new URLSearchParams();
|
|
if (order !== undefined) params.set('order', order);
|
|
if (tool) params.set('tool', tool);
|
|
if (tcId !== undefined) params.set('focus_tc', tcId);
|
|
const qs = params.toString();
|
|
const url = '/turn/' + turnId + (qs ? '?' + qs : '');
|
|
this.selectedTurn = turnId;
|
|
this.showDetail = true;
|
|
$nextTick(() => {
|
|
const body = document.getElementById('detail-body');
|
|
if (body) body.innerHTML = '<div class="detail-loading">Loading…</div>';
|
|
htmx.ajax('GET', url, {target:'#detail-body', swap:'innerHTML'});
|
|
});
|
|
}
|
|
}" @keydown.escape.window="showDetail = false">
|
|
<div class="trace-nav">
|
|
<a class="nav-link" href="/">← Back to sessions</a>
|
|
<h2>Session <code>{{ session_id[:48] }}</code></h2>
|
|
<span class="turn-summary">
|
|
<strong>{{ total_turn_count }}</strong> turns
|
|
{% if total_tool_calls > 0 %}
|
|
· <strong>{{ total_tool_calls }}</strong> tools
|
|
{% endif %}
|
|
{% if avg_latency is not none %}
|
|
· avg <strong>{{ "%.1f" | format(avg_latency) }}s</strong>
|
|
{% endif %}
|
|
{% if avg_tps is not none %}
|
|
· <strong>{{ "%.1f" | format(avg_tps) }}</strong> tok/s
|
|
{% endif %}
|
|
</span>
|
|
</div>
|
|
|
|
<div class="session-table-wrapper">
|
|
<table class="session-table">
|
|
<colgroup>
|
|
<col class="col-time">
|
|
<col class="col-call">
|
|
<col class="col-input">
|
|
<col class="col-response">
|
|
<col class="col-latency">
|
|
<col class="col-model">
|
|
</colgroup>
|
|
<thead>
|
|
<tr>
|
|
<th>Start</th>
|
|
<th>Call</th>
|
|
<th>Input</th>
|
|
<th>Response</th>
|
|
<th>Latency</th>
|
|
<th>Model</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for t in turns %}
|
|
{% set lat_s = (t.elapsed_ms / 1000) if t.elapsed_ms else 0 %}
|
|
{% set lat_cls = 'latency-fast' if lat_s < 1 else ('latency-medium' if lat_s < 10 else ('latency-slow' if lat_s < 30 else 'latency-very-slow')) %}
|
|
{# ── LLM Call row ── #}
|
|
<tr class="tr-llmcall" :class="{ 'tr-selected': selectedTurn === {{ t.id }} }" tabindex="0" @click="openTurn({{ t.id }}, {{ t._order }});" @keydown.enter.prevent="openTurn({{ t.id }}, {{ t._order }});" @keydown.space.prevent="openTurn({{ t.id }}, {{ t._order }});">
|
|
<td class="cell-time">{{ (t.created_at or "") | utc8 }}</td>
|
|
<td class="cell-call"><span class="call-badge" title="LLM #{{ t._order }}"><span class="label">LLM #{{ t._order }}</span></span></td>
|
|
<td class="cell-text" title="{{ t.request_preview or '' }}">{{ (t.request_preview or "") | truncate(80) }}</td>
|
|
<td class="cell-text" title="{{ t.response_preview or '' }}">{{ (t.response_preview or "") | truncate(80) }}</td>
|
|
<td class="cell-latency {{ lat_cls }}">
|
|
{% if t.elapsed_ms is not none %}
|
|
{{ "%.2f" | format(lat_s) }}s
|
|
{% else %}
|
|
—
|
|
{% endif %}
|
|
</td>
|
|
<td class="cell-model"><span class="badge badge-dim" title="{{ t.model or '' }}" style="max-width:100%;overflow:hidden;text-overflow:ellipsis;display:inline-block;">{{ t.model or "—" }}</span></td>
|
|
</tr>
|
|
{# ── Tool Call rows ── #}
|
|
{% for tc in t.tool_calls %}
|
|
{% set tc_lat_cls = 'latency-fast' if (tc.duration_ms or 0) < 1000 else ('latency-medium' if (tc.duration_ms or 0) < 10000 else ('latency-slow' if (tc.duration_ms or 0) < 30000 else 'latency-very-slow')) %}
|
|
{# Smart MCP display: mcp__x__y → MCP x/y #}
|
|
{% if tc.name.startswith('mcp__') %}
|
|
{% set tc_display = 'MCP ' ~ tc.name[5:] | replace('__', '/') %}
|
|
{% else %}
|
|
{% set tc_display = tc.name %}
|
|
{% endif %}
|
|
<tr class="tr-toolcall" tabindex="0" @click="openTurn({{ t.id }}, {{ t._order }}, {{ tc.name | tojson }}, {{ tc.id }});" @keydown.enter.prevent="openTurn({{ t.id }}, {{ t._order }}, {{ tc.name | tojson }}, {{ tc.id }});" @keydown.space.prevent="openTurn({{ t.id }}, {{ t._order }}, {{ tc.name | tojson }}, {{ tc.id }});">
|
|
<td class="cell-tool-meta" colspan="2">
|
|
<span class="tool-badge" title="{{ tc.name }}">
|
|
<span class="tool-arrow">↳</span>
|
|
<span class="tool-label">{{ tc_display }}</span>
|
|
</span>
|
|
</td>
|
|
<td class="cell-text" title="{{ tc.args or '' }}">{{ (tc.args or "") | truncate(80) }}</td>
|
|
<td class="cell-text" title="{{ tc.result or '' }}">{{ (tc.result or "") | truncate(80) }}</td>
|
|
<td class="cell-latency {{ tc_lat_cls }}">
|
|
{% if tc.duration_ms is not none %}
|
|
{{ tc.duration_ms }}ms
|
|
{% else %}
|
|
—
|
|
{% endif %}
|
|
</td>
|
|
<td></td>
|
|
</tr>
|
|
{% endfor %}
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
{# ── Detail Overlay Panel ── #}
|
|
<div class="detail-overlay" :class="{ open: showDetail }">
|
|
<div class="resize-handle" id="resize-handle"></div>
|
|
<div class="detail-overlay-header">
|
|
<span class="detail-overlay-title">Turn Details</span>
|
|
<button class="detail-overlay-close" @click="showDetail = false" aria-label="Close panel">×</button>
|
|
</div>
|
|
<div id="detail-body" class="detail-overlay-body">
|
|
<div class="empty-state">Select a turn to inspect</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|