feat(trace): waterfall visualization + persona YAML sync

- trace.Logger: Trace+Span model with 14+ hop tracking
- trace.SpanTimer: convenience API for instrumentation
- trace_adapter.go: serialize Trace+Span for frontend
- Frontend TracePage: colored waterfall bars, expand/collapse, detail popup
- persona.go: full v1 YAML parser (identity/traits/forbidden/sections)
- cyrene_persona.yaml: v1 persona config copied to v2
- Orchestrator: TraceHook + MemoryExtractor injection points
This commit is contained in:
Aska committed 2026-08-12 18:52:39 +08:00
1 parent 47047c903c
commit 4e2e81f684
8 files changed
+1178 -198

No files matched your search

+8 -2
View File
@@ -69,6 +69,7 @@ type LLMCallLogger interface {
// TraceLogger provides full-chain trace events.
type TraceLogger interface {
Recent(n int) []map[string]any
Clear() // Remove old traces
}
// PerfMonitor provides performance snapshot history.
@@ -515,10 +516,15 @@ func num(m map[string]any, key string) int {
func (r *Router) traceHandler(w http.ResponseWriter, req *http.Request) {
if r.deps.TraceLog == nil {
writeJSON(w, 200, M{"events": []any{}})
writeJSON(w, 200, M{"traces": []any{}})
return
}
writeJSON(w, 200, M{"events": r.deps.TraceLog.Recent(100)})
if req.Method == "DELETE" {
r.deps.TraceLog.Clear()
writeJSON(w, 200, M{"ok": true})
return
}
writeJSON(w, 200, M{"traces": r.deps.TraceLog.Recent(50)})
}
func (r *Router) perfHandler(w http.ResponseWriter, req *http.Request) {