@openclaw/msteams 2026.11.1 → 2026.11.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.
Files changed (37) hide show
  1. package/dist/.setup/{adapter.runtime-BMvpm7sS.cjs → adapter.runtime-B-6Q3nMI.cjs} +5 -3
  2. package/dist/.setup/{approval-card-Bo8kHYbj.cjs → approval-card-DWPDItvq.cjs} +4 -2
  3. package/dist/.setup/{approval-handler.runtime-BS3avHFu.cjs → approval-handler.runtime-CJtz8aNI.cjs} +6 -5
  4. package/dist/.setup/{bot-framework-service-url-CgVuKiIR.cjs → bot-framework-service-url-B3FWn2SV.cjs} +4 -2
  5. package/dist/.setup/{channel-CdCSk3Rg.cjs → channel-DMWQSTtQ.cjs} +75 -38
  6. package/dist/.setup/{channel.runtime--ZjTYgkY.cjs → channel.runtime-CthqKb5j.cjs} +26 -17
  7. package/dist/.setup/{channel.setup-nSTtK77J.cjs → channel.setup-BN3uhq3r.cjs} +17 -11
  8. package/dist/.setup/{config-schema-Bm15lF-j.cjs → config-schema-CkKdphSp.cjs} +8 -5
  9. package/dist/.setup/{conversation-store-state-NJU9osd-.cjs → conversation-store-state-B-4g4uq5.cjs} +40 -23
  10. package/dist/.setup/{delegated-state-CbMd3rIh.cjs → delegated-state-Bv5cWuec.cjs} +6 -4
  11. package/dist/.setup/{monitor-BxLDs5fk.cjs → monitor-CNa939Lg.cjs} +101 -49
  12. package/dist/.setup/{oauth-B-Y5pNM4.cjs → oauth-BBUQCwmq.cjs} +5 -3
  13. package/dist/.setup/{reaction-types-BaL1EVBS.cjs → reaction-types-CwP5RVQB.cjs} +5 -3
  14. package/dist/.setup/{resolve-allowlist-CqNzS9bZ.cjs → resolve-allowlist-gI34MnpE.cjs} +34 -19
  15. package/dist/.setup/{rolldown-runtime-CiKaZLfC.cjs → rolldown-runtime-BloeesfJ.cjs} +2 -1
  16. package/dist/.setup/{runtime-CbKazLGv.cjs → runtime-gZTAuFux.cjs} +2 -1
  17. package/dist/.setup/{secret-contract-api-5aH1Fl_c.cjs → secret-contract-api-YY3v6MP8.cjs} +1 -1
  18. package/dist/.setup/{secret-contract-api-BOzdWSn9.cjs → secret-contract-api-wAyY5UHv.cjs} +2 -1
  19. package/dist/.setup/{send-BXjI3ufq.cjs → send-D48Qmug3.cjs} +11 -9
  20. package/dist/.setup/{setup-plugin-api-lPpin6Gg.cjs → setup-plugin-api-B-NYBLkF.cjs} +1 -1
  21. package/dist/.setup/{thread-session-DZMoCsSR.cjs → thread-session-BWVCoYza.cjs} +5 -3
  22. package/dist/.setup/{token-config-DTZ00Ibq.cjs → token-config-bEpua_Q7.cjs} +2 -1
  23. package/dist/api.cjs +2 -2
  24. package/dist/channel-config-api.cjs +1 -1
  25. package/dist/channel-plugin-api.cjs +1 -1
  26. package/dist/configured-state.cjs +2 -1
  27. package/dist/directory-contract-api.cjs +2 -1
  28. package/dist/doctor-backup-resources.cjs +3 -2
  29. package/dist/doctor-contract-api.cjs +15 -9
  30. package/dist/index.cjs +2 -1
  31. package/dist/qa-runner-api.cjs +5 -3
  32. package/dist/runtime-api.cjs +1 -1
  33. package/dist/secret-contract-api.cjs +1 -1
  34. package/dist/setup-entry.cjs +4 -3
  35. package/dist/setup-plugin-api.cjs +1 -1
  36. package/package.json +4 -4
  37. package/dist/.source-module-urls/7e43ee3ae4faab430a47269c8217f8d99ec60ecd85233f40e81d03efeb543068.json +0 -1
@@ -1,10 +1,10 @@
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");
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-gI34MnpE.cjs");
4
+ const require_runtime = require("./runtime-gZTAuFux.cjs");
5
5
  require("../runtime-api.cjs");
6
- const require_delegated_state = require("./delegated-state-CbMd3rIh.cjs");
7
- const require_channel_setup = require("./channel.setup-nSTtK77J.cjs");
6
+ const require_delegated_state = require("./delegated-state-Bv5cWuec.cjs");
7
+ const require_channel_setup = require("./channel.setup-BN3uhq3r.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
- // extensions/msteams/src/file-consent.ts
36
+ //#region 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,7 +132,8 @@ 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
- // extensions/msteams/src/pending-uploads-fs.ts
135
+ //#endregion
136
+ //#region extensions/msteams/src/pending-uploads-fs.ts
136
137
  /** TTL for persisted pending uploads (matches in-memory store). */
137
138
  const PENDING_UPLOAD_TTL_MS$1 = 3e5;
138
139
  /** Cap to avoid unbounded growth if a process crashes mid-flow. */
@@ -295,7 +296,8 @@ async function setPendingUploadActivityIdFs(id, activityId) {
295
296
  }));
