@openclaw/mattermost 2026.11.5 → 2026.11.10-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.
Files changed (30) hide show
  1. package/dist/.setup/{callback-host-Bu2cmtfI.mjs → callback-host-CRQTeNn9.mjs} +1 -2
  2. package/dist/.setup/{channel-plugin-api-CuxSSPV8.mjs → channel-plugin-api-ZcL-ciz_.mjs} +25 -36
  3. package/dist/.setup/{channel-plugin-api-ClU67Wyc.mjs → channel-plugin-api-ZioQ5n8R.mjs} +1 -1
  4. package/dist/.setup/{channel.runtime-B3RvYLQi.mjs → channel.runtime-dwusbHyN.mjs} +8 -12
  5. package/dist/.setup/{client-CR-hGmGr.mjs → client-CVipK0N2.mjs} +1 -2
  6. package/dist/.setup/{doctor-contract-CjgZkyPm.mjs → doctor-contract-i788N90j.mjs} +6 -11
  7. package/dist/.setup/{gateway-auth-bypass-Lf99Gilr.mjs → gateway-auth-bypass-DhWaV22L.mjs} +2 -3
  8. package/dist/.setup/{ingress-identity-D6hxfxvo.mjs → ingress-identity-CtHiOUDu.mjs} +0 -1
  9. package/dist/.setup/{interactions-D5hhyPam.mjs → interactions-BWApCMHC.mjs} +12 -19
  10. package/dist/.setup/{monitor-Bw_pTSF8.mjs → monitor-HCtx0DCQ.mjs} +109 -73
  11. package/dist/.setup/{monitor-auth-BxpEUfvc.mjs → monitor-auth-C9TiGGVQ.mjs} +6 -5
  12. package/dist/.setup/{normalize-CNFRtT1O.mjs → normalize-DuLSV4tT.mjs} +3 -5
  13. package/dist/.setup/{rolldown-runtime-BBjsoOtd.mjs → rolldown-runtime-782esTHO.mjs} +1 -2
  14. package/dist/.setup/{runtime-CNB4YGqJ.mjs → runtime-y_L8jPMH.mjs} +1 -2
  15. package/dist/.setup/{secret-contract-fjlTFCmD.mjs → secret-contract-BkDCURCE.mjs} +1 -2
  16. package/dist/.setup/{secret-contract-api-Drz4m5pq.mjs → secret-contract-api-DydsmAPQ.mjs} +1 -1
  17. package/dist/.setup/{send-BSae9PKV.mjs → send-Dq203uXC.mjs} +50 -37
  18. package/dist/.setup/{slash-state-DpZH2wr6.mjs → slash-state-Dyd1mDYq.mjs} +15 -18
  19. package/dist/.source-module-urls/8fb0cb1067b83fd2cf3f3ba0f7a23e627c27e8e3adf1a4ea18753ddb884ff71e.json +1 -1
  20. package/dist/api.js +2 -2
  21. package/dist/channel-plugin-api.js +1 -1
  22. package/dist/doctor-contract-api.js +1 -1
  23. package/dist/gateway-auth-api.js +1 -1
  24. package/dist/index.js +1 -2
  25. package/dist/policy-api.js +1 -1
  26. package/dist/runtime-api.js +1 -1
  27. package/dist/secret-contract-api.js +1 -1
  28. package/dist/setup-entry.js +3 -4
  29. package/dist/slash-route-api.js +1 -1
  30. package/package.json +4 -4
