Plugins: internalize slack SDK imports

This commit is contained in:
Vincent Koc
2026-03-17 21:32:00 -07:00
parent aa3739167c
commit 873ac8bc79
9 changed files with 73 additions and 43 deletions

View File

@@ -7,13 +7,13 @@ import {
hasConfiguredSecretInput,
normalizeSecretInputString,
} from "openclaw/plugin-sdk/config-runtime";
import type { SlackAccountConfig } from "openclaw/plugin-sdk/slack";
import type { SlackAccountSurfaceFields } from "./account-surface-fields.js";
import {
mergeSlackAccountConfig,
resolveDefaultSlackAccountId,
type SlackTokenSource,
} from "./accounts.js";
import type { SlackAccountConfig } from "./runtime-api.js";
export type SlackCredentialStatus = "available" | "configured_unavailable" | "missing";

View File

@@ -6,8 +6,8 @@ import {
resolveAccountEntry,
type OpenClawConfig,
} from "openclaw/plugin-sdk/account-resolution";
import type { SlackAccountConfig } from "openclaw/plugin-sdk/slack";
import type { SlackAccountSurfaceFields } from "./account-surface-fields.js";
import type { SlackAccountConfig } from "./runtime-api.js";
import { resolveSlackAppToken, resolveSlackBotToken, resolveSlackUserToken } from "./token.js";
export type SlackTokenSource = "env" | "config" | "none";

View File

