openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
23 lines (22 loc) • 1.16 kB
JavaScript
import { l as isRecord } from "./record-coerce-CVPuDqcc.mjs";
//#region src/channels/turn/agent-run-terminal-outcome.ts
const AGENT_RUN_TERMINAL_OUTCOME = Symbol.for("openclaw.agentRunTerminalOutcome");
const AGENT_RUN_TERMINAL_ERROR = Symbol.for("openclaw.agentRunTerminalError");
function recordAgentRunTerminalOutcome(e, t, n) {
return Object.assign(e, {
[AGENT_RUN_TERMINAL_OUTCOME]: t,
[AGENT_RUN_TERMINAL_ERROR]: t === "failed" ? n : void 0
});
}
function readAgentRunTerminalOutcome(e) {
const t = isRecord(e) && Object.hasOwn(e, AGENT_RUN_TERMINAL_OUTCOME) ? Reflect.get(e, AGENT_RUN_TERMINAL_OUTCOME) : void 0;
return t === "completed" || t === "failed" ? t : void 0;
}
/** Carries the producer's final diagnostic without changing the JSON response. */
function readAgentRunTerminalError(e) {
if (!isRecord(e) || readAgentRunTerminalOutcome(e) !== "failed" || !Object.hasOwn(e, AGENT_RUN_TERMINAL_ERROR)) return;
const t = Reflect.get(e, AGENT_RUN_TERMINAL_ERROR);
return typeof t === "string" ? t : void 0;
}
//#endregion
export { readAgentRunTerminalOutcome as n, recordAgentRunTerminalOutcome as r, readAgentRunTerminalError as t };