openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
30 lines (29 loc) • 938 B
JavaScript
import { t as isStringOption } from "./string-readers-BtMVaphq.mjs";
//#region src/auto-reply/internal-turn-source.ts
const LEGACY_INTERNAL_TURN_SOURCES = /* @__PURE__ */ new Map([
["heartbeat", "heartbeat"],
["cron-event", "cron"],
["exec-event", "exec"]
]);
function legacyInternalTurnSource(e) {
return e ? LEGACY_INTERNAL_TURN_SOURCES.get(e) : void 0;
}
/** Fold shipped SDK source labels at ingress; runtime channels describe transport only. */
function normalizeInternalTurnContext(e) {
const t = isStringOption(e.InternalTurnSource, [
"heartbeat",
"cron",
"exec",
"event",
"progress-card-refresh"
]) ? e.InternalTurnSource : legacyInternalTurnSource(e.Provider);
if (t) e.InternalTurnSource = t;
else delete e.InternalTurnSource;
for (const t of [
"Provider",
"Surface",
"OriginatingChannel"
]) if (legacyInternalTurnSource(e[t])) delete e[t];
}
//#endregion
export { normalizeInternalTurnContext as t };