openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
108 lines (107 loc) • 4.01 kB
TypeScript
import type { App } from "@slack/bolt";
import type { OpenClawConfig, SlackReactionNotificationMode } from "openclaw/plugin-sdk/config-runtime";
import { type SessionScope } from "openclaw/plugin-sdk/config-runtime";
import type { DmPolicy, GroupPolicy } from "openclaw/plugin-sdk/config-runtime";
import type { HistoryEntry } from "openclaw/plugin-sdk/reply-history";
import { getChildLogger } from "openclaw/plugin-sdk/runtime-env";
import type { RuntimeEnv } from "openclaw/plugin-sdk/runtime-env";
import type { SlackMessageEvent } from "../types.js";
import type { SlackChannelConfigEntries } from "./channel-config.js";
export { inferSlackChannelType, normalizeSlackChannelType } from "./channel-type.js";
export type SlackMonitorContext = {
cfg: OpenClawConfig;
accountId: string;
botToken: string;
app: App;
runtime: RuntimeEnv;
botUserId: string;
teamId: string;
apiAppId: string;
historyLimit: number;
channelHistories: Map<string, HistoryEntry[]>;
sessionScope: SessionScope;
mainKey: string;
dmEnabled: boolean;
dmPolicy: DmPolicy;
allowFrom: string[];
allowNameMatching: boolean;
groupDmEnabled: boolean;
groupDmChannels: string[];
defaultRequireMention: boolean;
channelsConfig?: SlackChannelConfigEntries;
channelsConfigKeys: string[];
groupPolicy: GroupPolicy;
useAccessGroups: boolean;
reactionMode: SlackReactionNotificationMode;
reactionAllowlist: Array<string | number>;
replyToMode: "off" | "first" | "all";
threadHistoryScope: "thread" | "channel";
threadInheritParent: boolean;
slashCommand: Required<import("openclaw/plugin-sdk/config-runtime").SlackSlashCommandConfig>;
textLimit: number;
ackReactionScope: string;
typingReaction: string;
mediaMaxBytes: number;
removeAckAfterReply: boolean;
logger: ReturnType<typeof getChildLogger>;
markMessageSeen: (channelId: string | undefined, ts?: string) => boolean;
shouldDropMismatchedSlackEvent: (body: unknown) => boolean;
resolveSlackSystemEventSessionKey: (params: {
channelId?: string | null;
channelType?: string | null;
senderId?: string | null;
}) => string;
isChannelAllowed: (params: {
channelId?: string;
channelName?: string;
channelType?: SlackMessageEvent["channel_type"];
}) => boolean;
resolveChannelName: (channelId: string) => Promise<{
name?: string;
type?: SlackMessageEvent["channel_type"];
topic?: string;
purpose?: string;
}>;
resolveUserName: (userId: string) => Promise<{
name?: string;
}>;
setSlackThreadStatus: (params: {
channelId: string;
threadTs?: string;
status: string;
}) => Promise<void>;
};
export declare function createSlackMonitorContext(params: {
cfg: OpenClawConfig;
accountId: string;
botToken: string;
app: App;
runtime: RuntimeEnv;
botUserId: string;
teamId: string;
apiAppId: string;
historyLimit: number;
sessionScope: SessionScope;
mainKey: string;
dmEnabled: boolean;
dmPolicy: DmPolicy;
allowFrom: Array<string | number> | undefined;
allowNameMatching: boolean;
groupDmEnabled: boolean;
groupDmChannels: Array<string | number> | undefined;
defaultRequireMention?: boolean;
channelsConfig?: SlackMonitorContext["channelsConfig"];
groupPolicy: SlackMonitorContext["groupPolicy"];
useAccessGroups: boolean;
reactionMode: SlackReactionNotificationMode;
reactionAllowlist: Array<string | number>;
replyToMode: SlackMonitorContext["replyToMode"];
threadHistoryScope: SlackMonitorContext["threadHistoryScope"];
threadInheritParent: SlackMonitorContext["threadInheritParent"];
slashCommand: SlackMonitorContext["slashCommand"];
textLimit: number;
ackReactionScope: string;
typingReaction: string;
mediaMaxBytes: number;
removeAckAfterReply: boolean;
}): SlackMonitorContext;