@openclaw/msteams 2026.10.1 → 2026.10.5-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.setup/{adapter.runtime-D0HYByze.cjs → adapter.runtime-JoPydWqP.cjs} +1 -1
- package/dist/.setup/{approval-handler.runtime-C-RJ3wXc.cjs → approval-handler.runtime-bUN9icMr.cjs} +3 -3
- package/dist/.setup/{bot-framework-service-url-BUhTe8F3.cjs → bot-framework-service-url-CPp4d-Q6.cjs} +1 -5
- package/dist/.setup/{channel-BFhXodl2.cjs → channel-Cifn9fsv.cjs} +230 -430
- package/dist/.setup/{channel.runtime-D9jrw2SN.cjs → channel.runtime-DWRAolil.cjs} +70 -44
- package/dist/.setup/{channel.setup-ss0TO-ap.cjs → channel.setup-BjbHugkL.cjs} +5 -7
- package/dist/.setup/{config-schema-0KoBzb0t.cjs → config-schema-Dk0mRIam.cjs} +1 -1
- package/dist/.setup/{conversation-store-state-f7V8CVNy.cjs → conversation-store-state-DprmOfl7.cjs} +103 -236
- package/dist/.setup/{monitor-DfSPCRkk.cjs → monitor-C9x_CJhY.cjs} +173 -322
- package/dist/.setup/oauth-CWJ85AMw.cjs +55 -0
- package/dist/.setup/{reaction-types-B-GEv57k.cjs → reaction-types-Ig9sQJuR.cjs} +3 -3
- package/dist/.setup/{resolve-allowlist-Ct9yxQUw.cjs → resolve-allowlist-DdDBVCzl.cjs} +77 -174
- package/dist/.setup/{send-7VV1iCai.cjs → send-rJpcVtRp.cjs} +8 -9
- package/dist/.setup/{setup-plugin-api-B0OFG32J.cjs → setup-plugin-api-DfoVOqMJ.cjs} +1 -1
- package/dist/.setup/{thread-session-ClI-lSyG.cjs → thread-session-B74FC1Id.cjs} +1 -1
- package/dist/.setup/{token-config-DOt3XwVa.cjs → token-config-CqIh8z7Q.cjs} +6 -7
- 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 +2 -2
- package/dist/doctor-contract-api.cjs +1 -1
- package/dist/qa-runner-api.cjs +9 -10
- package/dist/setup-entry.cjs +1 -1
- package/dist/setup-plugin-api.cjs +1 -1
- package/package.json +4 -4
- package/dist/.setup/oauth-CYxMYIOQ.cjs +0 -102
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-BloeesfJ.cjs");
|
|
2
2
|
require("../runtime-api.cjs");
|
|
3
|
-
const require_resolve_allowlist = require("./resolve-allowlist-
|
|
3
|
+
const require_resolve_allowlist = require("./resolve-allowlist-DdDBVCzl.cjs");
|
|
4
4
|
const require_directory_contract_api = require("../directory-contract-api.cjs");
|
|
5
|
-
const require_thread_session = require("./thread-session-
|
|
6
|
-
const require_channel_setup = require("./channel.setup-
|
|
5
|
+
const require_thread_session = require("./thread-session-B74FC1Id.cjs");
|
|
6
|
+
const require_channel_setup = require("./channel.setup-BjbHugkL.cjs");
|
|
7
7
|
let openclaw_plugin_sdk_approval_handler_adapter_runtime = require("openclaw/plugin-sdk/approval-handler-adapter-runtime");
|
|
8
8
|
let openclaw_plugin_sdk_channel_actions = require("openclaw/plugin-sdk/channel-actions");
|
|
9
9
|
let openclaw_plugin_sdk_channel_core = require("openclaw/plugin-sdk/channel-core");
|
|
@@ -80,76 +80,17 @@ function actionError(message) {
|
|
|
80
80
|
}
|
|
81
81
|
//#endregion
|
|
82
82
|
//#region extensions/msteams/src/policy.ts
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
for (const [teamKey, team] of Object.entries(teams ?? {})) {
|
|
88
|
-
scopes[teamScopeKey(teamKey)] = {
|
|
89
|
-
tools: team.tools,
|
|
90
|
-
toolsBySender: team.toolsBySender
|
|
91
|
-
};
|
|
92
|
-
for (const [channelKey, channel] of Object.entries(team.channels ?? {})) scopes[channelScopeKey(teamKey, channelKey)] = {
|
|
93
|
-
tools: channel.tools,
|
|
94
|
-
toolsBySender: channel.toolsBySender
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
return { scopes };
|
|
98
|
-
}
|
|
99
|
-
function resolveMSTeamsToolPolicyScope(params) {
|
|
100
|
-
const teams = params.cfg.teams ?? {};
|
|
101
|
-
const tree = buildMSTeamsToolPolicyTree(teams);
|
|
102
|
-
const teamMatch = (0, openclaw_plugin_sdk_channel_targets.resolveChannelEntryMatchWithFallback)({
|
|
103
|
-
entries: teams,
|
|
104
|
-
keys: (0, openclaw_plugin_sdk_channel_targets.buildChannelKeyCandidates)(params.groupSpace?.trim()),
|
|
83
|
+
function matchMSTeamsPolicyEntry(entries, ...keys) {
|
|
84
|
+
return (0, openclaw_plugin_sdk_channel_targets.resolveChannelEntryMatchWithFallback)({
|
|
85
|
+
entries,
|
|
86
|
+
keys: (0, openclaw_plugin_sdk_channel_targets.buildChannelKeyCandidates)(...keys),
|
|
105
87
|
wildcardKey: "*",
|
|
106
88
|
normalizeKey: openclaw_plugin_sdk_channel_targets.normalizeChannelSlug
|
|
107
89
|
});
|
|
108
|
-
const matchedTeamKey = teamMatch.matchKey ?? teamMatch.key;
|
|
109
|
-
if (teamMatch.entry && matchedTeamKey) {
|
|
110
|
-
const channelMatch = (0, openclaw_plugin_sdk_channel_targets.resolveChannelEntryMatchWithFallback)({
|
|
111
|
-
entries: teamMatch.entry.channels ?? {},
|
|
112
|
-
keys: (0, openclaw_plugin_sdk_channel_targets.buildChannelKeyCandidates)(params.groupId?.trim()),
|
|
113
|
-
wildcardKey: "*",
|
|
114
|
-
normalizeKey: openclaw_plugin_sdk_channel_targets.normalizeChannelSlug
|
|
115
|
-
});
|
|
116
|
-
const matchedChannelKey = channelMatch.matchKey ?? channelMatch.key;
|
|
117
|
-
return {
|
|
118
|
-
tree,
|
|
119
|
-
path: [teamScopeKey(matchedTeamKey), ...channelMatch.entry && matchedChannelKey ? [channelScopeKey(matchedTeamKey, matchedChannelKey)] : []]
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
return {
|
|
123
|
-
tree,
|
|
124
|
-
path: []
|
|
125
|
-
};
|
|
126
90
|
}
|
|
127
|
-
function
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
const groupId = params.groupId?.trim();
|
|
131
|
-
if (!groupId) return {
|
|
132
|
-
tree,
|
|
133
|
-
path: []
|
|
134
|
-
};
|
|
135
|
-
const channelCandidates = (0, openclaw_plugin_sdk_channel_targets.buildChannelKeyCandidates)(groupId);
|
|
136
|
-
for (const [teamKey, team] of Object.entries(teams)) {
|
|
137
|
-
const channelMatch = (0, openclaw_plugin_sdk_channel_targets.resolveChannelEntryMatchWithFallback)({
|
|
138
|
-
entries: team.channels ?? {},
|
|
139
|
-
keys: channelCandidates,
|
|
140
|
-
wildcardKey: "*",
|
|
141
|
-
normalizeKey: openclaw_plugin_sdk_channel_targets.normalizeChannelSlug
|
|
142
|
-
});
|
|
143
|
-
const matchedChannelKey = channelMatch.matchKey ?? channelMatch.key;
|
|
144
|
-
if (channelMatch.entry && matchedChannelKey) return {
|
|
145
|
-
tree,
|
|
146
|
-
path: [teamScopeKey(teamKey), channelScopeKey(teamKey, matchedChannelKey)]
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
return {
|
|
150
|
-
tree,
|
|
151
|
-
path: []
|
|
152
|
-
};
|
|
91
|
+
function selectMSTeamsPolicyEntry(entries, key) {
|
|
92
|
+
const match = matchMSTeamsPolicyEntry(entries, key?.trim());
|
|
93
|
+
return match.matchKey ?? match.key ? match.entry : void 0;
|
|
153
94
|
}
|
|
154
95
|
function resolveMSTeamsRouteConfig(params) {
|
|
155
96
|
const teamId = params.teamId?.trim();
|
|
@@ -158,23 +99,11 @@ function resolveMSTeamsRouteConfig(params) {
|
|
|
158
99
|
const channelName = params.channelName?.trim();
|
|
159
100
|
const teams = params.cfg?.teams ?? {};
|
|
160
101
|
const allowlistConfigured = Object.keys(teams).length > 0;
|
|
161
|
-
const
|
|
162
|
-
const teamMatch = (0, openclaw_plugin_sdk_channel_targets.resolveChannelEntryMatchWithFallback)({
|
|
163
|
-
entries: teams,
|
|
164
|
-
keys: teamCandidates,
|
|
165
|
-
wildcardKey: "*",
|
|
166
|
-
normalizeKey: openclaw_plugin_sdk_channel_targets.normalizeChannelSlug
|
|
167
|
-
});
|
|
102
|
+
const teamMatch = matchMSTeamsPolicyEntry(teams, teamId, params.allowNameMatching ? teamName : void 0, params.allowNameMatching && teamName ? (0, openclaw_plugin_sdk_channel_targets.normalizeChannelSlug)(teamName) : void 0);
|
|
168
103
|
const teamConfig = teamMatch.entry;
|
|
169
104
|
const channels = teamConfig?.channels ?? {};
|
|
170
105
|
const channelAllowlistConfigured = Object.keys(channels).length > 0;
|
|
171
|
-
const
|
|
172
|
-
const channelMatch = (0, openclaw_plugin_sdk_channel_targets.resolveChannelEntryMatchWithFallback)({
|
|
173
|
-
entries: channels,
|
|
174
|
-
keys: channelCandidates,
|
|
175
|
-
wildcardKey: "*",
|
|
176
|
-
normalizeKey: openclaw_plugin_sdk_channel_targets.normalizeChannelSlug
|
|
177
|
-
});
|
|
106
|
+
const channelMatch = matchMSTeamsPolicyEntry(channels, conversationId, params.allowNameMatching ? channelName : void 0, params.allowNameMatching && channelName ? (0, openclaw_plugin_sdk_channel_targets.normalizeChannelSlug)(channelName) : void 0);
|
|
178
107
|
const channelConfig = channelMatch.entry;
|
|
179
108
|
return {
|
|
180
109
|
teamConfig,
|
|
@@ -195,32 +124,27 @@ function resolveMSTeamsRouteConfig(params) {
|
|
|
195
124
|
function resolveMSTeamsGroupToolPolicy(params) {
|
|
196
125
|
const cfg = params.cfg.channels?.msteams;
|
|
197
126
|
if (!cfg) return;
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
127
|
+
const teams = cfg.teams ?? {};
|
|
128
|
+
const team = selectMSTeamsPolicyEntry(teams, params.groupSpace);
|
|
129
|
+
const channel = team && selectMSTeamsPolicyEntry(team.channels ?? {}, params.groupId);
|
|
130
|
+
const resolve = (selectedTeam, selectedChannel) => (0, openclaw_plugin_sdk_channel_policy.resolveScopeToolsPolicy)({
|
|
131
|
+
tree: { scopes: {
|
|
132
|
+
team: selectedTeam ?? {},
|
|
133
|
+
channel: selectedChannel ?? {}
|
|
134
|
+
} },
|
|
135
|
+
path: ["team", "channel"],
|
|
204
136
|
senderPolicyMode: params.senderPolicyMode,
|
|
205
137
|
senderId: params.senderId,
|
|
206
138
|
senderName: params.senderName,
|
|
207
139
|
senderUsername: params.senderUsername,
|
|
208
140
|
senderE164: params.senderE164
|
|
209
|
-
};
|
|
210
|
-
const resolved = (0, openclaw_plugin_sdk_channel_policy.resolveScopeToolsPolicy)({
|
|
211
|
-
...scope,
|
|
212
|
-
...senderScope
|
|
213
|
-
});
|
|
214
|
-
if (resolved !== void 0) return resolved;
|
|
215
|
-
if (scope.path.length > 1) return;
|
|
216
|
-
const scanScope = resolveMSTeamsCrossTeamScanScope({
|
|
217
|
-
cfg,
|
|
218
|
-
groupId: params.groupId
|
|
219
|
-
});
|
|
220
|
-
return (0, openclaw_plugin_sdk_channel_policy.resolveScopeToolsPolicy)({
|
|
221
|
-
...scanScope,
|
|
222
|
-
...senderScope
|
|
223
141
|
});
|
|
142
|
+
const resolved = resolve(team, channel);
|
|
143
|
+
if (resolved !== void 0 || channel) return resolved;
|
|
144
|
+
if (params.groupId?.trim()) for (const candidate of Object.values(teams)) {
|
|
145
|
+
const matched = selectMSTeamsPolicyEntry(candidate.channels ?? {}, params.groupId);
|
|
146
|
+
if (matched) return resolve(candidate, matched);
|
|
147
|
+
}
|
|
224
148
|
}
|
|
225
149
|
function resolveMSTeamsReplyPolicy(params) {
|
|
226
150
|
if (params.isDirectMessage) return {
|
|
@@ -379,7 +303,7 @@ const msTeamsLazyApprovalNativeRuntime = (0, openclaw_plugin_sdk_approval_handle
|
|
|
379
303
|
request
|
|
380
304
|
}),
|
|
381
305
|
load: async () => {
|
|
382
|
-
const { msTeamsApprovalNativeRuntime } = await Promise.resolve().then(() => require("./approval-handler.runtime-
|
|
306
|
+
const { msTeamsApprovalNativeRuntime } = await Promise.resolve().then(() => require("./approval-handler.runtime-bUN9icMr.cjs"));
|
|
383
307
|
return msTeamsApprovalNativeRuntime;
|
|
384
308
|
}
|
|
385
309
|
});
|
|
@@ -475,22 +399,15 @@ function normalizePathSeparators(pathname) {
|
|
|
475
399
|
if (collapsed.length <= 1) return collapsed;
|
|
476
400
|
return collapsed.replace(/\/+$/, "");
|
|
477
401
|
}
|
|
478
|
-
function resolveDotSegments(pathname) {
|
|
479
|
-
try {
|
|
480
|
-
return new URL(pathname, "http://localhost").pathname;
|
|
481
|
-
} catch {
|
|
482
|
-
return pathname;
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
402
|
function normalizePathForSecurity(pathname) {
|
|
486
|
-
return normalizePathSeparators(normalizeLowercaseStringOrEmpty$1(
|
|
403
|
+
return normalizePathSeparators(normalizeLowercaseStringOrEmpty$1(URL.parse(pathname, "http://localhost")?.pathname ?? pathname)) || "/";
|
|
487
404
|
}
|
|
488
|
-
function buildCanonicalPathCandidates(pathname
|
|
405
|
+
function buildCanonicalPathCandidates(pathname) {
|
|
489
406
|
const candidates = /* @__PURE__ */ new Set([normalizePathForSecurity(pathname)]);
|
|
490
407
|
let decoded = pathname;
|
|
491
408
|
let malformedEncoding = false;
|
|
492
409
|
let decodePasses = 0;
|
|
493
|
-
for (let pass = 0; pass <
|
|
410
|
+
for (let pass = 0; pass < MAX_PATH_DECODE_PASSES; pass++) {
|
|
494
411
|
let nextDecoded;
|
|
495
412
|
try {
|
|
496
413
|
nextDecoded = decodeURIComponent(decoded);
|
|
@@ -574,7 +491,7 @@ function resolveMSTeamsWebhookPathIssue({ cfg, env }) {
|
|
|
574
491
|
const legacy = resolveMSTeamsLegacyWebhook(channel);
|
|
575
492
|
const pathname = URL.parse(path, "http://localhost")?.pathname ?? path;
|
|
576
493
|
const probe = classifyGatewayProbePath(pathname);
|
|
577
|
-
const reason = isProtectedPluginRoutePathFromContext(resolvePluginRoutePathContext(pathname)) ? "requires Gateway authentication on the main HTTP listener" : probe !== "namespace" && probe !== "outside" ? "is reserved for Gateway
|
|
494
|
+
const reason = isProtectedPluginRoutePathFromContext(resolvePluginRoutePathContext(pathname)) ? "requires Gateway authentication on the main HTTP listener" : probe !== "namespace" && probe !== "outside" ? "is reserved for Gateway checks" : /[:*{}\\]/.test(path) ? "uses Express pattern syntax that requires the compatibility listener" : void 0;
|
|
578
495
|
if (!reason) return;
|
|
579
496
|
return `Microsoft Teams webhook path ${path} ${reason}. Set channels.msteams.webhook.path to /api/messages and update the Azure Bot messaging endpoint or reverse-proxy upstream to Gateway port ${(0, gateway_config_runtime_exports.resolveGatewayPort)(cfg, env)}/api/messages; verify delivery before removing channels.msteams.legacyWebhook.` + (legacy ? ` Compatibility port ${legacy.port} continues serving the current path.` : " The compatibility listener is disabled, so this path cannot receive Teams callbacks.");
|
|
580
497
|
}
|
|
@@ -587,7 +504,7 @@ const isMSTeamsMutableAllowEntry = (0, openclaw_plugin_sdk_channel_policy.buildM
|
|
|
587
504
|
const collectMSTeamsMutableAllowlistWarnings = (0, openclaw_plugin_sdk_channel_policy.createDangerousNameMatchingMutableAllowlistWarningCollector)({
|
|
588
505
|
channel: "msteams",
|
|
589
506
|
detector: isMSTeamsMutableAllowEntry,
|
|
590
|
-
collectLists:
|
|
507
|
+
collectLists: openclaw_plugin_sdk_channel_policy.collectStandardAllowlistLists
|
|
591
508
|
});
|
|
592
509
|
function runMSTeamsWebhookDoctorSequence({ cfg, env }) {
|
|
593
510
|
const channel = cfg.channels?.msteams;
|
|
@@ -777,13 +694,13 @@ function normalizeUserTarget(target) {
|
|
|
777
694
|
function isStableUserId(value) {
|
|
778
695
|
return /^[0-9a-f-]{16,}$/i.test(value);
|
|
779
696
|
}
|
|
780
|
-
async function
|
|
697
|
+
async function resolveDmTarget(cfg, target, directOperator = false) {
|
|
781
698
|
const teams = cfg.channels?.msteams;
|
|
782
699
|
if (teams?.dmPolicy === "disabled") return;
|
|
783
700
|
const userId = normalizeUserTarget(target);
|
|
784
701
|
if (!userId) return;
|
|
785
|
-
const normalizedEntries = (teams?.allowFrom ?? []).map((entry) => normalizeUserTarget(entry.replace(/^(msteams|teams):/i, "")));
|
|
786
|
-
const allowAll = (teams?.dmPolicy ?? "pairing") === "open" || normalizedEntries.includes("*");
|
|
702
|
+
const normalizedEntries = (directOperator ? [] : teams?.allowFrom ?? []).map((entry) => normalizeUserTarget(entry.replace(/^(msteams|teams):/i, "")));
|
|
703
|
+
const allowAll = directOperator || (teams?.dmPolicy ?? "pairing") === "open" || normalizedEntries.includes("*");
|
|
787
704
|
if (isStableUserId(userId)) return allowAll || normalizedEntries.some((entry) => entry === userId) ? `user:${userId}` : void 0;
|
|
788
705
|
if (!(0, openclaw_plugin_sdk_dangerous_name_runtime.isDangerousNameMatchingEnabled)(teams)) return;
|
|
789
706
|
try {
|
|
@@ -797,22 +714,6 @@ async function resolveAllowedDmTarget(cfg, target) {
|
|
|
797
714
|
return;
|
|
798
715
|
}
|
|
799
716
|
}
|
|
800
|
-
async function resolveDirectDmTarget(cfg, target) {
|
|
801
|
-
if (cfg.channels?.msteams?.dmPolicy === "disabled") return;
|
|
802
|
-
const userId = normalizeUserTarget(target);
|
|
803
|
-
if (!userId) return;
|
|
804
|
-
if (isStableUserId(userId)) return `user:${userId}`;
|
|
805
|
-
if (!(0, openclaw_plugin_sdk_dangerous_name_runtime.isDangerousNameMatchingEnabled)(cfg.channels?.msteams)) return;
|
|
806
|
-
try {
|
|
807
|
-
const [resolved] = await require_resolve_allowlist.resolveMSTeamsUserAllowlist({
|
|
808
|
-
cfg,
|
|
809
|
-
entries: [userId]
|
|
810
|
-
});
|
|
811
|
-
return resolved?.resolved && resolved.id ? `user:${resolved.id}` : void 0;
|
|
812
|
-
} catch {
|
|
813
|
-
return;
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
717
|
function resolveMSTeamsReadGroupPolicy(cfg) {
|
|
817
718
|
const teams = cfg.channels?.msteams;
|
|
818
719
|
return teams ? teams.groupPolicy ?? (0, openclaw_plugin_sdk_runtime_group_policy.resolveDefaultGroupPolicy)(cfg) ?? "allowlist" : "disabled";
|
|
@@ -879,16 +780,19 @@ async function resolveAllowedChannelTarget(cfg, target) {
|
|
|
879
780
|
if (!stableTarget || !teams?.teams) return;
|
|
880
781
|
const [stableTeamId, stableChannelId] = stableTarget.split("/", 2);
|
|
881
782
|
if (!stableTeamId || !stableChannelId) return;
|
|
783
|
+
return await isMappedChannelAllowed(cfg, stableTeamId, stableChannelId) ? stableTarget : void 0;
|
|
784
|
+
}
|
|
785
|
+
async function isMappedChannelAllowed(cfg, teamId, conversationId) {
|
|
786
|
+
const teams = cfg.channels?.msteams;
|
|
787
|
+
if (!teams?.teams) return false;
|
|
882
788
|
try {
|
|
883
|
-
const botFrameworkTeamKey = await resolveConfiguredBotFrameworkTeamKey(cfg,
|
|
884
|
-
if (botFrameworkTeamKey
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
}
|
|
891
|
-
if (!hasMutableChannelConfig(cfg)) return;
|
|
789
|
+
const botFrameworkTeamKey = await resolveConfiguredBotFrameworkTeamKey(cfg, teamId);
|
|
790
|
+
if (botFrameworkTeamKey && resolveMSTeamsRouteConfig({
|
|
791
|
+
cfg: teams,
|
|
792
|
+
teamId: botFrameworkTeamKey,
|
|
793
|
+
conversationId
|
|
794
|
+
}).allowed) return true;
|
|
795
|
+
if (!hasMutableChannelConfig(cfg)) return false;
|
|
892
796
|
const resolved = await require_resolve_allowlist.resolveMSTeamsTeamsConfig({
|
|
893
797
|
cfg,
|
|
894
798
|
teamIdMode: "graph",
|
|
@@ -899,11 +803,11 @@ async function resolveAllowedChannelTarget(cfg, target) {
|
|
|
899
803
|
...teams,
|
|
900
804
|
teams: resolved.teams
|
|
901
805
|
},
|
|
902
|
-
teamId
|
|
903
|
-
conversationId
|
|
904
|
-
}).allowed
|
|
806
|
+
teamId,
|
|
807
|
+
conversationId
|
|
808
|
+
}).allowed;
|
|
905
809
|
} catch {
|
|
906
|
-
return;
|
|
810
|
+
return false;
|
|
907
811
|
}
|
|
908
812
|
}
|
|
909
813
|
function bothUnknownScopesAllowed(cfg) {
|
|
@@ -923,7 +827,7 @@ async function assertMSTeamsReadTargetAllowed(params) {
|
|
|
923
827
|
const currentChatType = params.ctx.toolContext?.currentChatType;
|
|
924
828
|
const groupEnabled = resolveMSTeamsReadGroupPolicy(params.cfg) !== "disabled";
|
|
925
829
|
const dmEnabled = params.cfg.channels?.msteams?.dmPolicy !== "disabled";
|
|
926
|
-
const allowedTarget = directOperator ? isChannel ? groupEnabled ? await resolveStableChannelTarget(params.cfg, target) : void 0 : isDm ? await
|
|
830
|
+
const allowedTarget = directOperator ? isChannel ? groupEnabled ? await resolveStableChannelTarget(params.cfg, target) : void 0 : isDm ? await resolveDmTarget(params.cfg, target, true) : isChat && groupEnabled && dmEnabled ? target : void 0 : current ? (isChannel ? groupEnabled : isDm || currentChatType === "direct" ? dmEnabled : currentChatType === "group" || currentChatType === "channel" ? groupEnabled : groupEnabled && dmEnabled) ? target : void 0 : isChannel ? await resolveAllowedChannelTarget(params.cfg, target) : isDm ? await resolveDmTarget(params.cfg, target) : isChat ? bothUnknownScopesAllowed(params.cfg) ? target : void 0 : false;
|
|
927
831
|
if (!allowedTarget) throw new openclaw_plugin_sdk_channel_actions.ToolAuthorizationError("Microsoft Teams read target is not allowed.");
|
|
928
832
|
return allowedTarget;
|
|
929
833
|
}
|
|
@@ -944,33 +848,7 @@ async function assertMSTeamsTeamEnumerationAllowed(params) {
|
|
|
944
848
|
}))[0]?.graphTeamId : void 0;
|
|
945
849
|
if (!stableTeamId) throw new openclaw_plugin_sdk_channel_actions.ToolAuthorizationError("Microsoft Teams channel list requires access to every channel in the team.");
|
|
946
850
|
if (params.ctx?.conversationReadOrigin === "direct-operator") return stableTeamId;
|
|
947
|
-
|
|
948
|
-
if (!allowed && teams?.teams) try {
|
|
949
|
-
const botFrameworkTeamKey = await resolveConfiguredBotFrameworkTeamKey(params.cfg, stableTeamId);
|
|
950
|
-
if (botFrameworkTeamKey) allowed = resolveMSTeamsRouteConfig({
|
|
951
|
-
cfg: teams,
|
|
952
|
-
teamId: botFrameworkTeamKey,
|
|
953
|
-
conversationId: "__openclaw_all_channels__"
|
|
954
|
-
}).allowed;
|
|
955
|
-
if (!allowed && hasMutableChannelConfig(params.cfg)) {
|
|
956
|
-
const resolved = await require_resolve_allowlist.resolveMSTeamsTeamsConfig({
|
|
957
|
-
cfg: params.cfg,
|
|
958
|
-
teamIdMode: "graph",
|
|
959
|
-
teams: teams.teams
|
|
960
|
-
});
|
|
961
|
-
allowed = resolveMSTeamsRouteConfig({
|
|
962
|
-
cfg: {
|
|
963
|
-
...teams,
|
|
964
|
-
teams: resolved.teams
|
|
965
|
-
},
|
|
966
|
-
teamId: stableTeamId,
|
|
967
|
-
conversationId: "__openclaw_all_channels__"
|
|
968
|
-
}).allowed;
|
|
969
|
-
}
|
|
970
|
-
} catch {
|
|
971
|
-
allowed = false;
|
|
972
|
-
}
|
|
973
|
-
if (!allowed) throw new openclaw_plugin_sdk_channel_actions.ToolAuthorizationError("Microsoft Teams channel list requires access to every channel in the team.");
|
|
851
|
+
if (!((directRoute.allowlistConfigured ? directRoute.allowed : groupPolicy === "open") || await isMappedChannelAllowed(params.cfg, stableTeamId, "__openclaw_all_channels__"))) throw new openclaw_plugin_sdk_channel_actions.ToolAuthorizationError("Microsoft Teams channel list requires access to every channel in the team.");
|
|
974
852
|
return stableTeamId;
|
|
975
853
|
}
|
|
976
854
|
//#endregion
|
|
@@ -1047,7 +925,7 @@ const collectMSTeamsSecurityFindings = openclaw_plugin_sdk_channel_policy.create
|
|
|
1047
925
|
severity: "warn",
|
|
1048
926
|
title: "MS Teams security warning"
|
|
1049
927
|
});
|
|
1050
|
-
const loadMSTeamsChannelRuntime = (0, openclaw_plugin_sdk_lazy_runtime.createLazyRuntimeNamedExport)(() => Promise.resolve().then(() => require("./channel.runtime-
|
|
928
|
+
const loadMSTeamsChannelRuntime = (0, openclaw_plugin_sdk_lazy_runtime.createLazyRuntimeNamedExport)(() => Promise.resolve().then(() => require("./channel.runtime-DWRAolil.cjs")), "msTeamsChannelRuntime");
|
|
1051
929
|
const MSTEAMS_REACTION_TYPES = [
|
|
1052
930
|
"like",
|
|
1053
931
|
"heart",
|
|
@@ -1074,38 +952,15 @@ function resolveGraphActionTarget(params, currentChannelId, currentGraphChannelI
|
|
|
1074
952
|
if (currentGraphTarget) return currentGraphTarget;
|
|
1075
953
|
return currentChatType === "channel" ? "" : currentChannelTarget ?? "";
|
|
1076
954
|
}
|
|
1077
|
-
function
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
const to = resolveMSTeamsActionTarget(params);
|
|
1082
|
-
if (!to) return actionError(`${params.actionLabel} requires a target (to).`);
|
|
1083
|
-
return await params.run(to);
|
|
1084
|
-
}
|
|
1085
|
-
async function runWithRequiredActionMessageTarget(params) {
|
|
1086
|
-
const to = resolveMSTeamsActionTarget(params);
|
|
1087
|
-
const messageIdRaw = params.allowCurrentMessageIdFallback === true && msteamsContextTargetsMatch(to, {
|
|
1088
|
-
currentChannelId: params.currentChannelId ?? void 0,
|
|
1089
|
-
currentMessagingTarget: params.currentGraphChannelId ?? void 0
|
|
955
|
+
function resolveMSTeamsActionMessageId(ctx, to, allowCurrentMessageIdFallback = false) {
|
|
956
|
+
const messageId = allowCurrentMessageIdFallback && msteamsContextTargetsMatch(to, {
|
|
957
|
+
currentChannelId: ctx.toolContext?.currentChannelId ?? void 0,
|
|
958
|
+
currentMessagingTarget: (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(ctx.toolContext?.currentGraphChannelId) ?? (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(ctx.toolContext?.currentMessagingTarget)
|
|
1090
959
|
}) ? (0, openclaw_plugin_sdk_channel_actions.resolveReactionMessageId)({
|
|
1091
|
-
args: params
|
|
1092
|
-
toolContext: { currentMessageId:
|
|
1093
|
-
}) : (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(params.
|
|
1094
|
-
|
|
1095
|
-
if (!to || !messageId) return actionError(`${params.actionLabel} requires a target (to) and messageId.`);
|
|
1096
|
-
return await params.run({
|
|
1097
|
-
to,
|
|
1098
|
-
messageId
|
|
1099
|
-
});
|
|
1100
|
-
}
|
|
1101
|
-
async function runWithRequiredActionPinnedMessageTarget(params) {
|
|
1102
|
-
const to = resolveMSTeamsActionTarget(params);
|
|
1103
|
-
const pinnedMessageId = typeof params.toolParams.pinnedMessageId === "string" ? params.toolParams.pinnedMessageId.trim() : (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(params.toolParams.messageId) ?? "";
|
|
1104
|
-
if (!to || !pinnedMessageId) return actionError(`${params.actionLabel} requires a target (to) and pinnedMessageId.`);
|
|
1105
|
-
return await params.run({
|
|
1106
|
-
to,
|
|
1107
|
-
pinnedMessageId
|
|
1108
|
-
});
|
|
960
|
+
args: ctx.params,
|
|
961
|
+
toolContext: { currentMessageId: ctx.toolContext?.currentMessageId ?? void 0 }
|
|
962
|
+
}) : (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(ctx.params.messageId) ?? "";
|
|
963
|
+
return messageId == null ? "" : String(messageId).trim();
|
|
1109
964
|
}
|
|
1110
965
|
function describeMSTeamsMessageTool({ cfg }) {
|
|
1111
966
|
const account = require_channel_setup.resolveMSTeamsAccount(cfg);
|
|
@@ -1330,214 +1185,170 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
|
|
|
1330
1185
|
presentation,
|
|
1331
1186
|
text: resolveActionContent(ctx.params)
|
|
1332
1187
|
});
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
messageId: result.messageId,
|
|
1349
|
-
conversationId: result.conversationId
|
|
1350
|
-
});
|
|
1351
|
-
}
|
|
1188
|
+
const to = resolveActionTarget(ctx.params);
|
|
1189
|
+
if (!to) return actionError("Card send requires a target (to).");
|
|
1190
|
+
const { sendAdaptiveCardMSTeams } = await loadMSTeamsChannelRuntime();
|
|
1191
|
+
const result = await sendAdaptiveCardMSTeams({
|
|
1192
|
+
cfg: ctx.cfg,
|
|
1193
|
+
to,
|
|
1194
|
+
card,
|
|
1195
|
+
assertDirectAdapterHandoff: ctx.assertDirectAdapterHandoff,
|
|
1196
|
+
onPlatformSendDispatch: ctx.onPlatformSendDispatch
|
|
1197
|
+
});
|
|
1198
|
+
return jsonActionResult({
|
|
1199
|
+
ok: true,
|
|
1200
|
+
channel: "msteams",
|
|
1201
|
+
messageId: result.messageId,
|
|
1202
|
+
conversationId: result.conversationId
|
|
1352
1203
|
});
|
|
1353
1204
|
}
|
|
1354
1205
|
if (ctx.action === "upload-file") {
|
|
1355
1206
|
const mediaUrl = resolveActionUploadFilePath(ctx.params);
|
|
1356
1207
|
if (!mediaUrl) return actionError("Upload-file requires media, filePath, or path.");
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
messageId: result.messageId,
|
|
1380
|
-
conversationId: result.conversationId,
|
|
1381
|
-
...result.pendingUploadId ? { pendingUploadId: result.pendingUploadId } : {}
|
|
1382
|
-
});
|
|
1383
|
-
}
|
|
1208
|
+
const to = resolveActionTarget(ctx.params, ctx.toolContext?.currentChannelId);
|
|
1209
|
+
if (!to) return actionError("Upload-file requires a target (to).");
|
|
1210
|
+
const { sendMessageMSTeams } = await loadMSTeamsChannelRuntime();
|
|
1211
|
+
const result = await sendMessageMSTeams({
|
|
1212
|
+
cfg: ctx.cfg,
|
|
1213
|
+
to,
|
|
1214
|
+
text: resolveActionContent(ctx.params),
|
|
1215
|
+
mediaUrl,
|
|
1216
|
+
filename: (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(ctx.params.filename) ?? (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(ctx.params.title),
|
|
1217
|
+
mediaAccess: ctx.mediaAccess,
|
|
1218
|
+
mediaLocalRoots: ctx.mediaLocalRoots,
|
|
1219
|
+
mediaReadFile: ctx.mediaReadFile,
|
|
1220
|
+
assertDirectAdapterHandoff: ctx.assertDirectAdapterHandoff,
|
|
1221
|
+
onPlatformSendDispatch: ctx.onPlatformSendDispatch
|
|
1222
|
+
});
|
|
1223
|
+
return jsonActionResult({
|
|
1224
|
+
ok: true,
|
|
1225
|
+
channel: "msteams",
|
|
1226
|
+
action: "upload-file",
|
|
1227
|
+
messageId: result.messageId,
|
|
1228
|
+
conversationId: result.conversationId,
|
|
1229
|
+
...result.pendingUploadId ? { pendingUploadId: result.pendingUploadId } : {}
|
|
1384
1230
|
});
|
|
1385
1231
|
}
|
|
1386
1232
|
if (ctx.action === "edit" || ctx.action === "delete") {
|
|
1387
1233
|
const action = ctx.action;
|
|
1388
1234
|
const content = action === "edit" ? resolveActionContent(ctx.params) : "";
|
|
1389
1235
|
if (action === "edit" && !content) return actionError("Edit requires content.");
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
text: content
|
|
1405
|
-
}) : await runtime.deleteMessageMSTeams(params)).conversationId);
|
|
1406
|
-
}
|
|
1407
|
-
});
|
|
1236
|
+
const target = resolveActionTarget(ctx.params, ctx.toolContext?.currentChannelId);
|
|
1237
|
+
const messageId = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(ctx.params.messageId) ?? "";
|
|
1238
|
+
if (!target || !messageId) return actionError(`${action === "edit" ? "Edit" : "Delete"} requires a target (to) and messageId.`);
|
|
1239
|
+
const to = await authorizeActionTarget(target);
|
|
1240
|
+
const runtime = await loadMSTeamsChannelRuntime();
|
|
1241
|
+
const params = {
|
|
1242
|
+
cfg: ctx.cfg,
|
|
1243
|
+
to,
|
|
1244
|
+
activityId: messageId
|
|
1245
|
+
};
|
|
1246
|
+
return jsonMSTeamsConversationResult((action === "edit" ? await runtime.editMessageMSTeams({
|
|
1247
|
+
...params,
|
|
1248
|
+
text: content
|
|
1249
|
+
}) : await runtime.deleteMessageMSTeams(params)).conversationId);
|
|
1408
1250
|
}
|
|
1409
|
-
const
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
} : ctx.params,
|
|
1414
|
-
currentChannelId: ctx.toolContext?.currentChannelId,
|
|
1415
|
-
currentGraphChannelId: (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(ctx.toolContext?.currentGraphChannelId) ?? (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(ctx.toolContext?.currentMessagingTarget),
|
|
1416
|
-
currentChatType: ctx.toolContext?.currentChatType,
|
|
1417
|
-
currentMessageId: ctx.toolContext?.currentMessageId,
|
|
1418
|
-
graphOnly: true
|
|
1419
|
-
};
|
|
1251
|
+
const graphTo = resolveGraphActionTarget(ctx.action === "search" || ctx.action === "member-info" ? {
|
|
1252
|
+
...ctx.params,
|
|
1253
|
+
to: resolveActionTarget(ctx.params) || (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(ctx.params.channelId)
|
|
1254
|
+
} : ctx.params, ctx.toolContext?.currentChannelId, (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(ctx.toolContext?.currentGraphChannelId) ?? (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(ctx.toolContext?.currentMessagingTarget), ctx.toolContext?.currentChatType);
|
|
1420
1255
|
if (ctx.action === "read" || ctx.action === "pin" || ctx.action === "reactions") {
|
|
1421
1256
|
const action = ctx.action;
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1257
|
+
const messageId = resolveMSTeamsActionMessageId(ctx, graphTo, action === "reactions");
|
|
1258
|
+
if (!graphTo || !messageId) return actionError(`${{
|
|
1259
|
+
read: "Read",
|
|
1260
|
+
pin: "Pin",
|
|
1261
|
+
reactions: "Reactions"
|
|
1262
|
+
}[action]} requires a target (to) and messageId.`);
|
|
1263
|
+
const to = await authorizeActionTarget(graphTo);
|
|
1264
|
+
const runtime = await loadMSTeamsChannelRuntime();
|
|
1265
|
+
const params = {
|
|
1266
|
+
cfg: ctx.cfg,
|
|
1267
|
+
to,
|
|
1268
|
+
messageId
|
|
1269
|
+
};
|
|
1270
|
+
if (action === "read") return jsonMSTeamsOkActionResult(action, { message: await runtime.getMessageMSTeams(params) });
|
|
1271
|
+
if (action === "pin") return jsonMSTeamsActionResult(action, await runtime.pinMessageMSTeams(params));
|
|
1272
|
+
return jsonMSTeamsOkActionResult(action, await runtime.listReactionsMSTeams(params));
|
|
1273
|
+
}
|
|
1274
|
+
if (ctx.action === "unpin") {
|
|
1275
|
+
const pinnedMessageId = typeof ctx.params.pinnedMessageId === "string" ? ctx.params.pinnedMessageId.trim() : (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(ctx.params.messageId) ?? "";
|
|
1276
|
+
if (!graphTo || !pinnedMessageId) return actionError("Unpin requires a target (to) and pinnedMessageId.");
|
|
1277
|
+
const to = await authorizeActionTarget(graphTo);
|
|
1278
|
+
const { unpinMessageMSTeams } = await loadMSTeamsChannelRuntime();
|
|
1279
|
+
return jsonMSTeamsActionResult("unpin", await unpinMessageMSTeams({
|
|
1280
|
+
cfg: ctx.cfg,
|
|
1281
|
+
to,
|
|
1282
|
+
pinnedMessageId
|
|
1283
|
+
}));
|
|
1284
|
+
}
|
|
1285
|
+
if (ctx.action === "list-pins") {
|
|
1286
|
+
if (!graphTo) return actionError("List-pins requires a target (to).");
|
|
1287
|
+
const to = await authorizeActionTarget(graphTo);
|
|
1288
|
+
const { listPinsMSTeams } = await loadMSTeamsChannelRuntime();
|
|
1289
|
+
return jsonMSTeamsOkActionResult("list-pins", await listPinsMSTeams({
|
|
1290
|
+
cfg: ctx.cfg,
|
|
1291
|
+
to
|
|
1292
|
+
}));
|
|
1293
|
+
}
|
|
1294
|
+
if (ctx.action === "react") {
|
|
1295
|
+
const messageId = resolveMSTeamsActionMessageId(ctx, graphTo, true);
|
|
1296
|
+
if (!graphTo || !messageId) return actionError("React requires a target (to) and messageId.");
|
|
1297
|
+
const emoji = typeof ctx.params.emoji === "string" ? ctx.params.emoji.trim() : "";
|
|
1298
|
+
const remove = typeof ctx.params.remove === "boolean" ? ctx.params.remove : false;
|
|
1299
|
+
if (!emoji) return {
|
|
1300
|
+
isError: true,
|
|
1301
|
+
...(0, openclaw_plugin_sdk_tool_results.textResult)(`React requires an emoji (reaction type). Valid types: ${MSTEAMS_REACTION_TYPES.join(", ")}.`, {
|
|
1302
|
+
error: "React requires an emoji (reaction type).",
|
|
1303
|
+
validTypes: [...MSTEAMS_REACTION_TYPES]
|
|
1304
|
+
})
|
|
1305
|
+
};
|
|
1306
|
+
const to = await authorizeActionTarget(graphTo);
|
|
1307
|
+
const runtime = await loadMSTeamsChannelRuntime();
|
|
1308
|
+
const result = await (remove ? runtime.unreactMessageMSTeams : runtime.reactMessageMSTeams)({
|
|
1309
|
+
cfg: ctx.cfg,
|
|
1310
|
+
to,
|
|
1311
|
+
messageId,
|
|
1312
|
+
reactionType: emoji
|
|
1313
|
+
});
|
|
1314
|
+
return jsonMSTeamsActionResult("react", {
|
|
1315
|
+
...remove ? { removed: true } : {},
|
|
1316
|
+
reactionType: emoji,
|
|
1317
|
+
...result
|
|
1445
1318
|
});
|
|
1446
1319
|
}
|
|
1447
|
-
if (ctx.action === "
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
run: async (to) => {
|
|
1464
|
-
const allowedTarget = await authorizeActionTarget(to);
|
|
1465
|
-
const { listPinsMSTeams } = await loadMSTeamsChannelRuntime();
|
|
1466
|
-
return jsonMSTeamsOkActionResult("list-pins", await listPinsMSTeams({
|
|
1467
|
-
cfg: ctx.cfg,
|
|
1468
|
-
to: allowedTarget
|
|
1469
|
-
}));
|
|
1470
|
-
}
|
|
1471
|
-
});
|
|
1472
|
-
if (ctx.action === "react") return await runWithRequiredActionMessageTarget({
|
|
1473
|
-
actionLabel: "React",
|
|
1474
|
-
...graphActionTarget,
|
|
1475
|
-
allowCurrentMessageIdFallback: true,
|
|
1476
|
-
run: async (target) => {
|
|
1477
|
-
const emoji = typeof ctx.params.emoji === "string" ? ctx.params.emoji.trim() : "";
|
|
1478
|
-
const remove = typeof ctx.params.remove === "boolean" ? ctx.params.remove : false;
|
|
1479
|
-
if (!emoji) return {
|
|
1480
|
-
isError: true,
|
|
1481
|
-
...(0, openclaw_plugin_sdk_tool_results.textResult)(`React requires an emoji (reaction type). Valid types: ${MSTEAMS_REACTION_TYPES.join(", ")}.`, {
|
|
1482
|
-
error: "React requires an emoji (reaction type).",
|
|
1483
|
-
validTypes: [...MSTEAMS_REACTION_TYPES]
|
|
1484
|
-
})
|
|
1485
|
-
};
|
|
1486
|
-
const to = await authorizeActionTarget(target.to);
|
|
1487
|
-
const runtime = await loadMSTeamsChannelRuntime();
|
|
1488
|
-
const result = await (remove ? runtime.unreactMessageMSTeams : runtime.reactMessageMSTeams)({
|
|
1489
|
-
cfg: ctx.cfg,
|
|
1490
|
-
to,
|
|
1491
|
-
messageId: target.messageId,
|
|
1492
|
-
reactionType: emoji
|
|
1493
|
-
});
|
|
1494
|
-
return jsonMSTeamsActionResult("react", {
|
|
1495
|
-
...remove ? { removed: true } : {},
|
|
1496
|
-
reactionType: emoji,
|
|
1497
|
-
...result
|
|
1498
|
-
});
|
|
1499
|
-
}
|
|
1500
|
-
});
|
|
1501
|
-
if (ctx.action === "search") return await runWithRequiredActionTarget({
|
|
1502
|
-
actionLabel: "Search",
|
|
1503
|
-
...graphActionTarget,
|
|
1504
|
-
run: async (to) => {
|
|
1505
|
-
const allowedTarget = await authorizeActionTarget(to);
|
|
1506
|
-
const query = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(ctx.params.query);
|
|
1507
|
-
if (!query) return actionError("Search requires a target (to) and query.");
|
|
1508
|
-
const limit = (0, openclaw_plugin_sdk_channel_actions.readPositiveIntegerParam)(ctx.params, "limit");
|
|
1509
|
-
const from = typeof ctx.params.from === "string" ? ctx.params.from.trim() : void 0;
|
|
1510
|
-
const { searchMessagesMSTeams } = await loadMSTeamsChannelRuntime();
|
|
1511
|
-
return jsonMSTeamsOkActionResult("search", await searchMessagesMSTeams({
|
|
1512
|
-
cfg: ctx.cfg,
|
|
1513
|
-
to: allowedTarget,
|
|
1514
|
-
query,
|
|
1515
|
-
from: from || void 0,
|
|
1516
|
-
limit
|
|
1517
|
-
}));
|
|
1518
|
-
}
|
|
1519
|
-
});
|
|
1320
|
+
if (ctx.action === "search") {
|
|
1321
|
+
if (!graphTo) return actionError("Search requires a target (to).");
|
|
1322
|
+
const to = await authorizeActionTarget(graphTo);
|
|
1323
|
+
const query = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(ctx.params.query);
|
|
1324
|
+
if (!query) return actionError("Search requires a target (to) and query.");
|
|
1325
|
+
const limit = (0, openclaw_plugin_sdk_channel_actions.readPositiveIntegerParam)(ctx.params, "limit");
|
|
1326
|
+
const from = typeof ctx.params.from === "string" ? ctx.params.from.trim() : void 0;
|
|
1327
|
+
const { searchMessagesMSTeams } = await loadMSTeamsChannelRuntime();
|
|
1328
|
+
return jsonMSTeamsOkActionResult("search", await searchMessagesMSTeams({
|
|
1329
|
+
cfg: ctx.cfg,
|
|
1330
|
+
to,
|
|
1331
|
+
query,
|
|
1332
|
+
from: from || void 0,
|
|
1333
|
+
limit
|
|
1334
|
+
}));
|
|
1335
|
+
}
|
|
1520
1336
|
if (ctx.action === "member-info") {
|
|
1521
1337
|
const userId = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(ctx.params.userId) ?? "";
|
|
1522
1338
|
if (!userId) return actionError("member-info requires a userId.");
|
|
1523
|
-
return
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
userId,
|
|
1537
|
-
currentRequesterId
|
|
1538
|
-
}));
|
|
1539
|
-
}
|
|
1540
|
-
});
|
|
1339
|
+
if (!graphTo) return actionError("member-info requires a target (to).");
|
|
1340
|
+
const to = await authorizeActionTarget(graphTo);
|
|
1341
|
+
const currentRequesterId = isCurrentMSTeamsReadTarget({
|
|
1342
|
+
ctx,
|
|
1343
|
+
target: to
|
|
1344
|
+
}) ? ctx.requesterSenderId : void 0;
|
|
1345
|
+
const { getMemberInfoMSTeams } = await loadMSTeamsChannelRuntime();
|
|
1346
|
+
return jsonMSTeamsOkActionResult("member-info", await getMemberInfoMSTeams({
|
|
1347
|
+
cfg: ctx.cfg,
|
|
1348
|
+
to,
|
|
1349
|
+
userId,
|
|
1350
|
+
currentRequesterId
|
|
1351
|
+
}));
|
|
1541
1352
|
}
|
|
1542
1353
|
if (ctx.action === "channel-list") {
|
|
1543
1354
|
const teamId = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(ctx.params.teamId) ?? "";
|
|
@@ -1570,42 +1381,31 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
|
|
|
1570
1381
|
const action = ctx.action;
|
|
1571
1382
|
const userId = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(ctx.params.userId);
|
|
1572
1383
|
if (!userId) return actionError(`${action} requires a userId.`);
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
...params,
|
|
1587
|
-
role
|
|
1588
|
-
}) : await runtime.removeParticipantMSTeams(params);
|
|
1589
|
-
return jsonMSTeamsOkActionResult(action, result);
|
|
1590
|
-
}
|
|
1591
|
-
});
|
|
1384
|
+
const to = resolveActionTarget(ctx.params, ctx.toolContext?.currentChannelId);
|
|
1385
|
+
if (!to) return actionError(`${action} requires a target (to).`);
|
|
1386
|
+
const role = action === "addParticipant" ? (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(ctx.params.role) : void 0;
|
|
1387
|
+
const runtime = await loadMSTeamsChannelRuntime();
|
|
1388
|
+
const params = {
|
|
1389
|
+
cfg: ctx.cfg,
|
|
1390
|
+
to,
|
|
1391
|
+
userId
|
|
1392
|
+
};
|
|
1393
|
+
return jsonMSTeamsOkActionResult(action, action === "addParticipant" ? await runtime.addParticipantMSTeams({
|
|
1394
|
+
...params,
|
|
1395
|
+
role
|
|
1396
|
+
}) : await runtime.removeParticipantMSTeams(params));
|
|
1592
1397
|
}
|
|
1593
1398
|
if (ctx.action === "renameGroup") {
|
|
1594
1399
|
const name = typeof ctx.params.name === "string" ? ctx.params.name.trim() : "";
|
|
1595
1400
|
if (!name) return actionError("renameGroup requires a name.");
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
to,
|
|
1605
|
-
name
|
|
1606
|
-
}));
|
|
1607
|
-
}
|
|
1608
|
-
});
|
|
1401
|
+
const to = resolveActionTarget(ctx.params, ctx.toolContext?.currentChannelId);
|
|
1402
|
+
if (!to) return actionError("renameGroup requires a target (to).");
|
|
1403
|
+
const { renameGroupMSTeams } = await loadMSTeamsChannelRuntime();
|
|
1404
|
+
return jsonMSTeamsOkActionResult("renameGroup", await renameGroupMSTeams({
|
|
1405
|
+
cfg: ctx.cfg,
|
|
1406
|
+
to,
|
|
1407
|
+
name
|
|
1408
|
+
}));
|
|
1609
1409
|
}
|
|
1610
1410
|
return null;
|
|
1611
1411
|
})
|
|
@@ -1645,7 +1445,7 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
|
|
|
1645
1445
|
})
|
|
1646
1446
|
}),
|
|
1647
1447
|
gateway: { startAccount: async (ctx) => {
|
|
1648
|
-
const { monitorMSTeamsProvider } = await Promise.resolve().then(() => require("./monitor-
|
|
1448
|
+
const { monitorMSTeamsProvider } = await Promise.resolve().then(() => require("./monitor-C9x_CJhY.cjs"));
|
|
1649
1449
|
const webhookPath = ctx.cfg.channels?.msteams?.webhook?.path || "/api/messages";
|
|
1650
1450
|
const statusSink = (0, openclaw_plugin_sdk_channel_outbound.createAccountStatusSink)({
|
|
1651
1451
|
accountId: ctx.accountId,
|