@openclaw/msteams 2026.8.1-beta.3 → 2026.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,28 +1,31 @@
1
1
  require("./runtime-api.cjs");
2
- const require_resolve_allowlist = require("./resolve-allowlist-CIfWUwuc.cjs");
2
+ const require_resolve_allowlist = require("./resolve-allowlist-CWbvAW4v.cjs");
3
3
  const require_directory_contract_api = require("./directory-contract-api.cjs");
4
- const require_channel_setup = require("./channel.setup-mOFtsfYz.cjs");
4
+ const require_thread_session = require("./thread-session-Br3R0ovy.cjs");
5
+ const require_channel_setup = require("./channel.setup-CKb8aKCV.cjs");
6
+ let openclaw_plugin_sdk_approval_handler_adapter_runtime = require("openclaw/plugin-sdk/approval-handler-adapter-runtime");
5
7
  let openclaw_plugin_sdk_channel_core = require("openclaw/plugin-sdk/channel-core");
6
8
  let openclaw_plugin_sdk_channel_outbound = require("openclaw/plugin-sdk/channel-outbound");
7
9
  let openclaw_plugin_sdk_channel_pairing = require("openclaw/plugin-sdk/channel-pairing");
8
10
  let openclaw_plugin_sdk_channel_policy = require("openclaw/plugin-sdk/channel-policy");
11
+ let openclaw_plugin_sdk_channel_runtime_context = require("openclaw/plugin-sdk/channel-runtime-context");
9
12
  let openclaw_plugin_sdk_directory_runtime = require("openclaw/plugin-sdk/directory-runtime");
10
13
  let openclaw_plugin_sdk_interactive_runtime = require("openclaw/plugin-sdk/interactive-runtime");
11
14
  let openclaw_plugin_sdk_lazy_runtime = require("openclaw/plugin-sdk/lazy-runtime");
12
15
  let openclaw_plugin_sdk_status_helpers = require("openclaw/plugin-sdk/status-helpers");
13
16
  let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
14
17
  let typebox = require("typebox");
18
+ let openclaw_plugin_sdk_account_id = require("openclaw/plugin-sdk/account-id");
15
19
  let openclaw_plugin_sdk_reply_reference = require("openclaw/plugin-sdk/reply-reference");
16
- let openclaw_plugin_sdk_approval_auth_runtime = require("openclaw/plugin-sdk/approval-auth-runtime");
20
+ let openclaw_plugin_sdk_approval_delivery_runtime = require("openclaw/plugin-sdk/approval-delivery-runtime");
21
+ let openclaw_plugin_sdk_approval_native_runtime = require("openclaw/plugin-sdk/approval-native-runtime");
17
22
  let openclaw_plugin_sdk_channel_actions = require("openclaw/plugin-sdk/channel-actions");
18
- let openclaw_plugin_sdk_routing = require("openclaw/plugin-sdk/routing");
19
23
  let openclaw_plugin_sdk_channel_targets = require("openclaw/plugin-sdk/channel-targets");
20
24
  let openclaw_plugin_sdk_allow_from = require("openclaw/plugin-sdk/allow-from");
21
25
  let openclaw_plugin_sdk_dangerous_name_runtime = require("openclaw/plugin-sdk/dangerous-name-runtime");
22
26
  let openclaw_plugin_sdk_runtime_group_policy = require("openclaw/plugin-sdk/runtime-group-policy");
23
27
  let openclaw_plugin_sdk_text_chunking = require("openclaw/plugin-sdk/text-chunking");
24
28
  let openclaw_plugin_sdk_channel_status = require("openclaw/plugin-sdk/channel-status");
25
- let openclaw_plugin_sdk_account_id = require("openclaw/plugin-sdk/account-id");
26
29
  //#region extensions/msteams/src/policy.ts
27
30
  const teamScopeKey = (teamKey) => (0, openclaw_plugin_sdk_channel_policy.scopeKey)(["team", teamKey]);
28
31
  const channelScopeKey = (teamKey, channelKey) => (0, openclaw_plugin_sdk_channel_policy.scopeKey)(["team", teamKey], ["channel", channelKey]);
@@ -249,32 +252,123 @@ function resolveMSTeamsAutoThreadId(params) {
249
252
  return context.currentThreadTs;
250
253
  }
251
254
  //#endregion
