{% extends "base.html" %} {% from "macros.html" import pill, sparkline %} {% block title %}Health — Agent Wasp{% endblock %} {% block page_css %} {% endblock %} {% block content %} {# ── Helpers ──────────────────────────────────────────────────────────────── #} {%- set score_color = "text-success" if score and score >= 80 else "text-warning" if score and score >= 50 else "text-error" -%} {%- set score_label = "Excellent" if score and score >= 80 else "Good" if score and score >= 60 else "Degraded" if score and score >= 40 else "Critical" -%}

Health & Introspection

Real-time system status · auto-refresh 30s

{% if score is not none %}
Score {{ score }} {{ score_label }}
{% endif %} {% if latest %} {%- set cpu_pct = latest.get("system",{}).get("cpu",{}).get("percent",0) -%} {%- set ram_pct = latest.get("system",{}).get("ram",{}).get("percent",0) -%} {%- set disk_pct = latest.get("system",{}).get("disk",{}).get("percent",0) -%}
CPU {{ cpu_pct }}%
RAM {{ ram_pct }}%
Disk {{ disk_pct }}%
{% endif %} {% if perf %}
24h Events {{ perf.total_events }}
Error Rate {{ perf.error_rate }}%
Avg Latency {{ perf.avg_latency_ms }}ms
{% endif %} {% if caps %}
Uptime {{ caps.uptime_hours }}h
{% endif %}
{# Health score card #} {% if score is not none %}
{{ score }}
Health Score
{{ score_label }}
{% endif %} {# Service cards #} {% if latest %} {% for svc, info in latest.get("services", {}).items() %}

{{ svc }}

{% if info.get("healthy") %} OK {% else %} FAIL {% endif %}
{% if info.get("latency_ms") is not none %}
Latency {{ info.latency_ms }}ms
{% endif %} {% if info.get("error") %}
{{ info.error[:60] }}
{% endif %} {% if info.get("models") %}
{{ info.models | join(", ") }}
{% endif %}
{% endfor %} {% endif %}
{% if latest %}
{%- set disk = latest.get("system",{}).get("disk",{}) -%} {%- set ram = latest.get("system",{}).get("ram",{}) -%} {%- set cpu = latest.get("system",{}).get("cpu",{}) -%} {% for label, key, metric, spark_json, warn_pct, crit_pct, unit_top, unit_bot in [ ("Disk", "disk", disk, disk_spark, 75, 90, disk.get("used_gb","?") ~ " / " ~ disk.get("total_gb","?") ~ " GB", ""), ("RAM", "ram", ram, ram_spark, 75, 90, ram.get("used_mb","?") ~ " / " ~ ram.get("total_mb","?") ~ " MB", ""), ("CPU", "cpu", cpu, cpu_spark, 70, 90, cpu.get("cores","?") ~ " cores", latest.get("system",{}).get("uptime_hours","?") ~ "h uptime"), ] %} {%- set pct = metric.get("percent", 0) -%} {%- set is_crit = pct >= crit_pct -%} {%- set is_warn = pct >= warn_pct and not is_crit -%} {%- set color = "#EF4444" if is_crit else "#F59E0B" if is_warn else "#10B981" -%}

{{ label }}

{{ pct }}%
{{ unit_top }}{% if unit_bot %} · {{ unit_bot }}{% endif %}
{% endfor %}
{% endif %} {% if perf %}
Performance (24h)
{{ perf.total_events }}
Events
{{ perf.avg_latency_ms }}ms
Avg Latency
{{ perf.errors }}
Errors
{{ perf.error_rate }}%
Error Rate
{% if perf.top_events %}
Top Event Types
{% for ev in perf.top_events %}
{{ ev.type }} {{ ev.count }}
{% endfor %}
{% endif %}
Activity (last 24h)
hourly buckets
24h ago
events errors
now
{% if caps %}
{% for label, val, color in [ ("Model", caps.active_model or "None", "text-accent"), ("Provider", caps.active_provider or "None", "text-info"), ("Skills", caps.skills_enabled ~ "/" ~ caps.skills_total, "text-success"), ("Memory", caps.memory_total ~ " entries", "text-secondary"), ] %}
{{ label }} {{ val }}
{% endfor %}
{% endif %}
{% endif %} {% if history %}
Recent Health Checks {{ history|length }} entries
{% for entry in history %} {%- set has_fail = false -%} {%- for svc in ["redis","postgres","ollama"] -%} {%- if not entry.get("services",{}).get(svc,{}).get("healthy",true) -%} {%- set has_fail = true -%} {%- endif -%} {%- endfor -%} {% for svc in ["redis", "postgres", "ollama"] %} {%- set info = entry.get("services",{}).get(svc,{}) -%} {% endfor %} {%- set d = entry.get("system",{}).get("disk",{}) -%} {%- set r = entry.get("system",{}).get("ram",{}) -%} {%- set c = entry.get("system",{}).get("cpu",{}) -%} {% endfor %}
Time Redis Postgres Ollama Disk RAM CPU Check ms
{{ entry.timestamp[:16].replace("T"," ") if entry.timestamp else "—" }} {% if info.get("healthy") %} {% else %} {% endif %} {{ d.get("percent","?") }}% {{ r.get("percent","?") }}% {{ c.get("percent","?") }}% {{ entry.get("check_ms","?") }}ms
{% endif %}
Safety & Execution Control
Last Soft Gate
{% if safety_data.gate_decision %}
{% if safety_data.gate_decision == "BLOCK" %} BLOCK {% elif safety_data.gate_decision == "WARN" %} WARN {% else %} ALLOW {% endif %} {{ safety_data.gate_ts or "—" }}
{% if safety_data.gate_reason %}

{{ safety_data.gate_reason }}

{% endif %} {% else %}

No self-improve executions yet

{% endif %}
CRIT-3 Daily Budget
{{ safety_data.crit3_count }} / {{ safety_data.crit3_limit }}
{%- set crit_pct2 = (safety_data.crit3_count / safety_data.crit3_limit * 100)|round|int -%}

Critical-path self-edits today

Saccadic Vision
{% if safety_data.saccadic_last %}
{{ safety_data.saccadic_last }}
{% if safety_data.saccadic_hash %}

hash: {{ safety_data.saccadic_hash }}…

{% endif %} {% else %}

No perception events yet

{% endif %}
Learning Queue
{{ behavioral_pending }} / 50
{%- set bq_pct = (behavioral_pending / 50 * 100)|round|int -%}
{% if behavioral_pending >= 40 %}

Near cap — LLM storm risk

{% elif behavioral_pending >= 20 %}

High — corrections pending analysis

{% else %}

Corrections pending LLM analysis

{% endif %}
{% endblock %} {% block extra_scripts %} {% endblock %}