@openclaw/mattermost 2026.8.1-beta.3 → 2026.9.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-plugin-runtime-C_mWt_83.js → channel-plugin-runtime-Bh8hcegp.js} +89 -128
- package/dist/channel-plugin-runtime.js +1 -1
- package/dist/{channel.runtime-CpQzh8-1.js → channel.runtime-DLTjcasQ.js} +69 -75
- package/dist/{client-B_hd-kwM.js → client-DAIry9-2.js} +1 -14
- package/dist/{interactions-Du_EJMeN.js → interactions-k47k-7SP.js} +1 -1
- package/dist/{accounts-DspH-NMT.js → normalize-bBDFEiyJ.js} +68 -3
- package/dist/slash-route-api.js +1 -1
- package/dist/{slash-state-BakgoSSL.js → slash-state-CfsJU7WW.js} +29 -81
- package/node_modules/ws/lib/permessage-deflate.js +3 -1
- package/node_modules/ws/package.json +1 -1
- package/openclaw.plugin.json +10 -0
- package/package.json +5 -5
package/dist/api.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { r as isMattermostSenderAllowed } from "./monitor-auth-CVd_4FPD.js";
|
|
2
|
-
import { t as buildButtonAttachments } from "./interactions-
|
|
2
|
+
import { t as buildButtonAttachments } from "./interactions-k47k-7SP.js";
|
|
3
3
|
export { buildButtonAttachments, isMattermostSenderAllowed };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as describeMattermostAccount, c as mattermostMeta, i as MattermostChannelConfigSchema, n as mattermostSetupWizard, o as isMattermostConfigured, r as mattermostSetupContract, s as mattermostConfigAdapter, t as mattermostPlugin } from "./channel-plugin-runtime-Bh8hcegp.js";
|
|
2
2
|
import { t as resolveMattermostGatewayAuthBypassPaths } from "./gateway-auth-bypass-B93t91oq.js";
|
|
3
3
|
//#region extensions/mattermost/src/channel.setup.ts
|
|
4
4
|
const mattermostSetupPlugin = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { m as normalizeMattermostBaseUrl } from "./client-
|
|
2
|
-
import { a as
|
|
1
|
+
import { m as normalizeMattermostBaseUrl } from "./client-DAIry9-2.js";
|
|
2
|
+
import { a as inspectMattermostAccount, c as resolveMattermostAccount, d as hasConfiguredSecretInput, i as resolveMattermostPresentation, l as resolveMattermostReplyToMode, n as normalizeMattermostMessagingTarget, o as listMattermostAccountIds, r as requiresMattermostMediaUpload, s as resolveDefaultMattermostAccountId, t as looksLikeMattermostTargetId, u as buildSecretInputSchema } from "./normalize-bBDFEiyJ.js";
|
|
3
3
|
import { t as resolveMattermostGatewayAuthBypassPaths } from "./gateway-auth-bypass-B93t91oq.js";
|
|
4
4
|
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-mvORF4f6.js";
|
|
5
5
|
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-qg3NXRlS.js";
|
|
@@ -11,13 +11,13 @@ import { z } from "zod";
|
|
|
11
11
|
import { formatNormalizedAllowFromEntries } from "openclaw/plugin-sdk/allow-from";
|
|
12
12
|
import { createLoggedPairingApprovalNotifier } from "openclaw/plugin-sdk/channel-pairing";
|
|
13
13
|
import { createAccountStatusSink, createChannelMessageAdapterFromOutbound } from "openclaw/plugin-sdk/channel-outbound";
|
|
14
|
-
import { jsonResult, readPositiveIntegerParam, readStringParam, withNormalizedTimestamp } from "openclaw/plugin-sdk/channel-actions";
|
|
14
|
+
import { jsonResult, readPositiveIntegerParam, readStringArrayParam, readStringParam, withNormalizedTimestamp } from "openclaw/plugin-sdk/channel-actions";
|
|
15
15
|
import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
16
16
|
import { createChannelConfigUiHints, createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
|
|
17
17
|
import { buildChannelGroupsScopeTree, buildMutableAllowEntryDetector, collectStandardAllowlistLists, createDangerousNameMatchingMutableAllowlistWarningCollector, createRestrictSendersChannelSecurity, resolveScopeRequireMention } from "openclaw/plugin-sdk/channel-policy";
|
|
18
18
|
import { attachChannelToResult, createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result";
|
|
19
19
|
import { createChannelDirectoryAdapter } from "openclaw/plugin-sdk/directory-runtime";
|
|
20
|
-
import {
|
|
20
|
+
import { resolveMessagePresentationButtonAction } from "openclaw/plugin-sdk/interactive-runtime";
|
|
21
21
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
22
22
|
import { resolvePayloadMediaUrls, sendTextMediaPayload } from "openclaw/plugin-sdk/reply-payload";
|
|
23
23
|
import { createComputedAccountStatusAdapter, createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/status-helpers";
|
|
@@ -198,6 +198,7 @@ const MattermostChannelConfigSchema = buildChannelConfigSchema(buildMultiAccount
|
|
|
198
198
|
markdown: MarkdownConfigSchema,
|
|
199
199
|
enabled: z.boolean().optional(),
|
|
200
200
|
configWrites: z.boolean().optional(),
|
|
201
|
+
historyLimit: z.number().int().min(0).optional(),
|
|
201
202
|
botToken: buildSecretInputSchema().optional(),
|
|
202
203
|
baseUrl: z.string().optional(),
|
|
203
204
|
chatmode: z.enum([
|
|
@@ -285,39 +286,59 @@ function resolveMattermostGroupRequireMention(params) {
|
|
|
285
286
|
});
|
|
286
287
|
}
|
|
287
288
|
//#endregion
|
|
288
|
-
//#region extensions/mattermost/src/
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
289
|
+
//#region extensions/mattermost/src/mattermost/emoji.ts
|
|
290
|
+
const MATTERMOST_EMOJI_SHORTNAME_BY_GLYPH = {
|
|
291
|
+
"✅": "white_check_mark",
|
|
292
|
+
"❌": "x",
|
|
293
|
+
"👍": "thumbsup",
|
|
294
|
+
"👎": "thumbsdown",
|
|
295
|
+
"🎉": "tada",
|
|
296
|
+
"❤": "heart",
|
|
297
|
+
"😄": "smile",
|
|
298
|
+
"😂": "joy",
|
|
299
|
+
"🚀": "rocket",
|
|
300
|
+
"👀": "eyes",
|
|
301
|
+
"🙏": "pray",
|
|
302
|
+
"🔥": "fire",
|
|
303
|
+
"💯": "100",
|
|
304
|
+
"⚠": "warning",
|
|
305
|
+
"➕": "heavy_plus_sign",
|
|
306
|
+
"➖": "heavy_minus_sign",
|
|
307
|
+
"🤔": "thinking_face",
|
|
308
|
+
"⚡": "zap",
|
|
309
|
+
"🌐": "globe_with_meridians",
|
|
310
|
+
"😱": "scream",
|
|
311
|
+
"🧠": "brain",
|
|
312
|
+
"💻": "computer",
|
|
313
|
+
"👋": "wave",
|
|
314
|
+
"🙌": "raised_hands"
|
|
315
|
+
};
|
|
316
|
+
const MATTERMOST_EMOJI_TONE_CAPABLE_NAMES = /* @__PURE__ */ new Set([
|
|
317
|
+
"thumbsup",
|
|
318
|
+
"thumbsdown",
|
|
319
|
+
"pray",
|
|
320
|
+
"wave",
|
|
321
|
+
"raised_hands"
|
|
322
|
+
]);
|
|
323
|
+
const MATTERMOST_EMOJI_TONE_SUFFIX_BY_MODIFIER = /* @__PURE__ */ new Map([
|
|
324
|
+
["🏻", "light_skin_tone"],
|
|
325
|
+
["🏼", "medium_light_skin_tone"],
|
|
326
|
+
["🏽", "medium_skin_tone"],
|
|
327
|
+
["🏾", "medium_dark_skin_tone"],
|
|
328
|
+
["🏿", "dark_skin_tone"]
|
|
329
|
+
]);
|
|
330
|
+
const EMOJI_SKIN_TONE_MODIFIER_RE = /[\u{1F3FB}-\u{1F3FF}]/gu;
|
|
331
|
+
const EMOJI_VARIATION_SELECTOR_RE = /[\u{FE00}-\u{FE0F}]/gu;
|
|
332
|
+
function normalizeMattermostEmojiName(raw) {
|
|
333
|
+
const withoutColons = raw?.trim().replace(/^:+|:+$/g, "");
|
|
334
|
+
if (!withoutColons) return;
|
|
335
|
+
const toneModifier = withoutColons.match(EMOJI_SKIN_TONE_MODIFIER_RE)?.[0];
|
|
336
|
+
const glyphKey = withoutColons.replace(EMOJI_SKIN_TONE_MODIFIER_RE, "").replace(EMOJI_VARIATION_SELECTOR_RE, "");
|
|
337
|
+
const shortname = Object.hasOwn(MATTERMOST_EMOJI_SHORTNAME_BY_GLYPH, glyphKey) ? MATTERMOST_EMOJI_SHORTNAME_BY_GLYPH[glyphKey] : void 0;
|
|
338
|
+
if (shortname === void 0) return withoutColons;
|
|
339
|
+
const toneSuffix = toneModifier ? MATTERMOST_EMOJI_TONE_SUFFIX_BY_MODIFIER.get(toneModifier) : void 0;
|
|
340
|
+
if (!toneSuffix || !MATTERMOST_EMOJI_TONE_CAPABLE_NAMES.has(shortname)) return shortname;
|
|
341
|
+
return `${shortname}_${toneSuffix}`;
|
|
321
342
|
}
|
|
322
343
|
//#endregion
|
|
323
344
|
//#region extensions/mattermost/src/session-route.ts
|
|
@@ -559,20 +580,7 @@ const mattermostSetupWizard = {
|
|
|
559
580
|
};
|
|
560
581
|
//#endregion
|
|
561
582
|
//#region extensions/mattermost/src/channel.ts
|
|
562
|
-
const loadMattermostChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-
|
|
563
|
-
function buildMattermostPresentationButtons(presentation) {
|
|
564
|
-
return presentation.blocks.filter((block) => block.type === "buttons").map((block) => block.buttons.flatMap((button) => {
|
|
565
|
-
if (button.action) return [];
|
|
566
|
-
const value = resolveMessagePresentationControlValue(button);
|
|
567
|
-
return value ? [{
|
|
568
|
-
id: value,
|
|
569
|
-
text: button.label,
|
|
570
|
-
callback_data: value,
|
|
571
|
-
context: { callback_data: value },
|
|
572
|
-
style: button.style
|
|
573
|
-
}] : [];
|
|
574
|
-
})).filter((row) => row.length > 0);
|
|
575
|
-
}
|
|
583
|
+
const loadMattermostChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-DLTjcasQ.js"));
|
|
576
584
|
const MATTERMOST_PRESENTATION_CAPABILITIES = {
|
|
577
585
|
supported: true,
|
|
578
586
|
buttons: true,
|
|
@@ -838,15 +846,13 @@ const mattermostMessageActions = {
|
|
|
838
846
|
if (action !== "send") throw new Error(`Unsupported Mattermost action: ${action}`);
|
|
839
847
|
const to = typeof params.to === "string" ? params.to.trim() : typeof params.target === "string" ? params.target.trim() : "";
|
|
840
848
|
if (!to) throw new Error("Mattermost send requires a target (to).");
|
|
841
|
-
const
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
}) : typeof params.message === "string" ? params.message : "";
|
|
849
|
+
const { text: message, buttons } = resolveMattermostPresentation({
|
|
850
|
+
text: typeof params.message === "string" ? params.message : void 0,
|
|
851
|
+
presentation: params.presentation
|
|
852
|
+
});
|
|
846
853
|
const replyToId = normalizeOptionalString(params.replyToId) ?? normalizeOptionalString(params.threadId) ?? normalizeOptionalString(params.replyTo);
|
|
847
854
|
const resolvedAccountId = accountId || void 0;
|
|
848
855
|
const mediaUrl = resolveMattermostSendAttachmentMedia(params);
|
|
849
|
-
const buttons = presentation ? buildMattermostPresentationButtons(presentation) : [];
|
|
850
856
|
const result = await (await loadMattermostChannelRuntime()).sendMessageMattermost(to, message, {
|
|
851
857
|
cfg,
|
|
852
858
|
accountId: resolvedAccountId,
|
|
@@ -879,7 +885,7 @@ const mattermostMessageActions = {
|
|
|
879
885
|
function parseMattermostReactActionParams(params) {
|
|
880
886
|
const postId = normalizeOptionalString(params.messageId) ?? normalizeOptionalString(params.postId);
|
|
881
887
|
if (!postId) throw new Error("Mattermost react requires messageId (post id)");
|
|
882
|
-
const emojiName = normalizeOptionalString(params.emoji)
|
|
888
|
+
const emojiName = normalizeMattermostEmojiName(normalizeOptionalString(params.emoji));
|
|
883
889
|
if (!emojiName) throw new Error("Mattermost react requires emoji");
|
|
884
890
|
return {
|
|
885
891
|
postId,
|
|
@@ -887,72 +893,28 @@ function parseMattermostReactActionParams(params) {
|
|
|
887
893
|
remove: params.remove === true
|
|
888
894
|
};
|
|
889
895
|
}
|
|
890
|
-
function
|
|
891
|
-
const
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
collected.push(trimmed);
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
return collected;
|
|
901
|
-
}
|
|
902
|
-
function toSnakeCaseKey(key) {
|
|
903
|
-
return key.replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2").replace(/([a-z0-9])([A-Z])/g, "$1_$2").toLowerCase();
|
|
904
|
-
}
|
|
905
|
-
function readMattermostParam(params, key) {
|
|
906
|
-
if (Object.hasOwn(params, key)) return params[key];
|
|
907
|
-
const snakeKey = toSnakeCaseKey(key);
|
|
908
|
-
return snakeKey === key || !Object.hasOwn(params, snakeKey) ? void 0 : params[snakeKey];
|
|
909
|
-
}
|
|
910
|
-
function readMattermostStringParam(params, key) {
|
|
911
|
-
const raw = readMattermostParam(params, key);
|
|
912
|
-
return typeof raw === "string" ? normalizeOptionalString(raw) : void 0;
|
|
913
|
-
}
|
|
914
|
-
function readMattermostStringArrayParam(params, key) {
|
|
915
|
-
const raw = readMattermostParam(params, key);
|
|
916
|
-
if (Array.isArray(raw)) return raw.filter((entry) => typeof entry === "string").flatMap((entry) => {
|
|
917
|
-
const normalized = normalizeOptionalString(entry);
|
|
918
|
-
return normalized ? [normalized] : [];
|
|
919
|
-
});
|
|
920
|
-
if (typeof raw === "string") {
|
|
921
|
-
const normalized = normalizeOptionalString(raw);
|
|
922
|
-
return normalized ? [normalized] : [];
|
|
923
|
-
}
|
|
924
|
-
return [];
|
|
925
|
-
}
|
|
926
|
-
function requiresMattermostMediaUpload(mediaUrl) {
|
|
927
|
-
const normalized = normalizeOptionalString(mediaUrl);
|
|
928
|
-
return Boolean(normalized && !/^https?:\/\//i.test(normalized));
|
|
929
|
-
}
|
|
930
|
-
function collectMattermostAttachmentMedia(params) {
|
|
931
|
-
const mediaUrlCandidates = [
|
|
932
|
-
readMattermostStringParam(params, "media"),
|
|
933
|
-
readMattermostStringParam(params, "mediaUrl"),
|
|
934
|
-
readMattermostStringParam(params, "path"),
|
|
935
|
-
readMattermostStringParam(params, "filePath"),
|
|
936
|
-
readMattermostStringParam(params, "fileUrl")
|
|
896
|
+
function resolveMattermostSendAttachmentMedia(params) {
|
|
897
|
+
const sourceKeys = [
|
|
898
|
+
"media",
|
|
899
|
+
"mediaUrl",
|
|
900
|
+
"path",
|
|
901
|
+
"filePath",
|
|
902
|
+
"fileUrl"
|
|
937
903
|
];
|
|
938
|
-
|
|
939
|
-
|
|
904
|
+
const candidates = sourceKeys.map((key) => readStringParam(params, key));
|
|
905
|
+
candidates.push(...readStringArrayParam(params, "mediaUrls") ?? []);
|
|
906
|
+
let hasUnsupportedAttachmentPayload = Boolean(readStringParam(params, "buffer") ?? readStringParam(params, "base64"));
|
|
940
907
|
if (Array.isArray(params.attachments)) for (const attachment of params.attachments) {
|
|
941
908
|
if (!attachment || typeof attachment !== "object" || Array.isArray(attachment)) continue;
|
|
942
909
|
const record = attachment;
|
|
943
|
-
|
|
944
|
-
|
|
910
|
+
candidates.push(...sourceKeys.map((key) => readStringParam(record, key)));
|
|
911
|
+
candidates.push(readStringParam(record, "url"));
|
|
912
|
+
hasUnsupportedAttachmentPayload ||= Boolean(readStringParam(record, "buffer") ?? readStringParam(record, "base64"));
|
|
945
913
|
}
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
}
|
|
951
|
-
function resolveMattermostSendAttachmentMedia(params) {
|
|
952
|
-
const attachmentMedia = collectMattermostAttachmentMedia(params);
|
|
953
|
-
if (attachmentMedia.hasUnsupportedAttachmentPayload) throw new Error("Mattermost send attachments require media, mediaUrl, path, filePath, fileUrl, mediaUrls, or attachments[] with one of those fields; buffer/base64 payloads are not supported.");
|
|
954
|
-
if (attachmentMedia.mediaUrls.length > 1) throw new Error("Mattermost send supports one attachment per message; split multiple mediaUrls or attachments[] entries into separate sends.");
|
|
955
|
-
return attachmentMedia.mediaUrls[0];
|
|
914
|
+
if (hasUnsupportedAttachmentPayload) throw new Error("Mattermost send attachments require media, mediaUrl, path, filePath, fileUrl, mediaUrls, or attachments[] with one of those fields; buffer/base64 payloads are not supported.");
|
|
915
|
+
const mediaUrls = [...new Set(candidates.filter((candidate) => Boolean(candidate)))];
|
|
916
|
+
if (mediaUrls.length > 1) throw new Error("Mattermost send supports one attachment per message; split multiple mediaUrls or attachments[] entries into separate sends.");
|
|
917
|
+
return mediaUrls[0];
|
|
956
918
|
}
|
|
957
919
|
function toMattermostOutboundResult(result) {
|
|
958
920
|
const { channelId, ...delivery } = result;
|
|
@@ -986,16 +948,15 @@ const mattermostOutbound = {
|
|
|
986
948
|
presentationCapabilities: MATTERMOST_PRESENTATION_CAPABILITIES,
|
|
987
949
|
renderPresentation: ({ payload, presentation }) => {
|
|
988
950
|
if (payload.mediaUrls && payload.mediaUrls.length > 1) return null;
|
|
989
|
-
const buttons =
|
|
990
|
-
|
|
991
|
-
|
|
951
|
+
const { text, buttons } = resolveMattermostPresentation({
|
|
952
|
+
text: payload.text,
|
|
953
|
+
presentation
|
|
954
|
+
});
|
|
955
|
+
if (!buttons.length && !hasMattermostPresentationNavigation(presentation)) return null;
|
|
992
956
|
return {
|
|
993
957
|
...payload,
|
|
994
|
-
text
|
|
995
|
-
|
|
996
|
-
presentation
|
|
997
|
-
}),
|
|
998
|
-
...hasButtons ? { channelData: {
|
|
958
|
+
text,
|
|
959
|
+
...buttons.length ? { channelData: {
|
|
999
960
|
...payload.channelData,
|
|
1000
961
|
mattermost: {
|
|
1001
962
|
...payload.channelData?.mattermost,
|
|
@@ -1270,4 +1231,4 @@ const mattermostPlugin = createChatChannelPlugin({
|
|
|
1270
1231
|
outbound: mattermostOutbound
|
|
1271
1232
|
});
|
|
1272
1233
|
//#endregion
|
|
1273
|
-
export {
|
|
1234
|
+
export { describeMattermostAccount as a, mattermostMeta as c, MattermostChannelConfigSchema as i, mattermostSetupWizard as n, isMattermostConfigured$1 as o, mattermostSetupContract as r, mattermostConfigAdapter as s, mattermostPlugin as t };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as mattermostPlugin } from "./channel-plugin-runtime-
|
|
1
|
+
import { t as mattermostPlugin } from "./channel-plugin-runtime-Bh8hcegp.js";
|
|
2
2
|
export { mattermostPlugin };
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { n as getOptionalMattermostRuntime, t as getMattermostRuntime } from "./runtime-CNB4YGqJ.js";
|
|
2
|
-
import { a as createMattermostPost, d as fetchMattermostUser, g as readMattermostError, l as fetchMattermostChannelPosts, m as normalizeMattermostBaseUrl, n as buildMattermostApiUrl, o as deleteMattermostPost, p as fetchMattermostUserTeams, r as createMattermostClient, s as fetchMattermostChannel, t as MattermostPostSchema, u as fetchMattermostMe, v as
|
|
2
|
+
import { _ as sendMattermostTyping, a as createMattermostPost, d as fetchMattermostUser, g as readMattermostError, l as fetchMattermostChannelPosts, m as normalizeMattermostBaseUrl, n as buildMattermostApiUrl, o as deleteMattermostPost, p as fetchMattermostUserTeams, r as createMattermostClient, s as fetchMattermostChannel, t as MattermostPostSchema, u as fetchMattermostMe, v as updateMattermostPost } from "./client-DAIry9-2.js";
|
|
3
3
|
import { S as resolveChannelMediaMaxBytes, T as warnMissingProviderGroupPolicyFallbackOnce, _ as logInboundDrop, b as registerPluginHttpRoute, c as DEFAULT_GROUP_HISTORY_LIMIT, d as createChannelMessageReplyPipeline, f as createChannelPairingController, h as listSkillCommandsForAgents, i as normalizeMattermostAllowEntry, l as buildModelsProviderData, n as formatMattermostDirectMessageDropLog, o as resolveMattermostMonitorInboundAccess, s as resolveMattermostTrustedChatKind, t as authorizeMattermostCommandInvocation, u as createChannelHistoryWindow, v as logTypingFailure, w as resolveDefaultGroupPolicy, x as resolveAllowlistProviderRuntimeGroupPolicy$1 } from "./monitor-auth-CVd_4FPD.js";
|
|
4
|
-
import { a as resolveInteractionCallbackPath, c as setInteractionSecret, i as createMattermostInteractionHandler, n as buildButtonProps, r as computeInteractionCallbackUrl, s as setInteractionCallbackUrl } from "./interactions-
|
|
5
|
-
import { a as
|
|
6
|
-
import {
|
|
7
|
-
import { _ as isSlashCommandsEnabled, a as sendMessageMattermost, b as resolveSlashCommandConfig, c as deliverMattermostReplyPayload, d as parseMattermostModelPickerContext, f as renderMattermostModelsPickerView, g as cleanupSlashCommands, h as DEFAULT_COMMAND_SPECS, l as joinMattermostVisibleContent, m as resolveMattermostModelPickerCurrentModel, n as deactivateSlashCommands, o as resolveMattermostOpaqueTarget, p as renderMattermostProviderPickerView, r as getSlashCommandState, s as createMattermostReplyDeliveryBarrier, t as activateSlashCommands, u as buildMattermostAllowedModelRefs, v as registerSlashCommands, y as resolveCallbackUrl } from "./slash-state-BakgoSSL.js";
|
|
4
|
+
import { a as resolveInteractionCallbackPath, c as setInteractionSecret, i as createMattermostInteractionHandler, n as buildButtonProps, r as computeInteractionCallbackUrl, s as setInteractionCallbackUrl } from "./interactions-k47k-7SP.js";
|
|
5
|
+
import { a as inspectMattermostAccount, c as resolveMattermostAccount, l as resolveMattermostReplyToMode, n as normalizeMattermostMessagingTarget, o as listMattermostAccountIds } from "./normalize-bBDFEiyJ.js";
|
|
6
|
+
import { _ as registerSlashCommands, a as sendMessageMattermost, c as joinMattermostVisibleContent, d as renderMattermostModelsPickerView, f as renderMattermostProviderPickerView, g as isSlashCommandsEnabled, h as cleanupSlashCommands, l as buildMattermostAllowedModelRefs, m as DEFAULT_COMMAND_SPECS, n as deactivateSlashCommands, o as resolveMattermostOpaqueTarget, p as resolveMattermostModelPickerCurrentModel, r as getSlashCommandState, s as deliverMattermostReplyPayload, t as activateSlashCommands, u as parseMattermostModelPickerContext, v as resolveCallbackUrl, y as resolveSlashCommandConfig } from "./slash-state-CfsJU7WW.js";
|
|
8
7
|
import { randomUUID } from "node:crypto";
|
|
9
8
|
import { resolveGatewayPort } from "openclaw/plugin-sdk/core";
|
|
10
|
-
import { resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/security-runtime";
|
|
9
|
+
import { resolvePinnedMainDmOwnerFromAllowlist, sanitizeUntrustedFileName } from "openclaw/plugin-sdk/security-runtime";
|
|
11
10
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringEntries, normalizeTrimmedStringList, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
12
11
|
import { buildChannelInboundMediaPayload, createChannelPartialDeliveryError, formatInboundEnvelope, formatInboundFromLabel, formatInboundMediaUnavailableText, formatMediaPlaceholderText, implicitMentionKindWhen, isChannelPartialDeliveryError, resolveInboundMentionDecision, resolveInboundSessionEnvelopeContext, toInboundMediaFactsWithMetadata } from "openclaw/plugin-sdk/channel-inbound";
|
|
13
12
|
import { formatErrorMessage, toErrorObject } from "openclaw/plugin-sdk/error-runtime";
|
|
@@ -24,7 +23,7 @@ import { buildTtsSupplementMediaPayload, countOutboundMedia, getReplyPayloadTtsS
|
|
|
24
23
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
25
24
|
import { isRecord } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
|
|
26
25
|
import { resolveInboundLastRouteSessionKey, resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing";
|
|
27
|
-
import { runChannelProbe, sliceUtf16Safe, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
26
|
+
import { escapeRegExp, runChannelProbe, sliceUtf16Safe, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
28
27
|
import { resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
|
|
29
28
|
import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-runtime";
|
|
30
29
|
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
@@ -175,22 +174,32 @@ function resolveThreadSessionKeys$1(params) {
|
|
|
175
174
|
normalizeThreadId: (threadId) => threadId
|
|
176
175
|
});
|
|
177
176
|
}
|
|
177
|
+
function buildMattermostBotMentionPattern(username) {
|
|
178
|
+
return `(?<![a-z0-9_])@${escapeRegExp(username)}(?![a-z0-9_]|[.:-]+[a-z0-9_])`;
|
|
179
|
+
}
|
|
180
|
+
function matchesMattermostBotMention(text, botUsername) {
|
|
181
|
+
if (!botUsername) return false;
|
|
182
|
+
return new RegExp(buildMattermostBotMentionPattern(botUsername), "i").test(text);
|
|
183
|
+
}
|
|
178
184
|
/**
|
|
179
185
|
* Strip bot mention from message text while preserving newlines and
|
|
180
186
|
* block-level Markdown formatting (headings, lists, blockquotes).
|
|
181
187
|
*/
|
|
182
188
|
function normalizeMention(text, mention) {
|
|
183
189
|
if (!mention) return text.trim();
|
|
184
|
-
const
|
|
185
|
-
const hasMentionRe = new RegExp(
|
|
186
|
-
const leadingMentionRe = new RegExp(`^([\\t ]*)
|
|
187
|
-
const trailingMentionRe = new RegExp(`[\\t ]
|
|
190
|
+
const pattern = buildMattermostBotMentionPattern(mention);
|
|
191
|
+
const hasMentionRe = new RegExp(pattern, "i");
|
|
192
|
+
const leadingMentionRe = new RegExp(`^([\\t ]*)${pattern}[\\t ]*`, "i");
|
|
193
|
+
const trailingMentionRe = new RegExp(`[\\t ]*${pattern}[\\t ]*$`, "i");
|
|
188
194
|
const normalizedLines = text.split("\n").map((line) => {
|
|
189
|
-
|
|
190
|
-
|
|
195
|
+
if (!hasMentionRe.test(line)) return {
|
|
196
|
+
text: line,
|
|
197
|
+
mentionOnlyBlank: false
|
|
198
|
+
};
|
|
199
|
+
const normalizedLine = line.replace(leadingMentionRe, "$1").replace(trailingMentionRe, "").replace(new RegExp(pattern, "gi"), "").replace(/(\S)[ \t]{2,}/g, "$1 ");
|
|
191
200
|
return {
|
|
192
201
|
text: normalizedLine,
|
|
193
|
-
mentionOnlyBlank:
|
|
202
|
+
mentionOnlyBlank: normalizedLine.trim() === ""
|
|
194
203
|
};
|
|
195
204
|
});
|
|
196
205
|
while (normalizedLines[0]?.mentionOnlyBlank) normalizedLines.shift();
|
|
@@ -793,33 +802,26 @@ async function buildMattermostEventPlan(monitor, params) {
|
|
|
793
802
|
OriginatingChannel: "mattermost",
|
|
794
803
|
OriginatingTo: to
|
|
795
804
|
}),
|
|
796
|
-
createReplyPlan: () => {
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
error
|
|
817
|
-
});
|
|
818
|
-
}
|
|
819
|
-
} },
|
|
820
|
-
replyOptions: { disableBlockStreaming: typeof monitor.account.blockStreaming === "boolean" ? !monitor.account.blockStreaming : void 0 }
|
|
821
|
-
};
|
|
822
|
-
}
|
|
805
|
+
createReplyPlan: () => ({
|
|
806
|
+
textLimit: monitor.core.channel.text.resolveTextChunkLimit(monitor.cfg, "mattermost", monitor.account.accountId, { fallbackLimit: monitor.account.textChunkLimit ?? 4e3 }),
|
|
807
|
+
tableMode: monitor.core.channel.text.resolveMarkdownTableMode({
|
|
808
|
+
cfg: monitor.cfg,
|
|
809
|
+
channel: "mattermost",
|
|
810
|
+
accountId: monitor.account.accountId
|
|
811
|
+
}),
|
|
812
|
+
replyPipeline: { typing: {
|
|
813
|
+
start: () => monitor.resources.sendTypingIndicator(params.channelId, thread.effectiveReplyToId),
|
|
814
|
+
onStartError: (error) => {
|
|
815
|
+
logTypingFailure({
|
|
816
|
+
log: monitor.logDebugMessage,
|
|
817
|
+
channel: "mattermost",
|
|
818
|
+
target: params.channelId,
|
|
819
|
+
error
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
} },
|
|
823
|
+
replyOptions: { disableBlockStreaming: typeof monitor.account.blockStreaming === "boolean" ? !monitor.account.blockStreaming : void 0 }
|
|
824
|
+
})
|
|
823
825
|
};
|
|
824
826
|
}
|
|
825
827
|
//#endregion
|
|
@@ -894,7 +896,7 @@ function registerMattermostInteractions(params) {
|
|
|
894
896
|
dropLabel: "interaction dispatch"
|
|
895
897
|
});
|
|
896
898
|
if (!eventPlan) return;
|
|
897
|
-
const { channelDisplay, kind, route, thread, to } = eventPlan;
|
|
899
|
+
const { channelDisplay, channelId, kind, route, thread, to } = eventPlan;
|
|
898
900
|
const bodyText = `[Button click: user @${button.userName} selected "${button.actionName}"]`;
|
|
899
901
|
const ctxPayload = eventPlan.finalizeContext({
|
|
900
902
|
Body: bodyText,
|
|
@@ -908,7 +910,7 @@ function registerMattermostInteractions(params) {
|
|
|
908
910
|
WasMentioned: true,
|
|
909
911
|
CommandAuthorized: false
|
|
910
912
|
});
|
|
911
|
-
const {
|
|
913
|
+
const { replyOptions, replyPipeline, tableMode, textLimit } = eventPlan.createReplyPlan();
|
|
912
914
|
await core.channel.inbound.dispatch({
|
|
913
915
|
cfg,
|
|
914
916
|
channel: "mattermost",
|
|
@@ -926,7 +928,7 @@ function registerMattermostInteractions(params) {
|
|
|
926
928
|
core,
|
|
927
929
|
cfg,
|
|
928
930
|
payload,
|
|
929
|
-
|
|
931
|
+
channelId,
|
|
930
932
|
accountId: account.accountId,
|
|
931
933
|
agentId: route.agentId,
|
|
932
934
|
replyToId: resolveMattermostInteractionReplyRootId({
|
|
@@ -938,8 +940,7 @@ function registerMattermostInteractions(params) {
|
|
|
938
940
|
}),
|
|
939
941
|
textLimit,
|
|
940
942
|
tableMode,
|
|
941
|
-
sendMessage: sendMessageMattermost
|
|
942
|
-
onDmChannelResolution: deliveryBarrier.trackDmChannelResolution
|
|
943
|
+
sendMessage: sendMessageMattermost
|
|
943
944
|
});
|
|
944
945
|
if (result.visibleReplySent) runtime.log?.(`delivered button-click reply to ${to}`);
|
|
945
946
|
return result;
|
|
@@ -949,11 +950,7 @@ function registerMattermostInteractions(params) {
|
|
|
949
950
|
}
|
|
950
951
|
},
|
|
951
952
|
replyPipeline,
|
|
952
|
-
dispatcherOptions: {
|
|
953
|
-
resolveFollowupAdmissionBarrierTimeoutPolicy: deliveryBarrier.resolveTimeoutPolicy,
|
|
954
|
-
onDeliverySettled: deliveryBarrier.markDeliverySettled,
|
|
955
|
-
humanDelay: resolveHumanDelayConfig(cfg, route.agentId)
|
|
956
|
-
},
|
|
953
|
+
dispatcherOptions: { humanDelay: resolveHumanDelayConfig(cfg, route.agentId) },
|
|
957
954
|
replyOptions
|
|
958
955
|
});
|
|
959
956
|
},
|
|
@@ -963,7 +960,6 @@ function registerMattermostInteractions(params) {
|
|
|
963
960
|
source: "mattermost-interactions",
|
|
964
961
|
accountId: account.accountId,
|
|
965
962
|
log: (message) => runtime.log?.(message),
|
|
966
|
-
replaceExisting: true,
|
|
967
963
|
throwOnFailure: true
|
|
968
964
|
});
|
|
969
965
|
}
|
|
@@ -973,7 +969,7 @@ function createMattermostModelPickerInteractionHandler(monitor) {
|
|
|
973
969
|
const { account, cfg, core, pairing, resources, runtime } = monitor;
|
|
974
970
|
const { resolveChannelInfo, updateModelPickerPost } = resources;
|
|
975
971
|
const runModelPickerCommand = async (params) => {
|
|
976
|
-
const { channelDisplay, kind, roomLabel, route, thread
|
|
972
|
+
const { channelDisplay, channelId, kind, roomLabel, route, thread } = params.eventPlan;
|
|
977
973
|
const fromLabel = kind === "direct" ? `Mattermost DM from ${params.senderName}` : `Mattermost message in ${roomLabel} from ${params.senderName}`;
|
|
978
974
|
const ctxPayload = params.eventPlan.finalizeContext({
|
|
979
975
|
Body: params.commandText,
|
|
@@ -989,7 +985,7 @@ function createMattermostModelPickerInteractionHandler(monitor) {
|
|
|
989
985
|
CommandAuthorized: params.commandAuthorized,
|
|
990
986
|
CommandSource: "native"
|
|
991
987
|
});
|
|
992
|
-
const {
|
|
988
|
+
const { replyOptions, replyPipeline, tableMode, textLimit } = params.eventPlan.createReplyPlan();
|
|
993
989
|
await core.channel.inbound.dispatch({
|
|
994
990
|
cfg,
|
|
995
991
|
channel: "mattermost",
|
|
@@ -1011,7 +1007,7 @@ function createMattermostModelPickerInteractionHandler(monitor) {
|
|
|
1011
1007
|
core,
|
|
1012
1008
|
cfg,
|
|
1013
1009
|
payload: trimmedPayload,
|
|
1014
|
-
|
|
1010
|
+
channelId,
|
|
1015
1011
|
accountId: account.accountId,
|
|
1016
1012
|
agentId: route.agentId,
|
|
1017
1013
|
replyToId: resolveMattermostInteractionReplyRootId({
|
|
@@ -1023,8 +1019,7 @@ function createMattermostModelPickerInteractionHandler(monitor) {
|
|
|
1023
1019
|
}),
|
|
1024
1020
|
textLimit,
|
|
1025
1021
|
tableMode: "off",
|
|
1026
|
-
sendMessage: sendMessageMattermost
|
|
1027
|
-
onDmChannelResolution: deliveryBarrier.trackDmChannelResolution
|
|
1022
|
+
sendMessage: sendMessageMattermost
|
|
1028
1023
|
});
|
|
1029
1024
|
},
|
|
1030
1025
|
onError: (err, info) => {
|
|
@@ -1032,10 +1027,6 @@ function createMattermostModelPickerInteractionHandler(monitor) {
|
|
|
1032
1027
|
}
|
|
1033
1028
|
},
|
|
1034
1029
|
replyPipeline,
|
|
1035
|
-
dispatcherOptions: {
|
|
1036
|
-
resolveFollowupAdmissionBarrierTimeoutPolicy: deliveryBarrier.resolveTimeoutPolicy,
|
|
1037
|
-
onDeliverySettled: deliveryBarrier.markDeliverySettled
|
|
1038
|
-
},
|
|
1039
1030
|
replyOptions
|
|
1040
1031
|
});
|
|
1041
1032
|
};
|
|
@@ -1224,9 +1215,11 @@ function formatMattermostInboundMediaText(params) {
|
|
|
1224
1215
|
const materializedCount = params.materializedMedia.filter((media) => Boolean(media.path) || Boolean(media.url)).length;
|
|
1225
1216
|
const unavailableCount = Math.max(0, params.nativeMedia.length - materializedCount);
|
|
1226
1217
|
if (unavailableCount === 0) return params.body;
|
|
1218
|
+
const unavailableFileNames = params.materializedMedia.filter((media) => !media.path && !media.url && media.fileName).map((media) => sanitizeUntrustedFileName(media.fileName ?? "", "")).filter(Boolean).join(", ");
|
|
1219
|
+
const fileNameNotice = unavailableFileNames ? ` ${JSON.stringify(truncateUtf16Safe(unavailableFileNames, 512))}` : "";
|
|
1227
1220
|
return formatInboundMediaUnavailableText({
|
|
1228
1221
|
body: params.body,
|
|
1229
|
-
notice: `[mattermost ${unavailableCount > 1 ? `${unavailableCount} attachments` : "attachment"} unavailable]`
|
|
1222
|
+
notice: `[mattermost ${unavailableCount > 1 ? `${unavailableCount} attachments` : "attachment"} unavailable]${fileNameNotice}`
|
|
1230
1223
|
});
|
|
1231
1224
|
}
|
|
1232
1225
|
const CHANNEL_CACHE_TTL_MS = 5 * 6e4;
|
|
@@ -1282,18 +1275,22 @@ function createMattermostMonitorResources(params) {
|
|
|
1282
1275
|
out.push({
|
|
1283
1276
|
path: saved.path,
|
|
1284
1277
|
contentType,
|
|
1278
|
+
...saved.fileName ? { fileName: saved.fileName } : {},
|
|
1285
1279
|
kind: mediaKindFromMime(contentType) ?? "unknown"
|
|
1286
1280
|
});
|
|
1287
1281
|
} catch (err) {
|
|
1288
1282
|
logger.debug?.(`mattermost: failed to download file ${fileId}: ${String(err)}`);
|
|
1289
|
-
let
|
|
1283
|
+
let info;
|
|
1290
1284
|
try {
|
|
1291
|
-
|
|
1285
|
+
info = await client.request(`/files/${fileId}/info`);
|
|
1292
1286
|
} catch (infoErr) {
|
|
1293
1287
|
logger.debug?.(`mattermost: failed to resolve metadata for file ${fileId}: ${String(infoErr)}`);
|
|
1294
1288
|
}
|
|
1289
|
+
const contentType = info?.mime_type?.trim() || void 0;
|
|
1290
|
+
const fileName = info?.name?.trim();
|
|
1295
1291
|
out.push({
|
|
1296
1292
|
contentType,
|
|
1293
|
+
...fileName ? { fileName } : {},
|
|
1297
1294
|
kind: mediaKindFromMime(contentType) ?? "unknown"
|
|
1298
1295
|
});
|
|
1299
1296
|
}
|
|
@@ -1719,9 +1716,9 @@ async function deliverMattermostReplyWithDraftPreview(params) {
|
|
|
1719
1716
|
confirmedPreviewDelivery = previewFinalResolution?.confirmedDelivery;
|
|
1720
1717
|
previewFinalDeliveryText = previewFinalResolution?.deliveryText;
|
|
1721
1718
|
previewFinalTextAlreadyDelivered = previewFinalResolution?.alreadyDelivered === true && payload.isError !== true;
|
|
1722
|
-
useConfirmedPreviewAsWholeFinal = previewFinalTextAlreadyDelivered && !resolveSendableOutboundReplyParts(payload).hasMedia;
|
|
1719
|
+
useConfirmedPreviewAsWholeFinal = previewFinalTextAlreadyDelivered && !resolveSendableOutboundReplyParts(payload).hasMedia && !payload.presentation;
|
|
1723
1720
|
const previewFinalText = previewFinalResolution?.editText;
|
|
1724
|
-
if (hasMedia && !ttsSupplement || typeof previewFinalText !== "string" || payload.isError || !canFinalizeMattermostPreviewInPlace({
|
|
1721
|
+
if (hasMedia && !ttsSupplement || typeof previewFinalText !== "string" || payload.isError || payload.presentation || !canFinalizeMattermostPreviewInPlace({
|
|
1725
1722
|
kind: params.kind,
|
|
1726
1723
|
previewRootId: params.effectiveReplyToId,
|
|
1727
1724
|
threadRootId: params.effectiveReplyToId,
|
|
@@ -1867,7 +1864,7 @@ async function dispatchMattermostInboundTurn(monitor, params) {
|
|
|
1867
1864
|
const { channelHistories, ctxPayload, eventPlan, historyKey, historyLimit, pinnedMainDmOwner, post, rawText, turnAdoptionLifecycle } = params;
|
|
1868
1865
|
const { channelId, kind, route, senderId, thread, to } = eventPlan;
|
|
1869
1866
|
const { effectiveReplyToId } = thread;
|
|
1870
|
-
const {
|
|
1867
|
+
const { replyOptions, replyPipeline: baseReplyPipeline, tableMode, textLimit } = eventPlan.createReplyPlan();
|
|
1871
1868
|
const chunkMode = core.channel.text.resolveChunkMode(cfg, "mattermost", account.accountId);
|
|
1872
1869
|
const { onModelSelected, typingCallbacks, resolveResponsePrefix, ...dispatcherPipeline } = createChannelMessageReplyPipeline({
|
|
1873
1870
|
cfg,
|
|
@@ -1989,8 +1986,6 @@ async function dispatchMattermostInboundTurn(monitor, params) {
|
|
|
1989
1986
|
};
|
|
1990
1987
|
const dispatcherOptions = {
|
|
1991
1988
|
...dispatcherPipeline,
|
|
1992
|
-
resolveFollowupAdmissionBarrierTimeoutPolicy: deliveryBarrier.resolveTimeoutPolicy,
|
|
1993
|
-
onDeliverySettled: deliveryBarrier.markDeliverySettled,
|
|
1994
1989
|
humanDelay: resolveHumanDelayConfig(cfg, route.agentId),
|
|
1995
1990
|
typingCallbacks
|
|
1996
1991
|
};
|
|
@@ -2030,7 +2025,7 @@ async function dispatchMattermostInboundTurn(monitor, params) {
|
|
|
2030
2025
|
core,
|
|
2031
2026
|
cfg,
|
|
2032
2027
|
payload: resolvedPayload,
|
|
2033
|
-
|
|
2028
|
+
channelId,
|
|
2034
2029
|
accountId: account.accountId,
|
|
2035
2030
|
agentId: route.agentId,
|
|
2036
2031
|
replyToId: resolveMattermostReplyRootId({
|
|
@@ -2040,8 +2035,7 @@ async function dispatchMattermostInboundTurn(monitor, params) {
|
|
|
2040
2035
|
}),
|
|
2041
2036
|
textLimit,
|
|
2042
2037
|
tableMode,
|
|
2043
|
-
sendMessage: sendMessageMattermost
|
|
2044
|
-
onDmChannelResolution: deliveryBarrier.trackDmChannelResolution
|
|
2038
|
+
sendMessage: sendMessageMattermost
|
|
2045
2039
|
}).catch((error) => {
|
|
2046
2040
|
if (isChannelPartialDeliveryError(error)) markThreadParticipation();
|
|
2047
2041
|
throw error;
|
|
@@ -2214,7 +2208,7 @@ function createMattermostPostHandler(monitor) {
|
|
|
2214
2208
|
const { account, botUserId, botUsername, cfg, core, groupPolicy, pairing, resources } = monitor;
|
|
2215
2209
|
const { resolveMattermostMedia, resolveUserInfo } = resources;
|
|
2216
2210
|
const channelHistories = /* @__PURE__ */ new Map();
|
|
2217
|
-
const historyLimit = Math.max(0, cfg.messages?.groupChat?.historyLimit ?? DEFAULT_GROUP_HISTORY_LIMIT);
|
|
2211
|
+
const historyLimit = Math.max(0, account.config.historyLimit ?? cfg.messages?.groupChat?.historyLimit ?? DEFAULT_GROUP_HISTORY_LIMIT);
|
|
2218
2212
|
return async (post, payload, turnAdoptionLifecycle, messageIds) => {
|
|
2219
2213
|
const channelId = post.channel_id ?? payload.data?.channel_id ?? payload.broadcast?.channel_id;
|
|
2220
2214
|
if (!channelId) {
|
|
@@ -2313,7 +2307,7 @@ function createMattermostPostHandler(monitor) {
|
|
|
2313
2307
|
});
|
|
2314
2308
|
monitor.logVerboseMessage(`mattermost: pairing request sender=${senderId} created=${created}`);
|
|
2315
2309
|
if (created) try {
|
|
2316
|
-
await sendMessageMattermost(`
|
|
2310
|
+
await sendMessageMattermost(`channel:${channelId}`, core.channel.pairing.buildPairingReply({
|
|
2317
2311
|
channel: "mattermost",
|
|
2318
2312
|
idLine: `Your Mattermost user id: ${senderId}`,
|
|
2319
2313
|
code
|
|
@@ -2368,7 +2362,7 @@ function createMattermostPostHandler(monitor) {
|
|
|
2368
2362
|
return;
|
|
2369
2363
|
}
|
|
2370
2364
|
const mentionRegexes = core.channel.mentions.buildMentionRegexes(cfg, route.agentId);
|
|
2371
|
-
const wasMentioned = kind !== "direct" && ((
|
|
2365
|
+
const wasMentioned = kind !== "direct" && (matchesMattermostBotMention(rawText, botUsername) || core.channel.mentions.matchesMentionPatterns(rawText, mentionRegexes));
|
|
2372
2366
|
const oncharEnabled = account.chatmode === "onchar" && kind !== "direct";
|
|
2373
2367
|
const oncharPrefixes = oncharEnabled ? resolveOncharPrefixes(account.oncharPrefixes) : [];
|
|
2374
2368
|
const oncharResult = oncharEnabled ? stripOncharPrefix(rawText, oncharPrefixes) : {
|
|
@@ -197,19 +197,6 @@ async function createMattermostDirectChannel(client, userIds, signal, timeoutMs)
|
|
|
197
197
|
timeoutMs
|
|
198
198
|
});
|
|
199
199
|
}
|
|
200
|
-
const DM_REPLY_DELIVERY_BARRIER_SLACK_MS = 6e4;
|
|
201
|
-
/** Covers DM creation retries without extending channel-delivery stalls. */
|
|
202
|
-
function resolveMattermostReplyDeliveryBarrierTimeoutMs(params) {
|
|
203
|
-
if (!params.isDirect) return;
|
|
204
|
-
const deliveryCount = Object.values(params.queuedCounts).reduce((sum, count) => sum + count, 0);
|
|
205
|
-
if (deliveryCount === 0) return;
|
|
206
|
-
const maxRetries = params.dmRetryOptions?.maxRetries ?? 3;
|
|
207
|
-
const maxDelayMs = params.dmRetryOptions?.maxDelayMs ?? 1e4;
|
|
208
|
-
const timeoutMs = params.dmRetryOptions?.timeoutMs ?? 3e4;
|
|
209
|
-
const perDeliveryTimeoutMs = (maxRetries + 1) * timeoutMs + maxRetries * maxDelayMs + DM_REPLY_DELIVERY_BARRIER_SLACK_MS;
|
|
210
|
-
const totalTimeoutMs = perDeliveryTimeoutMs * deliveryCount + Math.max(0, params.humanDelayBudgetMs ?? 0);
|
|
211
|
-
return resolveTimerTimeoutMs(Number.isFinite(totalTimeoutMs) ? totalTimeoutMs : Number.MAX_SAFE_INTEGER, perDeliveryTimeoutMs);
|
|
212
|
-
}
|
|
213
200
|
const RETRYABLE_NETWORK_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
214
201
|
"ECONNRESET",
|
|
215
202
|
"ECONNREFUSED",
|
|
@@ -382,4 +369,4 @@ async function uploadMattermostFile(client, params) {
|
|
|
382
369
|
return info;
|
|
383
370
|
}
|
|
384
371
|
//#endregion
|
|
385
|
-
export {
|
|
372
|
+
export { sendMattermostTyping as _, createMattermostPost as a, fetchMattermostChannelByName as c, fetchMattermostUser as d, fetchMattermostUserByUsername as f, readMattermostError as g, parseMattermostApiStatus as h, createMattermostDirectChannelWithRetry as i, fetchMattermostChannelPosts as l, normalizeMattermostBaseUrl as m, buildMattermostApiUrl as n, deleteMattermostPost as o, fetchMattermostUserTeams as p, createMattermostClient as r, fetchMattermostChannel as s, MattermostPostSchema as t, fetchMattermostMe as u, updateMattermostPost as v, uploadMattermostFile as y };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.js";
|
|
2
|
-
import {
|
|
2
|
+
import { v as updateMattermostPost } from "./client-DAIry9-2.js";
|
|
3
3
|
import { C as resolveClientIp, m as isTrustedProxyAddress, y as readRequestBodyWithLimit } from "./monitor-auth-CVd_4FPD.js";
|
|
4
4
|
import { createHmac } from "node:crypto";
|
|
5
5
|
import { resolveGatewayPort } from "openclaw/plugin-sdk/core";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { m as normalizeMattermostBaseUrl } from "./client-
|
|
2
|
-
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
1
|
+
import { m as normalizeMattermostBaseUrl } from "./client-DAIry9-2.js";
|
|
2
|
+
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { resolveChannelPreviewStreamMode, resolveChannelStreamingBlockCoalesce, resolveChannelStreamingBlockEnabled, resolveChannelStreamingChunkMode } from "openclaw/plugin-sdk/channel-outbound";
|
|
4
|
+
import { normalizeMessagePresentation, renderMessagePresentationFallbackText, resolveMessagePresentationControlValue } from "openclaw/plugin-sdk/interactive-runtime";
|
|
4
5
|
import { createAccountListHelpers, hasConfiguredAccountValue } from "openclaw/plugin-sdk/account-helpers";
|
|
5
6
|
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
6
7
|
import { buildSecretInputSchema, hasConfiguredSecretInput, resolveSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
@@ -83,4 +84,68 @@ function resolveMattermostReplyToMode(account, kind) {
|
|
|
83
84
|
return account.config.replyToMode ?? "off";
|
|
84
85
|
}
|
|
85
86
|
//#endregion
|
|
86
|
-
|
|
87
|
+
//#region extensions/mattermost/src/normalize.ts
|
|
88
|
+
function resolveMattermostPresentation(params) {
|
|
89
|
+
const presentation = normalizeMessagePresentation(params.presentation);
|
|
90
|
+
return {
|
|
91
|
+
text: !presentation || params.presentationTextMode === "fallback" && params.text !== void 0 ? params.text ?? "" : renderMessagePresentationFallbackText({
|
|
92
|
+
text: params.text,
|
|
93
|
+
presentation
|
|
94
|
+
}),
|
|
95
|
+
buttons: presentation ? presentation.blocks.filter((block) => block.type === "buttons").map((block) => block.buttons.flatMap((button) => {
|
|
96
|
+
if (button.action) return [];
|
|
97
|
+
const value = resolveMessagePresentationControlValue(button);
|
|
98
|
+
return value ? [{
|
|
99
|
+
id: value,
|
|
100
|
+
text: button.label,
|
|
101
|
+
callback_data: value,
|
|
102
|
+
context: { callback_data: value },
|
|
103
|
+
style: button.style
|
|
104
|
+
}] : [];
|
|
105
|
+
})).filter((row) => row.length > 0) : []
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function normalizeMattermostMessagingTarget(raw) {
|
|
109
|
+
const trimmed = raw.trim();
|
|
110
|
+
if (!trimmed) return;
|
|
111
|
+
const lower = normalizeLowercaseStringOrEmpty(trimmed);
|
|
112
|
+
if (lower.startsWith("channel:")) {
|
|
113
|
+
const id = trimmed.slice(8).trim();
|
|
114
|
+
return id ? `channel:${id}` : void 0;
|
|
115
|
+
}
|
|
116
|
+
if (lower.startsWith("group:")) {
|
|
117
|
+
const id = trimmed.slice(6).trim();
|
|
118
|
+
return id ? `channel:${id}` : void 0;
|
|
119
|
+
}
|
|
120
|
+
if (lower.startsWith("user:")) {
|
|
121
|
+
const id = trimmed.slice(5).trim();
|
|
122
|
+
return id ? `user:${id}` : void 0;
|
|
123
|
+
}
|
|
124
|
+
if (lower.startsWith("mattermost:")) {
|
|
125
|
+
const id = trimmed.slice(11).trim();
|
|
126
|
+
return id ? `user:${id}` : void 0;
|
|
127
|
+
}
|
|
128
|
+
if (trimmed.startsWith("@")) {
|
|
129
|
+
const id = trimmed.slice(1).trim();
|
|
130
|
+
return id ? `@${id}` : void 0;
|
|
131
|
+
}
|
|
132
|
+
if (trimmed.startsWith("#")) return;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* True when media must be uploaded as a file: any non-empty, non-http(s) value
|
|
136
|
+
* (e.g. a local workspace path) has no address the server can fetch, so the
|
|
137
|
+
* send must require a successful upload rather than degrade to caption text.
|
|
138
|
+
*/
|
|
139
|
+
function requiresMattermostMediaUpload(mediaUrl) {
|
|
140
|
+
const trimmed = mediaUrl?.trim();
|
|
141
|
+
return Boolean(trimmed && !/^https?:\/\//i.test(trimmed));
|
|
142
|
+
}
|
|
143
|
+
function looksLikeMattermostTargetId(raw, _normalized) {
|
|
144
|
+
const trimmed = raw.trim();
|
|
145
|
+
if (!trimmed) return false;
|
|
146
|
+
if (/^(user|channel|group|mattermost):/i.test(trimmed)) return true;
|
|
147
|
+
if (trimmed.startsWith("@")) return true;
|
|
148
|
+
return /^[a-z0-9]{26}$/i.test(trimmed) || /^[a-z0-9]{26}__[a-z0-9]{26}$/i.test(trimmed);
|
|
149
|
+
}
|
|
150
|
+
//#endregion
|
|
151
|
+
export { inspectMattermostAccount as a, resolveMattermostAccount as c, hasConfiguredSecretInput as d, resolveMattermostPresentation as i, resolveMattermostReplyToMode as l, normalizeMattermostMessagingTarget as n, listMattermostAccountIds as o, requiresMattermostMediaUpload as r, resolveDefaultMattermostAccountId as s, looksLikeMattermostTargetId as t, buildSecretInputSchema as u };
|
package/dist/slash-route-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as registerSlashCommandRoute } from "./slash-state-
|
|
1
|
+
import { i as registerSlashCommandRoute } from "./slash-state-CfsJU7WW.js";
|
|
2
2
|
export { registerSlashCommandRoute };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.js";
|
|
2
|
-
import { _ as
|
|
2
|
+
import { _ as sendMattermostTyping, a as createMattermostPost, c as fetchMattermostChannelByName, d as fetchMattermostUser, f as fetchMattermostUserByUsername, h as parseMattermostApiStatus, i as createMattermostDirectChannelWithRetry, m as normalizeMattermostBaseUrl, p as fetchMattermostUserTeams, r as createMattermostClient, s as fetchMattermostChannel, u as fetchMattermostMe, y as uploadMattermostFile } from "./client-DAIry9-2.js";
|
|
3
3
|
import { a as normalizeMattermostAllowList, g as loadOutboundMediaFromUrl, l as buildModelsProviderData, p as isRequestBodyLimitError, s as resolveMattermostTrustedChatKind, t as authorizeMattermostCommandInvocation, v as logTypingFailure, y as readRequestBodyWithLimit } from "./monitor-auth-CVd_4FPD.js";
|
|
4
|
-
import { c as setInteractionSecret, n as buildButtonProps, o as resolveInteractionCallbackUrl } from "./interactions-
|
|
5
|
-
import {
|
|
4
|
+
import { c as setInteractionSecret, n as buildButtonProps, o as resolveInteractionCallbackUrl } from "./interactions-k47k-7SP.js";
|
|
5
|
+
import { c as resolveMattermostAccount, i as resolveMattermostPresentation, r as requiresMattermostMediaUpload } from "./normalize-bBDFEiyJ.js";
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
7
7
|
import { safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
|
|
8
8
|
import { asFiniteNumber, normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringifiedOptionalString, readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -613,42 +613,6 @@ function renderMattermostModelsPickerView(params) {
|
|
|
613
613
|
}
|
|
614
614
|
//#endregion
|
|
615
615
|
//#region extensions/mattermost/src/mattermost/reply-delivery.ts
|
|
616
|
-
function createMattermostReplyDeliveryBarrier(params) {
|
|
617
|
-
let activeDmChannelResolutions = 0;
|
|
618
|
-
let queuedDeliveryCount = 0;
|
|
619
|
-
let settledDeliveryCount = 0;
|
|
620
|
-
const trackDmChannelResolution = (resolution) => {
|
|
621
|
-
activeDmChannelResolutions += 1;
|
|
622
|
-
Promise.resolve(resolution).then(() => {
|
|
623
|
-
activeDmChannelResolutions -= 1;
|
|
624
|
-
}, () => {
|
|
625
|
-
activeDmChannelResolutions -= 1;
|
|
626
|
-
});
|
|
627
|
-
};
|
|
628
|
-
const markDeliverySettled = () => {
|
|
629
|
-
settledDeliveryCount += 1;
|
|
630
|
-
};
|
|
631
|
-
const resolveTimeoutPolicy = (context) => {
|
|
632
|
-
const { queuedCounts } = context;
|
|
633
|
-
queuedDeliveryCount = Object.values(queuedCounts).reduce((sum, count) => sum + count, 0);
|
|
634
|
-
const maxTimeoutMs = resolveMattermostReplyDeliveryBarrierTimeoutMs({
|
|
635
|
-
isDirect: params.isDirect,
|
|
636
|
-
dmRetryOptions: params.dmRetryOptions,
|
|
637
|
-
queuedCounts,
|
|
638
|
-
humanDelayBudgetMs: context.humanDelayBudgetMs
|
|
639
|
-
});
|
|
640
|
-
if (maxTimeoutMs === void 0) return;
|
|
641
|
-
return {
|
|
642
|
-
maxTimeoutMs,
|
|
643
|
-
shouldExtend: () => activeDmChannelResolutions > 0 || settledDeliveryCount < queuedDeliveryCount
|
|
644
|
-
};
|
|
645
|
-
};
|
|
646
|
-
return {
|
|
647
|
-
trackDmChannelResolution,
|
|
648
|
-
markDeliverySettled,
|
|
649
|
-
resolveTimeoutPolicy
|
|
650
|
-
};
|
|
651
|
-
}
|
|
652
616
|
/** Represents distinct provider posts without collapsing their visible boundary. */
|
|
653
617
|
function joinMattermostVisibleContent(contents) {
|
|
654
618
|
return contents.filter((content) => Boolean(content)).join("\n");
|
|
@@ -659,39 +623,35 @@ async function deliverMattermostReplyPayload(params) {
|
|
|
659
623
|
visibleReplySent: false,
|
|
660
624
|
suppression: { reason: "no_visible_result" }
|
|
661
625
|
};
|
|
662
|
-
const
|
|
626
|
+
const presentation = resolveMattermostPresentation(params.payload);
|
|
627
|
+
const reply = resolveSendableOutboundReplyParts(params.payload, { text: params.core.channel.text.convertMarkdownTables(presentation.text, params.tableMode) });
|
|
663
628
|
const mediaLocalRoots = getAgentScopedMediaLocalRoots(params.cfg, params.agentId);
|
|
664
629
|
const chunkMode = params.core.channel.text.resolveChunkMode(params.cfg, "mattermost", params.accountId);
|
|
665
630
|
const results = [];
|
|
666
631
|
const acceptedContents = [];
|
|
632
|
+
const sendAccepted = async (text, mediaUrl) => {
|
|
633
|
+
const result = await params.sendMessage(`channel:${params.channelId}`, text, {
|
|
634
|
+
cfg: params.cfg,
|
|
635
|
+
accountId: params.accountId,
|
|
636
|
+
...mediaUrl ? {
|
|
637
|
+
mediaUrl,
|
|
638
|
+
mediaLocalRoots
|
|
639
|
+
} : {},
|
|
640
|
+
...requiresMattermostMediaUpload(mediaUrl) ? { requireMediaUpload: true } : {},
|
|
641
|
+
...results.length === 0 && reply.mediaUrls.length < 2 && presentation.buttons.length ? { buttons: presentation.buttons } : {},
|
|
642
|
+
replyToId: params.replyToId
|
|
643
|
+
});
|
|
644
|
+
results.push(result);
|
|
645
|
+
acceptedContents.push(result.content);
|
|
646
|
+
};
|
|
667
647
|
let outcome;
|
|
668
648
|
try {
|
|
669
649
|
outcome = await deliverTextOrMediaReply({
|
|
670
650
|
payload: params.payload,
|
|
671
651
|
text: reply.text,
|
|
672
652
|
chunkText: (value) => params.core.channel.text.chunkMarkdownTextWithMode(value, params.textLimit, chunkMode),
|
|
673
|
-
sendText:
|
|
674
|
-
|
|
675
|
-
cfg: params.cfg,
|
|
676
|
-
accountId: params.accountId,
|
|
677
|
-
replyToId: params.replyToId,
|
|
678
|
-
...params.onDmChannelResolution ? { onDmChannelResolution: params.onDmChannelResolution } : {}
|
|
679
|
-
});
|
|
680
|
-
results.push(result);
|
|
681
|
-
acceptedContents.push(result.content);
|
|
682
|
-
},
|
|
683
|
-
sendMedia: async ({ mediaUrl, caption }) => {
|
|
684
|
-
const result = await params.sendMessage(params.to, caption ?? "", {
|
|
685
|
-
cfg: params.cfg,
|
|
686
|
-
accountId: params.accountId,
|
|
687
|
-
mediaUrl,
|
|
688
|
-
mediaLocalRoots,
|
|
689
|
-
replyToId: params.replyToId,
|
|
690
|
-
...params.onDmChannelResolution ? { onDmChannelResolution: params.onDmChannelResolution } : {}
|
|
691
|
-
});
|
|
692
|
-
results.push(result);
|
|
693
|
-
acceptedContents.push(result.content);
|
|
694
|
-
}
|
|
653
|
+
sendText: sendAccepted,
|
|
654
|
+
sendMedia: ({ mediaUrl, caption }) => sendAccepted(caption ?? "", mediaUrl)
|
|
695
655
|
});
|
|
696
656
|
} catch (error) {
|
|
697
657
|
const failedPartial = isChannelPartialDeliveryError(error) ? error.deliveryResult : void 0;
|
|
@@ -1014,7 +974,7 @@ async function resolveTargetChannelId(params) {
|
|
|
1014
974
|
const cachedDm = dmChannelCache.get(dmKey);
|
|
1015
975
|
if (cachedDm) return cachedDm;
|
|
1016
976
|
const botUser = await resolveBotUser(params.baseUrl, params.token, params.allowPrivateNetwork);
|
|
1017
|
-
const
|
|
977
|
+
const channel = await createMattermostDirectChannelWithRetry(createMattermostClient({
|
|
1018
978
|
baseUrl: params.baseUrl,
|
|
1019
979
|
botToken: params.token,
|
|
1020
980
|
allowPrivateNetwork: params.allowPrivateNetwork
|
|
@@ -1025,8 +985,6 @@ async function resolveTargetChannelId(params) {
|
|
|
1025
985
|
if (params.logger) params.logger.warn?.(`DM channel creation retry ${attempt} after ${delayMs}ms: ${error.message}`);
|
|
1026
986
|
}
|
|
1027
987
|
});
|
|
1028
|
-
params.onDmChannelResolution?.(resolution);
|
|
1029
|
-
const channel = await resolution;
|
|
1030
988
|
cacheOutboundEntry(dmChannelCache, dmKey, channel.id, MATTERMOST_TARGET_CACHE_MAX_ENTRIES);
|
|
1031
989
|
return channel.id;
|
|
1032
990
|
}
|
|
@@ -1069,7 +1027,6 @@ async function resolveMattermostSendContext(to, opts) {
|
|
|
1069
1027
|
token,
|
|
1070
1028
|
allowPrivateNetwork,
|
|
1071
1029
|
dmRetryOptions,
|
|
1072
|
-
onDmChannelResolution: opts.onDmChannelResolution,
|
|
1073
1030
|
logger: core.logging.shouldLogVerbose() ? logger : void 0
|
|
1074
1031
|
});
|
|
1075
1032
|
return {
|
|
@@ -1635,7 +1592,7 @@ async function handleSlashCommandAsync(params) {
|
|
|
1635
1592
|
if (pickerEntry) {
|
|
1636
1593
|
const data = await buildModelsProviderData(cfg, route.agentId);
|
|
1637
1594
|
if (data.providers.length === 0) {
|
|
1638
|
-
await sendMessageMattermost(
|
|
1595
|
+
await sendMessageMattermost(`channel:${channelId}`, "No models available.", {
|
|
1639
1596
|
cfg,
|
|
1640
1597
|
accountId: account.accountId
|
|
1641
1598
|
});
|
|
@@ -1660,7 +1617,7 @@ async function handleSlashCommandAsync(params) {
|
|
|
1660
1617
|
page: 1,
|
|
1661
1618
|
currentModel
|
|
1662
1619
|
});
|
|
1663
|
-
await sendMessageMattermost(
|
|
1620
|
+
await sendMessageMattermost(`channel:${channelId}`, view.text, {
|
|
1664
1621
|
cfg,
|
|
1665
1622
|
accountId: account.accountId,
|
|
1666
1623
|
buttons: view.buttons
|
|
@@ -1703,10 +1660,6 @@ async function handleSlashCommandAsync(params) {
|
|
|
1703
1660
|
accountId: account.accountId
|
|
1704
1661
|
});
|
|
1705
1662
|
const humanDelay = resolveHumanDelayConfig(cfg, route.agentId);
|
|
1706
|
-
const deliveryBarrier = createMattermostReplyDeliveryBarrier({
|
|
1707
|
-
isDirect: kind === "direct",
|
|
1708
|
-
dmRetryOptions: account.config.dmChannelRetry
|
|
1709
|
-
});
|
|
1710
1663
|
await core.channel.inbound.dispatch({
|
|
1711
1664
|
cfg,
|
|
1712
1665
|
channel: "mattermost",
|
|
@@ -1724,13 +1677,12 @@ async function handleSlashCommandAsync(params) {
|
|
|
1724
1677
|
core,
|
|
1725
1678
|
cfg,
|
|
1726
1679
|
payload,
|
|
1727
|
-
|
|
1680
|
+
channelId,
|
|
1728
1681
|
accountId: account.accountId,
|
|
1729
1682
|
agentId: route.agentId,
|
|
1730
1683
|
textLimit,
|
|
1731
1684
|
tableMode,
|
|
1732
|
-
sendMessage: sendMessageMattermost
|
|
1733
|
-
onDmChannelResolution: deliveryBarrier.trackDmChannelResolution
|
|
1685
|
+
sendMessage: sendMessageMattermost
|
|
1734
1686
|
});
|
|
1735
1687
|
if (result.visibleReplySent) runtime.log?.(`delivered slash reply to ${to}`);
|
|
1736
1688
|
return result;
|
|
@@ -1750,11 +1702,7 @@ async function handleSlashCommandAsync(params) {
|
|
|
1750
1702
|
});
|
|
1751
1703
|
}
|
|
1752
1704
|
} },
|
|
1753
|
-
dispatcherOptions: {
|
|
1754
|
-
resolveFollowupAdmissionBarrierTimeoutPolicy: deliveryBarrier.resolveTimeoutPolicy,
|
|
1755
|
-
onDeliverySettled: deliveryBarrier.markDeliverySettled,
|
|
1756
|
-
humanDelay
|
|
1757
|
-
},
|
|
1705
|
+
dispatcherOptions: { humanDelay },
|
|
1758
1706
|
replyOptions: { disableBlockStreaming: typeof account.blockStreaming === "boolean" ? !account.blockStreaming : void 0 }
|
|
1759
1707
|
});
|
|
1760
1708
|
}
|
|
@@ -2001,4 +1949,4 @@ function registerSlashCommandRoute(api) {
|
|
|
2001
1949
|
});
|
|
2002
1950
|
}
|
|
2003
1951
|
//#endregion
|
|
2004
|
-
export {
|
|
1952
|
+
export { registerSlashCommands as _, sendMessageMattermost as a, joinMattermostVisibleContent as c, renderMattermostModelsPickerView as d, renderMattermostProviderPickerView as f, isSlashCommandsEnabled as g, cleanupSlashCommands as h, registerSlashCommandRoute as i, buildMattermostAllowedModelRefs as l, DEFAULT_COMMAND_SPECS as m, deactivateSlashCommands as n, resolveMattermostOpaqueTarget as o, resolveMattermostModelPickerCurrentModel as p, getSlashCommandState as r, deliverMattermostReplyPayload as s, activateSlashCommands as t, parseMattermostModelPickerContext as u, resolveCallbackUrl as v, resolveSlashCommandConfig as y };
|
|
@@ -167,7 +167,9 @@ class PerMessageDeflate {
|
|
|
167
167
|
(typeof opts.serverMaxWindowBits === 'number' &&
|
|
168
168
|
opts.serverMaxWindowBits > params.server_max_window_bits))) ||
|
|
169
169
|
(typeof opts.clientMaxWindowBits === 'number' &&
|
|
170
|
-
|
|
170
|
+
(typeof params.client_max_window_bits === 'number'
|
|
171
|
+
? opts.clientMaxWindowBits > params.client_max_window_bits
|
|
172
|
+
: !params.client_max_window_bits))
|
|
171
173
|
) {
|
|
172
174
|
return false;
|
|
173
175
|
}
|
package/openclaw.plugin.json
CHANGED
|
@@ -54,6 +54,11 @@
|
|
|
54
54
|
"configWrites": {
|
|
55
55
|
"type": "boolean"
|
|
56
56
|
},
|
|
57
|
+
"historyLimit": {
|
|
58
|
+
"type": "integer",
|
|
59
|
+
"minimum": 0,
|
|
60
|
+
"maximum": 9007199254740991
|
|
61
|
+
},
|
|
57
62
|
"botToken": {
|
|
58
63
|
"anyOf": [
|
|
59
64
|
{
|
|
@@ -548,6 +553,11 @@
|
|
|
548
553
|
"configWrites": {
|
|
549
554
|
"type": "boolean"
|
|
550
555
|
},
|
|
556
|
+
"historyLimit": {
|
|
557
|
+
"type": "integer",
|
|
558
|
+
"minimum": 0,
|
|
559
|
+
"maximum": 9007199254740991
|
|
560
|
+
},
|
|
551
561
|
"botToken": {
|
|
552
562
|
"anyOf": [
|
|
553
563
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/mattermost",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.9.1-beta.1",
|
|
4
4
|
"description": "OpenClaw Mattermost channel plugin",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"ws": "8.21.
|
|
11
|
+
"ws": "8.21.3",
|
|
12
12
|
"zod": "4.4.3"
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"openclaw": ">=2026.
|
|
15
|
+
"openclaw": ">=2026.9.1-beta.1"
|
|
16
16
|
},
|
|
17
17
|
"peerDependenciesMeta": {
|
|
18
18
|
"openclaw": {
|
|
@@ -91,10 +91,10 @@
|
|
|
91
91
|
"allowInvalidConfigRecovery": true
|
|
92
92
|
},
|
|
93
93
|
"compat": {
|
|
94
|
-
"pluginApi": ">=2026.
|
|
94
|
+
"pluginApi": ">=2026.9.1-beta.1"
|
|
95
95
|
},
|
|
96
96
|
"build": {
|
|
97
|
-
"openclawVersion": "2026.
|
|
97
|
+
"openclawVersion": "2026.9.1-beta.1",
|
|
98
98
|
"bundledDist": false
|
|
99
99
|
},
|
|
100
100
|
"release": {
|