296
297
  });
297
298
  }
298
- // extensions/msteams/src/pending-uploads.ts
299
+ //#endregion
300
+ //#region extensions/msteams/src/pending-uploads.ts
299
301
  /**
300
302
  * In-memory storage for files awaiting user consent in the FileConsentCard flow.
301
303
  *
@@ -360,7 +362,8 @@ function setPendingUploadActivityId(uploadId, activityId) {
360
362
  const entry = pendingUploads.get(uploadId);
361
363
  if (entry) entry.consentCardActivityId = activityId;
362
364
  }
363
- // extensions/msteams/src/file-consent-helpers.ts
365
+ //#endregion
366
+ //#region extensions/msteams/src/file-consent-helpers.ts
364
367
  const FILE_CONSENT_THRESHOLD_BYTES = 4194304;
365
368
  /** In-process replies keep consent bytes in memory; CLI sends use the persisted variant below. */
366
369
  function prepareFileConsentActivity(params) {
@@ -400,7 +403,8 @@ function requiresFileConsent(params) {
400
403
  const isLargeFile = params.bufferSize >= FILE_CONSENT_THRESHOLD_BYTES;
401
404
  return isPersonal && (isLargeFile || !isImage);
402
405
  }
403
- // extensions/msteams/src/format.ts
406
+ //#endregion
407
+ //#region extensions/msteams/src/format.ts
404
408
  const ESCAPED_MARKDOWN_RE = /\\[\\`*_{}[\]()#+\-.!|>~]/gu;
405
409
  const MARKDOWN_ENTITY_RE = /&(?:#\d+|#x[\da-f]+|[a-z][a-z\d]+);/giu;
406
410
  const TOKEN_END = "";
@@ -681,7 +685,8 @@ function formatMSTeamsMarkdown(markdown, tableMode) {
681
685
  }, MSTEAMS_FORMAT_CAPABILITIES);
682
686
  return protectedValues.reduce((text, { prefix, values }) => restoreTokens(text, prefix, values), restoreTokens(rendered, `${tokenPrefix}c`, codeRegions));
683
687
  }
684
- // extensions/msteams/src/graph-chat.ts
688
+ //#endregion
689
+ //#region extensions/msteams/src/graph-chat.ts
685
690
  function buildTeamsFileInfoCard(file) {
686
691
  const rawETag = file.eTag;
687
692
  const uniqueId = rawETag.replace(/^["']|["']$/g, "").replace(/[{}]/g, "").split(",")[0] ?? rawETag;
@@ -694,7 +699,8 @@ function buildTeamsFileInfoCard(file) {
694
699
  fileType
695
700
  });
696
701
  }
697
- // extensions/msteams/src/graph-upload.ts
702
+ //#endregion
703
+ //#region extensions/msteams/src/graph-upload.ts
698
704
  const GRAPH_ROOT = "https://graph.microsoft.com/v1.0";
699
705
  const GRAPH_BETA = "https://graph.microsoft.com/beta";
700
706
  const GRAPH_SCOPE = "https://graph.microsoft.com";
@@ -837,7 +843,8 @@ async function uploadAndShareSharePoint(params) {
837
843
  name: uploaded.name
838
844
  };
839
845
  }
840
- // extensions/msteams/src/media-helpers.ts
846
+ //#endregion
847
+ //#region extensions/msteams/src/media-helpers.ts
841
848
  const MSTEAMS_MAX_MEDIA_BYTES = 104857600;
842
849
  async function getMimeType(url) {
843
850
  if (url.startsWith("data:")) {
@@ -882,7 +889,8 @@ function extractMessageId(response) {
882
889
  const { id } = response;
883
890
  return typeof id === "string" && id ? id : null;
884
891
  }
885
- // extensions/msteams/src/mentions.ts
892
+ //#endregion
893
+ //#region extensions/msteams/src/mentions.ts
886
894
  /**
887
895
  * Check whether an ID looks like a valid Teams user/bot identifier.
888
896
  * Accepts:
@@ -925,7 +933,8 @@ function parseMentions(text) {
925
933
  entities
926
934
  };
927
935
  }
928
- // extensions/msteams/src/message-activity.ts
936
+ //#endregion
937
+ //#region extensions/msteams/src/message-activity.ts
929
938
  const AI_GENERATED_ENTITY = {
930
939
  type: "https://schema.org/Message",
931
940
  "@type": "Message",
@@ -951,7 +960,8 @@ function buildMSTeamsAdaptiveCardActivity(card) {
951
960
  }]
952
961
  };
953
962
  }
954
- // extensions/msteams/src/revoked-context.ts
963
+ //#endregion
964
+ //#region extensions/msteams/src/revoked-context.ts
955
965
  async function withRevokedProxyFallback(params) {
956
966
  try {
957
967
  return await params.run();
@@ -961,7 +971,8 @@ async function withRevokedProxyFallback(params) {
961
971
  return await params.onRevoked();
962
972
  }
963
973
  }
964
- // extensions/msteams/src/sent-message-cache.ts
974
+ //#endregion
975
+ //#region extensions/msteams/src/sent-message-cache.ts
965
976
  const TTL_MS = 864e5;
966
977
  const MAX_ENTRIES = 2e4;
967
978
  const PERSISTENT_MAX_ENTRIES = 1e3;
@@ -1010,7 +1021,8 @@ async function wasMSTeamsMessageSentWithPersistence(params) {
1010
1021
  if (!params.conversationId || !params.messageId) return false;
1011
1022
  return await getSentMessageCache((0, openclaw_plugin_sdk_account_id.normalizeAccountId)(params.accountId)).lookup(makeKey(params.conversationId, params.messageId, params.botId));
1012
1023
  }
1013
- // extensions/msteams/src/sdk-proactive.ts
1024
+ //#endregion
1025
+ //#region extensions/msteams/src/sdk-proactive.ts
1014
1026
  const loadMSTeamsApiModule = (0, openclaw_plugin_sdk_lazy_runtime.createLazyRuntimeModule)(() => import("@microsoft/teams.api"));
1015
1027
  async function quoteMSTeamsActivity(activity, messageId) {
1016
1028
  const { MessageActivityInput } = await loadMSTeamsApiModule();
@@ -1146,7 +1158,8 @@ async function deleteMSTeamsActivityWithReference(app, source, activityId, optio
1146
1158
  const ref = buildSdkConversationReference(source, options);
1147
1159
  return (await getApiClientForReference(app, ref)).conversations.activities(ref.conversation.id).delete(activityId);
1148
1160
  }
1149
- // extensions/msteams/src/messenger.ts
1161
+ //#endregion
1162
+ //#region extensions/msteams/src/messenger.ts
1150
1163
  const MSTEAMS_SEND_ATTEMPTS = 3;
1151
1164
  const MSTEAMS_SEND_RETRY_MAX_DELAY_MS = 1e4;
1152
1165
  function buildConversationReference(ref) {
@@ -1359,7 +1372,8 @@ async function sendMSTeamsMessages(params) {
1359
1372
  }
1360
1373
  return await sendProactively(messages, 0);
1361
1374
  }
1362
- // extensions/msteams/src/polls.ts
1375
+ //#endregion
1376
+ //#region extensions/msteams/src/polls.ts
1363
1377
  const MSTEAMS_POLLS_NAMESPACE = "polls";
1364
1378
  const MSTEAMS_POLL_VOTE_BUCKETS_NAMESPACE = "poll-vote-buckets";
1365
1379
  const MSTEAMS_MAX_POLLS = 1e3;
@@ -1633,7 +1647,8 @@ function createMSTeamsPollStoreState(params) {
1633
1647
  recordVote
1634
1648
  };
1635
1649
  }
1636
- // extensions/msteams/src/conversation-store-helpers.ts
1650
+ //#endregion
1651
+ //#region extensions/msteams/src/conversation-store-helpers.ts
1637
1652
  function mergeStoredConversationReference(existing, incoming, nowIso) {
1638
1653
  return {
1639
1654
  ...existing?.timezone && !incoming.timezone ? { timezone: existing.timezone } : {},
@@ -1663,7 +1678,8 @@ function findPreferredDmConversationByUserId(entries, id) {
1663
1678
  }
1664
1679
  return preferred;
1665
1680
  }
1666
- // extensions/msteams/src/conversation-store-state.ts
1681
+ //#endregion
1682
+ //#region extensions/msteams/src/conversation-store-state.ts
1667
1683
  const MSTEAMS_CONVERSATIONS_NAMESPACE = "conversations";
1668
1684
  const MSTEAMS_MAX_CONVERSATIONS = 1e3;
1669
1685
  const MSTEAMS_SQLITE_MAX_CONVERSATION_ROWS = 2e3;
@@ -1754,6 +1770,7 @@ function createMSTeamsConversationStoreState(params) {
1754
1770
  findPreferredDmByUserId
1755
1771
  };
1756
1772
  }
1773
+ //#endregion
1757
1774
  Object.defineProperty(exports, "FILE_CONSENT_THRESHOLD_BYTES", {
1758
1775
  enumerable: true,
1759
1776
  get: function() {
@@ -1,12 +1,12 @@
1
- const require_rolldown_runtime = require("./rolldown-runtime-CiKaZLfC.cjs");
2
- const require_runtime = require("./runtime-CbKazLGv.cjs");
1
+ const require_rolldown_runtime = require("./rolldown-runtime-BloeesfJ.cjs");
2
+ const require_runtime = require("./runtime-gZTAuFux.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
- // extensions/msteams/src/sqlite-state.ts
9
+ //#region 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,7 +21,8 @@ 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
- // extensions/msteams/src/delegated-state.ts
24
+ //#endregion
25
+ //#region extensions/msteams/src/delegated-state.ts
25
26
  const MSTEAMS_DELEGATED_TOKEN_LEGACY_FILENAME = "msteams-delegated.json";
26
27
  const MSTEAMS_DELEGATED_TOKEN_NAMESPACE = "delegated-token";
27
28
  const MSTEAMS_DELEGATED_TOKEN_KEY = "current";
@@ -52,6 +53,7 @@ async function saveMSTeamsDelegatedTokens(tokens, accountId) {
52
53
  if (!normalized) throw new Error("Invalid Microsoft Teams delegated token payload");
53
54
  await openDelegatedTokenStore(accountId).register(MSTEAMS_DELEGATED_TOKEN_KEY, normalized);
54
55
  }
56
+ //#endregion
55
57
  Object.defineProperty(exports, "MSTEAMS_DELEGATED_TOKEN_KEY", {
56
58
  enumerable: true,
57
59
  get: function() {
@@ -1,15 +1,15 @@
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");
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-gI34MnpE.cjs");
4
+ const require_runtime = require("./runtime-gZTAuFux.cjs");
5
5
  require("../runtime-api.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");
6
+ const require_delegated_state = require("./delegated-state-Bv5cWuec.cjs");
7
+ const require_channel = require("./channel-DMWQSTtQ.cjs");
8
+ const require_thread_session = require("./thread-session-BWVCoYza.cjs");
9
+ const require_channel_setup = require("./channel.setup-BN3uhq3r.cjs");
10
+ const require_approval_card = require("./approval-card-DWPDItvq.cjs");
11
+ const require_conversation_store_state = require("./conversation-store-state-B-4g4uq5.cjs");
12
+ const require_reaction_types = require("./reaction-types-CwP5RVQB.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");
@@ -33,6 +33,7 @@ let openclaw_plugin_sdk_channel_ingress_runtime = require("openclaw/plugin-sdk/c
33
33
  let openclaw_plugin_sdk_context_visibility_runtime = require("openclaw/plugin-sdk/context-visibility-runtime");
34
34
  let openclaw_plugin_sdk_reply_history = require("openclaw/plugin-sdk/reply-history");
35
35
  let openclaw_plugin_sdk_runtime_config_snapshot = require("openclaw/plugin-sdk/runtime-config-snapshot");
36
+ let node_util = require("node:util");
36
37
  let openclaw_plugin_sdk_request_url = require("openclaw/plugin-sdk/request-url");
37
38
  let openclaw_plugin_sdk_agent_runtime = require("openclaw/plugin-sdk/agent-runtime");
38
39
  let openclaw_plugin_sdk_extension_shared = require("openclaw/plugin-sdk/extension-shared");
@@ -45,7 +46,7 @@ let openclaw_plugin_sdk_runtime_group_policy = require("openclaw/plugin-sdk/runt
45
46
  let openclaw_plugin_sdk_dangerous_name_runtime = require("openclaw/plugin-sdk/dangerous-name-runtime");
46
47
  let openclaw_plugin_sdk_account_helpers = require("openclaw/plugin-sdk/account-helpers");
47
48
  let openclaw_plugin_sdk_webhook_ingress = require("openclaw/plugin-sdk/webhook-ingress");
48
- // extensions/msteams/src/feedback-reflection-store.ts
49
+ //#region extensions/msteams/src/feedback-reflection-store.ts
49
50
  const LEARNINGS_NAMESPACE = "feedback-learnings";
50
51
  const MAX_LEARNING_ENTRIES = 1e4;
51
52
  function learningStoreKey(storePath, sessionKey) {
@@ -78,7 +79,8 @@ async function storeSessionLearning(params) {
78
79
  observed = result.current;
79
80
  }
80
81
  }
81
- // extensions/msteams/src/feedback-reflection.ts
82
+ //#endregion
83
+ //#region extensions/msteams/src/feedback-reflection.ts
82
84
  /**
83
85
  * Run a background reflection after negative feedback.
84
86
  * This is designed to be called fire-and-forget (don't await in the invoke handler).
@@ -149,7 +151,8 @@ async function runFeedbackReflection(params) {
149
151
  log.debug?.("failed to send reflection follow-up", { error: require_channel_setup.formatUnknownError(err) });
150
152
  }
151
153
  }
152
- // extensions/msteams/src/adaptive-card-submit.ts
154
+ //#endregion
155
+ //#region extensions/msteams/src/adaptive-card-submit.ts
153
156
  function extractAdaptiveCardSubmittedData(value) {
154
157
  if (!(0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(value)) return value;
155
158
  const action = (0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(value.action) ? value.action : void 0;
@@ -177,7 +180,8 @@ function serializeMSTeamsAdaptiveCardActionValue(value) {
177
180
  return null;
178
181
  }
179
182
  }
180
- // extensions/msteams/src/approval-card-submit.ts
183
+ //#endregion
184
+ //#region extensions/msteams/src/approval-card-submit.ts
181
185
  function isMSTeamsApprovalSubmit(value) {
182
186
  if (!(0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(value)) return false;
183
187
  if (value.openclawAction === "approval") return true;
@@ -261,7 +265,8 @@ async function maybeHandleMSTeamsApprovalCardSubmit(params) {
261
265
  });
262
266
  return true;
263
267
  }
264
- // extensions/msteams/src/monitor-handler/access.ts
268
+ //#endregion
269
+ //#region extensions/msteams/src/monitor-handler/access.ts
265
270
  const msteamsIngressIdentity = {
266
271
  key: "sender-id",
267
272
  authentication: "asserted",
@@ -538,7 +543,8 @@ async function admitMSTeamsMessage(params) {
538
543
  isChannel: params.isChannel
539
544
  };
540
545
  }
541
- // src/channels/mention-gating.ts
546
+ //#endregion
547
+ //#region src/channels/mention-gating.ts
542
548
  function resolveBotThreadMentionPolicy(params) {
543
549
  if (!params.isBotOwnedThread || params.requireMentionInBotThreads === void 0) return {
544
550
  requireMention: params.requireMention,
@@ -549,11 +555,25 @@ function resolveBotThreadMentionPolicy(params) {
549
555
  implicitMentionKinds: params.requireMentionInBotThreads ? params.implicitMentionKinds?.filter((kind) => kind === "native") : params.implicitMentionKinds
550
556
  };
551
557
  }
552
- // extensions/msteams/src/monitor-handler/config.ts
558
+ //#endregion
559
+ //#region extensions/msteams/src/monitor-handler/config.ts
560
+ const allowlistInputs = (config) => [
561
+ config.allowFrom,
562
+ config.groupAllowFrom,
563
+ config.teams,
564
+ config.dangerouslyAllowNameMatching
565
+ ];
553
566
  function createMSTeamsHandlerConfigReader(deps) {
554
567
  const source = deps.accountPolicyCfg ?? deps.cfg;
555
568
  const read = (0, openclaw_plugin_sdk_runtime_config_snapshot.createRuntimeConfigReader)(source);
556
569
  const originallyConfigured = require_resolve_allowlist.listMSTeamsAccountIds(source).includes(deps.accountId);
570
+ const startupInputs = deps.accountPolicyCfg && allowlistInputs(require_resolve_allowlist.resolveMSTeamsAccountConfig(source, deps.accountId));
571
+ const startup = deps.cfg.channels?.msteams;
572
+ const startupAllowlists = {
573
+ allowFrom: startup?.allowFrom,
574
+ groupAllowFrom: startup?.groupAllowFrom,
575
+ teams: startup?.teams
576
+ };
557
577
  let lastSource;
558
578
  let lastProjection = deps.cfg;
559
579
  return () => {
@@ -562,19 +582,22 @@ function createMSTeamsHandlerConfigReader(deps) {
562
582
  lastSource = current;
563
583
  if (current === source && deps.accountPolicyCfg) return lastProjection = deps.cfg;
564
584
  const retired = originallyConfigured && !require_resolve_allowlist.listMSTeamsAccountIds(current).includes(deps.accountId);
565
- if (deps.accountId === "default" && !current.channels?.msteams?.accounts && !retired) return lastProjection = current;
566
585
  const accountConfig = require_resolve_allowlist.resolveMSTeamsAccountConfig(current, deps.accountId);
586
+ const keepStartup = current.channels?.msteams !== void 0 && (0, node_util.isDeepStrictEqual)(allowlistInputs(accountConfig), startupInputs);
587
+ if (deps.accountId === "default" && !current.channels?.msteams?.accounts && !retired && !keepStartup) return lastProjection = current;
567
588
  return lastProjection = require_resolve_allowlist.withAccountScopedMSTeamsConfig({
568
589
  cfg: current,
569
590
  accountId: deps.accountId,
570
591
  accountConfig: {
571
592
  ...accountConfig,
593
+ ...keepStartup ? startupAllowlists : {},
572
594
  ...current.channels?.msteams?.enabled === false || retired ? { enabled: false } : {}
573
595
  }
574
596
  });
575
597
  };
576
598
  }
577
- // extensions/msteams/src/attachments/bot-framework.ts
599
+ //#endregion
600
+ //#region extensions/msteams/src/attachments/bot-framework.ts
578
601
  const BOT_FRAMEWORK_SCOPE = "https://api.botframework.com";
579
602
  /**
580
603
  * Detect Bot Framework personal chat ("a:") and MSA orgid ("8:orgid:") conversation
@@ -739,7 +762,8 @@ async function downloadMSTeamsBotFrameworkAttachments(params) {
739
762
  attachmentCount: unique.length
740
763
  };
741
764
  }
742
- // extensions/msteams/src/attachments/html.ts
765
+ //#endregion
766
+ //#region extensions/msteams/src/attachments/html.ts
743
767
  /**
744
768
  * Extract every `<attachment id="...">` reference from the HTML attachments in
745
769
  * the inbound activity. Returns the complete (non-sliced) list; callers that
@@ -829,7 +853,8 @@ function resolveMSTeamsAdvertisedMedia(attachments) {
829
853
  ...htmlAttachmentIds.map((sourceId) => createAdvertisedMediaFact("document", sourceId))
830
854
  ];
831
855
  }
832
- // extensions/msteams/src/attachments/remote-media.ts
856
+ //#endregion
857
+ //#region extensions/msteams/src/attachments/remote-media.ts
833
858
  /**
834
859
  * Direct save path used when the caller supplies the already-guarded fetch
835
860
  * implementation. This lets Teams-specific auth fallback own the request
@@ -857,7 +882,8 @@ async function downloadAndStoreMSTeamsRemoteMedia(params) {
857
882
  await response.body?.cancel().catch(() => void 0);
858
883
  }
859
884
  }
860
- // extensions/msteams/src/attachments/download.ts
885
+ //#endregion
886
+ //#region extensions/msteams/src/attachments/download.ts
861
887
  function resolveDownloadCandidate(att, graphReferenceToken) {
862
888
  const contentType = require_resolve_allowlist.normalizeContentType(att.contentType);
863
889
  const graphReference = graphReferenceToken !== void 0 && contentType === "reference";
@@ -1088,7 +1114,8 @@ async function downloadMSTeamsAttachments(params) {
1088
1114
  function safeHostForLog(url) {
1089
1115
  return URL.parse(url)?.host ?? "invalid-url";
1090
1116
  }
1091
- // extensions/msteams/src/attachments/graph.ts
1117
+ //#endregion
1118
+ //#region extensions/msteams/src/attachments/graph.ts
1092
1119
  function createGraphHostedContentFact(item) {
1093
1120
  const contentType = require_resolve_allowlist.normalizeContentType(item.contentType);
1094
1121
  return {
@@ -1335,7 +1362,8 @@ async function downloadMSTeamsGraphMedia(params) {
1335
1362
  messageUrl
1336
1363
  };
1337
1364
  }
1338
- // extensions/msteams/src/monitor-handler/inbound-media.ts
1365
+ //#endregion
1366
+ //#region extensions/msteams/src/monitor-handler/inbound-media.ts
1339
1367
  function shouldAttemptMSTeamsGraphMediaFallback(params) {
1340
1368
  const conversationType = params.conversationType.trim().toLowerCase();
1341
1369
  return params.graphMediaFallback === true && (conversationType === "channel" || conversationType === "groupchat") && (params.htmlSummary?.htmlAttachments ?? 0) > 0;
@@ -1476,7 +1504,8 @@ async function resolveMSTeamsInboundMedia(params) {
1476
1504
  });
1477
1505
  return mediaList;
1478
1506
  }
1479
- // extensions/msteams/src/monitor-handler/inbound-content.ts
1507
+ //#endregion
1508
+ //#region extensions/msteams/src/monitor-handler/inbound-content.ts
1480
1509
  async function prepareMSTeamsInboundContent(params) {
1481
1510
  const activity = params.entry.context.activity;
1482
1511
  const mayRecoverGraphMedia = Boolean(params.htmlSummary?.attachmentIds.length) || shouldAttemptMSTeamsGraphMediaFallback({
@@ -1539,7 +1568,8 @@ async function prepareMSTeamsInboundContent(params) {
1539
1568
  inboundMedia
1540
1569
  };
1541
1570
  }
1542
- // extensions/msteams/src/informative-status.ts
1571
+ //#endregion
1572
+ //#region extensions/msteams/src/informative-status.ts
1543
1573
  const INFORMATIVE_MAX_CHARS = 1e3;
1544
1574
  const INFORMATIVE_MAX_BYTES = 1024;
1545
1575
  const ELLIPSIS = "…";
@@ -1562,7 +1592,8 @@ function flattenInformativeStatus(text) {
1562
1592
  }
1563
1593
  return ELLIPSIS + graphemes.slice(start).join("");
1564
1594
  }
1565
- // extensions/msteams/src/reply-stream-controller.ts
1595
+ //#endregion
1596
+ //#region extensions/msteams/src/reply-stream-controller.ts
1566
1597
  function isStreamCancelledError(err) {
1567
1598
  return err instanceof Error && err.name === "StreamCancelledError";
1568
1599
  }
@@ -1862,7 +1893,8 @@ function createTeamsReplyStreamController(params) {
1862
1893
  wasCanceled
1863
1894
  };
1864
1895
  }
1865
- // extensions/msteams/src/reply-dispatcher.ts
1896
+ //#endregion
1897
+ //#region extensions/msteams/src/reply-dispatcher.ts
1866
1898
  function createMSTeamsReplyDispatcher(params) {
1867
1899
  const core = require_runtime.getMSTeamsRuntime();
1868
1900
  const msteamsCfg = require_resolve_allowlist.resolveMSTeamsAccountConfig(params.cfg, params.accountId);
@@ -2177,7 +2209,8 @@ function createMSTeamsReplyDispatcher(params) {
2177
2209
  }
2178
2210
  };
2179
2211
  }
2180
- // extensions/msteams/src/monitor-handler/inbound-dispatch.ts
2212
+ //#endregion
2213
+ //#region extensions/msteams/src/monitor-handler/inbound-dispatch.ts
2181
2214
  async function dispatchMSTeamsInboundTurn(params) {
2182
2215
  const core = require_runtime.getMSTeamsRuntime();
2183
2216
  const { cfg, runtime, app, tokenProvider, textLimit, log, logVerboseMessage, facts, admission, content, routing, thread, replyStyle, timestamp, contextVisibilityMode, conversationHistories, historyLimit } = params;
@@ -2414,7 +2447,8 @@ async function dispatchMSTeamsInboundTurn(params) {
2414
2447
  return { kind: "failed" };
2415
2448
  }
2416
2449
  }
2417
- // extensions/msteams/src/monitor-handler/inbound-facts.ts
2450
+ //#endregion
2451
+ //#region extensions/msteams/src/monitor-handler/inbound-facts.ts
2418
2452
  function extractTextFromHtmlAttachments(attachments) {
2419
2453
  for (const attachment of attachments) {
2420
2454
  const raw = require_resolve_allowlist.extractHtmlFromAttachment(attachment);
@@ -2516,7 +2550,8 @@ function assembleMSTeamsInboundFacts(entry) {
2516
2550
  })
2517
2551
  };
2518
2552
  }
2519
- // extensions/msteams/src/team-identity.ts
2553
+ //#endregion
2554
+ //#region extensions/msteams/src/team-identity.ts
2520
2555
  const teamGroupIdCache = /* @__PURE__ */ new Map();
2521
2556
  const TEAM_GROUP_ID_CACHE_MAX_ENTRIES = 500;
2522
2557
  function cacheTeamGroupId(conversationTeamId, groupId) {
@@ -2543,7 +2578,8 @@ async function resolveTeamGroupId(params) {
2543
2578
  cacheTeamGroupId(params.conversationTeamId, groupId);
2544
2579
  return groupId;
2545
2580
  }
2546
- // extensions/msteams/src/thread-parent-context.ts
2581
+ //#endregion
2582
+ //#region extensions/msteams/src/thread-parent-context.ts
2547
2583
  const PARENT_CACHE_TTL_MS = 3e5;
2548
2584
  const PARENT_CACHE_MAX = 100;
2549
2585
  const parentCache = /* @__PURE__ */ new Map();
@@ -2595,7 +2631,8 @@ function shouldInjectParentContext(sessionKey, parentId) {
2595
2631
  function markParentContextInjected(sessionKey, parentId) {
2596
2632
  touchLru(injectedParents, sessionKey, parentId, INJECTED_MAX);
2597
2633
  }
2598
- // extensions/msteams/src/monitor-handler/thread-context.ts
2634
+ //#endregion
2635
+ //#region extensions/msteams/src/monitor-handler/thread-context.ts
2599
2636
  function prepareMSTeamsThreadRouting(params) {
2600
2637
  const route = require_runtime.getMSTeamsRuntime().channel.routing.resolveAgentRoute({
2601
2638
  cfg: params.cfg,
@@ -2727,7 +2764,8 @@ async function resolveMSTeamsThreadContext(params) {
2727
2764
  threadContext
2728
2765
  };
2729
2766
  }
2730
- // extensions/msteams/src/monitor-handler/message-handler.ts
2767
+ //#endregion
2768
+ //#region extensions/msteams/src/monitor-handler/message-handler.ts
2731
2769
  function createMSTeamsMessageHandler(deps) {
2732
2770
  const { cfg, accountPolicyCfg = cfg, accountId, runtime, appId, app, tokenProvider, textLimit, mediaMaxBytes, conversationStore, pollStore, log } = deps;
2733
2771
  const core = require_runtime.getMSTeamsRuntime();
@@ -3032,7 +3070,8 @@ function createMSTeamsMessageHandler(deps) {
3032
3070
  if (turnAdoptionLifecycle) return { kind: "deferred" };
3033
3071
  };
3034
3072
  }
3035
- // extensions/msteams/src/monitor-handler/reaction-handler.ts
3073
+ //#endregion
3074
+ //#region extensions/msteams/src/monitor-handler/reaction-handler.ts
3036
3075
  function createMSTeamsReactionHandler(deps) {
3037
3076
  const { accountId, log } = deps;
3038
3077
  const readConfig = deps.readConfig ?? createMSTeamsHandlerConfigReader(deps);
@@ -3121,7 +3160,8 @@ function createMSTeamsReactionHandler(deps) {
3121
3160
  }
3122
3161
  };
3123
3162
  }
3124
- // extensions/msteams/src/welcome-card.ts
3163
+ //#endregion
3164
+ //#region extensions/msteams/src/welcome-card.ts
3125
3165
  const DEFAULT_PROMPT_STARTERS = [
3126
3166
  "What can you do?",
3127
3167
  "Summarize my last meeting",
@@ -3157,7 +3197,8 @@ function buildGroupWelcomeText(botName) {
3157
3197
  const name = botName || "OpenClaw";
3158
3198
  return `Hi! I'm ${name}. Mention me with @${name} to get started.`;
3159
3199
  }
3160
- // extensions/msteams/src/monitor-handler.ts
3200
+ //#endregion
3201
+ //#region extensions/msteams/src/monitor-handler.ts
3161
3202
  async function isMSTeamsInvokeAuthorized(params) {
3162
3203
  const { context, deps, invokeKind } = params;
3163
3204
  const cfg = deps.readConfig?.() ?? deps.cfg;
@@ -3275,7 +3316,8 @@ function createMSTeamsActivityHandler(deps) {
3275
3316
  }
3276
3317
  };
3277
3318
  }
