UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

35 lines (34 loc) 1.38 kB
import { l as normalizeOptionalString } from "./string-coerce-CIXf7egm.js"; import { A as parseRawSessionConversationRef, M as parseThreadSessionSuffix } from "./session-key-BnWWjqNc.js"; import { r as getLoadedChannelPluginForRead } from "./registry-loaded-Bh7xuMJh.js"; //#region src/channels/plugins/session-thread-info-loaded.ts /** * Loaded-plugin session thread info resolver. * * Uses only already loaded channel hooks to resolve thread suffix metadata on hot paths. */ function resolveLoadedSessionConversationThreadInfo(sessionKey) { const raw = parseRawSessionConversationRef(sessionKey); if (!raw) return null; const rawId = raw.rawId.trim(); if (!rawId) return null; const resolved = (getLoadedChannelPluginForRead(raw.channel)?.messaging)?.resolveSessionConversation?.({ kind: raw.kind, rawId }); if (!resolved?.id?.trim()) return null; const id = resolved.id.trim(); const threadId = normalizeOptionalString(resolved.threadId); return { baseSessionKey: threadId ? `${raw.prefix}:${id}` : normalizeOptionalString(sessionKey), threadId }; } /** * Resolves thread suffix metadata using loaded plugin hooks or generic parsing. */ function resolveLoadedSessionThreadInfo(sessionKey) { return resolveLoadedSessionConversationThreadInfo(sessionKey) ?? parseThreadSessionSuffix(sessionKey); } //#endregion export { resolveLoadedSessionThreadInfo as t };