@@ -1,11 +1,11 @@
1
- import { a as resolveInteractionCallbackPath, c as setInteractionSecret, i as createMattermostInteractionHandler, l as gateway_config_runtime_exports, n as buildButtonProps, r as computeInteractionCallbackUrl, s as setInteractionCallbackUrl } from "./interactions-D5hhyPam.mjs";
2
- import { n as getOptionalMattermostRuntime, t as getMattermostRuntime } from "./runtime-CNB4YGqJ.mjs";
3
- import { a as createMattermostPost, d as fetchMattermostUser, h as normalizeMattermostBaseUrl, l as fetchMattermostChannelPosts, m as isRetryableError, n as buildMattermostApiUrl, o as deleteMattermostPost, p as fetchMattermostUserTeams, s as fetchMattermostChannel, t as MattermostPostSchema, u as fetchMattermostMe, v as sendMattermostTyping, y as updateMattermostPost } from "./client-CR-hGmGr.mjs";
4
- import { C as registerPluginHttpRoute, D as resolveDefaultGroupPolicy, T as resolveChannelMediaMaxBytes, b as logTypingFailure, c as shouldRetainMattermostSenderHistory, d as createChannelHistoryWindow, f as createChannelMessageReplyPipeline, h as isDangerousNameMatchingEnabled, k as warnMissingProviderGroupPolicyFallbackOnce, l as DEFAULT_GROUP_HISTORY_LIMIT, n as authorizeMattermostCommandInvocation, o as resolveMattermostMonitorInboundAccess, p as createChannelPairingController, r as formatMattermostDirectMessageDropLog, s as resolveMattermostTrustedChatKind, t as MATTERMOST_PAIRING_QUEUE_FULL_TEXT, u as buildPreparedModelsProviderData, w as resolveAllowlistProviderRuntimeGroupPolicy, x as prepareSkillCommandsForAgents, y as logInboundDrop } from "./monitor-auth-BxpEUfvc.mjs";
5
- import { n as normalizeMattermostAllowEntry } from "./ingress-identity-D6hxfxvo.mjs";
6
- import { d as resolveMattermostAccount, f as resolveMattermostReplyToMode, o as createMattermostAccountClient, r as parseMattermostQuestionContext } from "./normalize-CNFRtT1O.mjs";
7
- import { C as resolveSlashCommandConfig, S as resolveCallbackUrl, _ as resolveMattermostModelPickerCurrentModel, a as deliverMattermostReplyPayload, b as isSlashCommandsEnabled, c as canFinalizeMattermostPreviewInPlace, d as resolveMattermostReplyRootId, f as resolveMattermostThreadSessionContext, g as renderMattermostProviderPickerView, h as renderMattermostModelsPickerView, l as formatMattermostFinalDeliveryOutcomeLog, m as parseMattermostModelPickerContext, n as deactivateSlashCommands, o as joinMattermostVisibleContent, p as shouldUpdateMattermostDraftToolProgress, r as getSlashCommandState, s as buildMattermostButtonInteractionMessageSid, t as activateSlashCommands, u as resolveMattermostInteractionReplyRootId, v as DEFAULT_COMMAND_SPECS, x as registerSlashCommands, y as cleanupSlashCommands } from "./slash-state-DpZH2wr6.mjs";
8
- import { t as sendMessageMattermost } from "./send-BSae9PKV.mjs";
1
+ import { a as resolveInteractionCallbackPath, c as setInteractionSecret, i as createMattermostInteractionHandler, l as gateway_config_runtime_exports, n as buildButtonProps, r as computeInteractionCallbackUrl, s as setInteractionCallbackUrl } from "./interactions-BWApCMHC.mjs";
2
+ import { n as getOptionalMattermostRuntime, t as getMattermostRuntime } from "./runtime-y_L8jPMH.mjs";
3
+ import { a as createMattermostPost, d as fetchMattermostUser, h as normalizeMattermostBaseUrl, l as fetchMattermostChannelPosts, m as isRetryableError, n as buildMattermostApiUrl, o as deleteMattermostPost, p as fetchMattermostUserTeams, s as fetchMattermostChannel, t as MattermostPostSchema, u as fetchMattermostMe, v as sendMattermostTyping, y as updateMattermostPost } from "./client-CVipK0N2.mjs";
4
+ import { C as registerPluginHttpRoute, D as resolveDefaultGroupPolicy, T as resolveChannelMediaMaxBytes, b as logTypingFailure, c as shouldRetainMattermostSenderHistory, d as createChannelHistoryWindow, f as createChannelMessageReplyPipeline, h as isDangerousNameMatchingEnabled, k as warnMissingProviderGroupPolicyFallbackOnce, l as DEFAULT_GROUP_HISTORY_LIMIT, n as authorizeMattermostCommandInvocation, o as resolveMattermostMonitorInboundAccess, p as createChannelPairingController, r as formatMattermostDirectMessageDropLog, s as resolveMattermostTrustedChatKind, t as MATTERMOST_PAIRING_QUEUE_FULL_TEXT, u as buildPreparedModelsProviderData, w as resolveAllowlistProviderRuntimeGroupPolicy, x as prepareSkillCommandsForAgents, y as logInboundDrop } from "./monitor-auth-C9TiGGVQ.mjs";
5
+ import { n as normalizeMattermostAllowEntry } from "./ingress-identity-CtHiOUDu.mjs";
6
+ import { d as resolveMattermostAccount, f as resolveMattermostReplyToMode, o as createMattermostAccountClient, r as parseMattermostQuestionContext } from "./normalize-DuLSV4tT.mjs";
7
+ import { C as resolveSlashCommandConfig, S as resolveCallbackUrl, _ as resolveMattermostModelPickerCurrentModel, a as deliverMattermostReplyPayload, b as isSlashCommandsEnabled, c as canFinalizeMattermostPreviewInPlace, d as resolveMattermostReplyRootId, f as resolveMattermostThreadSessionContext, g as renderMattermostProviderPickerView, h as renderMattermostModelsPickerView, l as formatMattermostFinalDeliveryOutcomeLog, m as parseMattermostModelPickerContext, n as deactivateSlashCommands, o as joinMattermostVisibleContent, p as shouldUpdateMattermostDraftToolProgress, r as getSlashCommandState, s as buildMattermostButtonInteractionMessageSid, t as activateSlashCommands, u as resolveMattermostInteractionReplyRootId, v as DEFAULT_COMMAND_SPECS, x as registerSlashCommands, y as cleanupSlashCommands } from "./slash-state-Dyd1mDYq.mjs";
8
+ import { t as sendMessageMattermost } from "./send-Dq203uXC.mjs";
9
9
  import { randomUUID } from "node:crypto";
10
10
  import { resolvePinnedMainDmOwnerFromAllowlist, sanitizeUntrustedFileName } from "openclaw/plugin-sdk/security-runtime";
11
11
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringEntries, normalizeTrimmedStringList, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -20,6 +20,7 @@ import { rawDataToString } from "openclaw/plugin-sdk/webhook-ingress";
20
20
  import { fanInChannelIngressLifecycles, resolveChannelImplicitMentions } from "openclaw/plugin-sdk/channel-ingress-runtime";
21
21
  import { resolveChannelGroups, resolveChannelGroupsConfigPath } from "openclaw/plugin-sdk/channel-policy";
22
22
  import { safeParseJsonWithSchema, safeParseWithSchema } from "openclaw/plugin-sdk/extension-shared";
23
+ import { chunkMarkdownTextWithMode } from "openclaw/plugin-sdk/reply-chunking";
23
24
  import { buildTtsSupplementMediaPayload, getReplyPayloadTtsSupplement, isReasoningReplyPayload, resolveSendableOutboundReplyParts } from "openclaw/plugin-sdk/reply-payload";
24
25
  import { isRecord } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
25
26
  import { resolveHumanDelayConfig } from "openclaw/plugin-sdk/agent-runtime";
