mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-03 13:50:27 +00:00
Slack: add opt-in interactive reply directives (#44607)
* Reply: add Slack interactive directive parser * Reply: wire Slack directives into normalization * Reply: cover Slack directive parsing * Reply: test Slack directive normalization * Slack: hint interactive reply directives * Config: add Slack interactive reply capability type * Config: validate Slack interactive reply capability * Reply: gate Slack directives behind capability * Slack: gate interactive reply hints by capability * Tests: cover Slack interactive reply capability gating * Changelog: note opt-in Slack interactive replies * Slack: fix interactive reply review findings * Slack: harden interactive reply routing and limits * Slack: harden interactive reply trust and validation
This commit is contained in:
@@ -12,11 +12,13 @@ import {
|
||||
resolveResponsePrefixTemplate,
|
||||
type ResponsePrefixContext,
|
||||
} from "./response-prefix-template.js";
|
||||
import { hasSlackDirectives, parseSlackDirectives } from "./slack-directives.js";
|
||||
|
||||
export type NormalizeReplySkipReason = "empty" | "silent" | "heartbeat";
|
||||
|
||||
export type NormalizeReplyOptions = {
|
||||
responsePrefix?: string;
|
||||
enableSlackInteractiveReplies?: boolean;
|
||||
/** Context for template variable interpolation in responsePrefix */
|
||||
responsePrefixContext?: ResponsePrefixContext;
|
||||
onHeartbeatStrip?: () => void;
|
||||
@@ -105,5 +107,10 @@ export function normalizeReplyPayload(
|
||||
text = `${effectivePrefix} ${text}`;
|
||||
}
|
||||
|
||||
return { ...enrichedPayload, text };
|
||||
enrichedPayload = { ...enrichedPayload, text };
|
||||
if (opts.enableSlackInteractiveReplies && text && hasSlackDirectives(text)) {
|
||||
enrichedPayload = parseSlackDirectives(enrichedPayload);
|
||||
}
|
||||
|
||||
return enrichedPayload;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user