@openclaw/msteams 2026.5.12 → 2026.5.14-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/api.js +2 -2
- package/dist/{channel-BApPsQGS.js → channel-C5CVTygn.js} +138 -8
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-CnDHBWml.js → channel.runtime-fqvE_yLN.js} +2 -2
- package/dist/contract-api.js +1 -1
- package/dist/{graph-users-BQJvcsX8.js → graph-users-ChPPxUzD.js} +66 -29
- package/dist/{oauth-BWJyilR1.js → oauth-DsVj42gA.js} +1 -1
- package/dist/{oauth.token-xxpoLWy5.js → oauth.token-mUfXUE0j.js} +2 -1
- package/dist/{probe-4kXMWuAw.js → probe-I2DM0U-s.js} +2 -2
- package/dist/secret-contract-api.js +1 -1
- package/dist/setup-plugin-api.js +2 -2
- package/dist/{setup-surface-Ce463w3t.js → setup-surface-CQrMX-nJ.js} +220 -4
- package/dist/{src-BEhrsfns.js → src-CYZq-lQ4.js} +83 -94
- package/dist/test-api.js +1 -1
- package/package.json +6 -6
- package/dist/policy-bM71GXRd.js +0 -134
- package/dist/resolve-allowlist-DPCTpYxi.js +0 -219
- /package/dist/{secret-contract-BuoEXmPS.js → secret-contract-DDPQm4fE.js} +0 -0
package/dist/api.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
1
|
+
import { i as msteamsSetupAdapter, n as openDelegatedOAuthUrl, r as createMSTeamsSetupWizardBase, t as msteamsSetupWizard } from "./setup-surface-CQrMX-nJ.js";
|
|
2
|
+
import { t as msteamsPlugin } from "./channel-C5CVTygn.js";
|
|
3
3
|
export { createMSTeamsSetupWizardBase, msteamsPlugin, msteamsSetupAdapter, msteamsSetupWizard, openDelegatedOAuthUrl };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { o as buildProbeChannelStatusSummary, r as PAIRING_APPROVED_MESSAGE, s as chunkTextForOutbound, t as DEFAULT_ACCOUNT_ID, u as createDefaultChannelRuntimeState } from "./runtime-api-C3EIaIpt.js";
|
|
2
|
-
import { h as resolveMSTeamsCredentials } from "./graph-users-
|
|
3
|
-
import { a as
|
|
1
|
+
import { O as resolveNestedAllowlistDecision, S as normalizeChannelSlug, T as resolveChannelEntryMatchWithFallback, _ as isDangerousNameMatchingEnabled, i as buildChannelKeyCandidates, k as resolveToolsBySender, o as buildProbeChannelStatusSummary, r as PAIRING_APPROVED_MESSAGE, s as chunkTextForOutbound, t as DEFAULT_ACCOUNT_ID, u as createDefaultChannelRuntimeState, w as resolveAllowlistMatchSimple } from "./runtime-api-C3EIaIpt.js";
|
|
2
|
+
import { h as resolveMSTeamsCredentials } from "./graph-users-ChPPxUzD.js";
|
|
3
|
+
import { a as looksLikeMSTeamsTargetId, c as parseMSTeamsConversationId, d as resolveMSTeamsUserAllowlist, i as msteamsSetupAdapter, l as parseMSTeamsTeamChannelInput, o as normalizeMSTeamsMessagingTarget, s as normalizeMSTeamsUserInput, t as msteamsSetupWizard, u as resolveMSTeamsChannelAllowlist } from "./setup-surface-CQrMX-nJ.js";
|
|
4
4
|
import { t as MSTeamsChannelConfigSchema } from "./config-schema-DwOEthCC.js";
|
|
5
|
-
import { n as resolveMSTeamsGroupToolPolicy } from "./policy-bM71GXRd.js";
|
|
6
|
-
import { i as msteamsSetupAdapter, t as msteamsSetupWizard } from "./setup-surface-Ce463w3t.js";
|
|
7
5
|
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
8
6
|
import { formatAllowFromLowercase } from "openclaw/plugin-sdk/allow-from";
|
|
9
7
|
import { createTopLevelChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
@@ -67,6 +65,138 @@ const collectMSTeamsMutableAllowlistWarnings = createDangerousNameMatchingMutabl
|
|
|
67
65
|
}]
|
|
68
66
|
});
|
|
69
67
|
//#endregion
|
|
68
|
+
//#region extensions/msteams/src/policy.ts
|
|
69
|
+
function resolveMSTeamsRouteConfig(params) {
|
|
70
|
+
const teamId = params.teamId?.trim();
|
|
71
|
+
const teamName = params.teamName?.trim();
|
|
72
|
+
const conversationId = params.conversationId?.trim();
|
|
73
|
+
const channelName = params.channelName?.trim();
|
|
74
|
+
const teams = params.cfg?.teams ?? {};
|
|
75
|
+
const allowlistConfigured = Object.keys(teams).length > 0;
|
|
76
|
+
const teamMatch = resolveChannelEntryMatchWithFallback({
|
|
77
|
+
entries: teams,
|
|
78
|
+
keys: buildChannelKeyCandidates(teamId, params.allowNameMatching ? teamName : void 0, params.allowNameMatching && teamName ? normalizeChannelSlug(teamName) : void 0),
|
|
79
|
+
wildcardKey: "*",
|
|
80
|
+
normalizeKey: normalizeChannelSlug
|
|
81
|
+
});
|
|
82
|
+
const teamConfig = teamMatch.entry;
|
|
83
|
+
const channels = teamConfig?.channels ?? {};
|
|
84
|
+
const channelAllowlistConfigured = Object.keys(channels).length > 0;
|
|
85
|
+
const channelMatch = resolveChannelEntryMatchWithFallback({
|
|
86
|
+
entries: channels,
|
|
87
|
+
keys: buildChannelKeyCandidates(conversationId, params.allowNameMatching ? channelName : void 0, params.allowNameMatching && channelName ? normalizeChannelSlug(channelName) : void 0),
|
|
88
|
+
wildcardKey: "*",
|
|
89
|
+
normalizeKey: normalizeChannelSlug
|
|
90
|
+
});
|
|
91
|
+
const channelConfig = channelMatch.entry;
|
|
92
|
+
return {
|
|
93
|
+
teamConfig,
|
|
94
|
+
channelConfig,
|
|
95
|
+
allowlistConfigured,
|
|
96
|
+
allowed: resolveNestedAllowlistDecision({
|
|
97
|
+
outerConfigured: allowlistConfigured,
|
|
98
|
+
outerMatched: Boolean(teamConfig),
|
|
99
|
+
innerConfigured: channelAllowlistConfigured,
|
|
100
|
+
innerMatched: Boolean(channelConfig)
|
|
101
|
+
}),
|
|
102
|
+
teamKey: teamMatch.matchKey ?? teamMatch.key,
|
|
103
|
+
channelKey: channelMatch.matchKey ?? channelMatch.key,
|
|
104
|
+
channelMatchKey: channelMatch.matchKey,
|
|
105
|
+
channelMatchSource: channelMatch.matchSource === "direct" || channelMatch.matchSource === "wildcard" ? channelMatch.matchSource : void 0
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function resolveMSTeamsGroupToolPolicy(params) {
|
|
109
|
+
const cfg = params.cfg.channels?.msteams;
|
|
110
|
+
if (!cfg) return;
|
|
111
|
+
const groupId = params.groupId?.trim();
|
|
112
|
+
const groupChannel = params.groupChannel?.trim();
|
|
113
|
+
const groupSpace = params.groupSpace?.trim();
|
|
114
|
+
const allowNameMatching = isDangerousNameMatchingEnabled(cfg);
|
|
115
|
+
const resolved = resolveMSTeamsRouteConfig({
|
|
116
|
+
cfg,
|
|
117
|
+
teamId: groupSpace,
|
|
118
|
+
teamName: groupSpace,
|
|
119
|
+
conversationId: groupId,
|
|
120
|
+
channelName: groupChannel,
|
|
121
|
+
allowNameMatching
|
|
122
|
+
});
|
|
123
|
+
if (resolved.channelConfig) {
|
|
124
|
+
const senderPolicy = resolveToolsBySender({
|
|
125
|
+
toolsBySender: resolved.channelConfig.toolsBySender,
|
|
126
|
+
senderId: params.senderId,
|
|
127
|
+
senderName: params.senderName,
|
|
128
|
+
senderUsername: params.senderUsername,
|
|
129
|
+
senderE164: params.senderE164
|
|
130
|
+
});
|
|
131
|
+
if (senderPolicy) return senderPolicy;
|
|
132
|
+
if (resolved.channelConfig.tools) return resolved.channelConfig.tools;
|
|
133
|
+
const teamSenderPolicy = resolveToolsBySender({
|
|
134
|
+
toolsBySender: resolved.teamConfig?.toolsBySender,
|
|
135
|
+
senderId: params.senderId,
|
|
136
|
+
senderName: params.senderName,
|
|
137
|
+
senderUsername: params.senderUsername,
|
|
138
|
+
senderE164: params.senderE164
|
|
139
|
+
});
|
|
140
|
+
if (teamSenderPolicy) return teamSenderPolicy;
|
|
141
|
+
return resolved.teamConfig?.tools;
|
|
142
|
+
}
|
|
143
|
+
if (resolved.teamConfig) {
|
|
144
|
+
const teamSenderPolicy = resolveToolsBySender({
|
|
145
|
+
toolsBySender: resolved.teamConfig.toolsBySender,
|
|
146
|
+
senderId: params.senderId,
|
|
147
|
+
senderName: params.senderName,
|
|
148
|
+
senderUsername: params.senderUsername,
|
|
149
|
+
senderE164: params.senderE164
|
|
150
|
+
});
|
|
151
|
+
if (teamSenderPolicy) return teamSenderPolicy;
|
|
152
|
+
if (resolved.teamConfig.tools) return resolved.teamConfig.tools;
|
|
153
|
+
}
|
|
154
|
+
if (!groupId) return;
|
|
155
|
+
const channelCandidates = buildChannelKeyCandidates(groupId, allowNameMatching ? groupChannel : void 0, allowNameMatching && groupChannel ? normalizeChannelSlug(groupChannel) : void 0);
|
|
156
|
+
for (const teamConfig of Object.values(cfg.teams ?? {})) {
|
|
157
|
+
const match = resolveChannelEntryMatchWithFallback({
|
|
158
|
+
entries: teamConfig?.channels ?? {},
|
|
159
|
+
keys: channelCandidates,
|
|
160
|
+
wildcardKey: "*",
|
|
161
|
+
normalizeKey: normalizeChannelSlug
|
|
162
|
+
});
|
|
163
|
+
if (match.entry) {
|
|
164
|
+
const senderPolicy = resolveToolsBySender({
|
|
165
|
+
toolsBySender: match.entry.toolsBySender,
|
|
166
|
+
senderId: params.senderId,
|
|
167
|
+
senderName: params.senderName,
|
|
168
|
+
senderUsername: params.senderUsername,
|
|
169
|
+
senderE164: params.senderE164
|
|
170
|
+
});
|
|
171
|
+
if (senderPolicy) return senderPolicy;
|
|
172
|
+
if (match.entry.tools) return match.entry.tools;
|
|
173
|
+
const teamSenderPolicy = resolveToolsBySender({
|
|
174
|
+
toolsBySender: teamConfig?.toolsBySender,
|
|
175
|
+
senderId: params.senderId,
|
|
176
|
+
senderName: params.senderName,
|
|
177
|
+
senderUsername: params.senderUsername,
|
|
178
|
+
senderE164: params.senderE164
|
|
179
|
+
});
|
|
180
|
+
if (teamSenderPolicy) return teamSenderPolicy;
|
|
181
|
+
return teamConfig?.tools;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
function resolveMSTeamsAllowlistMatch(params) {
|
|
186
|
+
return resolveAllowlistMatchSimple(params);
|
|
187
|
+
}
|
|
188
|
+
function resolveMSTeamsReplyPolicy(params) {
|
|
189
|
+
if (params.isDirectMessage) return {
|
|
190
|
+
requireMention: false,
|
|
191
|
+
replyStyle: "thread"
|
|
192
|
+
};
|
|
193
|
+
const requireMention = params.channelConfig?.requireMention ?? params.teamConfig?.requireMention ?? params.globalConfig?.requireMention ?? true;
|
|
194
|
+
return {
|
|
195
|
+
requireMention,
|
|
196
|
+
replyStyle: params.channelConfig?.replyStyle ?? params.teamConfig?.replyStyle ?? params.globalConfig?.replyStyle ?? (requireMention ? "thread" : "top-level")
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
//#endregion
|
|
70
200
|
//#region extensions/msteams/src/presentation.ts
|
|
71
201
|
function buildMSTeamsPresentationCard(params) {
|
|
72
202
|
const body = [];
|
|
@@ -183,7 +313,7 @@ const collectMSTeamsSecurityWarnings = createAllowlistProviderGroupPolicyWarning
|
|
|
183
313
|
resolveGroupPolicy: ({ cfg }) => cfg.channels?.msteams?.groupPolicy,
|
|
184
314
|
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."] : []
|
|
185
315
|
});
|
|
186
|
-
const loadMSTeamsChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-
|
|
316
|
+
const loadMSTeamsChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-fqvE_yLN.js"), "msTeamsChannelRuntime");
|
|
187
317
|
const resolveMSTeamsChannelConfig = (cfg) => ({
|
|
188
318
|
allowFrom: cfg.channels?.msteams?.allowFrom,
|
|
189
319
|
defaultTo: cfg.channels?.msteams?.defaultTo
|
|
@@ -965,7 +1095,7 @@ const msteamsPlugin = createChatChannelPlugin({
|
|
|
965
1095
|
})
|
|
966
1096
|
}),
|
|
967
1097
|
gateway: { startAccount: async (ctx) => {
|
|
968
|
-
const { monitorMSTeamsProvider } = await import("./src-
|
|
1098
|
+
const { monitorMSTeamsProvider } = await import("./src-CYZq-lQ4.js");
|
|
969
1099
|
const port = ctx.cfg.channels?.msteams?.webhook?.port ?? 3978;
|
|
970
1100
|
ctx.setStatus({
|
|
971
1101
|
accountId: ctx.accountId,
|
|
@@ -1006,4 +1136,4 @@ const msteamsPlugin = createChatChannelPlugin({
|
|
|
1006
1136
|
outbound: msteamsChannelOutbound
|
|
1007
1137
|
});
|
|
1008
1138
|
//#endregion
|
|
1009
|
-
export { msteamsPlugin as t };
|
|
1139
|
+
export { resolveMSTeamsRouteConfig as i, resolveMSTeamsAllowlistMatch as n, resolveMSTeamsReplyPolicy as r, msteamsPlugin as t };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as msteamsPlugin } from "./channel-
|
|
1
|
+
import { t as msteamsPlugin } from "./channel-C5CVTygn.js";
|
|
2
2
|
export { msteamsPlugin };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { s as chunkTextForOutbound } from "./runtime-api-C3EIaIpt.js";
|
|
2
|
-
import { a as fetchGraphJson, c as normalizeQuery, d as postGraphJson, f as resolveGraphToken, i as fetchGraphAbsoluteUrl, l as patchGraphJson, n as deleteGraphRequest, o as listChannelsForTeam, r as escapeOData, s as listTeamsByName, t as searchGraphUsers, u as postGraphBetaJson } from "./graph-users-
|
|
3
|
-
import { S as createMSTeamsConversationStoreFs, a as sendMessageMSTeams, b as createMSTeamsPollStoreFs, i as sendAdaptiveCardMSTeams, n as deleteMessageMSTeams, o as sendPollMSTeams, r as editMessageMSTeams, t as probeMSTeams } from "./probe-
|
|
2
|
+
import { a as fetchGraphJson, c as normalizeQuery, d as postGraphJson, f as resolveGraphToken, i as fetchGraphAbsoluteUrl, l as patchGraphJson, n as deleteGraphRequest, o as listChannelsForTeam, r as escapeOData, s as listTeamsByName, t as searchGraphUsers, u as postGraphBetaJson } from "./graph-users-ChPPxUzD.js";
|
|
3
|
+
import { S as createMSTeamsConversationStoreFs, a as sendMessageMSTeams, b as createMSTeamsPollStoreFs, i as sendAdaptiveCardMSTeams, n as deleteMessageMSTeams, o as sendPollMSTeams, r as editMessageMSTeams, t as probeMSTeams } from "./probe-I2DM0U-s.js";
|
|
4
4
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { createAttachedChannelResultAdapter } from "openclaw/plugin-sdk/channel-send-result";
|
|
6
6
|
import { resolveOutboundSendDep } from "openclaw/plugin-sdk/outbound-send-deps";
|
package/dist/contract-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-
|
|
1
|
+
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-DDPQm4fE.js";
|
|
2
2
|
export { collectRuntimeConfigAssignments, secretTargetRegistryEntries };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { M as getMSTeamsRuntime, h as fetchWithSsrFGuard$1 } from "./runtime-api-C3EIaIpt.js";
|
|
2
|
-
import { n as refreshMSTeamsDelegatedTokens } from "./oauth.token-
|
|
2
|
+
import { n as refreshMSTeamsDelegatedTokens } from "./oauth.token-mUfXUE0j.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { isRecord as isRecord$2, normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
6
|
+
import { readProviderJsonResponse } from "openclaw/plugin-sdk/provider-http";
|
|
6
7
|
import { Buffer } from "node:buffer";
|
|
7
8
|
import { lookup } from "node:dns/promises";
|
|
8
9
|
import { buildHostnameAllowlistPolicyFromSuffixAllowlist, isHttpsUrlAllowedByHostnameSuffixAllowlist, isPrivateIpAddress, normalizeHostnameSuffixAllowlist } from "openclaw/plugin-sdk/ssrf-policy";
|
|
@@ -180,8 +181,24 @@ function extractHtmlFromAttachment(att) {
|
|
|
180
181
|
if (!isRecord$2(att.content)) return;
|
|
181
182
|
return typeof att.content.text === "string" ? att.content.text : typeof att.content.body === "string" ? att.content.body : typeof att.content.content === "string" ? att.content.content : void 0;
|
|
182
183
|
}
|
|
183
|
-
function
|
|
184
|
-
|
|
184
|
+
function canonicalizeInlineBase64Payload(value) {
|
|
185
|
+
let cleaned = "";
|
|
186
|
+
let padding = 0;
|
|
187
|
+
let sawPadding = false;
|
|
188
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
189
|
+
const code = value.charCodeAt(index);
|
|
190
|
+
if (code <= 32) continue;
|
|
191
|
+
if (code === 61) {
|
|
192
|
+
padding += 1;
|
|
193
|
+
if (padding > 2) return;
|
|
194
|
+
sawPadding = true;
|
|
195
|
+
cleaned += "=";
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
if (sawPadding || !(code >= 65 && code <= 90 || code >= 97 && code <= 122 || code >= 48 && code <= 57 || code === 43 || code === 47)) return;
|
|
199
|
+
cleaned += value[index];
|
|
200
|
+
}
|
|
201
|
+
return cleaned && cleaned.length % 4 === 0 ? cleaned : void 0;
|
|
185
202
|
}
|
|
186
203
|
function decodeDataImageWithLimits(src, opts) {
|
|
187
204
|
const match = /^data:(image\/[a-z0-9.+-]+)?(;base64)?,(.*)$/i.exec(src);
|
|
@@ -194,12 +211,12 @@ function decodeDataImageWithLimits(src, opts) {
|
|
|
194
211
|
candidate: null,
|
|
195
212
|
estimatedBytes: 0
|
|
196
213
|
};
|
|
197
|
-
const
|
|
198
|
-
if (!
|
|
214
|
+
const canonicalPayload = canonicalizeInlineBase64Payload(match[3] ?? "");
|
|
215
|
+
if (!canonicalPayload) return {
|
|
199
216
|
candidate: null,
|
|
200
217
|
estimatedBytes: 0
|
|
201
218
|
};
|
|
202
|
-
const estimatedBytes = estimateBase64DecodedBytes(
|
|
219
|
+
const estimatedBytes = estimateBase64DecodedBytes(canonicalPayload);
|
|
203
220
|
if (estimatedBytes <= 0) return {
|
|
204
221
|
candidate: null,
|
|
205
222
|
estimatedBytes: 0
|
|
@@ -212,7 +229,7 @@ function decodeDataImageWithLimits(src, opts) {
|
|
|
212
229
|
return {
|
|
213
230
|
candidate: {
|
|
214
231
|
kind: "data",
|
|
215
|
-
data: Buffer.from(
|
|
232
|
+
data: Buffer.from(canonicalPayload, "base64"),
|
|
216
233
|
contentType,
|
|
217
234
|
placeholder: "<media:image>"
|
|
218
235
|
},
|
|
@@ -1179,6 +1196,12 @@ async function resolveDelegatedAccessToken(params) {
|
|
|
1179
1196
|
//#endregion
|
|
1180
1197
|
//#region extensions/msteams/src/graph.ts
|
|
1181
1198
|
const GRAPH_BETA = "https://graph.microsoft.com/beta";
|
|
1199
|
+
const NULL_BODY_STATUSES = new Set([
|
|
1200
|
+
101,
|
|
1201
|
+
204,
|
|
1202
|
+
205,
|
|
1203
|
+
304
|
|
1204
|
+
]);
|
|
1182
1205
|
function normalizeQuery(value) {
|
|
1183
1206
|
return value?.trim() ?? "";
|
|
1184
1207
|
}
|
|
@@ -1187,25 +1210,41 @@ function escapeOData(value) {
|
|
|
1187
1210
|
}
|
|
1188
1211
|
async function requestGraph(params) {
|
|
1189
1212
|
const hasBody = params.body !== void 0;
|
|
1190
|
-
const
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1213
|
+
const url = `${params.root ?? "https://graph.microsoft.com/v1.0"}${params.path}`;
|
|
1214
|
+
const currentFetch = globalThis.fetch;
|
|
1215
|
+
const { response, release } = await fetchWithSsrFGuard$1({
|
|
1216
|
+
url,
|
|
1217
|
+
fetchImpl: async (input, guardedInit) => await currentFetch(input, guardedInit),
|
|
1218
|
+
init: {
|
|
1219
|
+
method: params.method,
|
|
1220
|
+
headers: {
|
|
1221
|
+
"User-Agent": buildUserAgent(),
|
|
1222
|
+
Authorization: `Bearer ${params.token}`,
|
|
1223
|
+
...hasBody ? { "Content-Type": "application/json" } : {},
|
|
1224
|
+
...params.headers
|
|
1225
|
+
},
|
|
1226
|
+
body: hasBody ? JSON.stringify(params.body) : void 0
|
|
1197
1227
|
},
|
|
1198
|
-
|
|
1228
|
+
auditContext: "msteams.graph"
|
|
1199
1229
|
});
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1230
|
+
try {
|
|
1231
|
+
if (!response.ok) {
|
|
1232
|
+
const text = await response.text().catch(() => "");
|
|
1233
|
+
throw new Error(`${params.errorPrefix ?? "Graph"} ${params.path} failed (${response.status}): ${text || "unknown error"}`);
|
|
1234
|
+
}
|
|
1235
|
+
const body = NULL_BODY_STATUSES.has(response.status) ? null : await response.arrayBuffer();
|
|
1236
|
+
return new Response(body, {
|
|
1237
|
+
status: response.status,
|
|
1238
|
+
statusText: response.statusText,
|
|
1239
|
+
headers: new Headers(response.headers)
|
|
1240
|
+
});
|
|
1241
|
+
} finally {
|
|
1242
|
+
await release();
|
|
1203
1243
|
}
|
|
1204
|
-
return res;
|
|
1205
1244
|
}
|
|
1206
|
-
async function readOptionalGraphJson(res) {
|
|
1245
|
+
async function readOptionalGraphJson(res, label) {
|
|
1207
1246
|
if (res.status === 204 || res.headers?.get?.("content-length") === "0") return;
|
|
1208
|
-
return await res
|
|
1247
|
+
return await readProviderJsonResponse(res, label);
|
|
1209
1248
|
}
|
|
1210
1249
|
async function fetchGraphJson(params) {
|
|
1211
1250
|
return await readOptionalGraphJson(await requestGraph({
|
|
@@ -1214,7 +1253,7 @@ async function fetchGraphJson(params) {
|
|
|
1214
1253
|
method: params.method,
|
|
1215
1254
|
body: params.body,
|
|
1216
1255
|
headers: params.headers
|
|
1217
|
-
}));
|
|
1256
|
+
}), `Graph ${params.path} failed`);
|
|
1218
1257
|
}
|
|
1219
1258
|
/**
|
|
1220
1259
|
* Fetch JSON from an absolute Graph API URL (for example @odata.nextLink
|
|
@@ -1235,7 +1274,7 @@ async function fetchGraphAbsoluteUrl(params) {
|
|
|
1235
1274
|
const text = await response.text().catch(() => "");
|
|
1236
1275
|
throw new Error(`Graph ${params.url} failed (${response.status}): ${text || "unknown error"}`);
|
|
1237
1276
|
}
|
|
1238
|
-
return await response.
|
|
1277
|
+
return await readProviderJsonResponse(response, `Graph ${params.url} failed`);
|
|
1239
1278
|
} finally {
|
|
1240
1279
|
await release();
|
|
1241
1280
|
}
|
|
@@ -1309,7 +1348,7 @@ async function postGraphJson(params) {
|
|
|
1309
1348
|
method: "POST",
|
|
1310
1349
|
body: params.body,
|
|
1311
1350
|
errorPrefix: "Graph POST"
|
|
1312
|
-
}));
|
|
1351
|
+
}), `Graph POST ${params.path} failed`);
|
|
1313
1352
|
}
|
|
1314
1353
|
async function postGraphBetaJson(params) {
|
|
1315
1354
|
return readOptionalGraphJson(await requestGraph({
|
|
@@ -1319,7 +1358,7 @@ async function postGraphBetaJson(params) {
|
|
|
1319
1358
|
root: GRAPH_BETA,
|
|
1320
1359
|
body: params.body,
|
|
1321
1360
|
errorPrefix: "Graph beta POST"
|
|
1322
|
-
}));
|
|
1361
|
+
}), `Graph beta POST ${params.path} failed`);
|
|
1323
1362
|
}
|
|
1324
1363
|
async function deleteGraphRequest(params) {
|
|
1325
1364
|
await requestGraph({
|
|
@@ -1330,15 +1369,13 @@ async function deleteGraphRequest(params) {
|
|
|
1330
1369
|
});
|
|
1331
1370
|
}
|
|
1332
1371
|
async function patchGraphJson(params) {
|
|
1333
|
-
|
|
1372
|
+
return readOptionalGraphJson(await requestGraph({
|
|
1334
1373
|
token: params.token,
|
|
1335
1374
|
path: params.path,
|
|
1336
1375
|
method: "PATCH",
|
|
1337
1376
|
body: params.body,
|
|
1338
1377
|
errorPrefix: "Graph PATCH"
|
|
1339
|
-
});
|
|
1340
|
-
if (res.status === 204 || res.headers.get("content-length") === "0") return;
|
|
1341
|
-
return await res.json();
|
|
1378
|
+
}), `Graph PATCH ${params.path} failed`);
|
|
1342
1379
|
}
|
|
1343
1380
|
async function listChannelsForTeam(token, teamId) {
|
|
1344
1381
|
const { items } = await fetchAllGraphPages({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as MSTEAMS_OAUTH_CALLBACK_PORT, i as MSTEAMS_OAUTH_CALLBACK_PATH, o as MSTEAMS_OAUTH_REDIRECT_URI, r as MSTEAMS_DEFAULT_DELEGATED_SCOPES, s as buildMSTeamsAuthEndpoint, t as exchangeMSTeamsCodeForTokens } from "./oauth.token-
|
|
1
|
+
import { a as MSTEAMS_OAUTH_CALLBACK_PORT, i as MSTEAMS_OAUTH_CALLBACK_PATH, o as MSTEAMS_OAUTH_REDIRECT_URI, r as MSTEAMS_DEFAULT_DELEGATED_SCOPES, s as buildMSTeamsAuthEndpoint, t as exchangeMSTeamsCodeForTokens } from "./oauth.token-mUfXUE0j.js";
|
|
2
2
|
import { generateHexPkceVerifierChallenge } from "openclaw/plugin-sdk/provider-auth";
|
|
3
3
|
import { generateOAuthState, parseOAuthCallbackInput, waitForLocalOAuthCallback } from "openclaw/plugin-sdk/provider-auth-runtime";
|
|
4
4
|
import { isWSL2Sync } from "openclaw/plugin-sdk/runtime-env";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
2
|
+
import { readProviderJsonResponse } from "openclaw/plugin-sdk/provider-http";
|
|
2
3
|
//#region extensions/msteams/src/oauth.shared.ts
|
|
3
4
|
const MSTEAMS_OAUTH_REDIRECT_URI = "http://localhost:8086/oauth2callback";
|
|
4
5
|
const MSTEAMS_OAUTH_CALLBACK_PORT = 8086;
|
|
@@ -51,7 +52,7 @@ async function fetchMSTeamsTokens(params) {
|
|
|
51
52
|
const errorText = await response.text();
|
|
52
53
|
throw new Error(`MSTeams ${params.failureLabel} failed (${response.status}): ${errorText}`);
|
|
53
54
|
}
|
|
54
|
-
return await response.
|
|
55
|
+
return await readProviderJsonResponse(response, `MSTeams ${params.failureLabel} failed`);
|
|
55
56
|
} finally {
|
|
56
57
|
await release();
|
|
57
58
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { C as normalizeStringEntries, E as resolveChannelMediaMaxBytes, M as getMSTeamsRuntime, d as detectMime, g as getFileExtension, m as extractOriginalFilename, p as extensionForMime, y as loadOutboundMediaFromUrl } from "./runtime-api-C3EIaIpt.js";
|
|
2
|
-
import { C as loadMSTeamsSdkWithAuth, D as formatMSTeamsSendErrorHint, E as classifyMSTeamsSendError, O as formatUnknownError, S as createMSTeamsTokenProvider, _ as resolveMSTeamsStorePath, h as resolveMSTeamsCredentials, k as isRevokedProxyError, m as loadDelegatedTokens, w as buildUserAgent, x as createMSTeamsAdapter, y as readAccessToken } from "./graph-users-
|
|
3
|
-
import { i as resolveMSTeamsRouteConfig, r as resolveMSTeamsReplyPolicy } from "./
|
|
2
|
+
import { C as loadMSTeamsSdkWithAuth, D as formatMSTeamsSendErrorHint, E as classifyMSTeamsSendError, O as formatUnknownError, S as createMSTeamsTokenProvider, _ as resolveMSTeamsStorePath, h as resolveMSTeamsCredentials, k as isRevokedProxyError, m as loadDelegatedTokens, w as buildUserAgent, x as createMSTeamsAdapter, y as readAccessToken } from "./graph-users-ChPPxUzD.js";
|
|
3
|
+
import { i as resolveMSTeamsRouteConfig, r as resolveMSTeamsReplyPolicy } from "./channel-C5CVTygn.js";
|
|
4
4
|
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-message";
|
|
5
5
|
import { isRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { withFileLock } from "openclaw/plugin-sdk/file-lock";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries, t as channelSecrets } from "./secret-contract-
|
|
1
|
+
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries, t as channelSecrets } from "./secret-contract-DDPQm4fE.js";
|
|
2
2
|
export { channelSecrets, collectRuntimeConfigAssignments, secretTargetRegistryEntries };
|
package/dist/setup-plugin-api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { h as resolveMSTeamsCredentials } from "./graph-users-
|
|
1
|
+
import { h as resolveMSTeamsCredentials } from "./graph-users-ChPPxUzD.js";
|
|
2
|
+
import { i as msteamsSetupAdapter, t as msteamsSetupWizard } from "./setup-surface-CQrMX-nJ.js";
|
|
2
3
|
import { t as MSTeamsChannelConfigSchema } from "./config-schema-DwOEthCC.js";
|
|
3
|
-
import { i as msteamsSetupAdapter, t as msteamsSetupWizard } from "./setup-surface-Ce463w3t.js";
|
|
4
4
|
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
5
5
|
import { formatAllowFromLowercase } from "openclaw/plugin-sdk/allow-from";
|
|
6
6
|
import { createTopLevelChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
|