perf(slack): narrow send chunking imports

This commit is contained in:
Vincent Koc 2026-03-31 21:55:59 +09:00
parent 4ea1ca4849
commit 675b80c4a4
5 changed files with 15 additions and 8 deletions

View File

@ -2,13 +2,13 @@ import { type Block, type KnownBlock, type WebClient } from "@slack/web-api";
import { loadConfig, type OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/config-runtime";
import { withTrustedEnvProxyGuardedFetchMode } from "openclaw/plugin-sdk/fetch-runtime";
import { resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
import {
chunkMarkdownTextWithMode,
isSilentReplyText,
resolveChunkMode,
resolveTextChunkLimit,
} from "openclaw/plugin-sdk/reply-runtime";
import { isSilentReplyText } from "openclaw/plugin-sdk/reply-runtime";
} from "openclaw/plugin-sdk/reply-chunking";
import { resolveTextChunksWithFallback } from "openclaw/plugin-sdk/reply-payload";
import { logVerbose } from "openclaw/plugin-sdk/runtime-env";
import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/ssrf-runtime";
import { loadWebMedia } from "openclaw/plugin-sdk/web-media";

View File

@ -33,6 +33,7 @@ vi.mock("openclaw/plugin-sdk/web-media", () => ({
let sendMessageSlack: typeof import("./send.js").sendMessageSlack;
let clearSlackDmChannelCache: typeof import("./send.js").clearSlackDmChannelCache;
({ sendMessageSlack, clearSlackDmChannelCache } = await import("./send.js"));
type UploadTestClient = WebClient & {
conversations: { open: ReturnType<typeof vi.fn> };
@ -65,11 +66,6 @@ function createUploadTestClient(): UploadTestClient {
describe("sendMessageSlack file upload with user IDs", () => {
const originalFetch = globalThis.fetch;
beforeAll(async () => {
vi.resetModules();
({ sendMessageSlack, clearSlackDmChannelCache } = await import("./send.js"));
});
beforeEach(() => {
globalThis.fetch = vi.fn(
async () => new Response("ok", { status: 200 }),

View File

@ -101,6 +101,10 @@
"types": "./dist/plugin-sdk/reply-runtime.d.ts",
"default": "./dist/plugin-sdk/reply-runtime.js"
},
"./plugin-sdk/reply-chunking": {
"types": "./dist/plugin-sdk/reply-chunking.d.ts",
"default": "./dist/plugin-sdk/reply-chunking.js"
},
"./plugin-sdk/reply-payload": {
"types": "./dist/plugin-sdk/reply-payload.d.ts",
"default": "./dist/plugin-sdk/reply-payload.js"

View File

@ -15,6 +15,7 @@
"approval-runtime",
"config-runtime",
"reply-runtime",
"reply-chunking",
"reply-payload",
"channel-reply-pipeline",
"channel-runtime",

View File

@ -0,0 +1,6 @@
export {
chunkMarkdownTextWithMode,
resolveChunkMode,
resolveTextChunkLimit,
} from "../auto-reply/chunk.js";
export { isSilentReplyText } from "../auto-reply/tokens.js";