UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

61 lines (60 loc) • 2.28 kB
import { t as formatErrorMessage } from "./errors-BKzCeTYb.mjs"; import { k as setReplyPayloadMetadata } from "./reply-payload-k5WsQWxi.mjs"; import { n as logError } from "./logger-CIwfuhOU.mjs"; import { r as logVerbose } from "./globals-CgepmiqE.mjs"; import { l as requireCommandFlagEnabled } from "./command-gates-BZ-IYgiD.mjs"; import { i as formatDetailedPluginHealth } from "./status-plugin-health-CJ4KJVb9.mjs"; import { t as buildStatusReplyParts } from "./status-text-D-bSgwTJ.mjs"; //#region src/auto-reply/reply/commands-status.ts /** Builds /status replies using the command's authorized channel context. */ function markStatusReply(e) { return setReplyPayloadMetadata(e, { contextFreeCommand: true }); } /** Builds a status reply or suppresses unauthorized status requests. */ async function buildStatusReply(e) { const { command: t } = e; if (!t.isAuthorizedSender) { logVerbose(`Ignoring /status from unauthorized sender: ${t.senderId || "<unknown>"}`); return; } try { const { text: n, presentation: r } = await buildStatusReplyParts({ ...e, statusChannel: t.channel, statusAccountId: t.accountId }); return markStatusReply({ text: n, presentation: r, presentationTextMode: "fallback" }); } catch (e) { logError(`/status render failed: ${formatErrorMessage(e)}`); return markStatusReply({ text: "⚠️ Status: error rendering response" }); } } async function buildStatusPluginsReply(e) { const { command: t } = e; if (!t.isAuthorizedSender) { logVerbose(`Ignoring /status plugins from unauthorized sender: ${t.senderId || "<unknown>"}`); return; } const n = requireCommandFlagEnabled(e.cfg, { label: "/status plugins", configKey: "plugins" }); if (n) return n.reply ? markStatusReply(n.reply) : void 0; try { const { collectInstalledPluginHealthSnapshot: t } = await import("./status-plugin-health.runtime.js"); const n = await t({ config: e.cfg, workspaceDir: e.workspaceDir }); return markStatusReply({ text: formatDetailedPluginHealth(n) }); } catch (e) { logError(`/status plugins render failed: ${formatErrorMessage(e)}`); return markStatusReply({ text: "⚠️ Plugins: health unavailable" }); } } //#endregion export { buildStatusReply as n, buildStatusPluginsReply as t };