Skip to content

Commit a59d1bd

Browse files
committed
perf: narrow slack test imports
1 parent 3aa3551 commit a59d1bd

9 files changed

Lines changed: 26 additions & 12 deletions

File tree

docs/plugins/sdk-subpaths.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ For the plugin authoring guide, see [Plugin SDK overview](/plugins/sdk-overview)
119119
| `plugin-sdk/approval-handler-runtime` | Broader approval handler runtime helpers; prefer the narrower adapter/gateway seams when they are enough |
120120
| `plugin-sdk/approval-native-runtime` | Native approval target + account-binding helpers |
121121
| `plugin-sdk/approval-reply-runtime` | Exec/plugin approval reply payload helpers |
122+
| `plugin-sdk/channel-contract-testing` | Narrow channel contract test helpers without the broad testing barrel |
122123
| `plugin-sdk/command-auth-native` | Native command auth + native session-target helpers |
123124
| `plugin-sdk/command-detection` | Shared command detection helpers |
124125
| `plugin-sdk/command-primitives-runtime` | Lightweight command text predicates for hot channel paths |

extensions/slack/src/monitor/message-handler/prepare.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import fs from "node:fs";
22
import type { App } from "@slack/bolt";
3+
import { expectChannelInboundContextContract as expectInboundContextContract } from "openclaw/plugin-sdk/channel-contract-testing";
34
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
45
import {
56
registerSessionBindingAdapter,
@@ -9,7 +10,6 @@ import {
910
} from "openclaw/plugin-sdk/conversation-runtime";
1011
import { resolveAgentRoute } from "openclaw/plugin-sdk/routing";
1112
import { resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing";
12-
import { expectChannelInboundContextContract as expectInboundContextContract } from "openclaw/plugin-sdk/testing";
1313
import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
1414
import type { ResolvedSlackAccount } from "../../accounts.js";
1515
import type { SlackMessageEvent } from "../../types.js";

extensions/slack/src/monitor/message-handler/prepare.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { resolveControlCommandGate } from "openclaw/plugin-sdk/command-gating";
1717
import { shouldHandleTextCommands } from "openclaw/plugin-sdk/command-surface";
1818
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
1919
import { enqueueSystemEvent } from "openclaw/plugin-sdk/infra-runtime";
20+
import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-dispatch-runtime";
2021
import {
2122
buildPendingHistoryContextFromMap,
2223
recordPendingHistoryEntryIfEnabled,
@@ -50,7 +51,6 @@ import { normalizeSlackChannelType, type SlackMonitorContext } from "../context.
5051
import { recordInboundSession, resolveConversationLabel } from "../conversation.runtime.js";
5152
import { authorizeSlackDirectMessage } from "../dm-auth.js";
5253
import { resolveSlackThreadStarter } from "../media.js";
53-
import { finalizeInboundContext } from "../reply.runtime.js";
5454
import { resolveSlackRoomContextHints } from "../room-context.js";
5555
import { sendMessageSlack } from "../send.runtime.js";
5656
import { resolveSlackMessageContent } from "./prepare-content.js";

extensions/slack/src/monitor/replies.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import type { MarkdownTableMode, OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
2+
import {
3+
chunkMarkdownTextWithMode,
4+
isSilentReplyText,
5+
SILENT_REPLY_TOKEN,
6+
type ChunkMode,
7+
} from "openclaw/plugin-sdk/reply-chunking";
28
import {
39
deliverTextOrMediaReply,
410
resolveSendableOutboundReplyParts,
11+
type ReplyPayload,
512
} from "openclaw/plugin-sdk/reply-payload";
6-
import type { ChunkMode } from "openclaw/plugin-sdk/reply-runtime";
7-
import type { ReplyPayload } from "openclaw/plugin-sdk/reply-runtime";
13+
import { createReplyReferencePlanner } from "openclaw/plugin-sdk/reply-reference";
814
import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env";
915
import { markdownToSlackMrkdwnChunks } from "../format.js";
1016
import { SLACK_TEXT_LIMIT } from "../limits.js";
1117
import { resolveSlackReplyBlocks } from "../reply-blocks.js";
12-
import {
13-
chunkMarkdownTextWithMode,
14-
createReplyReferencePlanner,
15-
isSilentReplyText,
16-
SILENT_REPLY_TOKEN,
17-
} from "./reply.runtime.js";
1818
import { sendMessageSlack, type SlackSendIdentity } from "./send.runtime.js";
1919

2020
export function readSlackReplyBlocks(payload: ReplyPayload) {

extensions/slack/src/outbound-payload.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { installChannelOutboundPayloadContractSuite } from "openclaw/plugin-sdk/channel-contract-testing";
12
import type { ReplyPayload } from "openclaw/plugin-sdk/reply-runtime";
2-
import { installChannelOutboundPayloadContractSuite } from "openclaw/plugin-sdk/testing";
33
import { describe, expect, it } from "vitest";
44
import { createSlackOutboundPayloadHarness } from "../test-api.js";
55

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,10 @@
509509
"types": "./dist/plugin-sdk/boolean-param.d.ts",
510510
"default": "./dist/plugin-sdk/boolean-param.js"
511511
},
512+
"./plugin-sdk/channel-contract-testing": {
513+
"types": "./dist/plugin-sdk/channel-contract-testing.d.ts",
514+
"default": "./dist/plugin-sdk/channel-contract-testing.js"
515+
},
512516
"./plugin-sdk/dangerous-name-runtime": {
513517
"types": "./dist/plugin-sdk/dangerous-name-runtime.d.ts",
514518
"default": "./dist/plugin-sdk/dangerous-name-runtime.js"

scripts/lib/plugin-sdk-entrypoints.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
"browser-setup-tools",
114114
"browser-support",
115115
"boolean-param",
116+
"channel-contract-testing",
116117
"dangerous-name-runtime",
117118
"command-auth",
118119
"command-auth-native",
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export {
2+
expectChannelInboundContextContract,
3+
primeChannelOutboundSendMock,
4+
} from "../channels/plugins/contracts/test-helpers.js";
5+
export {
6+
installChannelOutboundPayloadContractSuite,
7+
type OutboundPayloadHarnessParams,
8+
} from "../channels/plugins/contracts/outbound-payload-testkit.js";

src/plugin-sdk/reply-chunking.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ export {
66
resolveTextChunkLimit,
77
} from "../auto-reply/chunk.js";
88
export type { ChunkMode } from "../auto-reply/chunk.js";
9-
export { isSilentReplyText } from "../auto-reply/tokens.js";
9+
export { isSilentReplyText, SILENT_REPLY_TOKEN } from "../auto-reply/tokens.js";
1010
export type { ReplyPayload } from "./reply-payload.js";

0 commit comments

Comments
 (0)