/** Local network diagnostics (runs on the desktop, not over SSH). */ import { call, subscribe } from "../transport"; import type { Payload, Result } from "../types"; export type ExportFormat = "json" | "csv" | "txt"; export const diagnostics = Object.freeze({ resolve: (options: Payload) => call>("core_diagnostics_resolve", "diagnostics:resolve", options), start: (options: Payload) => call>("core_diagnostics_start", "diagnostics:start", options), cancel: (id: string, tool?: string) => call>("core_diagnostics_cancel", "diagnostics:cancel", { id, tool }), get: (id: string) => call>("core_diagnostics_get", "diagnostics:get", { id }), history: () => call>("core_diagnostics_history", "diagnostics:history"), removeHistory: (id?: string) => call>("core_diagnostics_remove_history", "diagnostics:removeHistory", { id }), export: (id: string, format: ExportFormat) => call>("core_diagnostics_export", "diagnostics:export", { id, format }), copy: (id: string, format: ExportFormat = "txt") => call>("core_diagnostics_copy", "diagnostics:copy", { id, format }), import: () => call>("core_diagnostics_import", "diagnostics:import"), onProgress: (callback: (event: Payload) => void) => subscribe("diagnostics:progress", callback) });