mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:50:43 +00:00
perf: narrow slack command imports
This commit is contained in:
@@ -12,9 +12,9 @@ import {
|
||||
resolveEnvelopeFormatOptions,
|
||||
resolveInboundMentionDecision,
|
||||
} from "openclaw/plugin-sdk/channel-inbound";
|
||||
import { resolveControlCommandGate } from "openclaw/plugin-sdk/command-auth";
|
||||
import { hasControlCommand } from "openclaw/plugin-sdk/command-auth";
|
||||
import { shouldHandleTextCommands } from "openclaw/plugin-sdk/command-auth";
|
||||
import { hasControlCommand } from "openclaw/plugin-sdk/command-detection";
|
||||
import { resolveControlCommandGate } from "openclaw/plugin-sdk/command-gating";
|
||||
import { shouldHandleTextCommands } from "openclaw/plugin-sdk/command-surface";
|
||||
import {
|
||||
resolveRuntimeConversationBindingRoute,
|
||||
type RuntimeConversationBindingRouteResult,
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export { listProviderPluginCommandSpecs } from "openclaw/plugin-sdk/command-auth";
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { SlackActionMiddlewareArgs, SlackCommandMiddlewareArgs } from "@slack/bolt";
|
||||
import { createChannelReplyPipeline } from "openclaw/plugin-sdk/channel-reply-pipeline";
|
||||
import type { ChatCommandDefinition } from "openclaw/plugin-sdk/command-auth";
|
||||
import {
|
||||
type CommandArgs,
|
||||
resolveCommandAuthorizedFromAuthorizers,
|
||||
resolveNativeCommandSessionTargets,
|
||||
listProviderPluginCommandSpecs,
|
||||
} from "openclaw/plugin-sdk/command-auth";
|
||||
import { type ChatCommandDefinition, type CommandArgs } from "openclaw/plugin-sdk/command-auth";
|
||||
} from "openclaw/plugin-sdk/command-auth-native";
|
||||
import {
|
||||
resolveNativeCommandsEnabled,
|
||||
resolveNativeSkillsEnabled,
|
||||
@@ -47,6 +47,9 @@ let slashCommandsRuntimePromise: Promise<typeof import("./slash-commands.runtime
|
||||
null;
|
||||
let slashDispatchRuntimePromise: Promise<typeof import("./slash-dispatch.runtime.js")> | null =
|
||||
null;
|
||||
let slackPluginCommandsRuntimePromise: Promise<
|
||||
typeof import("./slash-plugin-commands.runtime.js")
|
||||
> | null = null;
|
||||
let slashSkillCommandsRuntimePromise: Promise<
|
||||
typeof import("./slash-skill-commands.runtime.js")
|
||||
> | null = null;
|
||||
@@ -61,6 +64,11 @@ function loadSlashDispatchRuntime() {
|
||||
return slashDispatchRuntimePromise;
|
||||
}
|
||||
|
||||
function loadSlackPluginCommandsRuntime() {
|
||||
slackPluginCommandsRuntimePromise ??= import("./slash-plugin-commands.runtime.js");
|
||||
return slackPluginCommandsRuntimePromise;
|
||||
}
|
||||
|
||||
function loadSlashSkillCommandsRuntime() {
|
||||
slashSkillCommandsRuntimePromise ??= import("./slash-skill-commands.runtime.js");
|
||||
return slashSkillCommandsRuntimePromise;
|
||||
@@ -685,6 +693,7 @@ export async function registerSlackMonitorSlashCommands(params: {
|
||||
const existingNativeNames = new Set(
|
||||
nativeCommands.map((c) => normalizeLowercaseStringOrEmpty(c.name)).filter(Boolean),
|
||||
);
|
||||
const { listProviderPluginCommandSpecs } = await loadSlackPluginCommandsRuntime();
|
||||
for (const pluginCommand of listProviderPluginCommandSpecs("slack")) {
|
||||
const normalizedName = normalizeLowercaseStringOrEmpty(pluginCommand.name);
|
||||
if (!normalizedName || existingNativeNames.has(normalizedName)) {
|
||||
|
||||
Reference in New Issue
Block a user