refactor(mattermost): trim monitor gating facade (#106021)

* refactor(mattermost): trim monitor gating facade

* chore(ci): shrink Mattermost LOC baseline

* chore(ci): refresh deadcode export baseline
This commit is contained in:
Peter Steinberger
2026-07-12 23:09:15 -07:00
committed by GitHub
parent 008f04a656
commit 9cdf166d2e
6 changed files with 10 additions and 24 deletions

View File

@@ -26,7 +26,7 @@ export function resolveMattermostTrustedChatKind(params: {
return params.fallback ?? "direct";
}
export type MattermostRequireMentionResolverInput = {
type MattermostRequireMentionResolverInput = {
cfg: OpenClawConfig;
channel: "mattermost";
accountId: string;
@@ -34,7 +34,7 @@ export type MattermostRequireMentionResolverInput = {
requireMentionOverride?: boolean;
};
export type MattermostMentionGateInput = {
type MattermostMentionGateInput = {
kind: ChatType;
cfg: OpenClawConfig;
accountId: string;

View File

@@ -1,6 +1,6 @@
// Mattermost tests cover monitor.channel kind plugin behavior.
import { describe, expect, it } from "vitest";
import { mapMattermostChannelTypeToChatType } from "./monitor.js";
import { mapMattermostChannelTypeToChatType } from "./monitor-gating.js";
describe("mapMattermostChannelTypeToChatType", () => {
it("maps direct and group dm channel types", () => {

View File

@@ -5,11 +5,11 @@ import type { OpenClawConfig } from "../../runtime-api.js";
import { resolveMattermostAccount } from "./accounts.js";
import * as clientModule from "./client.js";
import type { MattermostClient } from "./client.js";
import { evaluateMattermostMentionGate } from "./monitor-gating.js";
import {
buildMattermostModelPickerSelectMessageSid,
canFinalizeMattermostPreviewInPlace,
deliverMattermostReplyWithDraftPreview,
evaluateMattermostMentionGate,
formatMattermostFinalDeliveryOutcomeLog,
MattermostRetryableInboundError,
processMattermostReplayGuardedPost,
@@ -20,10 +20,13 @@ import {
resolveMattermostThreadSessionContext,
shouldSuppressMattermostDefaultToolProgressMessages,
shouldUpdateMattermostDraftToolProgress,
type MattermostMentionGateInput,
type MattermostRequireMentionResolverInput,
} from "./monitor.js";
type MattermostMentionGateInput = Parameters<typeof evaluateMattermostMentionGate>[0];
type MattermostRequireMentionResolverInput = Parameters<
MattermostMentionGateInput["resolveRequireMention"]
>[0];
function resolveRequireMentionForTest(params: MattermostRequireMentionResolverInput): boolean {
const root = params.cfg.channels?.mattermost;
const accountGroups = (

View File

@@ -129,16 +129,6 @@ import {
recordMattermostThreadParticipation,
} from "./thread-participation.js";
export {
evaluateMattermostMentionGate,
mapMattermostChannelTypeToChatType,
resolveMattermostTrustedChatKind,
} from "./monitor-gating.js";
export type {
MattermostMentionGateInput,
MattermostRequireMentionResolverInput,
} from "./monitor-gating.js";
type MonitorMattermostOpts = {
botToken?: string;
baseUrl?: string;

View File

@@ -301,8 +301,6 @@ export const KNIP_UNUSED_EXPORT_BASELINE = [
"extensions/mattermost/src/mattermost/interactions.ts: generateInteractionToken",
"extensions/mattermost/src/mattermost/interactions.ts: getInteractionSecret",
"extensions/mattermost/src/mattermost/interactions.ts: verifyInteractionToken",
"extensions/mattermost/src/mattermost/monitor-gating.ts: MattermostMentionGateInput",
"extensions/mattermost/src/mattermost/monitor-gating.ts: MattermostRequireMentionResolverInput",
"extensions/mattermost/src/mattermost/monitor-resources.ts: MATTERMOST_MEDIA_READ_IDLE_TIMEOUT_MS",
"extensions/mattermost/src/mattermost/monitor-resources.ts: MATTERMOST_MEDIA_RESPONSE_HEADER_TIMEOUT_MS",
"extensions/mattermost/src/mattermost/monitor-websocket.ts: MATTERMOST_WEBSOCKET_MAX_PAYLOAD_BYTES",
@@ -311,11 +309,7 @@ export const KNIP_UNUSED_EXPORT_BASELINE = [
"extensions/mattermost/src/mattermost/monitor.ts: buildMattermostModelPickerSelectMessageSid",
"extensions/mattermost/src/mattermost/monitor.ts: canFinalizeMattermostPreviewInPlace",
"extensions/mattermost/src/mattermost/monitor.ts: deliverMattermostReplyWithDraftPreview",
"extensions/mattermost/src/mattermost/monitor.ts: evaluateMattermostMentionGate",
"extensions/mattermost/src/mattermost/monitor.ts: formatMattermostFinalDeliveryOutcomeLog",
"extensions/mattermost/src/mattermost/monitor.ts: mapMattermostChannelTypeToChatType",
"extensions/mattermost/src/mattermost/monitor.ts: MattermostMentionGateInput",
"extensions/mattermost/src/mattermost/monitor.ts: MattermostRequireMentionResolverInput",
"extensions/mattermost/src/mattermost/monitor.ts: MattermostRetryableInboundError",
"extensions/mattermost/src/mattermost/monitor.ts: processMattermostReplayGuardedPost",
"extensions/mattermost/src/mattermost/monitor.ts: resolveMattermostEffectiveReplyToId",
@@ -323,7 +317,6 @@ export const KNIP_UNUSED_EXPORT_BASELINE = [
"extensions/mattermost/src/mattermost/monitor.ts: resolveMattermostReactionChannelId",
"extensions/mattermost/src/mattermost/monitor.ts: resolveMattermostReplyRootId",
"extensions/mattermost/src/mattermost/monitor.ts: resolveMattermostThreadSessionContext",
"extensions/mattermost/src/mattermost/monitor.ts: resolveMattermostTrustedChatKind",
"extensions/mattermost/src/mattermost/monitor.ts: shouldSuppressMattermostDefaultToolProgressMessages",
"extensions/mattermost/src/mattermost/monitor.ts: shouldUpdateMattermostDraftToolProgress",
"extensions/mattermost/src/mattermost/reactions.ts: resetMattermostReactionBotUserCacheForTests",

View File

@@ -193,7 +193,7 @@
"extensions/mattermost/src/channel.ts": 961,
"extensions/mattermost/src/mattermost/client.ts": 736,
"extensions/mattermost/src/mattermost/interactions.ts": 677,
"extensions/mattermost/src/mattermost/monitor.ts": 2476,
"extensions/mattermost/src/mattermost/monitor.ts": 2466,
"extensions/mattermost/src/mattermost/send.ts": 554,
"extensions/mattermost/src/mattermost/slash-commands.ts": 620,
"extensions/mattermost/src/mattermost/slash-http.ts": 948,