UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

53 lines (52 loc) • 2 kB
import { T as runWithGatewayIndependentRootWorkContinuation } from "./gateway-work-admission-79pid1hQ.mjs"; import { n as emitSessionTitleChanged } from "./session-change-event-DFgDuXAu.mjs"; import { t as formatForLog } from "./ws-log-CbOV6uhk.mjs"; import { i as maybeGenerateDashboardSessionTitle, r as isDashboardSessionTitleCandidate, t as buildDashboardSessionTitleSource } from "./dashboard-session-title-7_gTR3ku.mjs"; //#region src/gateway/server-methods/chat-send-background.ts function scheduleCreatedDashboardSessionTitle(e, t, n, r) { if (!e.isNew || e.entry.incognito || !r) return; scheduleChatDashboardSessionTitle({ admittedSessionId: e.entry.sessionId, agentId: e.agentId, cfg: t, context: n, request: { rawMessage: r, normalizedAttachments: [] }, sessionKey: e.key, storePath: e.storePath }); } function scheduleChatDashboardSessionTitle(e, t) { const n = buildDashboardSessionTitleSource({ message: e.request.rawMessage, attachments: e.request.normalizedAttachments }); if (!isDashboardSessionTitleCandidate({ sessionKey: e.sessionKey, userMessage: n })) return; runWithGatewayIndependentRootWorkContinuation(async () => { await maybeGenerateDashboardSessionTitle({ cfg: e.cfg, agentId: e.agentId, sessionId: e.admittedSessionId, sessionKey: e.sessionKey, storePath: e.storePath, currentUserMessage: e.request.rawMessage, userMessage: n, ...t ? { retryAfter: t } : {}, onFallback: () => e.context.logGateway.warn("dashboard session title generation exhausted; using a crustacean fallback name"), onTitleStateChanged: () => emitSessionTitleChanged(e.context, { sessionKey: e.sessionKey, sessionId: e.admittedSessionId, agentId: e.agentId }) }); }, "chat-send:background").catch((t) => { e.context.logGateway.warn(`dashboard session title generation failed: ${formatForLog(t)}`); }); } //#endregion export { scheduleCreatedDashboardSessionTitle as n, scheduleChatDashboardSessionTitle as t };