@openclaw/mattermost 2026.9.1-beta.1 → 2026.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.js +2 -2
- package/dist/channel-plugin-api.js +3 -1
- package/dist/{channel-plugin-runtime-Bh8hcegp.js → channel-plugin-runtime-Bq86sS1N.js} +107 -141
- package/dist/channel-plugin-runtime.js +1 -1
- package/dist/{channel.runtime-DLTjcasQ.js → channel.runtime-B454n78J.js} +80 -32
- package/dist/{client-DAIry9-2.js → client-Dt7Q-j5B.js} +9 -7
- package/dist/ingress-identity-DNl4yQSc.js +27 -0
- package/dist/{interactions-k47k-7SP.js → interactions-DF1FH27_.js} +28 -15
- package/dist/{monitor-auth-CVd_4FPD.js → monitor-auth-C6RGYyn-.js} +12 -31
- package/dist/{normalize-bBDFEiyJ.js → normalize-R-ATEEHC.js} +12 -4
- package/dist/policy-api.js +1 -1
- package/dist/runtime-api.js +5 -4
- package/dist/slash-route-api.js +1 -1
- package/dist/{slash-state-CfsJU7WW.js → slash-state-njvQCdwt.js} +49 -52
- package/openclaw.plugin.json +27 -2
- package/package.json +4 -4
package/dist/api.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { t as buildButtonAttachments } from "./interactions-DF1FH27_.js";
|
|
2
|
+
import { r as isMattermostSenderAllowed } from "./monitor-auth-C6RGYyn-.js";
|
|
3
3
|
export { buildButtonAttachments, isMattermostSenderAllowed };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as isMattermostConfigured } from "./normalize-R-ATEEHC.js";
|
|
2
|
+
import { a as describeMattermostAccount, i as MattermostChannelConfigSchema, n as mattermostSetupWizard, o as mattermostConfigAdapter, r as mattermostSetupContract, s as mattermostMeta, t as mattermostPlugin } from "./channel-plugin-runtime-Bq86sS1N.js";
|
|
2
3
|
import { t as resolveMattermostGatewayAuthBypassPaths } from "./gateway-auth-bypass-B93t91oq.js";
|
|
3
4
|
//#region extensions/mattermost/src/channel.setup.ts
|
|
4
5
|
const mattermostSetupPlugin = {
|
|
@@ -18,6 +19,7 @@ const mattermostSetupPlugin = {
|
|
|
18
19
|
},
|
|
19
20
|
reload: {
|
|
20
21
|
configPrefixes: ["channels.mattermost"],
|
|
22
|
+
noopPrefixes: ["messages.inbound"],
|
|
21
23
|
/**
|
|
22
24
|
* accounts.default is promoted; named resolution merges only channel-wide fields
|
|
23
25
|
* plus the selected account. Runtime monitor, debounce, and ingress use accountId.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { m as normalizeMattermostBaseUrl } from "./client-
|
|
2
|
-
import {
|
|
1
|
+
import { m as normalizeMattermostBaseUrl } from "./client-Dt7Q-j5B.js";
|
|
2
|
+
import { t as mattermostIngressIdentity } from "./ingress-identity-DNl4yQSc.js";
|
|
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-R-ATEEHC.js";
|
|
3
4
|
import { t as resolveMattermostGatewayAuthBypassPaths } from "./gateway-auth-bypass-B93t91oq.js";
|
|
4
5
|
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-mvORF4f6.js";
|
|
5
6
|
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-qg3NXRlS.js";
|
|
6
|
-
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, buildChannelOutboundSessionRoute, buildThreadAwareOutboundSessionRoute, stripChannelTargetPrefix, stripTargetKindPrefix } from "openclaw/plugin-sdk/core";
|
|
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";
|
|
@@ -11,6 +11,9 @@ import { z } from "zod";
|
|
|
11
11
|
import { formatNormalizedAllowFromEntries } from "openclaw/plugin-sdk/allow-from";
|
|
12
12
|
import { createLoggedPairingApprovalNotifier } from "openclaw/plugin-sdk/channel-pairing";
|
|
13
13
|
import { createAccountStatusSink, createChannelMessageAdapterFromOutbound } from "openclaw/plugin-sdk/channel-outbound";
|
|
14
|
+
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
15
|
+
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1, buildChannelOutboundSessionRoute, buildThreadAwareOutboundSessionRoute, stripChannelTargetPrefix, stripTargetKindPrefix } from "openclaw/plugin-sdk/core";
|
|
16
|
+
import { identityEntryAuthenticationClassifier } from "openclaw/plugin-sdk/channel-ingress-runtime";
|
|
14
17
|
import { jsonResult, readPositiveIntegerParam, readStringArrayParam, readStringParam, withNormalizedTimestamp } from "openclaw/plugin-sdk/channel-actions";
|
|
15
18
|
import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
16
19
|
import { createChannelConfigUiHints, createChatChannelPlugin } from "openclaw/plugin-sdk/channel-core";
|
|
@@ -23,16 +26,16 @@ import { resolvePayloadMediaUrls, sendTextMediaPayload } from "openclaw/plugin-s
|
|
|
23
26
|
import { createComputedAccountStatusAdapter, createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/status-helpers";
|
|
24
27
|
import { chunkTextForOutbound, sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-chunking";
|
|
25
28
|
import { createChannelApprovalAuth } from "openclaw/plugin-sdk/approval-auth-runtime";
|
|
26
|
-
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
27
29
|
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
28
|
-
import { BlockStreamingCoalesceSchema, ChannelImplicitMentionsSchema, DmPolicySchema, GroupPolicySchema, MarkdownConfigSchema, buildChannelConfigSchema, buildGroupEntrySchema, buildMultiAccountChannelSchema, requireOpenAllowFrom } from "openclaw/plugin-sdk/channel-config-schema";
|
|
30
|
+
import { BlockStreamingCoalesceSchema, ChannelImplicitMentionsSchema, ContextVisibilityModeSchema, DmPolicySchema, GroupPolicySchema, MarkdownConfigSchema, buildChannelConfigSchema, buildGroupEntrySchema, buildMultiAccountChannelSchema, requireOpenAllowFrom } from "openclaw/plugin-sdk/channel-config-schema";
|
|
29
31
|
import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
|
|
30
32
|
import { applyAccountNameToChannelSection, applySetupAccountConfigPatch, baseUrlTextInput, createSetupTranslator, createStandardChannelSetupStatus, defineTokenCredential, formatDocsLink, migrateBaseNameToDefaultAccount, setSetupChannelEnabled } from "openclaw/plugin-sdk/setup";
|
|
31
33
|
import { createSetupInputPresenceValidator } from "openclaw/plugin-sdk/setup-runtime";
|
|
32
34
|
//#region extensions/mattermost/src/approval-auth.ts
|
|
33
35
|
const MATTERMOST_USER_ID_RE = /^[a-z0-9]{26}$/;
|
|
34
36
|
function normalizeMattermostApproverId(value) {
|
|
35
|
-
const
|
|
37
|
+
const normalized = String(value).trim().replace(/^(mattermost|user):/i, "").replace(/^@/, "").trim();
|
|
38
|
+
const lowered = normalizeLowercaseStringOrEmpty(normalized);
|
|
36
39
|
return MATTERMOST_USER_ID_RE.test(lowered) ? lowered : void 0;
|
|
37
40
|
}
|
|
38
41
|
const mattermostApprovalAuth = createChannelApprovalAuth({
|
|
@@ -87,9 +90,6 @@ const mattermostConfigAdapter = createScopedChannelConfigAdapter({
|
|
|
87
90
|
normalizeEntry: formatMattermostAllowEntry
|
|
88
91
|
})
|
|
89
92
|
});
|
|
90
|
-
function isMattermostConfigured$1(account) {
|
|
91
|
-
return (account.botTokenStatus ? account.botTokenStatus !== "missing" : Boolean(account.botToken)) && Boolean(account.baseUrl);
|
|
92
|
-
}
|
|
93
93
|
function describeMattermostAccount(account) {
|
|
94
94
|
return describeAccountSnapshot({
|
|
95
95
|
account,
|
|
@@ -189,16 +189,16 @@ const MattermostReplyToModeByChatTypeSchema = z.object({
|
|
|
189
189
|
group: MattermostReplyToModeSchema.optional(),
|
|
190
190
|
channel: MattermostReplyToModeSchema.optional()
|
|
191
191
|
}).strict();
|
|
192
|
-
|
|
193
|
-
//#region extensions/mattermost/src/config-surface.ts
|
|
194
|
-
const MattermostChannelConfigSchema = buildChannelConfigSchema(buildMultiAccountChannelSchema(z.object({
|
|
192
|
+
const MattermostAccountSchemaBase = z.object({
|
|
195
193
|
name: z.string().optional(),
|
|
196
194
|
capabilities: z.array(z.string()).optional(),
|
|
197
195
|
dangerouslyAllowNameMatching: z.boolean().optional(),
|
|
198
196
|
markdown: MarkdownConfigSchema,
|
|
199
197
|
enabled: z.boolean().optional(),
|
|
200
198
|
configWrites: z.boolean().optional(),
|
|
199
|
+
contextVisibility: ContextVisibilityModeSchema.optional(),
|
|
201
200
|
historyLimit: z.number().int().min(0).optional(),
|
|
201
|
+
mediaMaxMb: z.number().positive().optional(),
|
|
202
202
|
botToken: buildSecretInputSchema().optional(),
|
|
203
203
|
baseUrl: z.string().optional(),
|
|
204
204
|
chatmode: z.enum([
|
|
@@ -233,7 +233,8 @@ const MattermostChannelConfigSchema = buildChannelConfigSchema(buildMultiAccount
|
|
|
233
233
|
network: MattermostNetworkSchema,
|
|
234
234
|
/** Retry configuration for DM channel creation */
|
|
235
235
|
dmChannelRetry: DmChannelRetrySchema
|
|
236
|
-
}).strict()
|
|
236
|
+
}).strict();
|
|
237
|
+
const MattermostConfigSchema = buildMultiAccountChannelSchema(MattermostAccountSchemaBase, {
|
|
237
238
|
optionalAccount: true,
|
|
238
239
|
refine: (value, ctx) => {
|
|
239
240
|
requireMattermostOpenAllowFrom({
|
|
@@ -242,7 +243,10 @@ const MattermostChannelConfigSchema = buildChannelConfigSchema(buildMultiAccount
|
|
|
242
243
|
ctx
|
|
243
244
|
});
|
|
244
245
|
}
|
|
245
|
-
})
|
|
246
|
+
});
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region extensions/mattermost/src/config-ui-hints.ts
|
|
249
|
+
const mattermostChannelConfigUiHints = {
|
|
246
250
|
"": {
|
|
247
251
|
label: "Mattermost",
|
|
248
252
|
help: "Mattermost channel provider configuration for bot auth, access policy, slash commands, and preview streaming."
|
|
@@ -261,15 +265,22 @@ const MattermostChannelConfigSchema = buildChannelConfigSchema(buildMultiAccount
|
|
|
261
265
|
},
|
|
262
266
|
progress: {}
|
|
263
267
|
})
|
|
264
|
-
}
|
|
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
|
+
});
|
|
265
280
|
const mattermostDoctor = {
|
|
266
281
|
legacyConfigRules,
|
|
267
282
|
normalizeCompatibilityConfig,
|
|
268
|
-
collectMutableAllowlistWarnings:
|
|
269
|
-
channel: "mattermost",
|
|
270
|
-
detector: buildMutableAllowEntryDetector({ stableIdPattern: /^(?:(?:mattermost|user):)?@?[a-z0-9]{26}$/i }),
|
|
271
|
-
collectLists: (scope) => collectStandardAllowlistLists(scope)
|
|
272
|
-
})
|
|
283
|
+
collectMutableAllowlistWarnings: collectMattermostMutableAllowlistWarnings
|
|
273
284
|
};
|
|
274
285
|
//#endregion
|
|
275
286
|
//#region extensions/mattermost/src/group-mentions.ts
|
|
@@ -368,21 +379,22 @@ function resolveMattermostOutboundSessionRoute(params) {
|
|
|
368
379
|
const recipientSessionExact = isUser && hasExplicitUserKind && /^[a-z0-9]{26}$/.test(rawId);
|
|
369
380
|
const isGroup = !isUser && (resolvedKind === "group" || resolvedKind !== "channel" && (lower.startsWith("group:") || mattermostSessionKeyPeerKind(params.currentSessionKey, rawId) === "group"));
|
|
370
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
|
+
});
|
|
371
396
|
return buildThreadAwareOutboundSessionRoute({
|
|
372
|
-
route:
|
|
373
|
-
cfg: params.cfg,
|
|
374
|
-
agentId: params.agentId,
|
|
375
|
-
channel: "mattermost",
|
|
376
|
-
accountId: params.accountId,
|
|
377
|
-
recipientSessionExact,
|
|
378
|
-
peer: {
|
|
379
|
-
kind,
|
|
380
|
-
id: rawId
|
|
381
|
-
},
|
|
382
|
-
chatType: kind,
|
|
383
|
-
from: isUser ? `mattermost:${rawId}` : `mattermost:${kind}:${rawId}`,
|
|
384
|
-
to: isUser ? `user:${rawId}` : `channel:${rawId}`
|
|
385
|
-
}),
|
|
397
|
+
route: baseRoute,
|
|
386
398
|
replyToId: params.replyToId,
|
|
387
399
|
threadId: params.threadId,
|
|
388
400
|
currentSessionKey: params.currentSessionKey,
|
|
@@ -408,16 +420,58 @@ function applyMattermostSetupConfigPatch(params) {
|
|
|
408
420
|
accountId: params.accountId,
|
|
409
421
|
name: params.name
|
|
410
422
|
});
|
|
423
|
+
const next = params.accountId !== DEFAULT_ACCOUNT_ID ? migrateBaseNameToDefaultAccount({
|
|
424
|
+
cfg: namedConfig,
|
|
425
|
+
channelKey: channel$1
|
|
426
|
+
}) : namedConfig;
|
|
411
427
|
return applySetupAccountConfigPatch({
|
|
412
|
-
cfg:
|
|
413
|
-
cfg: namedConfig,
|
|
414
|
-
channelKey: channel$1
|
|
415
|
-
}) : namedConfig,
|
|
428
|
+
cfg: next,
|
|
416
429
|
channelKey: channel$1,
|
|
417
430
|
accountId: params.accountId,
|
|
418
431
|
patch: params.patch
|
|
419
432
|
});
|
|
420
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
|
+
};
|
|
421
475
|
const mattermostSetupContract = defineChannelSetupContract({
|
|
422
476
|
fields: {
|
|
423
477
|
token: {
|
|
@@ -452,47 +506,7 @@ const mattermostSetupContract = defineChannelSetupContract({
|
|
|
452
506
|
envVars: ["MATTERMOST_BOT_TOKEN", "MATTERMOST_URL"]
|
|
453
507
|
}
|
|
454
508
|
},
|
|
455
|
-
legacyAdapter:
|
|
456
|
-
resolveAccountId: ({ accountId }) => normalizeAccountId(accountId),
|
|
457
|
-
applyAccountName: ({ cfg, accountId, name }) => applyAccountNameToChannelSection({
|
|
458
|
-
cfg,
|
|
459
|
-
channelKey: channel$1,
|
|
460
|
-
accountId,
|
|
461
|
-
name
|
|
462
|
-
}),
|
|
463
|
-
validateInput: createSetupInputPresenceValidator({
|
|
464
|
-
defaultAccountOnlyEnvError: "Mattermost env vars can only be used for the default account.",
|
|
465
|
-
whenNotUseEnv: [{
|
|
466
|
-
someOf: ["botToken", "token"],
|
|
467
|
-
message: "Mattermost requires --bot-token and --http-url (or --use-env)."
|
|
468
|
-
}, {
|
|
469
|
-
someOf: ["httpUrl"],
|
|
470
|
-
message: "Mattermost requires --bot-token and --http-url (or --use-env)."
|
|
471
|
-
}],
|
|
472
|
-
validate: ({ input }) => {
|
|
473
|
-
const setupInput = input;
|
|
474
|
-
const token = setupInput.botToken ?? setupInput.token;
|
|
475
|
-
const baseUrl = normalizeMattermostBaseUrl(setupInput.httpUrl);
|
|
476
|
-
if (!setupInput.useEnv && (!token || !baseUrl)) return "Mattermost requires --bot-token and --http-url (or --use-env).";
|
|
477
|
-
if (setupInput.httpUrl && !baseUrl) return "Mattermost --http-url must include a valid base URL.";
|
|
478
|
-
return null;
|
|
479
|
-
}
|
|
480
|
-
}),
|
|
481
|
-
applyAccountConfig: ({ cfg, accountId, input }) => {
|
|
482
|
-
const setupInput = input;
|
|
483
|
-
const token = setupInput.botToken ?? setupInput.token;
|
|
484
|
-
const baseUrl = normalizeMattermostBaseUrl(setupInput.httpUrl);
|
|
485
|
-
return applyMattermostSetupConfigPatch({
|
|
486
|
-
cfg,
|
|
487
|
-
accountId,
|
|
488
|
-
name: setupInput.name,
|
|
489
|
-
patch: setupInput.useEnv ? {} : {
|
|
490
|
-
...token ? { botToken: token } : {},
|
|
491
|
-
...baseUrl ? { baseUrl } : {}
|
|
492
|
-
}
|
|
493
|
-
});
|
|
494
|
-
}
|
|
495
|
-
}
|
|
509
|
+
legacyAdapter: mattermostSetupAdapter
|
|
496
510
|
});
|
|
497
511
|
//#endregion
|
|
498
512
|
//#region extensions/mattermost/src/setup-surface.ts
|
|
@@ -580,7 +594,7 @@ const mattermostSetupWizard = {
|
|
|
580
594
|
};
|
|
581
595
|
//#endregion
|
|
582
596
|
//#region extensions/mattermost/src/channel.ts
|
|
583
|
-
const loadMattermostChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-
|
|
597
|
+
const loadMattermostChannelRuntime = createLazyRuntimeModule(() => import("./channel.runtime-B454n78J.js"));
|
|
584
598
|
const MATTERMOST_PRESENTATION_CAPABILITIES = {
|
|
585
599
|
supported: true,
|
|
586
600
|
buttons: true,
|
|
@@ -614,6 +628,7 @@ const mattermostSecurityAdapter = createRestrictSendersChannelSecurity({
|
|
|
614
628
|
groupAllowFromPath: "channels.mattermost.groupAllowFrom",
|
|
615
629
|
findingTitle: "Mattermost security warning",
|
|
616
630
|
policyPathSuffix: "dmPolicy",
|
|
631
|
+
classifyEntryAuthentication: identityEntryAuthenticationClassifier(mattermostIngressIdentity),
|
|
617
632
|
normalizeDmEntry: (raw) => normalizeMattermostAllowEntry(raw)
|
|
618
633
|
});
|
|
619
634
|
function describeMattermostMessageTool({ cfg, accountId }) {
|
|
@@ -661,22 +676,6 @@ function extractMattermostToolSend(args) {
|
|
|
661
676
|
...threadSuppressed ? { threadSuppressed: true } : {}
|
|
662
677
|
};
|
|
663
678
|
}
|
|
664
|
-
function extractMattermostToolSendResult(result, send) {
|
|
665
|
-
if (!result || typeof result !== "object") return null;
|
|
666
|
-
const details = result.details;
|
|
667
|
-
if (!details || typeof details !== "object") return null;
|
|
668
|
-
const toolSend = details.toolSend;
|
|
669
|
-
if (!toolSend || typeof toolSend !== "object") return null;
|
|
670
|
-
const record = toolSend;
|
|
671
|
-
const to = normalizeOptionalString(record.to);
|
|
672
|
-
if (!to) return null;
|
|
673
|
-
const threadId = normalizeOptionalString(record.threadId);
|
|
674
|
-
const originalTarget = normalizeOptionalString(send.to);
|
|
675
|
-
return {
|
|
676
|
-
to: originalTarget?.startsWith("user:") === true || originalTarget?.startsWith("@") === true ? originalTarget : to,
|
|
677
|
-
...threadId ? { threadId } : {}
|
|
678
|
-
};
|
|
679
|
-
}
|
|
680
679
|
function resolveMattermostAutoThreadId(params) {
|
|
681
680
|
const replyToId = normalizeOptionalString(params.replyToId);
|
|
682
681
|
const context = params.toolContext;
|
|
@@ -707,10 +706,12 @@ function normalizeMattermostThreadId(value) {
|
|
|
707
706
|
return typeof value === "number" ? String(value) : normalizeOptionalString(value);
|
|
708
707
|
}
|
|
709
708
|
function buildMattermostThreadingToolContext(params) {
|
|
710
|
-
const
|
|
709
|
+
const account = resolveMattermostAccount({
|
|
711
710
|
cfg: params.cfg,
|
|
712
711
|
accountId: params.accountId ?? resolveDefaultMattermostAccountId(params.cfg)
|
|
713
|
-
})
|
|
712
|
+
});
|
|
713
|
+
const chatType = params.context.ChatType === "direct" || params.context.ChatType === "group" || params.context.ChatType === "channel" ? params.context.ChatType : "channel";
|
|
714
|
+
const configuredReplyToMode = resolveMattermostReplyToMode(account, chatType);
|
|
714
715
|
const currentThreadTs = normalizeMattermostThreadId(params.context.MessageThreadId) ?? normalizeMattermostThreadId(params.context.TransportThreadId) ?? normalizeOptionalString(params.context.ReplyToId);
|
|
715
716
|
const currentMessageId = normalizeMattermostThreadId(params.context.CurrentMessageId);
|
|
716
717
|
const hasExistingThread = Boolean(currentThreadTs) && (!currentMessageId || currentThreadTs !== currentMessageId);
|
|
@@ -735,7 +736,6 @@ const mattermostMessageActions = {
|
|
|
735
736
|
providerOwnedReadGates: ["read"],
|
|
736
737
|
describeMessageTool: describeMattermostMessageTool,
|
|
737
738
|
extractToolSend: ({ args }) => extractMattermostToolSend(args),
|
|
738
|
-
extractToolSendResult: ({ result, send }) => extractMattermostToolSendResult(result, send),
|
|
739
739
|
prepareSendPayload: ({ ctx, payload }) => {
|
|
740
740
|
if (ctx.action !== "send") return null;
|
|
741
741
|
const mediaUrl = resolveMattermostSendAttachmentMedia(ctx.params);
|
|
@@ -757,9 +757,9 @@ const mattermostMessageActions = {
|
|
|
757
757
|
};
|
|
758
758
|
},
|
|
759
759
|
supportsAction: ({ action }) => {
|
|
760
|
-
return action === "
|
|
760
|
+
return action === "react" || action === "read";
|
|
761
761
|
},
|
|
762
|
-
handleAction: async ({ action, params, cfg, accountId,
|
|
762
|
+
handleAction: async ({ action, params, cfg, accountId, conversationReadOrigin, requesterAccountId, toolContext }) => {
|
|
763
763
|
if (action === "read") {
|
|
764
764
|
const resolvedAccountId = accountId ?? resolveDefaultMattermostAccountId(cfg);
|
|
765
765
|
const mattermostConfig = cfg.channels?.mattermost;
|
|
@@ -843,43 +843,7 @@ const mattermostMessageActions = {
|
|
|
843
843
|
details: {}
|
|
844
844
|
};
|
|
845
845
|
}
|
|
846
|
-
|
|
847
|
-
const to = typeof params.to === "string" ? params.to.trim() : typeof params.target === "string" ? params.target.trim() : "";
|
|
848
|
-
if (!to) throw new Error("Mattermost send requires a target (to).");
|
|
849
|
-
const { text: message, buttons } = resolveMattermostPresentation({
|
|
850
|
-
text: typeof params.message === "string" ? params.message : void 0,
|
|
851
|
-
presentation: params.presentation
|
|
852
|
-
});
|
|
853
|
-
const replyToId = normalizeOptionalString(params.replyToId) ?? normalizeOptionalString(params.threadId) ?? normalizeOptionalString(params.replyTo);
|
|
854
|
-
const resolvedAccountId = accountId || void 0;
|
|
855
|
-
const mediaUrl = resolveMattermostSendAttachmentMedia(params);
|
|
856
|
-
const result = await (await loadMattermostChannelRuntime()).sendMessageMattermost(to, message, {
|
|
857
|
-
cfg,
|
|
858
|
-
accountId: resolvedAccountId,
|
|
859
|
-
replyToId,
|
|
860
|
-
buttons: buttons.length > 0 ? buttons : void 0,
|
|
861
|
-
attachmentText: typeof params.attachmentText === "string" ? params.attachmentText : void 0,
|
|
862
|
-
mediaUrl,
|
|
863
|
-
mediaLocalRoots: mediaLocalRoots ?? mediaAccess?.localRoots,
|
|
864
|
-
mediaReadFile: mediaReadFile ?? mediaAccess?.readFile,
|
|
865
|
-
...mediaAccess?.workspaceDir ? { workspaceDir: mediaAccess.workspaceDir } : {},
|
|
866
|
-
requireMediaUpload: requiresMattermostMediaUpload(mediaUrl) ? true : void 0
|
|
867
|
-
});
|
|
868
|
-
return {
|
|
869
|
-
content: [{
|
|
870
|
-
type: "text",
|
|
871
|
-
text: JSON.stringify({
|
|
872
|
-
ok: true,
|
|
873
|
-
channel: "mattermost",
|
|
874
|
-
messageId: result.messageId,
|
|
875
|
-
channelId: result.channelId
|
|
876
|
-
})
|
|
877
|
-
}],
|
|
878
|
-
details: { toolSend: {
|
|
879
|
-
to: `channel:${result.channelId}`,
|
|
880
|
-
...replyToId ? { threadId: replyToId } : {}
|
|
881
|
-
} }
|
|
882
|
-
};
|
|
846
|
+
throw new Error(`Unsupported Mattermost action: ${action}`);
|
|
883
847
|
}
|
|
884
848
|
};
|
|
885
849
|
function parseMattermostReactActionParams(params) {
|
|
@@ -974,7 +938,7 @@ const mattermostOutbound = {
|
|
|
974
938
|
...ctx.payload,
|
|
975
939
|
mediaUrl: ctx.payload.mediaUrl ?? ctx.mediaUrl
|
|
976
940
|
}).map((url) => url.trim()).find(Boolean);
|
|
977
|
-
|
|
941
|
+
const result = await (await loadMattermostChannelRuntime()).sendMessageMattermost(ctx.to, ctx.payload.text ?? ctx.text, {
|
|
978
942
|
cfg: ctx.cfg,
|
|
979
943
|
accountId: ctx.accountId ?? void 0,
|
|
980
944
|
mediaUrl,
|
|
@@ -986,7 +950,8 @@ const mattermostOutbound = {
|
|
|
986
950
|
buttons: buttons?.length ? buttons : void 0,
|
|
987
951
|
attachmentText,
|
|
988
952
|
onDeliveryResult: createMattermostDeliveryProgressReporter(ctx.onDeliveryResult)
|
|
989
|
-
})
|
|
953
|
+
});
|
|
954
|
+
return attachChannelToResult("mattermost", toMattermostOutboundResult(result));
|
|
990
955
|
}
|
|
991
956
|
return await sendTextMediaPayload({
|
|
992
957
|
channel: "mattermost",
|
|
@@ -1066,6 +1031,7 @@ const mattermostPlugin = createChatChannelPlugin({
|
|
|
1066
1031
|
} },
|
|
1067
1032
|
reload: {
|
|
1068
1033
|
configPrefixes: ["channels.mattermost"],
|
|
1034
|
+
noopPrefixes: ["messages.inbound"],
|
|
1069
1035
|
/**
|
|
1070
1036
|
* accounts.default is promoted; named resolution merges only channel-wide fields
|
|
1071
1037
|
* plus the selected account. Monitor debounce and durable ingress use accountId.
|
|
@@ -1231,4 +1197,4 @@ const mattermostPlugin = createChatChannelPlugin({
|
|
|
1231
1197
|
outbound: mattermostOutbound
|
|
1232
1198
|
});
|
|
1233
1199
|
//#endregion
|
|
1234
|
-
export { describeMattermostAccount as a,
|
|
1200
|
+
export { describeMattermostAccount as a, MattermostChannelConfigSchema as i, mattermostSetupWizard as n, mattermostConfigAdapter as o, mattermostSetupContract as r, mattermostMeta as s, mattermostPlugin as t };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as mattermostPlugin } from "./channel-plugin-runtime-
|
|
1
|
+
import { t as mattermostPlugin } from "./channel-plugin-runtime-Bq86sS1N.js";
|
|
2
2
|
export { mattermostPlugin };
|