@openclaw/mattermost 2026.8.1 → 2026.8.33

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 (26) hide show
  1. package/dist/.setup/channel-plugin-api-B0CWOYS7.mjs +3 -0
  2. package/dist/.setup/channel-plugin-api-DwYqw8BB.mjs +39 -0
  3. package/dist/{channel-plugin-runtime-DGrYW6mT.js → .setup/channel-plugin-runtime-5KTpFt5d.mjs} +99 -86
  4. package/dist/{channel.runtime-W-EkJlMp.js → .setup/channel.runtime-Do4NNPx6.mjs} +13 -13
  5. package/dist/{client-DAIry9-2.js → .setup/client-D3Btt1WT.mjs} +7 -5
  6. package/dist/{interactions-LnudXdqD.js → .setup/interactions-D_JtOrNT.mjs} +9 -7
  7. package/dist/{monitor-auth-CACk1Hos.js → .setup/monitor-auth-5PSi3kAe.mjs} +5 -3
  8. package/dist/{normalize-DoleH0bY.js → .setup/normalize-D6YiIrp8.mjs} +11 -3
  9. package/dist/.setup/secret-contract-api-Drab0Nqx.mjs +3 -0
  10. package/dist/{slash-state-CPIuJQj2.js → .setup/slash-state-CG0pjvJi.mjs} +27 -20
  11. package/dist/api.js +2 -2
  12. package/dist/channel-plugin-api.js +2 -37
  13. package/dist/channel-plugin-runtime.js +1 -1
  14. package/dist/doctor-contract-api.js +1 -1
  15. package/dist/gateway-auth-api.js +1 -1
  16. package/dist/policy-api.js +1 -1
  17. package/dist/runtime-api.js +1 -1
  18. package/dist/secret-contract-api.js +1 -1
  19. package/dist/setup-entry.js +3 -2
  20. package/dist/slash-route-api.js +1 -1
  21. package/package.json +4 -4
  22. /package/dist/{doctor-contract-mvORF4f6.js → .setup/doctor-contract-mvORF4f6.mjs} +0 -0
  23. /package/dist/{gateway-auth-bypass-B93t91oq.js → .setup/gateway-auth-bypass-B93t91oq.mjs} +0 -0
  24. /package/dist/{ingress-identity-DNl4yQSc.js → .setup/ingress-identity-DNl4yQSc.mjs} +0 -0
  25. /package/dist/{runtime-CNB4YGqJ.js → .setup/runtime-CNB4YGqJ.mjs} +0 -0
  26. /package/dist/{secret-contract-qg3NXRlS.js → .setup/secret-contract-qg3NXRlS.mjs} +0 -0
@@ -0,0 +1,3 @@
1
+ import { t as mattermostPlugin } from "./channel-plugin-runtime-5KTpFt5d.mjs";
2
+ import { t as mattermostSetupPlugin } from "./channel-plugin-api-DwYqw8BB.mjs";
3
+ export { mattermostPlugin, mattermostSetupPlugin };
@@ -0,0 +1,39 @@
1
+ import { o as isMattermostConfigured } from "./normalize-D6YiIrp8.mjs";
2
+ import { a as describeMattermostAccount, i as MattermostChannelConfigSchema, n as mattermostSetupWizard, o as mattermostConfigAdapter, r as mattermostSetupContract, s as mattermostMeta } from "./channel-plugin-runtime-5KTpFt5d.mjs";
3
+ import { t as resolveMattermostGatewayAuthBypassPaths } from "./gateway-auth-bypass-B93t91oq.mjs";
4
+ //#region extensions/mattermost/src/channel.setup.ts
5
+ const mattermostSetupPlugin = {
6
+ id: "mattermost",
7
+ meta: { ...mattermostMeta },
8
+ capabilities: {
9
+ chatTypes: [
10
+ "direct",
11
+ "channel",
12
+ "group",
13
+ "thread"
14
+ ],
15
+ reactions: true,
16
+ threads: true,
17
+ media: true,
18
+ nativeCommands: true
19
+ },
20
+ reload: {
21
+ configPrefixes: ["channels.mattermost"],
22
+ /**
23
+ * accounts.default is promoted; named resolution merges only channel-wide fields
24
+ * plus the selected account. Runtime monitor, debounce, and ingress use accountId.
25
+ */
26
+ accountScopedRestart: true
27
+ },
28
+ configSchema: MattermostChannelConfigSchema,
29
+ config: {
30
+ ...mattermostConfigAdapter,
31
+ isConfigured: isMattermostConfigured,
32
+ describeAccount: describeMattermostAccount
33
+ },
34
+ gateway: { resolveGatewayAuthBypassPaths: resolveMattermostGatewayAuthBypassPaths },
35
+ setupContract: mattermostSetupContract,
36
+ setupWizard: mattermostSetupWizard
37
+ };
38
+ //#endregion
39
+ export { mattermostSetupPlugin as t };
@@ -1,9 +1,9 @@
1
- import { m as normalizeMattermostBaseUrl } from "./client-DAIry9-2.js";
2
- import { t as mattermostIngressIdentity } from "./ingress-identity-DNl4yQSc.js";
3
- import { a as inspectMattermostAccount, c as resolveMattermostAccount, d as hasConfiguredSecretInput, i as resolveMattermostPresentation, l as resolveMattermostReplyToMode, n as normalizeMattermostMessagingTarget, o as listMattermostAccountIds, r as requiresMattermostMediaUpload, s as resolveDefaultMattermostAccountId, t as looksLikeMattermostTargetId, u as buildSecretInputSchema } from "./normalize-DoleH0bY.js";
4
- import { t as resolveMattermostGatewayAuthBypassPaths } from "./gateway-auth-bypass-B93t91oq.js";
5
- import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-mvORF4f6.js";
6
- import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-qg3NXRlS.js";
1
+ import { m as normalizeMattermostBaseUrl } from "./client-D3Btt1WT.mjs";
2
+ import { t as mattermostIngressIdentity } from "./ingress-identity-DNl4yQSc.mjs";
3
+ import { a as inspectMattermostAccount, c as resolveDefaultMattermostAccountId, d as buildSecretInputSchema, f as hasConfiguredSecretInput, i as resolveMattermostPresentation, l as resolveMattermostAccount, n as normalizeMattermostMessagingTarget, o as isMattermostConfigured$1, r as requiresMattermostMediaUpload, s as listMattermostAccountIds, t as looksLikeMattermostTargetId, u as resolveMattermostReplyToMode } from "./normalize-D6YiIrp8.mjs";
4
+ import { t as resolveMattermostGatewayAuthBypassPaths } from "./gateway-auth-bypass-B93t91oq.mjs";
5
+ import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-mvORF4f6.mjs";
6
+ import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-qg3NXRlS.mjs";
7
7
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
8
8
  import { buildPassiveProbedChannelStatusSummary } from "openclaw/plugin-sdk/extension-shared";
9
9
  import { isPrivateNetworkOptInEnabled } from "openclaw/plugin-sdk/ssrf-runtime";
@@ -34,7 +34,8 @@ import { createSetupInputPresenceValidator } from "openclaw/plugin-sdk/setup-run
34
34
  //#region extensions/mattermost/src/approval-auth.ts
35
35
  const MATTERMOST_USER_ID_RE = /^[a-z0-9]{26}$/;
