mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-01 16:00:22 +00:00
fix(regression): restore msteams cold-runtime chunking
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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"]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user