refactor: unify LLM adapter tracing and API key resolution

↗ view on GitHub · Eli Ziff · 2026-07-27 · efc899d1

Every adapter duplicated the same two rituals: a ~10-line apiKey()
override-or-env-or-throw copy, and paired logRawLlmStream(...) +
rawStreamRecorder?.record(...) calls at each stream-event site.
createLlmTrace() now folds console echo and file capture behind one
always-present handle, and requireApiKey() owns key resolution.
Also drops OpenAI's redundant sse_chunk capture (the parsed sse_event
records the same bytes, matching the DeepSeek adapter's granularity).

Verified: tsc clean; 47 llm+chat tests green incl. new smoke test
proving file capture JSON and console echo end-to-end.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QUsMXzBsEJ27DjJVPSfW5o
Repository eliziff/Beaver
Author Eli Ziff <eliasziff@gmail.com>
Authored
Parents 2f78a7e4
Stats 10 files changed , +141 , -200
Part of Frontend UI compaction / simplification pass

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-efc899d1.md from inside the repo you want the change in.

⬇ Download capture-commit-efc899d1.md