export type MentionGateParams = { requireMention: boolean; canDetectMention: boolean; wasMentioned: boolean; implicitMention?: boolean; shouldBypassMention?: boolean; }; export type MentionGateResult = { effectiveWasMentioned: boolean; shouldSkip: boolean; }; export function resolveMentionGating(params: MentionGateParams): MentionGateResult { const implicit = params.implicitMention === true; const bypass = params.shouldBypassMention === true; const effectiveWasMentioned = params.wasMentioned || implicit || bypass; const shouldSkip = params.requireMention && params.canDetectMention && !effectiveWasMentioned; return { effectiveWasMentioned, shouldSkip }; }