UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

40 lines • 1.47 kB
export async function buildMcpStatusRows(snapshots, getExposureStatus) { return Promise.all(snapshots.map(async (snapshot) => ({ exposure: await getExposureStatus(snapshot.name), snapshot, }))); } export function formatMcpStatus(title, rows) { return [title, ...rows.map(formatRow)].join("\n"); } function formatRow(row) { const snapshot = row.snapshot; const averageLatencyMs = snapshot.counters.callCount === 0 ? 0 : Math.round(snapshot.counters.totalLatencyMs / snapshot.counters.callCount); return [ snapshot.name, snapshot.configState, `state=${snapshot.lifecycleState}`, `origin=${snapshot.source ?? "n/a"}`, `source=${snapshot.sourcePath ?? "n/a"}`, `tools=${row.exposure.toolCount ?? "?"}`, `uptime=${formatUptime(snapshot.uptimeMs)}`, `calls=${snapshot.counters.callCount}`, `errors=${snapshot.counters.errorCount}`, `latency=${averageLatencyMs}ms`, `reconnects=${snapshot.counters.reconnectCount}`, snapshot.lastError ? `lastError=${snapshot.lastError}` : "", row.exposure.hint ? `hint=${row.exposure.hint}` : "", ] .filter((part) => part.length > 0) .join(" "); } function formatUptime(uptimeMs) { if (uptimeMs === null) return "n/a"; if (uptimeMs < 1000) return "<1s"; return `${Math.round(uptimeMs / 1000)}s`; } //# sourceMappingURL=status.js.map