@@ -36,12 +37,11 @@ import { questionGatewayRuntime } from "openclaw/plugin-sdk/question-gateway-run
36
37
  import { mergePairLoopGuardConfig } from "openclaw/plugin-sdk/pair-loop-guard-runtime";
37
38
  import { raceWithTimeout } from "openclaw/plugin-sdk/time-runtime";
38
39
  import { getGlobalHookRunner } from "openclaw/plugin-sdk/plugin-runtime";
39
- import { chunkMarkdownTextWithMode } from "openclaw/plugin-sdk/reply-chunking";
40
40
  import { truncateWithMarker } from "openclaw/plugin-sdk/string-normalization-runtime";
41
41
  import { createPersistentDedupeCache } from "openclaw/plugin-sdk/dedupe-runtime";
42
42
  import { createPluginStateErrorReporter } from "openclaw/plugin-sdk/plugin-state-runtime";
43
43
  import { setTimeout as setTimeout$1 } from "node:timers/promises";
44
- //#region extensions/mattermost/src/mattermost/monitor-helpers.ts
44
+ // extensions/mattermost/src/mattermost/monitor-helpers.ts
45
45
  function buildMattermostBotMentionPattern(username) {
46
46
  return `(?<![a-z0-9_])@${escapeRegExp(username)}(?![a-z0-9_]|[.:-]+[a-z0-9_])`;
47
47
  }
@@ -80,8 +80,7 @@ function shouldDropEmptyMattermostBody(params) {
80
80
  const bareMention = params.rawText.match(/^[ \t]*(@\S+)[ \t]*$/u)?.[1];
81
81
  return !botUsername || normalizeLowercaseStringOrEmpty(bareMention) !== `@${botUsername}`;
82
82
  }
83
- //#endregion
84
- //#region extensions/mattermost/src/mattermost/monitor-websocket.ts
83
+ // extensions/mattermost/src/mattermost/monitor-websocket.ts
85
84
  const MATTERMOST_WEBSOCKET_MAX_PAYLOAD_BYTES = 16777216;
86
85
  const MATTERMOST_WEBSOCKET_HANDSHAKE_TIMEOUT_MS = 3e4;
87
86
  const MATTERMOST_WEBSOCKET_AUTH_TIMEOUT_MS = 3e4;
@@ -331,8 +330,7 @@ function createMattermostConnectOnce(opts) {
331
330
  }
332
331
  };
333
332
  }
334
- //#endregion
335
- //#region extensions/mattermost/src/mattermost/monitor-ingress.ts
333
+ // extensions/mattermost/src/mattermost/monitor-ingress.ts
336
334
  const MATTERMOST_INGRESS_PAYLOAD_VERSION = 1;
337
335
  const MATTERMOST_INGRESS_POLL_INTERVAL_MS = 1e3;
338
336
  const MattermostIngressPermanentError = createChannelIngressError("MattermostIngressPermanentError", { withReason: true });
@@ -441,8 +439,7 @@ function createMattermostIngressMonitor(options) {
441
439
  waitForIdle: monitor.waitForIdle
442
440
  };
443
441
  }
444
- //#endregion
445
- //#region extensions/mattermost/src/mattermost/monitor-event-plan.ts
442
+ // extensions/mattermost/src/mattermost/monitor-event-plan.ts
446
443
  async function buildMattermostEventPlan(monitor, params) {
447
444
  const channelInfo = params.channelInfo ?? await monitor.resources.resolveChannelInfo(params.channelId);
448
445
  const channelType = channelInfo?.type?.trim() || params.channelTypeFallback?.trim();
@@ -473,18 +470,22 @@ async function buildMattermostEventPlan(monitor, params) {
473
470
  threadRootId: params.threadRootId
474
471
  });
475
472
  const to = kind === "direct" ? `user:${params.senderId}` : `channel:${params.channelId}`;
473
+ const from = kind === "direct" ? `mattermost:${params.senderId}` : kind === "group" ? `mattermost:group:${params.channelId}` : `mattermost:channel:${params.channelId}`;
476
474
  return {
477
475
  channelId: params.channelId,
478
476
  senderId: params.senderId,
479
477
  kind,
480
478
  channelDisplay,
479
+ channelName,
480
+ teamId,
481
481
  roomLabel,
482
482
  route,
483
483
  thread,
484
484
  to,
485
+ from,
485
486
  finalizeContext: (context) => finalizeInboundContext({
486
487
  ...context,
487
- From: kind === "direct" ? `mattermost:${params.senderId}` : kind === "group" ? `mattermost:group:${params.channelId}` : `mattermost:channel:${params.channelId}`,
488
+ From: from,
488
489
  To: to,
489
490
  SessionKey: thread.sessionKey,
490
491
  DmScope: route.dmScope,
@@ -527,8 +528,7 @@ async function buildMattermostEventPlan(monitor, params) {
527
528
  })
528
529
  };
529
530
  }
530
- //#endregion
531
- //#region extensions/mattermost/src/mattermost/monitor-interaction-dispatch.ts
531
+ // extensions/mattermost/src/mattermost/monitor-interaction-dispatch.ts
532
532
  async function dispatchMattermostInteractionReply(monitor, eventPlan, params) {
533
533
  const { account, cfg, core, runtime } = monitor;
534
534
  const { channelId, kind, route, thread, to } = eventPlan;
@@ -581,8 +581,7 @@ async function dispatchMattermostInteractionReply(monitor, eventPlan, params) {
581
581
  replyOptions
582
582
  });
583
583
  }
