@openclaw/msteams 2026.10.10-beta.4 → 2026.10.10

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 (37) hide show
  1. package/dist/.setup/{adapter.runtime-B-6Q3nMI.cjs → adapter.runtime-BMvpm7sS.cjs} +3 -5
  2. package/dist/.setup/{approval-card-DWPDItvq.cjs → approval-card-Bo8kHYbj.cjs} +2 -4
  3. package/dist/.setup/{approval-handler.runtime-DccVf5AY.cjs → approval-handler.runtime-BS3avHFu.cjs} +5 -6
  4. package/dist/.setup/{bot-framework-service-url-B3FWn2SV.cjs → bot-framework-service-url-CgVuKiIR.cjs} +2 -4
  5. package/dist/.setup/{channel-B7Gy3QUW.cjs → channel-CdCSk3Rg.cjs} +27 -47
  6. package/dist/.setup/{channel.runtime-DzKeQAqd.cjs → channel.runtime--ZjTYgkY.cjs} +17 -26
  7. package/dist/.setup/{channel.setup-B5ClEcNI.cjs → channel.setup-nSTtK77J.cjs} +11 -17
  8. package/dist/.setup/{config-schema-CkKdphSp.cjs → config-schema-Bm15lF-j.cjs} +5 -8
  9. package/dist/.setup/{conversation-store-state-C3__T9mK.cjs → conversation-store-state-NJU9osd-.cjs} +25 -41
  10. package/dist/.setup/{delegated-state-Bv5cWuec.cjs → delegated-state-CbMd3rIh.cjs} +4 -6
  11. package/dist/.setup/{monitor-CzRI-Hsc.cjs → monitor-BxLDs5fk.cjs} +53 -90
  12. package/dist/.setup/{oauth-D9u8sPCD.cjs → oauth-B-Y5pNM4.cjs} +3 -5
  13. package/dist/.setup/{reaction-types-DSQWVA4Z.cjs → reaction-types-BaL1EVBS.cjs} +3 -5
  14. package/dist/.setup/{resolve-allowlist-tYgAHx0t.cjs → resolve-allowlist-CqNzS9bZ.cjs} +141 -59
  15. package/dist/.setup/{rolldown-runtime-BloeesfJ.cjs → rolldown-runtime-CiKaZLfC.cjs} +1 -2
  16. package/dist/.setup/{runtime-gZTAuFux.cjs → runtime-CbKazLGv.cjs} +1 -2
  17. package/dist/.setup/{secret-contract-api-YY3v6MP8.cjs → secret-contract-api-5aH1Fl_c.cjs} +1 -1
  18. package/dist/.setup/{secret-contract-api-wAyY5UHv.cjs → secret-contract-api-BOzdWSn9.cjs} +1 -2
  19. package/dist/.setup/{send-Bgm8RYUa.cjs → send-BXjI3ufq.cjs} +9 -11
  20. package/dist/.setup/{setup-plugin-api-BACfeF7_.cjs → setup-plugin-api-lPpin6Gg.cjs} +1 -1
  21. package/dist/.setup/{thread-session-C7KTMwLU.cjs → thread-session-DZMoCsSR.cjs} +3 -5
  22. package/dist/.setup/{token-config-bEpua_Q7.cjs → token-config-DTZ00Ibq.cjs} +1 -2
  23. package/dist/.source-module-urls/7e43ee3ae4faab430a47269c8217f8d99ec60ecd85233f40e81d03efeb543068.json +1 -1
  24. package/dist/api.cjs +2 -2
  25. package/dist/channel-config-api.cjs +1 -1
  26. package/dist/channel-plugin-api.cjs +1 -1
  27. package/dist/configured-state.cjs +1 -2
  28. package/dist/directory-contract-api.cjs +1 -2
  29. package/dist/doctor-backup-resources.cjs +2 -3
  30. package/dist/doctor-contract-api.cjs +9 -15
  31. package/dist/index.cjs +1 -2
  32. package/dist/qa-runner-api.cjs +3 -5
  33. package/dist/runtime-api.cjs +1 -1
  34. package/dist/secret-contract-api.cjs +1 -1
  35. package/dist/setup-entry.cjs +3 -4
  36. package/dist/setup-plugin-api.cjs +1 -1
  37. package/package.json +4 -4
@@ -1,10 +1,10 @@
1
- const require_rolldown_runtime = require("./rolldown-runtime-BloeesfJ.cjs");
2
- const require_bot_framework_service_url = require("./bot-framework-service-url-B3FWn2SV.cjs");
3
- const require_resolve_allowlist = require("./resolve-allowlist-tYgAHx0t.cjs");
4
- const require_runtime = require("./runtime-gZTAuFux.cjs");
1
+ const require_rolldown_runtime = require("./rolldown-runtime-CiKaZLfC.cjs");
2
+ const require_bot_framework_service_url = require("./bot-framework-service-url-CgVuKiIR.cjs");
3
+ const require_resolve_allowlist = require("./resolve-allowlist-CqNzS9bZ.cjs");
4
+ const require_runtime = require("./runtime-CbKazLGv.cjs");
5
5
  require("../runtime-api.cjs");
6
- const require_delegated_state = require("./delegated-state-Bv5cWuec.cjs");
7
- const require_channel_setup = require("./channel.setup-B5ClEcNI.cjs");
6
+ const require_delegated_state = require("./delegated-state-CbMd3rIh.cjs");
7
+ const require_channel_setup = require("./channel.setup-nSTtK77J.cjs");
8
8
  let openclaw_plugin_sdk_lazy_runtime = require("openclaw/plugin-sdk/lazy-runtime");
9
9
  let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
10
10
  let openclaw_plugin_sdk_account_id = require("openclaw/plugin-sdk/account-id");
@@ -33,7 +33,7 @@ let openclaw_plugin_sdk_web_media = require("openclaw/plugin-sdk/web-media");
33
33
  let openclaw_plugin_sdk_dedupe_runtime = require("openclaw/plugin-sdk/dedupe-runtime");
