fix(regression): restore googlechat cold-runtime chunking

This commit is contained in:
Tak Hoffman
2026-03-27 21:25:15 -05:00
parent 70a0ce2179
commit 18fe752c48
3 changed files with 12 additions and 1 deletions

View File

@@ -102,6 +102,15 @@ function setupRuntimeMediaMocks(params: { loadFileName: string; loadBytes: strin
}
describe("googlechatPlugin outbound sendMedia", () => {
it("chunks outbound text without requiring Google Chat runtime initialization", () => {
const chunker = googlechatPlugin.outbound?.chunker;
if (!chunker) {
throw new Error("Expected googlechatPlugin.outbound.chunker to be defined");
}
expect(chunker("alpha beta", 5)).toEqual(["alpha", "beta"]);
});
it("loads local media with mediaLocalRoots via runtime media loader", async () => {
const { loadWebMedia, fetchRemoteMedia } = setupRuntimeMediaMocks({
loadFileName: "image.png",

View File

@@ -24,6 +24,7 @@ import {
} from "openclaw/plugin-sdk/status-helpers";
import {
buildChannelConfigSchema,
chunkTextForOutbound,
DEFAULT_ACCOUNT_ID,
createAccountStatusSink,
getChatChannelMeta,
@@ -349,7 +350,7 @@ export const googlechatPlugin = createChatChannelPlugin({
outbound: {
base: {
deliveryMode: "direct",
chunker: (text, limit) => getGoogleChatRuntime().channel.text.chunkMarkdownText(text, limit),
chunker: chunkTextForOutbound,
chunkerMode: "markdown",
textChunkLimit: 4000,
resolveTarget: ({ to }) => {

View File

@@ -27,6 +27,7 @@ export { formatPairingApproveHint } from "../channels/plugins/helpers.js";
export { fetchRemoteMedia } from "../media/fetch.js";
export { resolveChannelMediaMaxBytes } from "../channels/plugins/media-limits.js";
export { loadWebMedia } from "./web-media.js";
export { chunkTextForOutbound } from "./text-chunking.js";
export {
addWildcardAllowFrom,
mergeAllowFromEntries,