openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
23 lines (22 loc) • 1.41 kB
JavaScript
import { a as toAcpRuntimeError } from "./errors-DGA2X_Nu.mjs";
//#region packages/acp-core/src/runtime/error-text.ts
const ACP_RUNTIME_ERROR_NEXT_STEPS = {
ACP_BACKEND_MISSING: "Run `/acp doctor`, install/enable the backend plugin, then retry.",
ACP_BACKEND_UNAVAILABLE: "Run `/acp doctor`, install/enable the backend plugin, then retry.",
ACP_DISPATCH_DISABLED: "Enable `acp.dispatch.enabled=true` to allow thread-message ACP turns.",
ACP_SESSION_INIT_FAILED: "If this session is stale, recreate it with `/acp spawn` and rebind the thread.",
ACP_INVALID_RUNTIME_OPTION: "Use `/acp status` to inspect options and pass valid values.",
ACP_BACKEND_UNSUPPORTED_CONTROL: "This backend does not support that control; use a supported command.",
ACP_TURN_FAILED: "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(e) {
const t = Object.hasOwn(ACP_RUNTIME_ERROR_NEXT_STEPS, e.code) ? ACP_RUNTIME_ERROR_NEXT_STEPS[e.code] : void 0;
return `ACP error (${e.code}): ${e.message}${t ? `\nnext: ${t}` : ""}`;
}
/** Normalizes unknown failures into ACP runtime error text for user-facing surfaces. */
function toAcpRuntimeErrorText(e) {
return formatAcpRuntimeErrorText(toAcpRuntimeError(e));
}
//#endregion
export { toAcpRuntimeErrorText as n, formatAcpRuntimeErrorText as t };