UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

20 lines (19 loc) 890 B
//#region src/plugins/host-hooks.ts function normalizePluginHostHookId(value) { return (value ?? "").trim(); } function normalizeQueuedInjectionText(entry, placement) { const candidate = entry; if (candidate.placement !== placement || typeof candidate.text !== "string") return; return candidate.text.trim() || void 0; } function buildPluginAgentTurnPrepareContext(params) { const prepend = params.queuedInjections.map((entry) => normalizeQueuedInjectionText(entry, "prepend_context")).filter(Boolean); const append = params.queuedInjections.map((entry) => normalizeQueuedInjectionText(entry, "append_context")).filter(Boolean); return { ...prepend.length > 0 ? { prependContext: prepend.join("\n\n") } : {}, ...append.length > 0 ? { appendContext: append.join("\n\n") } : {} }; } //#endregion export { normalizePluginHostHookId as n, buildPluginAgentTurnPrepareContext as t };