@openclaw/msteams 2026.10.10-beta.4 → 2026.10.10
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-B-6Q3nMI.cjs → adapter.runtime-BMvpm7sS.cjs} +3 -5
- package/dist/.setup/{approval-card-DWPDItvq.cjs → approval-card-Bo8kHYbj.cjs} +2 -4
- package/dist/.setup/{approval-handler.runtime-DccVf5AY.cjs → approval-handler.runtime-BS3avHFu.cjs} +5 -6
- package/dist/.setup/{bot-framework-service-url-B3FWn2SV.cjs → bot-framework-service-url-CgVuKiIR.cjs} +2 -4
- package/dist/.setup/{channel-B7Gy3QUW.cjs → channel-CdCSk3Rg.cjs} +27 -47
- package/dist/.setup/{channel.runtime-DzKeQAqd.cjs → channel.runtime--ZjTYgkY.cjs} +17 -26
- package/dist/.setup/{channel.setup-B5ClEcNI.cjs → channel.setup-nSTtK77J.cjs} +11 -17
- package/dist/.setup/{config-schema-CkKdphSp.cjs → config-schema-Bm15lF-j.cjs} +5 -8
- package/dist/.setup/{conversation-store-state-C3__T9mK.cjs → conversation-store-state-NJU9osd-.cjs} +25 -41
- package/dist/.setup/{delegated-state-Bv5cWuec.cjs → delegated-state-CbMd3rIh.cjs} +4 -6
- package/dist/.setup/{monitor-CzRI-Hsc.cjs → monitor-BxLDs5fk.cjs} +53 -90
- package/dist/.setup/{oauth-D9u8sPCD.cjs → oauth-B-Y5pNM4.cjs} +3 -5
- package/dist/.setup/{reaction-types-DSQWVA4Z.cjs → reaction-types-BaL1EVBS.cjs} +3 -5
- package/dist/.setup/{resolve-allowlist-tYgAHx0t.cjs → resolve-allowlist-CqNzS9bZ.cjs} +141 -59
- package/dist/.setup/{rolldown-runtime-BloeesfJ.cjs → rolldown-runtime-CiKaZLfC.cjs} +1 -2
- package/dist/.setup/{runtime-gZTAuFux.cjs → runtime-CbKazLGv.cjs} +1 -2
- package/dist/.setup/{secret-contract-api-YY3v6MP8.cjs → secret-contract-api-5aH1Fl_c.cjs} +1 -1
- package/dist/.setup/{secret-contract-api-wAyY5UHv.cjs → secret-contract-api-BOzdWSn9.cjs} +1 -2
- package/dist/.setup/{send-Bgm8RYUa.cjs → send-BXjI3ufq.cjs} +9 -11
- package/dist/.setup/{setup-plugin-api-BACfeF7_.cjs → setup-plugin-api-lPpin6Gg.cjs} +1 -1
- package/dist/.setup/{thread-session-C7KTMwLU.cjs → thread-session-DZMoCsSR.cjs} +3 -5
- package/dist/.setup/{token-config-bEpua_Q7.cjs → token-config-DTZ00Ibq.cjs} +1 -2
- package/dist/.source-module-urls/7e43ee3ae4faab430a47269c8217f8d99ec60ecd85233f40e81d03efeb543068.json +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 -2
- package/dist/directory-contract-api.cjs +1 -2
- package/dist/doctor-backup-resources.cjs +2 -3
- package/dist/doctor-contract-api.cjs +9 -15
- package/dist/index.cjs +1 -2
- package/dist/qa-runner-api.cjs +3 -5
- package/dist/runtime-api.cjs +1 -1
- package/dist/secret-contract-api.cjs +1 -1
- package/dist/setup-entry.cjs +3 -4
- package/dist/setup-plugin-api.cjs +1 -1
- package/package.json +4 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const require_resolve_allowlist = require("./resolve-allowlist-
|
|
1
|
+
const require_resolve_allowlist = require("./resolve-allowlist-CqNzS9bZ.cjs");
|
|
2
2
|
let openclaw_plugin_sdk_provider_auth = require("openclaw/plugin-sdk/provider-auth");
|
|
3
3
|
let openclaw_plugin_sdk_provider_auth_runtime = require("openclaw/plugin-sdk/provider-auth-runtime");
|
|
4
|
-
|
|
4
|
+
// extensions/msteams/src/oauth.flow.ts
|
|
5
5
|
function buildMSTeamsAuthUrl(params) {
|
|
6
6
|
const scopes = params.scopes ?? require_resolve_allowlist.MSTEAMS_DEFAULT_DELEGATED_SCOPES;
|
|
7
7
|
return `${require_resolve_allowlist.buildMSTeamsAuthEndpoint(params.tenantId)}?${new URLSearchParams({
|
|
@@ -15,8 +15,7 @@ function buildMSTeamsAuthUrl(params) {
|
|
|
15
15
|
prompt: "consent"
|
|
16
16
|
}).toString()}`;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
//#region extensions/msteams/src/oauth.ts
|
|
18
|
+
// extensions/msteams/src/oauth.ts
|
|
20
19
|
async function loginMSTeamsDelegated(ctx, params) {
|
|
21
20
|
await ctx.note([
|
|
22
21
|
"You are running in a remote/VPS environment.",
|
|
@@ -51,5 +50,4 @@ async function loginMSTeamsDelegated(ctx, params) {
|
|
|
51
50
|
verifier
|
|
52
51
|
});
|
|
53
52
|
}
|
|
54
|
-
//#endregion
|
|
55
53
|
exports.loginMSTeamsDelegated = loginMSTeamsDelegated;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_resolve_allowlist = require("./resolve-allowlist-
|
|
2
|
-
|
|
1
|
+
const require_resolve_allowlist = require("./resolve-allowlist-CqNzS9bZ.cjs");
|
|
2
|
+
// extensions/msteams/src/graph-thread.ts
|
|
3
3
|
/** Keep inbound thread enrichment bounded while still reaching recent replies. */
|
|
4
4
|
const MAX_REPLY_PAGES = 50;
|
|
5
5
|
function compareThreadMessagesChronologically(a, b) {
|
|
@@ -88,8 +88,7 @@ function buildThreadContext(messages, currentMessageId) {
|
|
|
88
88
|
}
|
|
89
89
|
return context;
|
|
90
90
|
}
|
|
91
|
-
|
|
92
|
-
//#region extensions/msteams/src/reaction-types.ts
|
|
91
|
+
// extensions/msteams/src/reaction-types.ts
|
|
93
92
|
const TEAMS_REACTION_EMOJI = {
|
|
94
93
|
like: "👍",
|
|
95
94
|
heart: "❤️",
|
|
@@ -108,7 +107,6 @@ function resolveMSTeamsReactionEmoji(raw) {
|
|
|
108
107
|
if (!normalized) throw new Error(`Reaction type is required. Common types: ${TEAMS_REACTION_TYPES.join(", ")}`);
|
|
109
108
|
return getMSTeamsReactionEmoji(normalized) ?? normalized;
|
|
110
109
|
}
|
|
111
|
-
//#endregion
|
|
112
110
|
Object.defineProperty(exports, "buildThreadContext", {
|
|
113
111
|
enumerable: true,
|
|
114
112
|
get: function() {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const require_bot_framework_service_url = require("./bot-framework-service-url-
|
|
2
|
-
const require_token_config = require("./token-config-
|
|
3
|
-
const require_runtime = require("./runtime-
|
|
1
|
+
const require_bot_framework_service_url = require("./bot-framework-service-url-CgVuKiIR.cjs");
|
|
2
|
+
const require_token_config = require("./token-config-DTZ00Ibq.cjs");
|
|
3
|
+
const require_runtime = require("./runtime-CbKazLGv.cjs");
|
|
4
4
|
require("../runtime-api.cjs");
|
|
5
|
-
const require_delegated_state = require("./delegated-state-
|
|
5
|
+
const require_delegated_state = require("./delegated-state-CbMd3rIh.cjs");
|
|
6
6
|
let openclaw_plugin_sdk_lazy_runtime = require("openclaw/plugin-sdk/lazy-runtime");
|
|
7
7
|
let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
|
|
8
8
|
let openclaw_plugin_sdk_account_helpers = require("openclaw/plugin-sdk/account-helpers");
|
|
@@ -22,7 +22,7 @@ let openclaw_plugin_sdk_secret_file = require("openclaw/plugin-sdk/secret-file")
|
|
|
22
22
|
let openclaw_plugin_sdk_error_runtime = require("openclaw/plugin-sdk/error-runtime");
|
|
23
23
|
let node_module = require("node:module");
|
|
24
24
|
let openclaw_plugin_sdk_html_entity_runtime = require("openclaw/plugin-sdk/html-entity-runtime");
|
|
25
|
-
|
|
25
|
+
// extensions/msteams/src/accounts.ts
|
|
26
26
|
const { listAccountIds, resolveDefaultAccountId } = (0, openclaw_plugin_sdk_account_helpers.createAccountListHelpers)("msteams", {
|
|
27
27
|
normalizeAccountId: openclaw_plugin_sdk_account_id.normalizeAccountId,
|
|
28
28
|
hasImplicitDefaultAccount: (cfg) => require_token_config.hasConfiguredMSTeamsCredentials(cfg.channels?.msteams)
|
|
@@ -169,8 +169,7 @@ function inspectMSTeamsAccount(params) {
|
|
|
169
169
|
path: account.config.webhook?.path ?? "/api/messages"
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
|
-
|
|
173
|
-
//#region extensions/msteams/src/request-timeout.ts
|
|
172
|
+
// extensions/msteams/src/request-timeout.ts
|
|
174
173
|
const MSTEAMS_REQUEST_TIMEOUT_MS = 3e4;
|
|
175
174
|
const MSTEAMS_SHAREPOINT_UPLOAD_BASE_TIMEOUT_MS = 3e5;
|
|
176
175
|
const MSTEAMS_SHAREPOINT_UPLOAD_MIN_BYTES_PER_SECOND = 262144;
|
|
@@ -220,11 +219,50 @@ async function withMSTeamsAbortableRequestTimeout(params) {
|
|
|
220
219
|
throw error;
|
|
221
220
|
}
|
|
222
221
|
}
|
|
223
|
-
|
|
224
|
-
//#region extensions/msteams/src/attachments/shared.ts
|
|
222
|
+
// extensions/msteams/src/attachments/shared.ts
|
|
225
223
|
const IMAGE_EXT_RE = /\.(avif|bmp|gif|heic|heif|jpe?g|png|tiff?|webp)$/i;
|
|
226
|
-
|
|
227
|
-
|
|
224
|
+
/**
|
|
225
|
+
* Values of `attr` on each `<tag ...>` in document order, matching the captures of
|
|
226
|
+
* `/<tag[^>]+attr=["']([^"']+)["'][^>]*>/gi`: the last attribute spelling inside the
|
|
227
|
+
* tag wins, and a quoted value may contain `>`. Each `<tag` start is resolved from
|
|
228
|
+
* precomputed next-`>` and next-quote positions in one forward pass.
|
|
229
|
+
*/
|
|
230
|
+
function htmlTagAttributeValues(html, tag, attr) {
|
|
231
|
+
const length = html.length;
|
|
232
|
+
const nextGt = new Int32Array(length + 1).fill(length);
|
|
233
|
+
const nextQuote = new Int32Array(length + 1).fill(length);
|
|
234
|
+
for (let index = length - 1; index >= 0; index -= 1) {
|
|
235
|
+
const char = html[index];
|
|
236
|
+
nextGt[index] = char === ">" ? index : nextGt[index + 1];
|
|
237
|
+
nextQuote[index] = char === "\"" || char === "'" ? index : nextQuote[index + 1];
|
|
238
|
+
}
|
|
239
|
+
const candidates = [];
|
|
240
|
+
for (const match of html.matchAll(new RegExp(`${attr}=["']`, "gi"))) {
|
|
241
|
+
const valueStart = match.index + match[0].length;
|
|
242
|
+
const valueEnd = nextQuote[valueStart];
|
|
243
|
+
if (valueEnd > valueStart && valueEnd < length && nextGt[valueEnd + 1] < length) candidates.push({
|
|
244
|
+
start: match.index,
|
|
245
|
+
valueStart,
|
|
246
|
+
valueEnd,
|
|
247
|
+
end: nextGt[valueEnd + 1] + 1
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
const values = [];
|
|
251
|
+
let resumeAt = 0;
|
|
252
|
+
let pastWindow = 0;
|
|
253
|
+
for (const open of html.matchAll(new RegExp(`<${tag}`, "gi"))) {
|
|
254
|
+
if (open.index < resumeAt) continue;
|
|
255
|
+
const nameEnd = open.index + open[0].length;
|
|
256
|
+
const lastStart = nextGt[nameEnd];
|
|
257
|
+
while (pastWindow < candidates.length && candidates[pastWindow].start <= lastStart) pastWindow += 1;
|
|
258
|
+
const candidate = candidates[pastWindow - 1];
|
|
259
|
+
if (candidate && candidate.start > nameEnd) {
|
|
260
|
+
values.push(html.slice(candidate.valueStart, candidate.valueEnd));
|
|
261
|
+
resumeAt = candidate.end;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return values;
|
|
265
|
+
}
|
|
228
266
|
const GRAPH_HOSTED_CONTENT_SRC_RE = /\/hostedContents\/([^/?#]+)/i;
|
|
229
267
|
function resolveInlineImageSourceId(src) {
|
|
230
268
|
const hostedContentId = GRAPH_HOSTED_CONTENT_SRC_RE.exec(src)?.[1];
|
|
@@ -363,9 +401,8 @@ function extractInlineImageReferences(attachments) {
|
|
|
363
401
|
for (const att of attachments) {
|
|
364
402
|
const html = extractHtmlFromAttachment(att);
|
|
365
403
|
if (!html) continue;
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
const src = match[1]?.trim();
|
|
404
|
+
for (const value of htmlTagAttributeValues(html, "img", "src")) {
|
|
405
|
+
const src = value.trim();
|
|
369
406
|
if (src) {
|
|
370
407
|
if (src.startsWith("data:")) out.push({
|
|
371
408
|
kind: "data",
|
|
@@ -464,8 +501,7 @@ async function safeFetchWithPolicy(params) {
|
|
|
464
501
|
});
|
|
465
502
|
return (0, openclaw_plugin_sdk_fetch_runtime.responseWithRelease)(guarded.response, guarded.release);
|
|
466
503
|
}
|
|
467
|
-
|
|
468
|
-
//#region extensions/msteams/src/cloud.ts
|
|
504
|
+
// extensions/msteams/src/cloud.ts
|
|
469
505
|
const DEFAULT_MSTEAMS_CLOUD = "Public";
|
|
470
506
|
const PUBLIC_MSTEAMS_SERVICE_HOST = "smba.trafficmanager.net";
|
|
471
507
|
const CHINA_BOT_FRAMEWORK_SERVICE_HOST = "botframework.azure.cn";
|
|
@@ -511,8 +547,7 @@ function validateMSTeamsProactiveServiceUrlBoundary(params) {
|
|
|
511
547
|
if (isChinaBotFrameworkServiceHost(stored.host)) throw new Error(`msteams proactive send blocked for ${params.conversationId}: stored conversation serviceUrl (${stored.value}) requires channels.msteams.cloud=China.`);
|
|
512
548
|
if (stored.host !== PUBLIC_MSTEAMS_SERVICE_HOST) throw new Error(`msteams proactive send blocked for ${params.conversationId}: stored conversation serviceUrl (${stored.value}) is not a Microsoft Teams public-cloud Bot Connector endpoint. Set channels.msteams.cloud and channels.msteams.serviceUrl for the supported Teams cloud that owns this conversation.`);
|
|
513
549
|
}
|
|
514
|
-
|
|
515
|
-
//#region extensions/msteams/src/send-handoff.ts
|
|
550
|
+
// extensions/msteams/src/send-handoff.ts
|
|
516
551
|
const connectorHandoff = new node_async_hooks.AsyncLocalStorage();
|
|
517
552
|
function notDispatched(error) {
|
|
518
553
|
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", {
|
|
@@ -560,8 +595,7 @@ const msteamsConnectorHandoffInterceptor = { request: async ({ config }) => {
|
|
|
560
595
|
};
|
|
561
596
|
return config;
|
|
562
597
|
} };
|
|
563
|
-
|
|
564
|
-
//#region extensions/msteams/src/qa/private-runtime.ts
|
|
598
|
+
// extensions/msteams/src/qa/private-runtime.ts
|
|
565
599
|
const PRIVATE_QA_BUILD_ENV = "OPENCLAW_BUILD_PRIVATE_QA";
|
|
566
600
|
const PRIVATE_QA_NONCE_HEADER = "x-openclaw-msteams-qa-nonce";
|
|
567
601
|
const PRIVATE_QA_RUNTIME_SYMBOL = Symbol.for("openclaw.msteams.privateQaRuntime");
|
|
@@ -621,8 +655,7 @@ function resolveMSTeamsPrivateQaRuntime(env = process.env, bootstrap = globalThi
|
|
|
621
655
|
token: async () => botToken
|
|
622
656
|
};
|
|
623
657
|
}
|
|
624
|
-
|
|
625
|
-
//#region extensions/msteams/src/user-agent.ts
|
|
658
|
+
// extensions/msteams/src/user-agent.ts
|
|
626
659
|
let cachedUserAgent;
|
|
627
660
|
function resolveTeamsSdkVersion() {
|
|
628
661
|
try {
|
|
@@ -669,8 +702,7 @@ function ensureUserAgentHeader(headers) {
|
|
|
669
702
|
if (!nextHeaders.has("User-Agent")) nextHeaders.set("User-Agent", buildUserAgent());
|
|
670
703
|
return nextHeaders;
|
|
671
704
|
}
|
|
672
|
-
|
|
673
|
-
//#region extensions/msteams/src/sdk.ts
|
|
705
|
+
// extensions/msteams/src/sdk.ts
|
|
674
706
|
const AZURE_IDENTITY_MODULE = "@azure/identity";
|
|
675
707
|
const loadAzureIdentity = (0, openclaw_plugin_sdk_lazy_runtime.createLazyRuntimeModule)(() => import(AZURE_IDENTITY_MODULE));
|
|
676
708
|
const loadSdkModules = (0, openclaw_plugin_sdk_lazy_runtime.createLazyRuntimeModule)(() => Promise.all([import("@microsoft/teams.apps"), import("@microsoft/teams.api")]).then(([apps, api]) => ({
|
|
@@ -739,8 +771,7 @@ function createMSTeamsTokenProvider(app) {
|
|
|
739
771
|
return (await app.tokenProvider.getAppToken(app.cloud?.botScope ?? "https://api.botframework.com/.default"))?.toString() ?? "";
|
|
740
772
|
} };
|
|
741
773
|
}
|
|
742
|
-
|
|
743
|
-
//#region extensions/msteams/src/oauth.shared.ts
|
|
774
|
+
// extensions/msteams/src/oauth.shared.ts
|
|
744
775
|
const MSTEAMS_OAUTH_REDIRECT_URI = "http://localhost:8086/oauth2callback";
|
|
745
776
|
const MSTEAMS_DEFAULT_TOKEN_FETCH_TIMEOUT_MS = 1e4;
|
|
746
777
|
const MSTEAMS_DEFAULT_DELEGATED_SCOPES = [
|
|
@@ -755,8 +786,7 @@ function buildMSTeamsAuthEndpoint(tenantId) {
|
|
|
755
786
|
function buildMSTeamsTokenEndpoint(tenantId) {
|
|
756
787
|
return `https://login.microsoftonline.com/${encodeURIComponent(tenantId)}/oauth2/v2.0/token`;
|
|
757
788
|
}
|
|
758
|
-
|
|
759
|
-
//#region extensions/msteams/src/oauth.token.ts
|
|
789
|
+
// extensions/msteams/src/oauth.token.ts
|
|
760
790
|
/** Five-minute buffer subtracted from token expiry to avoid edge-case clock drift. */
|
|
761
791
|
const EXPIRY_BUFFER_MS = 3e5;
|
|
762
792
|
function parseMSTeamsTokenResponse(data, failureLabel) {
|
|
@@ -846,8 +876,7 @@ async function refreshMSTeamsDelegatedTokens(params) {
|
|
|
846
876
|
resolveRefreshToken: (data) => data.refresh_token ?? params.refreshToken
|
|
847
877
|
});
|
|
848
878
|
}
|
|
849
|
-
|
|
850
|
-
//#region extensions/msteams/src/token.ts
|
|
879
|
+
// extensions/msteams/src/token.ts
|
|
851
880
|
async function resolveDelegatedAccessToken(params) {
|
|
852
881
|
const tokens = await require_delegated_state.loadMSTeamsDelegatedTokens(params.accountId);
|
|
853
882
|
if (!tokens) return;
|
|
@@ -866,8 +895,7 @@ async function resolveDelegatedAccessToken(params) {
|
|
|
866
895
|
return;
|
|
867
896
|
}
|
|
868
897
|
}
|
|
869
|
-
|
|
870
|
-
//#region extensions/msteams/src/graph.ts
|
|
898
|
+
// extensions/msteams/src/graph.ts
|
|
871
899
|
const GRAPH_BETA = "https://graph.microsoft.com/beta";
|
|
872
900
|
const graphRequestCurrentness = new node_async_hooks.AsyncLocalStorage();
|
|
873
901
|
function runWithMSTeamsGraphRequestCurrentness(assertCurrent, work) {
|
|
@@ -1052,8 +1080,7 @@ async function listChannelsForTeamWithPageInfo(token, teamId) {
|
|
|
1052
1080
|
path: `/teams/${encodeURIComponent(teamId)}/channels?$select=id,displayName`
|
|
1053
1081
|
});
|
|
1054
1082
|
}
|
|
1055
|
-
|
|
1056
|
-
//#region extensions/msteams/src/graph-users.ts
|
|
1083
|
+
// extensions/msteams/src/graph-users.ts
|
|
1057
1084
|
async function searchGraphUsers(params) {
|
|
1058
1085
|
const query = params.query.trim();
|
|
1059
1086
|
if (!query) return [];
|
|
@@ -1088,12 +1115,39 @@ async function findGraphUsersByExactIdentity(params) {
|
|
|
1088
1115
|
path
|
|
1089
1116
|
});
|
|
1090
1117
|
}
|
|
1091
|
-
|
|
1092
|
-
//#region extensions/msteams/src/inbound.ts
|
|
1118
|
+
// extensions/msteams/src/inbound.ts
|
|
1093
1119
|
function htmlToPlainText(html) {
|
|
1094
1120
|
return (0, openclaw_plugin_sdk_html_entity_runtime.decodeHtmlEntities)(html.replace(/<[^>]*>/g, " ")).replaceAll("\xA0", " ").replace(/\s+/g, " ").trim();
|
|
1095
1121
|
}
|
|
1096
1122
|
/**
|
|
1123
|
+
* Content of the first `<p ...>` whose opening tag contains `attribute`, up to the next
|
|
1124
|
+
* `</p>`, matching `/<p[^>]*ATTRIBUTE[^>]*>(.*?)<\/p>/is`. Opening tags, attribute
|
|
1125
|
+
* matches and `>` positions are all visited in one forward pass.
|
|
1126
|
+
*/
|
|
1127
|
+
function findParagraphContent(html, attribute) {
|
|
1128
|
+
const attributes = Array.from(html.matchAll(attribute), (match) => ({
|
|
1129
|
+
start: match.index,
|
|
1130
|
+
end: match.index + match[0].length
|
|
1131
|
+
}));
|
|
1132
|
+
let nextAttribute = 0;
|
|
1133
|
+
let tagEnd = -1;
|
|
1134
|
+
for (const open of html.matchAll(/<p/gi)) {
|
|
1135
|
+
const afterOpen = open.index + open[0].length;
|
|
1136
|
+
if (tagEnd < afterOpen) {
|
|
1137
|
+
tagEnd = html.indexOf(">", afterOpen);
|
|
1138
|
+
if (tagEnd < 0) return;
|
|
1139
|
+
}
|
|
1140
|
+
while (nextAttribute < attributes.length && attributes[nextAttribute].start < afterOpen) nextAttribute += 1;
|
|
1141
|
+
const match = attributes[nextAttribute];
|
|
1142
|
+
if (match && match.end <= tagEnd) {
|
|
1143
|
+
const close = /<\/p>/gi;
|
|
1144
|
+
close.lastIndex = tagEnd + 1;
|
|
1145
|
+
const closeMatch = close.exec(html);
|
|
1146
|
+
return closeMatch ? html.slice(tagEnd + 1, closeMatch.index) : void 0;
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
/**
|
|
1097
1151
|
* Extract quote info from MS Teams HTML reply attachments.
|
|
1098
1152
|
* Teams wraps quoted content in a blockquote with itemtype="http://schema.skype.com/Reply".
|
|
1099
1153
|
*/
|
|
@@ -1109,8 +1163,8 @@ function extractMSTeamsQuoteInfo(attachments) {
|
|
|
1109
1163
|
if (!content.includes("http://schema.skype.com/Reply")) continue;
|
|
1110
1164
|
const senderMatch = /<strong[^>]*itemprop=["']mri["'][^>]*>(.*?)<\/strong>/i.exec(content);
|
|
1111
1165
|
const sender = senderMatch?.[1] ? htmlToPlainText(senderMatch[1]) : void 0;
|
|
1112
|
-
const
|
|
1113
|
-
const body =
|
|
1166
|
+
const bodyHtml = findParagraphContent(content, /itemprop=["']copy["']/gi) ?? findParagraphContent(content, /itemprop=["']preview["']/gi);
|
|
1167
|
+
const body = bodyHtml ? htmlToPlainText(bodyHtml) : void 0;
|
|
1114
1168
|
const id = /<blockquote[^>]*\bitemid=["']([^"']+)["'][^>]*>/is.exec(content)?.[1]?.trim() || void 0;
|
|
1115
1169
|
if (body) return {
|
|
1116
1170
|
sender: sender ?? "unknown",
|
|
@@ -1141,9 +1195,14 @@ function wasMSTeamsBotMentioned(activity) {
|
|
|
1141
1195
|
if (!botId) return false;
|
|
1142
1196
|
return (activity.entities ?? []).some((e) => e.type === "mention" && e.mentioned?.id === botId);
|
|
1143
1197
|
}
|
|
1144
|
-
|
|
1145
|
-
//#region extensions/msteams/src/resolve-allowlist.ts
|
|
1198
|
+
// extensions/msteams/src/resolve-allowlist.ts
|
|
1146
1199
|
const MSTEAMS_GROUP_CONVERSATION_ID = /^19:.+@thread\.(?:tacv2|skype|v2)$/i;
|
|
1200
|
+
const MSTEAMS_UNMATCHABLE_THREAD_ID = "19:openclaw-unresolved-allowlist@thread.unresolved";
|
|
1201
|
+
/** Keeps a configured but fully unresolvable sender allowlist configured and matching nothing. */
|
|
1202
|
+
function keepConfiguredMSTeamsAllowlistActive(configured, projected) {
|
|
1203
|
+
if (!Array.isArray(configured) || configured.every((entry) => !entry?.trim())) return projected;
|
|
1204
|
+
return projected && projected.length > 0 ? projected : [MSTEAMS_UNMATCHABLE_THREAD_ID];
|
|
1205
|
+
}
|
|
1147
1206
|
function uniqueItemsById(items) {
|
|
1148
1207
|
const byId = /* @__PURE__ */ new Map();
|
|
1149
1208
|
for (const item of items) {
|
|
@@ -1252,7 +1311,7 @@ function looksLikeMSTeamsThreadConversationId(raw) {
|
|
|
1252
1311
|
function isStableMSTeamsTeamKey(raw) {
|
|
1253
1312
|
return /^[0-9a-fA-F-]{16,}$/.test(raw.trim()) || looksLikeMSTeamsThreadConversationId(raw);
|
|
1254
1313
|
}
|
|
1255
|
-
function projectStableMSTeamsChannels(channels) {
|
|
1314
|
+
function projectStableMSTeamsChannels(channels, options = {}) {
|
|
1256
1315
|
const projected = {};
|
|
1257
1316
|
for (const [channelKey, channelConfig] of Object.entries(channels ?? {})) {
|
|
1258
1317
|
if (channelKey === "*") {
|
|
@@ -1261,21 +1320,45 @@ function projectStableMSTeamsChannels(channels) {
|
|
|
1261
1320
|
}
|
|
1262
1321
|
if (looksLikeMSTeamsThreadConversationId(channelKey)) projected[normalizeMSTeamsConversationTargetId(channelKey)] = channelConfig;
|
|
1263
1322
|
}
|
|
1323
|
+
if (options.keepConfigured && Object.keys(channels ?? {}).length > 0 && Object.keys(projected).length === 0) projected[MSTEAMS_UNMATCHABLE_THREAD_ID] = {};
|
|
1264
1324
|
return projected;
|
|
1265
1325
|
}
|
|
1266
|
-
|
|
1267
|
-
|
|
1326
|
+
/** Drops the unmatchable placeholders once a real entry exists beside them. */
|
|
1327
|
+
function dropRedundantUnmatchablePlaceholders(teams) {
|
|
1328
|
+
const realTeamKeys = Object.keys(teams).filter((key) => key !== MSTEAMS_UNMATCHABLE_THREAD_ID);
|
|
1329
|
+
const cleaned = {};
|
|
1330
|
+
for (const [teamKey, teamConfig] of Object.entries(teams)) {
|
|
1331
|
+
if (teamKey === MSTEAMS_UNMATCHABLE_THREAD_ID && realTeamKeys.length > 0) continue;
|
|
1332
|
+
const channels = { ...teamConfig.channels };
|
|
1333
|
+
if (Object.keys(channels).length > 1) delete channels[MSTEAMS_UNMATCHABLE_THREAD_ID];
|
|
1334
|
+
cleaned[teamKey] = {
|
|
1335
|
+
...teamConfig,
|
|
1336
|
+
channels
|
|
1337
|
+
};
|
|
1338
|
+
}
|
|
1339
|
+
return cleaned;
|
|
1340
|
+
}
|
|
1341
|
+
function projectStableMSTeamsTeams(teams) {
|
|
1268
1342
|
const projected = {};
|
|
1269
1343
|
for (const [teamKey, teamConfig] of Object.entries(teams)) {
|
|
1270
1344
|
if (teamKey !== "*" && !isStableMSTeamsTeamKey(teamKey)) continue;
|
|
1271
1345
|
const stableKey = teamKey === "*" ? teamKey : normalizeMSTeamsConversationTargetId(teamKey);
|
|
1272
1346
|
projected[stableKey] = {
|
|
1273
1347
|
...teamConfig,
|
|
1274
|
-
channels: projectStableMSTeamsChannels(teamConfig.channels)
|
|
1348
|
+
channels: projectStableMSTeamsChannels(teamConfig.channels, { keepConfigured: true })
|
|
1275
1349
|
};
|
|
1276
1350
|
}
|
|
1277
1351
|
return projected;
|
|
1278
1352
|
}
|
|
1353
|
+
/** Keeps a configured but fully unresolvable teams allowlist configured and matching nothing. */
|
|
1354
|
+
function keepConfiguredMSTeamsTeamsActive(configured, teams) {
|
|
1355
|
+
if (Object.keys(configured).length === 0 || Object.keys(teams).length > 0) return teams;
|
|
1356
|
+
return { [MSTEAMS_UNMATCHABLE_THREAD_ID]: {} };
|
|
1357
|
+
}
|
|
1358
|
+
function projectStableMSTeamsTeamsConfig(teams) {
|
|
1359
|
+
if (!teams) return;
|
|
1360
|
+
return keepConfiguredMSTeamsTeamsActive(teams, projectStableMSTeamsTeams(teams));
|
|
1361
|
+
}
|
|
1279
1362
|
function parseMSTeamsTeamChannelInput(raw) {
|
|
1280
1363
|
const trimmed = stripProviderPrefix(raw).trim();
|
|
1281
1364
|
if (!trimmed) return {};
|
|
@@ -1471,7 +1554,7 @@ async function resolveMSTeamsTeamsConfig(params) {
|
|
|
1471
1554
|
teamIdMode: params.teamIdMode
|
|
1472
1555
|
});
|
|
1473
1556
|
const mapping = [];
|
|
1474
|
-
const teams =
|
|
1557
|
+
const teams = projectStableMSTeamsTeams(params.teams);
|
|
1475
1558
|
resolved.forEach((entry, index) => {
|
|
1476
1559
|
const source = entries[index];
|
|
1477
1560
|
if (!source) return;
|
|
@@ -1509,7 +1592,7 @@ async function resolveMSTeamsTeamsConfig(params) {
|
|
|
1509
1592
|
}
|
|
1510
1593
|
});
|
|
1511
1594
|
return {
|
|
1512
|
-
teams,
|
|
1595
|
+
teams: keepConfiguredMSTeamsTeamsActive(params.teams, dropRedundantUnmatchablePlaceholders(teams)),
|
|
1513
1596
|
mapping,
|
|
1514
1597
|
unresolved
|
|
1515
1598
|
};
|
|
@@ -1567,25 +1650,12 @@ async function resolveMSTeamsUserAllowlist(params) {
|
|
|
1567
1650
|
}
|
|
1568
1651
|
});
|
|
1569
1652
|
}
|
|
1570
|
-
//#endregion
|
|
1571
|
-
Object.defineProperty(exports, "ATTACHMENT_TAG_RE", {
|
|
1572
|
-
enumerable: true,
|
|
1573
|
-
get: function() {
|
|
1574
|
-
return ATTACHMENT_TAG_RE;
|
|
1575
|
-
}
|
|
1576
|
-
});
|
|
1577
1653
|
Object.defineProperty(exports, "GRAPH_ROOT", {
|
|
1578
1654
|
enumerable: true,
|
|
1579
1655
|
get: function() {
|
|
1580
1656
|
return GRAPH_ROOT;
|
|
1581
1657
|
}
|
|
1582
1658
|
});
|
|
1583
|
-
Object.defineProperty(exports, "IMG_SRC_RE", {
|
|
1584
|
-
enumerable: true,
|
|
1585
|
-
get: function() {
|
|
1586
|
-
return IMG_SRC_RE;
|
|
1587
|
-
}
|
|
1588
|
-
});
|
|
1589
1659
|
Object.defineProperty(exports, "MSTEAMS_DEFAULT_DELEGATED_SCOPES", {
|
|
1590
1660
|
enumerable: true,
|
|
1591
1661
|
get: function() {
|
|
@@ -1724,6 +1794,12 @@ Object.defineProperty(exports, "fetchGraphJson", {
|
|
|
1724
1794
|
return fetchGraphJson;
|
|
1725
1795
|
}
|
|
1726
1796
|
});
|
|
1797
|
+
Object.defineProperty(exports, "htmlTagAttributeValues", {
|
|
1798
|
+
enumerable: true,
|
|
1799
|
+
get: function() {
|
|
1800
|
+
return htmlTagAttributeValues;
|
|
1801
|
+
}
|
|
1802
|
+
});
|
|
1727
1803
|
Object.defineProperty(exports, "htmlToPlainText", {
|
|
1728
1804
|
enumerable: true,
|
|
1729
1805
|
get: function() {
|
|
@@ -1760,6 +1836,12 @@ Object.defineProperty(exports, "isRedirectStatus", {
|
|
|
1760
1836
|
return isRedirectStatus;
|
|
1761
1837
|
}
|
|
1762
1838
|
});
|
|
1839
|
+
Object.defineProperty(exports, "keepConfiguredMSTeamsAllowlistActive", {
|
|
1840
|
+
enumerable: true,
|
|
1841
|
+
get: function() {
|
|
1842
|
+
return keepConfiguredMSTeamsAllowlistActive;
|
|
1843
|
+
}
|
|
1844
|
+
});
|
|
1763
1845
|
Object.defineProperty(exports, "listChannelsForTeam", {
|
|
1764
1846
|
enumerable: true,
|
|
1765
1847
|
get: function() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// \0rolldown/runtime.js
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -29,7 +29,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
29
29
|
value: mod,
|
|
30
30
|
enumerable: true
|
|
31
31
|
}) : target, mod));
|
|
32
|
-
//#endregion
|
|
33
32
|
Object.defineProperty(exports, "__exportAll", {
|
|
34
33
|
enumerable: true,
|
|
35
34
|
get: function() {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// extensions/msteams/src/runtime.ts
|
|
2
2
|
const { setRuntime: setMSTeamsRuntime, getRuntime: getMSTeamsRuntime, tryGetRuntime: getOptionalMSTeamsRuntime } = (0, require("openclaw/plugin-sdk/runtime-store").createPluginRuntimeStore)({
|
|
3
3
|
pluginId: "msteams",
|
|
4
4
|
errorMessage: "MSTeams runtime not initialized"
|
|
5
5
|
});
|
|
6
|
-
//#endregion
|
|
7
6
|
Object.defineProperty(exports, "getMSTeamsRuntime", {
|
|
8
7
|
enumerable: true,
|
|
9
8
|
get: function() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_secret_contract_api = require("./secret-contract-api-
|
|
1
|
+
const require_secret_contract_api = require("./secret-contract-api-BOzdWSn9.cjs");
|
|
2
2
|
exports.channelSecrets = require_secret_contract_api.channelSecrets;
|
|
3
3
|
exports.collectRuntimeConfigAssignments = require_secret_contract_api.collectRuntimeConfigAssignments;
|
|
4
4
|
exports.secretTargetRegistryEntries = require_secret_contract_api.secretTargetRegistryEntries;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
let openclaw_plugin_sdk_setup = require("openclaw/plugin-sdk/setup");
|
|
2
2
|
let openclaw_plugin_sdk_channel_secret_basic_runtime = require("openclaw/plugin-sdk/channel-secret-basic-runtime");
|
|
3
|
-
|
|
3
|
+
// extensions/msteams/src/secret-contract.ts
|
|
4
4
|
const secretTargetRegistryEntries = (0, openclaw_plugin_sdk_channel_secret_basic_runtime.createChannelSecretTargetRegistryEntries)({
|
|
5
5
|
channelKey: "msteams",
|
|
6
6
|
account: ["appPassword"],
|
|
@@ -64,7 +64,6 @@ const channelSecrets = {
|
|
|
64
64
|
secretTargetRegistryEntries,
|
|
65
65
|
collectRuntimeConfigAssignments
|
|
66
66
|
};
|
|
67
|
-
//#endregion
|
|
68
67
|
Object.defineProperty(exports, "channelSecrets", {
|
|
69
68
|
enumerable: true,
|
|
70
69
|
get: function() {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const require_bot_framework_service_url = require("./bot-framework-service-url-
|
|
2
|
-
const require_token_config = require("./token-config-
|
|
3
|
-
const require_resolve_allowlist = require("./resolve-allowlist-
|
|
4
|
-
const require_runtime = require("./runtime-
|
|
1
|
+
const require_bot_framework_service_url = require("./bot-framework-service-url-CgVuKiIR.cjs");
|
|
2
|
+
const require_token_config = require("./token-config-DTZ00Ibq.cjs");
|
|
3
|
+
const require_resolve_allowlist = require("./resolve-allowlist-CqNzS9bZ.cjs");
|
|
4
|
+
const require_runtime = require("./runtime-CbKazLGv.cjs");
|
|
5
5
|
require("../runtime-api.cjs");
|
|
6
|
-
const require_channel = require("./channel-
|
|
7
|
-
const require_channel_setup = require("./channel.setup-
|
|
8
|
-
const require_conversation_store_state = require("./conversation-store-state-
|
|
6
|
+
const require_channel = require("./channel-CdCSk3Rg.cjs");
|
|
7
|
+
const require_channel_setup = require("./channel.setup-nSTtK77J.cjs");
|
|
8
|
+
const require_conversation_store_state = require("./conversation-store-state-NJU9osd-.cjs");
|
|
9
9
|
let openclaw_plugin_sdk_channel_outbound = require("openclaw/plugin-sdk/channel-outbound");
|
|
10
10
|
let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
|
|
11
11
|
let openclaw_plugin_sdk_account_id = require("openclaw/plugin-sdk/account-id");
|
|
@@ -14,7 +14,7 @@ let openclaw_plugin_sdk_channel_inbound = require("openclaw/plugin-sdk/channel-i
|
|
|
14
14
|
let openclaw_plugin_sdk_markdown_table_runtime = require("openclaw/plugin-sdk/markdown-table-runtime");
|
|
15
15
|
let openclaw_plugin_sdk_account_helpers = require("openclaw/plugin-sdk/account-helpers");
|
|
16
16
|
let openclaw_plugin_sdk_outbound_media = require("openclaw/plugin-sdk/outbound-media");
|
|
17
|
-
|
|
17
|
+
// extensions/msteams/src/send-context.ts
|
|
18
18
|
function resolveMSTeamsProactiveReplyTarget(params) {
|
|
19
19
|
const threadRootId = params.ref.threadId ?? params.ref.activityId;
|
|
20
20
|
if (params.conversationType !== "channel" || !threadRootId) return { replyStyle: "top-level" };
|
|
@@ -168,8 +168,7 @@ async function resolveMSTeamsSendContext(params) {
|
|
|
168
168
|
mediaMaxBytes
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
|
-
|
|
172
|
-
//#region extensions/msteams/src/send.ts
|
|
171
|
+
// extensions/msteams/src/send.ts
|
|
173
172
|
function createMSTeamsSendError(errorPrefix, error) {
|
|
174
173
|
if (error instanceof Error && (error instanceof openclaw_plugin_sdk_error_runtime.PlatformMessageNotDispatchedError || (0, openclaw_plugin_sdk_channel_inbound.isChannelPartialDeliveryError)(error))) return error;
|
|
175
174
|
const classification = require_channel_setup.classifyMSTeamsSendError(error);
|
|
@@ -579,7 +578,6 @@ async function mutateMSTeamsMessageActivity(params) {
|
|
|
579
578
|
});
|
|
580
579
|
return { conversationId };
|
|
581
580
|
}
|
|
582
|
-
//#endregion
|
|
583
581
|
Object.defineProperty(exports, "deleteMessageMSTeams", {
|
|
584
582
|
enumerable: true,
|
|
585
583
|
get: function() {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const require_resolve_allowlist = require("./resolve-allowlist-
|
|
1
|
+
const require_resolve_allowlist = require("./resolve-allowlist-CqNzS9bZ.cjs");
|
|
2
2
|
let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
|
|
3
3
|
let openclaw_plugin_sdk_approval_auth_runtime = require("openclaw/plugin-sdk/approval-auth-runtime");
|
|
4
4
|
let openclaw_plugin_sdk_routing = require("openclaw/plugin-sdk/routing");
|
|
5
|
-
|
|
5
|
+
// extensions/msteams/src/approval-auth.ts
|
|
6
6
|
const MSTEAMS_ID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
7
7
|
function normalizeMSTeamsApproverId(value) {
|
|
8
8
|
const normalized = require_resolve_allowlist.normalizeMSTeamsMessagingTarget(String(value));
|
|
@@ -34,8 +34,7 @@ const msTeamsApprovalAuth = { authorizeActorAction(params) {
|
|
|
34
34
|
};
|
|
35
35
|
return msTeamsApproval.approvalAuth.authorizeActorAction(params);
|
|
36
36
|
} };
|
|
37
|
-
|
|
38
|
-
//#region extensions/msteams/src/monitor-handler/thread-session.ts
|
|
37
|
+
// extensions/msteams/src/monitor-handler/thread-session.ts
|
|
39
38
|
const TRAILING_THREAD_SUFFIX = /(?::thread:[^:]+)+$/;
|
|
40
39
|
function resolveMSTeamsRouteSessionKey(params) {
|
|
41
40
|
const channelThreadId = params.isChannel ? params.conversationMessageId ?? params.replyToId ?? void 0 : void 0;
|
|
@@ -46,7 +45,6 @@ function resolveMSTeamsRouteSessionKey(params) {
|
|
|
46
45
|
parentSessionKey: channelThreadId ? cleanBase : void 0
|
|
47
46
|
}).sessionKey;
|
|
48
47
|
}
|
|
49
|
-
//#endregion
|
|
50
48
|
Object.defineProperty(exports, "getMSTeamsApprovalApprovers", {
|
|
51
49
|
enumerable: true,
|
|
52
50
|
get: function() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
|
|
2
2
|
let openclaw_plugin_sdk_secret_input = require("openclaw/plugin-sdk/secret-input");
|
|
3
|
-
|
|
3
|
+
// extensions/msteams/src/token-config.ts
|
|
4
4
|
function resolveAuthType(cfg, options) {
|
|
5
5
|
const fromCfg = cfg?.authType;
|
|
6
6
|
if (fromCfg === "secret" || fromCfg === "federated") return fromCfg;
|
|
@@ -72,7 +72,6 @@ function inspectMSTeamsCredentials(cfg, options) {
|
|
|
72
72
|
if ((0, openclaw_plugin_sdk_secret_input.hasConfiguredSecretInput)(cfg?.appPassword)) return { status: "configured_unavailable" };
|
|
73
73
|
return (allowEnvFallback ? (0, openclaw_plugin_sdk_secret_input.normalizeSecretInputString)(process.env.MSTEAMS_APP_PASSWORD) : void 0) ? { status: "available" } : { status: "missing" };
|
|
74
74
|
}
|
|
75
|
-
//#endregion
|
|
76
75
|
Object.defineProperty(exports, "hasConfiguredMSTeamsCredentials", {
|
|
77
76
|
enumerable: true,
|
|
78
77
|
get: function() {
|