34
34
  let openclaw_plugin_sdk_plugin_state_runtime = require("openclaw/plugin-sdk/plugin-state-runtime");
35
35
  let openclaw_plugin_sdk_media_runtime = require("openclaw/plugin-sdk/media-runtime");
36
- //#region extensions/msteams/src/file-consent.ts
36
+ // extensions/msteams/src/file-consent.ts
37
37
  /**
38
38
  * Allowlist of domains that are valid targets for file consent uploads.
39
39
  * These are the Microsoft/SharePoint domains that Teams legitimately provides
@@ -132,8 +132,7 @@ async function uploadToConsentUrl(params) {
132
132
  await res.body?.cancel().catch(() => void 0);
133
133
  if (!res.ok) throw new Error(`File upload to consent URL failed: ${res.status} ${res.statusText}`);
134
134
  }
135
- //#endregion
136
- //#region extensions/msteams/src/pending-uploads-fs.ts
135
+ // extensions/msteams/src/pending-uploads-fs.ts
137
136
  /** TTL for persisted pending uploads (matches in-memory store). */
138
137
  const PENDING_UPLOAD_TTL_MS$1 = 3e5;
139
138
  /** Cap to avoid unbounded growth if a process crashes mid-flow. */
@@ -296,8 +295,7 @@ async function setPendingUploadActivityIdFs(id, activityId) {
296
295
  }));
297
296
  });
298
297
  }
299
- //#endregion
300
- //#region extensions/msteams/src/pending-uploads.ts
298
+ // extensions/msteams/src/pending-uploads.ts
301
299
  /**
302
300
  * In-memory storage for files awaiting user consent in the FileConsentCard flow.
303
301
  *
@@ -362,8 +360,7 @@ function setPendingUploadActivityId(uploadId, activityId) {
362
360
  const entry = pendingUploads.get(uploadId);
363
361
  if (entry) entry.consentCardActivityId = activityId;
364
362
  }
365
- //#endregion
366
- //#region extensions/msteams/src/file-consent-helpers.ts
363
+ // extensions/msteams/src/file-consent-helpers.ts
367
364
  const FILE_CONSENT_THRESHOLD_BYTES = 4194304;
368
365
  /** In-process replies keep consent bytes in memory; CLI sends use the persisted variant below. */
