@openclaw/msteams 2026.9.8 → 2026.10.1-beta.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 (25) hide show
  1. package/dist/.setup/{adapter.runtime-BiWeMKXE.cjs → adapter.runtime-D0HYByze.cjs} +9 -7
  2. package/dist/.setup/{approval-handler.runtime-D1s7UR3U.cjs → approval-handler.runtime-C-RJ3wXc.cjs} +3 -3
  3. package/dist/.setup/{channel-ByzS7QJ0.cjs → channel-BFhXodl2.cjs} +61 -75
  4. package/dist/.setup/{channel.runtime-Baz8XDFs.cjs → channel.runtime-D9jrw2SN.cjs} +22 -46
  5. package/dist/.setup/{channel.setup-DL8lcWT_.cjs → channel.setup-ss0TO-ap.cjs} +30 -36
  6. package/dist/.setup/{conversation-store-state-B7JuyZTm.cjs → conversation-store-state-f7V8CVNy.cjs} +62 -128
  7. package/dist/.setup/{monitor-BJ7IyH4y.cjs → monitor-DfSPCRkk.cjs} +71 -171
  8. package/dist/.setup/{oauth-DQjOnJ4l.cjs → oauth-CYxMYIOQ.cjs} +1 -1
  9. package/dist/.setup/{reaction-types-CQ4oSUe7.cjs → reaction-types-B-GEv57k.cjs} +1 -1
  10. package/dist/.setup/{resolve-allowlist-Pl_NQFYH.cjs → resolve-allowlist-Ct9yxQUw.cjs} +16 -134
  11. package/dist/.setup/{send-VUM7Sryb.cjs → send-7VV1iCai.cjs} +24 -70
  12. package/dist/.setup/{setup-plugin-api-Dyf8kF-l.cjs → setup-plugin-api-B0OFG32J.cjs} +1 -1
  13. package/dist/.setup/{thread-session--rw3BTal.cjs → thread-session-ClI-lSyG.cjs} +1 -1
  14. package/dist/.setup/token-config-DOt3XwVa.cjs +139 -0
  15. package/dist/api.cjs +2 -2
  16. package/dist/channel-plugin-api.cjs +1 -1
  17. package/dist/directory-contract-api.cjs +3 -2
  18. package/dist/doctor-backup-resources.cjs +21 -0
  19. package/dist/doctor-contract-api.cjs +37 -19
  20. package/dist/qa-runner-api.cjs +1 -1
  21. package/dist/runtime-api.cjs +0 -20
  22. package/dist/setup-entry.cjs +1 -1
  23. package/dist/setup-plugin-api.cjs +1 -1
  24. package/package.json +4 -4
  25. package/dist/.setup/delegated-state-u-ywZyZT.cjs +0 -70
@@ -2,10 +2,10 @@ const require_rolldown_runtime = require("./rolldown-runtime-BloeesfJ.cjs");
2
2
  let node_url = require("node:url");
3
3
  let openclaw_plugin_sdk_ssrf_runtime = require("openclaw/plugin-sdk/ssrf-runtime");
4
4
  let openclaw_plugin_sdk_error_runtime = require("openclaw/plugin-sdk/error-runtime");
5
- let node_fs_promises = require("node:fs/promises");
6
- node_fs_promises = require_rolldown_runtime.__toESM(node_fs_promises, 1);
7
5
  let node_path = require("node:path");
8
6
  node_path = require_rolldown_runtime.__toESM(node_path, 1);
7
+ let node_fs_promises = require("node:fs/promises");
8
+ node_fs_promises = require_rolldown_runtime.__toESM(node_fs_promises, 1);
9
9
  let node_crypto = require("node:crypto");
10
10
  let node_timers_promises = require("node:timers/promises");
11
11
  let node_events = require("node:events");
@@ -217,11 +217,13 @@ async function createMSTeamsQaTransportAdapter(context) {
217
217
  ...input.replyToId ? { replyToId: input.replyToId } : {},
218
218
  channelData: {
219
219
  tenant: { id: TENANT_ID },
220
- team: {
221
- id: TEAM_ID,
222
- aadGroupId: TEAM_AAD_GROUP_ID
223
- },
224
- channel: { id: conversationId }
220
+ ...input.conversation.kind === "channel" ? {
221
+ team: {
222
+ id: TEAM_ID,
223
+ aadGroupId: TEAM_AAD_GROUP_ID
224
+ },
225
+ channel: { id: conversationId }
226
+ } : {}
225
227
  }
226
228
  };
227
229
  if (!webhookUrl) throw new Error("Microsoft Teams QA Gateway URL has not been configured");
@@ -1,7 +1,7 @@
1
- const require_resolve_allowlist = require("./resolve-allowlist-Pl_NQFYH.cjs");
2
- const require_channel = require("./channel-ByzS7QJ0.cjs");
1
+ const require_resolve_allowlist = require("./resolve-allowlist-Ct9yxQUw.cjs");
2
+ const require_channel = require("./channel-BFhXodl2.cjs");
3
3
  const require_approval_card = require("./approval-card-DWPDItvq.cjs");
4
- const require_send = require("./send-VUM7Sryb.cjs");
4
+ const require_send = require("./send-7VV1iCai.cjs");
5
5
  let openclaw_plugin_sdk_account_id = require("openclaw/plugin-sdk/account-id");
6
6
  let openclaw_plugin_sdk_approval_native_runtime = require("openclaw/plugin-sdk/approval-native-runtime");
