mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-23 07:01:40 +00:00
fix(regression): restore matrix cold-runtime chunking
This commit is contained in:
@@ -34,3 +34,4 @@ export type {
|
||||
WizardPrompter,
|
||||
} from "openclaw/plugin-sdk/matrix";
|
||||
export { formatZonedTimestamp } from "openclaw/plugin-sdk/matrix";
|
||||
export { chunkTextForOutbound } from "openclaw/plugin-sdk/matrix";
|
||||
|
||||
@@ -49,6 +49,7 @@ import {
|
||||
import {
|
||||
buildChannelConfigSchema,
|
||||
buildProbeChannelStatusSummary,
|
||||
chunkTextForOutbound,
|
||||
collectStatusIssuesFromLastError,
|
||||
DEFAULT_ACCOUNT_ID,
|
||||
PAIRING_APPROVED_MESSAGE,
|
||||
@@ -454,7 +455,7 @@ export const matrixPlugin: ChannelPlugin<ResolvedMatrixAccount, MatrixProbe> =
|
||||
},
|
||||
outbound: {
|
||||
deliveryMode: "direct",
|
||||
chunker: (text, limit) => getMatrixRuntime().channel.text.chunkMarkdownText!(text, limit),
|
||||
chunker: chunkTextForOutbound,
|
||||
chunkerMode: "markdown",
|
||||
textChunkLimit: 4000,
|
||||
...createRuntimeOutboundDelegates({
|
||||
|
||||
@@ -31,6 +31,16 @@ describe("matrixOutbound cfg threading", () => {
|
||||
mocks.sendPollMatrix.mockResolvedValue({ eventId: "$poll", roomId: "!room:example" });
|
||||
});
|
||||
|
||||
it("chunks outbound text without requiring Matrix runtime initialization", () => {
|
||||
const chunker = matrixOutbound.chunker;
|
||||
if (!chunker) {
|
||||
throw new Error("matrixOutbound.chunker missing");
|
||||
}
|
||||
|
||||
expect(() => chunker("hello world", 5)).not.toThrow();
|
||||
expect(chunker("hello world", 5)).toEqual(["hello", "world"]);
|
||||
});
|
||||
|
||||
it("passes resolved cfg to sendMessageMatrix for text sends", async () => {
|
||||
const cfg = {
|
||||
channels: {
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
import { sendMessageMatrix, sendPollMatrix } from "./matrix/send.js";
|
||||
import { resolveOutboundSendDep, type ChannelOutboundAdapter } from "./runtime-api.js";
|
||||
import {
|
||||
chunkTextForOutbound,
|
||||
resolveOutboundSendDep,
|
||||
type ChannelOutboundAdapter,
|
||||
} from "./runtime-api.js";
|
||||
import { getMatrixRuntime } from "./runtime.js";
|
||||
|
||||
export const matrixOutbound: ChannelOutboundAdapter = {
|
||||
deliveryMode: "direct",
|
||||
chunker: (text, limit) => getMatrixRuntime().channel.text.chunkMarkdownText(text, limit),
|
||||
chunker: chunkTextForOutbound,
|
||||
chunkerMode: "markdown",
|
||||
textChunkLimit: 4000,
|
||||
sendText: async ({ cfg, to, text, deps, replyToId, threadId, accountId, audioAsVoice }) => {
|
||||
|
||||
@@ -45,6 +45,7 @@ export {
|
||||
} from "../channels/plugins/config-helpers.js";
|
||||
export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js";
|
||||
export { formatPairingApproveHint } from "../channels/plugins/helpers.js";
|
||||
export { chunkTextForOutbound } from "./text-chunking.js";
|
||||
export {
|
||||
buildSingleChannelSecretPromptState,
|
||||
addWildcardAllowFrom,
|
||||
|
||||
Reference in New Issue
Block a user