@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.
package/dist/api.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_channel = require("./channel-DtZFlwhL.cjs");
3
- const require_setup_surface = require("./setup-surface-xVejKCJV.cjs");
2
+ const require_channel = require("./channel-C7QxRjBW.cjs");
3
+ const require_setup_surface = require("./setup-surface-ByWjaXEn.cjs");
4
4
  exports.createMSTeamsSetupWizardBase = require_setup_surface.createMSTeamsSetupWizardBase;
5
5
  exports.msteamsPlugin = require_channel.msteamsPlugin;
6
6
  exports.msteamsSetupAdapter = require_setup_surface.msteamsSetupAdapter;
@@ -1,7 +1,7 @@
1
1
  require("./runtime-api.cjs");
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
  let openclaw_plugin_sdk_channel_core = require("openclaw/plugin-sdk/channel-core");
7
7
  let openclaw_plugin_sdk_channel_outbound = require("openclaw/plugin-sdk/channel-outbound");
@@ -15,7 +15,6 @@ let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/str
15
15
  let typebox = require("typebox");
16
16
  let openclaw_plugin_sdk_approval_auth_runtime = require("openclaw/plugin-sdk/approval-auth-runtime");
17
17
  let openclaw_plugin_sdk_channel_actions = require("openclaw/plugin-sdk/channel-actions");
18
- let openclaw_plugin_sdk_html_entity_runtime = require("openclaw/plugin-sdk/html-entity-runtime");
19
18
  let openclaw_plugin_sdk_routing = require("openclaw/plugin-sdk/routing");
20
19
  let openclaw_plugin_sdk_channel_targets = require("openclaw/plugin-sdk/channel-targets");
21
20
  let openclaw_plugin_sdk_allow_from = require("openclaw/plugin-sdk/allow-from");
@@ -533,62 +532,6 @@ async function assertMSTeamsTeamEnumerationAllowed(params) {
533
532
  return stableTeamId;
534
533
  }
535
534
  //#endregion
