@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
19 lines • 1.07 kB
JavaScript
import { redactResolvedReferenceValues } from "../../../config-reference-redaction.js";
export function buildMcpServerSnapshot(name, server, connection, entry, now = Date.now()) {
return {
name,
configState: server?.state ?? "removed",
configHash: entry?.generationHash ?? server?.configHash ?? null,
source: server?.source ?? null,
sourcePath: server?.sourcePath ?? null,
lifecycleState: connection?.state === "idle" && connection.generation === 0 && entry?.cachedCatalog !== undefined
? "cached"
: (connection?.state ?? "not_spawned"),
generation: connection?.generation ?? null,
pid: connection?.getRootPid() ?? null,
lastError: connection?.lastError === undefined ? null : redactResolvedReferenceValues(connection.lastError.message),
uptimeMs: entry === undefined ? null : now - entry.createdAtMs,
counters: entry?.counters ?? { callCount: 0, errorCount: 0, totalLatencyMs: 0, reconnectCount: 0 },
};
}
//# sourceMappingURL=service-snapshot.js.map