UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

57 lines (56 loc) 2.13 kB
import { t as formatErrorMessage } from "./errors-Db3Ymjlb.js"; import { r as logVerbose } from "./globals-CTaGxEqj.js"; import { n as logError } from "./logger-DwECwNVZ.js"; import { c as requireCommandFlagEnabled } from "./command-gates-B4tlStPI.js"; import { i as formatDetailedPluginHealth } from "./status-plugin-health-CZ5gc9MV.js"; import { t as buildStatusReplyParts } from "./status-text-D0n6Qkik.js"; //#region src/auto-reply/reply/commands-status.ts /** Builds /status replies using the command's authorized channel context. */ /** Builds a status reply or suppresses unauthorized status requests. */ async function buildStatusReply(params) { const { command } = params; if (!command.isAuthorizedSender) { logVerbose(`Ignoring /status from unauthorized sender: ${command.senderId || "<unknown>"}`); return; } try { const { text, presentation } = await buildStatusReplyParts({ ...params, statusChannel: command.channel, statusAccountId: command.accountId }); return { text, presentation, presentationTextMode: "fallback" }; } catch (error) { logError(`/status render failed: ${formatErrorMessage(error)}`); return { text: "⚠️ Status: error rendering response" }; } } async function buildStatusPluginsReply(params) { const { command } = params; if (!command.isAuthorizedSender) { logVerbose(`Ignoring /status plugins from unauthorized sender: ${command.senderId || "<unknown>"}`); return; } const disabled = requireCommandFlagEnabled(params.cfg, { label: "/status plugins", configKey: "plugins" }); if (disabled) return disabled.reply; try { const { collectInstalledPluginHealthSnapshot } = await import("./status-plugin-health.runtime.js"); const snapshot = await collectInstalledPluginHealthSnapshot({ config: params.cfg, workspaceDir: params.workspaceDir }); return { text: formatDetailedPluginHealth(snapshot) }; } catch (error) { logError(`/status plugins render failed: ${formatErrorMessage(error)}`); return { text: "⚠️ Plugins: health unavailable" }; } } //#endregion export { buildStatusReply as n, buildStatusPluginsReply as t };