fix(regression): restore feishu cold-runtime chunking

This commit is contained in:
Tak Hoffman
2026-03-27 21:17:08 -05:00
parent 5426bdf391
commit c0c32445ab
4 changed files with 15 additions and 3 deletions

View File

@@ -26,6 +26,7 @@ import type { ChannelMeta, ChannelPlugin, ClawdbotConfig } from "../runtime-api.
import {
buildChannelConfigSchema,
buildProbeChannelStatusSummary,
chunkTextForOutbound,
createActionGate,
createDefaultChannelRuntimeState,
DEFAULT_ACCOUNT_ID,
@@ -1053,7 +1054,7 @@ export const feishuPlugin: ChannelPlugin<ResolvedFeishuAccount, FeishuProbeResul
},
outbound: {
deliveryMode: "direct",
chunker: (text, limit) => getFeishuRuntime().channel.text.chunkMarkdownText(text, limit),
chunker: chunkTextForOutbound,
chunkerMode: "markdown",
textChunkLimit: 4000,
...createRuntimeOutboundDelegates({

View File

@@ -53,6 +53,16 @@ describe("feishuOutbound.sendText local-image auto-convert", () => {
resetOutboundMocks();
});
it("chunks outbound text without requiring Feishu runtime initialization", () => {
const chunker = feishuOutbound.chunker;
if (!chunker) {
throw new Error("feishuOutbound.chunker missing");
}
expect(() => chunker("hello world", 5)).not.toThrow();
expect(chunker("hello world", 5)).toEqual(["hello", "world"]);
});
async function createTmpImage(ext = ".png"): Promise<{ dir: string; file: string }> {
const dir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-feishu-outbound-"));
const file = path.join(dir, `sample${ext}`);

View File

@@ -1,7 +1,7 @@
import fs from "fs";
import path from "path";
import { createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result";
import type { ChannelOutboundAdapter } from "../runtime-api.js";
import { chunkTextForOutbound, type ChannelOutboundAdapter } from "../runtime-api.js";
import { resolveFeishuAccount } from "./accounts.js";
import { sendMediaFeishu } from "./media.js";
import { getFeishuRuntime } from "./runtime.js";
@@ -79,7 +79,7 @@ async function sendOutboundText(params: {
export const feishuOutbound: ChannelOutboundAdapter = {
deliveryMode: "direct",
chunker: (text, limit) => getFeishuRuntime().channel.text.chunkMarkdownText(text, limit),
chunker: chunkTextForOutbound,
chunkerMode: "markdown",
textChunkLimit: 4000,
...createAttachedChannelResultAdapter({

View File

@@ -13,6 +13,7 @@ export { logTypingFailure } from "../channels/logging.js";
export type { AllowlistMatch } from "../channels/plugins/allowlist-match.js";
export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js";
export { createActionGate } from "../agents/tools/common.js";
export { chunkTextForOutbound } from "./text-chunking.js";
export {
buildSingleChannelSecretPromptState,
addWildcardAllowFrom,