UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

20 lines (19 loc) • 976 B
import { C as chunkTextByBreakResolver } from "./text-runtime-DVXt5xhi.js"; //#region src/plugin-sdk/config-paths.ts /** Resolve the config path prefix for a channel account, falling back to the root channel section. */ function resolveChannelAccountConfigBasePath(params) { const accounts = (params.cfg.channels?.[params.channelKey])?.accounts; return Boolean(accounts?.[params.accountId]) ? `channels.${params.channelKey}.accounts.${params.accountId}.` : `channels.${params.channelKey}.`; } //#endregion //#region src/plugin-sdk/text-chunking.ts /** Chunk outbound text while preferring newline boundaries over spaces. */ function chunkTextForOutbound(text, limit) { return chunkTextByBreakResolver(text, limit, (window) => { const lastNewline = window.lastIndexOf("\n"); const lastSpace = window.lastIndexOf(" "); return lastNewline > 0 ? lastNewline : lastSpace; }); } //#endregion export { resolveChannelAccountConfigBasePath as n, chunkTextForOutbound as t };