fix(regression): restore irc cold-runtime chunking

This commit is contained in:
Tak Hoffman
2026-03-27 22:24:18 -05:00
parent 71795c5323
commit 83adbc840c
4 changed files with 24 additions and 1 deletions

View File

@@ -0,0 +1,18 @@
import { afterEach, describe, expect, it } from "vitest";
import { ircPlugin } from "./channel.js";
import { clearIrcRuntime } from "./runtime.js";
describe("irc outbound chunking", () => {
afterEach(() => {
clearIrcRuntime();
});
it("chunks outbound text without requiring IRC runtime initialization", () => {
const chunker = ircPlugin.outbound?.chunker;
if (!chunker) {
throw new Error("irc outbound.chunker unavailable");
}
expect(chunker("alpha beta", 5)).toEqual(["alpha", "beta"]);
});
});

View File

@@ -16,6 +16,7 @@ import {
createResolvedDirectoryEntriesLister,
} from "openclaw/plugin-sdk/directory-runtime";
import { runStoppablePassiveMonitor } from "openclaw/plugin-sdk/extension-shared";
import { chunkTextForOutbound } from "openclaw/plugin-sdk/irc";
import {
createComputedAccountStatusAdapter,
createDefaultChannelRuntimeState,
@@ -333,7 +334,7 @@ export const ircPlugin: ChannelPlugin<ResolvedIrcAccount, IrcProbe> = createChat
outbound: {
base: {
deliveryMode: "direct",
chunker: (text, limit) => getIrcRuntime().channel.text.chunkMarkdownText(text, limit),
chunker: chunkTextForOutbound,
chunkerMode: "markdown",
textChunkLimit: 350,
},

View File

@@ -4,3 +4,6 @@ import type { PluginRuntime } from "./runtime-api.js";
const { setRuntime: setIrcRuntime, getRuntime: getIrcRuntime } =
createPluginRuntimeStore<PluginRuntime>("IRC runtime not initialized");
export { getIrcRuntime, setIrcRuntime };
export function clearIrcRuntime() {
setIrcRuntime(undefined as unknown as PluginRuntime);
}

View File

@@ -24,6 +24,7 @@ export type { BaseProbeResult } from "../channels/plugins/types.js";
export type { ChannelPlugin } from "../channels/plugins/types.plugin.js";
export { getChatChannelMeta } from "../channels/registry.js";
export { createChannelReplyPipeline } from "./channel-reply-pipeline.js";
export { chunkTextForOutbound } from "./text-chunking.js";
export type { OpenClawConfig } from "../config/config.js";
export { isDangerousNameMatchingEnabled } from "../config/dangerous-name-matching.js";
export {