7
7
  let openclaw_plugin_sdk_approval_handler_runtime = require("openclaw/plugin-sdk/approval-handler-runtime");
@@ -1,9 +1,9 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-BloeesfJ.cjs");
2
2
  require("../runtime-api.cjs");
3
- const require_resolve_allowlist = require("./resolve-allowlist-Pl_NQFYH.cjs");
3
+ const require_resolve_allowlist = require("./resolve-allowlist-Ct9yxQUw.cjs");
4
4
  const require_directory_contract_api = require("../directory-contract-api.cjs");
5
- const require_thread_session = require("./thread-session--rw3BTal.cjs");
6
- const require_channel_setup = require("./channel.setup-DL8lcWT_.cjs");
5
+ const require_thread_session = require("./thread-session-ClI-lSyG.cjs");
6
+ const require_channel_setup = require("./channel.setup-ss0TO-ap.cjs");
7
7
  let openclaw_plugin_sdk_approval_handler_adapter_runtime = require("openclaw/plugin-sdk/approval-handler-adapter-runtime");
8
8
  let openclaw_plugin_sdk_channel_actions = require("openclaw/plugin-sdk/channel-actions");
9
9
  let openclaw_plugin_sdk_channel_core = require("openclaw/plugin-sdk/channel-core");
@@ -16,15 +16,16 @@ let openclaw_plugin_sdk_interactive_runtime = require("openclaw/plugin-sdk/inter
16
16
  let openclaw_plugin_sdk_lazy_runtime = require("openclaw/plugin-sdk/lazy-runtime");
17
17
  let openclaw_plugin_sdk_status_helpers = require("openclaw/plugin-sdk/status-helpers");
18
18
  let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
19
+ let openclaw_plugin_sdk_tool_results = require("openclaw/plugin-sdk/tool-results");
19
20
  let typebox = require("typebox");
20
21
  let openclaw_plugin_sdk_account_id = require("openclaw/plugin-sdk/account-id");
22
+ let openclaw_plugin_sdk_text_chunking = require("openclaw/plugin-sdk/text-chunking");
21
23
  let openclaw_plugin_sdk_reply_reference = require("openclaw/plugin-sdk/reply-reference");
22
24
  let openclaw_plugin_sdk_approval_delivery_runtime = require("openclaw/plugin-sdk/approval-delivery-runtime");
23
25
  let openclaw_plugin_sdk_approval_native_runtime = require("openclaw/plugin-sdk/approval-native-runtime");
24
26
  let openclaw_plugin_sdk_channel_targets = require("openclaw/plugin-sdk/channel-targets");
25
27
  let openclaw_plugin_sdk_dangerous_name_runtime = require("openclaw/plugin-sdk/dangerous-name-runtime");
26
28
  let openclaw_plugin_sdk_runtime_group_policy = require("openclaw/plugin-sdk/runtime-group-policy");
27
- let openclaw_plugin_sdk_text_chunking = require("openclaw/plugin-sdk/text-chunking");
28
29
  let openclaw_plugin_sdk_channel_status = require("openclaw/plugin-sdk/channel-status");
29
30
  //#region extensions/msteams/src/action-params.ts
30
31
  /** Text and upload-source aliases shared by Teams message actions. */
@@ -44,13 +45,7 @@ function resolveActionUploadFilePath(params) {
44
45
  //#endregion
45
46
  //#region extensions/msteams/src/action-results.ts
46
47
  function jsonActionResult(data, details = data) {
47
- return {
48
- content: [{
49
- type: "text",
50
- text: JSON.stringify(data)
51
- }],
52
- details
53
- };
48
+ return (0, openclaw_plugin_sdk_tool_results.textResult)(JSON.stringify(data), details);
54
49
  }
55
50
  function jsonMSTeamsActionResult(action, data = {}) {
56
51
  return jsonActionResult({
@@ -80,11 +75,7 @@ function jsonMSTeamsConversationResult(conversationId) {
80
75
  function actionError(message) {
81
76
  return {
82
77
  isError: true,
83
- content: [{
84
- type: "text",
85
- text: message
86
- }],
87
- details: { error: message }
78
+ ...(0, openclaw_plugin_sdk_tool_results.textResult)(message, { error: message })
88
79
  };
89
80
  }
90
81
  //#endregion
@@ -247,16 +238,11 @@ function resolveMSTeamsReplyPolicy(params) {
247
238
  }
248
239
  //#endregion
249
240
  //#region extensions/msteams/src/action-threading.ts
250
- function stripConversationPrefix(raw) {
251
- const trimmed = raw.trim();
252
- if (/^conversation:/i.test(trimmed)) return trimmed.slice(13).trim();
253
- return trimmed;
254
- }
255
241
  /** Normalize Teams conversation targets for equality (strips `conversation:` and `;messageid=`). */
256
242
  function normalizeMSTeamsThreadingTarget(raw) {
257
243
  const value = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(raw);
258
244
  if (!value) return;
259
- return require_resolve_allowlist.normalizeMSTeamsConversationId(stripConversationPrefix(value));
245
+ return require_resolve_allowlist.normalizeMSTeamsConversationId((0, openclaw_plugin_sdk_channel_core.stripChannelTargetPrefix)(value, "conversation"));
260
246
  }
261
247
  function extractMSTeamsResultConversationId(value) {
262
248
  if (!(0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(value)) return;
@@ -272,11 +258,11 @@ function extractMSTeamsResultConversationId(value) {
272
258
  }
273
259
  }
274
260
  /** Recover the actual Teams conversation resolved by a successful tool send. */
275
- function extractMSTeamsToolSendResult(result, _send) {
261
+ function extractMSTeamsToolSendResult(result) {
276
262
  const details = (0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(result) && (0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(result.details) ? result.details : void 0;
277
263
  const conversationId = extractMSTeamsResultConversationId(details && (0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(details.result) ? details.result : void 0);
278
264
  if (!conversationId) return null;
279
- const normalizedConversationId = require_resolve_allowlist.normalizeMSTeamsConversationId(stripConversationPrefix(conversationId));
265
+ const normalizedConversationId = require_resolve_allowlist.normalizeMSTeamsConversationId((0, openclaw_plugin_sdk_channel_core.stripChannelTargetPrefix)(conversationId, "conversation"));
280
266
  return normalizedConversationId ? { to: `conversation:${normalizedConversationId}` } : null;
281
267
  }
282
268
  function msteamsContextTargetsMatch(target, context) {
@@ -393,7 +379,7 @@ const msTeamsLazyApprovalNativeRuntime = (0, openclaw_plugin_sdk_approval_handle
393
379
  request
394
380
  }),
395
381
  load: async () => {
396
- const { msTeamsApprovalNativeRuntime } = await Promise.resolve().then(() => require("./approval-handler.runtime-D1s7UR3U.cjs"));
382
+ const { msTeamsApprovalNativeRuntime } = await Promise.resolve().then(() => require("./approval-handler.runtime-C-RJ3wXc.cjs"));
397
383
  return msTeamsApprovalNativeRuntime;
398
384
  }
399
385
  });
@@ -580,8 +566,7 @@ require_rolldown_runtime.__reExport(gateway_config_runtime_exports, require("ope
580
566
  //#endregion
581
567
  //#region extensions/msteams/src/webhook-route.ts
582
568
  function resolveMSTeamsLegacyWebhook(config) {
583
- const listener = config?.legacyWebhook;
584
- return listener === false ? void 0 : listener ?? { port: 3978 };
569
+ return config?.legacyWebhook || void 0;
585
570
  }
586
571
  function resolveMSTeamsWebhookPathIssue({ cfg, env }) {
587
572
  const channel = cfg.channels?.msteams;
@@ -591,7 +576,7 @@ function resolveMSTeamsWebhookPathIssue({ cfg, env }) {
591
576
  const probe = classifyGatewayProbePath(pathname);
592
577
  const reason = isProtectedPluginRoutePathFromContext(resolvePluginRoutePathContext(pathname)) ? "requires Gateway authentication on the main HTTP listener" : probe !== "namespace" && probe !== "outside" ? "is reserved for Gateway probes" : /[:*{}\\]/.test(path) ? "uses Express pattern syntax that requires the compatibility listener" : void 0;
593
578
  if (!reason) return;
594
- return `Microsoft Teams webhook path ${path} ${reason}. Set channels.msteams.webhook.path to /api/messages and update the Azure Bot messaging endpoint or reverse-proxy upstream to Gateway port ${(0, gateway_config_runtime_exports.resolveGatewayPort)(cfg, env)}/api/messages; verify delivery before setting channels.msteams.legacyWebhook=false.` + (legacy ? ` Compatibility port ${legacy.port} continues serving the current path.` : " The compatibility listener is disabled, so this path cannot receive Teams callbacks.");
579
+ return `Microsoft Teams webhook path ${path} ${reason}. Set channels.msteams.webhook.path to /api/messages and update the Azure Bot messaging endpoint or reverse-proxy upstream to Gateway port ${(0, gateway_config_runtime_exports.resolveGatewayPort)(cfg, env)}/api/messages; verify delivery before removing channels.msteams.legacyWebhook.` + (legacy ? ` Compatibility port ${legacy.port} continues serving the current path.` : " The compatibility listener is disabled, so this path cannot receive Teams callbacks.");
595
580
  }
596
581
  //#endregion
597
582
  //#region extensions/msteams/src/doctor.ts
@@ -626,7 +611,7 @@ function runMSTeamsWebhookDoctorSequence({ cfg, env }) {
626
611
  return {
627
612
  changeNotes: [],
628
613
  warningNotes: [],
629
- infoNotes: [legacy ? `Microsoft Teams: compatibility port ${legacy.port} continues forwarding to Gateway route ${path}. To use only the Gateway listener, update the Azure Bot messaging endpoint or reverse-proxy upstream to Gateway port ${port}${path}, verify delivery, then set channels.msteams.legacyWebhook=false to close the old port.` : `Microsoft Teams webhooks use Gateway port ${port}${path}; the compatibility listener is disabled by channels.msteams.legacyWebhook=false. Point the Azure Bot messaging endpoint or reverse-proxy upstream to this route.`]
614
+ infoNotes: [legacy ? `Microsoft Teams: compatibility port ${legacy.port} continues forwarding to Gateway route ${path}. To use only the Gateway listener, update the Azure Bot messaging endpoint or reverse-proxy upstream to Gateway port ${port}${path}, verify delivery, then remove the channels.msteams.legacyWebhook pin to close the old port.` : `Microsoft Teams webhooks use Gateway port ${port}${path}; no compatibility listener is configured. Point the Azure Bot messaging endpoint or reverse-proxy upstream to this route.`]
630
615
  };
631
616
  }
632
617
  const msteamsDoctor = {
@@ -746,6 +731,27 @@ function buildMSTeamsPresentationCard(params) {
746
731
  };
747
732
  }
748
733
  //#endregion
734
+ //#region extensions/msteams/src/outbound-config.ts
735
+ const MSTEAMS_TEXT_CHUNK_LIMIT = 4e3;
736
+ function resolveMSTeamsEffectiveTextChunkLimit(configuredLimit) {
737
+ return typeof configuredLimit === "number" && configuredLimit > 0 ? Math.min(configuredLimit, MSTEAMS_TEXT_CHUNK_LIMIT) : MSTEAMS_TEXT_CHUNK_LIMIT;
738
+ }
739
+ const msteamsOutboundConfig = {
740
+ deliveryMode: "direct",
741
+ chunker: openclaw_plugin_sdk_text_chunking.chunkTextForOutbound,
742
+ chunkerMode: "markdown",
743
+ textChunkLimit: MSTEAMS_TEXT_CHUNK_LIMIT,
744
+ resolveEffectiveTextChunkLimit: ({ fallbackLimit }) => resolveMSTeamsEffectiveTextChunkLimit(fallbackLimit),
745
+ pollMaxOptions: 12,
746
+ deliveryCapabilities: { durableFinal: {
747
+ text: true,
748
+ media: true,
749
+ payload: true,
750
+ messageSendingHooks: true
751
+ } },
752
+ presentationCapabilities: MSTEAMS_PRESENTATION_CAPABILITIES
753
+ };
754
+ //#endregion
749
755
  //#region extensions/msteams/src/read-policy.ts
750
756
  function normalizeTarget(raw) {
751
757
  return raw ? require_resolve_allowlist.normalizeMSTeamsMessagingTarget(raw) ?? "" : "";
@@ -915,7 +921,9 @@ async function assertMSTeamsReadTargetAllowed(params) {
915
921
  });
916
922
  const directOperator = params.ctx.conversationReadOrigin === "direct-operator";
917
923
  const currentChatType = params.ctx.toolContext?.currentChatType;
918
- const allowedTarget = directOperator ? isChannel ? resolveMSTeamsReadGroupPolicy(params.cfg) !== "disabled" ? await resolveStableChannelTarget(params.cfg, target) : void 0 : isDm ? await resolveDirectDmTarget(params.cfg, target) : isChat && resolveMSTeamsReadGroupPolicy(params.cfg) !== "disabled" && params.cfg.channels?.msteams?.dmPolicy !== "disabled" ? target : void 0 : current ? isChannel ? resolveMSTeamsReadGroupPolicy(params.cfg) !== "disabled" ? target : void 0 : isDm ? params.cfg.channels?.msteams?.dmPolicy !== "disabled" ? target : void 0 : currentChatType === "direct" ? params.cfg.channels?.msteams?.dmPolicy !== "disabled" ? target : void 0 : currentChatType === "group" || currentChatType === "channel" ? resolveMSTeamsReadGroupPolicy(params.cfg) !== "disabled" ? target : void 0 : resolveMSTeamsReadGroupPolicy(params.cfg) !== "disabled" && params.cfg.channels?.msteams?.dmPolicy !== "disabled" ? target : void 0 : isChannel ? await resolveAllowedChannelTarget(params.cfg, target) : isDm ? await resolveAllowedDmTarget(params.cfg, target) : isChat ? bothUnknownScopesAllowed(params.cfg) ? target : void 0 : false;
924
+ const groupEnabled = resolveMSTeamsReadGroupPolicy(params.cfg) !== "disabled";
925
+ const dmEnabled = params.cfg.channels?.msteams?.dmPolicy !== "disabled";
926
+ const allowedTarget = directOperator ? isChannel ? groupEnabled ? await resolveStableChannelTarget(params.cfg, target) : void 0 : isDm ? await resolveDirectDmTarget(params.cfg, target) : isChat && groupEnabled && dmEnabled ? target : void 0 : current ? (isChannel ? groupEnabled : isDm || currentChatType === "direct" ? dmEnabled : currentChatType === "group" || currentChatType === "channel" ? groupEnabled : groupEnabled && dmEnabled) ? target : void 0 : isChannel ? await resolveAllowedChannelTarget(params.cfg, target) : isDm ? await resolveAllowedDmTarget(params.cfg, target) : isChat ? bothUnknownScopesAllowed(params.cfg) ? target : void 0 : false;
919
927
  if (!allowedTarget) throw new openclaw_plugin_sdk_channel_actions.ToolAuthorizationError("Microsoft Teams read target is not allowed.");
920
928
  return allowedTarget;
921
929
  }
@@ -1039,7 +1047,7 @@ const collectMSTeamsSecurityFindings = openclaw_plugin_sdk_channel_policy.create
1039
1047
  severity: "warn",
1040
1048
  title: "MS Teams security warning"
1041
1049
  });
1042
- const loadMSTeamsChannelRuntime = (0, openclaw_plugin_sdk_lazy_runtime.createLazyRuntimeNamedExport)(() => Promise.resolve().then(() => require("./channel.runtime-Baz8XDFs.cjs")), "msTeamsChannelRuntime");
1050
+ const loadMSTeamsChannelRuntime = (0, openclaw_plugin_sdk_lazy_runtime.createLazyRuntimeNamedExport)(() => Promise.resolve().then(() => require("./channel.runtime-D9jrw2SN.cjs")), "msTeamsChannelRuntime");
1043
1051
  const MSTEAMS_REACTION_TYPES = [
1044
1052
  "like",
1045
1053
  "heart",
@@ -1066,9 +1074,6 @@ function resolveGraphActionTarget(params, currentChannelId, currentGraphChannelI
1066
1074
  if (currentGraphTarget) return currentGraphTarget;
1067
1075
  return currentChatType === "channel" ? "" : currentChannelTarget ?? "";
1068
1076
  }
1069
- function resolveCurrentGraphActionTarget(toolContext) {
1070
- return (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(toolContext?.currentGraphChannelId) ?? (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(toolContext?.currentMessagingTarget);
1071
- }
1072
1077
  function resolveMSTeamsActionTarget(params) {
1073
1078
  return params.graphOnly ? resolveGraphActionTarget(params.toolParams, params.currentChannelId, params.currentGraphChannelId, params.currentChatType) : resolveActionTarget(params.toolParams, params.currentChannelId);
1074
1079
  }
@@ -1133,25 +1138,13 @@ function describeMSTeamsMessageTool({ cfg }) {
1133
1138
  };
1134
1139
  }
1135
1140
  const msteamsChannelOutbound = {
1136
- deliveryMode: "direct",
1137
- chunker: openclaw_plugin_sdk_text_chunking.chunkTextForOutbound,
1138
- chunkerMode: "markdown",
1139
- textChunkLimit: 4e3,
1140
- resolveEffectiveTextChunkLimit: ({ fallbackLimit }) => typeof fallbackLimit === "number" && fallbackLimit > 0 ? Math.min(fallbackLimit, 4e3) : 4e3,
1141
- pollMaxOptions: 12,
1141
+ ...msteamsOutboundConfig,
1142
1142
  shouldSuppressLocalPayloadPrompt: ({ cfg, accountId, payload, hint }) => shouldSuppressLocalMSTeamsExecApprovalPrompt({
1143
1143
  cfg,
1144
1144
  accountId,
1145
1145
  payload,
1146
1146
  hint
1147
1147
  }),
1148
- deliveryCapabilities: { durableFinal: {
1149
- text: true,
1150
- media: true,
1151
- payload: true,
1152
- messageSendingHooks: true
1153
- } },
1154
- presentationCapabilities: MSTEAMS_PRESENTATION_CAPABILITIES,
1155
1148
  ...(0, openclaw_plugin_sdk_channel_outbound.createRuntimeOutboundDelegates)({
1156
1149
  getRuntime: loadMSTeamsChannelRuntime,
1157
1150
  renderPresentation: { resolve: (runtime) => runtime.msteamsOutbound.renderPresentation },
@@ -1217,12 +1210,6 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
1217
1210
  name: void 0,
1218
1211
  note: void 0
1219
1212
  }));
1220
- const markPendingLookupFailed = (pending) => {
1221
- pending.forEach(({ index }) => {
1222
- const entry = results[index];
1223
- if (entry) entry.note = "lookup failed";
1224
- });
1225
- };
1226
1213
  const resolvePending = async (pending, resolveEntries, applyResolvedEntry) => {
1227
1214
  if (pending.length === 0) return;
1228
1215
  try {
@@ -1233,7 +1220,7 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
1233
1220
  });
1234
1221
  } catch (err) {
1235
1222
  runtime.error?.(`msteams resolve failed: ${String(err)}`);
1236
- markPendingLookupFailed(pending);
1223
+ for (const { index } of pending) results[index].note = "lookup failed";
1237
1224
  }
1238
1225
  };
1239
1226
  if (kind === "user") {
@@ -1251,7 +1238,6 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
1251
1238
  return;
1252
1239
  }
1253
1240
  pending.push({
1254
- input: entry.input,
1255
1241
  query: cleaned,
1256
1242
  index
1257
1243
  });
@@ -1288,7 +1274,6 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
1288
1274
  }
1289
1275
  const query = parsed.channel ? `${parsed.team}/${parsed.channel}` : parsed.team;
1290
1276
  pending.push({
1291
- input: entry.input,
1292
1277
  query,
1293
1278
  index
1294
1279
  });
@@ -1327,7 +1312,7 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
1327
1312
  "channel-list"
1328
1313
  ],
1329
1314
  describeMessageTool: describeMSTeamsMessageTool,
1330
- extractToolSendResult: ({ result, send }) => extractMSTeamsToolSendResult(result, send),
1315
+ extractToolSendResult: ({ result }) => extractMSTeamsToolSendResult(result),
1331
1316
  requiresTrustedRequesterSender: ({ action, toolContext }) => (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(toolContext?.currentChannelProvider)?.toLowerCase() === "msteams" && MSTEAMS_GROUP_MANAGEMENT_ACTIONS.has(action),
1332
1317
  handleAction: withMSTeamsGraphMutationCurrentness(async (ctx) => {
1333
1318
  if (MSTEAMS_GROUP_MANAGEMENT_ACTIONS.has(ctx.action)) {
@@ -1427,7 +1412,7 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
1427
1412
  to: resolveActionTarget(ctx.params) || (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(ctx.params.channelId)
1428
1413
  } : ctx.params,
1429
1414
  currentChannelId: ctx.toolContext?.currentChannelId,
1430
- currentGraphChannelId: resolveCurrentGraphActionTarget(ctx.toolContext),
1415
+ currentGraphChannelId: (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(ctx.toolContext?.currentGraphChannelId) ?? (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(ctx.toolContext?.currentMessagingTarget),
1431
1416
  currentChatType: ctx.toolContext?.currentChatType,
1432
1417
  currentMessageId: ctx.toolContext?.currentMessageId,
1433
1418
  graphOnly: true
@@ -1493,14 +1478,10 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
1493
1478
  const remove = typeof ctx.params.remove === "boolean" ? ctx.params.remove : false;
1494
1479
  if (!emoji) return {
1495
1480
  isError: true,
1496
- content: [{
1497
- type: "text",
1498
- text: `React requires an emoji (reaction type). Valid types: ${MSTEAMS_REACTION_TYPES.join(", ")}.`
1499
- }],
1500
- details: {
1481
+ ...(0, openclaw_plugin_sdk_tool_results.textResult)(`React requires an emoji (reaction type). Valid types: ${MSTEAMS_REACTION_TYPES.join(", ")}.`, {
1501
1482
  error: "React requires an emoji (reaction type).",
1502
1483
  validTypes: [...MSTEAMS_REACTION_TYPES]
1503
- }
1484
+ })
1504
1485
  };
1505
1486
  const to = await authorizeActionTarget(target.to);
1506
1487
  const runtime = await loadMSTeamsChannelRuntime();
@@ -1634,11 +1615,10 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
1634
1615
  buildChannelSummary: ({ snapshot }) => (0, openclaw_plugin_sdk_channel_status.buildProbeChannelStatusSummary)(snapshot, { port: snapshot.port ?? null }),
1635
1616
  probeAccount: async ({ cfg }) => await (await loadMSTeamsChannelRuntime()).probeMSTeams(cfg.channels?.msteams),
1636
1617
  formatCapabilitiesProbe: ({ probe }) => {
1637
- const teamsProbe = probe;
1638
1618
  const lines = [];
1639
- const appId = typeof teamsProbe?.appId === "string" ? teamsProbe.appId.trim() : "";
1619
+ const appId = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(probe?.appId);
1640
1620
  if (appId) lines.push({ text: `App: ${appId}` });
1641
- const graph = teamsProbe?.graph;
1621
+ const graph = probe?.graph;
1642
1622
  if (graph) {
1643
1623
  const roles = Array.isArray(graph.roles) ? (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeStringEntries)(graph.roles) : [];
1644
1624
  const scopes = Array.isArray(graph.scopes) ? (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeStringEntries)(graph.scopes) : [];
@@ -1653,7 +1633,7 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
1653
1633
  else if (roles.length > 0 || scopes.length > 0) {
1654
1634
  if (roles.length > 0) lines.push({ text: `Graph roles: ${roles.map(formatPermission).join(", ")}` });
1655
1635
  if (scopes.length > 0) lines.push({ text: `Graph scopes: ${scopes.map(formatPermission).join(", ")}` });
1656
- } else if (graph.ok) lines.push({ text: "Graph: ok" });
1636
+ } else lines.push({ text: "Graph: ok" });
1657
1637
  }
1658
1638
  return lines;
1659
1639
  },
@@ -1665,7 +1645,7 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
1665
1645
  })
1666
1646
  }),
1667
1647
  gateway: { startAccount: async (ctx) => {
1668
- const { monitorMSTeamsProvider } = await Promise.resolve().then(() => require("./monitor-BJ7IyH4y.cjs"));
1648
+ const { monitorMSTeamsProvider } = await Promise.resolve().then(() => require("./monitor-DfSPCRkk.cjs"));
1669
1649
  const webhookPath = ctx.cfg.channels?.msteams?.webhook?.path || "/api/messages";
1670
1650
  const statusSink = (0, openclaw_plugin_sdk_channel_outbound.createAccountStatusSink)({
1671
1651
  accountId: ctx.accountId,
@@ -1731,12 +1711,6 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
1731
1711
  outbound: msteamsChannelOutbound
1732
1712
  });
1733
1713
  //#endregion
1734
- Object.defineProperty(exports, "MSTEAMS_PRESENTATION_CAPABILITIES", {
1735
- enumerable: true,
1736
- get: function() {
1737
- return MSTEAMS_PRESENTATION_CAPABILITIES;
1738
- }
1739
- });
1740
1714
  Object.defineProperty(exports, "buildMSTeamsPresentationCard", {
1741
1715
  enumerable: true,
1742
1716
  get: function() {
@@ -1755,12 +1729,24 @@ Object.defineProperty(exports, "isMSTeamsNativeApprovalClientEnabled", {
1755
1729
  return isMSTeamsNativeApprovalClientEnabled;
1756
1730
  }
1757
1731
  });
1732
+ Object.defineProperty(exports, "msteamsOutboundConfig", {
1733
+ enumerable: true,
1734
+ get: function() {
1735
+ return msteamsOutboundConfig;
1736
+ }
1737
+ });
1758
1738
  Object.defineProperty(exports, "msteamsPlugin", {
1759
1739
  enumerable: true,
1760
1740
  get: function() {
1761
1741
  return msteamsPlugin;
1762
1742
  }
1763
1743
  });
1744
+ Object.defineProperty(exports, "resolveMSTeamsEffectiveTextChunkLimit", {
1745
+ enumerable: true,
1746
+ get: function() {
1747
+ return resolveMSTeamsEffectiveTextChunkLimit;
1748
+ }
1749
+ });
1764
1750
  Object.defineProperty(exports, "resolveMSTeamsLegacyWebhook", {
1765
1751
  enumerable: true,
1766
1752
  get: function() {
@@ -1,18 +1,18 @@
1
1
  require("../runtime-api.cjs");
2
- const require_resolve_allowlist = require("./resolve-allowlist-Pl_NQFYH.cjs");
3
- const require_delegated_state = require("./delegated-state-u-ywZyZT.cjs");
4
- const require_channel = require("./channel-ByzS7QJ0.cjs");
5
- const require_channel_setup = require("./channel.setup-DL8lcWT_.cjs");
6
- const require_conversation_store_state = require("./conversation-store-state-B7JuyZTm.cjs");
7
- const require_send = require("./send-VUM7Sryb.cjs");
8
- const require_reaction_types = require("./reaction-types-CQ4oSUe7.cjs");
2
+ const require_resolve_allowlist = require("./resolve-allowlist-Ct9yxQUw.cjs");
3
+ const require_token_config = require("./token-config-DOt3XwVa.cjs");
4
+ const require_channel = require("./channel-BFhXodl2.cjs");
5
+ const require_channel_setup = require("./channel.setup-ss0TO-ap.cjs");
6
+ const require_conversation_store_state = require("./conversation-store-state-f7V8CVNy.cjs");
7
+ const require_send = require("./send-7VV1iCai.cjs");
8
+ const require_reaction_types = require("./reaction-types-B-GEv57k.cjs");
9
9
  let openclaw_plugin_sdk_channel_outbound = require("openclaw/plugin-sdk/channel-outbound");
10
10
  let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
11
11
  let openclaw_plugin_sdk_reply_payload = require("openclaw/plugin-sdk/reply-payload");
12
12
  let openclaw_plugin_sdk_number_runtime = require("openclaw/plugin-sdk/number-runtime");
13
13
  let openclaw_plugin_sdk_channel_send_result = require("openclaw/plugin-sdk/channel-send-result");
14
- let openclaw_plugin_sdk_text_chunking = require("openclaw/plugin-sdk/text-chunking");
15
14
  let openclaw_plugin_sdk_string_normalization_runtime = require("openclaw/plugin-sdk/string-normalization-runtime");
15
+ let openclaw_plugin_sdk_text_chunking = require("openclaw/plugin-sdk/text-chunking");
16
16
  //#region extensions/msteams/src/directory-live.ts
17
17
  async function listMSTeamsDirectoryPeersLive(params) {
18
18
  const query = require_resolve_allowlist.normalizeQuery(params.query);
@@ -327,14 +327,9 @@ async function findMSTeamsConversationMember(params) {
327
327
  }
328
328
  //#endregion
329
329
  //#region extensions/msteams/src/graph-group-management.ts
330
- function normalizeConversationMemberRole(role) {
331
- const normalized = role?.trim().toLowerCase() ?? "";
332
- if (!normalized) return "member";
333
- if (normalized === "member" || normalized === "owner") return normalized;
334
- throw new Error("MS Teams participant role must be \"member\" or \"owner\".");
335
- }
336
330
  function resolveConversationMemberRoles(role, kind) {
337
- const normalized = normalizeConversationMemberRole(role);
331
+ const normalized = role?.trim().toLowerCase() || "member";
332
+ if (normalized !== "member" && normalized !== "owner") throw new Error("MS Teams participant role must be \"member\" or \"owner\".");
338
333
  if (kind === "chat") return ["owner"];
339
334
  return normalized === "owner" ? ["owner"] : [];
340
335
  }
@@ -403,7 +398,7 @@ function normalizeUserId(value) {
403
398
  return value?.replace(/^(msteams|teams|user):/i, "").trim().toLowerCase() ?? "";
404
399
  }
405
400
  async function findStandardChannelMember(params) {
406
- const conversation = resolveConversationPath(await resolveGraphConversationId(params.to));
401
+ const { conversation } = params;
407
402
  if (conversation.kind !== "channel" || !conversation.teamId) return;
408
403
  if ((await require_resolve_allowlist.fetchGraphJson({
409
404
  token: params.token,
@@ -420,9 +415,6 @@ async function findStandardChannelMember(params) {
420
415
  if (result.truncated) throw new Error("Microsoft Teams team member pagination limit exceeded");
421
416
  return result.found;
422
417
  }
423
- /**
424
- * Fetch a user profile from Microsoft Graph by user ID.
425
- */
426
418
  async function getMemberInfoMSTeams(params) {
427
419
  if (normalizeUserId(params.userId) === normalizeUserId(params.currentRequesterId) && resolveConversationPath(params.to).kind === "chat") return { user: {
428
420
  id: params.currentRequesterId ?? void 0,
@@ -433,9 +425,10 @@ async function getMemberInfoMSTeams(params) {
433
425
  officeLocation: void 0,
434
426
  roles: []
435
427
  } };
436
- const member = resolveConversationPath(await resolveGraphConversationId(params.to)).kind === "channel" ? await findStandardChannelMember({
428
+ const conversation = resolveConversationPath(await resolveGraphConversationId(params.to));
429
+ const member = conversation.kind === "channel" ? await findStandardChannelMember({
437
430
  token: await require_resolve_allowlist.resolveGraphToken(params.cfg),
438
- to: params.to,
431
+ conversation,
439
432
  userId: params.userId
440
433
  }) : void 0;
441
434
  if (!member?.userId) throw new Error(`User ${params.userId} is not a member of this conversation`);
@@ -486,10 +479,6 @@ async function getChannelInfoMSTeams(params) {
486
479
  }
487
480
  //#endregion
488
481
  //#region extensions/msteams/src/outbound.ts
489
- const MSTEAMS_TEXT_CHUNK_LIMIT = 4e3;
490
- function resolveMSTeamsEffectiveTextChunkLimit(configuredLimit) {
491
- return typeof configuredLimit === "number" && configuredLimit > 0 ? Math.min(configuredLimit, MSTEAMS_TEXT_CHUNK_LIMIT) : MSTEAMS_TEXT_CHUNK_LIMIT;
492
- }
493
482
  function toMSTeamsOutboundResult(result) {
494
483
  const { conversationId, ...delivery } = result;
495
484
  return {
@@ -540,19 +529,7 @@ async function sendMSTeamsOutbound(ctx, includeMedia) {
540
529
  }), ctx.onDeliveryResult));
541
530
  }
542
531
  const msteamsOutbound = {
543
- deliveryMode: "direct",
544
- chunker: openclaw_plugin_sdk_text_chunking.chunkTextForOutbound,
545
- chunkerMode: "markdown",
546
- textChunkLimit: MSTEAMS_TEXT_CHUNK_LIMIT,
547
- resolveEffectiveTextChunkLimit: ({ fallbackLimit }) => resolveMSTeamsEffectiveTextChunkLimit(fallbackLimit),
548
- pollMaxOptions: 12,
549
- deliveryCapabilities: { durableFinal: {
550
- text: true,
551
- media: true,
552
- payload: true,
553
- messageSendingHooks: true
554
- } },
555
- presentationCapabilities: require_channel.MSTEAMS_PRESENTATION_CAPABILITIES,
532
+ ...require_channel.msteamsOutboundConfig,
556
533
  renderPresentation: ({ payload, presentation }) => {
557
534
  if (payload.mediaUrl || payload.mediaUrls?.length) return null;
558
535
  const card = require_channel.buildMSTeamsPresentationCard({
@@ -577,8 +554,9 @@ const msteamsOutbound = {
577
554
  onPlatformSendDispatch
578
555
  };
579
556
  const deliveryTarget = resolveMSTeamsThreadTarget(to, threadId);
580
- const presentationCard = (0, openclaw_plugin_sdk_string_coerce_runtime.asOptionalRecord)(payload.channelData?.msteams)?.presentationCard;
581
- if (presentationCard && typeof presentationCard === "object" && !Array.isArray(presentationCard)) {
557
+ const msteamsData = (0, openclaw_plugin_sdk_string_coerce_runtime.asOptionalRecord)(payload.channelData?.msteams);
558
+ const presentationCard = (0, openclaw_plugin_sdk_string_coerce_runtime.asOptionalRecord)(msteamsData?.presentationCard);
559
+ if (presentationCard) {
582
560
  const result = await sendWithDeliveryResults((report) => require_send.sendAdaptiveCardMSTeams({
583
561
  cfg,
584
562
  to: deliveryTarget,
@@ -616,7 +594,7 @@ const msteamsOutbound = {
616
594
  cfg,
617
595
  deps
618
596
  });
619
- const chunks = (0, openclaw_plugin_sdk_reply_payload.resolveTextChunksWithFallback)(text, (0, openclaw_plugin_sdk_text_chunking.chunkTextForOutbound)(text, resolveMSTeamsEffectiveTextChunkLimit(cfg.channels?.msteams?.textChunkLimit)));
597
+ const chunks = (0, openclaw_plugin_sdk_reply_payload.resolveTextChunksWithFallback)(text, (0, openclaw_plugin_sdk_text_chunking.chunkTextForOutbound)(text, require_channel.resolveMSTeamsEffectiveTextChunkLimit(cfg.channels?.msteams?.textChunkLimit)));
620
598
  let result;
621
599
  for (const chunk of chunks) result = await sendWithDeliveryResults((report) => send(deliveryTarget, chunk, {
622
600
  ...handoff,
@@ -676,12 +654,10 @@ function readStringArray(value) {
676
654
  return out.length > 0 ? out : void 0;
677
655
  }
678
656
  function readScopes(value) {
679
- if (typeof value !== "string") return;
680
- const out = (0, openclaw_plugin_sdk_string_normalization_runtime.normalizeStringEntries)(value.split(/\s+/));
681
- return out.length > 0 ? out : void 0;
657
+ return typeof value === "string" ? readStringArray(value.split(/\s+/)) : void 0;
682
658
  }
683
659
  async function probeMSTeams(cfg) {
684
- const creds = require_resolve_allowlist.resolveMSTeamsCredentials(cfg);
660
+ const creds = require_token_config.resolveMSTeamsCredentials(cfg);
685
661
  if (!creds) return {
686
662
  ok: false,
687
663
  error: "missing credentials (appId, appPassword, tenantId)"
@@ -713,7 +689,7 @@ async function probeMSTeams(cfg) {
713
689
  }
714
690
  let delegatedAuth;
715
691
  if (cfg?.delegatedAuth?.enabled) try {
716
- const tokens = await require_delegated_state.loadMSTeamsDelegatedTokens();
692
+ const tokens = await require_token_config.loadMSTeamsDelegatedTokens();
717
693
  if (tokens) {
718
694
  const isExpired = !(0, openclaw_plugin_sdk_number_runtime.isFutureDateTimestampMs)(tokens.expiresAt);
719
695
  delegatedAuth = {