@openclaw/msteams 2026.7.2-beta.5 → 2026.7.2-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- const require_delegated_state = require("./delegated-state-DOSCHaAB.cjs");
2
1
  const require_runtime = require("./runtime-gZTAuFux.cjs");
3
2
  require("./runtime-api.cjs");
3
+ const require_delegated_state = require("./delegated-state-DiEz9JIa.cjs");
4
4
  let openclaw_plugin_sdk_lazy_runtime = require("openclaw/plugin-sdk/lazy-runtime");
5
5
  let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
6
6
  let openclaw_plugin_sdk_allow_from = require("openclaw/plugin-sdk/allow-from");
@@ -11,10 +11,10 @@ let node_dns_promises = require("node:dns/promises");
11
11
  let openclaw_plugin_sdk_ssrf_policy = require("openclaw/plugin-sdk/ssrf-policy");
12
12
  let openclaw_plugin_sdk_number_runtime = require("openclaw/plugin-sdk/number-runtime");
13
13
  let openclaw_plugin_sdk_text_utility_runtime = require("openclaw/plugin-sdk/text-utility-runtime");
14
- let node_fs = require("node:fs");
15
- node_fs = require_delegated_state.__toESM(node_fs, 1);
14
+ let openclaw_plugin_sdk_secret_file = require("openclaw/plugin-sdk/secret-file");
16
15
  let node_module = require("node:module");
17
16
  let openclaw_plugin_sdk_secret_input = require("openclaw/plugin-sdk/secret-input");
17
+ let openclaw_plugin_sdk_html_entity_runtime = require("openclaw/plugin-sdk/html-entity-runtime");
18
18
  //#region extensions/msteams/src/request-timeout.ts
19
19
  const MSTEAMS_REQUEST_TIMEOUT_MS = 3e4;
20
20
  const MSTEAMS_SHAREPOINT_UPLOAD_BASE_TIMEOUT_MS = 5 * 6e4;
@@ -746,7 +746,7 @@ async function createMSTeamsApp(creds, options) {
746
746
  ...serviceUrl ? { serviceUrl } : {},
747
747
  ...options?.oauthDefaultConnectionName ? { oauth: { defaultConnectionName: options.oauthDefaultConnectionName } } : {}
748
748
  };
749
- if (creds.type === "federated") return createFederatedApp(creds, App, appOptions);
749
+ if (creds.type === "federated") return await createFederatedApp(creds, App, appOptions);
750
750
  return new App({
751
751
  clientId: creds.appId,
752
752
  clientSecret: creds.appPassword,
@@ -754,7 +754,7 @@ async function createMSTeamsApp(creds, options) {
754
754
  ...appOptions
755
755
  });
756
756
  }
