@openclaw/mattermost 2026.8.1-beta.2 → 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.
@@ -1,8 +1,8 @@
1
1
  import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.js";
2
- import { _ as resolveMattermostReplyDeliveryBarrierTimeoutMs, a as createMattermostPost, b as uploadMattermostFile, 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, v as sendMattermostTyping } from "./client-B_hd-kwM.js";
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-Du_EJMeN.js";
5
- import { i as resolveMattermostAccount } from "./accounts-DspH-NMT.js";
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";
@@ -17,26 +17,14 @@ import { FormatCapabilityProfile, convertMarkdownTables } from "openclaw/plugin-
17
17
  import { getSessionEntry, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
18
18
  import { normalizeProviderId } from "openclaw/plugin-sdk/provider-model-shared";
19
19
  import { Readable } from "node:stream";
20
+ import { truncateUtf16Safe, truncateUtf8Prefix } from "openclaw/plugin-sdk/text-utility-runtime";
20
21
  import { resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
21
22
  import { finalizeInboundContext } from "openclaw/plugin-sdk/reply-runtime";
22
- import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
23
23
  import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
24
24
  import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
25
25
  import { extensionForMime } from "openclaw/plugin-sdk/media-mime";
26
26
  import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
27
27
  const MATTERMOST_COMMAND_DESCRIPTION_MAX_BYTES = 128;
28
- function truncateMattermostCommandDescription(description) {
29
- if (Buffer.byteLength(description, "utf8") <= MATTERMOST_COMMAND_DESCRIPTION_MAX_BYTES) return description;
30
- let bytes = 0;
31
- let end = 0;
32
- for (const char of description) {
33
- const charBytes = Buffer.byteLength(char, "utf8");
34
- if (bytes + charBytes > MATTERMOST_COMMAND_DESCRIPTION_MAX_BYTES) break;
35
- bytes += charBytes;
36
- end += char.length;
37
- }
38
- return description.slice(0, end);
39
- }
40
28
  /**
41
29
  * Built-in OpenClaw commands to register as native slash commands.
42
30
  * These mirror the text-based commands already handled by the gateway.
@@ -163,7 +151,7 @@ async function registerSlashCommands(params) {
163
151
  }
164
152
  const registered = [];
165
153
  for (const spec of commands) {
166
- const description = truncateMattermostCommandDescription(spec.description);
154
+ const description = truncateUtf8Prefix(spec.description, MATTERMOST_COMMAND_DESCRIPTION_MAX_BYTES);
167
155
  const existingForTrigger = existingByTrigger.get(spec.trigger) ?? [];
168
156
  const ownedCommands = existingForTrigger.filter((cmd) => cmd.creator_id?.trim() === normalizedCreatorUserId);
169
157
  const foreignCommands = existingForTrigger.filter((cmd) => cmd.creator_id?.trim() !== normalizedCreatorUserId);
@@ -625,42 +613,6 @@ function renderMattermostModelsPickerView(params) {
625
613
  }
626
614
  //#endregion
627
615
  //#region extensions/mattermost/src/mattermost/reply-delivery.ts
628
- function createMattermostReplyDeliveryBarrier(params) {
629
- let activeDmChannelResolutions = 0;
630
- let queuedDeliveryCount = 0;
631
- let settledDeliveryCount = 0;
632
- const trackDmChannelResolution = (resolution) => {
633
- activeDmChannelResolutions += 1;
634
- Promise.resolve(resolution).then(() => {
635
- activeDmChannelResolutions -= 1;
636
- }, () => {
637
- activeDmChannelResolutions -= 1;
638
- });
639
- };
640
- const markDeliverySettled = () => {
641
- settledDeliveryCount += 1;
642
- };
643
- const resolveTimeoutPolicy = (context) => {
644
- const { queuedCounts } = context;
645
- queuedDeliveryCount = Object.values(queuedCounts).reduce((sum, count) => sum + count, 0);
646
- const maxTimeoutMs = resolveMattermostReplyDeliveryBarrierTimeoutMs({
647
- isDirect: params.isDirect,
648
- dmRetryOptions: params.dmRetryOptions,
649
- queuedCounts,
650
- humanDelayBudgetMs: context.humanDelayBudgetMs
651
- });
652
- if (maxTimeoutMs === void 0) return;
653
- return {
654
- maxTimeoutMs,
655
- shouldExtend: () => activeDmChannelResolutions > 0 || settledDeliveryCount < queuedDeliveryCount
656
- };
657
- };
658
- return {
659
- trackDmChannelResolution,
660
- markDeliverySettled,
661
- resolveTimeoutPolicy
662
- };
663
- }
664
616
  /** Represents distinct provider posts without collapsing their visible boundary. */
665
617
  function joinMattermostVisibleContent(contents) {
666
618
  return contents.filter((content) => Boolean(content)).join("\n");
@@ -671,39 +623,35 @@ async function deliverMattermostReplyPayload(params) {
671
623
  visibleReplySent: false,
672
624
  suppression: { reason: "no_visible_result" }
673
625
  };
674
- const reply = resolveSendableOutboundReplyParts(params.payload, { text: params.core.channel.text.convertMarkdownTables(params.payload.text ?? "", params.tableMode) });
626
+ const presentation = resolveMattermostPresentation(params.payload);
627
+ const reply = resolveSendableOutboundReplyParts(params.payload, { text: params.core.channel.text.convertMarkdownTables(presentation.text, params.tableMode) });
675
628
  const mediaLocalRoots = getAgentScopedMediaLocalRoots(params.cfg, params.agentId);
676
629
  const chunkMode = params.core.channel.text.resolveChunkMode(params.cfg, "mattermost", params.accountId);
677
630
  const results = [];
678
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
+ };
679
647
  let outcome;
680
648
  try {
681
649
  outcome = await deliverTextOrMediaReply({
682
650
  payload: params.payload,
683
651
  text: reply.text,
684
652
  chunkText: (value) => params.core.channel.text.chunkMarkdownTextWithMode(value, params.textLimit, chunkMode),
685
- sendText: async (chunk) => {
686
- const result = await params.sendMessage(params.to, chunk, {
687
- cfg: params.cfg,
688
- accountId: params.accountId,
689
- replyToId: params.replyToId,
690
- ...params.onDmChannelResolution ? { onDmChannelResolution: params.onDmChannelResolution } : {}
691
- });
692
- results.push(result);
693
- acceptedContents.push(result.content);
694
- },
695
- sendMedia: async ({ mediaUrl, caption }) => {
696
- const result = await params.sendMessage(params.to, caption ?? "", {
697
- cfg: params.cfg,
698
- accountId: params.accountId,
699
- mediaUrl,
700
- mediaLocalRoots,
701
- replyToId: params.replyToId,
702
- ...params.onDmChannelResolution ? { onDmChannelResolution: params.onDmChannelResolution } : {}
703
- });
704
- results.push(result);
705
- acceptedContents.push(result.content);
706
- }
653
+ sendText: sendAccepted,
654
+ sendMedia: ({ mediaUrl, caption }) => sendAccepted(caption ?? "", mediaUrl)
707
655
  });
708
656
  } catch (error) {
709
657
  const failedPartial = isChannelPartialDeliveryError(error) ? error.deliveryResult : void 0;
@@ -1026,7 +974,7 @@ async function resolveTargetChannelId(params) {
1026
974
  const cachedDm = dmChannelCache.get(dmKey);
1027
975
  if (cachedDm) return cachedDm;
1028
976
  const botUser = await resolveBotUser(params.baseUrl, params.token, params.allowPrivateNetwork);
1029
- const resolution = createMattermostDirectChannelWithRetry(createMattermostClient({
977
+ const channel = await createMattermostDirectChannelWithRetry(createMattermostClient({
1030
978
  baseUrl: params.baseUrl,
1031
979
  botToken: params.token,
1032
980
  allowPrivateNetwork: params.allowPrivateNetwork
@@ -1037,8 +985,6 @@ async function resolveTargetChannelId(params) {
1037
985
  if (params.logger) params.logger.warn?.(`DM channel creation retry ${attempt} after ${delayMs}ms: ${error.message}`);
1038
986
  }
1039
987
  });
1040
- params.onDmChannelResolution?.(resolution);
1041
- const channel = await resolution;
1042
988
  cacheOutboundEntry(dmChannelCache, dmKey, channel.id, MATTERMOST_TARGET_CACHE_MAX_ENTRIES);
1043
989
  return channel.id;
1044
990
  }
@@ -1081,7 +1027,6 @@ async function resolveMattermostSendContext(to, opts) {
1081
1027
  token,
1082
1028
  allowPrivateNetwork,
1083
1029
  dmRetryOptions,
1084
- onDmChannelResolution: opts.onDmChannelResolution,
1085
1030
  logger: core.logging.shouldLogVerbose() ? logger : void 0
1086
1031
  });
1087
1032
  return {
@@ -1647,7 +1592,7 @@ async function handleSlashCommandAsync(params) {
1647
1592
  if (pickerEntry) {
1648
1593
  const data = await buildModelsProviderData(cfg, route.agentId);
1649
1594
  if (data.providers.length === 0) {
1650
- await sendMessageMattermost(to, "No models available.", {
1595
+ await sendMessageMattermost(`channel:${channelId}`, "No models available.", {
1651
1596
  cfg,
1652
1597
  accountId: account.accountId
1653
1598
  });
@@ -1672,7 +1617,7 @@ async function handleSlashCommandAsync(params) {
1672
1617
  page: 1,
1673
1618
  currentModel
1674
1619
  });
1675
- await sendMessageMattermost(to, view.text, {
1620
+ await sendMessageMattermost(`channel:${channelId}`, view.text, {
1676
1621
  cfg,
1677
1622
  accountId: account.accountId,
1678
1623
  buttons: view.buttons
@@ -1690,7 +1635,10 @@ async function handleSlashCommandAsync(params) {
1690
1635
  SessionKey: route.sessionKey,
1691
1636
  AccountId: route.accountId,
1692
1637
  ChatType: chatType,
1638
+ ConversationRouteContextObserved: true,
1639
+ ConversationRoutePeerId: kind === "direct" ? senderId : channelId,
1693
1640
  ConversationLabel: fromLabel,
1641
+ GroupSpace: teamId,
1694
1642
  GroupSubject: kind !== "direct" ? channelDisplay || roomLabel : void 0,
1695
1643
  SenderName: senderName,
1696
1644
  SenderId: senderId,
@@ -1700,6 +1648,7 @@ async function handleSlashCommandAsync(params) {
1700
1648
  Timestamp: Date.now(),
1701
1649
  WasMentioned: true,
1702
1650
  CommandAuthorized: commandAuthorized,
1651
+ InboundAccessAuthorized: true,
1703
1652
  CommandSource: "native",
1704
1653
  OriginatingChannel: "mattermost",
1705
1654
  OriginatingTo: to
@@ -1711,10 +1660,6 @@ async function handleSlashCommandAsync(params) {
1711
1660
  accountId: account.accountId
1712
1661
  });
1713
1662
  const humanDelay = resolveHumanDelayConfig(cfg, route.agentId);
1714
- const deliveryBarrier = createMattermostReplyDeliveryBarrier({
1715
- isDirect: kind === "direct",
1716
- dmRetryOptions: account.config.dmChannelRetry
1717
- });
1718
1663
  await core.channel.inbound.dispatch({
1719
1664
  cfg,
1720
1665
  channel: "mattermost",
@@ -1732,13 +1677,12 @@ async function handleSlashCommandAsync(params) {
1732
1677
  core,
1733
1678
  cfg,
1734
1679
  payload,
1735
- to,
1680
+ channelId,
1736
1681
  accountId: account.accountId,
1737
1682
  agentId: route.agentId,
1738
1683
  textLimit,
1739
1684
  tableMode,
1740
- sendMessage: sendMessageMattermost,
1741
- onDmChannelResolution: deliveryBarrier.trackDmChannelResolution
1685
+ sendMessage: sendMessageMattermost
1742
1686
  });
1743
1687
  if (result.visibleReplySent) runtime.log?.(`delivered slash reply to ${to}`);
1744
1688
  return result;
@@ -1758,11 +1702,7 @@ async function handleSlashCommandAsync(params) {
1758
1702
  });
1759
1703
  }
1760
1704
  } },
1761
- dispatcherOptions: {
1762
- resolveFollowupAdmissionBarrierTimeoutPolicy: deliveryBarrier.resolveTimeoutPolicy,
1763
- onDeliverySettled: deliveryBarrier.markDeliverySettled,
1764
- humanDelay
1765
- },
1705
+ dispatcherOptions: { humanDelay },
1766
1706
  replyOptions: { disableBlockStreaming: typeof account.blockStreaming === "boolean" ? !account.blockStreaming : void 0 }
1767
1707
  });
1768
1708
  }
@@ -2009,4 +1949,4 @@ function registerSlashCommandRoute(api) {
2009
1949
  });
2010
1950
  }
2011
1951
  //#endregion
2012
- export { isSlashCommandsEnabled as _, sendMessageMattermost as a, resolveSlashCommandConfig as b, deliverMattermostReplyPayload as c, parseMattermostModelPickerContext as d, renderMattermostModelsPickerView as f, cleanupSlashCommands as g, DEFAULT_COMMAND_SPECS as h, registerSlashCommandRoute as i, joinMattermostVisibleContent as l, resolveMattermostModelPickerCurrentModel as m, deactivateSlashCommands as n, resolveMattermostOpaqueTarget as o, renderMattermostProviderPickerView as p, getSlashCommandState as r, createMattermostReplyDeliveryBarrier as s, activateSlashCommands as t, buildMattermostAllowedModelRefs as u, registerSlashCommands as v, resolveCallbackUrl as y };
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
- !params.client_max_window_bits)
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
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ws",
3
- "version": "8.21.1",
3
+ "version": "8.21.3",
4
4
  "description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js",
5
5
  "keywords": [
6
6
  "HyBi",
@@ -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.8.1-beta.2",
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.1",
11
+ "ws": "8.21.3",
12
12
  "zod": "4.4.3"
13
13
  },
14
14
  "peerDependencies": {
15
- "openclaw": ">=2026.8.1-beta.2"
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.8.1-beta.2"
94
+ "pluginApi": ">=2026.9.1-beta.1"
95
95
  },
96
96
  "build": {
97
- "openclawVersion": "2026.8.1-beta.2",
97
+ "openclawVersion": "2026.9.1-beta.1",
98
98
  "bundledDist": false
99
99
  },
100
100
  "release": {