feat: Paseo-like orchestrator Phase 1-2 — trace system, session persistence, timeline, run_command, auto-fix loop

Phase 1: Trace System + Observability
- tool_traces DB table + insert/update service
- tool_trace_start/tool_trace_finish WS frames (contracts + FE types)
- Instrumented tool-phase.ts with timing around every tool call
- GET /api/chats/:id/traces paginated endpoint
- Trace viewer frontend (collapsible panel with timing bars + token breakdown)

Phase 2: Session Persistence + Resume
- agent_snapshots table (UPSERT per chat, persisted on turn boundaries)
- save/load/delete service functions
- Agent snapshot sent on WS reconnect
- Session timeline view (vertical timeline with scroll-to + restore)

Tooling:
- run_command tool (execFile, 30s timeout, 32KB cap, path-guarded)
- Auto-fix loop: after write tools, runs pnpm build, injects errors into next turn
This commit is contained in:
2026-06-08 02:26:47 +00:00
parent 7cb692d8be
commit abe9c5a3a8
22 changed files with 2231 additions and 101 deletions

View File

@@ -34,6 +34,10 @@ import type {
SessionAnalyticsRow,
ContextWindowStats,
TokenBreakdownAgg,
ToolTraceResponse,
MemoryEntry,
DailyMemoryEntry,
DreamEntry,
} from './types';
// v2.6 Phase 1-UX §9b: chat-scoped agent-session rows. Returned by
@@ -340,6 +344,10 @@ export const api = {
method: 'POST',
body: JSON.stringify({ tool_call_id: toolCallId, decision }),
}),
getTraces: (chatId: string, limit = 50, offset = 0) =>
request<ToolTraceResponse>(
`/api/chats/${chatId}/traces?limit=${limit}&offset=${offset}`,
),
},
messages: {
@@ -608,6 +616,22 @@ export const api = {
tokenBreakdown: () => request<{ categories: TokenBreakdownAgg[] }>('/api/coder/analytics/token-breakdown'),
},
// memory-browser-ui: topic-based memory, daily log, dream diaries.
memory: {
list: (projectId: string) =>
request<{ entries: MemoryEntry[] }>(
`/api/memory?project_id=${encodeURIComponent(projectId)}`,
),
daily: (projectId: string) =>
request<{ entries: DailyMemoryEntry[] }>(
`/api/memory/daily?project_id=${encodeURIComponent(projectId)}`,
),
dreams: (projectId: string) =>
request<{ entries: DreamEntry[] }>(
`/api/memory/dreams?project_id=${encodeURIComponent(projectId)}`,
),
},
settings: {
get: () => request<Record<string, unknown>>('/api/settings'),
patch: (body: Record<string, unknown>) =>