536
- //#region extensions/msteams/src/inbound.ts
537
- /**
538
- * Strip HTML tags, preserving text content.
539
- */
540
- function htmlToPlainText(html) {
541
- return (0, openclaw_plugin_sdk_html_entity_runtime.decodeHtmlEntities)(html.replace(/<[^>]*>/g, " ")).replaceAll("\xA0", " ").replace(/\s+/g, " ").trim();
542
- }
543
- /**
544
- * Extract quote info from MS Teams HTML reply attachments.
545
- * Teams wraps quoted content in a blockquote with itemtype="http://schema.skype.com/Reply".
546
- */
547
- function extractMSTeamsQuoteInfo(attachments) {
548
- for (const att of attachments) {
549
- let content = "";
550
- if (typeof att.content === "string") content = att.content;
551
- else if (typeof att.content === "object" && att.content !== null) {
552
- const record = att.content;
553
- content = typeof record.text === "string" ? record.text : typeof record.body === "string" ? record.body : "";
554
- }
555
- if (!content) continue;
556
- if (!content.includes("http://schema.skype.com/Reply")) continue;
557
- const senderMatch = /<strong[^>]*itemprop=["']mri["'][^>]*>(.*?)<\/strong>/i.exec(content);
558
- const sender = senderMatch?.[1] ? htmlToPlainText(senderMatch[1]) : void 0;
559
- const bodyMatch = /<p[^>]*itemprop=["']copy["'][^>]*>(.*?)<\/p>/is.exec(content) ?? /<p[^>]*itemprop=["']preview["'][^>]*>(.*?)<\/p>/is.exec(content);
560
- const body = bodyMatch?.[1] ? htmlToPlainText(bodyMatch[1]) : void 0;
561
- const id = /<blockquote[^>]*\bitemid=["']([^"']+)["'][^>]*>/is.exec(content)?.[1]?.trim() || void 0;
562
- if (body) return {
563
- sender: sender ?? "unknown",
564
- body,
565
- ...id ? { id } : {}
566
- };
567
- }
568
- }
569
- function normalizeMSTeamsConversationId(raw) {
570
- return raw.split(";")[0] ?? raw;
571
- }
572
- function extractMSTeamsConversationMessageId(raw) {
573
- if (!raw) return;
574
- return (/(?:^|;)messageid=([^;]+)/i.exec(raw)?.[1]?.trim() ?? "") || void 0;
575
- }
576
- function parseMSTeamsActivityTimestamp(value) {
577
- if (!value) return;
578
- if (value instanceof Date) return value;
579
- if (typeof value !== "string") return;
580
- const date = new Date(value);
581
- return Number.isNaN(date.getTime()) ? void 0 : date;
582
- }
583
- function stripMSTeamsMentionTags(text) {
584
- return text.replace(/<at[^>]*>.*?<\/at>/gi, "").trim();
585
- }
586
- function wasMSTeamsBotMentioned(activity) {
587
- const botId = activity.recipient?.id;
588
- if (!botId) return false;
589
- return (activity.entities ?? []).some((e) => e.type === "mention" && e.mentioned?.id === botId);
590
- }
591
- //#endregion
592
535
  //#region extensions/msteams/src/monitor-handler/thread-session.ts
593
536
  const TRAILING_THREAD_SUFFIX = /(?::thread:[^:]+)+$/;
594
537
  function resolveMSTeamsRouteSessionKey(params) {
@@ -608,9 +551,9 @@ function resolveMSTeamsOutboundSessionRoute(params) {
608
551
  const isUser = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeLowercaseStringOrEmpty)(trimmed).startsWith("user:");
609
552
  const rawId = (0, openclaw_plugin_sdk_channel_core.stripTargetKindPrefix)(trimmed);
610
553
  if (!rawId) return null;
611
- const conversationId = normalizeMSTeamsConversationId(rawId);
554
+ const conversationId = require_resolve_allowlist.normalizeMSTeamsConversationId(rawId);
612
555
  const isChannel = !isUser && /@thread\.tacv2/i.test(conversationId);
613
- const embeddedThreadId = extractMSTeamsConversationMessageId(rawId);
556
+ const embeddedThreadId = require_resolve_allowlist.extractMSTeamsConversationMessageId(rawId);
614
557
  const explicitThreadId = params.threadId ?? params.replyToId;
615
558
  const channelThreadId = embeddedThreadId ?? (explicitThreadId !== void 0 && explicitThreadId !== null ? String(explicitThreadId) : void 0);
616
559
  const resolvedKind = params.resolvedTarget?.kind;
@@ -661,7 +604,7 @@ const collectMSTeamsSecurityWarnings = (0, openclaw_plugin_sdk_channel_policy.cr
661
604
  resolveGroupPolicy: ({ cfg }) => cfg.channels?.msteams?.groupPolicy,
662
605
  collect: ({ groupPolicy }) => groupPolicy === "open" ? ["- MS Teams groups: groupPolicy=\"open\" allows any member to trigger (mention-gated). Set channels.msteams.groupPolicy=\"allowlist\" + channels.msteams.groupAllowFrom to restrict senders."] : []
663
606
  });
664
- const loadMSTeamsChannelRuntime = (0, openclaw_plugin_sdk_lazy_runtime.createLazyRuntimeNamedExport)(() => Promise.resolve().then(() => require("./channel.runtime-BtdOD_kD.cjs")), "msTeamsChannelRuntime");
607
+ const loadMSTeamsChannelRuntime = (0, openclaw_plugin_sdk_lazy_runtime.createLazyRuntimeNamedExport)(() => Promise.resolve().then(() => require("./channel.runtime-DjY6d_hd.cjs")), "msTeamsChannelRuntime");
665
608
  function jsonActionResult(data) {
666
609
  return {
667
610
  content: [{
@@ -862,6 +805,7 @@ const msteamsChannelOutbound = {
862
805
  chunker: openclaw_plugin_sdk_text_chunking.chunkTextForOutbound,
863
806
  chunkerMode: "markdown",
864
807
  textChunkLimit: 4e3,
808
+ resolveEffectiveTextChunkLimit: ({ fallbackLimit }) => typeof fallbackLimit === "number" && fallbackLimit > 0 ? Math.min(fallbackLimit, 4e3) : 4e3,
865
809
  pollMaxOptions: 12,
866
810
  deliveryCapabilities: { durableFinal: {
867
811
  text: true,
@@ -1540,7 +1484,7 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
1540
1484
  })
1541
1485
  }),
1542
1486
  gateway: { startAccount: async (ctx) => {
1543
- const { monitorMSTeamsProvider } = await Promise.resolve().then(() => require("./src-CsXzz0x2.cjs"));
1487
+ const { monitorMSTeamsProvider } = await Promise.resolve().then(() => require("./src-B_BdEvcr.cjs"));
1544
1488
  const port = ctx.cfg.channels?.msteams?.webhook?.port ?? 3978;
1545
1489
  ctx.setStatus({
1546
1490
  accountId: ctx.accountId,
@@ -1595,36 +1539,12 @@ Object.defineProperty(exports, "buildMSTeamsPresentationCard", {
1595
1539
  return buildMSTeamsPresentationCard;
1596
1540
  }
1597
1541
  });
1598
- Object.defineProperty(exports, "extractMSTeamsConversationMessageId", {
1599
- enumerable: true,
1600
- get: function() {
1601
- return extractMSTeamsConversationMessageId;
1602
- }
1603
- });
1604
- Object.defineProperty(exports, "extractMSTeamsQuoteInfo", {
1605
- enumerable: true,
1606
- get: function() {
1607
- return extractMSTeamsQuoteInfo;
1608
- }
1609
- });
1610
1542
  Object.defineProperty(exports, "msteamsPlugin", {
1611
1543
  enumerable: true,
1612
1544
  get: function() {
1613
1545
  return msteamsPlugin;
1614
1546
  }
1615
1547
  });
1616
- Object.defineProperty(exports, "normalizeMSTeamsConversationId", {
1617
- enumerable: true,
1618
- get: function() {
1619
- return normalizeMSTeamsConversationId;
1620
- }
1621
- });
1622
- Object.defineProperty(exports, "parseMSTeamsActivityTimestamp", {
1623
- enumerable: true,
1624
- get: function() {
1625
- return parseMSTeamsActivityTimestamp;
1626
- }
1627
- });
1628
1548
  Object.defineProperty(exports, "resolveMSTeamsAllowlistMatch", {
1629
1549
  enumerable: true,
1630
1550
  get: function() {
@@ -1649,15 +1569,3 @@ Object.defineProperty(exports, "resolveMSTeamsRouteSessionKey", {
1649
1569
  return resolveMSTeamsRouteSessionKey;
1650
1570
  }
1651
1571
  });
1652
- Object.defineProperty(exports, "stripMSTeamsMentionTags", {
1653
- enumerable: true,
1654
- get: function() {
1655
- return stripMSTeamsMentionTags;
1656
- }
1657
- });
1658
- Object.defineProperty(exports, "wasMSTeamsBotMentioned", {
1659
- enumerable: true,
1660
- get: function() {
1661
- return wasMSTeamsBotMentioned;
1662
- }
1663
- });
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_config_schema = require("./config-schema-BTnLgWAe.cjs");
2
+ const require_config_schema = require("./config-schema-C4CszdDi.cjs");
3
3
  exports.MSTeamsChannelConfigSchema = require_config_schema.MSTeamsChannelConfigSchema;
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_channel = require("./channel-DtZFlwhL.cjs");
2
+ const require_channel = require("./channel-C7QxRjBW.cjs");
3
3
  exports.msteamsPlugin = require_channel.msteamsPlugin;
@@ -1,10 +1,10 @@
1
+ const require_polls = require("./polls-BWKNpBSg.cjs");
1
2
  const require_runtime = require("./runtime-gZTAuFux.cjs");
2
3
  require("./runtime-api.cjs");
3
- const require_resolve_allowlist = require("./resolve-allowlist-Dr_1sOJh.cjs");
4
- const require_channel = require("./channel-DtZFlwhL.cjs");
5
- const require_setup_surface = require("./setup-surface-xVejKCJV.cjs");
6
- const require_polls = require("./polls-CWExq2xZ.cjs");
7
- const require_messenger = require("./messenger-BJ0KM2sD.cjs");
4
+ const require_resolve_allowlist = require("./resolve-allowlist-CEj9sABO.cjs");
5
+ const require_channel = require("./channel-C7QxRjBW.cjs");
6
+ const require_setup_surface = require("./setup-surface-ByWjaXEn.cjs");
7
+ const require_messenger = require("./messenger-DTiaLTDO.cjs");
8
8
  let openclaw_plugin_sdk_channel_outbound = require("openclaw/plugin-sdk/channel-outbound");
9
9
  let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
10
10
  let openclaw_plugin_sdk_reply_payload = require("openclaw/plugin-sdk/reply-payload");
@@ -771,7 +771,7 @@ async function sendMessageMSTeams(params) {
771
771
  cfg,
772
772
  to
773
773
  });
774
- const { app, conversationId, ref, log, conversationType, tokenProvider, sharePointSiteId, sdkCloudOptions } = ctx;
774
+ const { app, conversationId, ref, log, conversationType, replyStyle, tokenProvider, sharePointSiteId, sdkCloudOptions } = ctx;
775
775
  log.debug?.("sending proactive message", {
776
776
  conversationId,
777
777
  conversationType,
@@ -883,6 +883,7 @@ async function sendMessageMSTeams(params) {
883
883
  text: messageText || void 0,
884
884
  attachments: [fileCardAttachment]
885
885
  },
886
+ threadActivityId: replyStyle === "thread" && conversationType === "channel" ? ref.threadId ?? ref.activityId : void 0,
886
887
  serviceUrlBoundary: sdkCloudOptions
887
888
  });
888
889
  log.info("sent native file card", {
@@ -955,8 +956,11 @@ async function sendTextWithMedia(ctx, text, mediaUrl) {
955
956
  })
956
957
  };
957
958
  }
958
- async function sendProactiveActivityRaw({ app, ref, activity, serviceUrlBoundary }) {
959
- return require_messenger.extractMessageId(await require_messenger.sendMSTeamsActivityWithReference(app, require_messenger.buildConversationReference(ref), activity, { serviceUrlBoundary })) ?? "unknown";
959
+ async function sendProactiveActivityRaw({ app, ref, activity, threadActivityId, serviceUrlBoundary }) {
960
+ return require_messenger.extractMessageId(await require_messenger.sendMSTeamsActivityWithReference(app, require_messenger.buildConversationReference(ref), activity, {
961
+ ...threadActivityId ? { threadActivityId } : {},
962
+ serviceUrlBoundary
963
+ })) ?? "unknown";
960
964
  }
961
965
  async function sendProactiveActivity({ app, ref, activity, errorPrefix, serviceUrlBoundary }) {
962
966
  try {
@@ -1119,10 +1123,10 @@ async function deleteMessageMSTeams(params) {
1119
1123
  }
1120
1124
  //#endregion
1121
1125
  //#region extensions/msteams/src/outbound.ts
1122
- function asObjectRecord(value) {
1123
- return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
1124
- }
1125
1126
  const MSTEAMS_TEXT_CHUNK_LIMIT = 4e3;
1127
+ function resolveMSTeamsEffectiveTextChunkLimit(configuredLimit) {
1128
+ return typeof configuredLimit === "number" && configuredLimit > 0 ? Math.min(configuredLimit, MSTEAMS_TEXT_CHUNK_LIMIT) : MSTEAMS_TEXT_CHUNK_LIMIT;
1129
+ }
1126
1130
  function resolveMSTeamsTextSend(params) {
1127
1131
  return (0, openclaw_plugin_sdk_channel_outbound.resolveOutboundSendDep)(params.deps, "msteams") ?? ((to, text) => sendMessageMSTeams({
1128
1132
  cfg: params.cfg,
@@ -1145,6 +1149,7 @@ const msteamsOutbound = {
1145
1149
  chunker: openclaw_plugin_sdk_text_chunking.chunkTextForOutbound,
1146
1150
  chunkerMode: "markdown",
1147
1151
  textChunkLimit: MSTEAMS_TEXT_CHUNK_LIMIT,
1152
+ resolveEffectiveTextChunkLimit: ({ fallbackLimit }) => resolveMSTeamsEffectiveTextChunkLimit(fallbackLimit),
1148
1153
  pollMaxOptions: 12,
1149
1154
  deliveryCapabilities: { durableFinal: {
1150
1155
  text: true,
@@ -1159,7 +1164,7 @@ const msteamsOutbound = {
1159
1164
  presentation,
1160
1165
  text: payload.text
1161
1166
  });
1162
- const msteamsData = asObjectRecord(payload.channelData?.msteams) ?? {};
1167
+ const msteamsData = (0, openclaw_plugin_sdk_string_coerce_runtime.asOptionalRecord)(payload.channelData?.msteams) ?? {};
1163
1168
  return {
1164
1169
  ...payload,
1165
1170
  channelData: {
@@ -1172,7 +1177,7 @@ const msteamsOutbound = {
1172
1177
  };
1173
1178
  },
1174
1179
  sendPayload: async ({ cfg, to, text, mediaUrl, mediaLocalRoots, mediaReadFile, payload, deps, onDeliveryResult }) => {
1175
- const presentationCard = asObjectRecord(payload.channelData?.msteams)?.presentationCard;
1180
+ const presentationCard = (0, openclaw_plugin_sdk_string_coerce_runtime.asOptionalRecord)(payload.channelData?.msteams)?.presentationCard;
1176
1181
  if (presentationCard && typeof presentationCard === "object" && !Array.isArray(presentationCard)) return (0, openclaw_plugin_sdk_channel_send_result.attachChannelToResult)("msteams", await sendAdaptiveCardMSTeams({
1177
1182
  cfg,
1178
1183
  to,
@@ -1206,7 +1211,7 @@ const msteamsOutbound = {
1206
1211
  cfg,
1207
1212
  deps
1208
1213
  });
1209
- const chunks = (0, openclaw_plugin_sdk_reply_payload.resolveTextChunksWithFallback)(text, (0, openclaw_plugin_sdk_text_chunking.chunkTextForOutbound)(text, MSTEAMS_TEXT_CHUNK_LIMIT));
1214
+ const chunks = (0, openclaw_plugin_sdk_reply_payload.resolveTextChunksWithFallback)(text, (0, openclaw_plugin_sdk_text_chunking.chunkTextForOutbound)(text, resolveMSTeamsEffectiveTextChunkLimit(cfg.channels?.msteams?.textChunkLimit)));
1210
1215
  let result;
1211
1216
  for (const chunk of chunks) {
1212
1217
  result = await send(to, chunk);
@@ -1,3 +1,4 @@
1
+ let openclaw_plugin_sdk_channel_core = require("openclaw/plugin-sdk/channel-core");
1
2
  let openclaw_plugin_sdk_secret_input = require("openclaw/plugin-sdk/secret-input");
2
3
  let openclaw_plugin_sdk_channel_config_schema = require("openclaw/plugin-sdk/channel-config-schema");
3
4
  let zod = require("zod");
@@ -23,34 +24,17 @@ const msTeamsChannelConfigUiHints = {
23
24
  label: "MS Teams Graph Media Fallback",
24
25
  help: "Query Microsoft Graph for unresolved channel or group-chat HTML media. Adds one lookup per matching message when enabled (default: false)."
25
26
  },
26
- streaming: {
27
- label: "MS Teams Streaming",
28
- help: "Microsoft Teams preview/progress streaming mode: \"off\" | \"partial\" | \"block\" | \"progress\". Personal chats use Teams native streaminfo progress when available."
29
- },
30
- "streaming.progress.label": {
31
- label: "MS Teams Progress Label",
32
- help: "Initial progress title. Use \"auto\" for built-in single-word labels, a custom string, or false to hide the title."
33
- },
34
- "streaming.progress.labels": {
35
- label: "MS Teams Progress Label Pool",
36
- help: "Candidate labels for streaming.progress.label=\"auto\". Leave unset to use OpenClaw built-in progress labels."
37
- },
38
- "streaming.progress.maxLines": {
39
- label: "MS Teams Progress Max Lines",
40
- help: "Maximum number of compact progress lines to keep below the progress title (default: 8)."
41
- },
42
- "streaming.progress.maxLineChars": {
43
- label: "MS Teams Progress Max Line Chars",
44
- help: "Maximum characters per compact progress line before truncation (default: 120). Prose cuts at word boundaries; commands and paths keep useful suffixes."
45
- },
46
- "streaming.progress.toolProgress": {
47
- label: "MS Teams Progress Tool Lines",
48
- help: "Show compact tool/progress lines in progress mode (default: true). Set false to keep only the title until final delivery."
49
- },
50
- "streaming.progress.commandText": {
51
- label: "MS Teams Progress Command Text",
52
- help: "Command/exec detail in progress lines: \"raw\" preserves released behavior; \"status\" shows only the tool label."
53
- }
27
+ ...(0, openclaw_plugin_sdk_channel_core.createChannelConfigUiHints)({
28
+ channelLabel: "MS Teams",
29
+ streaming: { "": {
30
+ label: "MS Teams Streaming",
31
+ help: "Microsoft Teams preview/progress streaming mode: \"off\" | \"partial\" | \"block\" | \"progress\". Personal chats use Teams native streaminfo progress when available."
32
+ } },
33
+ progress: {
34
+ labels: "openclaw",
35
+ titleWording: true
36
+ }
37
+ })
54
38
  };
55
39
  //#endregion
56
40
  //#region extensions/msteams/src/config-schema.ts
@@ -1,25 +1,3 @@
1
- //#region \0rolldown/runtime.js
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
- key = keys[i];
11
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
- get: ((k) => from[k]).bind(null, key),
13
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
- });
15
- }
16
- return to;
17
- };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
- value: mod,
20
- enumerable: true
21
- }) : target, mod));
22
- //#endregion
23
1
  const require_runtime = require("./runtime-gZTAuFux.cjs");
24
2
  //#region extensions/msteams/src/delegated-state.ts
25
3
  const MSTEAMS_DELEGATED_TOKEN_LEGACY_FILENAME = "msteams-delegated.json";
@@ -72,12 +50,6 @@ Object.defineProperty(exports, "MSTEAMS_DELEGATED_TOKEN_NAMESPACE", {
72
50
  return MSTEAMS_DELEGATED_TOKEN_NAMESPACE;
73
51
  }
74
52
  });
75
- Object.defineProperty(exports, "__toESM", {
76
- enumerable: true,
77
- get: function() {
78
- return __toESM;
79
- }
80
- });
81
53
  Object.defineProperty(exports, "loadMSTeamsDelegatedTokens", {
82
54
  enumerable: true,
83
55
  get: function() {
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_resolve_allowlist = require("./resolve-allowlist-Dr_1sOJh.cjs");
2
+ const require_resolve_allowlist = require("./resolve-allowlist-CEj9sABO.cjs");
3
3
  let openclaw_plugin_sdk_directory_runtime = require("openclaw/plugin-sdk/directory-runtime");
4
4
  const msteamsDirectoryContractPlugin = {
5
5
  id: "msteams",
@@ -1,14 +1,14 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_delegated_state = require("./delegated-state-DOSCHaAB.cjs");
3
- const require_polls = require("./polls-CWExq2xZ.cjs");
4
- const require_sso_token_store = require("./sso-token-store-OSg229re.cjs");
2
+ const require_polls = require("./polls-BWKNpBSg.cjs");
3
+ const require_delegated_state = require("./delegated-state-DiEz9JIa.cjs");
4
+ const require_sso_token_store = require("./sso-token-store-TKYk_Ms7.cjs");
5
5
  let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
6
6
  let node_crypto = require("node:crypto");
7
- node_crypto = require_delegated_state.__toESM(node_crypto, 1);
7
+ node_crypto = require_polls.__toESM(node_crypto, 1);
8
8
  let node_fs_promises = require("node:fs/promises");
9
- node_fs_promises = require_delegated_state.__toESM(node_fs_promises, 1);
9
+ node_fs_promises = require_polls.__toESM(node_fs_promises, 1);
10
10
  let node_path = require("node:path");
11
- node_path = require_delegated_state.__toESM(node_path, 1);
11
+ node_path = require_polls.__toESM(node_path, 1);
12
12
  let openclaw_plugin_sdk_runtime_doctor = require("openclaw/plugin-sdk/runtime-doctor");
13
13
  let openclaw_plugin_sdk_session_store_runtime = require("openclaw/plugin-sdk/session-store-runtime");
14
14
  //#region extensions/msteams/doctor-contract-api.ts
@@ -1,9 +1,8 @@
1
- const require_delegated_state = require("./delegated-state-DOSCHaAB.cjs");
1
+ const require_polls = require("./polls-BWKNpBSg.cjs");
2
2
  const require_runtime = require("./runtime-gZTAuFux.cjs");
3
3
  require("./runtime-api.cjs");
4
- const require_resolve_allowlist = require("./resolve-allowlist-Dr_1sOJh.cjs");
5
- const require_setup_surface = require("./setup-surface-xVejKCJV.cjs");
6
- const require_polls = require("./polls-CWExq2xZ.cjs");
4
+ const require_resolve_allowlist = require("./resolve-allowlist-CEj9sABO.cjs");
5
+ const require_setup_surface = require("./setup-surface-ByWjaXEn.cjs");
7
6
  let openclaw_plugin_sdk_lazy_runtime = require("openclaw/plugin-sdk/lazy-runtime");
8
7
  let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
9
8
  let openclaw_plugin_sdk_reply_payload = require("openclaw/plugin-sdk/reply-payload");
@@ -14,9 +13,10 @@ let openclaw_plugin_sdk_ssrf_policy = require("openclaw/plugin-sdk/ssrf-policy")
14
13
  let openclaw_plugin_sdk_text_utility_runtime = require("openclaw/plugin-sdk/text-utility-runtime");
15
14
  let openclaw_plugin_sdk_html_entity_runtime = require("openclaw/plugin-sdk/html-entity-runtime");
16
15
  let node_crypto = require("node:crypto");
17
- node_crypto = require_delegated_state.__toESM(node_crypto, 1);
16
+ node_crypto = require_polls.__toESM(node_crypto, 1);
18
17
  let node_path = require("node:path");
19
- node_path = require_delegated_state.__toESM(node_path, 1);
18
+ node_path = require_polls.__toESM(node_path, 1);
19
+ let openclaw_plugin_sdk_error_runtime = require("openclaw/plugin-sdk/error-runtime");
20
20
  let openclaw_plugin_sdk_reply_chunking = require("openclaw/plugin-sdk/reply-chunking");
21
21
  let openclaw_plugin_sdk_web_media = require("openclaw/plugin-sdk/web-media");
22
22
  let openclaw_plugin_sdk_media_runtime = require("openclaw/plugin-sdk/media-runtime");
@@ -1088,9 +1088,10 @@ async function getGraphAccessToken(tokenProvider) {
1088
1088
  async function uploadToSharePoint(params) {
1089
1089
  const fetchFn = params.fetchFn ?? fetch;
1090
1090
  const uploadPath = `/OpenClawShared/${encodeURIComponent(params.filename)}`;
1091
+ const timeoutMs = require_resolve_allowlist.resolveMSTeamsSharePointUploadTimeoutMs(params.buffer.length);
1091
1092
  const data = await require_resolve_allowlist.withMSTeamsAbortableRequestTimeout({
1092
1093
  label: SHAREPOINT_UPLOAD_TIMEOUT_LABEL,
1093
- timeoutMs: require_resolve_allowlist.resolveMSTeamsSharePointUploadTimeoutMs(params.buffer.length),
1094
+ timeoutMs,
1094
1095
  work: async (signal) => {
1095
1096
  const token = await getGraphAccessToken(params.tokenProvider);
1096
1097
  const res = await fetchFn(`${GRAPH_ROOT}/sites/${params.siteId}/drive/root:${uploadPath}:/content`, {
@@ -1104,7 +1105,7 @@ async function uploadToSharePoint(params) {
1104
1105
  signal
1105
1106
  });
1106
1107
  if (!res.ok) throw await require_resolve_allowlist.createMSTeamsHttpError(res, "SharePoint upload failed");
1107
- return await (0, openclaw_plugin_sdk_provider_http.readProviderJsonResponse)(res, "msteams.graph-upload.uploadSharePointFile");
1108
+ return await (0, openclaw_plugin_sdk_provider_http.readProviderJsonResponse)(res, "msteams.graph-upload.uploadSharePointFile", { chunkTimeoutMs: timeoutMs });
1108
1109
  }
1109
1110
  });
1110
1111
  if (!data.id || !data.webUrl || !data.name) throw new Error("SharePoint upload response missing required fields");
@@ -1277,8 +1278,12 @@ async function extractFilename(url) {
1277
1278
  }
1278
1279
  try {
1279
1280
  const pathname = new URL(url).pathname;
1280
- const basename = node_path.default.basename(pathname);
1281
- const existingExt = (0, openclaw_plugin_sdk_media_runtime.getFileExtension)(pathname);
1281
+ let basename = node_path.default.basename(pathname);
1282
+ if (basename.includes("%")) try {
1283
+ const decodedBasename = decodeURIComponent(basename);
1284
+ if (!decodedBasename.includes("/") && !decodedBasename.includes("\\") && !decodedBasename.includes("\0")) basename = decodedBasename;
1285
+ } catch {}
1286
+ const existingExt = (0, openclaw_plugin_sdk_media_runtime.getFileExtension)(basename);
1282
1287
  if (basename && existingExt) return basename;
1283
1288
  const mime = await getMimeType(url);
1284
1289
  const ext = (0, openclaw_plugin_sdk_media_runtime.extensionForMime)(mime) ?? ".bin";
@@ -1725,17 +1730,26 @@ async function sendMSTeamsMessages(params) {
1725
1730
  }
1726
1731
  throw new Error("unreachable Teams send retry loop exit");
1727
1732
  };
1733
+ let providerDispatchStarted = false;
1728
1734
  const sendMessageInContext = async (sendFn, message, messageIndex) => {
1729
1735
  let pendingUploadId;
1730
- const messageId = extractMessageId(await sendWithRetry(async () => {
1731
- const activity = await buildActivity(message, params.conversationRef, params.tokenProvider, params.sharePointSiteId, params.mediaMaxBytes, { feedbackLoopEnabled: params.feedbackLoopEnabled });
1732
- pendingUploadId = typeof activity["_pendingUploadId"] === "string" ? activity["_pendingUploadId"] : void 0;
1733
- if (pendingUploadId) delete activity["_pendingUploadId"];
1734
- return await sendFn(activity);
1735
- }, {
1736
- messageIndex,
1737
- messageCount: messages.length
1738
- })) ?? "unknown";
1736
+ let response;
1737
+ try {
1738
+ response = await sendWithRetry(async () => {
1739
+ const activity = await buildActivity(message, params.conversationRef, params.tokenProvider, params.sharePointSiteId, params.mediaMaxBytes, { feedbackLoopEnabled: params.feedbackLoopEnabled });
1740
+ pendingUploadId = typeof activity["_pendingUploadId"] === "string" ? activity["_pendingUploadId"] : void 0;
1741
+ if (pendingUploadId) delete activity["_pendingUploadId"];
1742
+ providerDispatchStarted = true;
1743
+ return await sendFn(activity);
1744
+ }, {
1745
+ messageIndex,
1746
+ messageCount: messages.length
1747
+ });
1748
+ } catch (error) {
1749
+ if (!providerDispatchStarted) throw new openclaw_plugin_sdk_error_runtime.PlatformMessageNotDispatchedError(error instanceof Error ? error.message : "Teams activity preparation failed", { cause: error });
1750
+ throw error;
1751
+ }
1752
+ const messageId = extractMessageId(response) ?? "unknown";
1739
1753
  if (pendingUploadId && messageId !== "unknown") setPendingUploadActivityId(pendingUploadId, messageId);
1740
1754
  return messageId;
1741
1755
  };
@@ -1745,7 +1759,13 @@ async function sendMSTeamsMessages(params) {
1745
1759
  return messageIds;
1746
1760
  };
1747
1761
  const sendProactively = async (batch, startIndex, threadActivityId) => {
1748
- const baseRef = buildConversationReference(params.conversationRef);
1762
+ let baseRef;
1763
+ try {
1764
+ baseRef = buildConversationReference(params.conversationRef);
1765
+ } catch (error) {
1766
+ if (providerDispatchStarted) throw error;
1767
+ throw new openclaw_plugin_sdk_error_runtime.PlatformMessageNotDispatchedError(error instanceof Error ? error.message : "Teams conversation preparation failed", { cause: error });
1768
+ }
1749
1769
  const isChannel = params.conversationRef.conversation?.conversationType === "channel";
1750
1770
  const sendFn = (activity) => sendMSTeamsActivityWithReference(params.app, baseRef, activity, {
1751
1771
  threadActivityId: isChannel ? threadActivityId : void 0,
@@ -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_provider_auth = require("openclaw/plugin-sdk/provider-auth");
3
3
  let openclaw_plugin_sdk_provider_auth_runtime = require("openclaw/plugin-sdk/provider-auth-runtime");
4
4
  let openclaw_plugin_sdk_runtime_env = require("openclaw/plugin-sdk/runtime-env");
@@ -1,12 +1,33 @@
1
- const require_delegated_state = require("./delegated-state-DOSCHaAB.cjs");
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+ //#endregion
2
23
  const require_runtime = require("./runtime-gZTAuFux.cjs");
3
24
  let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
4
25
  let openclaw_plugin_sdk_file_lock = require("openclaw/plugin-sdk/file-lock");
5
26
  let openclaw_plugin_sdk_number_runtime = require("openclaw/plugin-sdk/number-runtime");
6
27
  let node_crypto = require("node:crypto");
7
- node_crypto = require_delegated_state.__toESM(node_crypto, 1);
28
+ node_crypto = __toESM(node_crypto, 1);
8
29
  let node_path = require("node:path");
9
- node_path = require_delegated_state.__toESM(node_path, 1);
30
+ node_path = __toESM(node_path, 1);
10
31
  let openclaw_plugin_sdk_keyed_async_queue = require("openclaw/plugin-sdk/keyed-async-queue");
11
32
  //#region extensions/msteams/src/conversation-store-helpers.ts
12
33
  function normalizeStoredConversationId(raw) {
@@ -568,6 +589,12 @@ Object.defineProperty(exports, "MSTEAMS_SQLITE_MAX_POLL_ROWS", {
568
589
  return MSTEAMS_SQLITE_MAX_POLL_ROWS;
569
590
  }
570
591
  });
592
+ Object.defineProperty(exports, "__toESM", {
593
+ enumerable: true,
594
+ get: function() {
595
+ return __toESM;
596
+ }
597
+ });
571
598
  Object.defineProperty(exports, "buildMSTeamsConversationStateKey", {
572
599
  enumerable: true,
573
600
  get: function() {