584
- //#endregion
585
- //#region extensions/mattermost/src/mattermost/monitor-interactions.ts
584
+ // extensions/mattermost/src/mattermost/monitor-interactions.ts
586
585
  function registerMattermostInteractions(params) {
587
586
  const { monitor } = params;
588
587
  const { account, cfg, client, core, pairing, resources, runtime } = monitor;
@@ -726,8 +725,7 @@ function registerMattermostInteractions(params) {
726
725
  throwOnFailure: true
727
726
  });
728
727
  }
729
- //#endregion
730
- //#region extensions/mattermost/src/mattermost/monitor-model-picker.ts
728
+ // extensions/mattermost/src/mattermost/monitor-model-picker.ts
731
729
  function createMattermostModelPickerInteractionHandler(monitor) {
732
730
  const { account, cfg, core, pairing, resources, runtime } = monitor;
733
731
  const { resolveChannelInfo, updateModelPickerPost } = resources;
@@ -887,8 +885,7 @@ function createMattermostModelPickerInteractionHandler(monitor) {
887
885
  return {};
888
886
  };
889
887
  }
890
- //#endregion
891
- //#region src/channels/mention-gating.ts
888
+ // src/channels/mention-gating.ts
892
889
  function resolveBotThreadMentionPolicy(params) {
893
890
  if (!params.isBotOwnedThread || params.requireMentionInBotThreads === void 0) return {
894
891
  requireMention: params.requireMention,
@@ -899,8 +896,7 @@ function resolveBotThreadMentionPolicy(params) {
899
896
  implicitMentionKinds: params.requireMentionInBotThreads ? params.implicitMentionKinds?.filter((kind) => kind === "native") : params.implicitMentionKinds
900
897
  };
901
898
  }
902
- //#endregion
903
- //#region extensions/mattermost/src/mattermost/monitor-onchar.ts
899
+ // extensions/mattermost/src/mattermost/monitor-onchar.ts
904
900
  const DEFAULT_ONCHAR_PREFIXES = [">", "!"];
905
901
  function resolveOncharPrefixes(prefixes) {
906
902
  const cleaned = prefixes ? normalizeStringEntries(prefixes) : DEFAULT_ONCHAR_PREFIXES;
@@ -920,8 +916,7 @@ function stripOncharPrefix(text, prefixes) {
920
916
  stripped: text
921
917
  };
922
918
  }
923
- //#endregion
924
- //#region extensions/mattermost/src/mattermost/monitor-resources.ts
919
+ // extensions/mattermost/src/mattermost/monitor-resources.ts
925
920
  function formatMattermostPendingMediaText(params) {
926
921
  return [params.body, formatMediaPlaceholderText(params.media)].filter(Boolean).join("\n").trim();
927
922
  }
@@ -1055,8 +1050,7 @@ function createMattermostMonitorResources(params) {
1055
1050
  updateModelPickerPost
1056
1051
  };
1057
1052
  }
1058
- //#endregion
1059
- //#region extensions/mattermost/src/mattermost/monitor-thread-backfill.ts
1053
+ // extensions/mattermost/src/mattermost/monitor-thread-backfill.ts
1060
1054
  const TIMEOUT_MS = 5e3;
1061
1055
  const COOLDOWN_MS = 6e4;
1062
1056
  const MAX_ATTEMPTS = 3;
