openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
75 lines (74 loc) • 3.19 kB
JavaScript
import { t as warnPluginSdkDeprecation } from "./sdk-deprecation-D5N9acnu.mjs";
import { t as getChannelPlugin } from "./registry-ByqVE5S3.mjs";
//#region src/channels/plugins/conversation-bindings.ts
function warnLegacyBindingMethod(e) {
warnPluginSdkDeprecation({
family: "channel-conversation-bindings",
method: e,
replacement: `${e}Async`
});
}
/**
* @deprecated Use setChannelConversationBindingIdleTimeoutBySessionKeyAsync; final compatibility day: 2026-12-31. Removal in the first January 2027 stable release.
*
* Missing plugin support is a no-op because session commands fan out through
* generic channel helpers while only some channels keep conversation bindings.
*/
function setChannelConversationBindingIdleTimeoutBySessionKey(e) {
warnLegacyBindingMethod("setChannelConversationBindingIdleTimeoutBySessionKey");
const t = getChannelPlugin(e.channelId)?.conversationBindings?.setIdleTimeoutBySessionKey;
if (!t) return [];
return t({
targetSessionKey: e.targetSessionKey,
accountId: e.accountId,
idleTimeoutMs: e.idleTimeoutMs
});
}
/**
* @deprecated Use setChannelConversationBindingMaxAgeBySessionKeyAsync; final compatibility day: 2026-12-31. Removal in the first January 2027 stable release.
*
* Returns the modified binding snapshots so command handlers can report the
* concrete sessions affected by the generic channel command.
*/
function setChannelConversationBindingMaxAgeBySessionKey(e) {
warnLegacyBindingMethod("setChannelConversationBindingMaxAgeBySessionKey");
const t = getChannelPlugin(e.channelId)?.conversationBindings?.setMaxAgeBySessionKey;
if (!t) return [];
return t({
targetSessionKey: e.targetSessionKey,
accountId: e.accountId,
maxAgeMs: e.maxAgeMs
});
}
/** Joins async lifecycle updates, with a synchronous fallback for legacy adapters. */
async function setChannelConversationBindingIdleTimeoutBySessionKeyAsync(e) {
const t = getChannelPlugin(e.channelId)?.conversationBindings;
const n = {
targetSessionKey: e.targetSessionKey,
accountId: e.accountId,
idleTimeoutMs: e.idleTimeoutMs
};
if (t?.setIdleTimeoutBySessionKeyAsync) return await t.setIdleTimeoutBySessionKeyAsync(n);
if (t?.setIdleTimeoutBySessionKey) {
warnLegacyBindingMethod("ChannelConversationBindingSupport.setIdleTimeoutBySessionKey");
return t.setIdleTimeoutBySessionKey(n);
}
return [];
}
/** Joins async lifecycle updates, with a synchronous fallback for legacy adapters. */
async function setChannelConversationBindingMaxAgeBySessionKeyAsync(e) {
const t = getChannelPlugin(e.channelId)?.conversationBindings;
const n = {
targetSessionKey: e.targetSessionKey,
accountId: e.accountId,
maxAgeMs: e.maxAgeMs
};
if (t?.setMaxAgeBySessionKeyAsync) return await t.setMaxAgeBySessionKeyAsync(n);
if (t?.setMaxAgeBySessionKey) {
warnLegacyBindingMethod("ChannelConversationBindingSupport.setMaxAgeBySessionKey");
return t.setMaxAgeBySessionKey(n);
}
return [];
}
//#endregion
export { setChannelConversationBindingMaxAgeBySessionKeyAsync as i, setChannelConversationBindingIdleTimeoutBySessionKeyAsync as n, setChannelConversationBindingMaxAgeBySessionKey as r, setChannelConversationBindingIdleTimeoutBySessionKey as t };