@@ -1,14 +1,4 @@
import type { AgentToolResult } from "@mariozechner/pi-agent-core";
import {
createActionGate,
imageResultFromFile,
jsonResult,
readNumberParam,
readReactionParams,
readStringParam,
type OpenClawConfig,
withNormalizedTimestamp,
} from "openclaw/plugin-sdk/slack-core";
import { resolveSlackAccount } from "./accounts.js";
import {
deleteSlackMessage,
@@ -27,6 +17,16 @@ import {
unpinSlackMessage,
} from "./actions.js";
import { parseSlackBlocksInput } from "./blocks-input.js";
import {
createActionGate,
imageResultFromFile,
jsonResult,
readNumberParam,
readReactionParams,
readStringParam,
type OpenClawConfig,
withNormalizedTimestamp,
} from "./runtime-api.js";
import { recordSlackThreadParticipation } from "./sent-thread-cache.js";
import { parseSlackTarget, resolveSlackChannelId } from "./targets.js";

View File

@@ -4,11 +4,11 @@ import {
type ChannelMessageActionAdapter,
type ChannelMessageToolDiscovery,
} from "openclaw/plugin-sdk/channel-runtime";
import { isSlackInteractiveRepliesEnabled } from "openclaw/plugin-sdk/slack";
import type { SlackActionContext } from "./action-runtime.js";
import { handleSlackAction } from "./action-runtime.js";
import { handleSlackMessageAction } from "./message-action-dispatch.js";
import { extractSlackToolSend, listSlackMessageActions } from "./message-actions.js";
import { isSlackInteractiveRepliesEnabled } from "./runtime-api.js";
import { resolveSlackChannelId } from "./targets.js";
type SlackActionInvoke = (

View File

@@ -1,5 +1,5 @@
import { type ChannelPlugin } from "openclaw/plugin-sdk/slack";
import { type ResolvedSlackAccount } from "./accounts.js";
import { type ChannelPlugin } from "./runtime-api.js";
import { slackSetupAdapter } from "./setup-core.js";
import { slackSetupWizard } from "./setup-surface.js";
import { createSlackPluginBase } from "./shared.js";

View File

@@ -10,6 +10,22 @@ import {
import { resolveOutboundSendDep } from "openclaw/plugin-sdk/channel-runtime";
import { buildOutboundBaseSessionKey, normalizeOutboundThreadId } from "openclaw/plugin-sdk/core";
import { resolveThreadSessionKeys, type RoutePeer } from "openclaw/plugin-sdk/routing";
import { buildPassiveProbedChannelStatusSummary } from "../../shared/channel-status-summary.js";
import {
listEnabledSlackAccounts,
resolveSlackAccount,
resolveSlackReplyToMode,
type ResolvedSlackAccount,
} from "./accounts.js";
import type { SlackActionContext } from "./action-runtime.js";
import { parseSlackBlocksInput } from "./blocks-input.js";
import { createSlackActions } from "./channel-actions.js";
import { createSlackWebClient } from "./client.js";
import { resolveSlackGroupRequireMention, resolveSlackGroupToolPolicy } from "./group-policy.js";
import { isSlackInteractiveRepliesEnabled } from "./interactive-replies.js";
import { normalizeAllowListLower } from "./monitor/allow-list.js";
import type { SlackProbe } from "./probe.js";
import { resolveSlackUserAllowlist } from "./resolve-users.js";
import {
buildComputedAccountStatusSnapshot,
DEFAULT_ACCOUNT_ID,
@@ -20,27 +36,7 @@ import {
resolveConfiguredFromRequiredCredentialStatuses,
type ChannelPlugin,
type OpenClawConfig,
type SlackActionContext,
} from "openclaw/plugin-sdk/slack";
import { buildPassiveProbedChannelStatusSummary } from "../../shared/channel-status-summary.js";
import {
listEnabledSlackAccounts,
resolveSlackAccount,
resolveSlackReplyToMode,
type ResolvedSlackAccount,
} from "./accounts.js";
import { parseSlackBlocksInput } from "./blocks-input.js";
import { createSlackActions } from "./channel-actions.js";
import { createSlackWebClient } from "./client.js";
import {
listSlackDirectoryGroupsFromConfig,
listSlackDirectoryPeersFromConfig,
} from "./directory-config.js";
import { resolveSlackGroupRequireMention, resolveSlackGroupToolPolicy } from "./group-policy.js";
import { isSlackInteractiveRepliesEnabled } from "./interactive-replies.js";
import { normalizeAllowListLower } from "./monitor/allow-list.js";
import type { SlackProbe } from "./probe.js";
import { resolveSlackUserAllowlist } from "./resolve-users.js";
} from "./runtime-api.js";
import { getSlackRuntime } from "./runtime.js";
import { fetchSlackScopes } from "./scopes.js";
import { slackSetupAdapter } from "./setup-core.js";

View File

@@ -3,9 +3,9 @@ import {
normalizeInteractiveReply,
type ChannelMessageActionContext,
} from "openclaw/plugin-sdk/channel-runtime";
import { readNumberParam, readStringParam } from "openclaw/plugin-sdk/slack-core";
import { parseSlackBlocksInput } from "./blocks-input.js";
import { buildSlackInteractiveBlocks } from "./blocks-render.js";
import { readNumberParam, readStringParam } from "./runtime-api.js";
type SlackActionInvoke = (
action: Record<string, unknown>,

View File

@@ -0,0 +1,34 @@
export type { OpenClawConfig } from "../../../src/config/config.js";
export type { SlackAccountConfig } from "../../../src/config/types.slack.js";
export type { ChannelPlugin } from "../../../src/channels/plugins/types.js";
export {
DEFAULT_ACCOUNT_ID,
buildChannelConfigSchema,
getChatChannelMeta,
PAIRING_APPROVED_MESSAGE,
} from "../../../src/plugin-sdk/channel-plugin-common.js";
export { buildComputedAccountStatusSnapshot } from "../../../src/plugin-sdk/status-helpers.js";
export {
listSlackDirectoryGroupsFromConfig,
listSlackDirectoryPeersFromConfig,
} from "../../../src/channels/plugins/directory-config.js";
export {
looksLikeSlackTargetId,
normalizeSlackMessagingTarget,
} from "../../../src/channels/plugins/normalize/slack.js";
export {
projectCredentialSnapshotFields,
resolveConfiguredFromRequiredCredentialStatuses,
} from "../../../src/channels/account-snapshot-fields.js";
export { SlackConfigSchema } from "../../../src/config/zod-schema.providers-core.js";
export {
createActionGate,
imageResultFromFile,
jsonResult,
readNumberParam,
readReactionParams,
readStringParam,
} from "../../../src/agents/tools/common.js";
export { withNormalizedTimestamp } from "../../../src/agents/date-time.js";
export { isSlackInteractiveRepliesEnabled } from "./interactive-replies.js";

View File

@@ -9,13 +9,6 @@ import {
hasConfiguredSecretInput,
patchChannelConfigForAccount,
} from "openclaw/plugin-sdk/setup";
import {
buildChannelConfigSchema,
getChatChannelMeta,
SlackConfigSchema,
type ChannelPlugin,
type OpenClawConfig,
} from "openclaw/plugin-sdk/slack-core";
import { inspectSlackAccount } from "./account-inspect.js";
import {
listSlackAccountIds,
@@ -24,6 +17,13 @@ import {
type ResolvedSlackAccount,
} from "./accounts.js";
import { isSlackInteractiveRepliesEnabled } from "./interactive-replies.js";
import {
buildChannelConfigSchema,
getChatChannelMeta,
SlackConfigSchema,
type ChannelPlugin,
type OpenClawConfig,
} from "./runtime-api.js";
export const SLACK_CHANNEL = "slack" as const;