369
366
  function prepareFileConsentActivity(params) {
@@ -403,8 +400,7 @@ function requiresFileConsent(params) {
403
400
  const isLargeFile = params.bufferSize >= FILE_CONSENT_THRESHOLD_BYTES;
404
401
  return isPersonal && (isLargeFile || !isImage);
405
402
  }
406
- //#endregion
407
- //#region extensions/msteams/src/format.ts
403
+ // extensions/msteams/src/format.ts
408
404
  const ESCAPED_MARKDOWN_RE = /\\[\\`*_{}[\]()#+\-.!|>~]/gu;
409
405
  const MARKDOWN_ENTITY_RE = /&(?:#\d+|#x[\da-f]+|[a-z][a-z\d]+);/giu;
410
406
  const TOKEN_END = "";
@@ -610,7 +606,8 @@ function protectMSTeamsCode(ir, tokenPrefix, code, protectedValues) {
610
606
  }
611
607
  const rendered = renderMSTeamsCode(codeStyle, source);
612
608
  let quoted = quoteDepth > 0 ? `${"> ".repeat(quoteDepth)}${rendered.replaceAll("\n", `\n${"> ".repeat(quoteDepth)}`)}` : rendered;
613
- if (hasTrailingQuotedText && !quoted.endsWith("\n")) quoted += "\n";
609
+ const followedByText = codeStyle === "code_block" && span.end < ir.text.length && ir.text[span.end] !== "\n";
610
+ if ((hasTrailingQuotedText || followedByText) && !quoted.endsWith("\n")) quoted += "\n";
614
611
  const index = code.push(quoted) - 1;
615
612
  return {
616
613
  start: span.start,
@@ -684,8 +681,7 @@ function formatMSTeamsMarkdown(markdown, tableMode) {
684
681
  }, MSTEAMS_FORMAT_CAPABILITIES);
685
682
  return protectedValues.reduce((text, { prefix, values }) => restoreTokens(text, prefix, values), restoreTokens(rendered, `${tokenPrefix}c`, codeRegions));
686
683
  }
687
- //#endregion
688
- //#region extensions/msteams/src/graph-chat.ts
684
+ // extensions/msteams/src/graph-chat.ts
689
685
  function buildTeamsFileInfoCard(file) {
690
686
  const rawETag = file.eTag;
691
687
  const uniqueId = rawETag.replace(/^["']|["']$/g, "").replace(/[{}]/g, "").split(",")[0] ?? rawETag;
@@ -698,8 +694,7 @@ function buildTeamsFileInfoCard(file) {
698
694
  fileType
699
695
  });
700
696
  }
701
- //#endregion
702
- //#region extensions/msteams/src/graph-upload.ts
697
+ // extensions/msteams/src/graph-upload.ts
703
698
  const GRAPH_ROOT = "https://graph.microsoft.com/v1.0";
704
699
  const GRAPH_BETA = "https://graph.microsoft.com/beta";
705
700
  const GRAPH_SCOPE = "https://graph.microsoft.com";
@@ -842,8 +837,7 @@ async function uploadAndShareSharePoint(params) {
842
837
  name: uploaded.name
843
838
  };
844
839
  }
845
- //#endregion
846
- //#region extensions/msteams/src/media-helpers.ts
840
+ // extensions/msteams/src/media-helpers.ts
847
841
  const MSTEAMS_MAX_MEDIA_BYTES = 104857600;
848
842
  async function getMimeType(url) {
849
843
  if (url.startsWith("data:")) {
@@ -888,8 +882,7 @@ function extractMessageId(response) {
888
882
  const { id } = response;
889
883
  return typeof id === "string" && id ? id : null;
890
884
  }
891
- //#endregion
892
- //#region extensions/msteams/src/mentions.ts
885
+ // extensions/msteams/src/mentions.ts
893
886
  /**
894
887
  * Check whether an ID looks like a valid Teams user/bot identifier.
895
888
  * Accepts:
@@ -932,8 +925,7 @@ function parseMentions(text) {
932
925
  entities
933
926
  };
934
927
  }
935
- //#endregion
936
- //#region extensions/msteams/src/message-activity.ts
928
+ // extensions/msteams/src/message-activity.ts
937
929
  const AI_GENERATED_ENTITY = {
938
930
  type: "https://schema.org/Message",
939
931
  "@type": "Message",
@@ -959,8 +951,7 @@ function buildMSTeamsAdaptiveCardActivity(card) {
959
951
  }]
960
952
  };
961
953
  }
962
- //#endregion
963
- //#region extensions/msteams/src/revoked-context.ts
954
+ // extensions/msteams/src/revoked-context.ts
964
955
  async function withRevokedProxyFallback(params) {
965
956
  try {
966
957
  return await params.run();
@@ -970,8 +961,7 @@ async function withRevokedProxyFallback(params) {
970
961
  return await params.onRevoked();
971
962
  }
972
963
  }
973
- //#endregion
974
- //#region extensions/msteams/src/sent-message-cache.ts
964
+ // extensions/msteams/src/sent-message-cache.ts
975
965
  const TTL_MS = 864e5;
976
966
  const MAX_ENTRIES = 2e4;
977
967
  const PERSISTENT_MAX_ENTRIES = 1e3;
@@ -1020,8 +1010,7 @@ async function wasMSTeamsMessageSentWithPersistence(params) {
1020
1010
  if (!params.conversationId || !params.messageId) return false;
1021
1011
  return await getSentMessageCache((0, openclaw_plugin_sdk_account_id.normalizeAccountId)(params.accountId)).lookup(makeKey(params.conversationId, params.messageId, params.botId));
1022
1012
  }
1023
- //#endregion
1024
- //#region extensions/msteams/src/sdk-proactive.ts
1013
+ // extensions/msteams/src/sdk-proactive.ts
1025
1014
  const loadMSTeamsApiModule = (0, openclaw_plugin_sdk_lazy_runtime.createLazyRuntimeModule)(() => import("@microsoft/teams.api"));
1026
1015
  async function quoteMSTeamsActivity(activity, messageId) {
1027
1016
  const { MessageActivityInput } = await loadMSTeamsApiModule();
@@ -1157,8 +1146,7 @@ async function deleteMSTeamsActivityWithReference(app, source, activityId, optio
1157
1146
  const ref = buildSdkConversationReference(source, options);
1158
1147
  return (await getApiClientForReference(app, ref)).conversations.activities(ref.conversation.id).delete(activityId);
1159
1148
  }
1160
- //#endregion
1161
- //#region extensions/msteams/src/messenger.ts
1149
+ // extensions/msteams/src/messenger.ts
1162
1150
  const MSTEAMS_SEND_ATTEMPTS = 3;
1163
1151
  const MSTEAMS_SEND_RETRY_MAX_DELAY_MS = 1e4;
1164
1152
  function buildConversationReference(ref) {
@@ -1371,8 +1359,7 @@ async function sendMSTeamsMessages(params) {
1371
1359
  }
1372
1360
  return await sendProactively(messages, 0);
1373
1361
  }
1374
- //#endregion
1375
- //#region extensions/msteams/src/polls.ts
1362
+ // extensions/msteams/src/polls.ts
1376
1363
  const MSTEAMS_POLLS_NAMESPACE = "polls";
1377
1364
  const MSTEAMS_POLL_VOTE_BUCKETS_NAMESPACE = "poll-vote-buckets";
1378
1365
  const MSTEAMS_MAX_POLLS = 1e3;
@@ -1646,8 +1633,7 @@ function createMSTeamsPollStoreState(params) {
1646
1633
  recordVote
1647
1634
  };
1648
1635
  }
1649
- //#endregion
1650
- //#region extensions/msteams/src/conversation-store-helpers.ts
1636
+ // extensions/msteams/src/conversation-store-helpers.ts
1651
1637
  function mergeStoredConversationReference(existing, incoming, nowIso) {
1652
1638
  return {
1653
1639
  ...existing?.timezone && !incoming.timezone ? { timezone: existing.timezone } : {},
@@ -1677,8 +1663,7 @@ function findPreferredDmConversationByUserId(entries, id) {
1677
1663
  }
1678
1664
  return preferred;
1679
1665
  }
1680
- //#endregion
1681
- //#region extensions/msteams/src/conversation-store-state.ts
1666
+ // extensions/msteams/src/conversation-store-state.ts
1682
1667
  const MSTEAMS_CONVERSATIONS_NAMESPACE = "conversations";
1683
1668
  const MSTEAMS_MAX_CONVERSATIONS = 1e3;
1684
1669
  const MSTEAMS_SQLITE_MAX_CONVERSATION_ROWS = 2e3;
@@ -1769,7 +1754,6 @@ function createMSTeamsConversationStoreState(params) {
1769
1754
  findPreferredDmByUserId
1770
1755
  };
1771
1756
  }
1772
- //#endregion
1773
1757
  Object.defineProperty(exports, "FILE_CONSENT_THRESHOLD_BYTES", {
1774
1758
  enumerable: true,
1775
1759
  get: function() {
@@ -1,12 +1,12 @@
1
- const require_rolldown_runtime = require("./rolldown-runtime-BloeesfJ.cjs");
2
- const require_runtime = require("./runtime-gZTAuFux.cjs");
1
+ const require_rolldown_runtime = require("./rolldown-runtime-CiKaZLfC.cjs");
2
+ const require_runtime = require("./runtime-CbKazLGv.cjs");
3
3
  let openclaw_plugin_sdk_account_id = require("openclaw/plugin-sdk/account-id");
4
4
  let node_crypto = require("node:crypto");
5
5
  node_crypto = require_rolldown_runtime.__toESM(node_crypto, 1);
6
6
  let node_path = require("node:path");
7
7
  node_path = require_rolldown_runtime.__toESM(node_path, 1);
8
8
  let openclaw_plugin_sdk_keyed_async_queue = require("openclaw/plugin-sdk/keyed-async-queue");
9
- //#region extensions/msteams/src/sqlite-state.ts
9
+ // extensions/msteams/src/sqlite-state.ts
10
10
  function resolveMSTeamsAccountStateNamespace(namespace, accountId) {
11
11
  const normalizedAccountId = (0, openclaw_plugin_sdk_account_id.normalizeAccountId)(accountId);
12
12
  if (normalizedAccountId === openclaw_plugin_sdk_account_id.DEFAULT_ACCOUNT_ID) return namespace;
@@ -21,8 +21,7 @@ async function withMSTeamsSqliteMutationLock(mutationKey, fn) {
21
21
  const scopedMutationKey = node_path.default.join(require_runtime.getMSTeamsRuntime().state.resolveStateDir(), mutationKey);
22
22
  return await sqliteMutationLocks.enqueue(scopedMutationKey, fn);
23
23
  }
24
- //#endregion
25
- //#region extensions/msteams/src/delegated-state.ts
24
+ // extensions/msteams/src/delegated-state.ts
26
25
  const MSTEAMS_DELEGATED_TOKEN_LEGACY_FILENAME = "msteams-delegated.json";
27
26
  const MSTEAMS_DELEGATED_TOKEN_NAMESPACE = "delegated-token";
28
27
  const MSTEAMS_DELEGATED_TOKEN_KEY = "current";
@@ -53,7 +52,6 @@ async function saveMSTeamsDelegatedTokens(tokens, accountId) {
53
52
  if (!normalized) throw new Error("Invalid Microsoft Teams delegated token payload");
54
53
  await openDelegatedTokenStore(accountId).register(MSTEAMS_DELEGATED_TOKEN_KEY, normalized);
55
54
  }
56
- //#endregion
57
55
  Object.defineProperty(exports, "MSTEAMS_DELEGATED_TOKEN_KEY", {
58
56
  enumerable: true,
59
57
  get: function() {
@@ -1,15 +1,15 @@
1
- const require_rolldown_runtime = require("./rolldown-runtime-BloeesfJ.cjs");
2
- const require_bot_framework_service_url = require("./bot-framework-service-url-B3FWn2SV.cjs");
3
- const require_resolve_allowlist = require("./resolve-allowlist-tYgAHx0t.cjs");
4
- const require_runtime = require("./runtime-gZTAuFux.cjs");
1
+ const require_rolldown_runtime = require("./rolldown-runtime-CiKaZLfC.cjs");
2
+ const require_bot_framework_service_url = require("./bot-framework-service-url-CgVuKiIR.cjs");
3
+ const require_resolve_allowlist = require("./resolve-allowlist-CqNzS9bZ.cjs");
4
+ const require_runtime = require("./runtime-CbKazLGv.cjs");
5
5
  require("../runtime-api.cjs");
6
- const require_delegated_state = require("./delegated-state-Bv5cWuec.cjs");
7
- const require_channel = require("./channel-B7Gy3QUW.cjs");
8
- const require_thread_session = require("./thread-session-C7KTMwLU.cjs");
9
- const require_channel_setup = require("./channel.setup-B5ClEcNI.cjs");
10
- const require_approval_card = require("./approval-card-DWPDItvq.cjs");
11
- const require_conversation_store_state = require("./conversation-store-state-C3__T9mK.cjs");
12
- const require_reaction_types = require("./reaction-types-DSQWVA4Z.cjs");
6
+ const require_delegated_state = require("./delegated-state-CbMd3rIh.cjs");
7
+ const require_channel = require("./channel-CdCSk3Rg.cjs");
8
+ const require_thread_session = require("./thread-session-DZMoCsSR.cjs");
9
+ const require_channel_setup = require("./channel.setup-nSTtK77J.cjs");
10
+ const require_approval_card = require("./approval-card-Bo8kHYbj.cjs");
11
+ const require_conversation_store_state = require("./conversation-store-state-NJU9osd-.cjs");
12
+ const require_reaction_types = require("./reaction-types-BaL1EVBS.cjs");
13
13
  let openclaw_plugin_sdk_channel_outbound = require("openclaw/plugin-sdk/channel-outbound");
14
14
  let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
15
15
  let openclaw_plugin_sdk_account_id = require("openclaw/plugin-sdk/account-id");
@@ -45,7 +45,7 @@ let openclaw_plugin_sdk_runtime_group_policy = require("openclaw/plugin-sdk/runt
45
45
  let openclaw_plugin_sdk_dangerous_name_runtime = require("openclaw/plugin-sdk/dangerous-name-runtime");
46
46
  let openclaw_plugin_sdk_account_helpers = require("openclaw/plugin-sdk/account-helpers");
47
47
  let openclaw_plugin_sdk_webhook_ingress = require("openclaw/plugin-sdk/webhook-ingress");
48
- //#region extensions/msteams/src/feedback-reflection-store.ts
48
+ // extensions/msteams/src/feedback-reflection-store.ts
49
49
  const LEARNINGS_NAMESPACE = "feedback-learnings";
50
50
  const MAX_LEARNING_ENTRIES = 1e4;
51
51
  function learningStoreKey(storePath, sessionKey) {
@@ -78,8 +78,7 @@ async function storeSessionLearning(params) {
78
78
  observed = result.current;
79
79
  }
80
80
  }
81
- //#endregion
82
- //#region extensions/msteams/src/feedback-reflection.ts
81
+ // extensions/msteams/src/feedback-reflection.ts
83
82
  /**
84
83
  * Run a background reflection after negative feedback.
85
84
  * This is designed to be called fire-and-forget (don't await in the invoke handler).
@@ -150,8 +149,7 @@ async function runFeedbackReflection(params) {
150
149
  log.debug?.("failed to send reflection follow-up", { error: require_channel_setup.formatUnknownError(err) });
151
150
  }
152
151
  }
153
- //#endregion
154
- //#region extensions/msteams/src/adaptive-card-submit.ts
152
+ // extensions/msteams/src/adaptive-card-submit.ts
155
153
  function extractAdaptiveCardSubmittedData(value) {
156
154
  if (!(0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(value)) return value;
157
155
  const action = (0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(value.action) ? value.action : void 0;
@@ -179,8 +177,7 @@ function serializeMSTeamsAdaptiveCardActionValue(value) {
179
177
  return null;
180
178
  }
181
179
  }
182
- //#endregion
183
- //#region extensions/msteams/src/approval-card-submit.ts
180
+ // extensions/msteams/src/approval-card-submit.ts
184
181
  function isMSTeamsApprovalSubmit(value) {
185
182
  if (!(0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(value)) return false;
186
183
  if (value.openclawAction === "approval") return true;
@@ -264,8 +261,7 @@ async function maybeHandleMSTeamsApprovalCardSubmit(params) {
264
261
  });
265
262
  return true;
266
263
  }
267
- //#endregion
268
- //#region extensions/msteams/src/monitor-handler/access.ts
264
+ // extensions/msteams/src/monitor-handler/access.ts
269
265
  const msteamsIngressIdentity = {
270
266
  key: "sender-id",
271
267
  authentication: "asserted",
@@ -542,8 +538,7 @@ async function admitMSTeamsMessage(params) {
542
538
  isChannel: params.isChannel
543
539
  };
544
540
  }
545
- //#endregion
546
- //#region src/channels/mention-gating.ts
541
+ // src/channels/mention-gating.ts
547
542
  function resolveBotThreadMentionPolicy(params) {
548
543
  if (!params.isBotOwnedThread || params.requireMentionInBotThreads === void 0) return {
549
544
  requireMention: params.requireMention,
@@ -554,8 +549,7 @@ function resolveBotThreadMentionPolicy(params) {
554
549
  implicitMentionKinds: params.requireMentionInBotThreads ? params.implicitMentionKinds?.filter((kind) => kind === "native") : params.implicitMentionKinds
555
550
  };
556
551
  }
557
- //#endregion
558
- //#region extensions/msteams/src/monitor-handler/config.ts
552
+ // extensions/msteams/src/monitor-handler/config.ts
559
553
  function createMSTeamsHandlerConfigReader(deps) {
560
554
  const source = deps.accountPolicyCfg ?? deps.cfg;
561
555
  const read = (0, openclaw_plugin_sdk_runtime_config_snapshot.createRuntimeConfigReader)(source);
@@ -580,8 +574,7 @@ function createMSTeamsHandlerConfigReader(deps) {
580
574
  });
581
575
  };
582
576
  }
583
- //#endregion
584
- //#region extensions/msteams/src/attachments/bot-framework.ts
577
+ // extensions/msteams/src/attachments/bot-framework.ts
585
578
  const BOT_FRAMEWORK_SCOPE = "https://api.botframework.com";
586
579
  /**
587
580
  * Detect Bot Framework personal chat ("a:") and MSA orgid ("8:orgid:") conversation
@@ -746,8 +739,7 @@ async function downloadMSTeamsBotFrameworkAttachments(params) {
746
739
  attachmentCount: unique.length
747
740
  };
748
741
  }
749
- //#endregion
750
- //#region extensions/msteams/src/attachments/html.ts
742
+ // extensions/msteams/src/attachments/html.ts
751
743
  /**
752
744
  * Extract every `<attachment id="...">` reference from the HTML attachments in
753
745
  * the inbound activity. Returns the complete (non-sliced) list; callers that
@@ -760,9 +752,8 @@ function extractMSTeamsHtmlAttachmentIds(attachments) {
760
752
  for (const att of list) {
761
753
  const html = require_resolve_allowlist.extractHtmlFromAttachment(att);
762
754
  if (!html) continue;
763
- require_resolve_allowlist.ATTACHMENT_TAG_RE.lastIndex = 0;
764
- for (const match of html.matchAll(require_resolve_allowlist.ATTACHMENT_TAG_RE)) {
765
- const id = match[1]?.trim();
755
+ for (const value of require_resolve_allowlist.htmlTagAttributeValues(html, "attachment", "id")) {
756
+ const id = value.trim();
766
757
  if (id) ids.add(id);
767
758
  }
768
759
  }
@@ -782,20 +773,18 @@ function summarizeMSTeamsHtmlAttachments(attachments) {
782
773
  const html = require_resolve_allowlist.extractHtmlFromAttachment(att);
783
774
  if (!html) continue;
784
775
  htmlAttachments += 1;
785
- require_resolve_allowlist.IMG_SRC_RE.lastIndex = 0;
786
- for (const match of html.matchAll(require_resolve_allowlist.IMG_SRC_RE)) {
776
+ for (const value of require_resolve_allowlist.htmlTagAttributeValues(html, "img", "src")) {
787
777
  imgTags += 1;
788
- const src = match[1]?.trim();
778
+ const src = value.trim();
789
779
  if (src) {
790
780
  if (src.startsWith("data:")) dataImages += 1;
791
781
  else if (src.startsWith("cid:")) cidImages += 1;
792
782
  else srcHosts.add(require_resolve_allowlist.safeHostForUrl(src));
793
783
  }
794
784
  }
795
- require_resolve_allowlist.ATTACHMENT_TAG_RE.lastIndex = 0;
796
- for (const attachmentMatch of html.matchAll(require_resolve_allowlist.ATTACHMENT_TAG_RE)) {
785
+ for (const value of require_resolve_allowlist.htmlTagAttributeValues(html, "attachment", "id")) {
797
786
  attachmentTags += 1;
798
- const id = attachmentMatch[1]?.trim();
787
+ const id = value.trim();
799
788
  if (id) attachmentIds.add(id);
800
789
  }
801
790
  }
@@ -840,8 +829,7 @@ function resolveMSTeamsAdvertisedMedia(attachments) {
840
829
  ...htmlAttachmentIds.map((sourceId) => createAdvertisedMediaFact("document", sourceId))
841
830
  ];
842
831
  }
843
- //#endregion
844
- //#region extensions/msteams/src/attachments/remote-media.ts
832
+ // extensions/msteams/src/attachments/remote-media.ts
845
833
  /**
846
834
  * Direct save path used when the caller supplies the already-guarded fetch
847
835
  * implementation. This lets Teams-specific auth fallback own the request
@@ -869,8 +857,7 @@ async function downloadAndStoreMSTeamsRemoteMedia(params) {
869
857
  await response.body?.cancel().catch(() => void 0);
870
858
  }
871
859
  }
872
- //#endregion
873
- //#region extensions/msteams/src/attachments/download.ts
860
+ // extensions/msteams/src/attachments/download.ts
874
861
  function resolveDownloadCandidate(att, graphReferenceToken) {
875
862
  const contentType = require_resolve_allowlist.normalizeContentType(att.contentType);
876
863
  const graphReference = graphReferenceToken !== void 0 && contentType === "reference";
@@ -1101,8 +1088,7 @@ async function downloadMSTeamsAttachments(params) {
1101
1088
  function safeHostForLog(url) {
1102
1089
  return URL.parse(url)?.host ?? "invalid-url";
1103
1090
  }
1104
- //#endregion
1105
- //#region extensions/msteams/src/attachments/graph.ts
1091
+ // extensions/msteams/src/attachments/graph.ts
1106
1092
  function createGraphHostedContentFact(item) {
1107
1093
  const contentType = require_resolve_allowlist.normalizeContentType(item.contentType);
1108
1094
  return {
@@ -1349,8 +1335,7 @@ async function downloadMSTeamsGraphMedia(params) {
1349
1335
  messageUrl
1350
1336
  };
1351
1337
  }
1352
- //#endregion
1353
- //#region extensions/msteams/src/monitor-handler/inbound-media.ts
1338
+ // extensions/msteams/src/monitor-handler/inbound-media.ts
1354
1339
  function shouldAttemptMSTeamsGraphMediaFallback(params) {
1355
1340
  const conversationType = params.conversationType.trim().toLowerCase();
1356
1341
  return params.graphMediaFallback === true && (conversationType === "channel" || conversationType === "groupchat") && (params.htmlSummary?.htmlAttachments ?? 0) > 0;
@@ -1491,8 +1476,7 @@ async function resolveMSTeamsInboundMedia(params) {
1491
1476
  });
1492
1477
  return mediaList;
1493
1478
  }
1494
- //#endregion
1495
- //#region extensions/msteams/src/monitor-handler/inbound-content.ts
1479
+ // extensions/msteams/src/monitor-handler/inbound-content.ts
1496
1480
  async function prepareMSTeamsInboundContent(params) {
1497
1481
  const activity = params.entry.context.activity;
1498
1482
  const mayRecoverGraphMedia = Boolean(params.htmlSummary?.attachmentIds.length) || shouldAttemptMSTeamsGraphMediaFallback({
@@ -1555,8 +1539,7 @@ async function prepareMSTeamsInboundContent(params) {
1555
1539
  inboundMedia
1556
1540
  };
1557
1541
  }
1558
- //#endregion
1559
- //#region extensions/msteams/src/informative-status.ts
1542
+ // extensions/msteams/src/informative-status.ts
1560
1543
  const INFORMATIVE_MAX_CHARS = 1e3;
1561
1544
  const INFORMATIVE_MAX_BYTES = 1024;
1562
1545
  const ELLIPSIS = "…";
@@ -1579,8 +1562,7 @@ function flattenInformativeStatus(text) {
1579
1562
  }
1580
1563
  return ELLIPSIS + graphemes.slice(start).join("");
1581
1564
  }
1582
- //#endregion
1583
- //#region extensions/msteams/src/reply-stream-controller.ts
1565
+ // extensions/msteams/src/reply-stream-controller.ts
1584
1566
  function isStreamCancelledError(err) {
1585
1567
  return err instanceof Error && err.name === "StreamCancelledError";
1586
1568
  }
@@ -1880,8 +1862,7 @@ function createTeamsReplyStreamController(params) {
1880
1862
  wasCanceled
1881
1863
  };
1882
1864
  }
1883
- //#endregion
1884
- //#region extensions/msteams/src/reply-dispatcher.ts
1865
+ // extensions/msteams/src/reply-dispatcher.ts
1885
1866
  function createMSTeamsReplyDispatcher(params) {
1886
1867
  const core = require_runtime.getMSTeamsRuntime();
1887
1868
  const msteamsCfg = require_resolve_allowlist.resolveMSTeamsAccountConfig(params.cfg, params.accountId);
@@ -2196,8 +2177,7 @@ function createMSTeamsReplyDispatcher(params) {
2196
2177
  }
2197
2178
  };
2198
2179
  }
2199
- //#endregion
2200
- //#region extensions/msteams/src/monitor-handler/inbound-dispatch.ts
2180
+ // extensions/msteams/src/monitor-handler/inbound-dispatch.ts
2201
2181
  async function dispatchMSTeamsInboundTurn(params) {
2202
2182
  const core = require_runtime.getMSTeamsRuntime();
2203
2183
  const { cfg, runtime, app, tokenProvider, textLimit, log, logVerboseMessage, facts, admission, content, routing, thread, replyStyle, timestamp, contextVisibilityMode, conversationHistories, historyLimit } = params;
@@ -2434,8 +2414,7 @@ async function dispatchMSTeamsInboundTurn(params) {
2434
2414
  return { kind: "failed" };
2435
2415
  }
2436
2416
  }
2437
- //#endregion
2438
- //#region extensions/msteams/src/monitor-handler/inbound-facts.ts
2417
+ // extensions/msteams/src/monitor-handler/inbound-facts.ts
2439
2418
  function extractTextFromHtmlAttachments(attachments) {
2440
2419
  for (const attachment of attachments) {
2441
2420
  const raw = require_resolve_allowlist.extractHtmlFromAttachment(attachment);
@@ -2537,8 +2516,7 @@ function assembleMSTeamsInboundFacts(entry) {
2537
2516
  })
2538
2517
  };
2539
2518
  }
2540
- //#endregion
2541
- //#region extensions/msteams/src/team-identity.ts
2519
+ // extensions/msteams/src/team-identity.ts
2542
2520
  const teamGroupIdCache = /* @__PURE__ */ new Map();
2543
2521
  const TEAM_GROUP_ID_CACHE_MAX_ENTRIES = 500;
2544
2522
  function cacheTeamGroupId(conversationTeamId, groupId) {
@@ -2565,8 +2543,7 @@ async function resolveTeamGroupId(params) {
2565
2543
  cacheTeamGroupId(params.conversationTeamId, groupId);
2566
2544
  return groupId;
2567
2545
  }
2568
- //#endregion
2569
- //#region extensions/msteams/src/thread-parent-context.ts
2546
+ // extensions/msteams/src/thread-parent-context.ts
2570
2547
  const PARENT_CACHE_TTL_MS = 3e5;
2571
2548
  const PARENT_CACHE_MAX = 100;
2572
2549
  const parentCache = /* @__PURE__ */ new Map();
@@ -2618,8 +2595,7 @@ function shouldInjectParentContext(sessionKey, parentId) {
2618
2595
  function markParentContextInjected(sessionKey, parentId) {
2619
2596
  touchLru(injectedParents, sessionKey, parentId, INJECTED_MAX);
2620
2597
  }
2621
- //#endregion
2622
- //#region extensions/msteams/src/monitor-handler/thread-context.ts
2598
+ // extensions/msteams/src/monitor-handler/thread-context.ts
2623
2599
  function prepareMSTeamsThreadRouting(params) {
2624
2600
  const route = require_runtime.getMSTeamsRuntime().channel.routing.resolveAgentRoute({
2625
2601
  cfg: params.cfg,
@@ -2751,8 +2727,7 @@ async function resolveMSTeamsThreadContext(params) {
2751
2727
  threadContext
2752
2728
  };
2753
2729
  }
2754
- //#endregion
2755
- //#region extensions/msteams/src/monitor-handler/message-handler.ts
2730
+ // extensions/msteams/src/monitor-handler/message-handler.ts
2756
2731
  function createMSTeamsMessageHandler(deps) {
2757
2732
  const { cfg, accountPolicyCfg = cfg, accountId, runtime, appId, app, tokenProvider, textLimit, mediaMaxBytes, conversationStore, pollStore, log } = deps;
2758
2733
  const core = require_runtime.getMSTeamsRuntime();
@@ -3057,8 +3032,7 @@ function createMSTeamsMessageHandler(deps) {
3057
3032
  if (turnAdoptionLifecycle) return { kind: "deferred" };
3058
3033
  };
3059
3034
  }
3060
- //#endregion
3061
- //#region extensions/msteams/src/monitor-handler/reaction-handler.ts
3035
+ // extensions/msteams/src/monitor-handler/reaction-handler.ts
3062
3036
  function createMSTeamsReactionHandler(deps) {
3063
3037
  const { accountId, log } = deps;
3064
3038
  const readConfig = deps.readConfig ?? createMSTeamsHandlerConfigReader(deps);
@@ -3147,8 +3121,7 @@ function createMSTeamsReactionHandler(deps) {
3147
3121
  }
3148
3122
  };
3149
3123
  }
3150
- //#endregion
3151
- //#region extensions/msteams/src/welcome-card.ts
3124
+ // extensions/msteams/src/welcome-card.ts
3152
3125
  const DEFAULT_PROMPT_STARTERS = [
3153
3126
  "What can you do?",
3154
3127
  "Summarize my last meeting",
@@ -3184,8 +3157,7 @@ function buildGroupWelcomeText(botName) {
3184
3157
  const name = botName || "OpenClaw";
3185
3158
  return `Hi! I'm ${name}. Mention me with @${name} to get started.`;
3186
3159
  }
3187
- //#endregion
3188
- //#region extensions/msteams/src/monitor-handler.ts
3160
+ // extensions/msteams/src/monitor-handler.ts
3189
3161
  async function isMSTeamsInvokeAuthorized(params) {
3190
3162
  const { context, deps, invokeKind } = params;
3191
3163
  const cfg = deps.readConfig?.() ?? deps.cfg;
@@ -3303,8 +3275,7 @@ function createMSTeamsActivityHandler(deps) {
3303
3275
  }
3304
3276
  };
3305
3277
  }