757
- function createFederatedApp(creds, App, appOptions) {
757
+ async function createFederatedApp(creds, App, appOptions) {
758
758
  if (creds.useManagedIdentity) return new App({
759
759
  clientId: creds.appId,
760
760
  tenantId: creds.tenantId,
@@ -764,7 +764,7 @@ function createFederatedApp(creds, App, appOptions) {
764
764
  if (!creds.certificatePath) throw new Error("Federated credentials require either a certificate path or managed identity.");
765
765
  let privateKey;
766
766
  try {
767
- privateKey = node_fs.readFileSync(creds.certificatePath, "utf-8");
767
+ privateKey = await (0, openclaw_plugin_sdk_secret_file.readSecretFile)(creds.certificatePath, "Microsoft Teams certificate");
768
768
  } catch (err) {
769
769
  const msg = err instanceof Error ? err.message : String(err);
770
770
  throw new Error(`Failed to read certificate file at '${creds.certificatePath}': ${msg}`, { cause: err });
@@ -948,12 +948,16 @@ function resolveAuthType(cfg) {
948
948
  if (process.env.MSTEAMS_AUTH_TYPE === "federated") return "federated";
949
949
  return "secret";
950
950
  }
951
+ function resolveFederatedPath(configValue, envValue) {
952
+ if ((0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(configValue)) return configValue;
953
+ if ((0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(envValue)) return envValue;
954
+ }
951
955
  function hasConfiguredMSTeamsCredentials(cfg) {
952
956
  const authType = resolveAuthType(cfg);
953
957
  const hasAppId = Boolean((0, openclaw_plugin_sdk_secret_input.normalizeSecretInputString)(cfg?.appId) || (0, openclaw_plugin_sdk_secret_input.normalizeSecretInputString)(process.env.MSTEAMS_APP_ID));
954
958
  const hasTenantId = Boolean((0, openclaw_plugin_sdk_secret_input.normalizeSecretInputString)(cfg?.tenantId) || (0, openclaw_plugin_sdk_secret_input.normalizeSecretInputString)(process.env.MSTEAMS_TENANT_ID));
955
959
  if (authType === "federated") {
956
- const hasCert = Boolean(cfg?.certificatePath || process.env.MSTEAMS_CERTIFICATE_PATH);
960
+ const hasCert = Boolean(resolveFederatedPath(cfg?.certificatePath, process.env.MSTEAMS_CERTIFICATE_PATH));
957
961
  const hasManagedIdentity = cfg?.useManagedIdentity ?? process.env.MSTEAMS_USE_MANAGED_IDENTITY === "true";
958
962
  return hasAppId && hasTenantId && (hasCert || hasManagedIdentity);
959
963
  }
@@ -965,7 +969,7 @@ function resolveMSTeamsCredentials(cfg) {
965
969
  const tenantId = (0, openclaw_plugin_sdk_secret_input.normalizeSecretInputString)(cfg?.tenantId) || (0, openclaw_plugin_sdk_secret_input.normalizeSecretInputString)(process.env.MSTEAMS_TENANT_ID);
966
970
  if (!appId || !tenantId) return;
967
971
  if (authType === "federated") {
968
- const certificatePath = cfg?.certificatePath || process.env.MSTEAMS_CERTIFICATE_PATH || void 0;
972
+ const certificatePath = resolveFederatedPath(cfg?.certificatePath, process.env.MSTEAMS_CERTIFICATE_PATH);
969
973
  const certificateThumbprint = cfg?.certificateThumbprint || process.env.MSTEAMS_CERTIFICATE_THUMBPRINT || void 0;
970
974
  const useManagedIdentity = cfg?.useManagedIdentity ?? process.env.MSTEAMS_USE_MANAGED_IDENTITY === "true";
971
975
  const managedIdentityClientId = cfg?.managedIdentityClientId || process.env.MSTEAMS_MANAGED_IDENTITY_CLIENT_ID || void 0;
@@ -1237,7 +1241,64 @@ async function findGraphUsersByExactIdentity(params) {
1237
1241
  });
1238
1242
  }
1239
1243
  //#endregion
1244
+ //#region extensions/msteams/src/inbound.ts
1245
+ /**
1246
+ * Strip HTML tags, preserving text content.
1247
+ */
1248
+ function htmlToPlainText(html) {
1249
+ return (0, openclaw_plugin_sdk_html_entity_runtime.decodeHtmlEntities)(html.replace(/<[^>]*>/g, " ")).replaceAll("\xA0", " ").replace(/\s+/g, " ").trim();
1250
+ }
1251
+ /**
1252
+ * Extract quote info from MS Teams HTML reply attachments.
1253
+ * Teams wraps quoted content in a blockquote with itemtype="http://schema.skype.com/Reply".
1254
+ */
1255
+ function extractMSTeamsQuoteInfo(attachments) {
1256
+ for (const att of attachments) {
1257
+ let content = "";
1258
+ if (typeof att.content === "string") content = att.content;
1259
+ else if (typeof att.content === "object" && att.content !== null) {
1260
+ const record = att.content;
1261
+ content = typeof record.text === "string" ? record.text : typeof record.body === "string" ? record.body : "";
1262
+ }
1263
+ if (!content) continue;
1264
+ if (!content.includes("http://schema.skype.com/Reply")) continue;
1265
+ const senderMatch = /<strong[^>]*itemprop=["']mri["'][^>]*>(.*?)<\/strong>/i.exec(content);
1266
+ const sender = senderMatch?.[1] ? htmlToPlainText(senderMatch[1]) : void 0;
1267
+ const bodyMatch = /<p[^>]*itemprop=["']copy["'][^>]*>(.*?)<\/p>/is.exec(content) ?? /<p[^>]*itemprop=["']preview["'][^>]*>(.*?)<\/p>/is.exec(content);
1268
+ const body = bodyMatch?.[1] ? htmlToPlainText(bodyMatch[1]) : void 0;
1269
+ const id = /<blockquote[^>]*\bitemid=["']([^"']+)["'][^>]*>/is.exec(content)?.[1]?.trim() || void 0;
1270
+ if (body) return {
1271
+ sender: sender ?? "unknown",
1272
+ body,
1273
+ ...id ? { id } : {}
1274
+ };
1275
+ }
1276
+ }
1277
+ function normalizeMSTeamsConversationId(raw) {
1278
+ return raw.split(";")[0] ?? raw;
1279
+ }
1280
+ function extractMSTeamsConversationMessageId(raw) {
1281
+ if (!raw) return;
1282
+ return (/(?:^|;)messageid=([^;]+)/i.exec(raw)?.[1]?.trim() ?? "") || void 0;
1283
+ }
1284
+ function parseMSTeamsActivityTimestamp(value) {
1285
+ if (!value) return;
1286
+ if (value instanceof Date) return value;
1287
+ if (typeof value !== "string") return;
1288
+ const date = new Date(value);
1289
+ return Number.isNaN(date.getTime()) ? void 0 : date;
1290
+ }
1291
+ function stripMSTeamsMentionTags(text) {
1292
+ return text.replace(/<at[^>]*>.*?<\/at>/gi, "").trim();
1293
+ }
1294
+ function wasMSTeamsBotMentioned(activity) {
1295
+ const botId = activity.recipient?.id;
1296
+ if (!botId) return false;
1297
+ return (activity.entities ?? []).some((e) => e.type === "mention" && e.mentioned?.id === botId);
1298
+ }
1299
+ //#endregion
1240
1300
  //#region extensions/msteams/src/resolve-allowlist.ts
1301
+ const MSTEAMS_GROUP_CONVERSATION_ID = /^19:.+@thread\.(?:tacv2|skype|v2)$/i;
1241
1302
  function normalizeExactMatch(value) {
1242
1303
  return (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeLowercaseStringOrEmpty)(value ?? "");
1243
1304
  }
@@ -1280,6 +1341,16 @@ function projectStableMSTeamsUserAllowlist(entries) {
1280
1341
  const projected = entries.map((entry) => normalizeStaticMSTeamsAllowEntry(entry)).filter((entry) => Boolean(entry));
1281
1342
  return [...new Map(projected.map((entry) => [normalizeExactMatch(entry), entry])).values()];
1282
1343
  }
1344
+ function projectStableMSTeamsGroupAllowlist(entries) {
1345
+ if (!entries) return;
1346
+ const projected = entries.map((entry) => {
1347
+ const stableUserEntry = normalizeStaticMSTeamsAllowEntry(entry);
1348
+ if (stableUserEntry) return stableUserEntry;
1349
+ const conversationId = normalizeMSTeamsConversationId(normalizeMSTeamsUserInput(entry));
1350
+ return MSTEAMS_GROUP_CONVERSATION_ID.test(conversationId) ? conversationId : void 0;
1351
+ }).filter((entry) => Boolean(entry));
1352
+ return [...new Map(projected.map((entry) => [MSTEAMS_GROUP_CONVERSATION_ID.test(entry) ? `conversation:${entry}` : normalizeExactMatch(entry), entry])).values()];
1353
+ }
1283
1354
  function stripProviderPrefix(raw) {
1284
1355
  return raw.replace(/^(msteams|teams):/i, "");
1285
1356
  }
@@ -1311,7 +1382,7 @@ function parseMSTeamsConversationId(raw) {
1311
1382
  *
1312
1383
  * Accepts both prefixed and bare formats:
1313
1384
  * - `conversation:<id>` — explicit conversation prefix
1314
- * - `19:abc@thread.tacv2` / `19:abc@thread.skype` — channel / legacy group
1385
+ * - `19:abc@thread.tacv2` / `19:abc@thread.skype` / `19:abc@thread.v2` — group or channel
1315
1386
  * - `19:{userId}_{appId}@unq.gbl.spaces` — Graph 1:1 chat thread format
1316
1387
  * - `a:1xxx` — Bot Framework personal (1:1) chat id
1317
1388
  * - `8:orgid:xxx` — Bot Framework org-scoped personal chat id
@@ -1320,7 +1391,7 @@ function looksLikeMSTeamsConversationId(raw) {
1320
1391
  const trimmed = raw.trim();
1321
1392
  if (!trimmed) return false;
1322
1393
  if (/^conversation:/i.test(trimmed)) return true;
1323
- if (/^19:.+@thread\.(tacv2|skype)$/i.test(trimmed)) return true;
1394
+ if (MSTEAMS_GROUP_CONVERSATION_ID.test(trimmed)) return true;
1324
1395
  if (/^19:.+@unq\.gbl\.spaces$/i.test(trimmed)) return true;
1325
1396
  if (/^a:1[A-Za-z0-9_-]+$/i.test(trimmed)) return true;
1326
1397
  if (/^8:orgid:[A-Za-z0-9-]+$/i.test(trimmed)) return true;
@@ -1331,7 +1402,7 @@ function looksLikeMSTeamsConversationId(raw) {
1331
1402
  * can forward verbatim to the channel adapter.
1332
1403
  */
1333
1404
  function looksLikeMSTeamsTargetId(raw) {
1334
- const trimmed = raw.trim();
1405
+ const trimmed = stripProviderPrefix(raw.trim()).trim();
1335
1406
  if (looksLikeMSTeamsConversationId(trimmed)) return true;
1336
1407
  if (/^user:/i.test(trimmed)) {
1337
1408
  const id = trimmed.slice(5).trim();
@@ -1805,6 +1876,18 @@ Object.defineProperty(exports, "extractInlineImageCandidates", {
1805
1876
  return extractInlineImageCandidates;
1806
1877
  }
1807
1878
  });
1879
+ Object.defineProperty(exports, "extractMSTeamsConversationMessageId", {
1880
+ enumerable: true,
1881
+ get: function() {
1882
+ return extractMSTeamsConversationMessageId;
1883
+ }
1884
+ });
1885
+ Object.defineProperty(exports, "extractMSTeamsQuoteInfo", {
1886
+ enumerable: true,
1887
+ get: function() {
1888
+ return extractMSTeamsQuoteInfo;
1889
+ }
1890
+ });
1808
1891
  Object.defineProperty(exports, "fetchGraphAbsoluteUrl", {
1809
1892
  enumerable: true,
1810
1893
  get: function() {
@@ -1907,6 +1990,12 @@ Object.defineProperty(exports, "normalizeContentType", {
1907
1990
  return normalizeContentType;
1908
1991
  }
1909
1992
  });
1993
+ Object.defineProperty(exports, "normalizeMSTeamsConversationId", {
1994
+ enumerable: true,
1995
+ get: function() {
1996
+ return normalizeMSTeamsConversationId;
1997
+ }
1998
+ });
1910
1999
  Object.defineProperty(exports, "normalizeMSTeamsMessagingTarget", {
1911
2000
  enumerable: true,
1912
2001
  get: function() {
@@ -1925,6 +2014,12 @@ Object.defineProperty(exports, "normalizeQuery", {
1925
2014
  return normalizeQuery;
1926
2015
  }
1927
2016
  });
2017
+ Object.defineProperty(exports, "parseMSTeamsActivityTimestamp", {
2018
+ enumerable: true,
2019
+ get: function() {
2020
+ return parseMSTeamsActivityTimestamp;
2021
+ }
2022
+ });
1928
2023
  Object.defineProperty(exports, "parseMSTeamsConversationId", {
1929
2024
  enumerable: true,
1930
2025
  get: function() {
@@ -1961,6 +2056,12 @@ Object.defineProperty(exports, "postGraphJson", {
1961
2056
  return postGraphJson;
1962
2057
  }
1963
2058
  });
2059
+ Object.defineProperty(exports, "projectStableMSTeamsGroupAllowlist", {
2060
+ enumerable: true,
2061
+ get: function() {
2062
+ return projectStableMSTeamsGroupAllowlist;
2063
+ }
2064
+ });
1964
2065
  Object.defineProperty(exports, "projectStableMSTeamsTeamsConfig", {
1965
2066
  enumerable: true,
1966
2067
  get: function() {
@@ -2075,6 +2176,12 @@ Object.defineProperty(exports, "searchGraphUsers", {
2075
2176
  return searchGraphUsers;
2076
2177
  }
2077
2178
  });
2179
+ Object.defineProperty(exports, "stripMSTeamsMentionTags", {
2180
+ enumerable: true,
2181
+ get: function() {
2182
+ return stripMSTeamsMentionTags;
2183
+ }
2184
+ });
2078
2185
  Object.defineProperty(exports, "tryBuildGraphSharesUrlForSharedLink", {
2079
2186
  enumerable: true,
2080
2187
  get: function() {
@@ -2093,6 +2200,12 @@ Object.defineProperty(exports, "validateMSTeamsProactiveServiceUrlBoundary", {
2093
2200
  return validateMSTeamsProactiveServiceUrlBoundary;
2094
2201
  }
2095
2202
  });
2203
+ Object.defineProperty(exports, "wasMSTeamsBotMentioned", {
2204
+ enumerable: true,
2205
+ get: function() {
2206
+ return wasMSTeamsBotMentioned;
2207
+ }
2208
+ });
2096
2209
  Object.defineProperty(exports, "withMSTeamsAbortableRequestTimeout", {
2097
2210
  enumerable: true,
2098
2211
  get: function() {
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_resolve_allowlist = require("./resolve-allowlist-Dr_1sOJh.cjs");
3
- const require_setup_surface = require("./setup-surface-xVejKCJV.cjs");
4
- const require_config_schema = require("./config-schema-BTnLgWAe.cjs");
2
+ const require_resolve_allowlist = require("./resolve-allowlist-CEj9sABO.cjs");
3
+ const require_setup_surface = require("./setup-surface-ByWjaXEn.cjs");
4
+ const require_config_schema = require("./config-schema-C4CszdDi.cjs");
5
5
  let openclaw_plugin_sdk_account_helpers = require("openclaw/plugin-sdk/account-helpers");
6
6
  //#region extensions/msteams/src/channel.setup.ts
7
7
  const msteamsSetupPlugin = {
@@ -1,4 +1,4 @@
1
- const require_resolve_allowlist = require("./resolve-allowlist-Dr_1sOJh.cjs");
1
+ const require_resolve_allowlist = require("./resolve-allowlist-CEj9sABO.cjs");
2
2
  let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
3
3
  let openclaw_plugin_sdk_account_id = require("openclaw/plugin-sdk/account-id");
4
4
  let openclaw_plugin_sdk_allow_from = require("openclaw/plugin-sdk/allow-from");
@@ -38,38 +38,24 @@ const msteamsConfigAdapter = (0, openclaw_plugin_sdk_channel_config_helpers.crea
38
38
  //#endregion
39
39
  //#region extensions/msteams/src/setup-core.ts
40
40
  const t$1 = (0, openclaw_plugin_sdk_setup.createSetupTranslator)();
41
+ const channel$1 = "msteams";
41
42
  const msteamsSetupAdapter = {
42
43
  resolveAccountId: () => openclaw_plugin_sdk_setup.DEFAULT_ACCOUNT_ID,
43
- applyAccountConfig: ({ cfg }) => ({
44
- ...cfg,
45
- channels: {
46
- ...cfg.channels,
47
- msteams: {
48
- ...cfg.channels?.msteams,
49
- enabled: true
50
- }
51
- }
52
- })
44
+ applyAccountConfig: ({ cfg }) => (0, openclaw_plugin_sdk_setup.setSetupChannelEnabled)(cfg, channel$1, true)
53
45
  };
54
46
  const msteamsSetupContract = (0, openclaw_plugin_sdk_channel_setup.defineChannelSetupContract)({
55
47
  fields: {},
56
48
  legacyAdapter: msteamsSetupAdapter
57
49
  });
58
- const channel$1 = "msteams";
59
50
  async function promptMSTeamsCredentials(prompter) {
51
+ const promptRequired = async (message) => (await prompter.text({
52
+ message,
53
+ validate: (value) => value?.trim() ? void 0 : t$1("common.required")
54
+ })).trim();
60
55
  return {
61
- appId: (await prompter.text({
62
- message: t$1("wizard.msteams.appIdPrompt"),
63
- validate: (value) => value?.trim() ? void 0 : t$1("common.required")
64
- })).trim(),
65
- appPassword: (await prompter.text({
66
- message: t$1("wizard.msteams.appPasswordPrompt"),
67
- validate: (value) => value?.trim() ? void 0 : t$1("common.required")
68
- })).trim(),
69
- tenantId: (await prompter.text({
70
- message: t$1("wizard.msteams.tenantIdPrompt"),
71
- validate: (value) => value?.trim() ? void 0 : t$1("common.required")
72
- })).trim()
56
+ appId: await promptRequired(t$1("wizard.msteams.appIdPrompt")),
57
+ appPassword: await promptRequired(t$1("wizard.msteams.appPasswordPrompt")),
58
+ tenantId: await promptRequired(t$1("wizard.msteams.tenantIdPrompt"))
73
59
  };
74
60
  }
75
61
  async function noteMSTeamsCredentialHelp(prompter) {
@@ -390,17 +376,12 @@ function setMSTeamsTeamsAllowlist(cfg, entries) {
390
376
  };
391
377
  } else teams[teamKey] = existing;
392
378
  }
393
- return {
394
- ...cfg,
395
- channels: {
396
- ...cfg.channels,
397
- msteams: {
398
- ...cfg.channels?.msteams,
399
- enabled: true,
400
- teams
401
- }
402
- }
403
- };
379
+ return (0, openclaw_plugin_sdk_setup.patchTopLevelChannelConfigSection)({
380
+ cfg,
381
+ channel,
382
+ enabled: true,
383
+ patch: { teams }
384
+ });
404
385
  }
405
386
  function listMSTeamsGroupEntries(cfg) {
406
387
  return Object.entries(cfg.channels?.msteams?.teams ?? {}).flatMap(([teamKey, value]) => {
@@ -490,7 +471,7 @@ const msteamsSetupWizard = {
490
471
  };
491
472
  let oauthModule;
492
473
  try {
493
- oauthModule = await Promise.resolve().then(() => require("./oauth-CNcnL8of.cjs"));
474
+ oauthModule = await Promise.resolve().then(() => require("./oauth-CW6jVGp8.cjs"));
494
475
  } catch (err) {
495
476
  await noteDelegatedAuthFailure(err);
496
477
  return {