@openclaw/msteams 2026.7.2-beta.5 → 2026.8.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.
- package/dist/adapter.runtime-DEYjslFX.cjs +309 -0
- package/dist/api.cjs +2 -2
- package/dist/{channel-DtZFlwhL.cjs → channel-DfCbi0d_.cjs} +209 -301
- package/dist/channel-config-api.cjs +1 -1
- package/dist/channel-plugin-api.cjs +1 -1
- package/dist/{channel.runtime-BtdOD_kD.cjs → channel.runtime-BJmueA4q.cjs} +99 -64
- package/dist/{config-schema-BTnLgWAe.cjs → config-schema-C4CszdDi.cjs} +12 -28
- package/dist/{delegated-state-DOSCHaAB.cjs → delegated-state-DiEz9JIa.cjs} +0 -28
- package/dist/directory-contract-api.cjs +1 -1
- package/dist/doctor-contract-api.cjs +19 -18
- package/dist/{messenger-BJ0KM2sD.cjs → messenger-BqA8G3pY.cjs} +55 -26
- package/dist/{oauth-CNcnL8of.cjs → oauth-DktsbN22.cjs} +12 -25
- package/dist/{polls-CWExq2xZ.cjs → polls-DvuJvaDG.cjs} +6 -12
- package/dist/qa-runner-api.cjs +36 -0
- package/dist/{resolve-allowlist-Dr_1sOJh.cjs → resolve-allowlist-C6YcNC9a.cjs} +292 -117
- package/dist/rolldown-runtime-D6vf50IK.cjs +28 -0
- package/dist/secret-contract-api.cjs +6 -30
- package/dist/setup-plugin-api.cjs +3 -4
- package/dist/{setup-surface-xVejKCJV.cjs → setup-surface-DAhGL2h8.cjs} +20 -44
- package/dist/{src-CsXzz0x2.cjs → src-Bz9wY0Mr.cjs} +1553 -1070
- package/dist/{sso-token-store-OSg229re.cjs → sso-token-store-ChhO1f4i.cjs} +1 -1
- package/openclaw.plugin.json +34 -8
- package/package.json +5 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require("./runtime-api.cjs");
|
|
2
|
-
const require_resolve_allowlist = require("./resolve-allowlist-
|
|
3
|
-
const require_setup_surface = require("./setup-surface-
|
|
4
|
-
const require_config_schema = require("./config-schema-
|
|
2
|
+
const require_resolve_allowlist = require("./resolve-allowlist-C6YcNC9a.cjs");
|
|
3
|
+
const require_setup_surface = require("./setup-surface-DAhGL2h8.cjs");
|
|
4
|
+
const require_config_schema = require("./config-schema-C4CszdDi.cjs");
|
|
5
5
|
let openclaw_plugin_sdk_account_helpers = require("openclaw/plugin-sdk/account-helpers");
|
|
6
6
|
let openclaw_plugin_sdk_channel_core = require("openclaw/plugin-sdk/channel-core");
|
|
7
7
|
let openclaw_plugin_sdk_channel_outbound = require("openclaw/plugin-sdk/channel-outbound");
|
|
@@ -13,9 +13,9 @@ let openclaw_plugin_sdk_lazy_runtime = require("openclaw/plugin-sdk/lazy-runtime
|
|
|
13
13
|
let openclaw_plugin_sdk_status_helpers = require("openclaw/plugin-sdk/status-helpers");
|
|
14
14
|
let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
|
|
15
15
|
let typebox = require("typebox");
|
|
16
|
+
let openclaw_plugin_sdk_reply_reference = require("openclaw/plugin-sdk/reply-reference");
|
|
16
17
|
let openclaw_plugin_sdk_approval_auth_runtime = require("openclaw/plugin-sdk/approval-auth-runtime");
|
|
17
18
|
let openclaw_plugin_sdk_channel_actions = require("openclaw/plugin-sdk/channel-actions");
|
|
18
|
-
let openclaw_plugin_sdk_html_entity_runtime = require("openclaw/plugin-sdk/html-entity-runtime");
|
|
19
19
|
let openclaw_plugin_sdk_routing = require("openclaw/plugin-sdk/routing");
|
|
20
20
|
let openclaw_plugin_sdk_channel_targets = require("openclaw/plugin-sdk/channel-targets");
|
|
21
21
|
let openclaw_plugin_sdk_allow_from = require("openclaw/plugin-sdk/allow-from");
|
|
@@ -24,46 +24,6 @@ let openclaw_plugin_sdk_runtime_group_policy = require("openclaw/plugin-sdk/runt
|
|
|
24
24
|
let openclaw_plugin_sdk_text_chunking = require("openclaw/plugin-sdk/text-chunking");
|
|
25
25
|
let openclaw_plugin_sdk_channel_status = require("openclaw/plugin-sdk/channel-status");
|
|
26
26
|
let openclaw_plugin_sdk_account_id = require("openclaw/plugin-sdk/account-id");
|
|
27
|
-
//#region extensions/msteams/src/approval-auth.ts
|
|
28
|
-
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;
|
|
29
|
-
function normalizeMSTeamsApproverId(value) {
|
|
30
|
-
const normalized = require_resolve_allowlist.normalizeMSTeamsMessagingTarget(String(value));
|
|
31
|
-
if (!normalized?.startsWith("user:")) return;
|
|
32
|
-
const id = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalLowercaseString)(normalized.slice(5));
|
|
33
|
-
if (!id) return;
|
|
34
|
-
return MSTEAMS_ID_RE.test(id) ? id : void 0;
|
|
35
|
-
}
|
|
36
|
-
function resolveMSTeamsChannelConfig(cfg) {
|
|
37
|
-
return cfg.channels?.msteams;
|
|
38
|
-
}
|
|
39
|
-
const msTeamsApprovalAuth = (0, openclaw_plugin_sdk_approval_auth_runtime.createChannelApprovalAuth)({
|
|
40
|
-
channelLabel: "Microsoft Teams",
|
|
41
|
-
resolveInputs: ({ cfg }) => {
|
|
42
|
-
const channel = resolveMSTeamsChannelConfig(cfg);
|
|
43
|
-
return {
|
|
44
|
-
allowFrom: channel?.allowFrom,
|
|
45
|
-
defaultTo: channel?.defaultTo
|
|
46
|
-
};
|
|
47
|
-
},
|
|
48
|
-
normalizeApprover: normalizeMSTeamsApproverId,
|
|
49
|
-
normalizeSenderId: (value) => {
|
|
50
|
-
const trimmed = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalLowercaseString)(value);
|
|
51
|
-
if (!trimmed) return;
|
|
52
|
-
return MSTEAMS_ID_RE.test(trimmed) ? trimmed : void 0;
|
|
53
|
-
}
|
|
54
|
-
}).approvalAuth;
|
|
55
|
-
//#endregion
|
|
56
|
-
//#region extensions/msteams/src/doctor.ts
|
|
57
|
-
const isMSTeamsMutableAllowEntry = (0, openclaw_plugin_sdk_channel_policy.buildMutableAllowEntryDetector)({
|
|
58
|
-
prefixes: ["msteams:", "user:"],
|
|
59
|
-
stableIdPattern: /^[^\s@]+$/
|
|
60
|
-
});
|
|
61
|
-
const collectMSTeamsMutableAllowlistWarnings = (0, openclaw_plugin_sdk_channel_policy.createDangerousNameMatchingMutableAllowlistWarningCollector)({
|
|
62
|
-
channel: "msteams",
|
|
63
|
-
detector: isMSTeamsMutableAllowEntry,
|
|
64
|
-
collectLists: (scope) => (0, openclaw_plugin_sdk_channel_policy.collectStandardAllowlistLists)(scope)
|
|
65
|
-
});
|
|
66
|
-
//#endregion
|
|
67
27
|
//#region extensions/msteams/src/policy.ts
|
|
68
28
|
const teamScopeKey = (teamKey) => (0, openclaw_plugin_sdk_channel_policy.scopeKey)(["team", teamKey]);
|
|
69
29
|
const channelScopeKey = (teamKey, channelKey) => (0, openclaw_plugin_sdk_channel_policy.scopeKey)(["team", teamKey], ["channel", channelKey]);
|
|
@@ -219,6 +179,115 @@ function resolveMSTeamsReplyPolicy(params) {
|
|
|
219
179
|
};
|
|
220
180
|
}
|
|
221
181
|
//#endregion
|
|
182
|
+
//#region extensions/msteams/src/action-threading.ts
|
|
183
|
+
function stripConversationPrefix(raw) {
|
|
184
|
+
const trimmed = raw.trim();
|
|
185
|
+
if (/^conversation:/i.test(trimmed)) return trimmed.slice(13).trim();
|
|
186
|
+
return trimmed;
|
|
187
|
+
}
|
|
188
|
+
/** Normalize Teams conversation targets for equality (strips `conversation:` and `;messageid=`). */
|
|
189
|
+
function normalizeMSTeamsThreadingTarget(raw) {
|
|
190
|
+
const value = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(raw);
|
|
191
|
+
if (!value) return;
|
|
192
|
+
return require_resolve_allowlist.normalizeMSTeamsConversationId(stripConversationPrefix(value));
|
|
193
|
+
}
|
|
194
|
+
function extractMSTeamsResultConversationId(value) {
|
|
195
|
+
if (!(0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(value)) return;
|
|
196
|
+
const direct = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(value.conversationId);
|
|
197
|
+
if (direct) return direct;
|
|
198
|
+
const receipt = (0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(value.receipt) ? value.receipt : void 0;
|
|
199
|
+
if (!receipt) return;
|
|
200
|
+
const candidates = [...Array.isArray(receipt.raw) ? receipt.raw : [], ...Array.isArray(receipt.parts) ? receipt.parts.map((part) => (0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(part) ? part.raw : void 0) : []];
|
|
201
|
+
for (const candidate of candidates) {
|
|
202
|
+
if (!(0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(candidate)) continue;
|
|
203
|
+
const conversationId = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(candidate.conversationId);
|
|
204
|
+
if (conversationId) return conversationId;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
/** Recover the actual Teams conversation resolved by a successful tool send. */
|
|
208
|
+
function extractMSTeamsToolSendResult(result, _send) {
|
|
209
|
+
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;
|
|
210
|
+
const conversationId = extractMSTeamsResultConversationId(details && (0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(details.result) ? details.result : void 0);
|
|
211
|
+
if (!conversationId) return null;
|
|
212
|
+
const normalizedConversationId = require_resolve_allowlist.normalizeMSTeamsConversationId(stripConversationPrefix(conversationId));
|
|
213
|
+
return normalizedConversationId ? { to: `conversation:${normalizedConversationId}` } : null;
|
|
214
|
+
}
|
|
215
|
+
function msteamsContextTargetsMatch(target, context) {
|
|
216
|
+
const normalizedTarget = normalizeMSTeamsThreadingTarget(target);
|
|
217
|
+
if (!normalizedTarget) return false;
|
|
218
|
+
const currentChannel = normalizeMSTeamsThreadingTarget(context.currentChannelId);
|
|
219
|
+
if (currentChannel && currentChannel === normalizedTarget) return true;
|
|
220
|
+
const currentMessaging = normalizeMSTeamsThreadingTarget(context.currentMessagingTarget);
|
|
221
|
+
return Boolean(currentMessaging && currentMessaging === normalizedTarget);
|
|
222
|
+
}
|
|
223
|
+
function resolveMSTeamsAutoThreadId(params) {
|
|
224
|
+
const explicitThreadId = require_resolve_allowlist.extractMSTeamsConversationMessageId(params.to);
|
|
225
|
+
if (explicitThreadId) return explicitThreadId;
|
|
226
|
+
const context = params.toolContext;
|
|
227
|
+
if (!context?.currentChannelId && !context?.currentMessagingTarget) return;
|
|
228
|
+
if (!msteamsContextTargetsMatch(params.to, context)) return;
|
|
229
|
+
const graphTarget = context.currentGraphChannelId ?? context.currentMessagingTarget;
|
|
230
|
+
const { team, channel } = graphTarget ? require_resolve_allowlist.parseMSTeamsTeamChannelInput(graphTarget) : {
|
|
231
|
+
team: void 0,
|
|
232
|
+
channel: void 0
|
|
233
|
+
};
|
|
234
|
+
const routeConfig = resolveMSTeamsRouteConfig({
|
|
235
|
+
cfg: params.cfg,
|
|
236
|
+
teamId: team,
|
|
237
|
+
conversationId: channel,
|
|
238
|
+
allowNameMatching: false
|
|
239
|
+
});
|
|
240
|
+
const { replyStyle } = resolveMSTeamsReplyPolicy({
|
|
241
|
+
isDirectMessage: false,
|
|
242
|
+
globalConfig: params.cfg,
|
|
243
|
+
teamConfig: routeConfig.teamConfig,
|
|
244
|
+
channelConfig: routeConfig.channelConfig
|
|
245
|
+
});
|
|
246
|
+
if (replyStyle === "top-level") return;
|
|
247
|
+
if (!context.currentThreadTs) return;
|
|
248
|
+
if (context.replyToMode !== "all" && !(0, openclaw_plugin_sdk_reply_reference.isSingleUseReplyToMode)(context.replyToMode ?? "off")) return;
|
|
249
|
+
if ((0, openclaw_plugin_sdk_reply_reference.isSingleUseReplyToMode)(context.replyToMode ?? "off") && context.hasRepliedRef?.value) return;
|
|
250
|
+
return context.currentThreadTs;
|
|
251
|
+
}
|
|
252
|
+
//#endregion
|
|
253
|
+
//#region extensions/msteams/src/approval-auth.ts
|
|
254
|
+
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;
|
|
255
|
+
function normalizeMSTeamsApproverId(value) {
|
|
256
|
+
const normalized = require_resolve_allowlist.normalizeMSTeamsMessagingTarget(String(value));
|
|
257
|
+
const id = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalLowercaseString)(normalized?.startsWith("user:") ? normalized.slice(5) : normalized);
|
|
258
|
+
return id && MSTEAMS_ID_RE.test(id) ? id : void 0;
|
|
259
|
+
}
|
|
260
|
+
function resolveMSTeamsChannelConfig(cfg) {
|
|
261
|
+
return cfg.channels?.msteams;
|
|
262
|
+
}
|
|
263
|
+
const msTeamsApprovalAuth = (0, openclaw_plugin_sdk_approval_auth_runtime.createChannelApprovalAuth)({
|
|
264
|
+
channelLabel: "Microsoft Teams",
|
|
265
|
+
resolveInputs: ({ cfg }) => {
|
|
266
|
+
const channel = resolveMSTeamsChannelConfig(cfg);
|
|
267
|
+
return {
|
|
268
|
+
allowFrom: channel?.allowFrom,
|
|
269
|
+
defaultTo: channel?.defaultTo
|
|
270
|
+
};
|
|
271
|
+
},
|
|
272
|
+
normalizeApprover: normalizeMSTeamsApproverId,
|
|
273
|
+
normalizeSenderId: (value) => {
|
|
274
|
+
const trimmed = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalLowercaseString)(value);
|
|
275
|
+
if (!trimmed) return;
|
|
276
|
+
return MSTEAMS_ID_RE.test(trimmed) ? trimmed : void 0;
|
|
277
|
+
}
|
|
278
|
+
}).approvalAuth;
|
|
279
|
+
//#endregion
|
|
280
|
+
//#region extensions/msteams/src/doctor.ts
|
|
281
|
+
const isMSTeamsMutableAllowEntry = (0, openclaw_plugin_sdk_channel_policy.buildMutableAllowEntryDetector)({
|
|
282
|
+
prefixes: ["msteams:", "user:"],
|
|
283
|
+
stableIdPattern: /^[^\s@]+$/
|
|
284
|
+
});
|
|
285
|
+
const collectMSTeamsMutableAllowlistWarnings = (0, openclaw_plugin_sdk_channel_policy.createDangerousNameMatchingMutableAllowlistWarningCollector)({
|
|
286
|
+
channel: "msteams",
|
|
287
|
+
detector: isMSTeamsMutableAllowEntry,
|
|
288
|
+
collectLists: (scope) => (0, openclaw_plugin_sdk_channel_policy.collectStandardAllowlistLists)(scope)
|
|
289
|
+
});
|
|
290
|
+
//#endregion
|
|
222
291
|
//#region extensions/msteams/src/presentation.ts
|
|
223
292
|
const MSTEAMS_PRESENTATION_CAPABILITIES = {
|
|
224
293
|
supported: true,
|
|
@@ -435,8 +504,8 @@ async function resolveAllowedChannelTarget(cfg, target) {
|
|
|
435
504
|
allowNameMatching: (0, openclaw_plugin_sdk_dangerous_name_runtime.isDangerousNameMatchingEnabled)(teams)
|
|
436
505
|
});
|
|
437
506
|
const stableTarget = await resolveStableChannelTarget(cfg, target);
|
|
507
|
+
if (!directRoute.allowlistConfigured && groupPolicy !== "open" && stableTarget) throw new openclaw_plugin_sdk_channel_actions.ToolAuthorizationError("Microsoft Teams read target is not allowed. Configure channels.msteams.teams.<team>.channels for this channel, or deliberately set channels.msteams.groupPolicy to \"open\".");
|
|
438
508
|
if (directRoute.allowed) return stableTarget;
|
|
439
|
-
if (!directRoute.allowlistConfigured) return groupPolicy === "open" ? stableTarget : void 0;
|
|
440
509
|
if (!stableTarget || !teams?.teams) return;
|
|
441
510
|
const [stableTeamId, stableChannelId] = stableTarget.split("/", 2);
|
|
442
511
|
if (!stableTeamId || !stableChannelId) return;
|
|
@@ -533,62 +602,6 @@ async function assertMSTeamsTeamEnumerationAllowed(params) {
|
|
|
533
602
|
return stableTeamId;
|
|
534
603
|
}
|
|
535
604
|
//#endregion
|
|
536
|
-
//#region extensions/msteams/src/inbound.ts
|
|
537
|
-
/**
|
|
538
|
-
* Strip HTML tags, preserving text content.
|
|
539
|
-
*/
|
|
540
|
-
function htmlToPlainText(html) {
|
|
541
|
-
return (0, openclaw_plugin_sdk_html_entity_runtime.decodeHtmlEntities)(html.replace(/<[^>]*>/g, " ")).replaceAll("\xA0", " ").replace(/\s+/g, " ").trim();
|
|
542
|
-
}
|
|
543
|
-
/**
|
|
544
|
-
* Extract quote info from MS Teams HTML reply attachments.
|
|
545
|
-
* Teams wraps quoted content in a blockquote with itemtype="http://schema.skype.com/Reply".
|
|
546
|
-
*/
|
|
547
|
-
function extractMSTeamsQuoteInfo(attachments) {
|
|
548
|
-
for (const att of attachments) {
|
|
549
|
-
let content = "";
|
|
550
|
-
if (typeof att.content === "string") content = att.content;
|
|
551
|
-
else if (typeof att.content === "object" && att.content !== null) {
|
|
552
|
-
const record = att.content;
|
|
553
|
-
content = typeof record.text === "string" ? record.text : typeof record.body === "string" ? record.body : "";
|
|
554
|
-
}
|
|
555
|
-
if (!content) continue;
|
|
556
|
-
if (!content.includes("http://schema.skype.com/Reply")) continue;
|
|
557
|
-
const senderMatch = /<strong[^>]*itemprop=["']mri["'][^>]*>(.*?)<\/strong>/i.exec(content);
|
|
558
|
-
const sender = senderMatch?.[1] ? htmlToPlainText(senderMatch[1]) : void 0;
|
|
559
|
-
const bodyMatch = /<p[^>]*itemprop=["']copy["'][^>]*>(.*?)<\/p>/is.exec(content) ?? /<p[^>]*itemprop=["']preview["'][^>]*>(.*?)<\/p>/is.exec(content);
|
|
560
|
-
const body = bodyMatch?.[1] ? htmlToPlainText(bodyMatch[1]) : void 0;
|
|
561
|
-
const id = /<blockquote[^>]*\bitemid=["']([^"']+)["'][^>]*>/is.exec(content)?.[1]?.trim() || void 0;
|
|
562
|
-
if (body) return {
|
|
563
|
-
sender: sender ?? "unknown",
|
|
564
|
-
body,
|
|
565
|
-
...id ? { id } : {}
|
|
566
|
-
};
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
function normalizeMSTeamsConversationId(raw) {
|
|
570
|
-
return raw.split(";")[0] ?? raw;
|
|
571
|
-
}
|
|
572
|
-
function extractMSTeamsConversationMessageId(raw) {
|
|
573
|
-
if (!raw) return;
|
|
574
|
-
return (/(?:^|;)messageid=([^;]+)/i.exec(raw)?.[1]?.trim() ?? "") || void 0;
|
|
575
|
-
}
|
|
576
|
-
function parseMSTeamsActivityTimestamp(value) {
|
|
577
|
-
if (!value) return;
|
|
578
|
-
if (value instanceof Date) return value;
|
|
579
|
-
if (typeof value !== "string") return;
|
|
580
|
-
const date = new Date(value);
|
|
581
|
-
return Number.isNaN(date.getTime()) ? void 0 : date;
|
|
582
|
-
}
|
|
583
|
-
function stripMSTeamsMentionTags(text) {
|
|
584
|
-
return text.replace(/<at[^>]*>.*?<\/at>/gi, "").trim();
|
|
585
|
-
}
|
|
586
|
-
function wasMSTeamsBotMentioned(activity) {
|
|
587
|
-
const botId = activity.recipient?.id;
|
|
588
|
-
if (!botId) return false;
|
|
589
|
-
return (activity.entities ?? []).some((e) => e.type === "mention" && e.mentioned?.id === botId);
|
|
590
|
-
}
|
|
591
|
-
//#endregion
|
|
592
605
|
//#region extensions/msteams/src/monitor-handler/thread-session.ts
|
|
593
606
|
const TRAILING_THREAD_SUFFIX = /(?::thread:[^:]+)+$/;
|
|
594
607
|
function resolveMSTeamsRouteSessionKey(params) {
|
|
@@ -602,20 +615,32 @@ function resolveMSTeamsRouteSessionKey(params) {
|
|
|
602
615
|
}
|
|
603
616
|
//#endregion
|
|
604
617
|
//#region extensions/msteams/src/session-route.ts
|
|
618
|
+
function inferMSTeamsTargetChatType(raw) {
|
|
619
|
+
const target = (0, openclaw_plugin_sdk_channel_core.stripChannelTargetPrefix)(raw, "msteams", "teams");
|
|
620
|
+
if (!target) return;
|
|
621
|
+
const lower = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeLowercaseStringOrEmpty)(target);
|
|
622
|
+
const rawId = (0, openclaw_plugin_sdk_channel_core.stripTargetKindPrefix)(target);
|
|
623
|
+
if (!rawId) return;
|
|
624
|
+
const conversationId = require_resolve_allowlist.normalizeMSTeamsConversationId(rawId);
|
|
625
|
+
if (lower.startsWith("user:") || /^[0-9a-f-]{16,}$/i.test(conversationId)) return "direct";
|
|
626
|
+
if (/@thread\.tacv2/i.test(conversationId)) return "channel";
|
|
627
|
+
return /^19:.+@thread\.(?:skype|v2)$/i.test(conversationId) ? "group" : void 0;
|
|
628
|
+
}
|
|
605
629
|
function resolveMSTeamsOutboundSessionRoute(params) {
|
|
606
630
|
const trimmed = (0, openclaw_plugin_sdk_channel_core.stripChannelTargetPrefix)(params.target, "msteams", "teams");
|
|
607
631
|
if (!trimmed) return null;
|
|
608
|
-
const
|
|
632
|
+
const resolvedKind = params.resolvedTarget?.kind;
|
|
633
|
+
const targetChatType = inferMSTeamsTargetChatType(trimmed);
|
|
634
|
+
const isUser = resolvedKind === "user" || targetChatType === "direct";
|
|
609
635
|
const rawId = (0, openclaw_plugin_sdk_channel_core.stripTargetKindPrefix)(trimmed);
|
|
610
636
|
if (!rawId) return null;
|
|
611
|
-
const conversationId = normalizeMSTeamsConversationId(rawId);
|
|
612
|
-
const isChannel = !isUser &&
|
|
613
|
-
const embeddedThreadId = extractMSTeamsConversationMessageId(rawId);
|
|
637
|
+
const conversationId = require_resolve_allowlist.normalizeMSTeamsConversationId(rawId);
|
|
638
|
+
const isChannel = !isUser && targetChatType === "channel";
|
|
639
|
+
const embeddedThreadId = require_resolve_allowlist.extractMSTeamsConversationMessageId(rawId);
|
|
614
640
|
const explicitThreadId = params.threadId ?? params.replyToId;
|
|
615
641
|
const channelThreadId = embeddedThreadId ?? (explicitThreadId !== void 0 && explicitThreadId !== null ? String(explicitThreadId) : void 0);
|
|
616
|
-
const resolvedKind = params.resolvedTarget?.kind;
|
|
617
642
|
const isCanonicalUserId = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(conversationId);
|
|
618
|
-
const recipientSessionExact =
|
|
643
|
+
const recipientSessionExact = isUser && isCanonicalUserId || (isChannel ? channelThreadId !== void 0 : resolvedKind === "group");
|
|
619
644
|
const route = (0, openclaw_plugin_sdk_channel_core.buildChannelOutboundSessionRoute)({
|
|
620
645
|
cfg: params.cfg,
|
|
621
646
|
agentId: params.agentId,
|
|
@@ -661,7 +686,7 @@ const collectMSTeamsSecurityWarnings = (0, openclaw_plugin_sdk_channel_policy.cr
|
|
|
661
686
|
resolveGroupPolicy: ({ cfg }) => cfg.channels?.msteams?.groupPolicy,
|
|
662
687
|
collect: ({ groupPolicy }) => groupPolicy === "open" ? ["- MS Teams groups: groupPolicy=\"open\" allows any member to trigger (mention-gated). Set channels.msteams.groupPolicy=\"allowlist\" + channels.msteams.groupAllowFrom to restrict senders."] : []
|
|
663
688
|
});
|
|
664
|
-
const loadMSTeamsChannelRuntime = (0, openclaw_plugin_sdk_lazy_runtime.createLazyRuntimeNamedExport)(() => Promise.resolve().then(() => require("./channel.runtime-
|
|
689
|
+
const loadMSTeamsChannelRuntime = (0, openclaw_plugin_sdk_lazy_runtime.createLazyRuntimeNamedExport)(() => Promise.resolve().then(() => require("./channel.runtime-BJmueA4q.cjs")), "msTeamsChannelRuntime");
|
|
665
690
|
function jsonActionResult(data) {
|
|
666
691
|
return {
|
|
667
692
|
content: [{
|
|
@@ -757,7 +782,7 @@ function resolveActionContent(params) {
|
|
|
757
782
|
return typeof params.text === "string" ? params.text : typeof params.content === "string" ? params.content : typeof params.message === "string" ? params.message : "";
|
|
758
783
|
}
|
|
759
784
|
function readOptionalTrimmedString(params, key) {
|
|
760
|
-
return
|
|
785
|
+
return (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(params[key]);
|
|
761
786
|
}
|
|
762
787
|
function resolveActionUploadFilePath(params) {
|
|
763
788
|
for (const key of [
|
|
@@ -769,64 +794,31 @@ function resolveActionUploadFilePath(params) {
|
|
|
769
794
|
if (value.trim()) return value;
|
|
770
795
|
}
|
|
771
796
|
}
|
|
772
|
-
function
|
|
773
|
-
|
|
797
|
+
function resolveMSTeamsActionTarget(params) {
|
|
798
|
+
return params.graphOnly ? resolveGraphActionTarget(params.toolParams, params.currentChannelId, params.currentGraphChannelId, params.currentChatType) : resolveActionTarget(params.toolParams, params.currentChannelId);
|
|
799
|
+
}
|
|
800
|
+
async function runWithRequiredActionTarget(params) {
|
|
801
|
+
const to = resolveMSTeamsActionTarget(params);
|
|
774
802
|
if (!to) return actionError(`${params.actionLabel} requires a target (to).`);
|
|
775
|
-
return to;
|
|
803
|
+
return await params.run(to);
|
|
776
804
|
}
|
|
777
|
-
function
|
|
778
|
-
const to =
|
|
805
|
+
async function runWithRequiredActionMessageTarget(params) {
|
|
806
|
+
const to = resolveMSTeamsActionTarget(params);
|
|
779
807
|
const messageId = resolveActionMessageId(params.toolParams);
|
|
780
808
|
if (!to || !messageId) return actionError(`${params.actionLabel} requires a target (to) and messageId.`);
|
|
781
|
-
return {
|
|
809
|
+
return await params.run({
|
|
782
810
|
to,
|
|
783
811
|
messageId
|
|
784
|
-
};
|
|
812
|
+
});
|
|
785
813
|
}
|
|
786
|
-
function
|
|
787
|
-
const to =
|
|
814
|
+
async function runWithRequiredActionPinnedMessageTarget(params) {
|
|
815
|
+
const to = resolveMSTeamsActionTarget(params);
|
|
788
816
|
const pinnedMessageId = resolveActionPinnedMessageId(params.toolParams);
|
|
789
817
|
if (!to || !pinnedMessageId) return actionError(`${params.actionLabel} requires a target (to) and pinnedMessageId.`);
|
|
790
|
-
return {
|
|
818
|
+
return await params.run({
|
|
791
819
|
to,
|
|
792
820
|
pinnedMessageId
|
|
793
|
-
};
|
|
794
|
-
}
|
|
795
|
-
async function runWithRequiredActionTarget(params) {
|
|
796
|
-
const to = resolveRequiredActionTarget({
|
|
797
|
-
actionLabel: params.actionLabel,
|
|
798
|
-
toolParams: params.toolParams,
|
|
799
|
-
currentChannelId: params.currentChannelId,
|
|
800
|
-
currentGraphChannelId: params.currentGraphChannelId,
|
|
801
|
-
currentChatType: params.currentChatType,
|
|
802
|
-
graphOnly: params.graphOnly
|
|
803
|
-
});
|
|
804
|
-
if (typeof to !== "string") return to;
|
|
805
|
-
return await params.run(to);
|
|
806
|
-
}
|
|
807
|
-
async function runWithRequiredActionMessageTarget(params) {
|
|
808
|
-
const target = resolveRequiredActionMessageTarget({
|
|
809
|
-
actionLabel: params.actionLabel,
|
|
810
|
-
toolParams: params.toolParams,
|
|
811
|
-
currentChannelId: params.currentChannelId,
|
|
812
|
-
currentGraphChannelId: params.currentGraphChannelId,
|
|
813
|
-
currentChatType: params.currentChatType,
|
|
814
|
-
graphOnly: params.graphOnly
|
|
815
821
|
});
|
|
816
|
-
if ("isError" in target) return target;
|
|
817
|
-
return await params.run(target);
|
|
818
|
-
}
|
|
819
|
-
async function runWithRequiredActionPinnedMessageTarget(params) {
|
|
820
|
-
const target = resolveRequiredActionPinnedMessageTarget({
|
|
821
|
-
actionLabel: params.actionLabel,
|
|
822
|
-
toolParams: params.toolParams,
|
|
823
|
-
currentChannelId: params.currentChannelId,
|
|
824
|
-
currentGraphChannelId: params.currentGraphChannelId,
|
|
825
|
-
currentChatType: params.currentChatType,
|
|
826
|
-
graphOnly: params.graphOnly
|
|
827
|
-
});
|
|
828
|
-
if ("isError" in target) return target;
|
|
829
|
-
return await params.run(target);
|
|
830
822
|
}
|
|
831
823
|
function describeMSTeamsMessageTool({ cfg }) {
|
|
832
824
|
const enabled = cfg.channels?.msteams?.enabled !== false && Boolean(require_resolve_allowlist.resolveMSTeamsCredentials(cfg.channels?.msteams));
|
|
@@ -862,6 +854,7 @@ const msteamsChannelOutbound = {
|
|
|
862
854
|
chunker: openclaw_plugin_sdk_text_chunking.chunkTextForOutbound,
|
|
863
855
|
chunkerMode: "markdown",
|
|
864
856
|
textChunkLimit: 4e3,
|
|
857
|
+
resolveEffectiveTextChunkLimit: ({ fallbackLimit }) => typeof fallbackLimit === "number" && fallbackLimit > 0 ? Math.min(fallbackLimit, 4e3) : 4e3,
|
|
865
858
|
pollMaxOptions: 12,
|
|
866
859
|
deliveryCapabilities: { durableFinal: {
|
|
867
860
|
text: true,
|
|
@@ -938,12 +931,12 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
|
|
|
938
931
|
warnOnEmptyGroupSenderAllowlist: true,
|
|
939
932
|
collectMutableAllowlistWarnings: collectMSTeamsMutableAllowlistWarnings
|
|
940
933
|
},
|
|
941
|
-
setup: require_setup_surface.msteamsSetupAdapter,
|
|
942
934
|
setupContract: require_setup_surface.msteamsSetupContract,
|
|
943
935
|
messaging: {
|
|
944
936
|
targetPrefixes: ["msteams", "teams"],
|
|
945
937
|
directTargetStyle: "user-prefixed",
|
|
946
938
|
normalizeTarget: require_resolve_allowlist.normalizeMSTeamsMessagingTarget,
|
|
939
|
+
inferTargetChatType: ({ to }) => inferMSTeamsTargetChatType(to),
|
|
947
940
|
resolveOutboundSessionRoute: (params) => resolveMSTeamsOutboundSessionRoute(params),
|
|
948
941
|
targetResolver: {
|
|
949
942
|
looksLikeId: (raw) => require_resolve_allowlist.looksLikeMSTeamsTargetId(raw),
|
|
@@ -1095,12 +1088,18 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
|
|
|
1095
1088
|
} },
|
|
1096
1089
|
actions: {
|
|
1097
1090
|
describeMessageTool: describeMSTeamsMessageTool,
|
|
1091
|
+
extractToolSendResult: ({ result, send }) => extractMSTeamsToolSendResult(result, send),
|
|
1098
1092
|
requiresTrustedRequesterSender: ({ action, toolContext }) => (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(toolContext?.currentChannelProvider)?.toLowerCase() === "msteams" && MSTEAMS_GROUP_MANAGEMENT_ACTIONS.has(action),
|
|
1099
1093
|
handleAction: async (ctx) => {
|
|
1100
1094
|
if (MSTEAMS_GROUP_MANAGEMENT_ACTIONS.has(ctx.action)) {
|
|
1101
1095
|
const authError = requireMSTeamsGroupManagementAuthorization(ctx);
|
|
1102
1096
|
if (authError) return authError;
|
|
1103
1097
|
}
|
|
1098
|
+
const authorizeActionTarget = (target) => assertMSTeamsReadTargetAllowed({
|
|
1099
|
+
cfg: ctx.cfg,
|
|
1100
|
+
ctx,
|
|
1101
|
+
target
|
|
1102
|
+
});
|
|
1104
1103
|
const presentation = ctx.action === "send" ? (0, openclaw_plugin_sdk_interactive_runtime.normalizeMessagePresentation)(ctx.params.presentation) : void 0;
|
|
1105
1104
|
if (ctx.action === "send" && presentation) {
|
|
1106
1105
|
const card = buildMSTeamsPresentationCard({
|
|
@@ -1145,6 +1144,7 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
|
|
|
1145
1144
|
text: resolveActionContent(ctx.params),
|
|
1146
1145
|
mediaUrl,
|
|
1147
1146
|
filename: readOptionalTrimmedString(ctx.params, "filename") ?? readOptionalTrimmedString(ctx.params, "title"),
|
|
1147
|
+
mediaAccess: ctx.mediaAccess,
|
|
1148
1148
|
mediaLocalRoots: ctx.mediaLocalRoots,
|
|
1149
1149
|
mediaReadFile: ctx.mediaReadFile
|
|
1150
1150
|
});
|
|
@@ -1172,11 +1172,7 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
|
|
|
1172
1172
|
toolParams: ctx.params,
|
|
1173
1173
|
currentChannelId: ctx.toolContext?.currentChannelId,
|
|
1174
1174
|
run: async (target) => {
|
|
1175
|
-
const to = await
|
|
1176
|
-
cfg: ctx.cfg,
|
|
1177
|
-
ctx,
|
|
1178
|
-
target: target.to
|
|
1179
|
-
});
|
|
1175
|
+
const to = await authorizeActionTarget(target.to);
|
|
1180
1176
|
const { editMessageMSTeams } = await loadMSTeamsChannelRuntime();
|
|
1181
1177
|
return jsonMSTeamsConversationResult((await editMessageMSTeams({
|
|
1182
1178
|
cfg: ctx.cfg,
|
|
@@ -1192,11 +1188,7 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
|
|
|
1192
1188
|
toolParams: ctx.params,
|
|
1193
1189
|
currentChannelId: ctx.toolContext?.currentChannelId,
|
|
1194
1190
|
run: async (target) => {
|
|
1195
|
-
const to = await
|
|
1196
|
-
cfg: ctx.cfg,
|
|
1197
|
-
ctx,
|
|
1198
|
-
target: target.to
|
|
1199
|
-
});
|
|
1191
|
+
const to = await authorizeActionTarget(target.to);
|
|
1200
1192
|
const { deleteMessageMSTeams } = await loadMSTeamsChannelRuntime();
|
|
1201
1193
|
return jsonMSTeamsConversationResult((await deleteMessageMSTeams({
|
|
1202
1194
|
cfg: ctx.cfg,
|
|
@@ -1205,19 +1197,18 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
|
|
|
1205
1197
|
})).conversationId);
|
|
1206
1198
|
}
|
|
1207
1199
|
});
|
|
1208
|
-
|
|
1209
|
-
actionLabel: "Read",
|
|
1200
|
+
const graphActionTarget = {
|
|
1210
1201
|
toolParams: ctx.params,
|
|
1211
1202
|
currentChannelId: ctx.toolContext?.currentChannelId,
|
|
1212
1203
|
currentGraphChannelId: resolveCurrentGraphActionTarget(ctx.toolContext),
|
|
1213
1204
|
currentChatType: ctx.toolContext?.currentChatType,
|
|
1214
|
-
graphOnly: true
|
|
1205
|
+
graphOnly: true
|
|
1206
|
+
};
|
|
1207
|
+
if (ctx.action === "read") return await runWithRequiredActionMessageTarget({
|
|
1208
|
+
actionLabel: "Read",
|
|
1209
|
+
...graphActionTarget,
|
|
1215
1210
|
run: async (target) => {
|
|
1216
|
-
const to = await
|
|
1217
|
-
cfg: ctx.cfg,
|
|
1218
|
-
ctx,
|
|
1219
|
-
target: target.to
|
|
1220
|
-
});
|
|
1211
|
+
const to = await authorizeActionTarget(target.to);
|
|
1221
1212
|
const { getMessageMSTeams } = await loadMSTeamsChannelRuntime();
|
|
1222
1213
|
return jsonMSTeamsOkActionResult("read", { message: await getMessageMSTeams({
|
|
1223
1214
|
cfg: ctx.cfg,
|
|
@@ -1228,17 +1219,9 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
|
|
|
1228
1219
|
});
|
|
1229
1220
|
if (ctx.action === "pin") return await runWithRequiredActionMessageTarget({
|
|
1230
1221
|
actionLabel: "Pin",
|
|
1231
|
-
|
|
1232
|
-
currentChannelId: ctx.toolContext?.currentChannelId,
|
|
1233
|
-
currentGraphChannelId: resolveCurrentGraphActionTarget(ctx.toolContext),
|
|
1234
|
-
currentChatType: ctx.toolContext?.currentChatType,
|
|
1235
|
-
graphOnly: true,
|
|
1222
|
+
...graphActionTarget,
|
|
1236
1223
|
run: async (target) => {
|
|
1237
|
-
const to = await
|
|
1238
|
-
cfg: ctx.cfg,
|
|
1239
|
-
ctx,
|
|
1240
|
-
target: target.to
|
|
1241
|
-
});
|
|
1224
|
+
const to = await authorizeActionTarget(target.to);
|
|
1242
1225
|
const { pinMessageMSTeams } = await loadMSTeamsChannelRuntime();
|
|
1243
1226
|
return jsonMSTeamsActionResult("pin", await pinMessageMSTeams({
|
|
1244
1227
|
cfg: ctx.cfg,
|
|
@@ -1249,17 +1232,9 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
|
|
|
1249
1232
|
});
|
|
1250
1233
|
if (ctx.action === "unpin") return await runWithRequiredActionPinnedMessageTarget({
|
|
1251
1234
|
actionLabel: "Unpin",
|
|
1252
|
-
|
|
1253
|
-
currentChannelId: ctx.toolContext?.currentChannelId,
|
|
1254
|
-
currentGraphChannelId: resolveCurrentGraphActionTarget(ctx.toolContext),
|
|
1255
|
-
currentChatType: ctx.toolContext?.currentChatType,
|
|
1256
|
-
graphOnly: true,
|
|
1235
|
+
...graphActionTarget,
|
|
1257
1236
|
run: async (target) => {
|
|
1258
|
-
const to = await
|
|
1259
|
-
cfg: ctx.cfg,
|
|
1260
|
-
ctx,
|
|
1261
|
-
target: target.to
|
|
1262
|
-
});
|
|
1237
|
+
const to = await authorizeActionTarget(target.to);
|
|
1263
1238
|
const { unpinMessageMSTeams } = await loadMSTeamsChannelRuntime();
|
|
1264
1239
|
return jsonMSTeamsActionResult("unpin", await unpinMessageMSTeams({
|
|
1265
1240
|
cfg: ctx.cfg,
|
|
@@ -1270,17 +1245,9 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
|
|
|
1270
1245
|
});
|
|
1271
1246
|
if (ctx.action === "list-pins") return await runWithRequiredActionTarget({
|
|
1272
1247
|
actionLabel: "List-pins",
|
|
1273
|
-
|
|
1274
|
-
currentChannelId: ctx.toolContext?.currentChannelId,
|
|
1275
|
-
currentGraphChannelId: resolveCurrentGraphActionTarget(ctx.toolContext),
|
|
1276
|
-
currentChatType: ctx.toolContext?.currentChatType,
|
|
1277
|
-
graphOnly: true,
|
|
1248
|
+
...graphActionTarget,
|
|
1278
1249
|
run: async (to) => {
|
|
1279
|
-
const allowedTarget = await
|
|
1280
|
-
cfg: ctx.cfg,
|
|
1281
|
-
ctx,
|
|
1282
|
-
target: to
|
|
1283
|
-
});
|
|
1250
|
+
const allowedTarget = await authorizeActionTarget(to);
|
|
1284
1251
|
const { listPinsMSTeams } = await loadMSTeamsChannelRuntime();
|
|
1285
1252
|
return jsonMSTeamsOkActionResult("list-pins", await listPinsMSTeams({
|
|
1286
1253
|
cfg: ctx.cfg,
|
|
@@ -1290,11 +1257,7 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
|
|
|
1290
1257
|
});
|
|
1291
1258
|
if (ctx.action === "react") return await runWithRequiredActionMessageTarget({
|
|
1292
1259
|
actionLabel: "React",
|
|
1293
|
-
|
|
1294
|
-
currentChannelId: ctx.toolContext?.currentChannelId,
|
|
1295
|
-
currentGraphChannelId: resolveCurrentGraphActionTarget(ctx.toolContext),
|
|
1296
|
-
currentChatType: ctx.toolContext?.currentChatType,
|
|
1297
|
-
graphOnly: true,
|
|
1260
|
+
...graphActionTarget,
|
|
1298
1261
|
run: async (target) => {
|
|
1299
1262
|
const emoji = typeof ctx.params.emoji === "string" ? ctx.params.emoji.trim() : "";
|
|
1300
1263
|
const remove = typeof ctx.params.remove === "boolean" ? ctx.params.remove : false;
|
|
@@ -1309,11 +1272,7 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
|
|
|
1309
1272
|
validTypes: [...MSTEAMS_REACTION_TYPES]
|
|
1310
1273
|
}
|
|
1311
1274
|
};
|
|
1312
|
-
const to = await
|
|
1313
|
-
cfg: ctx.cfg,
|
|
1314
|
-
ctx,
|
|
1315
|
-
target: target.to
|
|
1316
|
-
});
|
|
1275
|
+
const to = await authorizeActionTarget(target.to);
|
|
1317
1276
|
if (remove) {
|
|
1318
1277
|
const { unreactMessageMSTeams } = await loadMSTeamsChannelRuntime();
|
|
1319
1278
|
return jsonMSTeamsActionResult("react", {
|
|
@@ -1341,17 +1300,9 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
|
|
|
1341
1300
|
});
|
|
1342
1301
|
if (ctx.action === "reactions") return await runWithRequiredActionMessageTarget({
|
|
1343
1302
|
actionLabel: "Reactions",
|
|
1344
|
-
|
|
1345
|
-
currentChannelId: ctx.toolContext?.currentChannelId,
|
|
1346
|
-
currentGraphChannelId: resolveCurrentGraphActionTarget(ctx.toolContext),
|
|
1347
|
-
currentChatType: ctx.toolContext?.currentChatType,
|
|
1348
|
-
graphOnly: true,
|
|
1303
|
+
...graphActionTarget,
|
|
1349
1304
|
run: async (target) => {
|
|
1350
|
-
const to = await
|
|
1351
|
-
cfg: ctx.cfg,
|
|
1352
|
-
ctx,
|
|
1353
|
-
target: target.to
|
|
1354
|
-
});
|
|
1305
|
+
const to = await authorizeActionTarget(target.to);
|
|
1355
1306
|
const { listReactionsMSTeams } = await loadMSTeamsChannelRuntime();
|
|
1356
1307
|
return jsonMSTeamsOkActionResult("reactions", await listReactionsMSTeams({
|
|
1357
1308
|
cfg: ctx.cfg,
|
|
@@ -1362,17 +1313,9 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
|
|
|
1362
1313
|
});
|
|
1363
1314
|
if (ctx.action === "search") return await runWithRequiredActionTarget({
|
|
1364
1315
|
actionLabel: "Search",
|
|
1365
|
-
|
|
1366
|
-
currentChannelId: ctx.toolContext?.currentChannelId,
|
|
1367
|
-
currentGraphChannelId: resolveCurrentGraphActionTarget(ctx.toolContext),
|
|
1368
|
-
currentChatType: ctx.toolContext?.currentChatType,
|
|
1369
|
-
graphOnly: true,
|
|
1316
|
+
...graphActionTarget,
|
|
1370
1317
|
run: async (to) => {
|
|
1371
|
-
const allowedTarget = await
|
|
1372
|
-
cfg: ctx.cfg,
|
|
1373
|
-
ctx,
|
|
1374
|
-
target: to
|
|
1375
|
-
});
|
|
1318
|
+
const allowedTarget = await authorizeActionTarget(to);
|
|
1376
1319
|
const query = resolveActionQuery(ctx.params);
|
|
1377
1320
|
if (!query) return actionError("Search requires a target (to) and query.");
|
|
1378
1321
|
const limit = typeof ctx.params.limit === "number" ? ctx.params.limit : void 0;
|
|
@@ -1392,17 +1335,9 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
|
|
|
1392
1335
|
if (!userId) return actionError("member-info requires a userId.");
|
|
1393
1336
|
return await runWithRequiredActionTarget({
|
|
1394
1337
|
actionLabel: "member-info",
|
|
1395
|
-
|
|
1396
|
-
currentChannelId: ctx.toolContext?.currentChannelId,
|
|
1397
|
-
currentGraphChannelId: resolveCurrentGraphActionTarget(ctx.toolContext),
|
|
1398
|
-
currentChatType: ctx.toolContext?.currentChatType,
|
|
1399
|
-
graphOnly: true,
|
|
1338
|
+
...graphActionTarget,
|
|
1400
1339
|
run: async (target) => {
|
|
1401
|
-
const to = await
|
|
1402
|
-
cfg: ctx.cfg,
|
|
1403
|
-
ctx,
|
|
1404
|
-
target
|
|
1405
|
-
});
|
|
1340
|
+
const to = await authorizeActionTarget(target);
|
|
1406
1341
|
const currentRequesterId = isCurrentMSTeamsReadTarget({
|
|
1407
1342
|
ctx,
|
|
1408
1343
|
target: to
|
|
@@ -1435,11 +1370,7 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
|
|
|
1435
1370
|
const teamId = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(ctx.params.teamId) ?? "";
|
|
1436
1371
|
const channelId = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(ctx.params.channelId) ?? "";
|
|
1437
1372
|
if (!teamId || !channelId) return actionError("channel-info requires teamId and channelId.");
|
|
1438
|
-
const [graphTeamId, graphChannelId] = (await
|
|
1439
|
-
cfg: ctx.cfg,
|
|
1440
|
-
ctx,
|
|
1441
|
-
target: `${teamId}/${channelId}`
|
|
1442
|
-
})).split("/", 2);
|
|
1373
|
+
const [graphTeamId, graphChannelId] = (await authorizeActionTarget(`${teamId}/${channelId}`)).split("/", 2);
|
|
1443
1374
|
if (!graphTeamId || !graphChannelId) throw new Error("Authorized Microsoft Teams channel target is invalid.");
|
|
1444
1375
|
const { getChannelInfoMSTeams } = await loadMSTeamsChannelRuntime();
|
|
1445
1376
|
return jsonMSTeamsOkActionResult("channel-info", { channelInfo: (await getChannelInfoMSTeams({
|
|
@@ -1540,17 +1471,19 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
|
|
|
1540
1471
|
})
|
|
1541
1472
|
}),
|
|
1542
1473
|
gateway: { startAccount: async (ctx) => {
|
|
1543
|
-
const { monitorMSTeamsProvider } = await Promise.resolve().then(() => require("./src-
|
|
1474
|
+
const { monitorMSTeamsProvider } = await Promise.resolve().then(() => require("./src-Bz9wY0Mr.cjs"));
|
|
1544
1475
|
const port = ctx.cfg.channels?.msteams?.webhook?.port ?? 3978;
|
|
1545
|
-
|
|
1476
|
+
const statusSink = (0, openclaw_plugin_sdk_channel_outbound.createAccountStatusSink)({
|
|
1546
1477
|
accountId: ctx.accountId,
|
|
1547
|
-
|
|
1478
|
+
setStatus: ctx.setStatus
|
|
1548
1479
|
});
|
|
1480
|
+
statusSink({ port });
|
|
1549
1481
|
ctx.log?.info(`starting provider (port ${port})`);
|
|
1550
1482
|
return monitorMSTeamsProvider({
|
|
1551
1483
|
cfg: ctx.cfg,
|
|
1552
1484
|
runtime: ctx.runtime,
|
|
1553
|
-
abortSignal: ctx.abortSignal
|
|
1485
|
+
abortSignal: ctx.abortSignal,
|
|
1486
|
+
statusSink
|
|
1554
1487
|
});
|
|
1555
1488
|
} }
|
|
1556
1489
|
},
|
|
@@ -1568,18 +1501,29 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
|
|
|
1568
1501
|
});
|
|
1569
1502
|
}
|
|
1570
1503
|
} },
|
|
1571
|
-
threading: {
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1504
|
+
threading: {
|
|
1505
|
+
matchesToolContextTarget: ({ target, toolContext }) => msteamsContextTargetsMatch(target, toolContext),
|
|
1506
|
+
buildToolContext: ({ context, hasRepliedRef }) => {
|
|
1507
|
+
const nativeChannelId = context.NativeChannelId?.trim();
|
|
1508
|
+
const hasChannelRoute = Boolean(nativeChannelId && nativeChannelId.includes("/"));
|
|
1509
|
+
const isChannel = context.ChatType === "channel";
|
|
1510
|
+
const currentThreadTs = (context.MessageThreadId != null ? (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(String(context.MessageThreadId)) : void 0) ?? (isChannel ? (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(context.ReplyToId) : void 0);
|
|
1511
|
+
return {
|
|
1512
|
+
currentChannelId: (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(context.To),
|
|
1513
|
+
currentChatType: context.ChatType === "direct" || context.ChatType === "group" || context.ChatType === "channel" ? context.ChatType : void 0,
|
|
1514
|
+
currentMessagingTarget: hasChannelRoute ? nativeChannelId : void 0,
|
|
1515
|
+
currentGraphChannelId: hasChannelRoute ? nativeChannelId : void 0,
|
|
1516
|
+
currentThreadTs,
|
|
1517
|
+
...currentThreadTs ? { replyToMode: "all" } : {},
|
|
1518
|
+
hasRepliedRef
|
|
1519
|
+
};
|
|
1520
|
+
},
|
|
1521
|
+
resolveAutoThreadId: ({ cfg, to, toolContext }) => resolveMSTeamsAutoThreadId({
|
|
1522
|
+
cfg: cfg.channels?.msteams,
|
|
1523
|
+
to,
|
|
1524
|
+
toolContext
|
|
1525
|
+
})
|
|
1526
|
+
},
|
|
1583
1527
|
outbound: msteamsChannelOutbound
|
|
1584
1528
|
});
|
|
1585
1529
|
//#endregion
|
|
@@ -1595,36 +1539,12 @@ Object.defineProperty(exports, "buildMSTeamsPresentationCard", {
|
|
|
1595
1539
|
return buildMSTeamsPresentationCard;
|
|
1596
1540
|
}
|
|
1597
1541
|
});
|
|
1598
|
-
Object.defineProperty(exports, "extractMSTeamsConversationMessageId", {
|
|
1599
|
-
enumerable: true,
|
|
1600
|
-
get: function() {
|
|
1601
|
-
return extractMSTeamsConversationMessageId;
|
|
1602
|
-
}
|
|
1603
|
-
});
|
|
1604
|
-
Object.defineProperty(exports, "extractMSTeamsQuoteInfo", {
|
|
1605
|
-
enumerable: true,
|
|
1606
|
-
get: function() {
|
|
1607
|
-
return extractMSTeamsQuoteInfo;
|
|
1608
|
-
}
|
|
1609
|
-
});
|
|
1610
1542
|
Object.defineProperty(exports, "msteamsPlugin", {
|
|
1611
1543
|
enumerable: true,
|
|
1612
1544
|
get: function() {
|
|
1613
1545
|
return msteamsPlugin;
|
|
1614
1546
|
}
|
|
1615
1547
|
});
|
|
1616
|
-
Object.defineProperty(exports, "normalizeMSTeamsConversationId", {
|
|
1617
|
-
enumerable: true,
|
|
1618
|
-
get: function() {
|
|
1619
|
-
return normalizeMSTeamsConversationId;
|
|
1620
|
-
}
|
|
1621
|
-
});
|
|
1622
|
-
Object.defineProperty(exports, "parseMSTeamsActivityTimestamp", {
|
|
1623
|
-
enumerable: true,
|
|
1624
|
-
get: function() {
|
|
1625
|
-
return parseMSTeamsActivityTimestamp;
|
|
1626
|
-
}
|
|
1627
|
-
});
|
|
1628
1548
|
Object.defineProperty(exports, "resolveMSTeamsAllowlistMatch", {
|
|
1629
1549
|
enumerable: true,
|
|
1630
1550
|
get: function() {
|
|
@@ -1649,15 +1569,3 @@ Object.defineProperty(exports, "resolveMSTeamsRouteSessionKey", {
|
|
|
1649
1569
|
return resolveMSTeamsRouteSessionKey;
|
|
1650
1570
|
}
|
|
1651
1571
|
});
|
|
1652
|
-
Object.defineProperty(exports, "stripMSTeamsMentionTags", {
|
|
1653
|
-
enumerable: true,
|
|
1654
|
-
get: function() {
|
|
1655
|
-
return stripMSTeamsMentionTags;
|
|
1656
|
-
}
|
|
1657
|
-
});
|
|
1658
|
-
Object.defineProperty(exports, "wasMSTeamsBotMentioned", {
|
|
1659
|
-
enumerable: true,
|
|
1660
|
-
get: function() {
|
|
1661
|
-
return wasMSTeamsBotMentioned;
|
|
1662
|
-
}
|
|
1663
|
-
});
|