@openclaw/mattermost 2026.7.2-beta.3 → 2026.7.2-beta.4

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 CHANGED
@@ -1,3 +1,3 @@
1
- import { r as isMattermostSenderAllowed } from "./monitor-auth-ynw9EnGC.js";
2
- import { t as buildButtonAttachments } from "./interactions-BIb5iJjA.js";
1
+ import { r as isMattermostSenderAllowed } from "./monitor-auth-4zjr5tXP.js";
2
+ import { t as buildButtonAttachments } from "./interactions-DODXaHdE.js";
3
3
  export { buildButtonAttachments, isMattermostSenderAllowed };
@@ -1,4 +1,4 @@
1
- import { a as MattermostChannelConfigSchema, c as mattermostConfigAdapter, l as mattermostMeta, n as mattermostSetupWizard, o as describeMattermostAccount, r as mattermostSetupAdapter, s as isMattermostConfigured, t as mattermostPlugin } from "./channel-plugin-runtime-BfV83pya.js";
1
+ import { c as isMattermostConfigured, i as mattermostSetupContract, l as mattermostConfigAdapter, n as mattermostSetupWizard, o as MattermostChannelConfigSchema, r as mattermostSetupAdapter, s as describeMattermostAccount, t as mattermostPlugin, u as mattermostMeta } from "./channel-plugin-runtime-CgRXlOvV.js";
2
2
  import { t as resolveMattermostGatewayAuthBypassPaths } from "./gateway-auth-bypass-CL1PxV3z.js";
3
3
  //#region extensions/mattermost/src/channel.setup.ts
4
4
  const mattermostSetupPlugin = {
@@ -32,6 +32,7 @@ const mattermostSetupPlugin = {
32
32
  },
33
33
  gateway: { resolveGatewayAuthBypassPaths: resolveMattermostGatewayAuthBypassPaths },
34
34
  setup: mattermostSetupAdapter,
35
+ setupContract: mattermostSetupContract,
35
36
  setupWizard: mattermostSetupWizard
36
37
  };
37
38
  //#endregion
@@ -25,6 +25,7 @@ import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
25
25
  import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
26
26
  import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
27
27
  import { BlockStreamingCoalesceSchema, ChannelImplicitMentionsSchema, DmPolicySchema, GroupPolicySchema, MarkdownConfigSchema, buildChannelConfigSchema, buildGroupEntrySchema, buildMultiAccountChannelSchema, requireOpenAllowFrom } from "openclaw/plugin-sdk/channel-config-schema";
28
+ import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
28
29
  import { applyAccountNameToChannelSection, applySetupAccountConfigPatch, baseUrlTextInput, createSetupTranslator, createStandardChannelSetupStatus, defineTokenCredential, formatDocsLink, migrateBaseNameToDefaultAccount, setSetupChannelEnabled } from "openclaw/plugin-sdk/setup";
29
30
  import { createSetupInputPresenceValidator } from "openclaw/plugin-sdk/setup-runtime";
30
31
  //#region extensions/mattermost/src/approval-auth.ts
@@ -414,27 +415,64 @@ const mattermostSetupAdapter = {
414
415
  message: "Mattermost requires --bot-token and --http-url (or --use-env)."
415
416
  }],
416
417
  validate: ({ input }) => {
417
- const token = input.botToken ?? input.token;
418
- const baseUrl = normalizeMattermostBaseUrl(input.httpUrl);
419
- if (!input.useEnv && (!token || !baseUrl)) return "Mattermost requires --bot-token and --http-url (or --use-env).";
420
- if (input.httpUrl && !baseUrl) return "Mattermost --http-url must include a valid base URL.";
418
+ const setupInput = input;
419
+ const token = setupInput.botToken ?? setupInput.token;
420
+ const baseUrl = normalizeMattermostBaseUrl(setupInput.httpUrl);
421
+ if (!setupInput.useEnv && (!token || !baseUrl)) return "Mattermost requires --bot-token and --http-url (or --use-env).";
422
+ if (setupInput.httpUrl && !baseUrl) return "Mattermost --http-url must include a valid base URL.";
421
423
  return null;
422
424
  }
423
425
  }),
424
426
  applyAccountConfig: ({ cfg, accountId, input }) => {
425
- const token = input.botToken ?? input.token;
426
- const baseUrl = normalizeMattermostBaseUrl(input.httpUrl);
427
+ const setupInput = input;
428
+ const token = setupInput.botToken ?? setupInput.token;
429
+ const baseUrl = normalizeMattermostBaseUrl(setupInput.httpUrl);
427
430
  return applyMattermostSetupConfigPatch({
428
431
  cfg,
429
432
  accountId,
430
- name: input.name,
431
- patch: input.useEnv ? {} : {
433
+ name: setupInput.name,
434
+ patch: setupInput.useEnv ? {} : {
432
435
  ...token ? { botToken: token } : {},
433
436
  ...baseUrl ? { baseUrl } : {}
434
437
  }
435
438
  });
436
439
  }
437
440
  };
441
+ const mattermostSetupContract = defineChannelSetupContract({
442
+ fields: {
443
+ token: {
444
+ kind: "string",
445
+ sensitive: true,
446
+ cli: {
447
+ flags: "--token <token>",
448
+ description: "Mattermost bot token"
449
+ }
450
+ },
451
+ botToken: {
452
+ kind: "string",
453
+ sensitive: true,
454
+ cli: {
455
+ flags: "--bot-token <token>",
456
+ description: "Mattermost bot token"
457
+ }
458
+ },
459
+ httpUrl: {
460
+ kind: "string",
461
+ cli: {
462
+ flags: "--http-url <url>",
463
+ description: "Mattermost server URL"
464
+ }
465
+ },
466
+ useEnv: {
467
+ kind: "boolean",
468
+ cli: {
469
+ flags: "--use-env",
470
+ description: "Use Mattermost environment credentials"
471
+ }
472
+ }
473
+ },
474
+ legacyAdapter: mattermostSetupAdapter
475
+ });
438
476
  //#endregion
439
477
  //#region extensions/mattermost/src/setup-surface.ts
440
478
  const t = createSetupTranslator();
@@ -521,7 +559,7 @@ const mattermostSetupWizard = {
521
559
  };
522
560
  //#endregion
523
561
  //#region extensions/mattermost/src/channel.ts
