feat(msteams): add per-channel requireMention config

- Add teams/channels config structure to MSTeamsConfig
- Implement requireMention check in monitor.ts
  - Resolution order: channel > team > global > default (true)
- Update zod schema for validation
- Document RSC permissions for receiving all messages without @mention
- Document Graph API Proxy pattern for historical message access
- Document private channel limitations
- Document team/channel ID format (use URL path, not groupId)
This commit is contained in:
Onur
2026-01-08 02:29:53 +03:00
committed by Peter Steinberger
parent 7d72fcf7f8
commit 2c7d5c82f3
2 changed files with 243 additions and 1 deletions

View File

@@ -57,6 +57,12 @@ type TeamsActivity = {
type?: string;
mentioned?: { id?: string; name?: string };
}>;
/** Teams-specific channel data including team info */
channelData?: {
team?: { id?: string; name?: string };
channel?: { id?: string; name?: string };
tenant?: { id?: string };
};
};
type TeamsTurnContext = {
@@ -288,6 +294,34 @@ export async function monitorMSTeamsProvider(
}
}
// Check requireMention for channels and group chats
if (!isDirectMessage) {
const teamId = activity.channelData?.team?.id;
const channelId = conversationId;
// Resolution order: channel config > team config > global config > default (true)
const teamConfig = teamId ? msteamsCfg?.teams?.[teamId] : undefined;
const channelConfig = teamConfig?.channels?.[channelId];
const requireMention =
channelConfig?.requireMention ??
teamConfig?.requireMention ??
msteamsCfg?.requireMention ??
true;
const mentioned = wasBotMentioned(activity);
if (requireMention && !mentioned) {
log.debug("skipping message (mention required)", {
teamId,
channelId,
requireMention,
mentioned,
});
return;
}
}
// Format the message body with envelope
const timestamp = parseTimestamp(activity.timestamp);
const body = formatAgentEnvelope({