openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
51 lines (50 loc) • 1.82 kB
JavaScript
import { B as isRecord, a as defineChannelAliasMigration, k as normalizeChannelConfigEntries } from "./runtime-doctor-migrations-JGL9tD-z.js";
import "./string-coerce-runtime-DkwxSzQP.js";
//#region extensions/imessage/config-doctor-api.ts
function isEnabledCatchup(e) {
return isRecord(e) && e.enabled === true;
}
function imessageEntryHasRetiredCatchup(e) {
if (!isRecord(e)) return false;
if (Object.hasOwn(e, "catchup") && !isEnabledCatchup(e.catchup)) return true;
const t = e.accounts;
if (!isRecord(t)) return false;
return Object.values(t).some((e) => isRecord(e) && Object.hasOwn(e, "catchup") && !isEnabledCatchup(e.catchup));
}
const streamingAliasMigration = defineChannelAliasMigration({
channelId: "imessage",
streaming: {
defaultMode: "partial",
deliveryOnly: true
}
});
const legacyConfigRules = [{
path: ["channels", "imessage"],
message: "disabled channels.imessage.catchup config is retired; iMessage now recovers via always-on inbound dedupe and a stale-backlog age fence. Run \"openclaw doctor --fix\" to remove disabled catchup blocks.",
match: (e) => imessageEntryHasRetiredCatchup(e)
}, ...streamingAliasMigration.legacyConfigRules];
function normalizeCompatibilityConfig({ cfg: e }) {
const t = normalizeChannelConfigEntries({
cfg: e,
channelId: "imessage",
normalizeEntry: ({ entry: e, pathPrefix: t, changes: n }) => {
if (!Object.hasOwn(e, "catchup") || isEnabledCatchup(e.catchup)) return {
entry: e,
changed: false
};
const r = { ...e };
delete r.catchup;
n.push(`Removed disabled retired ${t}.catchup.`);
return {
entry: r,
changed: true
};
}
});
return streamingAliasMigration.normalizeChannelConfig({
cfg: t.config,
changes: t.changes
});
}
//#endregion
export { legacyConfigRules, normalizeCompatibilityConfig };