feat: wire multi-agent config and routing
Co-authored-by: Mark Pors <1078320+pors@users.noreply.github.com>
This commit is contained in:
@@ -105,7 +105,6 @@ beforeEach(() => {
|
||||
ackReactionScope: "group-mentions",
|
||||
},
|
||||
slack: { dm: { enabled: true, policy: "open", allowFrom: ["*"] } },
|
||||
routing: { allowFrom: [] },
|
||||
};
|
||||
sendMock.mockReset().mockResolvedValue(undefined);
|
||||
replyMock.mockReset();
|
||||
@@ -208,15 +207,14 @@ describe("monitorSlackProvider tool results", () => {
|
||||
|
||||
it("accepts channel messages when mentionPatterns match", async () => {
|
||||
config = {
|
||||
messages: { responsePrefix: "PFX" },
|
||||
messages: {
|
||||
responsePrefix: "PFX",
|
||||
groupChat: { mentionPatterns: ["\\bclawd\\b"] },
|
||||
},
|
||||
slack: {
|
||||
dm: { enabled: true, policy: "open", allowFrom: ["*"] },
|
||||
channels: { C1: { allow: true, requireMention: true } },
|
||||
},
|
||||
routing: {
|
||||
allowFrom: [],
|
||||
groupChat: { mentionPatterns: ["\\bclawd\\b"] },
|
||||
},
|
||||
};
|
||||
replyMock.mockResolvedValue({ text: "hi" });
|
||||
|
||||
@@ -378,7 +376,6 @@ describe("monitorSlackProvider tool results", () => {
|
||||
dm: { enabled: true, policy: "open", allowFrom: ["*"] },
|
||||
channels: { C1: { allow: true, requireMention: false } },
|
||||
},
|
||||
routing: { allowFrom: [] },
|
||||
};
|
||||
|
||||
const controller = new AbortController();
|
||||
@@ -429,12 +426,9 @@ describe("monitorSlackProvider tool results", () => {
|
||||
dm: { enabled: true, policy: "open", allowFrom: ["*"] },
|
||||
channels: { C1: { allow: true, requireMention: false } },
|
||||
},
|
||||
routing: {
|
||||
allowFrom: [],
|
||||
bindings: [
|
||||
{ agentId: "support", match: { provider: "slack", teamId: "T1" } },
|
||||
],
|
||||
},
|
||||
bindings: [
|
||||
{ agentId: "support", match: { provider: "slack", teamId: "T1" } },
|
||||
],
|
||||
};
|
||||
|
||||
const client = getSlackClient();
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
type SlackEventMiddlewareArgs,
|
||||
} from "@slack/bolt";
|
||||
import type { WebClient as SlackWebClient } from "@slack/web-api";
|
||||
import { resolveAckReaction } from "../agents/identity.js";
|
||||
import {
|
||||
chunkMarkdownText,
|
||||
resolveTextChunkLimit,
|
||||
@@ -509,7 +510,6 @@ export async function monitorSlackProvider(opts: MonitorSlackOpts = {}) {
|
||||
opts.slashCommand ?? slackCfg.slashCommand,
|
||||
);
|
||||
const textLimit = resolveTextChunkLimit(cfg, "slack", account.accountId);
|
||||
const ackReaction = (cfg.messages?.ackReaction ?? "").trim();
|
||||
const ackReactionScope = cfg.messages?.ackReactionScope ?? "group-mentions";
|
||||
const mediaMaxBytes =
|
||||
(opts.mediaMaxMb ?? slackCfg.mediaMaxMb ?? 20) * 1024 * 1024;
|
||||
@@ -936,6 +936,7 @@ export async function monitorSlackProvider(opts: MonitorSlackOpts = {}) {
|
||||
});
|
||||
const rawBody = (message.text ?? "").trim() || media?.placeholder || "";
|
||||
if (!rawBody) return;
|
||||
const ackReaction = resolveAckReaction(cfg, route.agentId);
|
||||
const shouldAckReaction = () => {
|
||||
if (!ackReaction) return false;
|
||||
if (ackReactionScope === "all") return true;
|
||||
|
||||
Reference in New Issue
Block a user