feat: add slack replyToModeByChatType overrides

This commit is contained in:
Peter Steinberger
2026-01-23 05:24:18 +00:00
parent eebd750781
commit 9bf295da48
7 changed files with 111 additions and 58 deletions

View File

@@ -17,7 +17,7 @@ export type SlackDmConfig = {
groupEnabled?: boolean;
/** Optional allowlist for group DM channels (ids or slugs). */
groupChannels?: Array<string | number>;
/** Control reply threading for DMs (off|first|all). Overrides top-level replyToMode for DMs. */
/** @deprecated Prefer channels.slack.replyToModeByChatType.direct. */
replyToMode?: ReplyToMode;
};
@@ -119,6 +119,11 @@ export type SlackAccountConfig = {
reactionAllowlist?: Array<string | number>;
/** Control reply threading when reply tags are present (off|first|all). */
replyToMode?: ReplyToMode;
/**
* Optional per-chat-type reply threading overrides.
* Example: { direct: "all", group: "first", channel: "off" }.
*/
replyToModeByChatType?: Partial<Record<"direct" | "group" | "channel", ReplyToMode>>;
/** Thread session behavior. */
thread?: SlackThreadConfig;
actions?: SlackActionConfig;

View File

@@ -248,6 +248,7 @@ export const SlackDmSchema = z
allowFrom: z.array(z.union([z.string(), z.number()])).optional(),
groupEnabled: z.boolean().optional(),
groupChannels: z.array(z.union([z.string(), z.number()])).optional(),
replyToMode: ReplyToModeSchema.optional(),
})
.strict()
.superRefine((value, ctx) => {
@@ -280,6 +281,14 @@ export const SlackThreadSchema = z
})
.strict();
const SlackReplyToModeByChatTypeSchema = z
.object({
direct: ReplyToModeSchema.optional(),
group: ReplyToModeSchema.optional(),
channel: ReplyToModeSchema.optional(),
})
.strict();
export const SlackAccountSchema = z
.object({
name: z.string().optional(),
@@ -307,6 +316,7 @@ export const SlackAccountSchema = z
reactionNotifications: z.enum(["off", "own", "all", "allowlist"]).optional(),
reactionAllowlist: z.array(z.union([z.string(), z.number()])).optional(),
replyToMode: ReplyToModeSchema.optional(),
replyToModeByChatType: SlackReplyToModeByChatTypeSchema.optional(),
thread: SlackThreadSchema.optional(),
actions: z
.object({