@openclaw/msteams 2026.10.10 → 2026.11.5-beta.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.
Files changed (32) hide show
  1. package/dist/.setup/{adapter.runtime-BMvpm7sS.cjs → adapter.runtime-UOD_H_ph.cjs} +20 -23
  2. package/dist/.setup/{approval-card-Bo8kHYbj.cjs → approval-card-CD5q0Nla.cjs} +5 -9
  3. package/dist/.setup/{approval-handler.runtime-BS3avHFu.cjs → approval-handler.runtime-DbPxvynk.cjs} +4 -4
  4. package/dist/.setup/{channel-CdCSk3Rg.cjs → channel-DQrXOfhf.cjs} +24 -224
  5. package/dist/.setup/{channel.runtime--ZjTYgkY.cjs → channel.runtime-Du4GPMES.cjs} +65 -106
  6. package/dist/.setup/{channel.setup-nSTtK77J.cjs → channel.setup--7ko_Kxv.cjs} +161 -262
  7. package/dist/.setup/{config-schema-Bm15lF-j.cjs → config-schema-BEXDIOC-.cjs} +120 -123
  8. package/dist/.setup/{conversation-store-state-NJU9osd-.cjs → conversation-store-state-AVgRyNE9.cjs} +411 -598
  9. package/dist/.setup/{delegated-state-CbMd3rIh.cjs → delegated-state-DhIHahf1.cjs} +68 -6
  10. package/dist/.setup/{monitor-BxLDs5fk.cjs → monitor-CXjIKz7o.cjs} +1883 -2284
  11. package/dist/.setup/{oauth-B-Y5pNM4.cjs → oauth-BWG6qWCd.cjs} +10 -20
  12. package/dist/.setup/presentation-CaLawc5j.cjs +211 -0
  13. package/dist/.setup/{reaction-types-BaL1EVBS.cjs → reaction-types-DOzN5oTl.cjs} +1 -1
  14. package/dist/.setup/{resolve-allowlist-CqNzS9bZ.cjs → resolve-allowlist-Drj1jaq0.cjs} +213 -90
  15. package/dist/.setup/{secret-contract-api-BOzdWSn9.cjs → secret-contract-api-DFqDvc_a.cjs} +4 -6
  16. package/dist/.setup/{secret-contract-api-5aH1Fl_c.cjs → secret-contract-api-YGHrfAT0.cjs} +1 -1
  17. package/dist/.setup/{send-BXjI3ufq.cjs → send-BRUztzVJ.cjs} +86 -182
  18. package/dist/.setup/{setup-plugin-api-lPpin6Gg.cjs → setup-plugin-api-BHEfter5.cjs} +1 -1
  19. package/dist/.setup/{thread-session-DZMoCsSR.cjs → thread-session-BUUV1zk_.cjs} +4 -6
  20. package/dist/.setup/{token-config-DTZ00Ibq.cjs → token-config-7K6UbNCo.cjs} +0 -2
  21. package/dist/.source-module-urls/7e43ee3ae4faab430a47269c8217f8d99ec60ecd85233f40e81d03efeb543068.json +1 -1
  22. package/dist/api.cjs +2 -2
  23. package/dist/channel-config-api.cjs +1 -1
  24. package/dist/channel-plugin-api.cjs +1 -1
  25. package/dist/directory-contract-api.cjs +1 -1
  26. package/dist/doctor-contract-api.cjs +6 -13
  27. package/dist/qa-runner-api.cjs +1 -1
  28. package/dist/secret-contract-api.cjs +1 -1
  29. package/dist/setup-entry.cjs +2 -2
  30. package/dist/setup-plugin-api.cjs +1 -1
  31. package/openclaw.plugin.json +0 -30
  32. package/package.json +11 -11
@@ -10,18 +10,14 @@ node_fs_promises = require_rolldown_runtime.__toESM(node_fs_promises, 1);
10
10
  let node_timers_promises = require("node:timers/promises");
11
11
  let node_events = require("node:events");
12
12
  let node_http = require("node:http");
13
+ let node_stream_consumers = require("node:stream/consumers");
14
+ let openclaw_plugin_sdk_http_response_runtime = require("openclaw/plugin-sdk/http-response-runtime");
13
15
  // extensions/msteams/src/qa/bot-framework-server.ts
14
16
  const AMBIGUOUS_GATEWAY_TIMEOUT_MARKER = "QA-MSTEAMS-AMBIGUOUS-504";
15
17
  async function readJson(request) {
16
- const chunks = [];
17
- for await (const chunk of request) chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
18
- const body = Buffer.concat(chunks).toString("utf8");
18
+ const body = (await (0, node_stream_consumers.buffer)(request)).toString("utf8");
19
19
  return body ? JSON.parse(body) : {};
20
20
  }
