UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

22 lines (21 loc) • 1.5 kB
import { a as toAcpRuntimeError } from "./errors-1GV1HisX.mjs"; //#region packages/acp-core/src/runtime/error-text.ts function resolveAcpRuntimeErrorNextStep(error) { if (error.code === "ACP_BACKEND_MISSING" || error.code === "ACP_BACKEND_UNAVAILABLE") return "Run `/acp doctor`, install/enable the backend plugin, then retry."; if (error.code === "ACP_DISPATCH_DISABLED") return "Enable `acp.dispatch.enabled=true` to allow thread-message ACP turns."; if (error.code === "ACP_SESSION_INIT_FAILED") return "If this session is stale, recreate it with `/acp spawn` and rebind the thread."; if (error.code === "ACP_INVALID_RUNTIME_OPTION") return "Use `/acp status` to inspect options and pass valid values."; if (error.code === "ACP_BACKEND_UNSUPPORTED_CONTROL") return "This backend does not support that control; use a supported command."; if (error.code === "ACP_TURN_FAILED") return "Retry, or use `/acp cancel` and send the message again."; } /** Formats ACP runtime errors with the operator next-step hint attached when known. */ function formatAcpRuntimeErrorText(error) { const next = resolveAcpRuntimeErrorNextStep(error); return `ACP error (${error.code}): ${error.message}${next ? `\nnext: ${next}` : ""}`; } /** Normalizes unknown failures into ACP runtime error text for user-facing surfaces. */ function toAcpRuntimeErrorText(params) { return formatAcpRuntimeErrorText(toAcpRuntimeError(params)); } //#endregion export { toAcpRuntimeErrorText as n, formatAcpRuntimeErrorText as t };