Download desktop/src/api/diagnostics.ts from chenbhao/codev: direct link, hf CLI and curl.
- Browser
- Download file 1.41 kB
-
https://huggingface.co/chenbhao/codev/resolve/e40073cc959cd4729bf4009662bca374c5c4e266/desktop/src/api/diagnostics.ts
- Command line
-
hf download hf://chenbhao/codev@e40073cc959cd4729bf4009662bca374c5c4e266/desktop/src/api/diagnostics.ts
-
curl -L -o diagnostics.ts https://huggingface.co/chenbhao/codev/resolve/e40073cc959cd4729bf4009662bca374c5c4e266/desktop/src/api/diagnostics.ts
1.41 kB
| import { api } from './client' | |
| export type DiagnosticSeverity = 'debug' | 'info' | 'warn' | 'error' | |
| export type DiagnosticEvent = { | |
| id: string | |
| timestamp: string | |
| type: string | |
| severity: DiagnosticSeverity | |
| summary: string | |
| sessionId?: string | |
| details?: unknown | |
| } | |
| export type DiagnosticEventInput = { | |
| type: string | |
| severity?: DiagnosticSeverity | |
| summary: string | |
| sessionId?: string | |
| details?: unknown | |
| } | |
| export type DiagnosticsStatus = { | |
| logDir: string | |
| diagnosticsPath: string | |
| cliDiagnosticsPath: string | |
| runtimeErrorsPath: string | |
| exportDir: string | |
| retentionDays: number | |
| maxBytes: number | |
| totalBytes: number | |
| eventCount: number | |
| recentErrorCount: number | |
| lastEventAt: string | null | |
| } | |
| export type DiagnosticsBundle = { | |
| path: string | |
| fileName: string | |
| bytes: number | |
| } | |
| export const diagnosticsApi = { | |
| getStatus: () => api.get<DiagnosticsStatus>('/api/diagnostics/status'), | |
| getEvents: (limit = 100) => api.get<{ events: DiagnosticEvent[] }>(`/api/diagnostics/events?limit=${limit}`), | |
| recordEvent: (event: DiagnosticEventInput) => api.post<{ ok: true }>('/api/diagnostics/events', event, { timeout: 5_000 }), | |
| exportBundle: () => api.post<{ bundle: DiagnosticsBundle }>('/api/diagnostics/export', undefined, { timeout: 60_000 }), | |
| openLogDir: () => api.post<{ ok: true }>('/api/diagnostics/open-log-dir'), | |
| clear: () => api.delete<{ ok: true }>('/api/diagnostics'), | |
| } | |