@@ -1106,7 +1100,7 @@ function createMattermostThreadBackfill(params) {
1106
1100
  const thread = ThreadSchema.parse(raw);
1107
1101
  const candidates = thread.order.slice(0, MAX_THREAD_POSTS).flatMap((id) => {
1108
1102
  const post = thread.posts[id];
1109
- if (!post || post.id !== id || post.id === turn.currentPostId || post.channel_id !== turn.channelId || post.id !== turn.threadRootId && post.root_id !== turn.threadRootId || post.type || !post.user_id || typeof post.create_at !== "number" || post.create_at > turn.currentPostTimestamp || !post.message?.trim() && !post.file_ids?.length) return [];
1103
+ if (!post || post.id !== id || post.id === turn.currentPostId || post.channel_id !== turn.channelId || post.id !== turn.threadRootId && post.root_id !== turn.threadRootId || post.type?.startsWith("system_") || !post.user_id || typeof post.create_at !== "number" || post.create_at > turn.currentPostTimestamp || !post.message?.trim() && !post.file_ids?.length) return [];
1110
1104
  return [post];
1111
1105
  });
1112
1106
  const senderIds = [...new Set(candidates.map((post) => post.user_id))];
@@ -1164,6 +1158,8 @@ function createMattermostThreadBackfill(params) {
1164
1158
  };
1165
1159
  return async (turn) => {
1166
1160
  if (historyLimit <= 0 || !Number.isFinite(turn.currentPostTimestamp) || turn.currentPostTimestamp <= 0) return {};
1161
+ const pendingRecovery = recoveries.get(turn.historyKey);
1162
+ const pendingHistory = pendingRecovery?.completion;
1167
1163
  let identity;
1168
1164
  try {
1169
1165
  identity = await readIdentity(turn);
@@ -1172,6 +1168,7 @@ function createMattermostThreadBackfill(params) {
1172
1168
  return {};
1173
1169
  }
1174
1170
  const previous = recoveries.get(turn.historyKey);
1171
+ if (previous === pendingRecovery && previous?.identity === identity && pendingHistory) return { history: await pendingHistory };
1175
1172
  let recovery = previous;
1176
1173
  if (!recovery || recovery.identity !== identity) {
1177
1174
  recovery = {
@@ -1236,8 +1233,7 @@ function createMattermostThreadBackfill(params) {
1236
1233
  return { history: await owner.completion };
1237
1234
  };
1238
1235
  }
1239
- //#endregion
1240
- //#region extensions/mattermost/src/mattermost/draft-stream.ts
1236
+ // extensions/mattermost/src/mattermost/draft-stream.ts
1241
1237
  const MATTERMOST_STREAM_MAX_CHARS = 4e3;
1242
1238
  const THROTTLE_MS = 1200;
1243
1239
  function createMattermostDraftStream(params) {
@@ -1266,6 +1262,7 @@ function createMattermostDraftStream(params) {
1266
1262
  const publishedAssistantParts = /* @__PURE__ */ new Map();
1267
1263
  const sendOrEditStreamMessage = async (text) => {
1268
1264
  const target = currentGeneration;
1265
+ const isAssistantText = text === target.latestAssistantText;
1269
1266
  const trimmed = text.trim();
1270
1267
  const normalized = trimmed ? truncateWithMarker(trimmed, MATTERMOST_STREAM_MAX_CHARS, {
1271
1268
  marker: "...",
@@ -1276,6 +1273,11 @@ function createMattermostDraftStream(params) {
1276
1273
  await target.ready;
1277
1274
  if (streamState.stopped && !streamState.final) return false;
1278
1275
  if (normalized === target.lastSentText) return true;
1276
+ const extendsSentAnswer = target.lastSentAssistantSource !== void 0 && text.startsWith(target.lastSentAssistantSource);
1277
+ if (target.postId && isAssistantText && !extendsSentAnswer) {
1278
+ target.newerPostId ??= await findPostAfter(target.postId).catch(() => void 0);
1279
+ if (target.newerPostId) return true;
1280
+ }
1279
1281
  try {
1280
1282
  if (target.postId) target.lastProviderText = (await updateMattermostPost(params.client, target.postId, { message: normalized })).message ?? normalized;
1281
1283
  else {
@@ -1288,6 +1290,7 @@ function createMattermostDraftStream(params) {
1288
1290
  target.lastProviderText = sent.message ?? normalized;
1289
1291
  }
1290
1292
  target.lastSentText = normalized;
1293
+ target.lastSentAssistantSource = isAssistantText ? text : void 0;
1291
1294
  return true;
1292
1295
  } catch (err) {
1293
1296
  streamState.stopped = true;
@@ -1503,8 +1506,7 @@ function createMattermostDraftStream(params) {
1503
1506
  findPostAfter
1504
1507
  };
1505
1508
  }
1506
- //#endregion
1507
- //#region extensions/mattermost/src/mattermost/monitor-draft-delivery.ts
1509
+ // extensions/mattermost/src/mattermost/monitor-draft-delivery.ts
1508
1510
  async function deliverMattermostReplyWithDraftPreview(params) {
1509
1511
  if (isReasoningReplyPayload(params.payload)) return {
1510
1512
  outcome: "reasoning_skipped",
@@ -1613,8 +1615,7 @@ async function deliverMattermostReplyWithDraftPreview(params) {
1613
1615
  }));
1614
1616
  }
1615
1617
  }
1616
- //#endregion
1617
- //#region extensions/mattermost/src/mattermost/thread-participation.ts
1618
+ // extensions/mattermost/src/mattermost/thread-participation.ts
1618
1619
  const threadParticipation = createPersistentDedupeCache({
1619
1620
  globalKey: Symbol.for("openclaw.mattermostThreadParticipation"),
1620
1621
  ttlMs: 6048e5,
@@ -1638,8 +1639,7 @@ async function hasMattermostThreadParticipationWithPersistence(params) {
1638
1639
  if (!params.accountId || !params.channelId || !params.threadRootId) return false;
1639
1640
  return await threadParticipation.lookup(makeKey(params.accountId, params.channelId, params.threadRootId));
1640
1641
  }
1641
- //#endregion
1642
- //#region extensions/mattermost/src/mattermost/monitor-turn.ts
1642
+ // extensions/mattermost/src/mattermost/monitor-turn.ts
1643
1643
  async function dispatchMattermostInboundTurn(monitor, params) {
1644
1644
  const { account, cfg, client, core, runtime } = monitor;
1645
1645
  const { botLoopProtection, channelHistories, ctxPayload, eventPlan, historyKey, historyLimit, pinnedMainDmOwner, post, rawText, turnAdoptionLifecycle } = params;
@@ -1974,8 +1974,7 @@ async function dispatchMattermostInboundTurn(monitor, params) {
1974
1974
  }
1975
1975
  }
1976
1976
  }
1977
- //#endregion
1978
- //#region extensions/mattermost/src/mattermost/monitor-posts.ts
1977
+ // extensions/mattermost/src/mattermost/monitor-posts.ts
1979
1978
  function createMattermostPostHandler(monitor) {
1980
1979
  const { account, botUserId, botUsername, cfg, core, groupPolicy, pairing, resources } = monitor;
1981
1980
  const groups = resolveChannelGroups(cfg, "mattermost", account.accountId);
@@ -2009,8 +2008,8 @@ function createMattermostPostHandler(monitor) {
2009
2008
  monitor.logVerboseMessage(`mattermost: drop post (self sender=${senderId})`);
2010
2009
  return;
2011
2010
  }
2012
- if (normalizeOptionalString(post.type) !== void 0) {
2013
- monitor.logVerboseMessage(`mattermost: drop post (system post type=${post.type ?? "unknown"})`);
2011
+ if (post.type?.startsWith("system_")) {
2012
+ monitor.logVerboseMessage(`mattermost: drop post (system post type=${post.type})`);
2014
2013
  return;
2015
2014
  }
2016
2015
  const eventPlan = await buildMattermostEventPlan(monitor, {
@@ -2075,13 +2074,21 @@ function createMattermostPostHandler(monitor) {
2075
2074
  senderId,
2076
2075
  senderName,
2077
2076
  channelId,
2077
+ threadId: effectiveReplyToId,
2078
2078
  kind,
2079
2079
  groupPolicy,
2080
2080
  readStoreAllowFrom: pairing.readAllowFromStore,
2081
2081
  allowTextCommands,
2082
2082
  hasControlCommand: isControlCommand,
2083
2083
  eventKind: "message",
2084
- mayPair: true
2084
+ mayPair: true,
2085
+ contextBinding: {
2086
+ agentId: route.agentId,
2087
+ sessionKey,
2088
+ messageId: post.id,
2089
+ nativeChannelId: channelId,
2090
+ inboundEventKind: "user_request"
2091
+ }
2085
2092
  });
2086
2093
  const commandAuthorized = accessDecision.commandAccess.authorized;
2087
2094
  if (accessDecision.ingress.decision !== "allow") {
@@ -2300,25 +2307,59 @@ function createMattermostPostHandler(monitor) {
2300
2307
  historyKey,
2301
2308
  limit: historyLimit
2302
2309
  }) : void 0;
2303
- const ctxPayload = eventPlan.finalizeContext({
2304
- Body: combinedBody,
2305
- BodyForAgent: bodyForAgent,
2306
- InboundHistory: inboundHistory,
2307
- RawBody: commandBody,
2308
- CommandBody: commandBody,
2309
- BodyForCommands: commandBody,
2310
- ConversationLabel: fromLabel,
2311
- GroupSubject: kind !== "direct" ? channelDisplay || roomLabel : void 0,
2312
- SenderName: senderName,
2313
- MessageSid: post.id,
2314
- MessageSids: allMessageIds.length > 1 ? allMessageIds : void 0,
2315
- MessageSidFirst: allMessageIds.length > 1 ? allMessageIds[0] : void 0,
2316
- MessageSidLast: allMessageIds.length > 1 ? allMessageIds[allMessageIds.length - 1] : void 0,
2317
- Timestamp: post.create_at ?? void 0,
2318
- WasMentioned: kind !== "direct" ? mentionDecision.effectiveWasMentioned : void 0,
2319
- CommandAuthorized: commandAuthorized,
2320
- CommandSource: commandAuthorized && isControlCommand ? "text" : void 0,
2321
- media: await toInboundMediaFactsWithMetadata(mediaList)
2310
+ const ctxPayload = core.channel.inbound.buildContext({
2311
+ channel: "mattermost",
2312
+ accountId: route.accountId,
2313
+ channelIngress: accessDecision,
2314
+ from: eventPlan.from,
2315
+ messageId: post.id,
2316
+ timestamp: post.create_at ?? void 0,
2317
+ sender: {
2318
+ id: senderId,
2319
+ name: senderName,
2320
+ isBot: isBotPost || void 0
2321
+ },
2322
+ conversation: {
2323
+ kind,
2324
+ id: channelId,
2325
+ nativeChannelId: channelId,
2326
+ routePeer: {
2327
+ kind,
2328
+ id: kind === "direct" ? senderId : channelId
2329
+ },
2330
+ label: fromLabel,
2331
+ spaceId: eventPlan.teamId,
2332
+ threadId: effectiveReplyToId
2333
+ },
2334
+ route: {
2335
+ ...route,
2336
+ routeSessionKey: route.sessionKey,
2337
+ dispatchSessionKey: sessionKey,
2338
+ parentSessionKey: thread.parentSessionKey
2339
+ },
2340
+ reply: {
2341
+ to: eventPlan.to,
2342
+ replyToId: effectiveReplyToId,
2343
+ messageThreadId: effectiveReplyToId
2344
+ },
2345
+ message: {
2346
+ body: combinedBody,
2347
+ bodyForAgent,
2348
+ rawBody: commandBody,
2349
+ commandBody,
2350
+ inboundHistory
2351
+ },
2352
+ access: { commands: accessDecision.commandAccess },
2353
+ media: await toInboundMediaFactsWithMetadata(mediaList),
2354
+ extra: {
2355
+ GroupSubject: kind !== "direct" ? channelDisplay || roomLabel : void 0,
2356
+ GroupChannel: eventPlan.channelName ? `#${eventPlan.channelName}` : void 0,
2357
+ WasMentioned: kind !== "direct" ? mentionDecision.effectiveWasMentioned : void 0,
2358
+ MessageSids: allMessageIds.length > 1 ? allMessageIds : void 0,
2359
+ MessageSidFirst: allMessageIds.length > 1 ? allMessageIds[0] : void 0,
2360
+ MessageSidLast: allMessageIds.length > 1 ? allMessageIds[allMessageIds.length - 1] : void 0,
2361
+ CommandSource: commandAuthorized && isControlCommand ? "text" : void 0
2362
+ }
2322
2363
  });
2323
2364
  const pinnedMainDmOwner = kind === "direct" ? resolvePinnedMainDmOwnerFromAllowlist({
2324
2365
  dmScope: cfg.session?.dmScope,
@@ -2351,8 +2392,7 @@ function createMattermostPostHandler(monitor) {
2351
2392
  });
2352
2393
  };
2353
2394
  }
2354
- //#endregion
2355
- //#region extensions/mattermost/src/mattermost/monitor-reactions.ts
2395
+ // extensions/mattermost/src/mattermost/monitor-reactions.ts
2356
2396
  function createMattermostReactionHandler(monitor) {
2357
2397
  const { account, botUserId, cfg, core, groupPolicy, pairing, resources } = monitor;
2358
2398
  const { resolveUserInfo } = resources;
@@ -2415,8 +2455,7 @@ function createMattermostReactionHandler(monitor) {
2415
2455
  monitor.logVerboseMessage(`mattermost reaction: ${action} :${emojiName}: by ${senderName} on ${postId}`);
2416
2456
  };
2417
2457
  }
2418
- //#endregion
2419
- //#region extensions/mattermost/src/mattermost/monitor-slash.ts
2458
+ // extensions/mattermost/src/mattermost/monitor-slash.ts
2420
2459
  async function registerMattermostMonitorSlashCommands(params) {
2421
2460
  const commandsRaw = params.account.config.commands;
2422
2461
  const slashConfig = resolveSlashCommandConfig(commandsRaw);
@@ -2498,8 +2537,7 @@ async function registerMattermostMonitorSlashCommands(params) {
2498
2537
  params.runtime.error?.(`mattermost: failed to register slash commands: ${String(err)}`);
2499
2538
  }
2500
2539
  }
2501
- //#endregion
2502
- //#region extensions/mattermost/src/mattermost/reconnect.ts
2540
+ // extensions/mattermost/src/mattermost/reconnect.ts
2503
2541
  async function runWithReconnect(connectFn, opts = {}) {
2504
2542
  let retryDelay = 2e3;
2505
2543
  while (!opts.abortSignal?.aborted) {
@@ -2525,8 +2563,7 @@ async function runWithReconnect(connectFn, opts = {}) {
2525
2563
  if (failed) retryDelay = Math.min(retryDelay * 2, 6e4);
2526
2564
  }
2527
2565
  }
2528
- //#endregion
2529
- //#region extensions/mattermost/src/mattermost/monitor.ts
2566
+ // extensions/mattermost/src/mattermost/monitor.ts
2530
2567
  function publishMattermostRecoveringStatus(statusSink, error) {
2531
2568
  statusSink?.({
2532
2569
  lastError: String(error),
@@ -2799,5 +2836,4 @@ async function monitorMattermostProvider(opts = {}) {
2799
2836
  if (shutdownFailures.length > 0) throw new AggregateError(shutdownFailures, "Mattermost monitor shutdown failed.", { cause: connectionFailure?.error });
2800
2837
  if (connectionFailure) throw connectionFailure.error;
2801
2838
  }
2802
- //#endregion
2803
2839
  export { monitorMattermostProvider };
@@ -1,5 +1,5 @@
1
- import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.mjs";
2
- import { n as normalizeMattermostAllowEntry, t as mattermostIngressIdentity } from "./ingress-identity-D6hxfxvo.mjs";
1
+ import { t as getMattermostRuntime } from "./runtime-y_L8jPMH.mjs";
2
+ import { n as normalizeMattermostAllowEntry, t as mattermostIngressIdentity } from "./ingress-identity-CtHiOUDu.mjs";
3
3
  import { uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  import { createWebhookInFlightLimiter, readRequestBodyWithLimit, sendHttpRequestRejection } from "openclaw/plugin-sdk/webhook-request-guards";
5
5
  import { logInboundDrop } from "openclaw/plugin-sdk/channel-inbound";
@@ -18,7 +18,7 @@ import { registerPluginHttpRoute } from "openclaw/plugin-sdk/webhook-targets";
18
18
  import { isRequestBodyLimitError } from "openclaw/plugin-sdk/webhook-ingress";
19
19
  import { isTrustedProxyAddress, resolveClientIp } from "openclaw/plugin-sdk/core";
20
20
  import { resolveChannelContextVisibilityMode, shouldIncludeSupplementalContext } from "openclaw/plugin-sdk/context-visibility-runtime";
21
- //#region extensions/mattermost/src/mattermost/monitor-auth.ts
21
+ // extensions/mattermost/src/mattermost/monitor-auth.ts
22
22
  const MATTERMOST_PAIRING_QUEUE_FULL_TEXT = "DM pairing is full, so no pairing request was saved. Ask the bot owner to approve or dismiss pending requests in Settings → Channels → DM access requests, then try again.";
23
23
  function normalizeMattermostAllowList(entries) {
24
24
  const normalized = entries.map((entry) => normalizeMattermostAllowEntry(String(entry))).filter(Boolean);
@@ -55,6 +55,7 @@ async function resolveMattermostMonitorInboundAccess(params) {
55
55
  return await getMattermostRuntime().channel.inbound.ingress.resolveStable({
56
56
  channelId: "mattermost",
57
57
  accountId: account.accountId,
58
+ contextBinding: params.contextBinding,
58
59
  identity: mattermostIngressIdentity,
59
60
  cfg,
60
61
  ...readStoreAllowFrom ? { readStoreAllowFrom } : {},
@@ -65,7 +66,8 @@ async function resolveMattermostMonitorInboundAccess(params) {
65
66
  },
66
67
  conversation: {
67
68
  kind,
68
- id: channelId
69
+ id: channelId,
70
+ threadId: params.threadId
69
71
  },
70
72
  event: {
71
73
  kind: params.eventKind ?? "message",
@@ -166,5 +168,4 @@ async function authorizeMattermostCommandInvocation(params) {
166
168
  }
167
169
  };
168
170
  }
169
- //#endregion
170
171
  export { registerPluginHttpRoute as C, resolveDefaultGroupPolicy as D, resolveClientIp as E, sendHttpRequestRejection as O, readRequestBodyWithLimit as S, resolveChannelMediaMaxBytes$1 as T, isTrustedProxyAddress as _, normalizeMattermostAllowList as a, logTypingFailure as b, shouldRetainMattermostSenderHistory as c, createChannelHistoryWindow as d, createChannelMessageReplyPipeline as f, isRequestBodyLimitError as g, isDangerousNameMatchingEnabled as h, isMattermostSenderAllowed as i, warnMissingProviderGroupPolicyFallbackOnce as k, DEFAULT_GROUP_HISTORY_LIMIT as l, createWebhookInFlightLimiter as m, authorizeMattermostCommandInvocation as n, resolveMattermostMonitorInboundAccess as o, createChannelPairingController as p, formatMattermostDirectMessageDropLog as r, resolveMattermostTrustedChatKind as s, MATTERMOST_PAIRING_QUEUE_FULL_TEXT as t, buildPreparedModelsProviderData as u, loadOutboundMediaFromUrl as v, resolveAllowlistProviderRuntimeGroupPolicy$1 as w, prepareSkillCommandsForAgents as x, logInboundDrop as y };
@@ -1,4 +1,4 @@
1
- import { h as normalizeMattermostBaseUrl, r as createMattermostClient } from "./client-CR-hGmGr.mjs";
1
+ import { h as normalizeMattermostBaseUrl, r as createMattermostClient } from "./client-CVipK0N2.mjs";
2
2
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
3
3
  import { resolveChannelPreviewStreamMode, resolveChannelStreamingBlockEnabled } from "openclaw/plugin-sdk/channel-outbound";
4
4
  import { createAccountListHelpers, hasConfiguredAccountValue } from "openclaw/plugin-sdk/account-helpers";
@@ -6,7 +6,7 @@ import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/acco
6
6
  import { normalizeMessagePresentation, renderMessagePresentationFallbackText, resolveMessagePresentationControlValue } from "openclaw/plugin-sdk/interactive-runtime";
7
7
  import { resolveAskUserQuestionOptionIndex, resolveAskUserQuestionOptionIndices } from "openclaw/plugin-sdk/reply-payload";
8
8
  import { resolveSecretInputString } from "openclaw/plugin-sdk/secret-input";
9
- //#region extensions/mattermost/src/mattermost/accounts.ts
9
+ // extensions/mattermost/src/mattermost/accounts.ts
10
10
  const { listAccountIds: listMattermostAccountIds, resolveDefaultAccountId: resolveDefaultMattermostAccountId, resolveAccountConfig: mergeMattermostAccountConfig } = createAccountListHelpers("mattermost", {
11
11
  omitKeys: ["defaultAccount"],
12
12
  nestedObjectKeys: ["commands", "botLoopProtection"],
@@ -105,8 +105,7 @@ function resolveMattermostReplyToMode(account, kind) {
105
105
  if (kind === "direct") return "off";
106
106
  return account.config.replyToMode ?? "off";
107
107
  }
108
- //#endregion
109
- //#region extensions/mattermost/src/normalize.ts
108
+ // extensions/mattermost/src/normalize.ts
110
109
  /** Marks a button context as one this plugin answers through the question Gateway. */
111
110
  const MATTERMOST_QUESTION_CONTEXT_KEY = "oc_question";
112
111
  /**
@@ -199,5 +198,4 @@ function looksLikeMattermostTargetId(raw, _normalized) {
199
198
  if (trimmed.startsWith("@")) return true;
200
199
  return /^[a-z0-9]{26}$/i.test(trimmed) || /^[a-z0-9]{26}__[a-z0-9]{26}$/i.test(trimmed);
201
200
  }
202
- //#endregion
203
201
  export { resolveMattermostPresentation as a, isMattermostConfigured as c, resolveMattermostAccount as d, resolveMattermostReplyToMode as f, requiresMattermostMediaUpload as i, listMattermostAccountIds as l, normalizeMattermostMessagingTarget as n, createMattermostAccountClient as o, parseMattermostQuestionContext as r, inspectMattermostAccount as s, looksLikeMattermostTargetId as t, resolveDefaultMattermostAccountId as u };
@@ -1,4 +1,4 @@
1
- //#region \0rolldown/runtime.js
1
+ // \0rolldown/runtime.js
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -23,5 +23,4 @@ var __copyProps = (to, from, except, desc) => {
23
23
  return to;
24
24
  };
25
25
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
26
- //#endregion
27
26
  export { __reExport as n, __exportAll as t };
@@ -1,8 +1,7 @@
1
1
  import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
2
- //#region extensions/mattermost/src/runtime.ts
2
+ // extensions/mattermost/src/runtime.ts
3
3
  const { setRuntime: setMattermostRuntime, getRuntime: getMattermostRuntime, tryGetRuntime: getOptionalMattermostRuntime } = createPluginRuntimeStore({
4
4
  pluginId: "mattermost",
5
5
  errorMessage: "Mattermost runtime not initialized"
6
6
  });
7
- //#endregion
8
7
  export { getOptionalMattermostRuntime as n, setMattermostRuntime as r, getMattermostRuntime as t };
@@ -1,6 +1,6 @@
1
1
  import { hasConfiguredAccountValue } from "openclaw/plugin-sdk/account-helpers";
2
2
  import { collectSimpleChannelFieldAssignments, createChannelSecretContract } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
3
- //#region extensions/mattermost/src/secret-contract.ts
3
+ // extensions/mattermost/src/secret-contract.ts
4
4
  const channelSecrets = createChannelSecretContract({
5
5
  channelKey: "mattermost",
6
6
  account: ["botToken"],
@@ -16,5 +16,4 @@ const channelSecrets = createChannelSecretContract({
16
16
  }
17
17
  });
18
18
  const { secretTargetRegistryEntries, collectRuntimeConfigAssignments } = channelSecrets;
19
- //#endregion
20
19
  export { collectRuntimeConfigAssignments as n, secretTargetRegistryEntries as r, channelSecrets as t };
@@ -1,2 +1,2 @@
1
- export { t as channelSecrets, n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-fjlTFCmD.mjs";
1
+ export { t as channelSecrets, n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-BkDCURCE.mjs";
2
2
  import "../secret-contract-api.js";