252
- //#region extensions/msteams/src/approval-auth.ts
253
- const MSTEAMS_ID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
254
- function normalizeMSTeamsApproverId(value) {
255
- const normalized = require_resolve_allowlist.normalizeMSTeamsMessagingTarget(String(value));
256
- const id = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalLowercaseString)(normalized?.startsWith("user:") ? normalized.slice(5) : normalized);
257
- return id && MSTEAMS_ID_RE.test(id) ? id : void 0;
258
- }
259
- function resolveMSTeamsChannelConfig(cfg) {
260
- return cfg.channels?.msteams;
255
+ //#region extensions/msteams/src/approval-native.ts
256
+ function isMSTeamsApprovalTransportEnabled(params) {
257
+ if (params.accountId && (0, openclaw_plugin_sdk_account_id.normalizeAccountId)(params.accountId) !== openclaw_plugin_sdk_account_id.DEFAULT_ACCOUNT_ID) return false;
258
+ const account = require_channel_setup.resolveMSTeamsAccount(params.cfg);
259
+ return account.enabled && account.configured && account.tokenStatus === "available";
261
260
  }
262
- const msTeamsApprovalAuth = (0, openclaw_plugin_sdk_approval_auth_runtime.createChannelApprovalAuth)({
263
- channelLabel: "Microsoft Teams",
264
- resolveInputs: ({ cfg }) => {
265
- const channel = resolveMSTeamsChannelConfig(cfg);
266
- return {
267
- allowFrom: channel?.allowFrom,
268
- defaultTo: channel?.defaultTo
269
- };
261
+ const msTeamsMessagingTargetResolvers = (0, openclaw_plugin_sdk_approval_native_runtime.createNativeApprovalMessagingTargetResolvers)({
262
+ channel: "msteams",
263
+ normalizeTo: require_resolve_allowlist.normalizeMSTeamsMessagingTarget
264
+ });
265
+ const msTeamsApprovalTargetResolvers = {
266
+ ...msTeamsMessagingTargetResolvers,
267
+ resolveTurnSourceTarget: (request) => {
268
+ const target = msTeamsMessagingTargetResolvers.resolveTurnSourceTarget(request);
269
+ return target ? {
270
+ ...target,
271
+ threadId: request.request.turnSourceThreadId ?? null
272
+ } : null;
270
273
  },
271
- normalizeApprover: normalizeMSTeamsApproverId,
272
- normalizeSenderId: (value) => {
273
- const trimmed = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalLowercaseString)(value);
274
- if (!trimmed) return;
275
- return MSTEAMS_ID_RE.test(trimmed) ? trimmed : void 0;
274
+ resolveSessionTarget: (sessionTarget) => {
275
+ const target = msTeamsMessagingTargetResolvers.resolveSessionTarget(sessionTarget);
276
+ return target ? {
277
+ ...target,
278
+ threadId: sessionTarget.threadId ?? null
279
+ } : null;
276
280
  }
277
- }).approvalAuth;
281
+ };
282
+ const msTeamsApprovalRouteGates = (0, openclaw_plugin_sdk_approval_native_runtime.createNativeApprovalChannelRouteGates)({
283
+ channel: "msteams",
284
+ defaultForwardingMode: "session",
285
+ isTransportEnabled: isMSTeamsApprovalTransportEnabled,
286
+ listAccountIds: require_channel_setup.msteamsConfigAdapter.listAccountIds,
287
+ resolveDefaultAccountId: () => openclaw_plugin_sdk_account_id.DEFAULT_ACCOUNT_ID,
288
+ normalizeForwardTarget: msTeamsApprovalTargetResolvers.normalizeForwardTarget,
289
+ resolveTurnSourceTarget: msTeamsApprovalTargetResolvers.resolveTurnSourceTarget
290
+ });
291
+ function isMSTeamsNativeApprovalClientEnabled(params) {
292
+ return msTeamsApprovalRouteGates.canAnyApprovalPotentiallyRouteToChannel({
293
+ ...params,
294
+ nativeSessionOnly: true
295
+ }) && require_thread_session.getMSTeamsApprovalApprovers(params).length > 0;
296
+ }
297
+ function shouldHandleMSTeamsNativeApprovalRequest(params) {
298
+ return msTeamsApprovalRouteGates.shouldHandleApprovalRequest(params) && require_thread_session.getMSTeamsApprovalApprovers(params).length > 0 && Boolean(msTeamsApprovalTargetResolvers.resolveTurnSourceTarget(params.request));
299
+ }
300
+ function shouldSuppressLocalMSTeamsExecApprovalPrompt(params) {
301
+ return (0, openclaw_plugin_sdk_approval_native_runtime.shouldSuppressLocalNativeExecApprovalPrompt)({
302
+ ...params,
303
+ isNativeDeliveryEnabled: isMSTeamsNativeApprovalClientEnabled
304
+ });
305
+ }
306
+ const resolveMSTeamsOriginTarget = (0, openclaw_plugin_sdk_approval_native_runtime.createChannelNativeOriginTargetResolver)({
307
+ channel: "msteams",
308
+ shouldHandleRequest: shouldHandleMSTeamsNativeApprovalRequest,
309
+ resolveTurnSourceTarget: msTeamsApprovalTargetResolvers.resolveTurnSourceTarget,
310
+ resolveSessionTarget: msTeamsApprovalTargetResolvers.resolveSessionTarget,
311
+ normalizeTarget: msTeamsApprovalTargetResolvers.normalizeTarget
312
+ });
313
+ const msTeamsLazyApprovalNativeRuntime = (0, openclaw_plugin_sdk_approval_handler_adapter_runtime.createLazyChannelApprovalNativeRuntimeAdapter)({
314
+ eventKinds: ["exec", "plugin"],
315
+ isConfigured: ({ cfg, accountId }) => isMSTeamsNativeApprovalClientEnabled({
316
+ cfg,
317
+ accountId
318
+ }),
319
+ shouldHandle: ({ cfg, accountId, approvalKind, request }) => shouldHandleMSTeamsNativeApprovalRequest({
320
+ cfg,
321
+ accountId,
322
+ approvalKind,
323
+ request
324
+ }),
325
+ load: async () => {
326
+ const { msTeamsApprovalNativeRuntime } = await Promise.resolve().then(() => require("./approval-handler.runtime-B-ZA6Vjp.cjs"));
327
+ return msTeamsApprovalNativeRuntime;
328
+ }
329
+ });
330
+ const resolveMSTeamsApproverDmTargets = (0, openclaw_plugin_sdk_approval_native_runtime.createChannelApproverDmTargetResolver)({
331
+ shouldHandleRequest: shouldHandleMSTeamsNativeApprovalRequest,
332
+ resolveApprovers: require_thread_session.getMSTeamsApprovalApprovers,
333
+ mapApprover: (approver, params) => ({
334
+ to: `user:${approver}`,
335
+ accountId: (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(params.accountId)
336
+ })
337
+ });
338
+ const msTeamsApprovalCapability = {
339
+ ...(0, openclaw_plugin_sdk_approval_delivery_runtime.createApproverRestrictedNativeApprovalCapability)({
340
+ channel: "msteams",
341
+ channelLabel: "Microsoft Teams",
342
+ describeExecApprovalSetup: () => "Approve it from the Web UI or terminal UI for now. Microsoft Teams supports native approvals when the bot is configured. Configure `channels.msteams.allowFrom` or `channels.msteams.defaultTo` with Microsoft Entra object ID approvers.",
343
+ listAccountIds: require_channel_setup.msteamsConfigAdapter.listAccountIds,
344
+ hasApprovers: ({ cfg, accountId }) => require_thread_session.getMSTeamsApprovalApprovers({
345
+ cfg,
346
+ accountId
347
+ }).length > 0,
348
+ isExecAuthorizedSender: ({ cfg, accountId, senderId }) => require_thread_session.msTeamsApprovalAuth.authorizeActorAction?.({
349
+ cfg,
350
+ accountId,
351
+ senderId,
352
+ action: "approve",
353
+ approvalKind: "exec"
354
+ })?.authorized ?? false,
355
+ isPluginAuthorizedSender: ({ cfg, accountId, senderId }) => require_thread_session.msTeamsApprovalAuth.authorizeActorAction?.({
356
+ cfg,
357
+ accountId,
358
+ senderId,
359
+ action: "approve",
360
+ approvalKind: "plugin"
361
+ })?.authorized ?? false,
362
+ isNativeDeliveryEnabled: isMSTeamsNativeApprovalClientEnabled,
363
+ resolveNativeDeliveryMode: () => "channel",
364
+ requireMatchingTurnSourceChannel: true,
365
+ resolveSuppressionAccountId: ({ target, request }) => (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(target.accountId) ?? (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(request.request.turnSourceAccountId),
366
+ resolveOriginTarget: resolveMSTeamsOriginTarget,
367
+ resolveApproverDmTargets: resolveMSTeamsApproverDmTargets,
368
+ nativeRuntime: msTeamsLazyApprovalNativeRuntime
369
+ }),
370
+ authorizeActorAction: (params) => require_thread_session.msTeamsApprovalAuth.authorizeActorAction?.(params)
371
+ };
278
372
  //#endregion
279
373
  //#region extensions/msteams/src/doctor.ts
280
374
  const isMSTeamsMutableAllowEntry = (0, openclaw_plugin_sdk_channel_policy.buildMutableAllowEntryDetector)({
@@ -601,18 +695,6 @@ async function assertMSTeamsTeamEnumerationAllowed(params) {
601
695
  return stableTeamId;
602
696
  }
603
697
  //#endregion
604
- //#region extensions/msteams/src/monitor-handler/thread-session.ts
605
- const TRAILING_THREAD_SUFFIX = /(?::thread:[^:]+)+$/;
606
- function resolveMSTeamsRouteSessionKey(params) {
607
- const channelThreadId = params.isChannel ? params.conversationMessageId ?? params.replyToId ?? void 0 : void 0;
608
- const cleanBase = params.baseSessionKey.replace(TRAILING_THREAD_SUFFIX, "");
609
- return (0, openclaw_plugin_sdk_routing.resolveThreadSessionKeys)({
610
- baseSessionKey: cleanBase,
611
- threadId: channelThreadId,
612
- parentSessionKey: channelThreadId ? cleanBase : void 0
613
- }).sessionKey;
614
- }
615
- //#endregion
616
698
  //#region extensions/msteams/src/session-route.ts
617
699
  function inferMSTeamsTargetChatType(raw) {
618
700
  const target = (0, openclaw_plugin_sdk_channel_core.stripChannelTargetPrefix)(raw, "msteams", "teams");
@@ -656,7 +738,7 @@ function resolveMSTeamsOutboundSessionRoute(params) {
656
738
  });
657
739
  return isChannel ? {
658
740
  ...route,
659
- sessionKey: resolveMSTeamsRouteSessionKey({
741
+ sessionKey: require_thread_session.resolveMSTeamsRouteSessionKey({
660
742
  baseSessionKey: route.baseSessionKey,
661
743
  isChannel: true,
662
744
  conversationMessageId: channelThreadId
@@ -691,7 +773,7 @@ const collectMSTeamsSecurityFindings = openclaw_plugin_sdk_channel_policy.create
691
773
  severity: "critical",
692
774
  title: "MS Teams security warning"
693
775
  });
694
- const loadMSTeamsChannelRuntime = (0, openclaw_plugin_sdk_lazy_runtime.createLazyRuntimeNamedExport)(() => Promise.resolve().then(() => require("./channel.runtime-Bkzj8jZ0.cjs")), "msTeamsChannelRuntime");
776
+ const loadMSTeamsChannelRuntime = (0, openclaw_plugin_sdk_lazy_runtime.createLazyRuntimeNamedExport)(() => Promise.resolve().then(() => require("./channel.runtime-D3qqruU3.cjs")), "msTeamsChannelRuntime");
695
777
  function jsonActionResult(data) {
696
778
  return {
697
779
  content: [{
@@ -862,6 +944,12 @@ const msteamsChannelOutbound = {
862
944
  textChunkLimit: 4e3,
863
945
  resolveEffectiveTextChunkLimit: ({ fallbackLimit }) => typeof fallbackLimit === "number" && fallbackLimit > 0 ? Math.min(fallbackLimit, 4e3) : 4e3,
864
946
  pollMaxOptions: 12,
947
+ shouldSuppressLocalPayloadPrompt: ({ cfg, accountId, payload, hint }) => shouldSuppressLocalMSTeamsExecApprovalPrompt({
948
+ cfg,
949
+ accountId,
950
+ payload,
951
+ hint
952
+ }),
865
953
  deliveryCapabilities: { durableFinal: {
866
954
  text: true,
867
955
  media: true,
@@ -904,7 +992,7 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
904
992
  } },
905
993
  agentPrompt: { messageToolHints: () => ["- Adaptive Cards supported. Use `action=send` with `card={type,version,body}` to send rich cards.", "- MSTeams targeting: omit `target` to reply to the current conversation (auto-inferred). Explicit targets: `user:ID` or `user:Display Name` (requires Graph API) for DMs, `conversation:19:...@thread.tacv2` for groups/channels. Prefer IDs over display names for speed."] },
906
994
  groups: { resolveToolPolicy: resolveMSTeamsGroupToolPolicy },
907
- approvalCapability: msTeamsApprovalAuth,
995
+ approvalCapability: msTeamsApprovalCapability,
908
996
  doctor: {
909
997
  dmAllowFromMode: "topOnly",
910
998
  groupModel: "hybrid",
@@ -1428,7 +1516,7 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
1428
1516
  })
1429
1517
  }),
1430
1518
  gateway: { startAccount: async (ctx) => {
1431
- const { monitorMSTeamsProvider } = await Promise.resolve().then(() => require("./src-C127-DcQ.cjs"));
1519
+ const { monitorMSTeamsProvider } = await Promise.resolve().then(() => require("./src-BGhvpEOP.cjs"));
1432
1520
  const port = ctx.cfg.channels?.msteams?.webhook?.port ?? 3978;
1433
1521
  const statusSink = (0, openclaw_plugin_sdk_channel_outbound.createAccountStatusSink)({
1434
1522
  accountId: ctx.accountId,
@@ -1436,6 +1524,17 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
1436
1524
  });
1437
1525
  statusSink({ port });
1438
1526
  ctx.log?.info(`starting provider (port ${port})`);
1527
+ if (isMSTeamsNativeApprovalClientEnabled({
1528
+ cfg: ctx.cfg,
1529
+ accountId: ctx.accountId
1530
+ })) (0, openclaw_plugin_sdk_channel_runtime_context.registerChannelRuntimeContext)({
1531
+ channelRuntime: ctx.channelRuntime,
1532
+ channelId: "msteams",
1533
+ accountId: ctx.accountId,
1534
+ capability: openclaw_plugin_sdk_approval_handler_adapter_runtime.CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY,
1535
+ context: {},
1536
+ abortSignal: ctx.abortSignal
1537
+ });
1439
1538
  return monitorMSTeamsProvider({
1440
1539
  cfg: ctx.cfg,
1441
1540
  runtime: ctx.runtime,
@@ -1496,6 +1595,18 @@ Object.defineProperty(exports, "buildMSTeamsPresentationCard", {
1496
1595
  return buildMSTeamsPresentationCard;
1497
1596
  }
1498
1597
  });
1598
+ Object.defineProperty(exports, "inferMSTeamsTargetChatType", {
1599
+ enumerable: true,
1600
+ get: function() {
1601
+ return inferMSTeamsTargetChatType;
1602
+ }
1603
+ });
1604
+ Object.defineProperty(exports, "isMSTeamsNativeApprovalClientEnabled", {
1605
+ enumerable: true,
1606
+ get: function() {
1607
+ return isMSTeamsNativeApprovalClientEnabled;
1608
+ }
1609
+ });
1499
1610
  Object.defineProperty(exports, "msteamsPlugin", {
1500
1611
  enumerable: true,
1501
1612
  get: function() {
@@ -1520,9 +1631,9 @@ Object.defineProperty(exports, "resolveMSTeamsRouteConfig", {
1520
1631
  return resolveMSTeamsRouteConfig;
1521
1632
  }
1522
1633
  });
1523
- Object.defineProperty(exports, "resolveMSTeamsRouteSessionKey", {
1634
+ Object.defineProperty(exports, "shouldHandleMSTeamsNativeApprovalRequest", {
1524
1635
  enumerable: true,
1525
1636
  get: function() {
1526
- return resolveMSTeamsRouteSessionKey;
1637
+ return shouldHandleMSTeamsNativeApprovalRequest;
1527
1638
  }
1528
1639
  });
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_config_schema = require("./config-schema-C4CszdDi.cjs");
2
+ const require_config_schema = require("./config-schema-MyN2lamA.cjs");
3
3
  exports.MSTeamsChannelConfigSchema = require_config_schema.MSTeamsChannelConfigSchema;
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_channel = require("./channel-KpWENcgK.cjs");
2
+ const require_channel = require("./channel-ChmCvkuA.cjs");
3
3
  exports.msteamsPlugin = require_channel.msteamsPlugin;