3278
- // extensions/msteams/src/feedback-invoke.ts
3319
+ //#endregion
3320
+ //#region extensions/msteams/src/feedback-invoke.ts
3279
3321
  /** Return whether feedback consumed the invoke; the SDK owns its HTTP acknowledgement. */
3280
3322
  async function runMSTeamsFeedbackInvokeHandler(context, deps) {
3281
3323
  const activity = context.activity;
@@ -3386,7 +3428,8 @@ async function runMSTeamsFeedbackInvokeHandler(context, deps) {
3386
3428
  });
3387
3429
  return true;
3388
3430
  }
3389
- // extensions/msteams/src/file-consent-invoke.ts
3431
+ //#endregion
3432
+ //#region extensions/msteams/src/file-consent-invoke.ts
3390
3433
  async function handleMSTeamsFileConsentInvoke(context, log) {
3391
3434
  const expiredUploadMessage = "The file upload request has expired. Please try sending the file again.";
3392
3435
  const activity = context.activity;
@@ -3488,14 +3531,16 @@ async function runMSTeamsFileConsentInvokeHandler(context, log) {
3488
3531
  log.debug?.("file consent handler error", { error: require_channel_setup.formatUnknownError(err) });
3489
3532
  }
3490
3533
  }
3491
- // extensions/msteams/src/monitor-account-stores.ts
3534
+ //#endregion
3535
+ //#region extensions/msteams/src/monitor-account-stores.ts
3492
3536
  function createMSTeamsMonitorStores(accountId, overrides) {
3493
3537
  return {
3494
3538
  conversationStore: overrides.conversationStore ?? require_conversation_store_state.createMSTeamsConversationStoreState({ accountId }),
3495
3539
  pollStore: overrides.pollStore ?? require_conversation_store_state.createMSTeamsPollStoreState({ accountId })
3496
3540
  };
3497
3541
  }
3498
- // extensions/msteams/src/monitor-status.ts
3542
+ //#endregion
3543
+ //#region extensions/msteams/src/monitor-status.ts
3499
3544
  function publishMSTeamsBlocked(statusSink, lastError) {
3500
3545
  statusSink?.((0, openclaw_plugin_sdk_gateway_runtime.channelBlockedPatch)(lastError, { running: true }));
3501
3546
  }
@@ -3505,7 +3550,8 @@ function publishMSTeamsReady(statusSink, now = Date.now()) {
3505
3550
  function publishMSTeamsStopped(statusSink) {
3506
3551
  statusSink?.((0, openclaw_plugin_sdk_gateway_runtime.channelStoppedPatch)());
3507
3552
  }
3508
- // extensions/msteams/src/msteams-ingress.ts
3553
+ //#endregion
3554
+ //#region extensions/msteams/src/msteams-ingress.ts
3509
3555
  const MSTEAMS_INGRESS_VERSION = 1;
3510
3556
  const MSTEAMS_INGRESS_DRAIN_INTERVAL_MS = 500;
3511
3557
  const MSTEAMS_INGRESS_MAX_CONCURRENT_DELIVERIES = 8;
@@ -3634,7 +3680,8 @@ function createMSTeamsIngress(options) {
3634
3680
  }
3635
3681
  };
3636
3682
  }
3637
- // extensions/msteams/src/replay-context.ts
3683
+ //#endregion
3684
+ //#region extensions/msteams/src/replay-context.ts
3638
3685
  function createMSTeamsReplayContext(activity, app, serviceUrlBoundary, accountId) {
3639
3686
  const rawConversationId = activity.conversation?.id ?? "";
3640
3687
  const conversationId = require_resolve_allowlist.normalizeMSTeamsConversationId(rawConversationId);
@@ -3682,7 +3729,8 @@ function createMSTeamsReplayContext(activity, app, serviceUrlBoundary, accountId
3682
3729
  getTeamDetails: (teamId) => app.api.teams.getById(teamId)
3683
3730
  };
3684
3731
  }
3685
- // extensions/msteams/src/sso-token-store.ts
3732
+ //#endregion
3733
+ //#region extensions/msteams/src/sso-token-store.ts
3686
3734
  /**
3687
3735
  * SQLite-backed store for Bot Framework OAuth SSO tokens.
3688
3736
  *
@@ -3716,7 +3764,8 @@ function createMSTeamsSsoTokenStoreFs(params) {
3716
3764
  }
3717
3765
  };
3718
3766
  }
3719
- // extensions/msteams/src/webhook-handler.ts
3767
+ //#endregion
3768
+ //#region extensions/msteams/src/webhook-handler.ts
3720
3769
  /** Keep Express response ownership until the channel's route can be released. */
3721
3770
  function createMSTeamsWebhookHandler(expressApp, warn) {
3722
3771
  const responses = /* @__PURE__ */ new Map();
@@ -3762,7 +3811,8 @@ function createMSTeamsWebhookHandler(expressApp, warn) {
3762
3811
  }
3763
3812
  };
3764
3813
  }
3765
- // extensions/msteams/src/monitor.ts
3814
+ //#endregion
3815
+ //#region extensions/msteams/src/monitor.ts
3766
3816
  async function monitorMSTeamsProvider(opts) {
3767
3817
  const core = require_runtime.getMSTeamsRuntime();
3768
3818
  const log = core.logging.getChildLogger({ name: "msteams" });
@@ -4131,11 +4181,12 @@ async function monitorMSTeamsProvider(opts) {
4131
4181
  throwOnFailure: true,
4132
4182
  log: (message) => log.warn?.(message)
4133
4183
  }));
4134
- if (accountId === openclaw_plugin_sdk_account_id.DEFAULT_ACCOUNT_ID && configuredPath !== "/api/messages") unregisterRoutes.push((0, openclaw_plugin_sdk_webhook_targets.registerPluginHttpRoute)({
4184
+ const legacyMessagesOwner = require_channel.resolveMSTeamsLegacyMessagesOwner(accountPolicyCfg);
4185
+ if (accountId === openclaw_plugin_sdk_account_id.DEFAULT_ACCOUNT_ID && !legacyMessagesOwner) unregisterRoutes.push((0, openclaw_plugin_sdk_webhook_targets.registerPluginHttpRoute)({
4135
4186
  path: "/api/messages",
4136
4187
  auth: "plugin",
4137
4188
  pluginId: "msteams",
4138
- source: "msteams-webhook-alias",
4189
+ source: "msteams-webhook",
4139
4190
  accountId,
4140
4191
  handler: webhook.handler,
4141
4192
  log: (message) => log.warn?.(message)
@@ -4220,4 +4271,5 @@ function adaptSdkContext(ctx, app) {
4220
4271
  stream: sdkCtx.stream
4221
4272
  });
4222
4273
  }
4274
+ //#endregion
4223
4275
  exports.monitorMSTeamsProvider = monitorMSTeamsProvider;