524
- const loadMattermostChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-DbsfMgC4.js"));
562
+ const loadMattermostChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-VRis1MN2.js"));
525
563
  function buildMattermostPresentationButtons(presentation) {
526
564
  return presentation.blocks.filter((block) => block.type === "buttons").map((block) => block.buttons.flatMap((button) => {
527
565
  if (button.action) return [];
@@ -957,6 +995,7 @@ const mattermostPlugin = createChatChannelPlugin({
957
995
  id: "mattermost",
958
996
  meta: { ...mattermostMeta },
959
997
  setup: mattermostSetupAdapter,
998
+ setupContract: mattermostSetupContract,
960
999
  setupWizard: mattermostSetupWizard,
961
1000
  capabilities: {
962
1001
  chatTypes: [
@@ -1134,4 +1173,4 @@ const mattermostPlugin = createChatChannelPlugin({
1134
1173
  outbound: mattermostOutbound
1135
1174
  });
1136
1175
  //#endregion
1137
- export { MattermostChannelConfigSchema as a, mattermostConfigAdapter as c, normalizeMattermostMessagingTarget as i, mattermostMeta as l, mattermostSetupWizard as n, describeMattermostAccount as o, mattermostSetupAdapter as r, isMattermostConfigured$1 as s, mattermostPlugin as t };
1176
+ export { normalizeMattermostMessagingTarget as a, isMattermostConfigured$1 as c, mattermostSetupContract as i, mattermostConfigAdapter as l, mattermostSetupWizard as n, MattermostChannelConfigSchema as o, mattermostSetupAdapter as r, describeMattermostAccount as s, mattermostPlugin as t, mattermostMeta as u };
@@ -1,2 +1,2 @@
1
- import { t as mattermostPlugin } from "./channel-plugin-runtime-BfV83pya.js";
1
+ import { t as mattermostPlugin } from "./channel-plugin-runtime-CgRXlOvV.js";
2
2
  export { mattermostPlugin };
@@ -1,10 +1,10 @@
1
1
  import { n as getOptionalMattermostRuntime, t as getMattermostRuntime } from "./runtime-CNB4YGqJ.js";
2
2
  import { _ as updateMattermostPost, a as createMattermostPost, f as fetchMattermostUserTeams, g as sendMattermostTyping, l as fetchMattermostMe, m as readMattermostError, n as buildMattermostApiUrl, o as deleteMattermostPost, p as normalizeMattermostBaseUrl, r as createMattermostClient, s as fetchMattermostChannel, t as MattermostPostSchema, u as fetchMattermostUser } from "./client-w0lkxuKh.js";
3
- import { C as registerPluginHttpRoute, D as resolveDefaultGroupPolicy, O as warnMissingProviderGroupPolicyFallbackOnce, T as resolveChannelMediaMaxBytes, _ as listSkillCommandsForAgents, a as normalizeMattermostAllowEntry, b as logTypingFailure, c as resolveMattermostTrustedChatKind, d as buildModelsProviderData, f as createChannelHistoryWindow, i as mapMattermostChannelTypeToChatType, l as DEFAULT_GROUP_HISTORY_LIMIT, m as createChannelPairingController, n as formatMattermostDirectMessageDropLog, p as createChannelMessageReplyPipeline, s as resolveMattermostMonitorInboundAccess, t as authorizeMattermostCommandInvocation, u as buildAgentMediaPayload, w as resolveAllowlistProviderRuntimeGroupPolicy, x as parseTcpPort, y as logInboundDrop } from "./monitor-auth-ynw9EnGC.js";
4
- import { a as resolveInteractionCallbackPath, c as setInteractionSecret, i as createMattermostInteractionHandler, n as buildButtonProps, r as computeInteractionCallbackUrl, s as setInteractionCallbackUrl } from "./interactions-BIb5iJjA.js";
3
+ import { C as resolveAllowlistProviderRuntimeGroupPolicy, D as warnMissingProviderGroupPolicyFallbackOnce, E as resolveDefaultGroupPolicy, S as registerPluginHttpRoute, a as normalizeMattermostAllowEntry, b as parseTcpPort, c as resolveMattermostTrustedChatKind, d as createChannelHistoryWindow, f as createChannelMessageReplyPipeline, g as listSkillCommandsForAgents, i as mapMattermostChannelTypeToChatType, l as DEFAULT_GROUP_HISTORY_LIMIT, n as formatMattermostDirectMessageDropLog, p as createChannelPairingController, s as resolveMattermostMonitorInboundAccess, t as authorizeMattermostCommandInvocation, u as buildModelsProviderData, v as logInboundDrop, w as resolveChannelMediaMaxBytes, y as logTypingFailure } from "./monitor-auth-4zjr5tXP.js";
4
+ import { a as resolveInteractionCallbackPath, c as setInteractionSecret, i as createMattermostInteractionHandler, n as buildButtonProps, r as computeInteractionCallbackUrl, s as setInteractionCallbackUrl } from "./interactions-DODXaHdE.js";
5
5
  import { i as resolveMattermostReplyToMode, r as resolveMattermostAccount, t as listMattermostAccountIds } from "./accounts-B-GrNVwP.js";
6
- import { i as normalizeMattermostMessagingTarget } from "./channel-plugin-runtime-BfV83pya.js";
7
- import { _ as registerSlashCommands, a as sendMessageMattermost, c as deliverMattermostReplyPayload, 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 createMattermostReplyDeliveryBarrier, t as activateSlashCommands, u as parseMattermostModelPickerContext, v as resolveCallbackUrl, y as resolveSlashCommandConfig } from "./slash-state-N-zfDDSz.js";
6
+ import { a as normalizeMattermostMessagingTarget } from "./channel-plugin-runtime-CgRXlOvV.js";
7
+ import { _ as registerSlashCommands, a as sendMessageMattermost, c as deliverMattermostReplyPayload, 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 createMattermostReplyDeliveryBarrier, t as activateSlashCommands, u as parseMattermostModelPickerContext, v as resolveCallbackUrl, y as resolveSlashCommandConfig } from "./slash-state-CFEaCLnp.js";
8
8
  import { randomUUID } from "node:crypto";
9
9
  import { resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/security-runtime";
10
10
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringEntries, normalizeTrimmedStringList, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -13,8 +13,8 @@ import { asDateTimestampMs, resolveExpiresAtMsFromDurationMs, resolveTimerTimeou
13
13
  import { readProviderJsonResponse } from "openclaw/plugin-sdk/provider-http";
14
14
  import { fetchWithSsrFGuard, isPrivateNetworkOptInEnabled, ssrfPolicyFromPrivateNetworkOptIn } from "openclaw/plugin-sdk/ssrf-runtime";
15
15
  import { z } from "zod";
16
- import { formatInboundEnvelope, formatInboundFromLabel, formatInboundMediaUnavailableText, implicitMentionKindWhen, resolveInboundMentionDecision } from "openclaw/plugin-sdk/channel-inbound";
17
- import { DEFAULT_INGRESS_ADOPTION_STALL_MS, DEFAULT_INGRESS_RETRY_DEAD_LETTER_MIN_AGE_MS, DEFAULT_INGRESS_RETRY_MAX_ATTEMPTS, bindIngressLifecycleToReplyOptions, buildChannelProgressDraftLineForEntry, createChannelIngressDrain, createChannelProgressDraftCompositor, createFinalizableDraftLifecycle, defineFinalizableLivePreviewAdapter, deliverWithFinalizableLivePreviewAdapter, resolveChannelStreamingPreviewToolProgress } from "openclaw/plugin-sdk/channel-outbound";
16
+ import { buildChannelInboundMediaPayload, formatInboundEnvelope, formatInboundFromLabel, formatInboundMediaUnavailableText, formatMediaPlaceholderText, implicitMentionKindWhen, resolveInboundMentionDecision, toInboundMediaFacts } from "openclaw/plugin-sdk/channel-inbound";
17
+ import { bindIngressLifecycleToReplyOptions, buildChannelProgressDraftLineForEntry, createChannelIngressMonitor, createChannelProgressDraftCompositor, createFinalizableDraftLifecycle, defineFinalizableLivePreviewAdapter, deliverWithFinalizableLivePreviewAdapter, resolveChannelStreamingPreviewToolProgress } from "openclaw/plugin-sdk/channel-outbound";
18
18
  import { rawDataToString } from "openclaw/plugin-sdk/webhook-ingress";
19
19
  import { resolveChannelImplicitMentions } from "openclaw/plugin-sdk/channel-ingress-runtime";
20
20
  import { buildTtsSupplementMediaPayload, countOutboundMedia, getReplyPayloadTtsSupplement, isReasoningReplyPayload } from "openclaw/plugin-sdk/reply-payload";
@@ -973,127 +973,56 @@ function resolveMattermostIngressNonRetryableFailure(error) {
973
973
  } : null;
974
974
  }
975
975
  function createMattermostIngressMonitor(options) {
976
- let queue = options.queue;
977
- let drain;
978
- let running = true;
979
- let requested = false;
980
- let pumping;
981
- let lastPrunedAt = 0;
982
- const getQueue = () => {
983
- queue ??= getMattermostRuntime().state.openChannelIngressQueue({ accountId: options.accountId });
984
- return queue;
985
- };
986
- const getDrain = () => {
987
- drain ??= createChannelIngressDrain({
988
- queue: getQueue(),
989
- adoptionStallTimeoutMs: options.adoptionStallTimeoutMs ?? DEFAULT_INGRESS_ADOPTION_STALL_MS,
990
- retryPolicy: {
991
- maxAttempts: DEFAULT_INGRESS_RETRY_MAX_ATTEMPTS,
992
- deadLetterMinAgeMs: DEFAULT_INGRESS_RETRY_DEAD_LETTER_MIN_AGE_MS
993
- },
994
- resolveNonRetryableFailure: resolveMattermostIngressNonRetryableFailure,
995
- ...options.abortSignal ? { abortSignal: options.abortSignal } : {},
996
- onLog: (message) => options.runtime.log?.(`mattermost ${message}`),
997
- dispatchClaimedEvent: async (record, lifecycle) => {
998
- if (record.payload.version !== MATTERMOST_INGRESS_PAYLOAD_VERSION) throw new MattermostIngressPermanentError("invalid-event", `Mattermost ingress row ${record.id} has an unsupported version.`);
999
- const { post, payload } = parseClaimedEvent(record.payload.rawEvent, record.id);
1000
- return await options.dispatch(post, payload, lifecycle);
1001
- }
1002
- });
1003
- return drain;
1004
- };
1005
- const pruneIfDue = async () => {
1006
- const now = Date.now();
1007
- if (now - lastPrunedAt < MATTERMOST_INGRESS_PRUNE_INTERVAL_MS) return;
1008
- await getQueue().prune({
976
+ const monitor = createChannelIngressMonitor({
977
+ queue: options.queue ?? (() => getMattermostRuntime().state.openChannelIngressQueue({ accountId: options.accountId })),
978
+ inspect: (rawEvent) => inspectMattermostIngressEvent(rawEvent),
979
+ payload: {
980
+ version: MATTERMOST_INGRESS_PAYLOAD_VERSION,
981
+ serialize: (rawEvent, { receivedAt }) => ({
982
+ receivedAt,
983
+ rawEvent
984
+ }),
985
+ deserialize: (body) => body.rawEvent,
986
+ encode: ({ body }) => ({
987
+ version: MATTERMOST_INGRESS_PAYLOAD_VERSION,
988
+ ...body
989
+ }),
990
+ decode: (payload) => ({
991
+ version: payload.version,
992
+ body: {
993
+ receivedAt: payload.receivedAt,
994
+ rawEvent: payload.rawEvent
995
+ }
996
+ }),
997
+ createClaimError: (kind, claim) => new MattermostIngressPermanentError("invalid-event", kind === "invalid-version" ? `Mattermost ingress row ${claim.id} has an unsupported version.` : `Mattermost ingress row ${claim.id} has invalid post identity.`)
998
+ },
999
+ deliver: async (rawEvent, lifecycle, claim) => {
1000
+ const { post, payload } = parseClaimedEvent(rawEvent, claim.id);
1001
+ return await options.dispatch(post, payload, lifecycle);
1002
+ },
1003
+ pollIntervalMs: options.pollIntervalMs ?? MATTERMOST_INGRESS_POLL_INTERVAL_MS,
1004
+ waitForDeliveryIdleBeforeRepump: true,
1005
+ retention: {
1006
+ pruneIntervalMs: MATTERMOST_INGRESS_PRUNE_INTERVAL_MS,
1009
1007
  completedTtlMs: MATTERMOST_INGRESS_COMPLETED_TTL_MS,
1010
1008
  completedMaxEntries: MATTERMOST_INGRESS_COMPLETED_MAX_ENTRIES,
1011
1009
  failedTtlMs: MATTERMOST_INGRESS_FAILED_TTL_MS,
1012
- failedMaxEntries: MATTERMOST_INGRESS_FAILED_MAX_ENTRIES,
1013
- now
1014
- });
1015
- lastPrunedAt = now;
1016
- };
1017
- const runPump = async () => {
1018
- try {
1019
- for (;;) {
1020
- requested = false;
1021
- await pruneIfDue();
1022
- if (!running) break;
1023
- const activeDrain = getDrain();
1024
- const { started } = await activeDrain.drainOnce();
1025
- await activeDrain.waitForIdle();
1026
- if (!running || !requested && started === 0) break;
1027
- }
1028
- } catch (error) {
1029
- options.runtime.error?.(`mattermost ingress drain failed: ${formatErrorMessage(error)}`);
1030
- } finally {
1031
- pumping = void 0;
1032
- if (running && requested) requestDrain();
1033
- }
1034
- };
1035
- const requestDrain = () => {
1036
- requested = true;
1037
- if (!running || pumping) return;
1038
- pumping = runPump();
1039
- };
1040
- const timer = setInterval(requestDrain, options.pollIntervalMs ?? MATTERMOST_INGRESS_POLL_INTERVAL_MS);
1041
- timer.unref?.();
1042
- requestDrain();
1043
- let admissionTail = Promise.resolve();
1044
- const admitOnce = async (rawEvent) => {
1045
- const facts = inspectMattermostIngressEvent(rawEvent);
1046
- if (!facts) return;
1047
- const receivedAt = Date.now();
1048
- let lastError;
1049
- for (const delayMs of [
1050
- 0,
1051
- 100,
1052
- 300
1053
- ]) {
1054
- if (delayMs > 0) await new Promise((resolve) => {
1055
- setTimeout(resolve, delayMs);
1056
- });
1057
- try {
1058
- await getQueue().enqueue(facts.eventId, {
1059
- version: MATTERMOST_INGRESS_PAYLOAD_VERSION,
1060
- receivedAt,
1061
- rawEvent
1062
- }, {
1063
- receivedAt,
1064
- laneKey: facts.laneKey
1065
- });
1066
- requestDrain();
1067
- return;
1068
- } catch (error) {
1069
- lastError = error;
1070
- }
1071
- }
1072
- throw lastError;
1073
- };
1074
- return {
1075
- receive: (rawEvent) => {
1076
- const admission = admissionTail.then(() => admitOnce(rawEvent));
1077
- admissionTail = admission.catch(() => void 0);
1078
- return admission;
1010
+ failedMaxEntries: MATTERMOST_INGRESS_FAILED_MAX_ENTRIES
1079
1011
  },
1080
- stop: async () => {
1081
- running = false;
1082
- clearInterval(timer);
1083
- await admissionTail;
1084
- drain?.dispose();
1085
- await pumping;
1086
- drain?.dispose();
1087
- await drain?.waitForIdle();
1012
+ drain: {
1013
+ resolveNonRetryableFailure: resolveMattermostIngressNonRetryableFailure,
1014
+ ...options.adoptionStallTimeoutMs === void 0 ? {} : { adoptionStallTimeoutMs: options.adoptionStallTimeoutMs },
1015
+ onLog: (message) => options.runtime.log?.(`mattermost ${message}`)
1088
1016
  },
1089
- waitForIdle: async () => {
1090
- for (;;) {
1091
- const activePump = pumping;
1092
- if (!activePump) break;
1093
- await activePump;
1094
- }
1095
- await drain?.waitForIdle();
1096
- }
1017
+ ...options.abortSignal ? { abortSignal: options.abortSignal } : {},
1018
+ createStoppedError: () => /* @__PURE__ */ new Error("Mattermost ingress is stopped."),
1019
+ onError: (error) => options.runtime.error?.(`mattermost ingress drain failed: ${formatErrorMessage(error)}`)
1020
+ });
1021
+ monitor.start();
1022
+ return {
1023
+ receive: (rawEvent) => monitor.admit(rawEvent).then(() => void 0),
1024
+ stop: monitor.stop,
1025
+ waitForIdle: monitor.waitForIdle
1097
1026
  };
1098
1027
  }
1099
1028
  //#endregion
@@ -1119,12 +1048,18 @@ function stripOncharPrefix(text, prefixes) {
1119
1048
  }
1120
1049
  //#endregion
1121
1050
  //#region extensions/mattermost/src/mattermost/monitor-resources.ts
1051
+ function buildMattermostInboundMediaPayload(media) {
1052
+ return buildChannelInboundMediaPayload(toInboundMediaFacts(media));
1053
+ }
1054
+ function formatMattermostPendingMediaText(params) {
1055
+ return [params.body, formatMediaPlaceholderText(params.media)].filter(Boolean).join("\n").trim();
1056
+ }
1122
1057
  function formatMattermostInboundMediaText(params) {
1123
- const unavailableCount = Math.max(0, params.expectedCount - params.mediaCount);
1058
+ const materializedCount = params.materializedMedia.filter((media) => Boolean(media.path) || Boolean(media.url)).length;
1059
+ const unavailableCount = Math.max(0, params.nativeMedia.length - materializedCount);
1124
1060
  if (unavailableCount === 0) return params.body;
1125
1061
  return formatInboundMediaUnavailableText({
1126
1062
  body: params.body,
1127
- mediaPlaceholder: params.mediaCount === 0 ? params.mediaPlaceholder : void 0,
1128
1063
  notice: `[mattermost ${unavailableCount > 1 ? `${unavailableCount} attachments` : "attachment"} unavailable]`
1129
1064
  });
1130
1065
  }
@@ -1158,24 +1093,44 @@ function createMattermostMonitorResources(params) {
1158
1093
  const ids = normalizeStringEntries(fileIds ?? []);
1159
1094
  if (ids.length === 0) return [];
1160
1095
  const out = [];
1161
- for (const fileId of ids) try {
1162
- const saved = await saveRemoteMedia({
1163
- url: buildMattermostApiUrl(client.baseUrl, `/files/${fileId}`),
1164
- requestInit: { headers: { Authorization: `Bearer ${client.token}` } },
1165
- filePathHint: fileId,
1166
- maxBytes: mediaMaxBytes,
1167
- ssrfPolicy: { allowedHostnames: [new URL(client.baseUrl).hostname] },
1168
- responseHeaderTimeoutMs: MATTERMOST_MEDIA_RESPONSE_HEADER_TIMEOUT_MS,
1169
- readIdleTimeoutMs: MATTERMOST_MEDIA_READ_IDLE_TIMEOUT_MS
1170
- });
1171
- const contentType = saved.contentType ?? void 0;
1172
- out.push({
1173
- path: saved.path,
1174
- contentType,
1175
- kind: mediaKindFromMime(contentType) ?? "unknown"
1176
- });
1177
- } catch (err) {
1178
- logger.debug?.(`mattermost: failed to download file ${fileId}: ${String(err)}`);
1096
+ for (const fileId of ids) {
1097
+ let downloadUrl;
1098
+ try {
1099
+ downloadUrl = buildMattermostApiUrl(client.baseUrl, `/files/${fileId}`);
1100
+ } catch (err) {
1101
+ logger.debug?.(`mattermost: failed to resolve file ${fileId}: ${String(err)}`);
1102
+ out.push({ kind: "unknown" });
1103
+ continue;
1104
+ }
1105
+ try {
1106
+ const saved = await saveRemoteMedia({
1107
+ url: downloadUrl,
1108
+ requestInit: { headers: { Authorization: `Bearer ${client.token}` } },
1109
+ filePathHint: fileId,
1110
+ maxBytes: mediaMaxBytes,
1111
+ ssrfPolicy: { allowedHostnames: [new URL(client.baseUrl).hostname] },
1112
+ responseHeaderTimeoutMs: MATTERMOST_MEDIA_RESPONSE_HEADER_TIMEOUT_MS,
1113
+ readIdleTimeoutMs: MATTERMOST_MEDIA_READ_IDLE_TIMEOUT_MS
1114
+ });
1115
+ const contentType = saved.contentType ?? void 0;
1116
+ out.push({
1117
+ path: saved.path,
1118
+ contentType,
1119
+ kind: mediaKindFromMime(contentType) ?? "unknown"
1120
+ });
1121
+ } catch (err) {
1122
+ logger.debug?.(`mattermost: failed to download file ${fileId}: ${String(err)}`);
1123
+ let contentType;
1124
+ try {
1125
+ contentType = (await client.request(`/files/${fileId}/info`)).mime_type?.trim() || void 0;
1126
+ } catch (infoErr) {
1127
+ logger.debug?.(`mattermost: failed to resolve metadata for file ${fileId}: ${String(infoErr)}`);
1128
+ }
1129
+ out.push({
1130
+ contentType,
1131
+ kind: mediaKindFromMime(contentType) ?? "unknown"
1132
+ });
1133
+ }
1179
1134
  }
1180
1135
  return out;
1181
1136
  };
@@ -1504,18 +1459,6 @@ function createDisabledMattermostDraftStream() {
1504
1459
  })
1505
1460
  };
1506
1461
  }
1507
- function buildMattermostAttachmentPlaceholder(mediaList) {
1508
- if (mediaList.length === 0) return "";
1509
- if (mediaList.length === 1) {
1510
- const media = mediaList[0];
1511
- if (!media) return "";
1512
- return `<media:${media.kind === "unknown" ? "document" : media.kind}>`;
1513
- }
1514
- const allImages = mediaList.every((media) => media.kind === "image");
1515
- const label = allImages ? "image" : "file";
1516
- const suffix = mediaList.length === 1 ? label : `${label}s`;
1517
- return `${allImages ? "<media:image>" : "<media:document>"} (${mediaList.length} ${suffix})`;
1518
- }
1519
1462
  function buildMattermostWsUrl(baseUrl) {
1520
1463
  const normalized = normalizeMattermostBaseUrl(baseUrl);
1521
1464
  if (!normalized) throw new Error("Mattermost baseUrl is required");
@@ -2233,9 +2176,14 @@ async function monitorMattermostProvider(opts = {}) {
2233
2176
  kind,
2234
2177
  sessionKey
2235
2178
  });
2179
+ const fileIds = uniqueStrings(normalizeTrimmedStringList(post.file_ids ?? []));
2180
+ const nativeMedia = fileIds.map(() => ({}));
2236
2181
  const mentionRegexes = core.channel.mentions.buildMentionRegexes(cfg, route.agentId);
2237
2182
  const wasMentioned = kind !== "direct" && ((botUsername ? normalizeLowercaseStringOrEmpty(rawText).includes(`@${normalizeLowercaseStringOrEmpty(botUsername)}`) : false) || core.channel.mentions.matchesMentionPatterns(rawText, mentionRegexes));
2238
- const pendingBody = rawText || (post.file_ids?.length ? `[Mattermost ${post.file_ids.length === 1 ? "file" : "files"}]` : "");
2183
+ const pendingBody = formatMattermostPendingMediaText({
2184
+ body: rawText,
2185
+ media: nativeMedia
2186
+ });
2239
2187
  const pendingSender = senderName;
2240
2188
  const recordPendingHistory = () => {
2241
2189
  const trimmed = pendingBody.trim();
@@ -2294,16 +2242,13 @@ async function monitorMattermostProvider(opts = {}) {
2294
2242
  recordPendingHistory();
2295
2243
  return;
2296
2244
  }
2297
- const fileIds = uniqueStrings(normalizeTrimmedStringList(post.file_ids ?? []));
2298
2245
  const mediaList = await resolveMattermostMedia(fileIds);
2299
- const mediaPlaceholder = buildMattermostAttachmentPlaceholder(mediaList);
2300
2246
  const bodyText = normalizeMention(formatMattermostInboundMediaText({
2301
- body: [oncharTriggered ? oncharResult.stripped : rawText, mediaPlaceholder].filter(Boolean).join("\n").trim(),
2302
- mediaPlaceholder,
2303
- expectedCount: fileIds.length,
2304
- mediaCount: mediaList.length
2247
+ body: oncharTriggered ? oncharResult.stripped : rawText,
2248
+ nativeMedia,
2249
+ materializedMedia: mediaList
2305
2250
  }), botUsername);
2306
- if (shouldDropEmptyMattermostBody({
2251
+ if (mediaList.length === 0 && shouldDropEmptyMattermostBody({
2307
2252
  bodyText,
2308
2253
  rawText: rawPostText,
2309
2254
  botUsername
@@ -2351,7 +2296,7 @@ async function monitorMattermostProvider(opts = {}) {
2351
2296
  })
2352
2297
  });
2353
2298
  const to = kind === "direct" ? `user:${senderId}` : `channel:${channelId}`;
2354
- const mediaPayload = buildAgentMediaPayload(mediaList);
2299
+ const mediaPayload = buildMattermostInboundMediaPayload(mediaList);
2355
2300
  const commandBody = rawText.trim();
2356
2301
  const inboundHistory = historyKey && historyLimit > 0 ? createChannelHistoryWindow({ historyMap: channelHistories }).buildInboundHistory({
2357
2302
  historyKey,
@@ -2897,7 +2842,7 @@ async function monitorMattermostProvider(opts = {}) {
2897
2842
  }
2898
2843
  //#endregion
2899
2844
  //#region extensions/mattermost/src/mattermost/probe.ts
2900
- async function probeMattermost(baseUrl, botToken, timeoutMs = 2500, allowPrivateNetwork = false) {
2845
+ async function probeMattermost(baseUrl, botToken, timeoutMs = 2500, allowPrivateNetwork = false, deps) {
2901
2846
  const normalized = normalizeMattermostBaseUrl(baseUrl);
2902
2847
  if (!normalized) return {
2903
2848
  ok: false,
@@ -2905,19 +2850,16 @@ async function probeMattermost(baseUrl, botToken, timeoutMs = 2500, allowPrivate
2905
2850
  };
2906
2851
  const url = `${normalized}/api/v4/users/me`;
2907
2852
  const start = Date.now();
2908
- const resolvedTimeoutMs = timeoutMs > 0 ? resolveTimerTimeoutMs(timeoutMs, 2500) : 0;
2909
- const controller = resolvedTimeoutMs > 0 ? new AbortController() : void 0;
2910
- let timer = null;
2911
- if (controller) timer = setTimeout(() => controller.abort(), resolvedTimeoutMs);
2853
+ const resolvedTimeoutMs = timeoutMs > 0 ? resolveTimerTimeoutMs(timeoutMs, 2500) : void 0;
2912
2854
  try {
2913
2855
  const { response: res, release } = await fetchWithSsrFGuard({
2914
2856
  url,
2915
- init: {
2916
- headers: { Authorization: `Bearer ${botToken}` },
2917
- signal: controller?.signal
2918
- },
2857
+ init: { headers: { Authorization: `Bearer ${botToken}` } },
2919
2858
  auditContext: "mattermost-probe",
2920
- policy: ssrfPolicyFromPrivateNetworkOptIn(allowPrivateNetwork)
2859
+ policy: ssrfPolicyFromPrivateNetworkOptIn(allowPrivateNetwork),
2860
+ ...resolvedTimeoutMs !== void 0 ? { timeoutMs: resolvedTimeoutMs } : {},
2861
+ ...deps?.fetchImpl ? { fetchImpl: deps.fetchImpl } : {},
2862
+ ...deps?.lookupFn ? { lookupFn: deps.lookupFn } : {}
2921
2863
  });
2922
2864
  try {
2923
2865
  const elapsedMs = Date.now() - start;
@@ -2947,8 +2889,6 @@ async function probeMattermost(baseUrl, botToken, timeoutMs = 2500, allowPrivate
2947
2889
  error: formatErrorMessage(err),
2948
2890
  elapsedMs: Date.now() - start
2949
2891
  };
2950
- } finally {
2951
- if (timer) clearTimeout(timer);
2952
2892
  }
2953
2893
  }
2954
2894
  //#endregion
@@ -1,6 +1,6 @@
1
1
  import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.js";
2
2
  import { _ as updateMattermostPost } from "./client-w0lkxuKh.js";
3
- import { E as resolveClientIp, S as readRequestBodyWithLimit, g as isTrustedProxyAddress } from "./monitor-auth-ynw9EnGC.js";
3
+ import { T as resolveClientIp, h as isTrustedProxyAddress, x as readRequestBodyWithLimit } from "./monitor-auth-4zjr5tXP.js";
4
4
  import { createHmac } from "node:crypto";
5
5
  import { safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
6
6
  import { normalizeOptionalString, normalizeStringifiedOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -1,6 +1,5 @@
1
1
  import { normalizeLowercaseStringOrEmpty, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
2
2
  import { parseTcpPort } from "openclaw/plugin-sdk/number-runtime";
3
- import { buildAgentMediaPayload } from "openclaw/plugin-sdk/agent-media-payload";
4
3
  import { resolveAllowlistMatchSimple } from "openclaw/plugin-sdk/allow-from";
5
4
  import { logInboundDrop } from "openclaw/plugin-sdk/channel-inbound";
6
5
  import { createChannelPairingController } from "openclaw/plugin-sdk/channel-pairing";
@@ -183,4 +182,4 @@ async function authorizeMattermostCommandInvocation(params) {
183
182
  };
184
183
  }
185
184
  //#endregion
186
- export { registerPluginHttpRoute as C, resolveDefaultGroupPolicy as D, resolveClientIp as E, warnMissingProviderGroupPolicyFallbackOnce as O, readRequestBodyWithLimit as S, resolveChannelMediaMaxBytes as T, listSkillCommandsForAgents as _, normalizeMattermostAllowEntry as a, logTypingFailure as b, resolveMattermostTrustedChatKind as c, buildModelsProviderData as d, createChannelHistoryWindow as f, isTrustedProxyAddress as g, isRequestBodyLimitError as h, mapMattermostChannelTypeToChatType as i, DEFAULT_GROUP_HISTORY_LIMIT as l, createChannelPairingController as m, formatMattermostDirectMessageDropLog as n, normalizeMattermostAllowList as o, createChannelMessageReplyPipeline as p, isMattermostSenderAllowed as r, resolveMattermostMonitorInboundAccess as s, authorizeMattermostCommandInvocation as t, buildAgentMediaPayload as u, loadOutboundMediaFromUrl as v, resolveAllowlistProviderRuntimeGroupPolicy as w, parseTcpPort as x, logInboundDrop as y };
185
+ export { resolveAllowlistProviderRuntimeGroupPolicy as C, warnMissingProviderGroupPolicyFallbackOnce as D, resolveDefaultGroupPolicy as E, registerPluginHttpRoute as S, resolveClientIp as T, loadOutboundMediaFromUrl as _, normalizeMattermostAllowEntry as a, parseTcpPort as b, resolveMattermostTrustedChatKind as c, createChannelHistoryWindow as d, createChannelMessageReplyPipeline as f, listSkillCommandsForAgents as g, isTrustedProxyAddress as h, mapMattermostChannelTypeToChatType as i, DEFAULT_GROUP_HISTORY_LIMIT as l, isRequestBodyLimitError as m, formatMattermostDirectMessageDropLog as n, normalizeMattermostAllowList as o, createChannelPairingController as p, isMattermostSenderAllowed as r, resolveMattermostMonitorInboundAccess as s, authorizeMattermostCommandInvocation as t, buildModelsProviderData as u, logInboundDrop as v, resolveChannelMediaMaxBytes as w, readRequestBodyWithLimit as x, logTypingFailure as y };
@@ -1,2 +1,2 @@
1
- import { r as isMattermostSenderAllowed } from "./monitor-auth-ynw9EnGC.js";
1
+ import { r as isMattermostSenderAllowed } from "./monitor-auth-4zjr5tXP.js";
2
2
  export { isMattermostSenderAllowed };
@@ -1,5 +1,4 @@
1
1
  import { r as setMattermostRuntime } from "./runtime-CNB4YGqJ.js";
2
- import { buildAgentMediaPayload } from "openclaw/plugin-sdk/agent-media-payload";
3
2
  import { resolveAllowlistMatchSimple } from "openclaw/plugin-sdk/allow-from";
4
3
  import { formatInboundFromLabel, logInboundDrop } from "openclaw/plugin-sdk/channel-inbound";
5
4
  import { createChannelPairingController } from "openclaw/plugin-sdk/channel-pairing";
@@ -18,6 +17,7 @@ import { DEFAULT_ACCOUNT_ID, buildChannelConfigSchema, createDedupeCache, isTrus
18
17
  import { chunkTextForOutbound } from "openclaw/plugin-sdk/text-chunking";
19
18
  import { applyAccountNameToChannelSection, applySetupAccountConfigPatch, migrateBaseNameToDefaultAccount } from "openclaw/plugin-sdk/setup";
20
19
  import { buildComputedAccountStatusSnapshot } from "openclaw/plugin-sdk/channel-status";
20
+ import { buildAgentMediaPayload } from "openclaw/plugin-sdk/agent-media-payload";
21
21
  import { resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
22
22
  import { normalizeAccountId, resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing";
23
23
  import { normalizeProviderId } from "openclaw/plugin-sdk/provider-model-shared";
@@ -1,2 +1,2 @@
1
- import { i as registerSlashCommandRoute } from "./slash-state-N-zfDDSz.js";
1
+ import { i as registerSlashCommandRoute } from "./slash-state-CFEaCLnp.js";
2
2
  export { registerSlashCommandRoute };
@@ -1,7 +1,7 @@
1
1
  import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.js";
2
2
  import { a as createMattermostPost, c as fetchMattermostChannelByName, d as fetchMattermostUserByUsername, f as fetchMattermostUserTeams, g as sendMattermostTyping, h as resolveMattermostReplyDeliveryBarrierTimeoutMs, i as createMattermostDirectChannelWithRetry, l as fetchMattermostMe, p as normalizeMattermostBaseUrl, r as createMattermostClient, s as fetchMattermostChannel, u as fetchMattermostUser, v as uploadMattermostFile } from "./client-w0lkxuKh.js";
3
- import { S as readRequestBodyWithLimit, b as logTypingFailure, d as buildModelsProviderData, h as isRequestBodyLimitError, o as normalizeMattermostAllowList, p as createChannelMessageReplyPipeline, t as authorizeMattermostCommandInvocation, v as loadOutboundMediaFromUrl } from "./monitor-auth-ynw9EnGC.js";
4
- import { c as setInteractionSecret, n as buildButtonProps, o as resolveInteractionCallbackUrl } from "./interactions-BIb5iJjA.js";
3
+ import { _ as loadOutboundMediaFromUrl, f as createChannelMessageReplyPipeline, m as isRequestBodyLimitError, o as normalizeMattermostAllowList, t as authorizeMattermostCommandInvocation, u as buildModelsProviderData, x as readRequestBodyWithLimit, y as logTypingFailure } from "./monitor-auth-4zjr5tXP.js";
4
+ import { c as setInteractionSecret, n as buildButtonProps, o as resolveInteractionCallbackUrl } from "./interactions-DODXaHdE.js";
5
5
  import { r as resolveMattermostAccount } from "./accounts-B-GrNVwP.js";
6
6
  import { createHash } from "node:crypto";
7
7
  import { safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
@@ -827,6 +827,35 @@ async function resolveMattermostOpaqueTarget(params) {
827
827
  //#region extensions/mattermost/src/mattermost/send.ts
828
828
  const MATTERMOST_BOT_USER_CACHE_MAX_ENTRIES = 64;
829
829
  const MATTERMOST_TARGET_CACHE_MAX_ENTRIES = 1024;
830
+ const MATTERMOST_FORMAT_PROFILE = {
831
+ mechanism: "markdown",
832
+ constructs: {
833
+ bold: "native",
834
+ italic: "native",
835
+ underline: "native",
836
+ strikethrough: "native",
837
+ spoiler: "native",
838
+ codeInline: "native",
839
+ codeBlock: "native",
840
+ codeLanguage: "native",
841
+ linkLabel: "native",
842
+ heading: "native",
843
+ bulletList: "native",
844
+ orderedList: "native",
845
+ taskList: "native",
846
+ table: "native",
847
+ blockquote: "native",
848
+ image: "native",
849
+ mention: "native"
850
+ },
851
+ chunk: {
852
+ limit: 16383,
853
+ unit: "chars"
854
+ }
855
+ };
856
+ function renderMattermostMarkdown(markdown, tableMode) {
857
+ return tableMode === "off" && MATTERMOST_FORMAT_PROFILE.constructs.table === "native" ? markdown : convertMarkdownTables(markdown, tableMode);
858
+ }
830
859
  const botUserCache = /* @__PURE__ */ new Map();
831
860
  const userByNameCache = /* @__PURE__ */ new Map();
832
861
  const channelByNameCache = /* @__PURE__ */ new Map();
@@ -1069,7 +1098,7 @@ async function sendMessageMattermost(to, text, opts) {
1069
1098
  channel: "mattermost",
1070
1099
  accountId
1071
1100
  });
1072
- message = convertMarkdownTables(message, tableMode);
1101
+ message = renderMattermostMarkdown(message, tableMode);
1073
1102
  }
1074
1103
  if (!message && (!fileIds || fileIds.length === 0)) {
1075
1104
  if (uploadError) throw new Error(`Mattermost media upload failed: ${uploadError.message}`, { cause: uploadError });
@@ -77,6 +77,7 @@ class Receiver extends Writable {
77
77
 
78
78
  this._totalPayloadLength = 0;
79
79
  this._messageLength = 0;
80
+ this._numFragments = 0;
80
81
  this._fragments = [];
81
82
 
82
83
  this._errored = false;
@@ -500,6 +501,19 @@ class Receiver extends Writable {
500
501
  return;
501
502
  }
502
503
 
504
+ if (this._maxFragments > 0 && ++this._numFragments > this._maxFragments) {
505
+ const error = this.createError(
506
+ RangeError,
507
+ 'Too many message fragments',
508
+ false,
509
+ 1008,
510
+ 'WS_ERR_TOO_MANY_BUFFERED_PARTS'
511
+ );
512
+
513
+ cb(error);
514
+ return;
515
+ }
516
+
503
517
  if (this._compressed) {
504
518
  this._state = INFLATING;
505
519
  this.decompress(data, cb);
@@ -507,22 +521,6 @@ class Receiver extends Writable {
507
521
  }
508
522
 
509
523
  if (data.length) {
510
- if (
511
- this._maxFragments > 0 &&
512
- this._fragments.length >= this._maxFragments
513
- ) {
514
- const error = this.createError(
515
- RangeError,
516
- 'Too many message fragments',
517
- false,
518
- 1008,
519
- 'WS_ERR_TOO_MANY_BUFFERED_PARTS'
520
- );
521
-
522
- cb(error);
523
- return;
524
- }
525
-
526
524
  //
527
525
  // This message is not compressed so its length is the sum of the payload
528
526
  // length of all fragments.
@@ -562,22 +560,6 @@ class Receiver extends Writable {
562
560
  return;
563
561
  }
564
562
 
565
- if (
566
- this._maxFragments > 0 &&
567
- this._fragments.length >= this._maxFragments
568
- ) {
569
- const error = this.createError(
570
- RangeError,
571
- 'Too many message fragments',
572
- false,
573
- 1008,
574
- 'WS_ERR_TOO_MANY_BUFFERED_PARTS'
575
- );
576
-
577
- cb(error);
578
- return;
579
- }
580
-
581
563
  this._fragments.push(buf);
582
564
  }
583
565
 
@@ -604,6 +586,7 @@ class Receiver extends Writable {
604
586
  this._totalPayloadLength = 0;
605
587
  this._messageLength = 0;
606
588
  this._fragmented = 0;
589
+ this._numFragments = 0;
607
590
  this._fragments = [];
608
591
 
609
592
  if (this._opcode === 2) {
@@ -43,9 +43,9 @@ class WebSocketServer extends EventEmitter {
43
43
  * called
44
44
  * @param {Function} [options.handleProtocols] A hook to handle protocols
45
45
  * @param {String} [options.host] The hostname where to bind the server
46
- * @param {Number} [options.maxBufferedChunks=1048576] The maximum number of
46
+ * @param {Number} [options.maxBufferedChunks=262144] The maximum number of
47
47
  * buffered data chunks
48
- * @param {Number} [options.maxFragments=131072] The maximum number of message
48
+ * @param {Number} [options.maxFragments=16384] The maximum number of message
49
49
  * fragments
50
50
  * @param {Number} [options.maxPayload=104857600] The maximum allowed message
51
51
  * size
@@ -69,8 +69,8 @@ class WebSocketServer extends EventEmitter {
69
69
  options = {
70
70
  allowSynchronousEvents: true,
71
71
  autoPong: true,
72
- maxBufferedChunks: 1024 * 1024,
73
- maxFragments: 128 * 1024,
72
+ maxBufferedChunks: 256 * 1024,
73
+ maxFragments: 16 * 1024,
74
74
  maxPayload: 100 * 1024 * 1024,
75
75
  skipUTF8Validation: false,
76
76
  perMessageDeflate: false,
@@ -646,9 +646,9 @@ module.exports = WebSocket;
646
646
  * masking key
647
647
  * @param {Number} [options.handshakeTimeout] Timeout in milliseconds for the
648
648
  * handshake request
649
- * @param {Number} [options.maxBufferedChunks=1048576] The maximum number of
649
+ * @param {Number} [options.maxBufferedChunks=262144] The maximum number of
650
650
  * buffered data chunks
651
- * @param {Number} [options.maxFragments=131072] The maximum number of message
651
+ * @param {Number} [options.maxFragments=16384] The maximum number of message
652
652
  * fragments
653
653
  * @param {Number} [options.maxPayload=104857600] The maximum allowed message
654
654
  * size
@@ -670,8 +670,8 @@ function initAsClient(websocket, address, protocols, options) {
670
670
  autoPong: true,
671
671
  closeTimeout: CLOSE_TIMEOUT,
672
672
  protocolVersion: protocolVersions[1],
673
- maxBufferedChunks: 1024 * 1024,
674
- maxFragments: 128 * 1024,
673
+ maxBufferedChunks: 256 * 1024,
674
+ maxFragments: 16 * 1024,
675
675
  maxPayload: 100 * 1024 * 1024,
676
676
  skipUTF8Validation: false,
677
677
  perMessageDeflate: true,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ws",
3
- "version": "8.21.0",
3
+ "version": "8.21.1",
4
4
  "description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js",
5
5
  "keywords": [
6
6
  "HyBi",
@@ -66,5 +66,9 @@
66
66
  "nyc": "^15.0.0",
67
67
  "prettier": "^3.0.0",
68
68
  "utf-8-validate": "^6.0.0"
69
+ },
70
+ "allowScripts": {
71
+ "bufferutil": true,
72
+ "utf-8-validate": true
69
73
  }
70
74
  }
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@openclaw/mattermost",
3
- "version": "2026.7.2-beta.3",
3
+ "version": "2026.7.2-beta.4",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@openclaw/mattermost",
9
- "version": "2026.7.2-beta.3",
9
+ "version": "2026.7.2-beta.4",
10
10
  "dependencies": {
11
- "ws": "8.21.0",
11
+ "ws": "8.21.1",
12
12
  "zod": "4.4.3"
13
13
  },
14
14
  "peerDependencies": {
15
- "openclaw": ">=2026.7.2-beta.3"
15
+ "openclaw": ">=2026.7.2-beta.4"
16
16
  },
17
17
  "peerDependenciesMeta": {
18
18
  "openclaw": {
@@ -21,9 +21,9 @@
21
21
  }
22
22
  },
23
23
  "node_modules/ws": {
24
- "version": "8.21.0",
25
- "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.0.tgz",
26
- "integrity": "sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==",
24
+ "version": "8.21.1",
25
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.1.tgz",
26
+ "integrity": "sha512-+0NTnW77fFN/DjQi6k/Sq/Yvk4Sgajw7urW8V+asjXnRgDs9gyGkdb7EzgfhA4goXsRIZKE28fzIXBHEzhuiWw==",
27
27
  "license": "MIT",
28
28
  "engines": {
29
29
  "node": ">=10.0.0"
@@ -7,12 +7,6 @@
7
7
  "channels": [
8
8
  "mattermost"
9
9
  ],
10
- "channelEnvVars": {
11
- "mattermost": [
12
- "MATTERMOST_BOT_TOKEN",
13
- "MATTERMOST_URL"
14
- ]
15
- },
16
10
  "configSchema": {
17
11
  "type": "object",
18
12
  "additionalProperties": false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/mattermost",
3
- "version": "2026.7.2-beta.3",
3
+ "version": "2026.7.2-beta.4",
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.0",
11
+ "ws": "8.21.1",
12
12
  "zod": "4.4.3"
13
13
  },
14
14
  "peerDependencies": {
15
- "openclaw": ">=2026.7.2-beta.3"
15
+ "openclaw": ">=2026.7.2-beta.4"
16
16
  },
17
17
  "peerDependenciesMeta": {
18
18
  "openclaw": {
@@ -26,12 +26,58 @@
26
26
  "setupEntry": "./dist/setup-entry.js",
27
27
  "channel": {
28
28
  "id": "mattermost",
29
+ "configuredState": {
30
+ "env": {
31
+ "allOf": [
32
+ "MATTERMOST_BOT_TOKEN",
33
+ "MATTERMOST_URL"
34
+ ]
35
+ }
36
+ },
29
37
  "label": "Mattermost",
30
38
  "selectionLabel": "Mattermost (plugin)",
31
39
  "docsPath": "/channels/mattermost",
32
40
  "docsLabel": "mattermost",
33
41
  "blurb": "self-hosted Slack-style chat; install the plugin to enable.",
34
- "order": 65
42
+ "order": 65,
43
+ "setup": {
44
+ "fields": [
45
+ {
46
+ "key": "token",
47
+ "kind": "string",
48
+ "sensitive": true,
49
+ "cli": {
50
+ "flags": "--token <token>",
51
+ "description": "Mattermost bot token"
52
+ }
53
+ },
54
+ {
55
+ "key": "botToken",
56
+ "kind": "string",
57
+ "sensitive": true,
58
+ "cli": {
59
+ "flags": "--bot-token <token>",
60
+ "description": "Mattermost bot token"
61
+ }
62
+ },
63
+ {
64
+ "key": "httpUrl",
65
+ "kind": "string",
66
+ "cli": {
67
+ "flags": "--http-url <url>",
68
+ "description": "Mattermost server URL"
69
+ }
70
+ },
71
+ {
72
+ "key": "useEnv",
73
+ "kind": "boolean",
74
+ "cli": {
75
+ "flags": "--use-env",
76
+ "description": "Use Mattermost environment credentials"
77
+ }
78
+ }
79
+ ]
80
+ }
35
81
  },
36
82
  "install": {
37
83
  "clawhubSpec": "clawhub:@openclaw/mattermost",
@@ -41,10 +87,10 @@
41
87
  "allowInvalidConfigRecovery": true
42
88
  },
43
89
  "compat": {
44
- "pluginApi": ">=2026.7.2-beta.3"
90
+ "pluginApi": ">=2026.7.2-beta.4"
45
91
  },
46
92
  "build": {
47
- "openclawVersion": "2026.7.2-beta.3",
93
+ "openclawVersion": "2026.7.2-beta.4",
48
94
  "bundledDist": false
49
95
  },
50
96
  "release": {