feat: replace Langfuse with local-first tracing system

Merged
AN
8mo ago
+10604-263

What does this PR do?

Replaces the Langfuse SDK integration with a vendor-neutral, exporter-based tracing system. Every CLI and TUI session now captures full traces (generations, tool calls, tokens, cost, timing) as local JSON files with an interactive HTML viewer.

Core additions:

  • Tracer class with FileExporter (local JSON) and HttpExporter (remote endpoints)
  • 4-mode HTML trace viewer (Waterfall, Tree, Chat, Log) via Bun.serve
  • altimate-code trace list and altimate-code trace view CLI commands
  • Data engineering semantic attributes for warehouse/SQL/dbt/quality/cost
  • Config schema: tracing.enabled, tracing.dir, tracing.maxFiles, tracing.exporters

Key design decisions:

  • Crash-safe: writeFileSync in signal handlers, atomic tmp+rename snapshots
  • Config-aware: TUI and CLI both honor tracing.* config settings
  • Fail-safe: all tracing methods wrapped in try-catch, never crashes the app
  • Localhost-only: trace viewer server binds to 127.0.0.1
  • Session finalization: TUI traces end on session.status=idle

Type of change

  • New feature (non-breaking change which adds functionality)

Issue for this PR

Closes #182

How did you verify your code works?

  • 380 tests across 13 test files (unit, integration, adversarial, e2e)
  • TypeScript type-check passes (0 new errors)
  • Manual testing of trace list, trace view, and TUI /trace command
  • 6-model code review (Claude, GPT 5.2 Codex, Gemini 3.1 Pro, Kimi K2.5, MiniMax M2.5, GLM-5) with convergence round

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes