@openclaw/msteams 2026.7.2-beta.4 → 2026.7.2-beta.7
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/README.md +1 -1
- package/dist/api.cjs +2 -2
- package/dist/{channel-D_epy05a.cjs → channel-C7QxRjBW.cjs} +16 -134
- package/dist/channel-config-api.cjs +1 -1
- package/dist/channel-plugin-api.cjs +1 -1
- package/dist/{channel.runtime-D6MyENlx.cjs → channel.runtime-DjY6d_hd.cjs} +19 -14
- package/dist/{config-schema-BTnLgWAe.cjs → config-schema-C4CszdDi.cjs} +12 -28
- package/dist/{delegated-state-DOSCHaAB.cjs → delegated-state-DiEz9JIa.cjs} +0 -28
- package/dist/directory-contract-api.cjs +1 -1
- package/dist/doctor-contract-api.cjs +9 -7
- package/dist/{messenger-BcpkE82v.cjs → messenger-DTiaLTDO.cjs} +43 -32
- package/dist/{oauth-Bv-hLxJo.cjs → oauth-CW6jVGp8.cjs} +1 -1
- package/dist/{polls-CWExq2xZ.cjs → polls-BWKNpBSg.cjs} +30 -3
- package/dist/{resolve-allowlist-CgA2KHN8.cjs → resolve-allowlist-CEj9sABO.cjs} +125 -12
- package/dist/runtime-api.cjs +1 -1
- package/dist/setup-plugin-api.cjs +6 -34
- package/dist/{setup-surface-BWSGtAxk.cjs → setup-surface-ByWjaXEn.cjs} +59 -36
- package/dist/{src-Gqmhf6Hw.cjs → src-B_BdEvcr.cjs} +1305 -1021
- package/dist/{sso-token-store-OSg229re.cjs → sso-token-store-TKYk_Ms7.cjs} +1 -1
- package/package.json +5 -6
- package/npm-shrinkwrap.json +0 -1748
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_polls = require("./polls-BWKNpBSg.cjs");
|
|
2
2
|
const require_runtime = require("./runtime-gZTAuFux.cjs");
|
|
3
3
|
require("./runtime-api.cjs");
|
|
4
|
-
const require_resolve_allowlist = require("./resolve-allowlist-
|
|
5
|
-
const require_setup_surface = require("./setup-surface-
|
|
6
|
-
const require_polls = require("./polls-CWExq2xZ.cjs");
|
|
4
|
+
const require_resolve_allowlist = require("./resolve-allowlist-CEj9sABO.cjs");
|
|
5
|
+
const require_setup_surface = require("./setup-surface-ByWjaXEn.cjs");
|
|
7
6
|
let openclaw_plugin_sdk_lazy_runtime = require("openclaw/plugin-sdk/lazy-runtime");
|
|
8
7
|
let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
|
|
9
8
|
let openclaw_plugin_sdk_reply_payload = require("openclaw/plugin-sdk/reply-payload");
|
|
@@ -14,9 +13,10 @@ let openclaw_plugin_sdk_ssrf_policy = require("openclaw/plugin-sdk/ssrf-policy")
|
|
|
14
13
|
let openclaw_plugin_sdk_text_utility_runtime = require("openclaw/plugin-sdk/text-utility-runtime");
|
|
15
14
|
let openclaw_plugin_sdk_html_entity_runtime = require("openclaw/plugin-sdk/html-entity-runtime");
|
|
16
15
|
let node_crypto = require("node:crypto");
|
|
17
|
-
node_crypto =
|
|
16
|
+
node_crypto = require_polls.__toESM(node_crypto, 1);
|
|
18
17
|
let node_path = require("node:path");
|
|
19
|
-
node_path =
|
|
18
|
+
node_path = require_polls.__toESM(node_path, 1);
|
|
19
|
+
let openclaw_plugin_sdk_error_runtime = require("openclaw/plugin-sdk/error-runtime");
|
|
20
20
|
let openclaw_plugin_sdk_reply_chunking = require("openclaw/plugin-sdk/reply-chunking");
|
|
21
21
|
let openclaw_plugin_sdk_web_media = require("openclaw/plugin-sdk/web-media");
|
|
22
22
|
let openclaw_plugin_sdk_media_runtime = require("openclaw/plugin-sdk/media-runtime");
|
|
@@ -603,33 +603,24 @@ function requiresFileConsent(params) {
|
|
|
603
603
|
const ESCAPED_MARKDOWN_RE = /\\[\\`*_{}[\]()#+\-.!|>~]/gu;
|
|
604
604
|
const MARKDOWN_ENTITY_RE = /&(?:#\d+|#x[\da-f]+|[a-z][a-z\d]+);/giu;
|
|
605
605
|
const TOKEN_END = "";
|
|
606
|
-
const MSTEAMS_FORMAT_CAPABILITIES = {
|
|
606
|
+
const MSTEAMS_FORMAT_CAPABILITIES = openclaw_plugin_sdk_text_chunking.FormatCapabilityProfile.define({
|
|
607
607
|
mechanism: "markdown",
|
|
608
608
|
constructs: {
|
|
609
|
-
bold: "native",
|
|
610
|
-
italic: "native",
|
|
611
609
|
underline: "strip",
|
|
612
|
-
strikethrough: "native",
|
|
613
610
|
spoiler: "fallback",
|
|
614
|
-
codeInline: "native",
|
|
615
|
-
codeBlock: "native",
|
|
616
611
|
codeLanguage: "fallback",
|
|
617
|
-
linkLabel: "native",
|
|
618
612
|
heading: "fallback",
|
|
619
613
|
bulletList: "fallback",
|
|
620
614
|
orderedList: "fallback",
|
|
621
615
|
taskList: "fallback",
|
|
622
|
-
table: "fallback"
|
|
623
|
-
blockquote: "native",
|
|
624
|
-
image: "native",
|
|
625
|
-
mention: "native"
|
|
616
|
+
table: "fallback"
|
|
626
617
|
},
|
|
627
618
|
chunk: {
|
|
628
619
|
limit: 8e4,
|
|
629
620
|
unit: "utf16",
|
|
630
621
|
hardCap: 1e5
|
|
631
622
|
}
|
|
632
|
-
};
|
|
623
|
+
});
|
|
633
624
|
const MSTEAMS_MARKERS = {
|
|
634
625
|
bold: {
|
|
635
626
|
open: "**",
|
|
@@ -1097,9 +1088,10 @@ async function getGraphAccessToken(tokenProvider) {
|
|
|
1097
1088
|
async function uploadToSharePoint(params) {
|
|
1098
1089
|
const fetchFn = params.fetchFn ?? fetch;
|
|
1099
1090
|
const uploadPath = `/OpenClawShared/${encodeURIComponent(params.filename)}`;
|
|
1091
|
+
const timeoutMs = require_resolve_allowlist.resolveMSTeamsSharePointUploadTimeoutMs(params.buffer.length);
|
|
1100
1092
|
const data = await require_resolve_allowlist.withMSTeamsAbortableRequestTimeout({
|
|
1101
1093
|
label: SHAREPOINT_UPLOAD_TIMEOUT_LABEL,
|
|
1102
|
-
timeoutMs
|
|
1094
|
+
timeoutMs,
|
|
1103
1095
|
work: async (signal) => {
|
|
1104
1096
|
const token = await getGraphAccessToken(params.tokenProvider);
|
|
1105
1097
|
const res = await fetchFn(`${GRAPH_ROOT}/sites/${params.siteId}/drive/root:${uploadPath}:/content`, {
|
|
@@ -1113,7 +1105,7 @@ async function uploadToSharePoint(params) {
|
|
|
1113
1105
|
signal
|
|
1114
1106
|
});
|
|
1115
1107
|
if (!res.ok) throw await require_resolve_allowlist.createMSTeamsHttpError(res, "SharePoint upload failed");
|
|
1116
|
-
return await (0, openclaw_plugin_sdk_provider_http.readProviderJsonResponse)(res, "msteams.graph-upload.uploadSharePointFile");
|
|
1108
|
+
return await (0, openclaw_plugin_sdk_provider_http.readProviderJsonResponse)(res, "msteams.graph-upload.uploadSharePointFile", { chunkTimeoutMs: timeoutMs });
|
|
1117
1109
|
}
|
|
1118
1110
|
});
|
|
1119
1111
|
if (!data.id || !data.webUrl || !data.name) throw new Error("SharePoint upload response missing required fields");
|
|
@@ -1286,8 +1278,12 @@ async function extractFilename(url) {
|
|
|
1286
1278
|
}
|
|
1287
1279
|
try {
|
|
1288
1280
|
const pathname = new URL(url).pathname;
|
|
1289
|
-
|
|
1290
|
-
|
|
1281
|
+
let basename = node_path.default.basename(pathname);
|
|
1282
|
+
if (basename.includes("%")) try {
|
|
1283
|
+
const decodedBasename = decodeURIComponent(basename);
|
|
1284
|
+
if (!decodedBasename.includes("/") && !decodedBasename.includes("\\") && !decodedBasename.includes("\0")) basename = decodedBasename;
|
|
1285
|
+
} catch {}
|
|
1286
|
+
const existingExt = (0, openclaw_plugin_sdk_media_runtime.getFileExtension)(basename);
|
|
1291
1287
|
if (basename && existingExt) return basename;
|
|
1292
1288
|
const mime = await getMimeType(url);
|
|
1293
1289
|
const ext = (0, openclaw_plugin_sdk_media_runtime.extensionForMime)(mime) ?? ".bin";
|
|
@@ -1734,17 +1730,26 @@ async function sendMSTeamsMessages(params) {
|
|
|
1734
1730
|
}
|
|
1735
1731
|
throw new Error("unreachable Teams send retry loop exit");
|
|
1736
1732
|
};
|
|
1733
|
+
let providerDispatchStarted = false;
|
|
1737
1734
|
const sendMessageInContext = async (sendFn, message, messageIndex) => {
|
|
1738
1735
|
let pendingUploadId;
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1736
|
+
let response;
|
|
1737
|
+
try {
|
|
1738
|
+
response = await sendWithRetry(async () => {
|
|
1739
|
+
const activity = await buildActivity(message, params.conversationRef, params.tokenProvider, params.sharePointSiteId, params.mediaMaxBytes, { feedbackLoopEnabled: params.feedbackLoopEnabled });
|
|
1740
|
+
pendingUploadId = typeof activity["_pendingUploadId"] === "string" ? activity["_pendingUploadId"] : void 0;
|
|
1741
|
+
if (pendingUploadId) delete activity["_pendingUploadId"];
|
|
1742
|
+
providerDispatchStarted = true;
|
|
1743
|
+
return await sendFn(activity);
|
|
1744
|
+
}, {
|
|
1745
|
+
messageIndex,
|
|
1746
|
+
messageCount: messages.length
|
|
1747
|
+
});
|
|
1748
|
+
} catch (error) {
|
|
1749
|
+
if (!providerDispatchStarted) throw new openclaw_plugin_sdk_error_runtime.PlatformMessageNotDispatchedError(error instanceof Error ? error.message : "Teams activity preparation failed", { cause: error });
|
|
1750
|
+
throw error;
|
|
1751
|
+
}
|
|
1752
|
+
const messageId = extractMessageId(response) ?? "unknown";
|
|
1748
1753
|
if (pendingUploadId && messageId !== "unknown") setPendingUploadActivityId(pendingUploadId, messageId);
|
|
1749
1754
|
return messageId;
|
|
1750
1755
|
};
|
|
@@ -1754,7 +1759,13 @@ async function sendMSTeamsMessages(params) {
|
|
|
1754
1759
|
return messageIds;
|
|
1755
1760
|
};
|
|
1756
1761
|
const sendProactively = async (batch, startIndex, threadActivityId) => {
|
|
1757
|
-
|
|
1762
|
+
let baseRef;
|
|
1763
|
+
try {
|
|
1764
|
+
baseRef = buildConversationReference(params.conversationRef);
|
|
1765
|
+
} catch (error) {
|
|
1766
|
+
if (providerDispatchStarted) throw error;
|
|
1767
|
+
throw new openclaw_plugin_sdk_error_runtime.PlatformMessageNotDispatchedError(error instanceof Error ? error.message : "Teams conversation preparation failed", { cause: error });
|
|
1768
|
+
}
|
|
1758
1769
|
const isChannel = params.conversationRef.conversation?.conversationType === "channel";
|
|
1759
1770
|
const sendFn = (activity) => sendMSTeamsActivityWithReference(params.app, baseRef, activity, {
|
|
1760
1771
|
threadActivityId: isChannel ? threadActivityId : void 0,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_resolve_allowlist = require("./resolve-allowlist-
|
|
1
|
+
const require_resolve_allowlist = require("./resolve-allowlist-CEj9sABO.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
|
let openclaw_plugin_sdk_runtime_env = require("openclaw/plugin-sdk/runtime-env");
|
|
@@ -1,12 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
//#endregion
|
|
2
23
|
const require_runtime = require("./runtime-gZTAuFux.cjs");
|
|
3
24
|
let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
|
|
4
25
|
let openclaw_plugin_sdk_file_lock = require("openclaw/plugin-sdk/file-lock");
|
|
5
26
|
let openclaw_plugin_sdk_number_runtime = require("openclaw/plugin-sdk/number-runtime");
|
|
6
27
|
let node_crypto = require("node:crypto");
|
|
7
|
-
node_crypto =
|
|
28
|
+
node_crypto = __toESM(node_crypto, 1);
|
|
8
29
|
let node_path = require("node:path");
|
|
9
|
-
node_path =
|
|
30
|
+
node_path = __toESM(node_path, 1);
|
|
10
31
|
let openclaw_plugin_sdk_keyed_async_queue = require("openclaw/plugin-sdk/keyed-async-queue");
|
|
11
32
|
//#region extensions/msteams/src/conversation-store-helpers.ts
|
|
12
33
|
function normalizeStoredConversationId(raw) {
|
|
@@ -568,6 +589,12 @@ Object.defineProperty(exports, "MSTEAMS_SQLITE_MAX_POLL_ROWS", {
|
|
|
568
589
|
return MSTEAMS_SQLITE_MAX_POLL_ROWS;
|
|
569
590
|
}
|
|
570
591
|
});
|
|
592
|
+
Object.defineProperty(exports, "__toESM", {
|
|
593
|
+
enumerable: true,
|
|
594
|
+
get: function() {
|
|
595
|
+
return __toESM;
|
|
596
|
+
}
|
|
597
|
+
});
|
|
571
598
|
Object.defineProperty(exports, "buildMSTeamsConversationStateKey", {
|
|
572
599
|
enumerable: true,
|
|
573
600
|
get: function() {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const require_delegated_state = require("./delegated-state-DOSCHaAB.cjs");
|
|
2
1
|
const require_runtime = require("./runtime-gZTAuFux.cjs");
|
|
3
2
|
require("./runtime-api.cjs");
|
|
4
|
-
|
|
3
|
+
const require_delegated_state = require("./delegated-state-DiEz9JIa.cjs");
|
|
5
4
|
let openclaw_plugin_sdk_lazy_runtime = require("openclaw/plugin-sdk/lazy-runtime");
|
|
6
5
|
let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
|
|
6
|
+
let openclaw_plugin_sdk_allow_from = require("openclaw/plugin-sdk/allow-from");
|
|
7
7
|
let openclaw_plugin_sdk_ssrf_runtime = require("openclaw/plugin-sdk/ssrf-runtime");
|
|
8
8
|
let openclaw_plugin_sdk_provider_http = require("openclaw/plugin-sdk/provider-http");
|
|
9
9
|
let node_buffer = require("node:buffer");
|
|
@@ -11,10 +11,10 @@ let node_dns_promises = require("node:dns/promises");
|
|
|
11
11
|
let openclaw_plugin_sdk_ssrf_policy = require("openclaw/plugin-sdk/ssrf-policy");
|
|
12
12
|
let openclaw_plugin_sdk_number_runtime = require("openclaw/plugin-sdk/number-runtime");
|
|
13
13
|
let openclaw_plugin_sdk_text_utility_runtime = require("openclaw/plugin-sdk/text-utility-runtime");
|
|
14
|
-
let
|
|
15
|
-
node_fs = require_delegated_state.__toESM(node_fs, 1);
|
|
14
|
+
let openclaw_plugin_sdk_secret_file = require("openclaw/plugin-sdk/secret-file");
|
|
16
15
|
let node_module = require("node:module");
|
|
17
16
|
let openclaw_plugin_sdk_secret_input = require("openclaw/plugin-sdk/secret-input");
|
|
17
|
+
let openclaw_plugin_sdk_html_entity_runtime = require("openclaw/plugin-sdk/html-entity-runtime");
|
|
18
18
|
//#region extensions/msteams/src/request-timeout.ts
|
|
19
19
|
const MSTEAMS_REQUEST_TIMEOUT_MS = 3e4;
|
|
20
20
|
const MSTEAMS_SHAREPOINT_UPLOAD_BASE_TIMEOUT_MS = 5 * 6e4;
|
|
@@ -746,7 +746,7 @@ async function createMSTeamsApp(creds, options) {
|
|
|
746
746
|
...serviceUrl ? { serviceUrl } : {},
|
|
747
747
|
...options?.oauthDefaultConnectionName ? { oauth: { defaultConnectionName: options.oauthDefaultConnectionName } } : {}
|
|
748
748
|
};
|
|
749
|
-
if (creds.type === "federated") return createFederatedApp(creds, App, appOptions);
|
|
749
|
+
if (creds.type === "federated") return await createFederatedApp(creds, App, appOptions);
|
|
750
750
|
return new App({
|
|
751
751
|
clientId: creds.appId,
|
|
752
752
|
clientSecret: creds.appPassword,
|
|
@@ -754,7 +754,7 @@ async function createMSTeamsApp(creds, options) {
|
|
|
754
754
|
...appOptions
|
|
755
755
|
});
|
|
756
756
|
}
|
|
757
|
-
function createFederatedApp(creds, App, appOptions) {
|
|
757
|
+
async function createFederatedApp(creds, App, appOptions) {
|
|
758
758
|
if (creds.useManagedIdentity) return new App({
|
|
759
759
|
clientId: creds.appId,
|
|
760
760
|
tenantId: creds.tenantId,
|
|
@@ -764,7 +764,7 @@ function createFederatedApp(creds, App, appOptions) {
|
|
|
764
764
|
if (!creds.certificatePath) throw new Error("Federated credentials require either a certificate path or managed identity.");
|
|
765
765
|
let privateKey;
|
|
766
766
|
try {
|
|
767
|
-
privateKey =
|
|
767
|
+
privateKey = await (0, openclaw_plugin_sdk_secret_file.readSecretFile)(creds.certificatePath, "Microsoft Teams certificate");
|
|
768
768
|
} catch (err) {
|
|
769
769
|
const msg = err instanceof Error ? err.message : String(err);
|
|
770
770
|
throw new Error(`Failed to read certificate file at '${creds.certificatePath}': ${msg}`, { cause: err });
|
|
@@ -948,12 +948,16 @@ function resolveAuthType(cfg) {
|
|
|
948
948
|
if (process.env.MSTEAMS_AUTH_TYPE === "federated") return "federated";
|
|
949
949
|
return "secret";
|
|
950
950
|
}
|
|
951
|
+
function resolveFederatedPath(configValue, envValue) {
|
|
952
|
+
if ((0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(configValue)) return configValue;
|
|
953
|
+
if ((0, openclaw_plugin_sdk_string_coerce_runtime.normalizeOptionalString)(envValue)) return envValue;
|
|
954
|
+
}
|
|
951
955
|
function hasConfiguredMSTeamsCredentials(cfg) {
|
|
952
956
|
const authType = resolveAuthType(cfg);
|
|
953
957
|
const hasAppId = Boolean((0, openclaw_plugin_sdk_secret_input.normalizeSecretInputString)(cfg?.appId) || (0, openclaw_plugin_sdk_secret_input.normalizeSecretInputString)(process.env.MSTEAMS_APP_ID));
|
|
954
958
|
const hasTenantId = Boolean((0, openclaw_plugin_sdk_secret_input.normalizeSecretInputString)(cfg?.tenantId) || (0, openclaw_plugin_sdk_secret_input.normalizeSecretInputString)(process.env.MSTEAMS_TENANT_ID));
|
|
955
959
|
if (authType === "federated") {
|
|
956
|
-
const hasCert = Boolean(cfg?.certificatePath
|
|
960
|
+
const hasCert = Boolean(resolveFederatedPath(cfg?.certificatePath, process.env.MSTEAMS_CERTIFICATE_PATH));
|
|
957
961
|
const hasManagedIdentity = cfg?.useManagedIdentity ?? process.env.MSTEAMS_USE_MANAGED_IDENTITY === "true";
|
|
958
962
|
return hasAppId && hasTenantId && (hasCert || hasManagedIdentity);
|
|
959
963
|
}
|
|
@@ -965,7 +969,7 @@ function resolveMSTeamsCredentials(cfg) {
|
|
|
965
969
|
const tenantId = (0, openclaw_plugin_sdk_secret_input.normalizeSecretInputString)(cfg?.tenantId) || (0, openclaw_plugin_sdk_secret_input.normalizeSecretInputString)(process.env.MSTEAMS_TENANT_ID);
|
|
966
970
|
if (!appId || !tenantId) return;
|
|
967
971
|
if (authType === "federated") {
|
|
968
|
-
const certificatePath = cfg?.certificatePath
|
|
972
|
+
const certificatePath = resolveFederatedPath(cfg?.certificatePath, process.env.MSTEAMS_CERTIFICATE_PATH);
|
|
969
973
|
const certificateThumbprint = cfg?.certificateThumbprint || process.env.MSTEAMS_CERTIFICATE_THUMBPRINT || void 0;
|
|
970
974
|
const useManagedIdentity = cfg?.useManagedIdentity ?? process.env.MSTEAMS_USE_MANAGED_IDENTITY === "true";
|
|
971
975
|
const managedIdentityClientId = cfg?.managedIdentityClientId || process.env.MSTEAMS_MANAGED_IDENTITY_CLIENT_ID || void 0;
|
|
@@ -1237,7 +1241,64 @@ async function findGraphUsersByExactIdentity(params) {
|
|
|
1237
1241
|
});
|
|
1238
1242
|
}
|
|
1239
1243
|
//#endregion
|
|
1244
|
+
//#region extensions/msteams/src/inbound.ts
|
|
1245
|
+
/**
|
|
1246
|
+
* Strip HTML tags, preserving text content.
|
|
1247
|
+
*/
|
|
1248
|
+
function htmlToPlainText(html) {
|
|
1249
|
+
return (0, openclaw_plugin_sdk_html_entity_runtime.decodeHtmlEntities)(html.replace(/<[^>]*>/g, " ")).replaceAll("\xA0", " ").replace(/\s+/g, " ").trim();
|
|
1250
|
+
}
|
|
1251
|
+
/**
|
|
1252
|
+
* Extract quote info from MS Teams HTML reply attachments.
|
|
1253
|
+
* Teams wraps quoted content in a blockquote with itemtype="http://schema.skype.com/Reply".
|
|
1254
|
+
*/
|
|
1255
|
+
function extractMSTeamsQuoteInfo(attachments) {
|
|
1256
|
+
for (const att of attachments) {
|
|
1257
|
+
let content = "";
|
|
1258
|
+
if (typeof att.content === "string") content = att.content;
|
|
1259
|
+
else if (typeof att.content === "object" && att.content !== null) {
|
|
1260
|
+
const record = att.content;
|
|
1261
|
+
content = typeof record.text === "string" ? record.text : typeof record.body === "string" ? record.body : "";
|
|
1262
|
+
}
|
|
1263
|
+
if (!content) continue;
|
|
1264
|
+
if (!content.includes("http://schema.skype.com/Reply")) continue;
|
|
1265
|
+
const senderMatch = /<strong[^>]*itemprop=["']mri["'][^>]*>(.*?)<\/strong>/i.exec(content);
|
|
1266
|
+
const sender = senderMatch?.[1] ? htmlToPlainText(senderMatch[1]) : void 0;
|
|
1267
|
+
const bodyMatch = /<p[^>]*itemprop=["']copy["'][^>]*>(.*?)<\/p>/is.exec(content) ?? /<p[^>]*itemprop=["']preview["'][^>]*>(.*?)<\/p>/is.exec(content);
|
|
1268
|
+
const body = bodyMatch?.[1] ? htmlToPlainText(bodyMatch[1]) : void 0;
|
|
1269
|
+
const id = /<blockquote[^>]*\bitemid=["']([^"']+)["'][^>]*>/is.exec(content)?.[1]?.trim() || void 0;
|
|
1270
|
+
if (body) return {
|
|
1271
|
+
sender: sender ?? "unknown",
|
|
1272
|
+
body,
|
|
1273
|
+
...id ? { id } : {}
|
|
1274
|
+
};
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
function normalizeMSTeamsConversationId(raw) {
|
|
1278
|
+
return raw.split(";")[0] ?? raw;
|
|
1279
|
+
}
|
|
1280
|
+
function extractMSTeamsConversationMessageId(raw) {
|
|
1281
|
+
if (!raw) return;
|
|
1282
|
+
return (/(?:^|;)messageid=([^;]+)/i.exec(raw)?.[1]?.trim() ?? "") || void 0;
|
|
1283
|
+
}
|
|
1284
|
+
function parseMSTeamsActivityTimestamp(value) {
|
|
1285
|
+
if (!value) return;
|
|
1286
|
+
if (value instanceof Date) return value;
|
|
1287
|
+
if (typeof value !== "string") return;
|
|
1288
|
+
const date = new Date(value);
|
|
1289
|
+
return Number.isNaN(date.getTime()) ? void 0 : date;
|
|
1290
|
+
}
|
|
1291
|
+
function stripMSTeamsMentionTags(text) {
|
|
1292
|
+
return text.replace(/<at[^>]*>.*?<\/at>/gi, "").trim();
|
|
1293
|
+
}
|
|
1294
|
+
function wasMSTeamsBotMentioned(activity) {
|
|
1295
|
+
const botId = activity.recipient?.id;
|
|
1296
|
+
if (!botId) return false;
|
|
1297
|
+
return (activity.entities ?? []).some((e) => e.type === "mention" && e.mentioned?.id === botId);
|
|
1298
|
+
}
|
|
1299
|
+
//#endregion
|
|
1240
1300
|
//#region extensions/msteams/src/resolve-allowlist.ts
|
|
1301
|
+
const MSTEAMS_GROUP_CONVERSATION_ID = /^19:.+@thread\.(?:tacv2|skype|v2)$/i;
|
|
1241
1302
|
function normalizeExactMatch(value) {
|
|
1242
1303
|
return (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeLowercaseStringOrEmpty)(value ?? "");
|
|
1243
1304
|
}
|
|
@@ -1280,6 +1341,16 @@ function projectStableMSTeamsUserAllowlist(entries) {
|
|
|
1280
1341
|
const projected = entries.map((entry) => normalizeStaticMSTeamsAllowEntry(entry)).filter((entry) => Boolean(entry));
|
|
1281
1342
|
return [...new Map(projected.map((entry) => [normalizeExactMatch(entry), entry])).values()];
|
|
1282
1343
|
}
|
|
1344
|
+
function projectStableMSTeamsGroupAllowlist(entries) {
|
|
1345
|
+
if (!entries) return;
|
|
1346
|
+
const projected = entries.map((entry) => {
|
|
1347
|
+
const stableUserEntry = normalizeStaticMSTeamsAllowEntry(entry);
|
|
1348
|
+
if (stableUserEntry) return stableUserEntry;
|
|
1349
|
+
const conversationId = normalizeMSTeamsConversationId(normalizeMSTeamsUserInput(entry));
|
|
1350
|
+
return MSTEAMS_GROUP_CONVERSATION_ID.test(conversationId) ? conversationId : void 0;
|
|
1351
|
+
}).filter((entry) => Boolean(entry));
|
|
1352
|
+
return [...new Map(projected.map((entry) => [MSTEAMS_GROUP_CONVERSATION_ID.test(entry) ? `conversation:${entry}` : normalizeExactMatch(entry), entry])).values()];
|
|
1353
|
+
}
|
|
1283
1354
|
function stripProviderPrefix(raw) {
|
|
1284
1355
|
return raw.replace(/^(msteams|teams):/i, "");
|
|
1285
1356
|
}
|
|
@@ -1311,7 +1382,7 @@ function parseMSTeamsConversationId(raw) {
|
|
|
1311
1382
|
*
|
|
1312
1383
|
* Accepts both prefixed and bare formats:
|
|
1313
1384
|
* - `conversation:<id>` — explicit conversation prefix
|
|
1314
|
-
* - `19:abc@thread.tacv2` / `19:abc@thread.skype` —
|
|
1385
|
+
* - `19:abc@thread.tacv2` / `19:abc@thread.skype` / `19:abc@thread.v2` — group or channel
|
|
1315
1386
|
* - `19:{userId}_{appId}@unq.gbl.spaces` — Graph 1:1 chat thread format
|
|
1316
1387
|
* - `a:1xxx` — Bot Framework personal (1:1) chat id
|
|
1317
1388
|
* - `8:orgid:xxx` — Bot Framework org-scoped personal chat id
|
|
@@ -1320,7 +1391,7 @@ function looksLikeMSTeamsConversationId(raw) {
|
|
|
1320
1391
|
const trimmed = raw.trim();
|
|
1321
1392
|
if (!trimmed) return false;
|
|
1322
1393
|
if (/^conversation:/i.test(trimmed)) return true;
|
|
1323
|
-
if (
|
|
1394
|
+
if (MSTEAMS_GROUP_CONVERSATION_ID.test(trimmed)) return true;
|
|
1324
1395
|
if (/^19:.+@unq\.gbl\.spaces$/i.test(trimmed)) return true;
|
|
1325
1396
|
if (/^a:1[A-Za-z0-9_-]+$/i.test(trimmed)) return true;
|
|
1326
1397
|
if (/^8:orgid:[A-Za-z0-9-]+$/i.test(trimmed)) return true;
|
|
@@ -1331,7 +1402,7 @@ function looksLikeMSTeamsConversationId(raw) {
|
|
|
1331
1402
|
* can forward verbatim to the channel adapter.
|
|
1332
1403
|
*/
|
|
1333
1404
|
function looksLikeMSTeamsTargetId(raw) {
|
|
1334
|
-
const trimmed = raw.trim();
|
|
1405
|
+
const trimmed = stripProviderPrefix(raw.trim()).trim();
|
|
1335
1406
|
if (looksLikeMSTeamsConversationId(trimmed)) return true;
|
|
1336
1407
|
if (/^user:/i.test(trimmed)) {
|
|
1337
1408
|
const id = trimmed.slice(5).trim();
|
|
@@ -1805,6 +1876,18 @@ Object.defineProperty(exports, "extractInlineImageCandidates", {
|
|
|
1805
1876
|
return extractInlineImageCandidates;
|
|
1806
1877
|
}
|
|
1807
1878
|
});
|
|
1879
|
+
Object.defineProperty(exports, "extractMSTeamsConversationMessageId", {
|
|
1880
|
+
enumerable: true,
|
|
1881
|
+
get: function() {
|
|
1882
|
+
return extractMSTeamsConversationMessageId;
|
|
1883
|
+
}
|
|
1884
|
+
});
|
|
1885
|
+
Object.defineProperty(exports, "extractMSTeamsQuoteInfo", {
|
|
1886
|
+
enumerable: true,
|
|
1887
|
+
get: function() {
|
|
1888
|
+
return extractMSTeamsQuoteInfo;
|
|
1889
|
+
}
|
|
1890
|
+
});
|
|
1808
1891
|
Object.defineProperty(exports, "fetchGraphAbsoluteUrl", {
|
|
1809
1892
|
enumerable: true,
|
|
1810
1893
|
get: function() {
|
|
@@ -1907,6 +1990,12 @@ Object.defineProperty(exports, "normalizeContentType", {
|
|
|
1907
1990
|
return normalizeContentType;
|
|
1908
1991
|
}
|
|
1909
1992
|
});
|
|
1993
|
+
Object.defineProperty(exports, "normalizeMSTeamsConversationId", {
|
|
1994
|
+
enumerable: true,
|
|
1995
|
+
get: function() {
|
|
1996
|
+
return normalizeMSTeamsConversationId;
|
|
1997
|
+
}
|
|
1998
|
+
});
|
|
1910
1999
|
Object.defineProperty(exports, "normalizeMSTeamsMessagingTarget", {
|
|
1911
2000
|
enumerable: true,
|
|
1912
2001
|
get: function() {
|
|
@@ -1925,6 +2014,12 @@ Object.defineProperty(exports, "normalizeQuery", {
|
|
|
1925
2014
|
return normalizeQuery;
|
|
1926
2015
|
}
|
|
1927
2016
|
});
|
|
2017
|
+
Object.defineProperty(exports, "parseMSTeamsActivityTimestamp", {
|
|
2018
|
+
enumerable: true,
|
|
2019
|
+
get: function() {
|
|
2020
|
+
return parseMSTeamsActivityTimestamp;
|
|
2021
|
+
}
|
|
2022
|
+
});
|
|
1928
2023
|
Object.defineProperty(exports, "parseMSTeamsConversationId", {
|
|
1929
2024
|
enumerable: true,
|
|
1930
2025
|
get: function() {
|
|
@@ -1961,6 +2056,12 @@ Object.defineProperty(exports, "postGraphJson", {
|
|
|
1961
2056
|
return postGraphJson;
|
|
1962
2057
|
}
|
|
1963
2058
|
});
|
|
2059
|
+
Object.defineProperty(exports, "projectStableMSTeamsGroupAllowlist", {
|
|
2060
|
+
enumerable: true,
|
|
2061
|
+
get: function() {
|
|
2062
|
+
return projectStableMSTeamsGroupAllowlist;
|
|
2063
|
+
}
|
|
2064
|
+
});
|
|
1964
2065
|
Object.defineProperty(exports, "projectStableMSTeamsTeamsConfig", {
|
|
1965
2066
|
enumerable: true,
|
|
1966
2067
|
get: function() {
|
|
@@ -2075,6 +2176,12 @@ Object.defineProperty(exports, "searchGraphUsers", {
|
|
|
2075
2176
|
return searchGraphUsers;
|
|
2076
2177
|
}
|
|
2077
2178
|
});
|
|
2179
|
+
Object.defineProperty(exports, "stripMSTeamsMentionTags", {
|
|
2180
|
+
enumerable: true,
|
|
2181
|
+
get: function() {
|
|
2182
|
+
return stripMSTeamsMentionTags;
|
|
2183
|
+
}
|
|
2184
|
+
});
|
|
2078
2185
|
Object.defineProperty(exports, "tryBuildGraphSharesUrlForSharedLink", {
|
|
2079
2186
|
enumerable: true,
|
|
2080
2187
|
get: function() {
|
|
@@ -2093,6 +2200,12 @@ Object.defineProperty(exports, "validateMSTeamsProactiveServiceUrlBoundary", {
|
|
|
2093
2200
|
return validateMSTeamsProactiveServiceUrlBoundary;
|
|
2094
2201
|
}
|
|
2095
2202
|
});
|
|
2203
|
+
Object.defineProperty(exports, "wasMSTeamsBotMentioned", {
|
|
2204
|
+
enumerable: true,
|
|
2205
|
+
get: function() {
|
|
2206
|
+
return wasMSTeamsBotMentioned;
|
|
2207
|
+
}
|
|
2208
|
+
});
|
|
2096
2209
|
Object.defineProperty(exports, "withMSTeamsAbortableRequestTimeout", {
|
|
2097
2210
|
enumerable: true,
|
|
2098
2211
|
get: function() {
|
package/dist/runtime-api.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_runtime = require("./runtime-gZTAuFux.cjs");
|
|
3
|
-
let openclaw_plugin_sdk_allow_from = require("openclaw/plugin-sdk/allow-from");
|
|
4
3
|
let openclaw_plugin_sdk_channel_outbound = require("openclaw/plugin-sdk/channel-outbound");
|
|
5
4
|
let openclaw_plugin_sdk_channel_pairing = require("openclaw/plugin-sdk/channel-pairing");
|
|
6
5
|
let openclaw_plugin_sdk_channel_policy = require("openclaw/plugin-sdk/channel-policy");
|
|
7
6
|
let openclaw_plugin_sdk_account_id = require("openclaw/plugin-sdk/account-id");
|
|
7
|
+
let openclaw_plugin_sdk_allow_from = require("openclaw/plugin-sdk/allow-from");
|
|
8
8
|
let openclaw_plugin_sdk_channel_status = require("openclaw/plugin-sdk/channel-status");
|
|
9
9
|
let openclaw_plugin_sdk_channel_targets = require("openclaw/plugin-sdk/channel-targets");
|
|
10
10
|
let openclaw_plugin_sdk_dangerous_name_runtime = require("openclaw/plugin-sdk/dangerous-name-runtime");
|
|
@@ -1,42 +1,14 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_resolve_allowlist = require("./resolve-allowlist-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
2
|
+
const require_resolve_allowlist = require("./resolve-allowlist-CEj9sABO.cjs");
|
|
3
|
+
const require_setup_surface = require("./setup-surface-ByWjaXEn.cjs");
|
|
4
|
+
const require_config_schema = require("./config-schema-C4CszdDi.cjs");
|
|
5
5
|
let openclaw_plugin_sdk_account_helpers = require("openclaw/plugin-sdk/account-helpers");
|
|
6
|
-
let openclaw_plugin_sdk_allow_from = require("openclaw/plugin-sdk/allow-from");
|
|
7
|
-
let openclaw_plugin_sdk_channel_config_helpers = require("openclaw/plugin-sdk/channel-config-helpers");
|
|
8
6
|
//#region extensions/msteams/src/channel.setup.ts
|
|
9
|
-
const meta = {
|
|
10
|
-
id: "msteams",
|
|
11
|
-
label: "Microsoft Teams",
|
|
12
|
-
selectionLabel: "Microsoft Teams (Bot Framework)",
|
|
13
|
-
docsPath: "/channels/msteams",
|
|
14
|
-
docsLabel: "msteams",
|
|
15
|
-
blurb: "Teams SDK; enterprise support.",
|
|
16
|
-
aliases: ["teams"],
|
|
17
|
-
order: 60
|
|
18
|
-
};
|
|
19
|
-
const resolveMSTeamsChannelConfig = (cfg) => ({
|
|
20
|
-
allowFrom: cfg.channels?.msteams?.allowFrom,
|
|
21
|
-
defaultTo: cfg.channels?.msteams?.defaultTo
|
|
22
|
-
});
|
|
23
|
-
const msteamsConfigAdapter = (0, openclaw_plugin_sdk_channel_config_helpers.createTopLevelChannelConfigAdapter)({
|
|
24
|
-
sectionKey: "msteams",
|
|
25
|
-
resolveAccount: (cfg) => ({
|
|
26
|
-
accountId: "default",
|
|
27
|
-
enabled: cfg.channels?.msteams?.enabled !== false,
|
|
28
|
-
configured: Boolean(require_resolve_allowlist.resolveMSTeamsCredentials(cfg.channels?.msteams))
|
|
29
|
-
}),
|
|
30
|
-
resolveAccessorAccount: ({ cfg }) => resolveMSTeamsChannelConfig(cfg),
|
|
31
|
-
resolveAllowFrom: (account) => account.allowFrom,
|
|
32
|
-
formatAllowFrom: (allowFrom) => (0, openclaw_plugin_sdk_allow_from.formatAllowFromLowercase)({ allowFrom }),
|
|
33
|
-
resolveDefaultTo: (account) => account.defaultTo
|
|
34
|
-
});
|
|
35
7
|
const msteamsSetupPlugin = {
|
|
36
8
|
id: "msteams",
|
|
37
9
|
meta: {
|
|
38
|
-
...
|
|
39
|
-
aliases: [...
|
|
10
|
+
...require_setup_surface.msteamsMeta,
|
|
11
|
+
aliases: [...require_setup_surface.msteamsMeta.aliases]
|
|
40
12
|
},
|
|
41
13
|
capabilities: {
|
|
42
14
|
chatTypes: [
|
|
@@ -51,7 +23,7 @@ const msteamsSetupPlugin = {
|
|
|
51
23
|
reload: { configPrefixes: ["channels.msteams"] },
|
|
52
24
|
configSchema: require_config_schema.MSTeamsChannelConfigSchema,
|
|
53
25
|
config: {
|
|
54
|
-
...msteamsConfigAdapter,
|
|
26
|
+
...require_setup_surface.msteamsConfigAdapter,
|
|
55
27
|
isConfigured: (_account, cfg) => Boolean(require_resolve_allowlist.resolveMSTeamsCredentials(cfg.channels?.msteams)),
|
|
56
28
|
describeAccount: (account) => (0, openclaw_plugin_sdk_account_helpers.describeAccountSnapshot)({
|
|
57
29
|
account,
|