36
36
  function normalizeMattermostApproverId(value) {
37
- const lowered = normalizeLowercaseStringOrEmpty(String(value).trim().replace(/^(mattermost|user):/i, "").replace(/^@/, "").trim());
37
+ const normalized = String(value).trim().replace(/^(mattermost|user):/i, "").replace(/^@/, "").trim();
38
+ const lowered = normalizeLowercaseStringOrEmpty(normalized);
38
39
  return MATTERMOST_USER_ID_RE.test(lowered) ? lowered : void 0;
39
40
  }
40
41
  const mattermostApprovalAuth = createChannelApprovalAuth({
@@ -89,9 +90,6 @@ const mattermostConfigAdapter = createScopedChannelConfigAdapter({
89
90
  normalizeEntry: formatMattermostAllowEntry
90
91
  })
91
92
  });
92
- function isMattermostConfigured$1(account) {
93
- return (account.botTokenStatus ? account.botTokenStatus !== "missing" : Boolean(account.botToken)) && Boolean(account.baseUrl);
94
- }
95
93
  function describeMattermostAccount(account) {
96
94
  return describeAccountSnapshot({
97
95
  account,
@@ -191,9 +189,7 @@ const MattermostReplyToModeByChatTypeSchema = z.object({
191
189
  group: MattermostReplyToModeSchema.optional(),
192
190
  channel: MattermostReplyToModeSchema.optional()
193
191
  }).strict();
194
- //#endregion
195
- //#region extensions/mattermost/src/config-surface.ts
196
- const MattermostChannelConfigSchema = buildChannelConfigSchema(buildMultiAccountChannelSchema(z.object({
192
+ const MattermostAccountSchemaBase = z.object({
197
193
  name: z.string().optional(),
198
194
  capabilities: z.array(z.string()).optional(),
199
195
  dangerouslyAllowNameMatching: z.boolean().optional(),
@@ -237,7 +233,8 @@ const MattermostChannelConfigSchema = buildChannelConfigSchema(buildMultiAccount
237
233
  network: MattermostNetworkSchema,
238
234
  /** Retry configuration for DM channel creation */
239
235
  dmChannelRetry: DmChannelRetrySchema
240
- }).strict(), {
236
+ }).strict();
237
+ const MattermostConfigSchema = buildMultiAccountChannelSchema(MattermostAccountSchemaBase, {
241
238
  optionalAccount: true,
242
239
  refine: (value, ctx) => {
243
240
  requireMattermostOpenAllowFrom({
@@ -246,7 +243,10 @@ const MattermostChannelConfigSchema = buildChannelConfigSchema(buildMultiAccount
246
243
  ctx
247
244
  });
248
245
  }
249
- }), { uiHints: {
246
+ });
247
+ //#endregion
248
+ //#region extensions/mattermost/src/config-ui-hints.ts
249
+ const mattermostChannelConfigUiHints = {
250
250
  "": {
251
251
  label: "Mattermost",
252
252
  help: "Mattermost channel provider configuration for bot auth, access policy, slash commands, and preview streaming."
@@ -265,15 +265,22 @@ const MattermostChannelConfigSchema = buildChannelConfigSchema(buildMultiAccount
265
265
  },
266
266
  progress: {}
267
267
  })
268
- } });
268
+ };
269
+ //#endregion
270
+ //#region extensions/mattermost/src/config-surface.ts
271
+ const MattermostChannelConfigSchema = buildChannelConfigSchema(MattermostConfigSchema, { uiHints: mattermostChannelConfigUiHints });
272
+ //#endregion
273
+ //#region extensions/mattermost/src/doctor.ts
274
+ const isMattermostMutableAllowEntry = buildMutableAllowEntryDetector({ stableIdPattern: /^(?:(?:mattermost|user):)?@?[a-z0-9]{26}$/i });
275
+ const collectMattermostMutableAllowlistWarnings = createDangerousNameMatchingMutableAllowlistWarningCollector({
276
+ channel: "mattermost",
277
+ detector: isMattermostMutableAllowEntry,
278
+ collectLists: (scope) => collectStandardAllowlistLists(scope)
279
+ });
269
280
  const mattermostDoctor = {
270
281
  legacyConfigRules,
271
282
  normalizeCompatibilityConfig,
272
- collectMutableAllowlistWarnings: createDangerousNameMatchingMutableAllowlistWarningCollector({
273
- channel: "mattermost",
274
- detector: buildMutableAllowEntryDetector({ stableIdPattern: /^(?:(?:mattermost|user):)?@?[a-z0-9]{26}$/i }),
275
- collectLists: (scope) => collectStandardAllowlistLists(scope)
276
- })
283
+ collectMutableAllowlistWarnings: collectMattermostMutableAllowlistWarnings
277
284
  };
278
285
  //#endregion
279
286
  //#region extensions/mattermost/src/group-mentions.ts
@@ -372,21 +379,22 @@ function resolveMattermostOutboundSessionRoute(params) {
372
379
  const recipientSessionExact = isUser && hasExplicitUserKind && /^[a-z0-9]{26}$/.test(rawId);
373
380
  const isGroup = !isUser && (resolvedKind === "group" || resolvedKind !== "channel" && (lower.startsWith("group:") || mattermostSessionKeyPeerKind(params.currentSessionKey, rawId) === "group"));
374
381
  const kind = isUser ? "direct" : isGroup ? "group" : "channel";
382
+ const baseRoute = buildChannelOutboundSessionRoute({
383
+ cfg: params.cfg,
384
+ agentId: params.agentId,
385
+ channel: "mattermost",
386
+ accountId: params.accountId,
387
+ recipientSessionExact,
388
+ peer: {
389
+ kind,
390
+ id: rawId
391
+ },
392
+ chatType: kind,
393
+ from: isUser ? `mattermost:${rawId}` : `mattermost:${kind}:${rawId}`,
394
+ to: isUser ? `user:${rawId}` : `channel:${rawId}`
395
+ });
375
396
  return buildThreadAwareOutboundSessionRoute({
376
- route: buildChannelOutboundSessionRoute({
377
- cfg: params.cfg,
378
- agentId: params.agentId,
379
- channel: "mattermost",
380
- accountId: params.accountId,
381
- recipientSessionExact,
382
- peer: {
383
- kind,
384
- id: rawId
385
- },
386
- chatType: kind,
387
- from: isUser ? `mattermost:${rawId}` : `mattermost:${kind}:${rawId}`,
388
- to: isUser ? `user:${rawId}` : `channel:${rawId}`
389
- }),
397
+ route: baseRoute,
390
398
  replyToId: params.replyToId,
391
399
  threadId: params.threadId,
392
400
  currentSessionKey: params.currentSessionKey,
@@ -412,16 +420,58 @@ function applyMattermostSetupConfigPatch(params) {
412
420
  accountId: params.accountId,
413
421
  name: params.name
414
422
  });
423
+ const next = params.accountId !== DEFAULT_ACCOUNT_ID ? migrateBaseNameToDefaultAccount({
424
+ cfg: namedConfig,
425
+ channelKey: channel$1
426
+ }) : namedConfig;
415
427
  return applySetupAccountConfigPatch({
416
- cfg: params.accountId !== DEFAULT_ACCOUNT_ID ? migrateBaseNameToDefaultAccount({
417
- cfg: namedConfig,
418
- channelKey: channel$1
419
- }) : namedConfig,
428
+ cfg: next,
420
429
  channelKey: channel$1,
421
430
  accountId: params.accountId,
422
431
  patch: params.patch
423
432
  });
424
433
  }
434
+ const mattermostSetupAdapter = {
435
+ resolveAccountId: ({ accountId }) => normalizeAccountId(accountId),
436
+ applyAccountName: ({ cfg, accountId, name }) => applyAccountNameToChannelSection({
437
+ cfg,
438
+ channelKey: channel$1,
439
+ accountId,
440
+ name
441
+ }),
442
+ validateInput: createSetupInputPresenceValidator({
443
+ defaultAccountOnlyEnvError: "Mattermost env vars can only be used for the default account.",
444
+ whenNotUseEnv: [{
445
+ someOf: ["botToken", "token"],
446
+ message: "Mattermost requires --bot-token and --http-url (or --use-env)."
447
+ }, {
448
+ someOf: ["httpUrl"],
449
+ message: "Mattermost requires --bot-token and --http-url (or --use-env)."
450
+ }],
451
+ validate: ({ input }) => {
452
+ const setupInput = input;
453
+ const token = setupInput.botToken ?? setupInput.token;
454
+ const baseUrl = normalizeMattermostBaseUrl(setupInput.httpUrl);
455
+ if (!setupInput.useEnv && (!token || !baseUrl)) return "Mattermost requires --bot-token and --http-url (or --use-env).";
456
+ if (setupInput.httpUrl && !baseUrl) return "Mattermost --http-url must include a valid base URL.";
457
+ return null;
458
+ }
459
+ }),
460
+ applyAccountConfig: ({ cfg, accountId, input }) => {
461
+ const setupInput = input;
462
+ const token = setupInput.botToken ?? setupInput.token;
463
+ const baseUrl = normalizeMattermostBaseUrl(setupInput.httpUrl);
464
+ return applyMattermostSetupConfigPatch({
465
+ cfg,
466
+ accountId,
467
+ name: setupInput.name,
468
+ patch: setupInput.useEnv ? {} : {
469
+ ...token ? { botToken: token } : {},
470
+ ...baseUrl ? { baseUrl } : {}
471
+ }
472
+ });
473
+ }
474
+ };
425
475
  const mattermostSetupContract = defineChannelSetupContract({
426
476
  fields: {
427
477
  token: {
@@ -456,47 +506,7 @@ const mattermostSetupContract = defineChannelSetupContract({
456
506
  envVars: ["MATTERMOST_BOT_TOKEN", "MATTERMOST_URL"]
457
507
  }
458
508
  },
459
- legacyAdapter: {
460
- resolveAccountId: ({ accountId }) => normalizeAccountId(accountId),
461
- applyAccountName: ({ cfg, accountId, name }) => applyAccountNameToChannelSection({
462
- cfg,
463
- channelKey: channel$1,
464
- accountId,
465
- name
466
- }),
467
- validateInput: createSetupInputPresenceValidator({
468
- defaultAccountOnlyEnvError: "Mattermost env vars can only be used for the default account.",
469
- whenNotUseEnv: [{
470
- someOf: ["botToken", "token"],
471
- message: "Mattermost requires --bot-token and --http-url (or --use-env)."
472
- }, {
473
- someOf: ["httpUrl"],
474
- message: "Mattermost requires --bot-token and --http-url (or --use-env)."
475
- }],
476
- validate: ({ input }) => {
477
- const setupInput = input;
478
- const token = setupInput.botToken ?? setupInput.token;
479
- const baseUrl = normalizeMattermostBaseUrl(setupInput.httpUrl);
480
- if (!setupInput.useEnv && (!token || !baseUrl)) return "Mattermost requires --bot-token and --http-url (or --use-env).";
481
- if (setupInput.httpUrl && !baseUrl) return "Mattermost --http-url must include a valid base URL.";
482
- return null;
483
- }
484
- }),
485
- applyAccountConfig: ({ cfg, accountId, input }) => {
486
- const setupInput = input;
487
- const token = setupInput.botToken ?? setupInput.token;
488
- const baseUrl = normalizeMattermostBaseUrl(setupInput.httpUrl);
489
- return applyMattermostSetupConfigPatch({
490
- cfg,
491
- accountId,
492
- name: setupInput.name,
493
- patch: setupInput.useEnv ? {} : {
494
- ...token ? { botToken: token } : {},
495
- ...baseUrl ? { baseUrl } : {}
496
- }
497
- });
498
- }
499
- }
509
+ legacyAdapter: mattermostSetupAdapter
500
510
  });
501
511
  //#endregion
502
512
  //#region extensions/mattermost/src/setup-surface.ts
@@ -584,7 +594,7 @@ const mattermostSetupWizard = {
584
594
  };
585
595
  //#endregion
586
596
  //#region extensions/mattermost/src/channel.ts
587
- const loadMattermostChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-W-EkJlMp.js"));
597
+ const loadMattermostChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-Do4NNPx6.mjs"));
588
598
  const MATTERMOST_PRESENTATION_CAPABILITIES = {
589
599
  supported: true,
590
600
  buttons: true,
@@ -712,10 +722,12 @@ function normalizeMattermostThreadId(value) {
712
722
  return typeof value === "number" ? String(value) : normalizeOptionalString(value);
713
723
  }
714
724
  function buildMattermostThreadingToolContext(params) {
715
- const configuredReplyToMode = resolveMattermostReplyToMode(resolveMattermostAccount({
725
+ const account = resolveMattermostAccount({
716
726
  cfg: params.cfg,
717
727
  accountId: params.accountId ?? resolveDefaultMattermostAccountId(params.cfg)
718
- }), params.context.ChatType === "direct" || params.context.ChatType === "group" || params.context.ChatType === "channel" ? params.context.ChatType : "channel");
728
+ });
729
+ const chatType = params.context.ChatType === "direct" || params.context.ChatType === "group" || params.context.ChatType === "channel" ? params.context.ChatType : "channel";
730
+ const configuredReplyToMode = resolveMattermostReplyToMode(account, chatType);
719
731
  const currentThreadTs = normalizeMattermostThreadId(params.context.MessageThreadId) ?? normalizeMattermostThreadId(params.context.TransportThreadId) ?? normalizeOptionalString(params.context.ReplyToId);
720
732
  const currentMessageId = normalizeMattermostThreadId(params.context.CurrentMessageId);
721
733
  const hasExistingThread = Boolean(currentThreadTs) && (!currentMessageId || currentThreadTs !== currentMessageId);
@@ -979,7 +991,7 @@ const mattermostOutbound = {
979
991
  ...ctx.payload,
980
992
  mediaUrl: ctx.payload.mediaUrl ?? ctx.mediaUrl
981
993
  }).map((url) => url.trim()).find(Boolean);
982
- return attachChannelToResult("mattermost", toMattermostOutboundResult(await (await loadMattermostChannelRuntime()).sendMessageMattermost(ctx.to, ctx.payload.text ?? ctx.text, {
994
+ const result = await (await loadMattermostChannelRuntime()).sendMessageMattermost(ctx.to, ctx.payload.text ?? ctx.text, {
983
995
  cfg: ctx.cfg,
984
996
  accountId: ctx.accountId ?? void 0,
985
997
  mediaUrl,
@@ -991,7 +1003,8 @@ const mattermostOutbound = {
991
1003
  buttons: buttons?.length ? buttons : void 0,
992
1004
  attachmentText,
993
1005
  onDeliveryResult: createMattermostDeliveryProgressReporter(ctx.onDeliveryResult)
994
- })));
1006
+ });
1007
+ return attachChannelToResult("mattermost", toMattermostOutboundResult(result));
995
1008
  }
996
1009
  return await sendTextMediaPayload({
997
1010
  channel: "mattermost",
@@ -1236,4 +1249,4 @@ const mattermostPlugin = createChatChannelPlugin({
1236
1249
  outbound: mattermostOutbound
1237
1250
  });
1238
1251
  //#endregion
1239
- export { describeMattermostAccount as a, mattermostMeta as c, MattermostChannelConfigSchema as i, mattermostSetupWizard as n, isMattermostConfigured$1 as o, mattermostSetupContract as r, mattermostConfigAdapter as s, mattermostPlugin as t };
1252
+ export { describeMattermostAccount as a, MattermostChannelConfigSchema as i, mattermostSetupWizard as n, mattermostConfigAdapter as o, mattermostSetupContract as r, mattermostMeta as s, mattermostPlugin as t };
@@ -1,10 +1,10 @@
1
- import { n as getOptionalMattermostRuntime, t as getMattermostRuntime } from "./runtime-CNB4YGqJ.js";
2
- import { _ as sendMattermostTyping, a as createMattermostPost, d as fetchMattermostUser, g as readMattermostError, l as fetchMattermostChannelPosts, m as normalizeMattermostBaseUrl, n as buildMattermostApiUrl, o as deleteMattermostPost, p as fetchMattermostUserTeams, r as createMattermostClient, s as fetchMattermostChannel, t as MattermostPostSchema, u as fetchMattermostMe, v as updateMattermostPost } from "./client-DAIry9-2.js";
3
- import { C as resolveDefaultGroupPolicy, _ as logTypingFailure, a as resolveMattermostMonitorInboundAccess, b as resolveAllowlistProviderRuntimeGroupPolicy$1, c as buildPreparedModelsProviderData, d as createChannelPairingController, g as logInboundDrop, l as createChannelHistoryWindow, m as listSkillCommandsForAgents, n as formatMattermostDirectMessageDropLog, o as resolveMattermostTrustedChatKind, s as DEFAULT_GROUP_HISTORY_LIMIT, t as authorizeMattermostCommandInvocation, u as createChannelMessageReplyPipeline, w as warnMissingProviderGroupPolicyFallbackOnce, x as resolveChannelMediaMaxBytes, y as registerPluginHttpRoute } from "./monitor-auth-CACk1Hos.js";
4
- import { a as resolveInteractionCallbackPath, c as setInteractionSecret, i as createMattermostInteractionHandler, n as buildButtonProps, r as computeInteractionCallbackUrl, s as setInteractionCallbackUrl } from "./interactions-LnudXdqD.js";
5
- import { n as normalizeMattermostAllowEntry } from "./ingress-identity-DNl4yQSc.js";
6
- import { a as inspectMattermostAccount, c as resolveMattermostAccount, l as resolveMattermostReplyToMode, n as normalizeMattermostMessagingTarget, o as listMattermostAccountIds } from "./normalize-DoleH0bY.js";
7
- import { _ as registerSlashCommands, a as sendMessageMattermost, c as joinMattermostVisibleContent, d as renderMattermostModelsPickerView, f as renderMattermostProviderPickerView, g as isSlashCommandsEnabled, h as cleanupSlashCommands, l as buildMattermostAllowedModelRefs, m as DEFAULT_COMMAND_SPECS, n as deactivateSlashCommands, o as resolveMattermostOpaqueTarget, p as resolveMattermostModelPickerCurrentModel, r as getSlashCommandState, s as deliverMattermostReplyPayload, t as activateSlashCommands, u as parseMattermostModelPickerContext, v as resolveCallbackUrl, y as resolveSlashCommandConfig } from "./slash-state-CPIuJQj2.js";
1
+ import { n as getOptionalMattermostRuntime, t as getMattermostRuntime } from "./runtime-CNB4YGqJ.mjs";
2
+ import { _ as sendMattermostTyping, a as createMattermostPost, d as fetchMattermostUser, g as readMattermostError, l as fetchMattermostChannelPosts, m as normalizeMattermostBaseUrl, n as buildMattermostApiUrl, o as deleteMattermostPost, p as fetchMattermostUserTeams, r as createMattermostClient, s as fetchMattermostChannel, t as MattermostPostSchema, u as fetchMattermostMe, v as updateMattermostPost } from "./client-D3Btt1WT.mjs";
3
+ import { C as resolveDefaultGroupPolicy, _ as logTypingFailure, a as resolveMattermostMonitorInboundAccess, b as resolveAllowlistProviderRuntimeGroupPolicy$1, c as buildPreparedModelsProviderData, d as createChannelPairingController, g as logInboundDrop, l as createChannelHistoryWindow, m as listSkillCommandsForAgents, n as formatMattermostDirectMessageDropLog, o as resolveMattermostTrustedChatKind, s as DEFAULT_GROUP_HISTORY_LIMIT, t as authorizeMattermostCommandInvocation, u as createChannelMessageReplyPipeline, w as warnMissingProviderGroupPolicyFallbackOnce, x as resolveChannelMediaMaxBytes, y as registerPluginHttpRoute } from "./monitor-auth-5PSi3kAe.mjs";
4
+ import { a as resolveInteractionCallbackPath, c as setInteractionSecret, i as createMattermostInteractionHandler, n as buildButtonProps, r as computeInteractionCallbackUrl, s as setInteractionCallbackUrl } from "./interactions-D_JtOrNT.mjs";
5
+ import { n as normalizeMattermostAllowEntry } from "./ingress-identity-DNl4yQSc.mjs";
6
+ import { a as inspectMattermostAccount, l as resolveMattermostAccount, n as normalizeMattermostMessagingTarget, s as listMattermostAccountIds, u as resolveMattermostReplyToMode } from "./normalize-D6YiIrp8.mjs";
7
+ import { _ as registerSlashCommands, a as sendMessageMattermost, c as joinMattermostVisibleContent, d as renderMattermostModelsPickerView, f as renderMattermostProviderPickerView, g as isSlashCommandsEnabled, h as cleanupSlashCommands, l as buildMattermostAllowedModelRefs, m as DEFAULT_COMMAND_SPECS, n as deactivateSlashCommands, o as resolveMattermostOpaqueTarget, p as resolveMattermostModelPickerCurrentModel, r as getSlashCommandState, s as deliverMattermostReplyPayload, t as activateSlashCommands, u as parseMattermostModelPickerContext, v as resolveCallbackUrl, y as resolveSlashCommandConfig } from "./slash-state-CG0pjvJi.mjs";
8
8
  import { randomUUID } from "node:crypto";
9
9
  import { resolveGatewayPort } from "openclaw/plugin-sdk/gateway-config-runtime";
10
10
  import { resolvePinnedMainDmOwnerFromAllowlist, sanitizeUntrustedFileName } from "openclaw/plugin-sdk/security-runtime";
@@ -215,7 +215,7 @@ function shouldDropEmptyMattermostBody(params) {
215
215
  }
216
216
  //#endregion
217
217
  //#region extensions/mattermost/src/mattermost/monitor-websocket.ts
218
- const MATTERMOST_WEBSOCKET_MAX_PAYLOAD_BYTES = 16 * 1024 * 1024;
218
+ const MATTERMOST_WEBSOCKET_MAX_PAYLOAD_BYTES = 16777216;
219
219
  const MATTERMOST_WEBSOCKET_HANDSHAKE_TIMEOUT_MS = 3e4;
220
220
  const MATTERMOST_WEBSOCKET_AUTH_TIMEOUT_MS = 3e4;
221
221
  const MattermostEventPayloadSchema = z.object({
@@ -1254,8 +1254,8 @@ function formatMattermostInboundMediaText(params) {
1254
1254
  notice: `[mattermost ${unavailableCount > 1 ? `${unavailableCount} attachments` : "attachment"} unavailable]${fileNameNotice}`
1255
1255
  });
1256
1256
  }
1257
- const CHANNEL_CACHE_TTL_MS = 5 * 6e4;
1258
- const USER_CACHE_TTL_MS = 10 * 6e4;
1257
+ const CHANNEL_CACHE_TTL_MS = 3e5;
1258
+ const USER_CACHE_TTL_MS = 6e5;
1259
1259
  const MONITOR_RESOURCE_CACHE_MAX_ENTRIES = 1e3;
1260
1260
  const MATTERMOST_MEDIA_RESPONSE_HEADER_TIMEOUT_MS = 12e4;
1261
1261
  const MATTERMOST_MEDIA_READ_IDLE_TIMEOUT_MS = 3e4;
@@ -1845,7 +1845,7 @@ async function deliverMattermostReplyWithDraftPreview(params) {
1845
1845
  //#region extensions/mattermost/src/mattermost/thread-participation.ts
1846
1846
  const threadParticipation = createPersistentDedupeCache({
1847
1847
  globalKey: Symbol.for("openclaw.mattermostThreadParticipation"),
1848
- ttlMs: 10080 * 60 * 1e3,
1848
+ ttlMs: 6048e5,
1849
1849
  maxSize: 5e3,
1850
1850
  persistent: {
1851
1851
  namespace: "mattermost.thread-participation",
@@ -2870,7 +2870,7 @@ async function monitorMattermostProvider(opts = {}) {
2870
2870
  cfg,
2871
2871
  resolveChannelLimitMb: () => account.config.mediaMaxMb,
2872
2872
  accountId: account.accountId
2873
- }) ?? 8 * 1024 * 1024;
2873
+ }) ?? 8388608;
2874
2874
  const { groupPolicy, providerMissingFallbackApplied } = resolveAllowlistProviderRuntimeGroupPolicy$1({
2875
2875
  providerConfigPresent: cfg.channels?.mattermost !== void 0,
2876
2876
  groupPolicy: account.config.groupPolicy,
@@ -3085,7 +3085,7 @@ async function probeMattermost(baseUrl, botToken, timeoutMs = 2500, allowPrivate
3085
3085
  }
3086
3086
  //#endregion
3087
3087
  //#region extensions/mattermost/src/mattermost/reactions.ts
3088
- const BOT_USER_CACHE_TTL_MS = 10 * 6e4;
3088
+ const BOT_USER_CACHE_TTL_MS = 6e5;
3089
3089
  const botUserIdCache = /* @__PURE__ */ new Map();
3090
3090
  async function resolveBotUserId(client, cacheKey) {
3091
3091
  const rawNow = Date.now();
@@ -10,9 +10,9 @@ import { retryAsync } from "openclaw/plugin-sdk/retry-runtime";
10
10
  import { fetchWithSsrFGuard, ssrfPolicyFromPrivateNetworkOptIn } from "openclaw/plugin-sdk/ssrf-runtime";
11
11
  import { z } from "zod";
12
12
  //#region extensions/mattermost/src/mattermost/client.ts
13
- const MATTERMOST_ERROR_BODY_LIMIT_BYTES = 8 * 1024;
13
+ const MATTERMOST_ERROR_BODY_LIMIT_BYTES = 8192;
14
14
  const MATTERMOST_REQUEST_TIMEOUT_MS = 3e4;
15
- const MATTERMOST_TEXT_RESPONSE_LIMIT_BYTES = 64 * 1024;
15
+ const MATTERMOST_TEXT_RESPONSE_LIMIT_BYTES = 65536;
16
16
  const MattermostPostSchema = z.object({
17
17
  id: z.string(),
18
18
  user_id: z.string().nullable().optional(),
@@ -98,18 +98,20 @@ function createMattermostClient(params) {
98
98
  const fetchImpl = (externalFetchImpl ? async (input, init) => {
99
99
  const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url;
100
100
  const { timeoutMs: initTimeoutMs, ...requestInit } = init ?? {};
101
+ const timeoutMs = resolveTimerTimeoutMs(initTimeoutMs, requestTimeoutMs);
101
102
  const { signal: timeoutSignal, cleanup } = buildTimeoutAbortSignal({
102
- timeoutMs: resolveTimerTimeoutMs(initTimeoutMs, requestTimeoutMs),
103
+ timeoutMs,
103
104
  operation: "mattermost-api",
104
105
  url
105
106
  });
106
107
  const callerSignal = requestInit.signal ?? void 0;
107
108
  const signal = callerSignal && timeoutSignal ? AbortSignal.any([callerSignal, timeoutSignal]) : callerSignal ?? timeoutSignal;
108
109
  try {
109
- return responseWithRelease(await externalFetchImpl(input, {
110
+ const response = await externalFetchImpl(input, {
110
111
  ...requestInit,
111
112
  signal
112
- }), async () => cleanup());
113
+ });
114
+ return responseWithRelease(response, async () => cleanup());
113
115
  } catch (error) {
114
116
  cleanup();
115
117
  throw error;
@@ -1,12 +1,12 @@
1
- import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.js";
2
- import { v as updateMattermostPost } from "./client-DAIry9-2.js";
3
- import { S as resolveClientIp, p as isTrustedProxyAddress, v as readRequestBodyWithLimit } from "./monitor-auth-CACk1Hos.js";
1
+ import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.mjs";
2
+ import { v as updateMattermostPost } from "./client-D3Btt1WT.mjs";
3
+ import { S as resolveClientIp, p as isTrustedProxyAddress, v as readRequestBodyWithLimit } from "./monitor-auth-5PSi3kAe.mjs";
4
4
  import { createHmac } from "node:crypto";
5
5
  import { resolveGatewayPort } from "openclaw/plugin-sdk/gateway-config-runtime";
6
6
  import { safeEqualSecret } from "openclaw/plugin-sdk/security-runtime";
7
7
  import { normalizeOptionalString, normalizeStringifiedOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
8
8
  //#region extensions/mattermost/src/mattermost/interactions.ts
9
- const INTERACTION_MAX_BODY_BYTES = 64 * 1024;
9
+ const INTERACTION_MAX_BODY_BYTES = 65536;
10
10
  const INTERACTION_BODY_TIMEOUT_MS = 1e4;
11
11
  const SIGNED_CHANNEL_ID_CONTEXT_KEY = "__openclaw_channel_id";
12
12
  const callbackUrls = /* @__PURE__ */ new Map();
@@ -32,13 +32,14 @@ function headerValue(value) {
32
32
  function isAllowedInteractionSource(params) {
33
33
  const { allowedSourceIps } = params;
34
34
  if (!allowedSourceIps?.length) return true;
35
- return isTrustedProxyAddress(resolveClientIp({
35
+ const clientIp = resolveClientIp({
36
36
  remoteAddr: params.req.socket?.remoteAddress,
37
37
  forwardedFor: headerValue(params.req.headers["x-forwarded-for"]),
38
38
  realIp: headerValue(params.req.headers["x-real-ip"]),
39
39
  trustedProxies: params.trustedProxies,
40
40
  allowRealIpFallback: params.allowRealIpFallback
41
- }), allowedSourceIps);
41
+ });
42
+ return isTrustedProxyAddress(clientIp, allowedSourceIps);
42
43
  }
43
44
  /**
44
45
  * Resolve the interaction callback URL for an account.
@@ -99,7 +100,8 @@ function generateInteractionToken(context, accountId) {
99
100
  return createHmac("sha256", secret).update(payload).digest("hex");
100
101
  }
101
102
  function verifyInteractionToken(context, token, accountId) {
102
- return safeEqualSecret(generateInteractionToken(context, accountId), token);
103
+ const expected = generateInteractionToken(context, accountId);
104
+ return safeEqualSecret(expected, token);
103
105
  }
104
106
  /**
105
107
  * Build Mattermost `props.attachments` with interactive buttons.
@@ -1,4 +1,4 @@
1
- import { n as normalizeMattermostAllowEntry, t as mattermostIngressIdentity } from "./ingress-identity-DNl4yQSc.js";
1
+ import { n as normalizeMattermostAllowEntry, t as mattermostIngressIdentity } from "./ingress-identity-DNl4yQSc.mjs";
2
2
  import { uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
3
3
  import { logInboundDrop } from "openclaw/plugin-sdk/channel-inbound";
4
4
  import { resolveAllowlistMatchSimple } from "openclaw/plugin-sdk/allow-from";
@@ -18,7 +18,8 @@ import { isTrustedProxyAddress, resolveClientIp } from "openclaw/plugin-sdk/core
18
18
  import { resolveStableChannelMessageIngress } from "openclaw/plugin-sdk/channel-ingress-runtime";
19
19
  //#region extensions/mattermost/src/mattermost/monitor-auth.ts
20
20
  function normalizeMattermostAllowList(entries) {
21
- return uniqueStrings(entries.map((entry) => normalizeMattermostAllowEntry(String(entry))).filter(Boolean));
21
+ const normalized = entries.map((entry) => normalizeMattermostAllowEntry(String(entry))).filter(Boolean);
22
+ return uniqueStrings(normalized);
22
23
  }
23
24
  function formatMattermostDirectMessageDropLog(params) {
24
25
  const reason = params.reasonCode ? ` reason=${params.reasonCode}` : "";
@@ -26,8 +27,9 @@ function formatMattermostDirectMessageDropLog(params) {
26
27
  return `mattermost: drop dm sender=${params.senderId} (dmPolicy=${params.dmPolicy}${reason}${hint})`;
27
28
  }
28
29
  function isMattermostSenderAllowed(params) {
30
+ const allowFrom = normalizeMattermostAllowList(params.allowFrom);
29
31
  return resolveAllowlistMatchSimple({
30
- allowFrom: normalizeMattermostAllowList(params.allowFrom),
32
+ allowFrom,
31
33
  senderId: normalizeMattermostAllowEntry(params.senderId),
32
34
  senderName: params.senderName ? normalizeMattermostAllowEntry(params.senderName) : void 0,
33
35
  allowNameMatching: params.allowNameMatching
@@ -1,4 +1,4 @@
1
- import { m as normalizeMattermostBaseUrl } from "./client-DAIry9-2.js";
1
+ import { m as normalizeMattermostBaseUrl } from "./client-D3Btt1WT.mjs";
2
2
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
3
3
  import { resolveChannelPreviewStreamMode, resolveChannelStreamingBlockCoalesce, resolveChannelStreamingBlockEnabled, resolveChannelStreamingChunkMode } from "openclaw/plugin-sdk/channel-outbound";
4
4
  import { createAccountListHelpers, hasConfiguredAccountValue } from "openclaw/plugin-sdk/account-helpers";
@@ -68,10 +68,18 @@ function resolveMattermostAccount(params) {
68
68
  });
69
69
  }
70
70
  function inspectMattermostAccount(params) {
71
- return resolveMattermostAccountWithMode({
71
+ const account = resolveMattermostAccountWithMode({
72
72
  ...params,
73
73
  mode: "inspect"
74
74
  });
75
+ return {
76
+ ...account,
77
+ configured: isMattermostConfigured(account),
78
+ dmPolicy: account.config.dmPolicy ?? "pairing"
79
+ };
80
+ }
81
+ function isMattermostConfigured(account) {
82
+ return (account.botTokenStatus ? account.botTokenStatus !== "missing" : Boolean(account.botToken)) && Boolean(account.baseUrl);
75
83
  }
76
84
  /**
77
85
  * Resolve the effective replyToMode for a given chat type.
@@ -148,4 +156,4 @@ function looksLikeMattermostTargetId(raw, _normalized) {
148
156
  return /^[a-z0-9]{26}$/i.test(trimmed) || /^[a-z0-9]{26}__[a-z0-9]{26}$/i.test(trimmed);
149
157
  }
150
158
  //#endregion
151
- export { inspectMattermostAccount as a, resolveMattermostAccount as c, hasConfiguredSecretInput as d, resolveMattermostPresentation as i, resolveMattermostReplyToMode as l, normalizeMattermostMessagingTarget as n, listMattermostAccountIds as o, requiresMattermostMediaUpload as r, resolveDefaultMattermostAccountId as s, looksLikeMattermostTargetId as t, buildSecretInputSchema as u };
159
+ export { inspectMattermostAccount as a, resolveDefaultMattermostAccountId as c, buildSecretInputSchema as d, hasConfiguredSecretInput as f, resolveMattermostPresentation as i, resolveMattermostAccount as l, normalizeMattermostMessagingTarget as n, isMattermostConfigured as o, requiresMattermostMediaUpload as r, listMattermostAccountIds as s, looksLikeMattermostTargetId as t, resolveMattermostReplyToMode as u };
@@ -0,0 +1,3 @@
1
+ import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries, t as channelSecrets } from "./secret-contract-qg3NXRlS.mjs";
2
+ import "../secret-contract-api.js";
3
+ export { channelSecrets, collectRuntimeConfigAssignments, secretTargetRegistryEntries };
@@ -1,8 +1,8 @@
1
- import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.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
- import { _ as logTypingFailure, c as buildPreparedModelsProviderData, f as isRequestBodyLimitError, h as loadOutboundMediaFromUrl, i as normalizeMattermostAllowList, o as resolveMattermostTrustedChatKind, t as authorizeMattermostCommandInvocation, v as readRequestBodyWithLimit } from "./monitor-auth-CACk1Hos.js";
4
- import { c as setInteractionSecret, n as buildButtonProps, o as resolveInteractionCallbackUrl } from "./interactions-LnudXdqD.js";
5
- import { c as resolveMattermostAccount, i as resolveMattermostPresentation, r as requiresMattermostMediaUpload } from "./normalize-DoleH0bY.js";
1
+ import { t as getMattermostRuntime } from "./runtime-CNB4YGqJ.mjs";
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-D3Btt1WT.mjs";
3
+ import { _ as logTypingFailure, c as buildPreparedModelsProviderData, f as isRequestBodyLimitError, h as loadOutboundMediaFromUrl, i as normalizeMattermostAllowList, o as resolveMattermostTrustedChatKind, t as authorizeMattermostCommandInvocation, v as readRequestBodyWithLimit } from "./monitor-auth-5PSi3kAe.mjs";
4
+ import { c as setInteractionSecret, n as buildButtonProps, o as resolveInteractionCallbackUrl } from "./interactions-D_JtOrNT.mjs";
5
+ import { i as resolveMattermostPresentation, l as resolveMattermostAccount, r as requiresMattermostMediaUpload } from "./normalize-D6YiIrp8.mjs";
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";
@@ -689,7 +689,7 @@ async function deliverMattermostReplyPayload(params) {
689
689
  //#endregion
690
690
  //#region extensions/mattermost/src/mattermost/target-resolution.ts
691
691
  const MATTERMOST_OPAQUE_TARGET_CACHE_MAX_ENTRIES = 1024;
692
- const MATTERMOST_OPAQUE_TARGET_CACHE_TTL_MS = 300 * 1e3;
692
+ const MATTERMOST_OPAQUE_TARGET_CACHE_TTL_MS = 3e5;
693
693
  const mattermostOpaqueTargetCache = /* @__PURE__ */ new Map();
694
694
  function cacheMattermostOpaqueTarget(key, kind) {
695
695
  mattermostOpaqueTargetCache.set(key, {
@@ -823,7 +823,8 @@ async function resolveMattermostOpaqueTarget(params) {
823
823
  };
824
824
  }
825
825
  try {
826
- const channelKind = resolveMattermostTrustedChatKind({ channelType: (await fetchMattermostChannel(client, input)).type }) === "group" ? "group" : "channel";
826
+ const channel = await fetchMattermostChannel(client, input);
827
+ const channelKind = resolveMattermostTrustedChatKind({ channelType: channel.type }) === "group" ? "group" : "channel";
827
828
  cacheMattermostOpaqueTarget(key, channelKind);
828
829
  return {
829
830
  kind: channelKind,
@@ -902,11 +903,12 @@ async function resolveBotUser(baseUrl, token, allowPrivateNetwork) {
902
903
  const key = cacheKey(baseUrl, token);
903
904
  const cached = botUserCache.get(key);
904
905
  if (cached) return cached;
905
- const user = await fetchMattermostMe(createMattermostClient({
906
+ const client = createMattermostClient({
906
907
  baseUrl,
907
908
  botToken: token,
908
909
  allowPrivateNetwork
909
- }));
910
+ });
911
+ const user = await fetchMattermostMe(client);
910
912
  cacheOutboundEntry(botUserCache, key, user, MATTERMOST_BOT_USER_CACHE_MAX_ENTRIES);
911
913
  return user;
912
914
  }
@@ -915,11 +917,12 @@ async function resolveUserIdByUsername(params) {
915
917
  const key = `${cacheKey(baseUrl, token)}::${normalizeLowercaseStringOrEmpty(username)}`;
916
918
  const cached = userByNameCache.get(key);
917
919
  if (cached?.id) return cached.id;
918
- const user = await fetchMattermostUserByUsername(createMattermostClient({
920
+ const client = createMattermostClient({
919
921
  baseUrl,
920
922
  botToken: token,
921
923
  allowPrivateNetwork: params.allowPrivateNetwork
922
- }), username);
924
+ });
925
+ const user = await fetchMattermostUserByUsername(client, username);
923
926
  cacheOutboundEntry(userByNameCache, key, user, MATTERMOST_TARGET_CACHE_MAX_ENTRIES);
924
927
  return user.id;
925
928
  }
@@ -933,7 +936,8 @@ async function resolveChannelIdByName(params) {
933
936
  botToken: token,
934
937
  allowPrivateNetwork: params.allowPrivateNetwork
935
938
  });
936
- const teams = await fetchMattermostUserTeams(client, (await fetchMattermostMe(client)).id);
939
+ const me = await fetchMattermostMe(client);
940
+ const teams = await fetchMattermostUserTeams(client, me.id);
937
941
  for (const team of teams) try {
938
942
  const channel = await fetchMattermostChannelByName(client, team.id, name);
939
943
  if (channel?.id) {
@@ -974,11 +978,12 @@ async function resolveTargetChannelId(params) {
974
978
  const cachedDm = dmChannelCache.get(dmKey);
975
979
  if (cachedDm) return cachedDm;
976
980
  const botUser = await resolveBotUser(params.baseUrl, params.token, params.allowPrivateNetwork);
977
- const channel = await createMattermostDirectChannelWithRetry(createMattermostClient({
981
+ const client = createMattermostClient({
978
982
  baseUrl: params.baseUrl,
979
983
  botToken: params.token,
980
984
  allowPrivateNetwork: params.allowPrivateNetwork
981
- }), [botUser.id, userId], {
985
+ });
986
+ const channel = await createMattermostDirectChannelWithRetry(client, [botUser.id, userId], {
982
987
  ...params.dmRetryOptions,
983
988
  onRetry: (attempt, delayMs, error) => {
984
989
  params.dmRetryOptions?.onRetry?.(attempt, delayMs, error);
@@ -1143,7 +1148,7 @@ async function sendMessageMattermost(to, text, opts) {
1143
1148
  }
1144
1149
  //#endregion
1145
1150
  //#region extensions/mattermost/src/mattermost/slash-http.ts
1146
- const MAX_BODY_BYTES = 64 * 1024;
1151
+ const MAX_BODY_BYTES = 65536;
1147
1152
  const BODY_READ_TIMEOUT_MS = 5e3;
1148
1153
  const COMMAND_LOOKUP_TIMEOUT_MS = 1e3;
1149
1154
  const COMMAND_VALIDATION_FAILURE_CACHE_MS = 5e3;
@@ -1185,7 +1190,7 @@ function isDeletedMattermostCommand(command) {
1185
1190
  return typeof command.delete_at === "number" && command.delete_at > 0;
1186
1191
  }
1187
1192
  function sanitizeCommandLookupError(error) {
1188
- return truncateUtf16Safe((error instanceof Error ? error.message : String(error)).replace(/[\r\n\t]/gu, " ").replace(/https?:\/\/[^\s)\]}]+/giu, (urlText) => {
1193
+ const sanitized = (error instanceof Error ? error.message : String(error)).replace(/[\r\n\t]/gu, " ").replace(/https?:\/\/[^\s)\]}]+/giu, (urlText) => {
1189
1194
  try {
1190
1195
  const url = new URL(urlText);
1191
1196
  if (url.username || url.password) {
@@ -1197,7 +1202,8 @@ function sanitizeCommandLookupError(error) {
1197
1202
  } catch {
1198
1203
  return urlText;
1199
1204
  }
1200
- }).replace(/(^|[^\w-])(Bearer|Token)\s+[A-Za-z0-9._~+/=-]+/giu, "$1$2 [redacted]").replace(/\b(token|authorization|access_token|refresh_token|client_secret|botToken)\b(\s*["']?\s*(?:=|:)\s*["']?)[^"',\s;}]+/giu, "$1$2[redacted]"), 300);
1205
+ }).replace(/(^|[^\w-])(Bearer|Token)\s+[A-Za-z0-9._~+/=-]+/giu, "$1$2 [redacted]").replace(/\b(token|authorization|access_token|refresh_token|client_secret|botToken)\b(\s*["']?\s*(?:=|:)\s*["']?)[^"',\s;}]+/giu, "$1$2[redacted]");
1206
+ return truncateUtf16Safe(sanitized, 300);
1201
1207
  }
1202
1208
  function sanitizeMattermostLogValue(value) {
1203
1209
  return truncateUtf16Safe(value.replace(/[\r\n\t]/gu, " "), 200);
@@ -1277,7 +1283,8 @@ function sweepCommandValidationLookupRateLimit(now = Date.now()) {
1277
1283
  }
1278
1284
  }
1279
1285
  function reserveCommandValidationLookup(params) {
1280
- const now = asDateTimestampMs(params.now ?? Date.now());
1286
+ const rawNow = params.now ?? Date.now();
1287
+ const now = asDateTimestampMs(rawNow);
1281
1288
  if (now === void 0) {
1282
1289
  commandValidationLookupRateLimit.clear();
1283
1290
  return { allowed: true };
@@ -1287,7 +1294,7 @@ function reserveCommandValidationLookup(params) {
1287
1294
  if (!existing) {
1288
1295
  commandValidationLookupRateLimit.set(params.key, {
1289
1296
  accountId: params.accountId,
1290
- tokens: COMMAND_VALIDATION_LOOKUP_BURST - 1,
1297
+ tokens: 19,
1291
1298
  updatedAt: now,
1292
1299
  lastLimitedLogAt: 0
1293
1300
  });
@@ -1714,7 +1721,7 @@ async function handleSlashCommandAsync(params) {
1714
1721
  }
1715
1722
  //#endregion
1716
1723
  //#region extensions/mattermost/src/mattermost/slash-state.ts
1717
- const MULTI_ACCOUNT_BODY_MAX_BYTES = 64 * 1024;
1724
+ const MULTI_ACCOUNT_BODY_MAX_BYTES = 65536;
1718
1725
  const MULTI_ACCOUNT_BODY_TIMEOUT_MS = 5e3;
1719
1726
  /**
1720
1727
  * Map from accountId → per-account slash command state.
package/dist/api.js CHANGED
@@ -1,3 +1,3 @@
1
- import { r as isMattermostSenderAllowed } from "./monitor-auth-CACk1Hos.js";
2
- import { t as buildButtonAttachments } from "./interactions-LnudXdqD.js";
1
+ import { r as isMattermostSenderAllowed } from "./.setup/monitor-auth-5PSi3kAe.mjs";
2
+ import { t as buildButtonAttachments } from "./.setup/interactions-D_JtOrNT.mjs";
3
3
  export { buildButtonAttachments, isMattermostSenderAllowed };
@@ -1,38 +1,3 @@
1
- import { a as describeMattermostAccount, c as mattermostMeta, i as MattermostChannelConfigSchema, n as mattermostSetupWizard, o as isMattermostConfigured, r as mattermostSetupContract, s as mattermostConfigAdapter, t as mattermostPlugin } from "./channel-plugin-runtime-DGrYW6mT.js";
2
- import { t as resolveMattermostGatewayAuthBypassPaths } from "./gateway-auth-bypass-B93t91oq.js";
3
- //#region extensions/mattermost/src/channel.setup.ts
4
- const mattermostSetupPlugin = {
5
- id: "mattermost",
6
- meta: { ...mattermostMeta },
7
- capabilities: {
8
- chatTypes: [
9
- "direct",
10
- "channel",
11
- "group",
12
- "thread"
13
- ],
14
- reactions: true,
15
- threads: true,
16
- media: true,
17
- nativeCommands: true
18
- },
19
- reload: {
20
- configPrefixes: ["channels.mattermost"],
21
- /**
22
- * accounts.default is promoted; named resolution merges only channel-wide fields
23
- * plus the selected account. Runtime monitor, debounce, and ingress use accountId.
24
- */
25
- accountScopedRestart: true
26
- },
27
- configSchema: MattermostChannelConfigSchema,
28
- config: {
29
- ...mattermostConfigAdapter,
30
- isConfigured: isMattermostConfigured,
31
- describeAccount: describeMattermostAccount
32
- },
33
- gateway: { resolveGatewayAuthBypassPaths: resolveMattermostGatewayAuthBypassPaths },
34
- setupContract: mattermostSetupContract,
35
- setupWizard: mattermostSetupWizard
36
- };
37
- //#endregion
1
+ import { t as mattermostPlugin } from "./.setup/channel-plugin-runtime-5KTpFt5d.mjs";
2
+ import { t as mattermostSetupPlugin } from "./.setup/channel-plugin-api-DwYqw8BB.mjs";
38
3
  export { mattermostPlugin, mattermostSetupPlugin };
@@ -1,2 +1,2 @@
1
- import { t as mattermostPlugin } from "./channel-plugin-runtime-DGrYW6mT.js";
1
+ import { t as mattermostPlugin } from "./.setup/channel-plugin-runtime-5KTpFt5d.mjs";
2
2
  export { mattermostPlugin };
@@ -1,2 +1,2 @@
1
- import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-mvORF4f6.js";
1
+ import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./.setup/doctor-contract-mvORF4f6.mjs";
2
2
  export { legacyConfigRules, normalizeCompatibilityConfig };
@@ -1,2 +1,2 @@
1
- import { t as resolveMattermostGatewayAuthBypassPaths } from "./gateway-auth-bypass-B93t91oq.js";
1
+ import { t as resolveMattermostGatewayAuthBypassPaths } from "./.setup/gateway-auth-bypass-B93t91oq.mjs";
2
2
  export { resolveMattermostGatewayAuthBypassPaths as resolveGatewayAuthBypassPaths };
@@ -1,2 +1,2 @@
1
- import { r as isMattermostSenderAllowed } from "./monitor-auth-CACk1Hos.js";
1
+ import { r as isMattermostSenderAllowed } from "./.setup/monitor-auth-5PSi3kAe.mjs";
2
2
  export { isMattermostSenderAllowed };
@@ -1,4 +1,4 @@
1
- import { r as setMattermostRuntime } from "./runtime-CNB4YGqJ.js";
1
+ import { r as setMattermostRuntime } from "./.setup/runtime-CNB4YGqJ.mjs";
2
2
  import { formatInboundFromLabel, logInboundDrop } from "openclaw/plugin-sdk/channel-inbound";
3
3
  import { resolveAllowlistMatchSimple } from "openclaw/plugin-sdk/allow-from";
4
4
  import { createChannelPairingController } from "openclaw/plugin-sdk/channel-pairing";
@@ -1,2 +1,2 @@
1
- import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries, t as channelSecrets } from "./secret-contract-qg3NXRlS.js";
1
+ import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries, t as channelSecrets } from "./.setup/secret-contract-qg3NXRlS.mjs";
2
2
  export { channelSecrets, collectRuntimeConfigAssignments, secretTargetRegistryEntries };
@@ -1,13 +1,14 @@
1
1
  import { defineBundledChannelSetupEntry } from "openclaw/plugin-sdk/channel-entry-contract";
2
+ import { fileURLToPath } from "node:url";
2
3
  //#region extensions/mattermost/setup-entry.ts
3
4
  var setup_entry_default = defineBundledChannelSetupEntry({
4
5
  importMetaUrl: import.meta.url,
5
6
  plugin: {
6
- specifier: "./channel-plugin-api.js",
7
+ specifier: fileURLToPath(new URL(".setup/channel-plugin-api-B0CWOYS7.mjs", import.meta.url).href),
7
8
  exportName: "mattermostSetupPlugin"
8
9
  },
9
10
  secrets: {
10
- specifier: "./secret-contract-api.js",
11
+ specifier: fileURLToPath(new URL(".setup/secret-contract-api-Drab0Nqx.mjs", import.meta.url).href),
11
12
  exportName: "channelSecrets"
12
13
  }
13
14
  });
@@ -1,2 +1,2 @@
1
- import { i as registerSlashCommandRoute } from "./slash-state-CPIuJQj2.js";
1
+ import { i as registerSlashCommandRoute } from "./.setup/slash-state-CG0pjvJi.mjs";
2
2
  export { registerSlashCommandRoute };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/mattermost",
3
- "version": "2026.8.1",
3
+ "version": "2026.8.33",
4
4
  "description": "OpenClaw Mattermost channel plugin",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,7 +12,7 @@
12
12
  "zod": "4.4.3"
13
13
  },
14
14
  "peerDependencies": {
15
- "openclaw": ">=2026.8.1"
15
+ "openclaw": ">=2026.8.33"
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"
94
+ "pluginApi": ">=2026.8.33"
95
95
  },
96
96
  "build": {
97
- "openclawVersion": "2026.8.1",
97
+ "openclawVersion": "2026.8.33",
98
98
  "bundledDist": false
99
99
  },
100
100
  "release": {