UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

38 lines (37 loc) 1.47 kB
import { c as normalizeOptionalString } from "./string-coerce-mnp54Vah.js"; import { h as stringifyRouteThreadId } from "./channel-route-D7X5briz.js"; //#region src/gateway/server-methods/restart-request.ts function parseRestartDeliveryContext(params) { const raw = params.deliveryContext; if (!raw || typeof raw !== "object" || Array.isArray(raw)) return { deliveryContext: void 0, threadId: void 0 }; const context = raw; const deliveryContext = { channel: normalizeOptionalString(context.channel), to: normalizeOptionalString(context.to), accountId: normalizeOptionalString(context.accountId) }; return { deliveryContext: deliveryContext.channel || deliveryContext.to || deliveryContext.accountId ? deliveryContext : void 0, threadId: stringifyRouteThreadId(context.threadId) }; } function parseRestartRequestParams(params) { const sessionKey = normalizeOptionalString(params.sessionKey); const { deliveryContext, threadId } = parseRestartDeliveryContext(params); const note = normalizeOptionalString(params.note); const continuationMessage = normalizeOptionalString(params.continuationMessage); const restartDelayMsRaw = params.restartDelayMs; return { sessionKey, deliveryContext, threadId, note, continuationMessage, restartDelayMs: typeof restartDelayMsRaw === "number" && Number.isFinite(restartDelayMsRaw) ? Math.max(0, Math.floor(restartDelayMsRaw)) : void 0 }; } //#endregion export { parseRestartRequestParams as t };