@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.
- package/dist/api.cjs +2 -2
- package/dist/approval-card-B6ZIMO83.cjs +303 -0
- package/dist/approval-handler.runtime-B-ZA6Vjp.cjs +107 -0
- package/dist/{channel-KpWENcgK.cjs → channel-ChmCvkuA.cjs} +157 -46
- package/dist/channel-config-api.cjs +1 -1
- package/dist/channel-plugin-api.cjs +1 -1
- package/dist/{channel.runtime-Bkzj8jZ0.cjs → channel.runtime-D3qqruU3.cjs} +17 -590
- package/dist/{channel.setup-mOFtsfYz.cjs → channel.setup-CKb8aKCV.cjs} +11 -4
- package/dist/{config-schema-C4CszdDi.cjs → config-schema-MyN2lamA.cjs} +12 -11
- package/dist/configured-state.cjs +20 -0
- package/dist/directory-contract-api.cjs +1 -1
- package/dist/doctor-contract-api.cjs +76 -39
- package/dist/{messenger-IISPSOvj.cjs → messenger-Ctb9_CO7.cjs} +10 -158
- package/dist/{oauth-C9So7uld.cjs → oauth-BV7HWGe0.cjs} +1 -1
- package/dist/reaction-types-DtWOWuDN.cjs +149 -0
- package/dist/{resolve-allowlist-CIfWUwuc.cjs → resolve-allowlist-CWbvAW4v.cjs} +21 -47
- package/dist/runtime-api.cjs +2 -1
- package/dist/secret-input-C65t6kjM.cjs +1 -0
- package/dist/send-Bym7IH-v.cjs +627 -0
- package/dist/setup-plugin-api.cjs +1 -1
- package/dist/{src-C127-DcQ.cjs → src-BGhvpEOP.cjs} +146 -18
- package/dist/thread-session-Br3R0ovy.cjs +63 -0
- package/package.json +13 -11
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-D6vf50IK.cjs");
|
|
2
2
|
const require_runtime = require("./runtime-gZTAuFux.cjs");
|
|
3
3
|
require("./runtime-api.cjs");
|
|
4
|
-
const require_resolve_allowlist = require("./resolve-allowlist-
|
|
5
|
-
const require_channel = require("./channel-
|
|
6
|
-
const
|
|
4
|
+
const require_resolve_allowlist = require("./resolve-allowlist-CWbvAW4v.cjs");
|
|
5
|
+
const require_channel = require("./channel-ChmCvkuA.cjs");
|
|
6
|
+
const require_thread_session = require("./thread-session-Br3R0ovy.cjs");
|
|
7
|
+
const require_channel_setup = require("./channel.setup-CKb8aKCV.cjs");
|
|
7
8
|
const require_polls = require("./polls-DvuJvaDG.cjs");
|
|
8
9
|
const require_sso_token_store = require("./sso-token-store-ChhO1f4i.cjs");
|
|
9
|
-
const
|
|
10
|
+
const require_approval_card = require("./approval-card-B6ZIMO83.cjs");
|
|
11
|
+
const require_messenger = require("./messenger-Ctb9_CO7.cjs");
|
|
12
|
+
const require_reaction_types = require("./reaction-types-DtWOWuDN.cjs");
|
|
10
13
|
let openclaw_plugin_sdk_channel_outbound = require("openclaw/plugin-sdk/channel-outbound");
|
|
11
14
|
let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
|
|
12
15
|
let openclaw_plugin_sdk_allow_from = require("openclaw/plugin-sdk/allow-from");
|
|
13
16
|
let openclaw_plugin_sdk_provider_http = require("openclaw/plugin-sdk/provider-http");
|
|
17
|
+
let openclaw_plugin_sdk_account_id = require("openclaw/plugin-sdk/account-id");
|
|
14
18
|
let openclaw_plugin_sdk_media_runtime = require("openclaw/plugin-sdk/media-runtime");
|
|
15
19
|
let openclaw_plugin_sdk_ssrf_runtime = require("openclaw/plugin-sdk/ssrf-runtime");
|
|
16
20
|
let openclaw_plugin_sdk_number_runtime = require("openclaw/plugin-sdk/number-runtime");
|
|
@@ -18,8 +22,10 @@ let openclaw_plugin_sdk_text_utility_runtime = require("openclaw/plugin-sdk/text
|
|
|
18
22
|
let openclaw_plugin_sdk_routing = require("openclaw/plugin-sdk/routing");
|
|
19
23
|
let node_crypto = require("node:crypto");
|
|
20
24
|
node_crypto = require_rolldown_runtime.__toESM(node_crypto, 1);
|
|
25
|
+
let openclaw_plugin_sdk_collection_runtime = require("openclaw/plugin-sdk/collection-runtime");
|
|
21
26
|
let openclaw_plugin_sdk_error_runtime = require("openclaw/plugin-sdk/error-runtime");
|
|
22
27
|
let openclaw_plugin_sdk_channel_inbound = require("openclaw/plugin-sdk/channel-inbound");
|
|
28
|
+
let openclaw_plugin_sdk_approval_gateway_runtime = require("openclaw/plugin-sdk/approval-gateway-runtime");
|
|
23
29
|
let openclaw_plugin_sdk_channel_ingress_runtime = require("openclaw/plugin-sdk/channel-ingress-runtime");
|
|
24
30
|
let openclaw_plugin_sdk_context_visibility_runtime = require("openclaw/plugin-sdk/context-visibility-runtime");
|
|
25
31
|
let openclaw_plugin_sdk_reply_history = require("openclaw/plugin-sdk/reply-history");
|
|
@@ -28,12 +34,11 @@ let openclaw_plugin_sdk_extension_shared = require("openclaw/plugin-sdk/extensio
|
|
|
28
34
|
let openclaw_plugin_sdk_plugin_runtime = require("openclaw/plugin-sdk/plugin-runtime");
|
|
29
35
|
let openclaw_plugin_sdk_dedupe_runtime = require("openclaw/plugin-sdk/dedupe-runtime");
|
|
30
36
|
let openclaw_plugin_sdk_plugin_state_runtime = require("openclaw/plugin-sdk/plugin-state-runtime");
|
|
31
|
-
let openclaw_plugin_sdk_collection_runtime = require("openclaw/plugin-sdk/collection-runtime");
|
|
32
37
|
let openclaw_plugin_sdk_gateway_runtime = require("openclaw/plugin-sdk/gateway-runtime");
|
|
33
38
|
let openclaw_plugin_sdk_channel_pairing = require("openclaw/plugin-sdk/channel-pairing");
|
|
34
|
-
let openclaw_plugin_sdk_account_id = require("openclaw/plugin-sdk/account-id");
|
|
35
39
|
let openclaw_plugin_sdk_runtime_group_policy = require("openclaw/plugin-sdk/runtime-group-policy");
|
|
36
40
|
let openclaw_plugin_sdk_dangerous_name_runtime = require("openclaw/plugin-sdk/dangerous-name-runtime");
|
|
41
|
+
let openclaw_plugin_sdk_account_helpers = require("openclaw/plugin-sdk/account-helpers");
|
|
37
42
|
let openclaw_plugin_sdk_webhook_ingress = require("openclaw/plugin-sdk/webhook-ingress");
|
|
38
43
|
//#region extensions/msteams/src/feedback-reflection-store.ts
|
|
39
44
|
const LEARNINGS_NAMESPACE = "feedback-learnings";
|
|
@@ -166,19 +171,114 @@ function serializeMSTeamsAdaptiveCardActionValue(value) {
|
|
|
166
171
|
}
|
|
167
172
|
}
|
|
168
173
|
//#endregion
|
|
174
|
+
//#region extensions/msteams/src/approval-card-submit.ts
|
|
175
|
+
function isMSTeamsApprovalSubmit(value) {
|
|
176
|
+
if (!(0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(value)) return false;
|
|
177
|
+
if (value.openclawAction === "approval") return true;
|
|
178
|
+
const data = ((0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(value.action) ? value.action : void 0)?.data;
|
|
179
|
+
return (0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(data) && data.openclawAction === "approval";
|
|
180
|
+
}
|
|
181
|
+
async function maybeHandleMSTeamsApprovalCardSubmit(params) {
|
|
182
|
+
const { context, deps } = params;
|
|
183
|
+
if (!isMSTeamsApprovalSubmit(context.activity.value)) return false;
|
|
184
|
+
const ignored = (reason) => deps.log.info("msteams approval ignored", { reason });
|
|
185
|
+
const token = require_approval_card.readMSTeamsApprovalActionToken(context.activity.value);
|
|
186
|
+
if (!token) {
|
|
187
|
+
ignored("missing card token");
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
const binding = require_approval_card.getMSTeamsApprovalCardBinding(token);
|
|
191
|
+
if (!binding) {
|
|
192
|
+
ignored("unknown or expired card token");
|
|
193
|
+
return true;
|
|
194
|
+
}
|
|
195
|
+
if (binding.accountId !== openclaw_plugin_sdk_account_id.DEFAULT_ACCOUNT_ID) {
|
|
196
|
+
ignored("card token account mismatch");
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
if (require_resolve_allowlist.normalizeMSTeamsConversationId(context.activity.conversation?.id ?? "") !== require_resolve_allowlist.normalizeMSTeamsConversationId(binding.conversationId)) {
|
|
200
|
+
ignored("card token conversation mismatch");
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
203
|
+
if (context.activity.replyToId && context.activity.replyToId !== binding.activityId) {
|
|
204
|
+
ignored("card token activity mismatch");
|
|
205
|
+
return true;
|
|
206
|
+
}
|
|
207
|
+
if (!binding.allowedDecisions.includes(binding.decision)) {
|
|
208
|
+
ignored("card token decision is no longer allowed");
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
const senderId = context.activity.from?.aadObjectId;
|
|
212
|
+
if (!(require_thread_session.msTeamsApprovalAuth.authorizeActorAction?.({
|
|
213
|
+
cfg: deps.cfg,
|
|
214
|
+
accountId: openclaw_plugin_sdk_account_id.DEFAULT_ACCOUNT_ID,
|
|
215
|
+
senderId,
|
|
216
|
+
action: "approve",
|
|
217
|
+
approvalKind: binding.approvalKind
|
|
218
|
+
}))?.authorized) {
|
|
219
|
+
ignored(`unauthorized actor ${senderId || "unknown"}`);
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
const claim = require_approval_card.claimMSTeamsApprovalCardBinding(token);
|
|
223
|
+
if (claim.kind !== "claimed") {
|
|
224
|
+
ignored(claim.kind === "in-flight" ? "card token resolve already in flight" : "card token already consumed");
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
227
|
+
const consumed = claim.binding;
|
|
228
|
+
let result;
|
|
229
|
+
try {
|
|
230
|
+
result = await (0, openclaw_plugin_sdk_approval_gateway_runtime.resolveApprovalOverGateway)({
|
|
231
|
+
cfg: deps.cfg,
|
|
232
|
+
approvalId: consumed.approvalId,
|
|
233
|
+
approvalKind: consumed.approvalKind,
|
|
234
|
+
decision: consumed.decision,
|
|
235
|
+
channel: "msteams",
|
|
236
|
+
accountId: openclaw_plugin_sdk_account_id.DEFAULT_ACCOUNT_ID,
|
|
237
|
+
senderId
|
|
238
|
+
});
|
|
239
|
+
await context.updateActivity({
|
|
240
|
+
type: "message",
|
|
241
|
+
id: consumed.activityId,
|
|
242
|
+
attachments: [{
|
|
243
|
+
contentType: "application/vnd.microsoft.card.adaptive",
|
|
244
|
+
content: require_approval_card.buildMSTeamsCanonicalApprovalTerminalCard(result)
|
|
245
|
+
}]
|
|
246
|
+
});
|
|
247
|
+
} catch (error) {
|
|
248
|
+
if ((0, openclaw_plugin_sdk_error_runtime.isApprovalNotFoundError)(error)) {
|
|
249
|
+
require_approval_card.completeMSTeamsApprovalCardBinding(token);
|
|
250
|
+
ignored(`approval expired or no longer exists id=${consumed.approvalId}`);
|
|
251
|
+
return true;
|
|
252
|
+
}
|
|
253
|
+
require_approval_card.releaseMSTeamsApprovalCardBinding(token);
|
|
254
|
+
throw error;
|
|
255
|
+
}
|
|
256
|
+
require_approval_card.completeMSTeamsApprovalCardBinding(token);
|
|
257
|
+
deps.log.info("msteams approval resolved", {
|
|
258
|
+
approvalId: consumed.approvalId,
|
|
259
|
+
approvalKind: consumed.approvalKind,
|
|
260
|
+
applied: result.applied,
|
|
261
|
+
status: result.approval.status,
|
|
262
|
+
senderId
|
|
263
|
+
});
|
|
264
|
+
return true;
|
|
265
|
+
}
|
|
266
|
+
//#endregion
|
|
169
267
|
//#region extensions/msteams/src/monitor-handler/access.ts
|
|
170
268
|
const msteamsIngressIdentity = {
|
|
171
269
|
key: "sender-id",
|
|
270
|
+
authentication: "asserted",
|
|
172
271
|
normalize: normalizeIngressValue,
|
|
173
272
|
aliases: [{
|
|
174
273
|
key: "sender-name",
|
|
175
274
|
kind: "plugin:msteams-sender-name",
|
|
176
275
|
normalizeEntry: normalizeSenderNameIngressValue,
|
|
177
276
|
normalizeSubject: normalizeSenderNameIngressValue,
|
|
178
|
-
|
|
277
|
+
authentication: "mutable"
|
|
179
278
|
}, {
|
|
180
279
|
key: "conversation-id",
|
|
181
280
|
kind: "plugin:msteams-conversation-id",
|
|
281
|
+
authentication: "asserted",
|
|
182
282
|
normalizeEntry: normalizeAllowlistConversationId,
|
|
183
283
|
normalizeSubject: normalizeAllowlistConversationId
|
|
184
284
|
}],
|
|
@@ -243,7 +343,23 @@ async function resolveMSTeamsSenderAccess(params) {
|
|
|
243
343
|
const resolved = await (0, openclaw_plugin_sdk_channel_ingress_runtime.resolveStableChannelMessageIngress)({
|
|
244
344
|
channelId: "msteams",
|
|
245
345
|
accountId: pairing.accountId,
|
|
246
|
-
identity:
|
|
346
|
+
identity: {
|
|
347
|
+
...msteamsIngressIdentity,
|
|
348
|
+
resolveParticipant: () => {
|
|
349
|
+
const tenantId = activity.channelData?.tenant?.id ?? activity.conversation?.tenantId;
|
|
350
|
+
const aadId = activity.from?.aadObjectId;
|
|
351
|
+
if (tenantId && aadId) return {
|
|
352
|
+
domain: `entra:${tenantId.toLowerCase()}`,
|
|
353
|
+
idKind: "object-id",
|
|
354
|
+
id: aadId.toLowerCase()
|
|
355
|
+
};
|
|
356
|
+
return msteamsCfg?.appId && activity.from?.id ? {
|
|
357
|
+
domain: `bot:${msteamsCfg.appId.toLowerCase()}`,
|
|
358
|
+
idKind: "channel-account-id",
|
|
359
|
+
id: activity.from.id
|
|
360
|
+
} : void 0;
|
|
361
|
+
}
|
|
362
|
+
},
|
|
247
363
|
cfg: params.cfg,
|
|
248
364
|
readStoreAllowFrom: pairing.readAllowFromStore,
|
|
249
365
|
subject: {
|
|
@@ -2089,7 +2205,7 @@ function createMSTeamsReplyDispatcher(params) {
|
|
|
2089
2205
|
cfg: params.cfg,
|
|
2090
2206
|
channel: "msteams"
|
|
2091
2207
|
});
|
|
2092
|
-
const mediaMaxBytes = (0,
|
|
2208
|
+
const mediaMaxBytes = (0, openclaw_plugin_sdk_account_helpers.resolveChannelMediaMaxBytes)({
|
|
2093
2209
|
cfg: params.cfg,
|
|
2094
2210
|
resolveChannelLimitMb: ({ cfg }) => cfg.channels?.msteams?.mediaMaxMb
|
|
2095
2211
|
});
|
|
@@ -2842,7 +2958,7 @@ function resolveParentCacheExpiresAt(nowRaw) {
|
|
|
2842
2958
|
* Uses the injected `fetchParent` (defaults to `fetchChannelMessage`) so
|
|
2843
2959
|
* tests can swap in a stub without mocking the Graph transport.
|
|
2844
2960
|
*/
|
|
2845
|
-
async function fetchParentMessageCached(token, groupId, channelId, parentId, fetchParent =
|
|
2961
|
+
async function fetchParentMessageCached(token, groupId, channelId, parentId, fetchParent = require_reaction_types.fetchChannelMessage) {
|
|
2846
2962
|
const key = buildParentCacheKey(groupId, channelId, parentId);
|
|
2847
2963
|
const now = (0, openclaw_plugin_sdk_number_runtime.asDateTimestampMs)(Date.now());
|
|
2848
2964
|
const cached = parentCache.get(key);
|
|
@@ -2872,7 +2988,7 @@ function summarizeParentMessage(message) {
|
|
|
2872
2988
|
const sender = message.from?.user?.displayName ?? message.from?.application?.displayName ?? "unknown";
|
|
2873
2989
|
const contentType = message.body?.contentType ?? "text";
|
|
2874
2990
|
const raw = message.body?.content ?? "";
|
|
2875
|
-
const text = contentType === "html" ?
|
|
2991
|
+
const text = contentType === "html" ? require_reaction_types.stripHtmlFromTeamsMessage(raw) : raw.replace(/\s+/g, " ").trim();
|
|
2876
2992
|
if (!text) return;
|
|
2877
2993
|
return {
|
|
2878
2994
|
sender,
|
|
@@ -2916,7 +3032,7 @@ function prepareMSTeamsThreadRouting(params) {
|
|
|
2916
3032
|
id: params.isDirectMessage ? params.senderId : params.conversationId
|
|
2917
3033
|
}
|
|
2918
3034
|
});
|
|
2919
|
-
route.sessionKey =
|
|
3035
|
+
route.sessionKey = require_thread_session.resolveMSTeamsRouteSessionKey({
|
|
2920
3036
|
baseSessionKey: route.sessionKey,
|
|
2921
3037
|
isChannel: params.isChannel,
|
|
2922
3038
|
conversationMessageId: params.conversationMessageId,
|
|
@@ -2967,7 +3083,7 @@ async function resolveMSTeamsThreadContext(params) {
|
|
|
2967
3083
|
quoteBodyFull = await require_resolve_allowlist.withMSTeamsRequestDeadline({
|
|
2968
3084
|
deadline,
|
|
2969
3085
|
label: "MS Teams quote lookup",
|
|
2970
|
-
work: () =>
|
|
3086
|
+
work: () => require_reaction_types.fetchChatMessageText(graphToken, params.conversationId, quoteMessageId, deadline)
|
|
2971
3087
|
});
|
|
2972
3088
|
} catch (err) {
|
|
2973
3089
|
params.log.debug?.("failed to fetch full quoted message text", { error: require_channel_setup.formatUnknownError(err) });
|
|
@@ -2983,7 +3099,7 @@ async function resolveMSTeamsThreadContext(params) {
|
|
|
2983
3099
|
const [parentResult, repliesResult] = await require_resolve_allowlist.withMSTeamsRequestDeadline({
|
|
2984
3100
|
deadline,
|
|
2985
3101
|
label: "MS Teams thread history",
|
|
2986
|
-
work: () => Promise.allSettled([fetchParentMessageCached(graphToken, teamAadGroupId, params.conversationId, threadParentId, (token, groupId, requestedChannelId, messageId) =>
|
|
3102
|
+
work: () => Promise.allSettled([fetchParentMessageCached(graphToken, teamAadGroupId, params.conversationId, threadParentId, (token, groupId, requestedChannelId, messageId) => require_reaction_types.fetchChannelMessage(token, groupId, requestedChannelId, messageId, deadline)), require_reaction_types.fetchThreadReplies(graphToken, teamAadGroupId, params.conversationId, threadParentId, 50, deadline)])
|
|
2987
3103
|
});
|
|
2988
3104
|
const parentMsg = parentResult.status === "fulfilled" ? parentResult.value : void 0;
|
|
2989
3105
|
const replies = repliesResult.status === "fulfilled" ? repliesResult.value : [];
|
|
@@ -3023,7 +3139,7 @@ async function resolveMSTeamsThreadContext(params) {
|
|
|
3023
3139
|
kind: "thread",
|
|
3024
3140
|
isSenderAllowed: isThreadSenderAllowed
|
|
3025
3141
|
});
|
|
3026
|
-
threadContext =
|
|
3142
|
+
threadContext = require_reaction_types.formatThreadContext(threadMessages, activity.id) || void 0;
|
|
3027
3143
|
} catch (err) {
|
|
3028
3144
|
params.log.debug?.("failed to fetch thread history", { error: require_channel_setup.formatUnknownError(err) });
|
|
3029
3145
|
}
|
|
@@ -3349,7 +3465,7 @@ function createMSTeamsReactionHandler(deps) {
|
|
|
3349
3465
|
const targetMessageId = activity.replyToId ?? "unknown";
|
|
3350
3466
|
for (const reaction of reactions) {
|
|
3351
3467
|
const reactionType = reaction.type ?? "unknown";
|
|
3352
|
-
const emoji =
|
|
3468
|
+
const emoji = require_reaction_types.resolveMSTeamsReactionEmoji(reactionType);
|
|
3353
3469
|
const label = direction === "added" ? `Teams reaction ${emoji} added by ${senderName} on message ${targetMessageId}` : `Teams reaction ${emoji} removed by ${senderName} from message ${targetMessageId}`;
|
|
3354
3470
|
log.info(`reaction ${direction}`, {
|
|
3355
3471
|
sender: senderId,
|
|
@@ -3491,6 +3607,10 @@ function registerMSTeamsHandlers(handler, deps) {
|
|
|
3491
3607
|
if (originalRun) handler.run = async (context, turnAdoptionLifecycle) => {
|
|
3492
3608
|
const ctx = context;
|
|
3493
3609
|
if (ctx.activity?.type === "invoke" && ctx.activity?.name === "adaptiveCard/action") {
|
|
3610
|
+
if (await maybeHandleMSTeamsApprovalCardSubmit({
|
|
3611
|
+
context: ctx,
|
|
3612
|
+
deps
|
|
3613
|
+
})) return;
|
|
3494
3614
|
const text = serializeMSTeamsAdaptiveCardActionValue(ctx.activity?.value);
|
|
3495
3615
|
if (text) return await handleTeamsMessage({
|
|
3496
3616
|
...ctx,
|
|
@@ -3511,7 +3631,15 @@ function registerMSTeamsHandlers(handler, deps) {
|
|
|
3511
3631
|
await next();
|
|
3512
3632
|
};
|
|
3513
3633
|
try {
|
|
3514
|
-
const
|
|
3634
|
+
const ctx = context;
|
|
3635
|
+
if (await maybeHandleMSTeamsApprovalCardSubmit({
|
|
3636
|
+
context: ctx,
|
|
3637
|
+
deps
|
|
3638
|
+
})) {
|
|
3639
|
+
await runNext();
|
|
3640
|
+
return;
|
|
3641
|
+
}
|
|
3642
|
+
const result = await handleTeamsMessage(ctx, turnAdoptionLifecycle);
|
|
3515
3643
|
await runNext();
|
|
3516
3644
|
return result;
|
|
3517
3645
|
} catch (err) {
|
|
@@ -4127,7 +4255,7 @@ async function monitorMSTeamsProvider(opts) {
|
|
|
4127
4255
|
};
|
|
4128
4256
|
const port = msteamsCfg.webhook?.port ?? 3978;
|
|
4129
4257
|
const textLimit = core.channel.text.resolveTextChunkLimit(cfg, "msteams");
|
|
4130
|
-
const mediaMaxBytes = (0,
|
|
4258
|
+
const mediaMaxBytes = (0, openclaw_plugin_sdk_account_helpers.resolveChannelMediaMaxBytes)({
|
|
4131
4259
|
cfg,
|
|
4132
4260
|
resolveChannelLimitMb: ({ cfg: channelCfg }) => channelCfg.channels?.msteams?.mediaMaxMb
|
|
4133
4261
|
}) ?? 8 * 1024 * 1024;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const require_resolve_allowlist = require("./resolve-allowlist-CWbvAW4v.cjs");
|
|
2
|
+
let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
|
|
3
|
+
let openclaw_plugin_sdk_approval_auth_runtime = require("openclaw/plugin-sdk/approval-auth-runtime");
|
|
4
|
+
let openclaw_plugin_sdk_routing = require("openclaw/plugin-sdk/routing");
|
|
5
|
+
//#region extensions/msteams/src/approval-auth.ts
|
|
6
|
+
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;
|
|
7
|
+
function normalizeMSTeamsApproverId(value) {
|
|
8
|
+
const normalized = require_resolve_allowlist.normalizeMSTeamsMessagingTarget(String(value));
|
|
9
|
+
const id = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalLowercaseString)(normalized?.startsWith("user:") ? normalized.slice(5) : normalized);
|
|
10
|
+
return id && MSTEAMS_ID_RE.test(id) ? id : void 0;
|
|
11
|
+
}
|
|
12
|
+
function resolveMSTeamsChannelConfig(cfg) {
|
|
13
|
+
return cfg.channels?.msteams;
|
|
14
|
+
}
|
|
15
|
+
const msTeamsApproval = (0, openclaw_plugin_sdk_approval_auth_runtime.createChannelApprovalAuth)({
|
|
16
|
+
channelLabel: "Microsoft Teams",
|
|
17
|
+
resolveInputs: ({ cfg }) => {
|
|
18
|
+
const channel = resolveMSTeamsChannelConfig(cfg);
|
|
19
|
+
return {
|
|
20
|
+
allowFrom: channel?.allowFrom,
|
|
21
|
+
defaultTo: channel?.defaultTo
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
normalizeApprover: normalizeMSTeamsApproverId,
|
|
25
|
+
normalizeSenderId: (value) => {
|
|
26
|
+
const trimmed = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalLowercaseString)(value);
|
|
27
|
+
if (!trimmed) return;
|
|
28
|
+
return MSTEAMS_ID_RE.test(trimmed) ? trimmed : void 0;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const getMSTeamsApprovalApprovers = msTeamsApproval.resolveApprovers;
|
|
32
|
+
const msTeamsApprovalAuth = msTeamsApproval.approvalAuth;
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region extensions/msteams/src/monitor-handler/thread-session.ts
|
|
35
|
+
const TRAILING_THREAD_SUFFIX = /(?::thread:[^:]+)+$/;
|
|
36
|
+
function resolveMSTeamsRouteSessionKey(params) {
|
|
37
|
+
const channelThreadId = params.isChannel ? params.conversationMessageId ?? params.replyToId ?? void 0 : void 0;
|
|
38
|
+
const cleanBase = params.baseSessionKey.replace(TRAILING_THREAD_SUFFIX, "");
|
|
39
|
+
return (0, openclaw_plugin_sdk_routing.resolveThreadSessionKeys)({
|
|
40
|
+
baseSessionKey: cleanBase,
|
|
41
|
+
threadId: channelThreadId,
|
|
42
|
+
parentSessionKey: channelThreadId ? cleanBase : void 0
|
|
43
|
+
}).sessionKey;
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
Object.defineProperty(exports, "getMSTeamsApprovalApprovers", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
get: function() {
|
|
49
|
+
return getMSTeamsApprovalApprovers;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
Object.defineProperty(exports, "msTeamsApprovalAuth", {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function() {
|
|
55
|
+
return msTeamsApprovalAuth;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
Object.defineProperty(exports, "resolveMSTeamsRouteSessionKey", {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
get: function() {
|
|
61
|
+
return resolveMSTeamsRouteSessionKey;
|
|
62
|
+
}
|
|
63
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/msteams",
|
|
3
|
-
"version": "2026.8.1
|
|
3
|
+
"version": "2026.8.1",
|
|
4
4
|
"description": "OpenClaw Microsoft Teams channel plugin for bot conversations.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,21 +8,21 @@
|
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@azure/identity": "4.13.
|
|
12
|
-
"@microsoft/teams.api": "2.0.
|
|
13
|
-
"@microsoft/teams.apps": "2.0.
|
|
11
|
+
"@azure/identity": "4.13.2",
|
|
12
|
+
"@microsoft/teams.api": "2.0.15",
|
|
13
|
+
"@microsoft/teams.apps": "2.0.15",
|
|
14
14
|
"express": "5.2.1",
|
|
15
|
-
"typebox": "1.3.
|
|
15
|
+
"typebox": "1.3.16",
|
|
16
16
|
"zod": "4.4.3"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@microsoft/teams.common": "2.0.
|
|
19
|
+
"@microsoft/teams.common": "2.0.15",
|
|
20
20
|
"@openclaw/plugin-sdk": "workspace:*",
|
|
21
|
-
"jose": "6.2.
|
|
21
|
+
"jose": "6.2.10",
|
|
22
22
|
"openclaw": "workspace:*"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"openclaw": ">=2026.8.1
|
|
25
|
+
"openclaw": ">=2026.8.1"
|
|
26
26
|
},
|
|
27
27
|
"peerDependenciesMeta": {
|
|
28
28
|
"openclaw": {
|
|
@@ -43,7 +43,9 @@
|
|
|
43
43
|
"MSTEAMS_APP_PASSWORD",
|
|
44
44
|
"MSTEAMS_TENANT_ID"
|
|
45
45
|
]
|
|
46
|
-
}
|
|
46
|
+
},
|
|
47
|
+
"specifier": "./dist/configured-state.cjs",
|
|
48
|
+
"exportName": "hasConfiguredMSTeamsChannelState"
|
|
47
49
|
},
|
|
48
50
|
"label": "Microsoft Teams",
|
|
49
51
|
"selectionLabel": "Microsoft Teams (Teams SDK)",
|
|
@@ -70,10 +72,10 @@
|
|
|
70
72
|
"minHostVersion": ">=2026.4.10"
|
|
71
73
|
},
|
|
72
74
|
"compat": {
|
|
73
|
-
"pluginApi": ">=2026.8.1
|
|
75
|
+
"pluginApi": ">=2026.8.1"
|
|
74
76
|
},
|
|
75
77
|
"build": {
|
|
76
|
-
"openclawVersion": "2026.8.1
|
|
78
|
+
"openclawVersion": "2026.8.1",
|
|
77
79
|
"runtimeFormat": "cjs"
|
|
78
80
|
},
|
|
79
81
|
"release": {
|