3306
- //#endregion
3307
- //#region extensions/msteams/src/feedback-invoke.ts
3278
+ // extensions/msteams/src/feedback-invoke.ts
3308
3279
  /** Return whether feedback consumed the invoke; the SDK owns its HTTP acknowledgement. */
3309
3280
  async function runMSTeamsFeedbackInvokeHandler(context, deps) {
3310
3281
  const activity = context.activity;
@@ -3415,8 +3386,7 @@ async function runMSTeamsFeedbackInvokeHandler(context, deps) {
3415
3386
  });
3416
3387
  return true;
3417
3388
  }
3418
- //#endregion
3419
- //#region extensions/msteams/src/file-consent-invoke.ts
3389
+ // extensions/msteams/src/file-consent-invoke.ts
3420
3390
  async function handleMSTeamsFileConsentInvoke(context, log) {
3421
3391
  const expiredUploadMessage = "The file upload request has expired. Please try sending the file again.";
3422
3392
  const activity = context.activity;
@@ -3518,16 +3488,14 @@ async function runMSTeamsFileConsentInvokeHandler(context, log) {
3518
3488
  log.debug?.("file consent handler error", { error: require_channel_setup.formatUnknownError(err) });
3519
3489
  }
3520
3490
  }
3521
- //#endregion
3522
- //#region extensions/msteams/src/monitor-account-stores.ts
3491
+ // extensions/msteams/src/monitor-account-stores.ts
3523
3492
  function createMSTeamsMonitorStores(accountId, overrides) {
3524
3493
  return {
3525
3494
  conversationStore: overrides.conversationStore ?? require_conversation_store_state.createMSTeamsConversationStoreState({ accountId }),
3526
3495
  pollStore: overrides.pollStore ?? require_conversation_store_state.createMSTeamsPollStoreState({ accountId })
3527
3496
  };
3528
3497
  }
