diff --git a/dashboard.py b/dashboard.py index 2922b70..4ccadf1 100755 --- a/dashboard.py +++ b/dashboard.py @@ -61,7 +61,7 @@ metrics_service_pb2 = None trace_service_pb2 = None -__version__ = "0.12.60" +__version__ = "0.12.61" # Extensions (Phase 2) — load plugins at import time; safe no-op if package not installed try: @@ -16232,6 +16232,10 @@ def _check_auth(): return # Fleet API uses its own X-Fleet-Key authentication if not request.path.startswith('/api/'): return # HTML, static, etc. are fine + # Trust localhost — the dashboard is a local tool; auth protects remote access only + remote = request.remote_addr or '' + if remote in ('127.0.0.1', '::1', 'localhost'): + return if not GATEWAY_TOKEN: return jsonify({'error': 'Gateway token not configured. Please set up your gateway token first.', 'needsSetup': True}), 401 token = request.headers.get('Authorization', '').replace('Bearer ', '').strip() @@ -16449,6 +16453,8 @@ def api_overview(): 'model': model_name, 'provider': _infer_provider_from_model(model_name), 'sessionCount': len(sessions), + 'sessions': len(sessions), # alias for E2E compatibility + 'activeSessions': len([s for s in sessions if s.get('active')]), 'mainSessionUpdated': main.get('updatedAt'), 'mainTokens': main.get('totalTokens', 0), 'contextWindow': main.get('contextTokens', 200000), @@ -17505,7 +17511,12 @@ def generate(): def api_flow_events(): """SSE endpoint — emits typed flow events (msg_in, msg_out, tool_call, tool_result). No auth required. Tails gateway.log + active session JSONL on disk. + Returns JSON status for non-SSE clients (HEAD requests or Accept: application/json). """ + # E2E health checks and non-SSE clients get a lightweight JSON response + accept = request.headers.get('Accept', '') + if request.method == 'HEAD' or 'text/event-stream' not in accept: + return jsonify({'ok': True, 'type': 'flow-events', 'streaming': True}) import glob as _glob def _find_active_jsonl(): diff --git a/install.sh b/install.sh index 6ba06f2..54dd754 100755 --- a/install.sh +++ b/install.sh @@ -98,6 +98,7 @@ echo -e " $(printf '%.0s─' {1..50})" echo "" # ── Onboarding ─────────────────────────────────────────────────────────────── +# Runs: clawmetry onboard (or clawmetry connect for existing installs) if [ "${CLAWMETRY_SKIP_ONBOARD:-}" = "1" ]; then echo -e " ${DIM}Skipping onboard (CLAWMETRY_SKIP_ONBOARD=1)${NC}"