mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-16 13:03:31 +08:00
Adds an idempotent DELETE /api/traces/:sessionId path that removes only the local trace JSONL file and invalidates trace read cache. The Trace list now exposes a trash action behind a confirmation dialog that states chat history is not deleted. Tested: bun test src/server/__tests__/trace-capture.test.ts Tested: cd desktop && bun run test -- src/pages/TraceList.test.tsx --run Tested: bun run check:server Tested: bun run check:desktop Tested: Browser smoke with temporary CLAUDE_CONFIG_DIR verified the Trace list delete button and confirmation dialog on ?traceWindow=1. Constraint: GitHub issue #868 remains open until a release ships and post-release retest passes. Confidence: high Scope-risk: moderate
26 lines
1006 B
TypeScript
26 lines
1006 B
TypeScript
import { api } from './client'
|
|
import type { TraceCaptureSettings, TraceSessionDeleteResult, TraceSessionList } from '../types/trace'
|
|
|
|
export const tracesApi = {
|
|
list(options?: { limit?: number; offset?: number; query?: string }) {
|
|
const params = new URLSearchParams()
|
|
if (options?.limit !== undefined) params.set('limit', String(options.limit))
|
|
if (options?.offset !== undefined) params.set('offset', String(options.offset))
|
|
if (options?.query) params.set('q', options.query)
|
|
const suffix = params.toString() ? `?${params}` : ''
|
|
return api.get<TraceSessionList>(`/api/traces${suffix}`)
|
|
},
|
|
|
|
getSettings() {
|
|
return api.get<TraceCaptureSettings>('/api/traces/settings')
|
|
},
|
|
|
|
updateSettings(settings: Partial<Pick<TraceCaptureSettings, 'enabled'>>) {
|
|
return api.put<TraceCaptureSettings>('/api/traces/settings', settings)
|
|
},
|
|
|
|
deleteSession(sessionId: string) {
|
|
return api.delete<TraceSessionDeleteResult>(`/api/traces/${encodeURIComponent(sessionId)}`)
|
|
},
|
|
}
|