perf: narrow slack test imports

This commit is contained in:
Peter Steinberger
2026-04-24 03:17:30 +01:00
parent 3aa3551491
commit a59d1bd46d
9 changed files with 26 additions and 12 deletions

View File

@@ -119,6 +119,7 @@ For the plugin authoring guide, see [Plugin SDK overview](/plugins/sdk-overview)
| `plugin-sdk/approval-handler-runtime` | Broader approval handler runtime helpers; prefer the narrower adapter/gateway seams when they are enough |
| `plugin-sdk/approval-native-runtime` | Native approval target + account-binding helpers |
| `plugin-sdk/approval-reply-runtime` | Exec/plugin approval reply payload helpers |
| `plugin-sdk/channel-contract-testing` | Narrow channel contract test helpers without the broad testing barrel |
| `plugin-sdk/command-auth-native` | Native command auth + native session-target helpers |
| `plugin-sdk/command-detection` | Shared command detection helpers |
| `plugin-sdk/command-primitives-runtime` | Lightweight command text predicates for hot channel paths |

View File

@@ -1,5 +1,6 @@
import fs from "node:fs";
import type { App } from "@slack/bolt";
import { expectChannelInboundContextContract as expectInboundContextContract } from "openclaw/plugin-sdk/channel-contract-testing";
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import {
registerSessionBindingAdapter,
@@ -9,7 +10,6 @@ import {
} from "openclaw/plugin-sdk/conversation-runtime";
import { resolveAgentRoute } from "openclaw/plugin-sdk/routing";
import { resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing";
import { expectChannelInboundContextContract as expectInboundContextContract } from "openclaw/plugin-sdk/testing";
import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
import type { ResolvedSlackAccount } from "../../accounts.js";
import type { SlackMessageEvent } from "../../types.js";

View File

@@ -17,6 +17,7 @@ import { resolveControlCommandGate } from "openclaw/plugin-sdk/command-gating";
import { shouldHandleTextCommands } from "openclaw/plugin-sdk/command-surface";
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
import { enqueueSystemEvent } from "openclaw/plugin-sdk/infra-runtime";
import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-dispatch-runtime";
import {
buildPendingHistoryContextFromMap,
recordPendingHistoryEntryIfEnabled,
@@ -50,7 +51,6 @@ import { normalizeSlackChannelType, type SlackMonitorContext } from "../context.
import { recordInboundSession, resolveConversationLabel } from "../conversation.runtime.js";
import { authorizeSlackDirectMessage } from "../dm-auth.js";
import { resolveSlackThreadStarter } from "../media.js";
import { finalizeInboundContext } from "../reply.runtime.js";
import { resolveSlackRoomContextHints } from "../room-context.js";
import { sendMessageSlack } from "../send.runtime.js";
import { resolveSlackMessageContent } from "./prepare-content.js";

View File

@@ -1,20 +1,20 @@
import type { MarkdownTableMode, OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import {
chunkMarkdownTextWithMode,
isSilentReplyText,
SILENT_REPLY_TOKEN,
type ChunkMode,
} from "openclaw/plugin-sdk/reply-chunking";
import {
deliverTextOrMediaReply,
resolveSendableOutboundReplyParts,
type ReplyPayload,
} from "openclaw/plugin-sdk/reply-payload";
import type { ChunkMode } from "openclaw/plugin-sdk/reply-runtime";
import type { ReplyPayload } from "openclaw/plugin-sdk/reply-runtime";
import { createReplyReferencePlanner } from "openclaw/plugin-sdk/reply-reference";
import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env";
import { markdownToSlackMrkdwnChunks } from "../format.js";
import { SLACK_TEXT_LIMIT } from "../limits.js";
import { resolveSlackReplyBlocks } from "../reply-blocks.js";
import {
chunkMarkdownTextWithMode,
createReplyReferencePlanner,
isSilentReplyText,
SILENT_REPLY_TOKEN,
} from "./reply.runtime.js";
import { sendMessageSlack, type SlackSendIdentity } from "./send.runtime.js";
export function readSlackReplyBlocks(payload: ReplyPayload) {

View File

@@ -1,5 +1,5 @@
import { installChannelOutboundPayloadContractSuite } from "openclaw/plugin-sdk/channel-contract-testing";
import type { ReplyPayload } from "openclaw/plugin-sdk/reply-runtime";
import { installChannelOutboundPayloadContractSuite } from "openclaw/plugin-sdk/testing";
import { describe, expect, it } from "vitest";
import { createSlackOutboundPayloadHarness } from "../test-api.js";

View File

@@ -509,6 +509,10 @@
"types": "./dist/plugin-sdk/boolean-param.d.ts",
"default": "./dist/plugin-sdk/boolean-param.js"
},
"./plugin-sdk/channel-contract-testing": {
"types": "./dist/plugin-sdk/channel-contract-testing.d.ts",
"default": "./dist/plugin-sdk/channel-contract-testing.js"
},
"./plugin-sdk/dangerous-name-runtime": {
"types": "./dist/plugin-sdk/dangerous-name-runtime.d.ts",
"default": "./dist/plugin-sdk/dangerous-name-runtime.js"

View File

@@ -113,6 +113,7 @@
"browser-setup-tools",
"browser-support",
"boolean-param",
"channel-contract-testing",
"dangerous-name-runtime",
"command-auth",
"command-auth-native",

View File

@@ -0,0 +1,8 @@
export {
expectChannelInboundContextContract,
primeChannelOutboundSendMock,
} from "../channels/plugins/contracts/test-helpers.js";
export {
installChannelOutboundPayloadContractSuite,
type OutboundPayloadHarnessParams,
} from "../channels/plugins/contracts/outbound-payload-testkit.js";

View File

@@ -6,5 +6,5 @@ export {
resolveTextChunkLimit,
} from "../auto-reply/chunk.js";
export type { ChunkMode } from "../auto-reply/chunk.js";
export { isSilentReplyText } from "../auto-reply/tokens.js";
export { isSilentReplyText, SILENT_REPLY_TOKEN } from "../auto-reply/tokens.js";
export type { ReplyPayload } from "./reply-payload.js";