21
- function sendJson(response, status, body) {
22
- response.writeHead(status, { "content-type": "application/json" });
23
- response.end(JSON.stringify(body));
24
- }
25
21
  function parseConversationPath(pathname) {
26
22
  const match = /\/v3\/conversations\/([^/]+)\/activities(?:\/[^/]+)?$/u.exec(pathname);
27
23
  if (!match) return;
@@ -38,12 +34,12 @@ async function startMSTeamsQaBotFrameworkServer(options) {
38
34
  const server = (0, node_http.createServer)((request, response) => {
39
35
  (async () => {
40
36
  if (request.headers["x-openclaw-msteams-qa-nonce"] !== options.nonce || request.headers.authorization !== `Bearer ${options.botToken}`) {
41
- sendJson(response, 401, { error: "unauthorized" });
37
+ (0, openclaw_plugin_sdk_http_response_runtime.writeJsonWithoutCharset)(response, 401, { error: "unauthorized" });
42
38
  return;
43
39
  }
44
40
  const route = parseConversationPath(new URL(request.url ?? "/", "http://127.0.0.1").pathname);
45
41
  if (request.method !== "POST" || !route) {
46
- sendJson(response, 404, { error: "not found" });
42
+ (0, openclaw_plugin_sdk_http_response_runtime.writeJsonWithoutCharset)(response, 404, { error: "not found" });
47
43
  return;
48
44
  }
49
45
  const activity = await readJson(request);
@@ -55,9 +51,9 @@ async function startMSTeamsQaBotFrameworkServer(options) {
55
51
  ...route.threadId ? { threadId: route.threadId } : {}
56
52
  });
57
53
  const acceptedButTimedOut = activity.type === "message" && typeof activity.text === "string" && activity.text.includes(AMBIGUOUS_GATEWAY_TIMEOUT_MARKER);
58
- sendJson(response, acceptedButTimedOut ? 504 : 200, acceptedButTimedOut ? { error: "gateway timeout after acceptance" } : { id: activityId });
54
+ (0, openclaw_plugin_sdk_http_response_runtime.writeJsonWithoutCharset)(response, acceptedButTimedOut ? 504 : 200, acceptedButTimedOut ? { error: "gateway timeout after acceptance" } : { id: activityId });
59
55
  })().catch((error) => {
60
- sendJson(response, 500, { error: (0, openclaw_plugin_sdk_error_runtime.coerceErrorMessage)(error) });
56
+ (0, openclaw_plugin_sdk_http_response_runtime.writeJsonWithoutCharset)(response, 500, { error: (0, openclaw_plugin_sdk_error_runtime.coerceErrorMessage)(error) });
61
57
  });
62
58
  });
63
59
  server.listen(0, "127.0.0.1");
@@ -139,15 +135,15 @@ async function createMSTeamsQaTransportAdapter(context) {
139
135
  const bootstrapPath = node_path.default.join(context.outputDir, ".msteams-private-qa-bootstrap.mjs");
140
136
  const busByNativeMessageId = /* @__PURE__ */ new Map();
141
137
  const nativeByBusMessageId = /* @__PURE__ */ new Map();
142
- const conversationKindByNativeId = /* @__PURE__ */ new Map();
143
- const logicalConversationByNativeId = /* @__PURE__ */ new Map();
138
+ const conversations = /* @__PURE__ */ new Map();
144
139
  const requireGroupMention = context.adapterOptions?.transportPolicy?.requireGroupMention === true;
145
140
  const connector = await startMSTeamsQaBotFrameworkServer({
146
141
  botToken,
147
142
  nonce,
148
143
  async onOutbound(outbound) {
149
- const kind = conversationKindByNativeId.get(outbound.conversationId) ?? "channel";
150
- const conversationId = logicalConversationByNativeId.get(outbound.conversationId) ?? outbound.conversationId;
144
+ const conversation = conversations.get(outbound.conversationId);
145
+ const kind = conversation?.kind ?? "channel";
146
+ const conversationId = conversation?.id ?? outbound.conversationId;
151
147
  const message = await context.messages.addOutboundMessage({
152
148
  accountId,
153
149
  to: `${kind === "direct" ? "dm" : kind}:${conversationId}`,
@@ -158,7 +154,6 @@ async function createMSTeamsQaTransportAdapter(context) {
158
154
  });
159
155
  nativeByBusMessageId.set(message.id, outbound.activityId);
160
156
  busByNativeMessageId.set(outbound.activityId, message.id);
161
- conversationKindByNativeId.set(outbound.conversationId, kind);
162
157
  }
163
158
  });
164
159
  try {
@@ -187,10 +182,13 @@ async function createMSTeamsQaTransportAdapter(context) {
187
182
  requiredPluginIds: ["msteams"],
188
183
  supportedActions: [],
189
184
  async sendInbound(input) {
190
- const conversationId = nativeConversationId(input.conversation.id);
185
+ const { id, kind } = input.conversation;
186
+ const conversationId = nativeConversationId(id);
191
187
  const nativeThreadId = input.threadId ? nativeByBusMessageId.get(input.threadId) ?? input.threadId : void 0;
192
- conversationKindByNativeId.set(conversationId, input.conversation.kind);
193
- logicalConversationByNativeId.set(conversationId, input.conversation.id);
188
+ conversations.set(conversationId, {
189
+ id,
190
+ kind
191
+ });
194
192
  const activityId = `qa-inbound-${(0, node_crypto.randomUUID)()}`;
195
193
  const activity = {
196
194
  id: activityId,
@@ -210,13 +208,13 @@ async function createMSTeamsQaTransportAdapter(context) {
210
208
  },
211
209
  conversation: {
212
210
  id: nativeThreadId ? `${conversationId};messageid=${nativeThreadId}` : conversationId,
213
- conversationType: input.conversation.kind === "direct" ? "personal" : input.conversation.kind === "group" ? "groupChat" : "channel",
211
+ conversationType: kind === "direct" ? "personal" : kind === "group" ? "groupChat" : "channel",
214
212
  tenantId: TENANT_ID
215
213
  },
216
214
  ...input.replyToId ? { replyToId: input.replyToId } : {},
217
215
  channelData: {
218
216
  tenant: { id: TENANT_ID },
219
- ...input.conversation.kind === "channel" ? {
217
+ ...kind === "channel" ? {
220
218
  team: {
221
219
  id: TEAM_ID,
222
220
  aadGroupId: TEAM_AAD_GROUP_ID
@@ -258,8 +256,7 @@ async function createMSTeamsQaTransportAdapter(context) {
258
256
  resetTransport() {
259
257
  busByNativeMessageId.clear();
260
258
  nativeByBusMessageId.clear();
261
- conversationKindByNativeId.clear();
262
- logicalConversationByNativeId.clear();
259
+ conversations.clear();
263
260
  },
264
261
  createGatewayConfig: () => {
265
262
  return { channels: { msteams: {
@@ -123,16 +123,12 @@ function buildMSTeamsPendingApprovalCard(params) {
123
123
  };
124
124
  });
125
125
  const remainingSeconds = Math.max(0, Math.ceil((view.expiresAtMs - nowMs) / 1e3));
126
- const body = [
127
- ...buildCardHeading(`${kindLabel} Approval Required`, `Expires in ${remainingSeconds}s`),
128
- ...buildApprovalSubject(view),
129
- buildApprovalMetadata(view.approvalId, view.metadata)
130
- ];
131
126
  return {
132
- approvalId: view.approvalId,
133
- approvalKind: view.approvalKind,
134
- expiresAtMs: view.expiresAtMs,
135
- card: buildAdaptiveCard(body, actions),
127
+ card: buildAdaptiveCard([
128
+ ...buildCardHeading(`${kindLabel} Approval Required`, `Expires in ${remainingSeconds}s`),
129
+ ...buildApprovalSubject(view),
130
+ buildApprovalMetadata(view.approvalId, view.metadata)
131
+ ], actions),
136
132
  actionTokens,
137
133
  allowedDecisions: view.actions.map(({ decision }) => decision)
138
134
  };
@@ -1,7 +1,7 @@
1
- const require_resolve_allowlist = require("./resolve-allowlist-CqNzS9bZ.cjs");
2
- const require_channel = require("./channel-CdCSk3Rg.cjs");
3
- const require_approval_card = require("./approval-card-Bo8kHYbj.cjs");
4
- const require_send = require("./send-BXjI3ufq.cjs");
1
+ const require_resolve_allowlist = require("./resolve-allowlist-Drj1jaq0.cjs");
2
+ const require_channel = require("./channel-DQrXOfhf.cjs");
3
+ const require_approval_card = require("./approval-card-CD5q0Nla.cjs");
4
+ const require_send = require("./send-BRUztzVJ.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,10 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-CiKaZLfC.cjs");
2
- const require_resolve_allowlist = require("./resolve-allowlist-CqNzS9bZ.cjs");
2
+ const require_resolve_allowlist = require("./resolve-allowlist-Drj1jaq0.cjs");
3
3
  require("../runtime-api.cjs");
4
4
  const require_directory_contract_api = require("../directory-contract-api.cjs");
5
- const require_thread_session = require("./thread-session-DZMoCsSR.cjs");
6
- const require_channel_setup = require("./channel.setup-nSTtK77J.cjs");
5
+ const require_presentation = require("./presentation-CaLawc5j.cjs");
6
+ const require_thread_session = require("./thread-session-BUUV1zk_.cjs");
7
+ const require_channel_setup = require("./channel.setup--7ko_Kxv.cjs");
7
8
  let openclaw_plugin_sdk_approval_handler_adapter_runtime = require("openclaw/plugin-sdk/approval-handler-adapter-runtime");
8
9
  let openclaw_plugin_sdk_channel_actions = require("openclaw/plugin-sdk/channel-actions");
9
10
  let openclaw_plugin_sdk_channel_core = require("openclaw/plugin-sdk/channel-core");
@@ -23,7 +24,6 @@ let openclaw_plugin_sdk_reply_reference = require("openclaw/plugin-sdk/reply-ref
23
24
  let openclaw_plugin_sdk_approval_delivery_runtime = require("openclaw/plugin-sdk/approval-delivery-runtime");
24
25
  let openclaw_plugin_sdk_approval_native_runtime = require("openclaw/plugin-sdk/approval-native-runtime");
25
26
  let typebox = require("typebox");
26
- let openclaw_plugin_sdk_channel_targets = require("openclaw/plugin-sdk/channel-targets");
27
27
  let openclaw_plugin_sdk_dangerous_name_runtime = require("openclaw/plugin-sdk/dangerous-name-runtime");
28
28
  let openclaw_plugin_sdk_runtime_group_policy = require("openclaw/plugin-sdk/runtime-group-policy");
29
29
  let openclaw_plugin_sdk_channel_status = require("openclaw/plugin-sdk/channel-status");
@@ -77,87 +77,6 @@ function actionError(message) {
77
77
  ...(0, openclaw_plugin_sdk_tool_results.textResult)(message, { error: message })
78
78
  };
79
79
  }
80
- // extensions/msteams/src/policy.ts
81
- function matchMSTeamsPolicyEntry(entries, ...keys) {
82
- return (0, openclaw_plugin_sdk_channel_targets.resolveChannelEntryMatchWithFallback)({
83
- entries,
84
- keys: (0, openclaw_plugin_sdk_channel_targets.buildChannelKeyCandidates)(...keys),
85
- wildcardKey: "*",
86
- normalizeKey: openclaw_plugin_sdk_channel_targets.normalizeChannelSlug
87
- });
88
- }
89
- function selectMSTeamsPolicyEntry(entries, key) {
90
- const match = matchMSTeamsPolicyEntry(entries, key?.trim());
91
- return match.matchKey ?? match.key ? match.entry : void 0;
92
- }
93
- function resolveMSTeamsRouteConfig(params) {
94
- const teamId = params.teamId?.trim();
95
- const teamName = params.teamName?.trim();
96
- const conversationId = params.conversationId?.trim();
97
- const channelName = params.channelName?.trim();
98
- const teams = params.cfg?.teams ?? {};
99
- const allowlistConfigured = Object.keys(teams).length > 0;
100
- const teamMatch = matchMSTeamsPolicyEntry(teams, teamId, params.allowNameMatching ? teamName : void 0, params.allowNameMatching && teamName ? (0, openclaw_plugin_sdk_channel_targets.normalizeChannelSlug)(teamName) : void 0);
101
- const teamConfig = teamMatch.entry;
102
- const channels = teamConfig?.channels ?? {};
103
- const channelAllowlistConfigured = Object.keys(channels).length > 0;
104
- const channelMatch = matchMSTeamsPolicyEntry(channels, conversationId, params.allowNameMatching ? channelName : void 0, params.allowNameMatching && channelName ? (0, openclaw_plugin_sdk_channel_targets.normalizeChannelSlug)(channelName) : void 0);
105
- const channelConfig = channelMatch.entry;
106
- return {
107
- teamConfig,
108
- channelConfig,
109
- allowlistConfigured,
110
- allowed: (0, openclaw_plugin_sdk_channel_targets.resolveNestedAllowlistDecision)({
111
- outerConfigured: allowlistConfigured,
112
- outerMatched: Boolean(teamConfig),
113
- innerConfigured: channelAllowlistConfigured,
114
- innerMatched: Boolean(channelConfig)
115
- }),
116
- teamKey: teamMatch.matchKey ?? teamMatch.key,
117
- channelKey: channelMatch.matchKey ?? channelMatch.key,
118
- channelMatchKey: channelMatch.matchKey,
119
- channelMatchSource: channelMatch.matchSource === "direct" || channelMatch.matchSource === "wildcard" ? channelMatch.matchSource : void 0
120
- };
121
- }
122
- function resolveMSTeamsGroupToolPolicy(params) {
123
- const cfg = require_resolve_allowlist.resolveMSTeamsAccountConfig(params.cfg, params.accountId);
124
- if (!cfg) return;
125
- const teams = cfg.teams ?? {};
126
- const team = selectMSTeamsPolicyEntry(teams, params.groupSpace);
127
- const channel = team && selectMSTeamsPolicyEntry(team.channels ?? {}, params.groupId);
128
- const resolve = (selectedTeam, selectedChannel) => (0, openclaw_plugin_sdk_channel_policy.resolveScopeToolsPolicy)({
129
- tree: { scopes: {
130
- team: selectedTeam ?? {},
131
- channel: selectedChannel ?? {}
132
- } },
133
- path: ["team", "channel"],
134
- senderPolicyMode: params.senderPolicyMode,
135
- senderId: params.senderId,
136
- senderName: params.senderName,
137
- senderUsername: params.senderUsername,
138
- senderE164: params.senderE164
139
- });
140
- const resolved = resolve(team, channel);
141
- if (resolved !== void 0 || channel) return resolved;
142
- if (params.groupId?.trim()) for (const candidate of Object.values(teams)) {
143
- const matched = selectMSTeamsPolicyEntry(candidate.channels ?? {}, params.groupId);
144
- if (matched) return resolve(candidate, matched);
145
- }
146
- }
147
- function resolveMSTeamsReplyPolicy(params) {
148
- if (params.isDirectMessage) return {
149
- requireMention: false,
150
- replyStyle: "thread"
151
- };
152
- const requireMention = params.channelConfig?.requireMention ?? params.teamConfig?.requireMention ?? params.globalConfig?.requireMention ?? true;
153
- const explicitReplyStyle = params.channelConfig?.replyStyle ?? params.teamConfig?.replyStyle ?? params.globalConfig?.replyStyle;
154
- const requireMentionInBotThreads = params.channelConfig?.requireMentionInBotThreads ?? params.teamConfig?.requireMentionInBotThreads ?? params.globalConfig?.requireMentionInBotThreads;
155
- return {
156
- requireMention,
157
- replyStyle: explicitReplyStyle ?? (requireMention ? "thread" : "top-level"),
158
- ...requireMentionInBotThreads === void 0 ? {} : { requireMentionInBotThreads }
159
- };
160
- }
161
80
  // extensions/msteams/src/action-threading.ts
162
81
  /** Normalize Teams conversation targets for equality (strips `conversation:` and `;messageid=`). */
163
82
  function normalizeMSTeamsThreadingTarget(raw) {
@@ -205,13 +124,13 @@ function resolveMSTeamsAutoThreadId(params) {
205
124
  team: void 0,
206
125
  channel: void 0
207
126
  };
208
- const routeConfig = resolveMSTeamsRouteConfig({
127
+ const routeConfig = require_presentation.resolveMSTeamsRouteConfig({
209
128
  cfg: params.cfg,
210
129
  teamId: team,
211
130
  conversationId: channel,
212
131
  allowNameMatching: false
213
132
  });
214
- const { replyStyle } = resolveMSTeamsReplyPolicy({
133
+ const { replyStyle } = require_presentation.resolveMSTeamsReplyPolicy({
215
134
  isDirectMessage: false,
216
135
  globalConfig: params.cfg,
217
136
  teamConfig: routeConfig.teamConfig,
@@ -298,7 +217,7 @@ const msTeamsLazyApprovalNativeRuntime = (0, openclaw_plugin_sdk_approval_handle
298
217
  request
299
218
  }),
300
219
  load: async () => {
301
- const { msTeamsApprovalNativeRuntime } = await Promise.resolve().then(() => require("./approval-handler.runtime-BS3avHFu.cjs"));
220
+ const { msTeamsApprovalNativeRuntime } = await Promise.resolve().then(() => require("./approval-handler.runtime-DbPxvynk.cjs"));
302
221
  return msTeamsApprovalNativeRuntime;
303
222
  }
304
223
  });
@@ -402,12 +321,12 @@ function normalizeNullableString(value) {
402
321
  return trimmed ? trimmed : null;
403
322
  }
404
323
  /** Trims string input and returns undefined for non-strings or empty strings. */
405
- function normalizeOptionalString$3(value) {
324
+ function normalizeOptionalString$2(value) {
406
325
  return normalizeNullableString(value) ?? void 0;
407
326
  }
408
327
  /** Lowercases a normalized optional string. */
409
328
  function normalizeOptionalLowercaseString(value) {
410
- return normalizeOptionalString$3(value)?.toLowerCase();
329
+ return normalizeOptionalString$2(value)?.toLowerCase();
411
330
  }
412
331
  /** Lowercases a normalized string or returns an empty string when absent. */
413
332
  function normalizeLowercaseStringOrEmpty$1(value) {
@@ -431,7 +350,6 @@ function buildCanonicalPathCandidates(pathname) {
431
350
  const candidates = /* @__PURE__ */ new Set([normalizePathForSecurity(pathname)]);
432
351
  let decoded = pathname;
433
352
  let malformedEncoding = false;
434
- let decodePasses = 0;
435
353
  for (let pass = 0; pass < MAX_PATH_DECODE_PASSES; pass++) {
436
354
  let nextDecoded;
437
355
  try {
@@ -441,7 +359,6 @@ function buildCanonicalPathCandidates(pathname) {
441
359
  break;
442
360
  }
443
361
  if (nextDecoded === decoded) break;
444
- decodePasses += 1;
445
362
  decoded = nextDecoded;
446
363
  candidates.add(normalizePathForSecurity(decoded));
447
364
  }
@@ -453,17 +370,15 @@ function buildCanonicalPathCandidates(pathname) {
453
370
  }
454
371
  return {
455
372
  candidates: [...candidates],
456
- decodePasses,
457
373
  decodePassLimitReached,
458
374
  malformedEncoding
459
375
  };
460
376
  }
461
377
  function canonicalizePathForSecurity(pathname) {
462
- const { candidates, decodePasses, decodePassLimitReached, malformedEncoding } = buildCanonicalPathCandidates(pathname);
378
+ const { candidates, decodePassLimitReached, malformedEncoding } = buildCanonicalPathCandidates(pathname);
463
379
  return {
464
380
  canonicalPath: candidates[candidates.length - 1] ?? "/",
465
381
  candidates,
466
- decodePasses,
467
382
  decodePassLimitReached,
468
383
  malformedEncoding,
469
384
  rawNormalizedPath: normalizePathSeparators(normalizeLowercaseStringOrEmpty$1(pathname)) || "/"
@@ -602,100 +517,6 @@ function withMSTeamsGraphMutationCurrentness(handleAction) {
602
517
  return handleAction(ctx);
603
518
  };
604
519
  }
605
- // extensions/msteams/src/presentation.ts
606
- const MSTEAMS_PRESENTATION_CAPABILITIES = {
607
- supported: true,
608
- buttons: true,
609
- selects: false,
610
- context: true,
611
- divider: true,
612
- limits: {
613
- actions: {
614
- supportsStyles: false,
615
- supportsDisabled: false
616
- },
617
- text: { markdownDialect: "markdown" }
618
- }
619
- };
620
- function buildMSTeamsPresentationCard(params) {
621
- const body = [];
622
- const text = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(params.text);
623
- if (text) body.push({
624
- type: "TextBlock",
625
- text,
626
- wrap: true
627
- });
628
- const presentation = (0, openclaw_plugin_sdk_interactive_runtime.adaptMessagePresentationForChannel)({
629
- presentation: params.presentation,
630
- capabilities: MSTEAMS_PRESENTATION_CAPABILITIES
631
- });
632
- if (presentation.title) body.push({
633
- type: "TextBlock",
634
- text: presentation.title,
635
- weight: "Bolder",
636
- size: "Medium",
637
- wrap: true
638
- });
639
- const actions = [];
640
- for (const block of presentation.blocks) {
641
- if (block.type === "text" || block.type === "context") {
642
- body.push({
643
- type: "TextBlock",
644
- text: block.text,
645
- wrap: true,
646
- ...block.type === "context" ? {
647
- isSubtle: true,
648
- size: "Small"
649
- } : {}
650
- });
651
- continue;
652
- }
653
- if (block.type === "divider") {
654
- body.push({
655
- type: "TextBlock",
656
- text: "---",
657
- wrap: true,
658
- isSubtle: true
659
- });
660
- continue;
661
- }
662
- if (block.type === "buttons") for (const button of block.buttons) {
663
- const action = (0, openclaw_plugin_sdk_interactive_runtime.resolveMessagePresentationButtonAction)(button);
664
- if (action?.type === "url" || action?.type === "web-app") {
665
- const url = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(action.url);
666
- if (!url) continue;
667
- actions.push({
668
- type: "Action.OpenUrl",
669
- title: button.label,
670
- url
671
- });
672
- continue;
673
- }
674
- if (action?.type === "command") {
675
- actions.push({
676
- type: "Action.Submit",
677
- title: button.label,
678
- data: action.command
679
- });
680
- continue;
681
- }
682
- if (action?.type === "callback") actions.push({
683
- type: "Action.Submit",
684
- title: button.label,
685
- data: {
686
- value: action.value,
687
- label: button.label
688
- }
689
- });
690
- }
691
- }
692
- return {
693
- type: "AdaptiveCard",
694
- version: "1.4",
695
- body,
696
- ...actions.length ? { actions } : {}
697
- };
698
- }
699
520
  // extensions/msteams/src/outbound-config.ts
700
521
  const MSTEAMS_TEXT_CHUNK_LIMIT = 4e3;
701
522
  function resolveMSTeamsEffectiveTextChunkLimit(configuredLimit) {
@@ -714,7 +535,7 @@ const msteamsOutboundConfig = {
714
535
  payload: true,
715
536
  messageSendingHooks: true
716
537
  } },
717
- presentationCapabilities: MSTEAMS_PRESENTATION_CAPABILITIES
538
+ presentationCapabilities: require_presentation.MSTEAMS_PRESENTATION_CAPABILITIES
718
539
  };
719
540
  // extensions/msteams/src/read-policy.ts
720
541
  function normalizeTarget(raw) {
@@ -748,9 +569,6 @@ function isCurrentMSTeamsReadTarget(params) {
748
569
  function normalizeUserTarget(target) {
749
570
  return target.replace(/^user:/i, "").trim().toLowerCase();
750
571
  }
751
- function isStableUserId(value) {
752
- return /^[0-9a-f-]{16,}$/i.test(value);
753
- }
754
572
  async function resolveDmTarget(cfg, accountId, target, directOperator = false) {
755
573
  const teams = cfg.channels?.msteams;
756
574
  if (teams?.dmPolicy === "disabled") return;
@@ -758,7 +576,7 @@ async function resolveDmTarget(cfg, accountId, target, directOperator = false) {
758
576
  if (!userId) return;
759
577
  const normalizedEntries = (directOperator ? [] : teams?.allowFrom ?? []).map((entry) => normalizeUserTarget(entry.replace(/^(msteams|teams):/i, "")));
760
578
  const allowAll = directOperator || (teams?.dmPolicy ?? "pairing") === "open" || normalizedEntries.includes("*");
761
- if (isStableUserId(userId)) return allowAll || normalizedEntries.some((entry) => entry === userId) ? `user:${userId}` : void 0;
579
+ if (/^[0-9a-f-]{16,}$/i.test(userId)) return allowAll || normalizedEntries.some((entry) => entry === userId) ? `user:${userId}` : void 0;
762
580
  if (!(0, openclaw_plugin_sdk_dangerous_name_runtime.isDangerousNameMatchingEnabled)(teams)) return;
763
581
  try {
764
582
  const [resolvedTarget, ...resolvedEntries] = await require_resolve_allowlist.resolveMSTeamsUserAllowlist({
@@ -825,7 +643,7 @@ async function resolveAllowedChannelTarget(cfg, accountId, target) {
825
643
  if (groupPolicy === "disabled") return;
826
644
  const [teamId, channelId] = target.split("/", 2);
827
645
  if (!teamId || !channelId) return;
828
- const directRoute = resolveMSTeamsRouteConfig({
646
+ const directRoute = require_presentation.resolveMSTeamsRouteConfig({
829
647
  cfg: teams,
830
648
  teamId,
831
649
  teamName: teamId,
@@ -846,7 +664,7 @@ async function isMappedChannelAllowed(cfg, accountId, teamId, conversationId) {
846
664
  if (!teams?.teams) return false;
847
665
  try {
848
666
  const botFrameworkTeamKey = await resolveConfiguredBotFrameworkTeamKey(cfg, accountId, teamId);
849
- if (botFrameworkTeamKey && resolveMSTeamsRouteConfig({
667
+ if (botFrameworkTeamKey && require_presentation.resolveMSTeamsRouteConfig({
850
668
  cfg: teams,
851
669
  teamId: botFrameworkTeamKey,
852
670
  conversationId
@@ -858,7 +676,7 @@ async function isMappedChannelAllowed(cfg, accountId, teamId, conversationId) {
858
676
  teamIdMode: "graph",
859
677
  teams: teams.teams
860
678
  });
861
- return resolveMSTeamsRouteConfig({
679
+ return require_presentation.resolveMSTeamsRouteConfig({
862
680
  cfg: {
863
681
  ...teams,
864
682
  teams: resolved.teams
@@ -902,7 +720,7 @@ async function assertMSTeamsTeamEnumerationAllowed(params) {
902
720
  const teams = cfg.channels?.msteams;
903
721
  const groupPolicy = resolveMSTeamsReadGroupPolicy(cfg);
904
722
  if (groupPolicy === "disabled") throw new openclaw_plugin_sdk_channel_actions.ToolAuthorizationError("Microsoft Teams channel list is not allowed.");
905
- const directRoute = resolveMSTeamsRouteConfig({
723
+ const directRoute = require_presentation.resolveMSTeamsRouteConfig({
906
724
  cfg: teams,
907
725
  teamId: params.teamId,
908
726
  teamName: params.teamId,
@@ -986,7 +804,7 @@ const collectMSTeamsSecurityFindings = openclaw_plugin_sdk_channel_policy.create
986
804
  severity: "warn",
987
805
  title: "MS Teams security warning"
988
806
  });
989
- const loadMSTeamsChannelRuntime = (0, openclaw_plugin_sdk_lazy_runtime.createLazyRuntimeNamedExport)(() => Promise.resolve().then(() => require("./channel.runtime--ZjTYgkY.cjs")), "msTeamsChannelRuntime");
807
+ const loadMSTeamsChannelRuntime = (0, openclaw_plugin_sdk_lazy_runtime.createLazyRuntimeNamedExport)(() => Promise.resolve().then(() => require("./channel.runtime-Du4GPMES.cjs")), "msTeamsChannelRuntime");
990
808
  const MSTEAMS_REACTION_TYPES = [
991
809
  "like",
992
810
  "heart",
@@ -1015,12 +833,12 @@ function resolveGraphActionTarget(params, currentChannelId, currentGraphChannelI
1015
833
  }
1016
834
  function resolveMSTeamsActionMessage(ctx, to, allowCurrentMessageIdFallback = false) {
1017
835
  const canUseCurrentMessageId = allowCurrentMessageIdFallback && msteamsContextTargetsMatch(to, {
1018
- currentChannelId: ctx.toolContext?.currentChannelId ?? void 0,
836
+ currentChannelId: ctx.toolContext?.currentChannelId,
1019
837
  currentMessagingTarget: (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(ctx.toolContext?.currentGraphChannelId) ?? (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(ctx.toolContext?.currentMessagingTarget)
1020
838
  });
1021
839
  const resolved = canUseCurrentMessageId ? (0, openclaw_plugin_sdk_channel_actions.resolveReactionMessageId)({
1022
840
  args: ctx.params,
1023
- toolContext: { currentMessageId: ctx.toolContext?.currentMessageId ?? void 0 }
841
+ toolContext: { currentMessageId: ctx.toolContext?.currentMessageId }
1024
842
  }) : (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(ctx.params.messageId) ?? "";
1025
843
  const messageId = resolved == null ? "" : String(resolved).trim();
1026
844
  const currentMessageId = ctx.toolContext?.currentMessageId;
@@ -1072,7 +890,7 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
1072
890
  idleMs: 1e3
1073
891
  } },
1074
892
  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."] },
1075
- groups: { resolveToolPolicy: resolveMSTeamsGroupToolPolicy },
893
+ groups: { resolveToolPolicy: require_presentation.resolveMSTeamsGroupToolPolicy },
1076
894
  approvalCapability: msTeamsApprovalCapability,
1077
895
  doctor: msteamsDoctor,
1078
896
  messaging: {
@@ -1216,7 +1034,7 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
1216
1034
  });
1217
1035
  const presentation = ctx.action === "send" ? (0, openclaw_plugin_sdk_interactive_runtime.normalizeMessagePresentation)(ctx.params.presentation) : void 0;
1218
1036
  if (ctx.action === "send" && presentation) {
1219
- const card = buildMSTeamsPresentationCard({
1037
+ const card = require_presentation.buildMSTeamsPresentationCard({
1220
1038
  presentation,
1221
1039
  text: resolveActionContent(ctx.params)
1222
1040
  });
@@ -1470,8 +1288,8 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
1470
1288
  if (appId) lines.push({ text: `App: ${appId}` });
1471
1289
  const graph = probe?.graph;
1472
1290
  if (graph) {
1473
- const roles = Array.isArray(graph.roles) ? (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeStringEntries)(graph.roles) : [];
1474
- const scopes = Array.isArray(graph.scopes) ? (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeStringEntries)(graph.scopes) : [];
1291
+ const roles = graph.roles ?? [];
1292
+ const scopes = graph.scopes ?? [];
1475
1293
  const formatPermission = (permission) => {
1476
1294
  const hint = TEAMS_GRAPH_PERMISSION_HINTS[permission];
1477
1295
  return hint ? `${permission} (${hint})` : permission;
@@ -1495,7 +1313,7 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
1495
1313
  })
1496
1314
  }),
1497
1315
  gateway: { startAccount: async (ctx) => {
1498
- const { monitorMSTeamsProvider } = await Promise.resolve().then(() => require("./monitor-BxLDs5fk.cjs"));
1316
+ const { monitorMSTeamsProvider } = await Promise.resolve().then(() => require("./monitor-CXjIKz7o.cjs"));
1499
1317
  const account = require_resolve_allowlist.resolveMSTeamsAccount({
1500
1318
  cfg: ctx.cfg,
1501
1319
  accountId: ctx.accountId
@@ -1571,12 +1389,6 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
1571
1389
  },
1572
1390
  outbound: msteamsChannelOutbound
1573
1391
  });
1574
- Object.defineProperty(exports, "buildMSTeamsPresentationCard", {
1575
- enumerable: true,
1576
- get: function() {
1577
- return buildMSTeamsPresentationCard;
1578
- }
1579
- });
1580
1392
  Object.defineProperty(exports, "inferMSTeamsTargetChatType", {
1581
1393
  enumerable: true,
1582
1394
  get: function() {
@@ -1613,18 +1425,6 @@ Object.defineProperty(exports, "resolveMSTeamsLegacyWebhook", {
1613
1425
  return resolveMSTeamsLegacyWebhook;
1614
1426
  }
1615
1427
  });
1616
- Object.defineProperty(exports, "resolveMSTeamsReplyPolicy", {
1617
- enumerable: true,
1618
- get: function() {
1619
- return resolveMSTeamsReplyPolicy;
1620
- }
1621
- });
1622
- Object.defineProperty(exports, "resolveMSTeamsRouteConfig", {
1623
- enumerable: true,
1624
- get: function() {
1625
- return resolveMSTeamsRouteConfig;
1626
- }
1627
- });
1628
1428
  Object.defineProperty(exports, "resolveMSTeamsWebhookCollisionIssue", {
1629
1429
  enumerable: true,
1630
1430
  get: function() {