@openclaw/msteams 2026.10.5-beta.4 → 2026.10.10-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/.setup/{adapter.runtime-JoPydWqP.cjs → adapter.runtime-B-6Q3nMI.cjs} +6 -4
- package/dist/.setup/{approval-handler.runtime-bUN9icMr.cjs → approval-handler.runtime-DccVf5AY.cjs} +16 -6
- package/dist/.setup/{bot-framework-service-url-CPp4d-Q6.cjs → bot-framework-service-url-B3FWn2SV.cjs} +13 -0
- package/dist/.setup/{channel-Cifn9fsv.cjs → channel-B7Gy3QUW.cjs} +261 -175
- package/dist/.setup/{channel.runtime-DWRAolil.cjs → channel.runtime-DzKeQAqd.cjs} +84 -49
- package/dist/.setup/channel.setup-B5ClEcNI.cjs +990 -0
- package/dist/.setup/config-schema-CkKdphSp.cjs +293 -0
- package/dist/.setup/{conversation-store-state-DprmOfl7.cjs → conversation-store-state-C3__T9mK.cjs} +79 -91
- package/dist/.setup/delegated-state-Bv5cWuec.cjs +110 -0
- package/dist/.setup/{monitor-C9x_CJhY.cjs → monitor-CzRI-Hsc.cjs} +283 -240
- package/dist/.setup/{oauth-CWJ85AMw.cjs → oauth-D9u8sPCD.cjs} +1 -1
- package/dist/.setup/{reaction-types-Ig9sQJuR.cjs → reaction-types-DSQWVA4Z.cjs} +15 -9
- package/dist/.setup/{resolve-allowlist-DdDBVCzl.cjs → resolve-allowlist-tYgAHx0t.cjs} +252 -38
- package/dist/.setup/{secret-contract-api-ChQdBeU1.cjs → secret-contract-api-YY3v6MP8.cjs} +1 -1
- package/dist/.setup/secret-contract-api-wAyY5UHv.cjs +85 -0
- package/dist/.setup/{send-rJpcVtRp.cjs → send-Bgm8RYUa.cjs} +45 -24
- package/dist/.setup/{setup-plugin-api-DfoVOqMJ.cjs → setup-plugin-api-BACfeF7_.cjs} +1 -1
- package/dist/.setup/{thread-session-B74FC1Id.cjs → thread-session-C7KTMwLU.cjs} +11 -4
- package/dist/.setup/token-config-bEpua_Q7.cjs +93 -0
- package/dist/api.cjs +2 -2
- package/dist/channel-config-api.cjs +1 -1
- package/dist/channel-plugin-api.cjs +1 -1
- package/dist/directory-contract-api.cjs +30 -22
- package/dist/doctor-contract-api.cjs +11 -10
- package/dist/qa-runner-api.cjs +1 -1
- package/dist/runtime-api.cjs +2 -2
- package/dist/secret-contract-api.cjs +1 -1
- package/dist/setup-entry.cjs +2 -2
- package/dist/setup-plugin-api.cjs +1 -1
- package/openclaw.plugin.json +715 -0
- package/package.json +57 -6
- package/dist/.setup/channel.setup-BjbHugkL.cjs +0 -632
- package/dist/.setup/config-schema-Dk0mRIam.cjs +0 -160
- package/dist/.setup/secret-contract-api-ipiUsANg.cjs +0 -28
- package/dist/.setup/token-config-CqIh8z7Q.cjs +0 -138
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
const require_token_config = require("./token-config-bEpua_Q7.cjs");
|
|
2
|
+
const require_resolve_allowlist = require("./resolve-allowlist-tYgAHx0t.cjs");
|
|
1
3
|
require("../runtime-api.cjs");
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const require_reaction_types = require("./reaction-types-Ig9sQJuR.cjs");
|
|
4
|
+
const require_delegated_state = require("./delegated-state-Bv5cWuec.cjs");
|
|
5
|
+
const require_channel = require("./channel-B7Gy3QUW.cjs");
|
|
6
|
+
const require_channel_setup = require("./channel.setup-B5ClEcNI.cjs");
|
|
7
|
+
const require_conversation_store_state = require("./conversation-store-state-C3__T9mK.cjs");
|
|
8
|
+
const require_send = require("./send-Bgm8RYUa.cjs");
|
|
9
|
+
const require_reaction_types = require("./reaction-types-DSQWVA4Z.cjs");
|
|
9
10
|
let openclaw_plugin_sdk_channel_outbound = require("openclaw/plugin-sdk/channel-outbound");
|
|
10
11
|
let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
|
|
12
|
+
let openclaw_plugin_sdk_account_id = require("openclaw/plugin-sdk/account-id");
|
|
11
13
|
let openclaw_plugin_sdk_reply_payload = require("openclaw/plugin-sdk/reply-payload");
|
|
12
14
|
let openclaw_plugin_sdk_number_runtime = require("openclaw/plugin-sdk/number-runtime");
|
|
13
15
|
let openclaw_plugin_sdk_channel_inbound = require("openclaw/plugin-sdk/channel-inbound");
|
|
@@ -18,7 +20,7 @@ let openclaw_plugin_sdk_text_chunking = require("openclaw/plugin-sdk/text-chunki
|
|
|
18
20
|
async function listMSTeamsDirectoryPeersLive(params) {
|
|
19
21
|
const query = require_resolve_allowlist.normalizeQuery(params.query);
|
|
20
22
|
if (!query) return [];
|
|
21
|
-
const token = await require_resolve_allowlist.resolveGraphToken(params.cfg);
|
|
23
|
+
const token = await require_resolve_allowlist.resolveGraphToken(params.cfg, { accountId: params.accountId });
|
|
22
24
|
const limit = typeof params.limit === "number" && params.limit > 0 ? params.limit : 20;
|
|
23
25
|
return (await require_resolve_allowlist.searchGraphUsers({
|
|
24
26
|
token,
|
|
@@ -41,7 +43,7 @@ async function listMSTeamsDirectoryPeersLive(params) {
|
|
|
41
43
|
async function listMSTeamsDirectoryGroupsLive(params) {
|
|
42
44
|
const rawQuery = require_resolve_allowlist.normalizeQuery(params.query);
|
|
43
45
|
if (!rawQuery) return [];
|
|
44
|
-
const token = await require_resolve_allowlist.resolveGraphToken(params.cfg);
|
|
46
|
+
const token = await require_resolve_allowlist.resolveGraphToken(params.cfg, { accountId: params.accountId });
|
|
45
47
|
const limit = typeof params.limit === "number" && params.limit > 0 ? params.limit : 20;
|
|
46
48
|
const [teamQuery, channelQuery] = rawQuery.includes("/") ? (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeStringEntries)(rawQuery.split("/", 2)) : [rawQuery, null];
|
|
47
49
|
const normalizedChannelQuery = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeLowercaseStringOrEmpty)(channelQuery);
|
|
@@ -90,12 +92,13 @@ function stripTargetPrefix(raw) {
|
|
|
90
92
|
* actual `19:xxx@thread.*` chat ID that Graph API requires.
|
|
91
93
|
* Conversation IDs and `teamId/channelId` pairs pass through unchanged.
|
|
92
94
|
*/
|
|
93
|
-
async function resolveGraphConversationId(to) {
|
|
95
|
+
async function resolveGraphConversationId(to, options) {
|
|
94
96
|
const trimmed = to.trim();
|
|
95
97
|
const isUserTarget = /^user:/i.test(trimmed);
|
|
96
98
|
const cleaned = stripTargetPrefix(trimmed);
|
|
97
99
|
if (!isUserTarget) return cleaned;
|
|
98
|
-
const
|
|
100
|
+
const accountId = (0, openclaw_plugin_sdk_account_id.normalizeAccountId)(options?.accountId ?? (options?.cfg ? require_resolve_allowlist.resolveDefaultMSTeamsAccountId(options.cfg) : openclaw_plugin_sdk_account_id.DEFAULT_ACCOUNT_ID));
|
|
101
|
+
const found = await require_conversation_store_state.createMSTeamsConversationStoreState({ accountId }).findPreferredDmByUserId(cleaned);
|
|
99
102
|
if (!found) throw new Error(`No conversation found for user:${cleaned}. The bot must receive a message from this user before Graph API operations work.`);
|
|
100
103
|
if (found.conversationId.startsWith("19:")) return found.conversationId;
|
|
101
104
|
throw new Error(`Conversation for user:${cleaned} uses a Bot Framework ID (${found.conversationId}) that Graph API does not accept. Use a Graph-native conversation:19:... target when available.`);
|
|
@@ -120,8 +123,14 @@ function resolveConversationPath(to) {
|
|
|
120
123
|
};
|
|
121
124
|
}
|
|
122
125
|
async function resolveGraphMessageContext(params, options) {
|
|
123
|
-
const token = await require_resolve_allowlist.resolveGraphToken(params.cfg,
|
|
124
|
-
|
|
126
|
+
const token = await require_resolve_allowlist.resolveGraphToken(params.cfg, {
|
|
127
|
+
...options,
|
|
128
|
+
accountId: params.accountId
|
|
129
|
+
});
|
|
130
|
+
const conversationId = await resolveGraphConversationId(params.to, {
|
|
131
|
+
cfg: params.cfg,
|
|
132
|
+
accountId: params.accountId
|
|
133
|
+
});
|
|
125
134
|
return {
|
|
126
135
|
token,
|
|
127
136
|
conversationId,
|
|
@@ -133,9 +142,13 @@ async function resolveGraphPinContext(params, operation) {
|
|
|
133
142
|
if (context.kind === "channel") throw new Error((operation === "list" ? "Listing pinned messages is not supported for channels on Graph v1.0. " : "Pin/unpin is not supported for channel messages on Graph v1.0. ") + "Only chat conversations support pinned messages.");
|
|
134
143
|
return context;
|
|
135
144
|
}
|
|
145
|
+
function resolveMessagePath(conv, params) {
|
|
146
|
+
const messageId = encodeURIComponent(params.messageId);
|
|
147
|
+
return conv.kind === "channel" && params.threadRootId && params.threadRootId !== params.messageId ? `${conv.basePath}/messages/${encodeURIComponent(params.threadRootId)}/replies/${messageId}` : `${conv.basePath}/messages/${messageId}`;
|
|
148
|
+
}
|
|
136
149
|
async function getMessageMSTeams(params) {
|
|
137
|
-
const { token,
|
|
138
|
-
const path =
|
|
150
|
+
const { token, ...conv } = await resolveGraphMessageContext(params);
|
|
151
|
+
const path = resolveMessagePath(conv, params);
|
|
139
152
|
const msg = await require_resolve_allowlist.fetchGraphJson({
|
|
140
153
|
token,
|
|
141
154
|
path
|
|
@@ -198,10 +211,10 @@ async function listPinsMSTeams(params) {
|
|
|
198
211
|
}
|
|
199
212
|
async function mutateMessageReaction(params, operation) {
|
|
200
213
|
const reactionType = require_reaction_types.resolveMSTeamsReactionEmoji(params.reactionType);
|
|
201
|
-
const { token,
|
|
214
|
+
const { token, ...conv } = await resolveGraphMessageContext(params, { preferDelegated: true });
|
|
202
215
|
await require_resolve_allowlist.mutateGraphJson({
|
|
203
216
|
token,
|
|
204
|
-
path: `${
|
|
217
|
+
path: `${resolveMessagePath(conv, params)}/${operation}`,
|
|
205
218
|
method: "POST",
|
|
206
219
|
body: { reactionType },
|
|
207
220
|
beta: true
|
|
@@ -219,8 +232,8 @@ function unreactMessageMSTeams(params) {
|
|
|
219
232
|
* Uses Graph v1.0 (reactions are included in the message resource).
|
|
220
233
|
*/
|
|
221
234
|
async function listReactionsMSTeams(params) {
|
|
222
|
-
const { token,
|
|
223
|
-
const path =
|
|
235
|
+
const { token, ...conv } = await resolveGraphMessageContext(params);
|
|
236
|
+
const path = resolveMessagePath(conv, params);
|
|
224
237
|
const msg = await require_resolve_allowlist.fetchGraphJson({
|
|
225
238
|
token,
|
|
226
239
|
path
|
|
@@ -234,9 +247,10 @@ async function listReactionsMSTeams(params) {
|
|
|
234
247
|
});
|
|
235
248
|
const group = grouped.get(type);
|
|
236
249
|
group.count++;
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
250
|
+
const user = reaction.user?.user;
|
|
251
|
+
if (user?.id) group.users.push({
|
|
252
|
+
id: user.id,
|
|
253
|
+
displayName: user.displayName ?? void 0
|
|
240
254
|
});
|
|
241
255
|
}
|
|
242
256
|
return { reactions: Array.from(grouped.entries()).map(([type, group]) => ({
|
|
@@ -314,7 +328,10 @@ async function searchMessagesMSTeams(params) {
|
|
|
314
328
|
//#region extensions/msteams/src/graph-conversation-members.ts
|
|
315
329
|
const MAX_CONVERSATION_MEMBER_PAGES = 100;
|
|
316
330
|
async function findMSTeamsConversationMember(params) {
|
|
317
|
-
const conversationId = await resolveGraphConversationId(params.to
|
|
331
|
+
const conversationId = await resolveGraphConversationId(params.to, {
|
|
332
|
+
cfg: params.cfg,
|
|
333
|
+
accountId: params.accountId
|
|
334
|
+
});
|
|
318
335
|
const conversation = resolveConversationPath(conversationId);
|
|
319
336
|
const userId = params.userId.trim().toLowerCase();
|
|
320
337
|
const result = await require_resolve_allowlist.fetchAllGraphPages({
|
|
@@ -339,17 +356,15 @@ function resolveConversationMemberRoles(role, kind) {
|
|
|
339
356
|
return normalized === "owner" ? ["owner"] : [];
|
|
340
357
|
}
|
|
341
358
|
async function addParticipantMSTeams(params) {
|
|
342
|
-
const token = await
|
|
343
|
-
const conversationId = await resolveGraphConversationId(params.to);
|
|
344
|
-
const conv = resolveConversationPath(conversationId);
|
|
359
|
+
const { token, conversationId, kind, basePath } = await resolveGraphMessageContext(params);
|
|
345
360
|
const body = {
|
|
346
361
|
"@odata.type": "#microsoft.graph.aadUserConversationMember",
|
|
347
|
-
roles: resolveConversationMemberRoles(params.role,
|
|
362
|
+
roles: resolveConversationMemberRoles(params.role, kind),
|
|
348
363
|
"user@odata.bind": `https://graph.microsoft.com/v1.0/users('${require_resolve_allowlist.escapeOData(params.userId)}')`
|
|
349
364
|
};
|
|
350
365
|
await require_resolve_allowlist.mutateGraphJson({
|
|
351
366
|
token,
|
|
352
|
-
path: `${
|
|
367
|
+
path: `${basePath}/members`,
|
|
353
368
|
method: "POST",
|
|
354
369
|
body
|
|
355
370
|
});
|
|
@@ -363,10 +378,12 @@ async function addParticipantMSTeams(params) {
|
|
|
363
378
|
* Lists members first to resolve the membership ID, then deletes.
|
|
364
379
|
*/
|
|
365
380
|
async function removeParticipantMSTeams(params) {
|
|
366
|
-
const token = await require_resolve_allowlist.resolveGraphToken(params.cfg);
|
|
381
|
+
const token = await require_resolve_allowlist.resolveGraphToken(params.cfg, { accountId: params.accountId });
|
|
367
382
|
const { conversationId, member } = await findMSTeamsConversationMember({
|
|
368
383
|
token,
|
|
369
384
|
to: params.to,
|
|
385
|
+
cfg: params.cfg,
|
|
386
|
+
accountId: params.accountId,
|
|
370
387
|
userId: params.userId
|
|
371
388
|
});
|
|
372
389
|
if (!member?.id) throw new Error(`User ${params.userId} is not a member of this conversation`);
|
|
@@ -381,13 +398,11 @@ async function removeParticipantMSTeams(params) {
|
|
|
381
398
|
} };
|
|
382
399
|
}
|
|
383
400
|
async function renameGroupMSTeams(params) {
|
|
384
|
-
const token = await
|
|
385
|
-
const
|
|
386
|
-
const conv = resolveConversationPath(conversationId);
|
|
387
|
-
const body = conv.kind === "chat" ? { topic: params.name } : { displayName: params.name };
|
|
401
|
+
const { token, conversationId, kind, basePath } = await resolveGraphMessageContext(params);
|
|
402
|
+
const body = kind === "chat" ? { topic: params.name } : { displayName: params.name };
|
|
388
403
|
await require_resolve_allowlist.mutateGraphJson({
|
|
389
404
|
token,
|
|
390
|
-
path:
|
|
405
|
+
path: basePath,
|
|
391
406
|
method: "PATCH",
|
|
392
407
|
body
|
|
393
408
|
});
|
|
@@ -430,9 +445,12 @@ async function getMemberInfoMSTeams(params) {
|
|
|
430
445
|
officeLocation: void 0,
|
|
431
446
|
roles: []
|
|
432
447
|
} };
|
|
433
|
-
const conversation = resolveConversationPath(await resolveGraphConversationId(params.to
|
|
448
|
+
const conversation = resolveConversationPath(await resolveGraphConversationId(params.to, {
|
|
449
|
+
cfg: params.cfg,
|
|
450
|
+
accountId: params.accountId
|
|
451
|
+
}));
|
|
434
452
|
const member = conversation.kind === "channel" ? await findStandardChannelMember({
|
|
435
|
-
token: await require_resolve_allowlist.resolveGraphToken(params.cfg),
|
|
453
|
+
token: await require_resolve_allowlist.resolveGraphToken(params.cfg, { accountId: params.accountId }),
|
|
436
454
|
conversation,
|
|
437
455
|
userId: params.userId
|
|
438
456
|
}) : void 0;
|
|
@@ -450,7 +468,7 @@ async function getMemberInfoMSTeams(params) {
|
|
|
450
468
|
//#endregion
|
|
451
469
|
//#region extensions/msteams/src/graph-teams.ts
|
|
452
470
|
async function listChannelsMSTeams(params) {
|
|
453
|
-
const token = await require_resolve_allowlist.resolveGraphToken(params.cfg);
|
|
471
|
+
const token = await require_resolve_allowlist.resolveGraphToken(params.cfg, { accountId: params.accountId });
|
|
454
472
|
const result = await require_resolve_allowlist.fetchAllGraphPages({
|
|
455
473
|
token,
|
|
456
474
|
path: `/teams/${encodeURIComponent(params.teamId)}/channels?$select=id,displayName,description,membershipType`,
|
|
@@ -467,7 +485,7 @@ async function listChannelsMSTeams(params) {
|
|
|
467
485
|
};
|
|
468
486
|
}
|
|
469
487
|
async function getChannelInfoMSTeams(params) {
|
|
470
|
-
const token = await require_resolve_allowlist.resolveGraphToken(params.cfg);
|
|
488
|
+
const token = await require_resolve_allowlist.resolveGraphToken(params.cfg, { accountId: params.accountId });
|
|
471
489
|
const path = `/teams/${encodeURIComponent(params.teamId)}/channels/${encodeURIComponent(params.channelId)}?$select=id,displayName,description,membershipType,webUrl,createdDateTime`;
|
|
472
490
|
const ch = await require_resolve_allowlist.fetchGraphJson({
|
|
473
491
|
token,
|
|
@@ -532,12 +550,19 @@ function resolveMSTeamsThreadTarget(to, threadId) {
|
|
|
532
550
|
return `${to};messageid=${normalizedThreadId}`;
|
|
533
551
|
}
|
|
534
552
|
function resolveMSTeamsSend(params) {
|
|
535
|
-
|
|
553
|
+
const accountId = (0, openclaw_plugin_sdk_account_id.normalizeAccountId)(params.accountId ?? require_resolve_allowlist.resolveDefaultMSTeamsAccountId(params.cfg));
|
|
554
|
+
const send = (0, openclaw_plugin_sdk_channel_outbound.resolveOutboundSendDep)(params.deps, "msteams");
|
|
555
|
+
return (to, text, opts) => send ? send(to, text, {
|
|
556
|
+
...opts,
|
|
536
557
|
cfg: params.cfg,
|
|
558
|
+
accountId
|
|
559
|
+
}) : require_send.sendMessageMSTeams({
|
|
560
|
+
...opts,
|
|
561
|
+
cfg: params.cfg,
|
|
562
|
+
accountId,
|
|
537
563
|
to,
|
|
538
|
-
text
|
|
539
|
-
|
|
540
|
-
}));
|
|
564
|
+
text
|
|
565
|
+
});
|
|
541
566
|
}
|
|
542
567
|
async function sendMSTeamsOutbound(ctx, includeMedia) {
|
|
543
568
|
const send = resolveMSTeamsSend(ctx);
|
|
@@ -573,7 +598,8 @@ const msteamsOutbound = {
|
|
|
573
598
|
}
|
|
574
599
|
};
|
|
575
600
|
},
|
|
576
|
-
sendPayload: async ({ cfg, to, text, mediaUrl, mediaAccess, mediaLocalRoots, mediaReadFile, payload, deps, onDeliveryResult, assertDirectAdapterHandoff, onPlatformSendDispatch, threadId }) => {
|
|
601
|
+
sendPayload: async ({ cfg, to, text, mediaUrl, mediaAccess, mediaLocalRoots, mediaReadFile, payload, accountId, deps, onDeliveryResult, assertDirectAdapterHandoff, onPlatformSendDispatch, threadId }) => {
|
|
602
|
+
const effectiveAccountId = (0, openclaw_plugin_sdk_account_id.normalizeAccountId)(accountId ?? require_resolve_allowlist.resolveDefaultMSTeamsAccountId(cfg));
|
|
577
603
|
const handoff = {
|
|
578
604
|
assertDirectAdapterHandoff,
|
|
579
605
|
onPlatformSendDispatch
|
|
@@ -585,6 +611,7 @@ const msteamsOutbound = {
|
|
|
585
611
|
if (presentationCard) {
|
|
586
612
|
const result = await sendWithDeliveryResults((report) => require_send.sendAdaptiveCardMSTeams({
|
|
587
613
|
cfg,
|
|
614
|
+
accountId: effectiveAccountId,
|
|
588
615
|
to: deliveryTarget,
|
|
589
616
|
card: presentationCard,
|
|
590
617
|
...handoff,
|
|
@@ -599,6 +626,7 @@ const msteamsOutbound = {
|
|
|
599
626
|
if (mediaUrls.length > 0) {
|
|
600
627
|
const send = resolveMSTeamsSend({
|
|
601
628
|
cfg,
|
|
629
|
+
accountId: effectiveAccountId,
|
|
602
630
|
deps
|
|
603
631
|
});
|
|
604
632
|
const result = await (0, openclaw_plugin_sdk_reply_payload.sendPayloadMediaSequence)({
|
|
@@ -618,9 +646,10 @@ const msteamsOutbound = {
|
|
|
618
646
|
if (text.trim()) {
|
|
619
647
|
const send = resolveMSTeamsSend({
|
|
620
648
|
cfg,
|
|
649
|
+
accountId: effectiveAccountId,
|
|
621
650
|
deps
|
|
622
651
|
});
|
|
623
|
-
const chunks = (0, openclaw_plugin_sdk_reply_payload.resolveTextChunksWithFallback)(text, (0, openclaw_plugin_sdk_text_chunking.chunkTextForOutbound)(text, require_channel.resolveMSTeamsEffectiveTextChunkLimit(cfg.
|
|
652
|
+
const chunks = (0, openclaw_plugin_sdk_reply_payload.resolveTextChunksWithFallback)(text, (0, openclaw_plugin_sdk_text_chunking.chunkTextForOutbound)(text, require_channel.resolveMSTeamsEffectiveTextChunkLimit(require_resolve_allowlist.resolveMSTeamsAccountConfig(cfg, effectiveAccountId).textChunkLimit)));
|
|
624
653
|
let result;
|
|
625
654
|
for (const chunk of chunks) result = await sendWithDeliveryResults((report) => send(deliveryTarget, chunk, {
|
|
626
655
|
...handoff,
|
|
@@ -634,10 +663,12 @@ const msteamsOutbound = {
|
|
|
634
663
|
channel: "msteams",
|
|
635
664
|
sendText: (ctx) => sendMSTeamsOutbound(ctx, false),
|
|
636
665
|
sendMedia: (ctx) => sendMSTeamsOutbound(ctx, true),
|
|
637
|
-
sendPoll: async ({ cfg, to, poll, threadId, assertDirectAdapterHandoff, onPlatformSendDispatch }) => {
|
|
666
|
+
sendPoll: async ({ cfg, to, poll, accountId, threadId, assertDirectAdapterHandoff, onPlatformSendDispatch }) => {
|
|
667
|
+
const effectiveAccountId = (0, openclaw_plugin_sdk_account_id.normalizeAccountId)(accountId ?? require_resolve_allowlist.resolveDefaultMSTeamsAccountId(cfg));
|
|
638
668
|
const maxSelections = poll.maxSelections ?? 1;
|
|
639
669
|
const result = await require_send.sendPollMSTeams({
|
|
640
670
|
cfg,
|
|
671
|
+
accountId: effectiveAccountId,
|
|
641
672
|
to: resolveMSTeamsThreadTarget(to, threadId),
|
|
642
673
|
question: poll.question,
|
|
643
674
|
options: poll.options,
|
|
@@ -645,7 +676,7 @@ const msteamsOutbound = {
|
|
|
645
676
|
assertDirectAdapterHandoff,
|
|
646
677
|
onPlatformSendDispatch
|
|
647
678
|
});
|
|
648
|
-
await require_conversation_store_state.createMSTeamsPollStoreState().createPoll({
|
|
679
|
+
await require_conversation_store_state.createMSTeamsPollStoreState({ accountId: effectiveAccountId }).createPoll({
|
|
649
680
|
id: result.pollId,
|
|
650
681
|
question: poll.question,
|
|
651
682
|
options: poll.options,
|
|
@@ -682,8 +713,12 @@ function readStringArray(value) {
|
|
|
682
713
|
function readScopes(value) {
|
|
683
714
|
return typeof value === "string" ? readStringArray(value.split(/\s+/)) : void 0;
|
|
684
715
|
}
|
|
685
|
-
async function probeMSTeams(cfg) {
|
|
686
|
-
const
|
|
716
|
+
async function probeMSTeams(cfg, params) {
|
|
717
|
+
const accountId = (0, openclaw_plugin_sdk_account_id.normalizeAccountId)(params?.accountId ?? openclaw_plugin_sdk_account_id.DEFAULT_ACCOUNT_ID);
|
|
718
|
+
const creds = require_token_config.resolveMSTeamsCredentials(cfg, {
|
|
719
|
+
allowEnvFallback: accountId === openclaw_plugin_sdk_account_id.DEFAULT_ACCOUNT_ID,
|
|
720
|
+
pathPrefix: accountId === openclaw_plugin_sdk_account_id.DEFAULT_ACCOUNT_ID ? "channels.msteams" : `channels.msteams.accounts.${accountId}`
|
|
721
|
+
});
|
|
687
722
|
if (!creds) return {
|
|
688
723
|
ok: false,
|
|
689
724
|
error: "missing credentials (appId, appPassword, tenantId)"
|
|
@@ -715,7 +750,7 @@ async function probeMSTeams(cfg) {
|
|
|
715
750
|
}
|
|
716
751
|
let delegatedAuth;
|
|
717
752
|
if (cfg?.delegatedAuth?.enabled) try {
|
|
718
|
-
const tokens = await
|
|
753
|
+
const tokens = await require_delegated_state.loadMSTeamsDelegatedTokens(accountId);
|
|
719
754
|
if (tokens) {
|
|
720
755
|
const isExpired = !(0, openclaw_plugin_sdk_number_runtime.isFutureDateTimestampMs)(tokens.expiresAt);
|
|
721
756
|
delegatedAuth = {
|