@openclaw/msteams 2026.9.4 → 2026.9.5
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/assets/activity.svg +40 -0
- package/assets/icon.png +0 -0
- package/dist/{approval-handler.runtime-DRhFNeJS.cjs → .setup/approval-handler.runtime-DDxGPJDz.cjs} +3 -3
- package/dist/{channel-B9LIyYeu.cjs → .setup/channel-Dzpbbht8.cjs} +62 -35
- package/dist/{channel.runtime-BergqMHg.cjs → .setup/channel.runtime-TE49QvFv.cjs} +57 -32
- package/dist/{channel.setup-BhxokviI.cjs → .setup/channel.setup-BVDfgdCc.cjs} +3 -3
- package/dist/{delegated-state-DiEz9JIa.cjs → .setup/delegated-state-u-ywZyZT.cjs} +5 -5
- package/dist/{messenger-TLdZf9Ar.cjs → .setup/messenger-BR1l4zw-.cjs} +108 -178
- package/dist/{oauth-DUtLTz2u.cjs → .setup/oauth-C6m7dvHj.cjs} +1 -1
- package/dist/{polls-BBdZPx_R.cjs → .setup/polls-BJ4-4uZm.cjs} +14 -7
- package/dist/{reaction-types-BbBBdnQ5.cjs → .setup/reaction-types-C7RA7Wxt.cjs} +1 -1
- package/dist/{resolve-allowlist-DmUTQxEz.cjs → .setup/resolve-allowlist-CHzaaWiC.cjs} +135 -93
- package/dist/.setup/secret-contract-api-ChQdBeU1.cjs +4 -0
- package/dist/.setup/secret-contract-api-ipiUsANg.cjs +28 -0
- package/dist/{send-CU61PSDN.cjs → .setup/send-D8ATH4QI.cjs} +95 -33
- package/dist/.setup/setup-plugin-api-DpiaA8z1.cjs +3 -0
- package/dist/{src-D7Do7sM5.cjs → .setup/src-CpKfpP1m.cjs} +132 -54
- package/dist/{sso-token-store-DTeYxubp.cjs → .setup/sso-token-store-YYLHXgFH.cjs} +1 -1
- package/dist/{thread-session-NmA7_njI.cjs → .setup/thread-session-CXgHK-yi.cjs} +1 -1
- package/dist/api.cjs +2 -2
- package/dist/channel-config-api.cjs +1 -1
- package/dist/channel-plugin-api.cjs +1 -1
- package/dist/configured-state.cjs +1 -1
- package/dist/directory-contract-api.cjs +1 -1
- package/dist/doctor-contract-api.cjs +64 -62
- package/dist/qa-runner-api.cjs +1 -1
- package/dist/runtime-api.cjs +1 -1
- package/dist/secret-contract-api.cjs +4 -13
- package/dist/setup-entry.cjs +5 -3
- package/dist/setup-plugin-api.cjs +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +14 -11
- package/dist/{adapter.runtime-BzR3RK2J.cjs → .setup/adapter.runtime-ChuVK6k_.cjs} +2 -2
- /package/dist/{approval-card-CPNH_q3P.cjs → .setup/approval-card-CPNH_q3P.cjs} +0 -0
- /package/dist/{config-schema-D22Lr1Qk.cjs → .setup/config-schema-D22Lr1Qk.cjs} +0 -0
- /package/dist/{rolldown-runtime-VH7oDXx4.cjs → .setup/rolldown-runtime-VH7oDXx4.cjs} +0 -0
- /package/dist/{runtime-gZTAuFux.cjs → .setup/runtime-gZTAuFux.cjs} +0 -0
- /package/dist/{secret-input-C65t6kjM.cjs → .setup/secret-input-C65t6kjM.cjs} +0 -0
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
const require_runtime = require("./runtime-gZTAuFux.cjs");
|
|
2
|
-
require("
|
|
3
|
-
const require_delegated_state = require("./delegated-state-
|
|
2
|
+
require("../runtime-api.cjs");
|
|
3
|
+
const require_delegated_state = require("./delegated-state-u-ywZyZT.cjs");
|
|
4
4
|
require("./secret-input-C65t6kjM.cjs");
|
|
5
5
|
let openclaw_plugin_sdk_lazy_runtime = require("openclaw/plugin-sdk/lazy-runtime");
|
|
6
6
|
let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
|
|
7
7
|
let openclaw_plugin_sdk_allow_from = require("openclaw/plugin-sdk/allow-from");
|
|
8
|
+
let node_async_hooks = require("node:async_hooks");
|
|
8
9
|
let openclaw_plugin_sdk_fetch_runtime = require("openclaw/plugin-sdk/fetch-runtime");
|
|
9
10
|
let openclaw_plugin_sdk_provider_http = require("openclaw/plugin-sdk/provider-http");
|
|
10
11
|
let openclaw_plugin_sdk_ssrf_runtime = require("openclaw/plugin-sdk/ssrf-runtime");
|
|
@@ -14,6 +15,7 @@ let openclaw_plugin_sdk_ssrf_policy = require("openclaw/plugin-sdk/ssrf-policy")
|
|
|
14
15
|
let openclaw_plugin_sdk_number_runtime = require("openclaw/plugin-sdk/number-runtime");
|
|
15
16
|
let openclaw_plugin_sdk_text_utility_runtime = require("openclaw/plugin-sdk/text-utility-runtime");
|
|
16
17
|
let openclaw_plugin_sdk_secret_file = require("openclaw/plugin-sdk/secret-file");
|
|
18
|
+
let openclaw_plugin_sdk_error_runtime = require("openclaw/plugin-sdk/error-runtime");
|
|
17
19
|
let node_module = require("node:module");
|
|
18
20
|
let openclaw_plugin_sdk_html_entity_runtime = require("openclaw/plugin-sdk/html-entity-runtime");
|
|
19
21
|
let openclaw_plugin_sdk_secret_input = require("openclaw/plugin-sdk/secret-input");
|
|
@@ -222,66 +224,6 @@ function extractHtmlFromAttachment(att) {
|
|
|
222
224
|
if (!(0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(att.content)) return;
|
|
223
225
|
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;
|
|
224
226
|
}
|
|
225
|
-
function canonicalizeInlineBase64Payload(value) {
|
|
226
|
-
let cleaned = "";
|
|
227
|
-
let padding = 0;
|
|
228
|
-
let sawPadding = false;
|
|
229
|
-
for (let index = 0; index < value.length; index += 1) {
|
|
230
|
-
const code = value.charCodeAt(index);
|
|
231
|
-
if (code <= 32) continue;
|
|
232
|
-
if (code === 61) {
|
|
233
|
-
padding += 1;
|
|
234
|
-
if (padding > 2) return;
|
|
235
|
-
sawPadding = true;
|
|
236
|
-
cleaned += "=";
|
|
237
|
-
continue;
|
|
238
|
-
}
|
|
239
|
-
if (sawPadding || !(code >= 65 && code <= 90 || code >= 97 && code <= 122 || code >= 48 && code <= 57 || code === 43 || code === 47)) return;
|
|
240
|
-
cleaned += value[index];
|
|
241
|
-
}
|
|
242
|
-
return cleaned && cleaned.length % 4 === 0 ? cleaned : void 0;
|
|
243
|
-
}
|
|
244
|
-
function decodeDataImageWithLimits(src, opts) {
|
|
245
|
-
const match = /^data:(image\/[a-z0-9.+-]+)?(;base64)?,(.*)$/i.exec(src);
|
|
246
|
-
if (!match) return {
|
|
247
|
-
candidate: null,
|
|
248
|
-
estimatedBytes: 0
|
|
249
|
-
};
|
|
250
|
-
const contentType = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeLowercaseStringOrEmpty)(match[1] ?? "");
|
|
251
|
-
if (!Boolean(match[2])) return {
|
|
252
|
-
candidate: null,
|
|
253
|
-
estimatedBytes: 0
|
|
254
|
-
};
|
|
255
|
-
const canonicalPayload = canonicalizeInlineBase64Payload(match[3] ?? "");
|
|
256
|
-
if (!canonicalPayload) return {
|
|
257
|
-
candidate: null,
|
|
258
|
-
estimatedBytes: 0
|
|
259
|
-
};
|
|
260
|
-
const estimatedBytes = node_buffer.Buffer.byteLength(canonicalPayload, "base64");
|
|
261
|
-
if (estimatedBytes <= 0) return {
|
|
262
|
-
candidate: null,
|
|
263
|
-
estimatedBytes: 0
|
|
264
|
-
};
|
|
265
|
-
if (typeof opts.maxInlineBytes === "number" && estimatedBytes > opts.maxInlineBytes) return {
|
|
266
|
-
candidate: null,
|
|
267
|
-
estimatedBytes
|
|
268
|
-
};
|
|
269
|
-
try {
|
|
270
|
-
return {
|
|
271
|
-
candidate: {
|
|
272
|
-
kind: "data",
|
|
273
|
-
data: node_buffer.Buffer.from(canonicalPayload, "base64"),
|
|
274
|
-
contentType
|
|
275
|
-
},
|
|
276
|
-
estimatedBytes
|
|
277
|
-
};
|
|
278
|
-
} catch {
|
|
279
|
-
return {
|
|
280
|
-
candidate: null,
|
|
281
|
-
estimatedBytes: 0
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
227
|
function fileHintFromUrl(src) {
|
|
286
228
|
try {
|
|
287
229
|
return new URL(src).pathname.split("/").pop() || void 0;
|
|
@@ -289,14 +231,13 @@ function fileHintFromUrl(src) {
|
|
|
289
231
|
return;
|
|
290
232
|
}
|
|
291
233
|
}
|
|
292
|
-
function
|
|
234
|
+
function extractInlineImageReferences(attachments) {
|
|
293
235
|
const out = [];
|
|
294
236
|
const seenReferences = /* @__PURE__ */ new Set();
|
|
295
237
|
const representedAttachmentIds = new Set(attachments.flatMap((attachment) => {
|
|
296
238
|
const id = attachment.id?.trim();
|
|
297
239
|
return id && !extractHtmlFromAttachment(attachment) ? [id] : [];
|
|
298
240
|
}));
|
|
299
|
-
let totalEstimatedInlineBytes = 0;
|
|
300
241
|
for (const att of attachments) {
|
|
301
242
|
const html = extractHtmlFromAttachment(att);
|
|
302
243
|
if (!html) continue;
|
|
@@ -305,17 +246,11 @@ function extractInlineImageCandidates(attachments, limits) {
|
|
|
305
246
|
while (match) {
|
|
306
247
|
const src = match[1]?.trim();
|
|
307
248
|
if (src) {
|
|
308
|
-
if (src.startsWith("data:")) {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
else {
|
|
314
|
-
totalEstimatedInlineBytes = nextTotal;
|
|
315
|
-
out.push(decoded);
|
|
316
|
-
}
|
|
317
|
-
} else out.push({ kind: "unavailable" });
|
|
318
|
-
} else if (!seenReferences.has(src)) {
|
|
249
|
+
if (src.startsWith("data:")) out.push({
|
|
250
|
+
kind: "data",
|
|
251
|
+
src
|
|
252
|
+
});
|
|
253
|
+
else if (!seenReferences.has(src)) {
|
|
319
254
|
seenReferences.add(src);
|
|
320
255
|
if (src.startsWith("cid:")) {
|
|
321
256
|
const sourceId = src.slice(4) || void 0;
|
|
@@ -590,6 +525,54 @@ function normalizeBotFrameworkServiceUrl(serviceUrl) {
|
|
|
590
525
|
throw new Error(`Blocked Microsoft Teams serviceUrl host: ${describeBotFrameworkServiceUrlHost(serviceUrl)}`);
|
|
591
526
|
}
|
|
592
527
|
//#endregion
|
|
528
|
+
//#region extensions/msteams/src/send-handoff.ts
|
|
529
|
+
const connectorHandoff = new node_async_hooks.AsyncLocalStorage();
|
|
530
|
+
function notDispatched(error) {
|
|
531
|
+
return error instanceof openclaw_plugin_sdk_error_runtime.PlatformMessageNotDispatchedError ? error : new openclaw_plugin_sdk_error_runtime.PlatformMessageNotDispatchedError(error instanceof Error ? error.message : "Teams delivery authority closed", {
|
|
532
|
+
cause: error,
|
|
533
|
+
retryable: false
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
function assertMSTeamsSendHandoff(handoff) {
|
|
537
|
+
try {
|
|
538
|
+
handoff?.assertDirectAdapterHandoff?.();
|
|
539
|
+
} catch (error) {
|
|
540
|
+
throw notDispatched(error);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
function withMSTeamsConnectorHandoff(handoff, send) {
|
|
544
|
+
const current = handoff.assertDirectAdapterHandoff || handoff.onPlatformSendDispatch ? handoff : connectorHandoff.getStore() ?? handoff;
|
|
545
|
+
return connectorHandoff.run(current, () => send(current));
|
|
546
|
+
}
|
|
547
|
+
/** Called only by a Connector transport, after its asynchronous token preparation. */
|
|
548
|
+
async function prepareMSTeamsConnectorRequest() {
|
|
549
|
+
const handoff = connectorHandoff.getStore();
|
|
550
|
+
if (!handoff) return;
|
|
551
|
+
const assertCurrent = handoff.assertDirectAdapterHandoff ? () => assertMSTeamsSendHandoff(handoff) : void 0;
|
|
552
|
+
assertCurrent?.();
|
|
553
|
+
try {
|
|
554
|
+
await handoff.onPlatformSendDispatch?.();
|
|
555
|
+
} catch (error) {
|
|
556
|
+
throw notDispatched(error);
|
|
557
|
+
}
|
|
558
|
+
return assertCurrent;
|
|
559
|
+
}
|
|
560
|
+
const msteamsConnectorHandoffInterceptor = { request: async ({ config }) => {
|
|
561
|
+
const assertCurrent = await prepareMSTeamsConnectorRequest();
|
|
562
|
+
if (!assertCurrent) return config;
|
|
563
|
+
const transforms = config.transformRequest;
|
|
564
|
+
config.transformRequest = [...Array.isArray(transforms) ? transforms : transforms ? [transforms] : [], (data) => {
|
|
565
|
+
assertCurrent();
|
|
566
|
+
return data;
|
|
567
|
+
}];
|
|
568
|
+
const beforeRedirect = config.beforeRedirect;
|
|
569
|
+
config.beforeRedirect = (...args) => {
|
|
570
|
+
beforeRedirect?.(...args);
|
|
571
|
+
assertCurrent();
|
|
572
|
+
};
|
|
573
|
+
return config;
|
|
574
|
+
} };
|
|
575
|
+
//#endregion
|
|
593
576
|
//#region extensions/msteams/src/qa/private-runtime.ts
|
|
594
577
|
const PRIVATE_QA_BUILD_ENV = "OPENCLAW_BUILD_PRIVATE_QA";
|
|
595
578
|
const PRIVATE_QA_NONCE_HEADER = "x-openclaw-msteams-qa-nonce";
|
|
@@ -619,6 +602,7 @@ var PrivateQaHttpClient = class PrivateQaHttpClient {
|
|
|
619
602
|
const token = typeof this.options.token === "function" ? await this.options.token() : this.options.token;
|
|
620
603
|
if (token) headers.set("authorization", `Bearer ${token}`);
|
|
621
604
|
const method = String(config.method ?? "GET").toUpperCase();
|
|
605
|
+
const assertCurrent = await prepareMSTeamsConnectorRequest();
|
|
622
606
|
const { response, release } = await (0, openclaw_plugin_sdk_ssrf_runtime.fetchWithSsrFGuard)({
|
|
623
607
|
url: targetUrl.toString(),
|
|
624
608
|
init: {
|
|
@@ -628,7 +612,8 @@ var PrivateQaHttpClient = class PrivateQaHttpClient {
|
|
|
628
612
|
},
|
|
629
613
|
policy: (0, openclaw_plugin_sdk_ssrf_runtime.ssrfPolicyFromHttpBaseUrlAllowedOrigin)(targetUrl.toString()),
|
|
630
614
|
maxRedirects: 0,
|
|
631
|
-
auditContext: "msteams-private-qa-connector"
|
|
615
|
+
auditContext: "msteams-private-qa-connector",
|
|
616
|
+
beforeRequest: assertCurrent
|
|
632
617
|
});
|
|
633
618
|
try {
|
|
634
619
|
const text = await response.text();
|
|
@@ -784,7 +769,8 @@ async function createMSTeamsApp(creds, options) {
|
|
|
784
769
|
const appOptions = {
|
|
785
770
|
client: privateQaRuntime?.client ?? options?.httpClient ?? {
|
|
786
771
|
headers: { "User-Agent": buildOpenClawUserAgentFragment() },
|
|
787
|
-
timeout: 3e4
|
|
772
|
+
timeout: 3e4,
|
|
773
|
+
interceptors: [msteamsConnectorHandoffInterceptor]
|
|
788
774
|
},
|
|
789
775
|
...privateQaRuntime ? {
|
|
790
776
|
clientSecret: "",
|
|
@@ -1057,10 +1043,10 @@ function loadDelegatedTokens() {
|
|
|
1057
1043
|
return require_delegated_state.loadMSTeamsDelegatedTokens();
|
|
1058
1044
|
}
|
|
1059
1045
|
function saveDelegatedTokens(tokens) {
|
|
1060
|
-
require_delegated_state.saveMSTeamsDelegatedTokens(tokens);
|
|
1046
|
+
return require_delegated_state.saveMSTeamsDelegatedTokens(tokens);
|
|
1061
1047
|
}
|
|
1062
1048
|
async function resolveDelegatedAccessToken(params) {
|
|
1063
|
-
const tokens = loadDelegatedTokens();
|
|
1049
|
+
const tokens = await loadDelegatedTokens();
|
|
1064
1050
|
if (!tokens) return;
|
|
1065
1051
|
if ((0, openclaw_plugin_sdk_number_runtime.isFutureDateTimestampMs)(tokens.expiresAt)) return tokens.accessToken;
|
|
1066
1052
|
try {
|
|
@@ -1071,7 +1057,7 @@ async function resolveDelegatedAccessToken(params) {
|
|
|
1071
1057
|
refreshToken: tokens.refreshToken,
|
|
1072
1058
|
scopes: tokens.scopes
|
|
1073
1059
|
});
|
|
1074
|
-
saveDelegatedTokens(refreshed);
|
|
1060
|
+
await saveDelegatedTokens(refreshed);
|
|
1075
1061
|
return refreshed.accessToken;
|
|
1076
1062
|
} catch {
|
|
1077
1063
|
return;
|
|
@@ -1080,6 +1066,19 @@ async function resolveDelegatedAccessToken(params) {
|
|
|
1080
1066
|
//#endregion
|
|
1081
1067
|
//#region extensions/msteams/src/graph.ts
|
|
1082
1068
|
const GRAPH_BETA = "https://graph.microsoft.com/beta";
|
|
1069
|
+
const graphRequestCurrentness = new node_async_hooks.AsyncLocalStorage();
|
|
1070
|
+
function runWithMSTeamsGraphRequestCurrentness(assertCurrent, work) {
|
|
1071
|
+
assertCurrent?.();
|
|
1072
|
+
return graphRequestCurrentness.run(assertCurrent, work);
|
|
1073
|
+
}
|
|
1074
|
+
function captureGraphRequestCurrentness(assertReadAuthority) {
|
|
1075
|
+
const assertCurrent = graphRequestCurrentness.getStore();
|
|
1076
|
+
if (!assertCurrent) return assertReadAuthority;
|
|
1077
|
+
return () => {
|
|
1078
|
+
assertReadAuthority?.();
|
|
1079
|
+
assertCurrent();
|
|
1080
|
+
};
|
|
1081
|
+
}
|
|
1083
1082
|
function normalizeQuery(value) {
|
|
1084
1083
|
return value?.trim() ?? "";
|
|
1085
1084
|
}
|
|
@@ -1087,6 +1086,9 @@ function escapeOData(value) {
|
|
|
1087
1086
|
return value.replace(/'/g, "''");
|
|
1088
1087
|
}
|
|
1089
1088
|
async function requestGraph(params) {
|
|
1089
|
+
const assertReadAuthority = (0, openclaw_plugin_sdk_fetch_runtime.captureChannelReadAuthority)();
|
|
1090
|
+
const assertRequestCurrent = captureGraphRequestCurrentness(assertReadAuthority);
|
|
1091
|
+
assertRequestCurrent?.();
|
|
1090
1092
|
const hasBody = params.body !== void 0;
|
|
1091
1093
|
const url = `${params.root ?? "https://graph.microsoft.com/v1.0"}${params.path}`;
|
|
1092
1094
|
const { response, release } = await (0, openclaw_plugin_sdk_ssrf_runtime.fetchWithSsrFGuard)({
|
|
@@ -1102,10 +1104,12 @@ async function requestGraph(params) {
|
|
|
1102
1104
|
body: hasBody ? JSON.stringify(params.body) : void 0
|
|
1103
1105
|
},
|
|
1104
1106
|
auditContext: "msteams.graph",
|
|
1105
|
-
timeoutMs: resolveMSTeamsRequestTimeoutMs(params.deadline)
|
|
1107
|
+
timeoutMs: resolveMSTeamsRequestTimeoutMs(params.deadline),
|
|
1108
|
+
beforeRequest: assertRequestCurrent
|
|
1106
1109
|
});
|
|
1107
1110
|
let releaseInFinally = true;
|
|
1108
1111
|
try {
|
|
1112
|
+
assertReadAuthority?.();
|
|
1109
1113
|
if (!response.ok) throw await createMSTeamsHttpError(response, `${params.errorPrefix ?? "Graph"} ${params.path} failed`);
|
|
1110
1114
|
releaseInFinally = false;
|
|
1111
1115
|
return (0, openclaw_plugin_sdk_fetch_runtime.responseWithRelease)(response, release);
|
|
@@ -1129,18 +1133,26 @@ async function mutateGraphJson(params) {
|
|
|
1129
1133
|
}), `${errorPrefix} ${params.path} failed`);
|
|
1130
1134
|
}
|
|
1131
1135
|
async function fetchGraphJson(params) {
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1136
|
+
const assertReadAuthority = (0, openclaw_plugin_sdk_fetch_runtime.captureChannelReadAuthority)();
|
|
1137
|
+
try {
|
|
1138
|
+
return await readOptionalGraphJson(await requestGraph({
|
|
1139
|
+
token: params.token,
|
|
1140
|
+
path: params.path,
|
|
1141
|
+
headers: params.headers,
|
|
1142
|
+
deadline: params.deadline
|
|
1143
|
+
}), `Graph ${params.path} failed`);
|
|
1144
|
+
} finally {
|
|
1145
|
+
assertReadAuthority?.();
|
|
1146
|
+
}
|
|
1138
1147
|
}
|
|
1139
1148
|
/**
|
|
1140
1149
|
* Fetch JSON from an absolute Graph API URL (for example @odata.nextLink
|
|
1141
1150
|
* pagination URLs) without prepending GRAPH_ROOT.
|
|
1142
1151
|
*/
|
|
1143
1152
|
async function fetchGraphAbsoluteUrl(params) {
|
|
1153
|
+
const assertReadAuthority = (0, openclaw_plugin_sdk_fetch_runtime.captureChannelReadAuthority)();
|
|
1154
|
+
const assertRequestCurrent = captureGraphRequestCurrentness(assertReadAuthority);
|
|
1155
|
+
assertRequestCurrent?.();
|
|
1144
1156
|
const { response, release } = await (0, openclaw_plugin_sdk_ssrf_runtime.fetchWithSsrFGuard)({
|
|
1145
1157
|
url: params.url,
|
|
1146
1158
|
init: { headers: {
|
|
@@ -1149,13 +1161,19 @@ async function fetchGraphAbsoluteUrl(params) {
|
|
|
1149
1161
|
...params.headers
|
|
1150
1162
|
} },
|
|
1151
1163
|
auditContext: "msteams.graph.absolute",
|
|
1152
|
-
timeoutMs: MSTEAMS_REQUEST_TIMEOUT_MS
|
|
1164
|
+
timeoutMs: MSTEAMS_REQUEST_TIMEOUT_MS,
|
|
1165
|
+
beforeRequest: assertRequestCurrent
|
|
1153
1166
|
});
|
|
1154
1167
|
try {
|
|
1168
|
+
assertReadAuthority?.();
|
|
1155
1169
|
if (!response.ok) throw await createMSTeamsHttpError(response, `Graph ${params.url} failed`);
|
|
1156
1170
|
return await (0, openclaw_plugin_sdk_provider_http.readProviderJsonResponse)(response, `Graph ${params.url} failed`);
|
|
1157
1171
|
} finally {
|
|
1158
|
-
|
|
1172
|
+
try {
|
|
1173
|
+
await release();
|
|
1174
|
+
} finally {
|
|
1175
|
+
assertReadAuthority?.();
|
|
1176
|
+
}
|
|
1159
1177
|
}
|
|
1160
1178
|
}
|
|
1161
1179
|
/**
|
|
@@ -1190,6 +1208,8 @@ async function fetchAllGraphPages(params) {
|
|
|
1190
1208
|
};
|
|
1191
1209
|
}
|
|
1192
1210
|
async function resolveGraphToken(cfg, options) {
|
|
1211
|
+
const assertRequestCurrent = captureGraphRequestCurrentness((0, openclaw_plugin_sdk_fetch_runtime.captureChannelReadAuthority)());
|
|
1212
|
+
assertRequestCurrent?.();
|
|
1193
1213
|
const msteamsCfg = cfg?.channels?.msteams;
|
|
1194
1214
|
const creds = resolveMSTeamsCredentials(msteamsCfg);
|
|
1195
1215
|
if (!creds) throw new Error("MS Teams credentials missing");
|
|
@@ -1200,14 +1220,18 @@ async function resolveGraphToken(cfg, options) {
|
|
|
1200
1220
|
clientId: creds.appId,
|
|
1201
1221
|
clientSecret: creds.appPassword
|
|
1202
1222
|
});
|
|
1223
|
+
assertRequestCurrent?.();
|
|
1203
1224
|
if (delegated) return delegated;
|
|
1204
1225
|
}
|
|
1205
1226
|
const { app } = await loadMSTeamsSdkWithAuth(creds, resolveMSTeamsSdkCloudOptions(msteamsCfg));
|
|
1227
|
+
assertRequestCurrent?.();
|
|
1206
1228
|
const tokenProvider = createMSTeamsTokenProvider(app);
|
|
1207
|
-
const
|
|
1229
|
+
const graphTokenValue = await withMSTeamsRequestDeadline({
|
|
1208
1230
|
label: "MS Teams Graph token",
|
|
1209
1231
|
work: () => tokenProvider.getAccessToken("https://graph.microsoft.com")
|
|
1210
|
-
})
|
|
1232
|
+
});
|
|
1233
|
+
assertRequestCurrent?.();
|
|
1234
|
+
const accessToken = readAccessToken(graphTokenValue);
|
|
1211
1235
|
if (!accessToken) throw new Error("MS Teams graph token unavailable");
|
|
1212
1236
|
return accessToken;
|
|
1213
1237
|
}
|
|
@@ -1826,6 +1850,12 @@ Object.defineProperty(exports, "applyAuthorizationHeaderForUrl", {
|
|
|
1826
1850
|
return applyAuthorizationHeaderForUrl;
|
|
1827
1851
|
}
|
|
1828
1852
|
});
|
|
1853
|
+
Object.defineProperty(exports, "assertMSTeamsSendHandoff", {
|
|
1854
|
+
enumerable: true,
|
|
1855
|
+
get: function() {
|
|
1856
|
+
return assertMSTeamsSendHandoff;
|
|
1857
|
+
}
|
|
1858
|
+
});
|
|
1829
1859
|
Object.defineProperty(exports, "buildMSTeamsAuthEndpoint", {
|
|
1830
1860
|
enumerable: true,
|
|
1831
1861
|
get: function() {
|
|
@@ -1904,10 +1934,10 @@ Object.defineProperty(exports, "extractHtmlFromAttachment", {
|
|
|
1904
1934
|
return extractHtmlFromAttachment;
|
|
1905
1935
|
}
|
|
1906
1936
|
});
|
|
1907
|
-
Object.defineProperty(exports, "
|
|
1937
|
+
Object.defineProperty(exports, "extractInlineImageReferences", {
|
|
1908
1938
|
enumerable: true,
|
|
1909
1939
|
get: function() {
|
|
1910
|
-
return
|
|
1940
|
+
return extractInlineImageReferences;
|
|
1911
1941
|
}
|
|
1912
1942
|
});
|
|
1913
1943
|
Object.defineProperty(exports, "extractMSTeamsConversationMessageId", {
|
|
@@ -2198,6 +2228,12 @@ Object.defineProperty(exports, "resolveRequestUrl", {
|
|
|
2198
2228
|
return resolveRequestUrl;
|
|
2199
2229
|
}
|
|
2200
2230
|
});
|
|
2231
|
+
Object.defineProperty(exports, "runWithMSTeamsGraphRequestCurrentness", {
|
|
2232
|
+
enumerable: true,
|
|
2233
|
+
get: function() {
|
|
2234
|
+
return runWithMSTeamsGraphRequestCurrentness;
|
|
2235
|
+
}
|
|
2236
|
+
});
|
|
2201
2237
|
Object.defineProperty(exports, "safeFetchWithPolicy", {
|
|
2202
2238
|
enumerable: true,
|
|
2203
2239
|
get: function() {
|
|
@@ -2258,6 +2294,12 @@ Object.defineProperty(exports, "withMSTeamsAbortableRequestTimeout", {
|
|
|
2258
2294
|
return withMSTeamsAbortableRequestTimeout;
|
|
2259
2295
|
}
|
|
2260
2296
|
});
|
|
2297
|
+
Object.defineProperty(exports, "withMSTeamsConnectorHandoff", {
|
|
2298
|
+
enumerable: true,
|
|
2299
|
+
get: function() {
|
|
2300
|
+
return withMSTeamsConnectorHandoff;
|
|
2301
|
+
}
|
|
2302
|
+
});
|
|
2261
2303
|
Object.defineProperty(exports, "withMSTeamsRequestDeadline", {
|
|
2262
2304
|
enumerable: true,
|
|
2263
2305
|
get: function() {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const require_secret_contract_api = require("./secret-contract-api-ipiUsANg.cjs");
|
|
2
|
+
exports.channelSecrets = require_secret_contract_api.channelSecrets;
|
|
3
|
+
exports.collectRuntimeConfigAssignments = require_secret_contract_api.collectRuntimeConfigAssignments;
|
|
4
|
+
exports.secretTargetRegistryEntries = require_secret_contract_api.secretTargetRegistryEntries;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region extensions/msteams/src/secret-contract.ts
|
|
2
|
+
const channelSecrets = (0, require("openclaw/plugin-sdk/channel-secret-basic-runtime").createSimpleChannelSecretContract)({
|
|
3
|
+
channelKey: "msteams",
|
|
4
|
+
label: "Microsoft Teams",
|
|
5
|
+
accountFields: [],
|
|
6
|
+
channelFields: ["appPassword"],
|
|
7
|
+
mode: "channel-only"
|
|
8
|
+
});
|
|
9
|
+
const { secretTargetRegistryEntries, collectRuntimeConfigAssignments } = channelSecrets;
|
|
10
|
+
//#endregion
|
|
11
|
+
Object.defineProperty(exports, "channelSecrets", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function() {
|
|
14
|
+
return channelSecrets;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "collectRuntimeConfigAssignments", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return collectRuntimeConfigAssignments;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports, "secretTargetRegistryEntries", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function() {
|
|
26
|
+
return secretTargetRegistryEntries;
|
|
27
|
+
}
|
|
28
|
+
});
|