3529
- //#endregion
3530
- //#region extensions/msteams/src/monitor-status.ts
3498
+ // extensions/msteams/src/monitor-status.ts
3531
3499
  function publishMSTeamsBlocked(statusSink, lastError) {
3532
3500
  statusSink?.((0, openclaw_plugin_sdk_gateway_runtime.channelBlockedPatch)(lastError, { running: true }));
3533
3501
  }
@@ -3537,8 +3505,7 @@ function publishMSTeamsReady(statusSink, now = Date.now()) {
3537
3505
  function publishMSTeamsStopped(statusSink) {
3538
3506
  statusSink?.((0, openclaw_plugin_sdk_gateway_runtime.channelStoppedPatch)());
3539
3507
  }
3540
- //#endregion
3541
- //#region extensions/msteams/src/msteams-ingress.ts
3508
+ // extensions/msteams/src/msteams-ingress.ts
3542
3509
  const MSTEAMS_INGRESS_VERSION = 1;
3543
3510
  const MSTEAMS_INGRESS_DRAIN_INTERVAL_MS = 500;
3544
3511
  const MSTEAMS_INGRESS_MAX_CONCURRENT_DELIVERIES = 8;
@@ -3667,8 +3634,7 @@ function createMSTeamsIngress(options) {
3667
3634
  }
3668
3635
  };
