Skip to content

Commit 5be5233

Browse files
committed
perf: narrow slack command imports
1 parent a3aa13d commit 5be5233

3 files changed

Lines changed: 16 additions & 6 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import {
1212
resolveEnvelopeFormatOptions,
1313
resolveInboundMentionDecision,
1414
} from "openclaw/plugin-sdk/channel-inbound";
15-
import { resolveControlCommandGate } from "openclaw/plugin-sdk/command-auth";
16-
import { hasControlCommand } from "openclaw/plugin-sdk/command-auth";
17-
import { shouldHandleTextCommands } from "openclaw/plugin-sdk/command-auth";
15+
import { hasControlCommand } from "openclaw/plugin-sdk/command-detection";
16+
import { resolveControlCommandGate } from "openclaw/plugin-sdk/command-gating";
17+
import { shouldHandleTextCommands } from "openclaw/plugin-sdk/command-surface";
1818
import {
1919
resolveRuntimeConversationBindingRoute,
2020
type RuntimeConversationBindingRouteResult,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { listProviderPluginCommandSpecs } from "openclaw/plugin-sdk/command-auth";

‎extensions/slack/src/monitor/slash.ts‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import type { SlackActionMiddlewareArgs, SlackCommandMiddlewareArgs } from "@slack/bolt";
22
import { createChannelReplyPipeline } from "openclaw/plugin-sdk/channel-reply-pipeline";
3+
import type { ChatCommandDefinition } from "openclaw/plugin-sdk/command-auth";
34
import {
5+
type CommandArgs,
46
resolveCommandAuthorizedFromAuthorizers,
57
resolveNativeCommandSessionTargets,
6-
listProviderPluginCommandSpecs,
7-
} from "openclaw/plugin-sdk/command-auth";
8-
import { type ChatCommandDefinition, type CommandArgs } from "openclaw/plugin-sdk/command-auth";
8+
} from "openclaw/plugin-sdk/command-auth-native";
99
import {
1010
resolveNativeCommandsEnabled,
1111
resolveNativeSkillsEnabled,
@@ -47,6 +47,9 @@ let slashCommandsRuntimePromise: Promise<typeof import("./slash-commands.runtime
4747
null;
4848
let slashDispatchRuntimePromise: Promise<typeof import("./slash-dispatch.runtime.js")> | null =
4949
null;
50+
let slackPluginCommandsRuntimePromise: Promise<
51+
typeof import("./slash-plugin-commands.runtime.js")
52+
> | null = null;
5053
let slashSkillCommandsRuntimePromise: Promise<
5154
typeof import("./slash-skill-commands.runtime.js")
5255
> | null = null;
@@ -61,6 +64,11 @@ function loadSlashDispatchRuntime() {
6164
return slashDispatchRuntimePromise;
6265
}
6366

67+
function loadSlackPluginCommandsRuntime() {
68+
slackPluginCommandsRuntimePromise ??= import("./slash-plugin-commands.runtime.js");
69+
return slackPluginCommandsRuntimePromise;
70+
}
71+
6472
function loadSlashSkillCommandsRuntime() {
6573
slashSkillCommandsRuntimePromise ??= import("./slash-skill-commands.runtime.js");
6674
return slashSkillCommandsRuntimePromise;
@@ -685,6 +693,7 @@ export async function registerSlackMonitorSlashCommands(params: {
685693
const existingNativeNames = new Set(
686694
nativeCommands.map((c) => normalizeLowercaseStringOrEmpty(c.name)).filter(Boolean),
687695
);
696+
const { listProviderPluginCommandSpecs } = await loadSlackPluginCommandsRuntime();
688697
for (const pluginCommand of listProviderPluginCommandSpecs("slack")) {
689698
const normalizedName = normalizeLowercaseStringOrEmpty(pluginCommand.name);
690699
if (!normalizedName || existingNativeNames.has(normalizedName)) {

0 commit comments

Comments
 (0)