From 925d3ab660017d4f7147473a5c0137aabfc6a210 Mon Sep 17 00:00:00 2001 From: QQ Date: Sat, 14 Nov 2026 14:52:16 +0800 Subject: [PATCH] Import packages/plugin/src/bin/doctor.ts --- packages/plugin/src/bin/doctor.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 packages/plugin/src/bin/doctor.ts diff --git a/packages/plugin/src/bin/doctor.ts b/packages/plugin/src/bin/doctor.ts new file mode 100644 index 0000000..cb11a7d --- /dev/null +++ b/packages/plugin/src/bin/doctor.ts @@ -0,0 +1,14 @@ +import type { HostPluginRuntime } from '../service.js' + +export function doctor(runtime: HostPluginRuntime): string { + const state = runtime.diagnostics() + return [ + 'DSH Remote doctor', + `Plugin: ${state.loaded ? 'loaded' : 'starting'}`, + `Identity: ${state.identityValid ? `valid (${state.deviceId})` : 'unavailable'}`, + `Server: ${state.serverConfigured ? state.serverOnline ? 'online' : 'configured, offline' : 'not configured'}`, + ...(state.serverError === undefined ? [] : [`Server error: ${state.serverError}`]), + `Peer channel: ${state.online ? 'online' : 'offline'}`, + `Trusted devices: ${state.trustedPeers}`, + ].join('\n') +}