3669
3636
  }
3670
- //#endregion
3671
- //#region extensions/msteams/src/replay-context.ts
3637
+ // extensions/msteams/src/replay-context.ts
3672
3638
  function createMSTeamsReplayContext(activity, app, serviceUrlBoundary, accountId) {
3673
3639
  const rawConversationId = activity.conversation?.id ?? "";
3674
3640
  const conversationId = require_resolve_allowlist.normalizeMSTeamsConversationId(rawConversationId);
@@ -3716,8 +3682,7 @@ function createMSTeamsReplayContext(activity, app, serviceUrlBoundary, accountId
3716
3682
  getTeamDetails: (teamId) => app.api.teams.getById(teamId)
3717
3683
  };
3718
3684
  }
3719
- //#endregion
3720
- //#region extensions/msteams/src/sso-token-store.ts
3685
+ // extensions/msteams/src/sso-token-store.ts
3721
3686
  /**
3722
3687
  * SQLite-backed store for Bot Framework OAuth SSO tokens.
3723
3688
  *
@@ -3751,8 +3716,7 @@ function createMSTeamsSsoTokenStoreFs(params) {
3751
3716
  }
3752
3717
  };
3753
3718
  }
3754
- //#endregion
3755
- //#region extensions/msteams/src/webhook-handler.ts
3719
+ // extensions/msteams/src/webhook-handler.ts
3756
3720
  /** Keep Express response ownership until the channel's route can be released. */
