fix(regression): restore msteams cold-runtime chunking

This commit is contained in:
Tak Hoffman
2026-03-27 21:21:32 -05:00
parent 3b9eb2cd1b
commit e57342c7f2
4 changed files with 14 additions and 13 deletions

View File

@@ -23,6 +23,7 @@ import { createComputedAccountStatusAdapter } from "openclaw/plugin-sdk/status-h
import type { ChannelMessageActionName, ChannelPlugin, OpenClawConfig } from "../runtime-api.js";
import {
buildProbeChannelStatusSummary,
chunkTextForOutbound,
createDefaultChannelRuntimeState,
DEFAULT_ACCOUNT_ID,
PAIRING_APPROVED_MESSAGE,
@@ -934,7 +935,7 @@ export const msteamsPlugin: ChannelPlugin<ResolvedMSTeamsAccount, ProbeMSTeamsRe
},
outbound: {
deliveryMode: "direct",
chunker: (text, limit) => getMSTeamsRuntime().channel.text.chunkMarkdownText(text, limit),
chunker: chunkTextForOutbound,
chunkerMode: "markdown",
textChunkLimit: 4000,
pollMaxOptions: 12,

View File

@@ -18,16 +18,6 @@ vi.mock("./polls.js", () => ({
}),
}));
vi.mock("./runtime.js", () => ({
getMSTeamsRuntime: () => ({
channel: {
text: {
chunkMarkdownText: (text: string) => [text],
},
},
}),
}));
import { msteamsOutbound } from "./outbound.js";
describe("msteamsOutbound cfg threading", () => {
@@ -128,4 +118,13 @@ describe("msteamsOutbound cfg threading", () => {
}),
);
});
it("chunks outbound text without requiring MSTeams runtime initialization", () => {
const chunker = msteamsOutbound.chunker;
if (!chunker) {
throw new Error("msteams outbound.chunker unavailable");
}
expect(chunker("alpha beta", 5)).toEqual(["alpha", "beta"]);
});
});

View File

@@ -1,13 +1,13 @@
import { createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result";
import { resolveOutboundSendDep } from "openclaw/plugin-sdk/outbound-runtime";
import type { ChannelOutboundAdapter } from "../runtime-api.js";
import { chunkTextForOutbound } from "../runtime-api.js";
import { createMSTeamsPollStoreFs } from "./polls.js";
import { getMSTeamsRuntime } from "./runtime.js";
import { sendMessageMSTeams, sendPollMSTeams } from "./send.js";
export const msteamsOutbound: ChannelOutboundAdapter = {
deliveryMode: "direct",
chunker: (text, limit) => getMSTeamsRuntime().channel.text.chunkMarkdownText(text, limit),
chunker: chunkTextForOutbound,
chunkerMode: "markdown",
textChunkLimit: 4000,
pollMaxOptions: 12,

View File

@@ -44,6 +44,7 @@ export {
} from "../channels/plugins/setup-wizard-helpers.js";
export { PAIRING_APPROVED_MESSAGE } from "../channels/plugins/pairing-message.js";
export { resolveOutboundMediaUrls, resolveSendableOutboundReplyParts } from "./reply-payload.js";
export { chunkTextForOutbound } from "./text-chunking.js";
export type {
BaseProbeResult,
ChannelDirectoryEntry,