SIGN IN SIGN UP

Add a per-thread raw event inspector (#182)

* Add a per-thread raw event inspector

When a bot misbehaves the chat view can't say why; the answer is in two
logs the harness already writes per thread — the normalized RuntimeEvent
stream (events/) and the provider's verbatim protocol tee (native/) —
and until now the only way to read them was by hand.

- server/thread-events.ts + GET /api/threads/:id/events?limit=: reads
  both logs, caps each on its own (the native tee is several times
  chattier), merges by time, tags kind. 404 for unknown threads; refuses
  path-shaped ids; a torn line is skipped, not fatal.
- InspectorPanel in the chat's right slot (bug icon in the header, same
  exclusive-panel pattern as Computer/Settings). Events lens: turns,
  tools, requests, token usage, errors, with runs of content.delta
  folded into one row; follows live over its own SSE subscription and
  re-reads the disk when a turn settles. Raw lens: the native tee with
  in/out direction and per-driver labels. Any row expands to full JSON.
- src/lib/inspector.ts keeps the summarizing/folding pure and tested.

Item 1.2 of docs/plans/agent-harness-upgrades-v2.md. Nothing new is
captured; this only reads back what was already on disk.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Validate inspector log records at the wire boundary

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: milind-soni <milindsoni201@gmail.com>
O
Omkar Satpute committed
3ce18caa69aea52330cad5ce3afcab4c40eaaf09
Parent: bbac2f1
Committed by GitHub <noreply@github.com> on 8/18/2026, 6:45:06 AM