openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
28 lines (27 loc) • 895 B
JavaScript
import { t as isStringOption } from "./string-readers-e58-jh1A.js";
//#region src/auto-reply/internal-turn-source.ts
function legacyInternalTurnSource(value) {
switch (value) {
case "heartbeat": return "heartbeat";
case "cron-event": return "cron";
case "exec-event": return "exec";
default: return;
}
}
/** Fold shipped SDK source labels at ingress; runtime channels describe transport only. */
function normalizeInternalTurnContext(ctx) {
const source = isStringOption(ctx.InternalTurnSource, [
"heartbeat",
"cron",
"exec"
]) ? ctx.InternalTurnSource : legacyInternalTurnSource(ctx.Provider);
if (source) ctx.InternalTurnSource = source;
else delete ctx.InternalTurnSource;
for (const field of [
"Provider",
"Surface",
"OriginatingChannel"
]) if (legacyInternalTurnSource(ctx[field])) delete ctx[field];
}
//#endregion
export { normalizeInternalTurnContext as t };