3757
3721
  function createMSTeamsWebhookHandler(expressApp, warn) {
3758
3722
  const responses = /* @__PURE__ */ new Map();
@@ -3798,8 +3762,7 @@ function createMSTeamsWebhookHandler(expressApp, warn) {
3798
3762
  }
3799
3763
  };
3800
3764
  }
3801
- //#endregion
3802
- //#region extensions/msteams/src/monitor.ts
3765
+ // extensions/msteams/src/monitor.ts
3803
3766
  async function monitorMSTeamsProvider(opts) {
3804
3767
  const core = require_runtime.getMSTeamsRuntime();
3805
3768
  const log = core.logging.getChildLogger({ name: "msteams" });
@@ -3900,6 +3863,7 @@ async function monitorMSTeamsProvider(opts) {
3900
3863
  } catch (err) {
3901
3864
  runtime.error?.(`msteams resolve failed; mutable allowlist entries are disabled. ${require_channel_setup.formatUnknownError(err)}`);
3902
3865
  }
3866
+ if (Array.isArray(configuredGroupAllowFrom)) groupAllowFrom = require_resolve_allowlist.keepConfiguredMSTeamsAllowlistActive(configuredGroupAllowFrom, groupAllowFrom);
3903
3867
  if (configuredGroupAllowFrom == null && groupAllowFrom) groupAllowFrom = (0, openclaw_plugin_sdk_allow_from.mergeAllowlist)({
3904
3868
  existing: groupAllowFrom,
3905
3869
  additions: allowFrom ?? []
@@ -4256,5 +4220,4 @@ function adaptSdkContext(ctx, app) {
4256
4220
  stream: sdkCtx.stream
4257
4221
  });
4258
4222
  }
4259
- //#endregion
4260
4223
  exports.monitorMSTeamsProvider = monitorMSTeamsProvider;