Files
coder/site/.knip.jsonc
T
Thomas Kosiewski 8c0fe6d5f2 feat(site): add chat debug API layer and panel utilities (#23919)
## Summary

Add API client methods, React Query builders, and unit tests for the chat debug endpoints. Add `debugPanelUtils` with coercion helpers that transform raw debug step data into structured display models for the Debug panel, and wire debug run streaming into the chat store.

This is PR 7/9 in the chat debug logging stack.

### Changes

- **API client** (`site/src/api/api.ts`): typed methods for all debug endpoints — list runs, list steps, get/set deployment logging, get/set user logging, set per-chat override.
- **React Query builders** (`site/src/api/queries/chats.ts`): `chatDebugRuns`, `chatDebugSteps`, `chatDebugLoggingConfig`, `userDebugLoggingConfig` query/mutation factories with `refetchInterval: 5000` for live polling.
- **Debug panel utilities** (`site/src/pages/AgentsPage/components/RightPanel/DebugPanel/debugPanelUtils.ts`): `coerceStepRequest` / `coerceStepResponse` that recursively parse nested JSONB into `StepRequestViewModel` / `StepResponseViewModel` with `MessagePart`, `ToolDef`, and `ToolCallPart` types. Includes `formatTokenSummary` (compact `3→5 tok` notation) and `compactDuration` helpers.
- **Unit tests**: coverage for coercion edge cases and formatting utilities.

### Stack overview

1. Database schema & SDK types
2. Types, context, and model normalization
3. Recorder, transport, and redaction
4. Service and summary aggregation
5. Chat lifecycle wiring
6. HTTP handlers and API docs
7. **→ Frontend API layer and panel utilities** (this PR)
8. Debug panel components and settings
9. Storybook stories

---
_Generated with [`mux`](https://github.com/coder/mux) • Model: `anthropic:claude-opus-4-6` • Thinking: `xhigh`_
2026-04-22 15:24:32 +02:00

29 lines
925 B
JSON

{
"$schema": "https://unpkg.com/knip@5/schema.json",
"entry": ["./src/index.tsx", "./src/serviceWorker.ts"],
"project": [
"./src/**/*.ts",
"./src/**/*.tsx",
"./test/**/*.ts",
"./e2e/**/*.ts"
],
"ignore": [
"**/*Generated.ts",
"src/api/chatModelOptions.ts",
// TODO(devtools): debugPanelUtils.ts is staged in PR 7; its exports are
// consumed by the Debug panel components in PRs 8 and 9. Remove this
// exclusion once the panel components land.
"src/pages/AgentsPage/components/RightPanel/DebugPanel/debugPanelUtils.ts",
// TODO(devtools): chatDebugLogging.ts queries are staged in PR 7;
// they are consumed by the Debug settings UI in PR 8. Remove this
// exclusion once the settings page lands.
"src/api/queries/chatDebugLogging.ts"
],
"ignoreBinaries": ["protoc"],
"ignoreDependencies": [
"@babel/plugin-syntax-typescript",
"@types/react-virtualized-auto-sizer",
"ts-proto"
]
}