@openclaw/msteams 2026.8.1-beta.3 → 2026.9.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.cjs +2 -2
- package/dist/approval-card-B6ZIMO83.cjs +303 -0
- package/dist/approval-handler.runtime-C3FXQ_6Z.cjs +107 -0
- package/dist/{channel-KpWENcgK.cjs → channel-BsqcQ0E9.cjs} +157 -46
- package/dist/channel-plugin-api.cjs +1 -1
- package/dist/{channel.runtime-Bkzj8jZ0.cjs → channel.runtime-DuQWuKFd.cjs} +17 -590
- package/dist/{channel.setup-mOFtsfYz.cjs → channel.setup-BvYxZIFG.cjs} +9 -2
- package/dist/configured-state.cjs +20 -0
- package/dist/directory-contract-api.cjs +1 -1
- package/dist/{messenger-IISPSOvj.cjs → messenger-BJB30CC2.cjs} +10 -158
- package/dist/{oauth-C9So7uld.cjs → oauth-BXQBTEta.cjs} +1 -1
- package/dist/reaction-types-dGkp4bkW.cjs +149 -0
- package/dist/{resolve-allowlist-CIfWUwuc.cjs → resolve-allowlist-B6FQAa3r.cjs} +2 -1
- package/dist/secret-input-C65t6kjM.cjs +1 -0
- package/dist/send-S0VPVSUi.cjs +627 -0
- package/dist/setup-plugin-api.cjs +1 -1
- package/dist/{src-C127-DcQ.cjs → src-NMnaP_95.cjs} +123 -14
- package/dist/thread-session-DdWfgc8U.cjs +63 -0
- package/package.json +13 -11
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
const require_resolve_allowlist = require("./resolve-allowlist-
|
|
1
|
+
const require_resolve_allowlist = require("./resolve-allowlist-B6FQAa3r.cjs");
|
|
2
|
+
require("./secret-input-C65t6kjM.cjs");
|
|
2
3
|
const require_config_schema = require("./config-schema-C4CszdDi.cjs");
|
|
3
4
|
let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
|
|
4
5
|
let openclaw_plugin_sdk_allow_from = require("openclaw/plugin-sdk/allow-from");
|
|
@@ -478,7 +479,7 @@ const msteamsSetupWizard = {
|
|
|
478
479
|
};
|
|
479
480
|
let oauthModule;
|
|
480
481
|
try {
|
|
481
|
-
oauthModule = await Promise.resolve().then(() => require("./oauth-
|
|
482
|
+
oauthModule = await Promise.resolve().then(() => require("./oauth-BXQBTEta.cjs"));
|
|
482
483
|
} catch (err) {
|
|
483
484
|
await noteDelegatedAuthFailure(err);
|
|
484
485
|
return {
|
|
@@ -602,6 +603,12 @@ Object.defineProperty(exports, "isRevokedProxyError", {
|
|
|
602
603
|
return isRevokedProxyError;
|
|
603
604
|
}
|
|
604
605
|
});
|
|
606
|
+
Object.defineProperty(exports, "msteamsConfigAdapter", {
|
|
607
|
+
enumerable: true,
|
|
608
|
+
get: function() {
|
|
609
|
+
return msteamsConfigAdapter;
|
|
610
|
+
}
|
|
611
|
+
});
|
|
605
612
|
Object.defineProperty(exports, "msteamsSetupAdapter", {
|
|
606
613
|
enumerable: true,
|
|
607
614
|
get: function() {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("./secret-input-C65t6kjM.cjs");
|
|
3
|
+
let openclaw_plugin_sdk_secret_input = require("openclaw/plugin-sdk/secret-input");
|
|
4
|
+
//#region extensions/msteams/configured-state.ts
|
|
5
|
+
/** Mirror Teams auth-mode requirements without loading the Azure SDK or full channel. */
|
|
6
|
+
function hasConfiguredMSTeamsChannelState(params) {
|
|
7
|
+
const config = params.cfg.channels?.msteams;
|
|
8
|
+
if (config?.enabled === false) return false;
|
|
9
|
+
const env = params.env ?? process.env;
|
|
10
|
+
const appId = (0, openclaw_plugin_sdk_secret_input.normalizeSecretInputString)(config && Object.hasOwn(config, "appId") ? config.appId : env.MSTEAMS_APP_ID);
|
|
11
|
+
const tenantId = (0, openclaw_plugin_sdk_secret_input.normalizeSecretInputString)(config && Object.hasOwn(config, "tenantId") ? config.tenantId : env.MSTEAMS_TENANT_ID);
|
|
12
|
+
if (!appId || !tenantId) return false;
|
|
13
|
+
if ((config?.authType ?? env.MSTEAMS_AUTH_TYPE ?? "secret") === "federated") {
|
|
14
|
+
const certificatePath = (0, openclaw_plugin_sdk_secret_input.normalizeSecretInputString)(config && Object.hasOwn(config, "certificatePath") ? config.certificatePath : env.MSTEAMS_CERTIFICATE_PATH);
|
|
15
|
+
return Boolean(certificatePath || (config?.useManagedIdentity ?? env.MSTEAMS_USE_MANAGED_IDENTITY === "true"));
|
|
16
|
+
}
|
|
17
|
+
return config && Object.hasOwn(config, "appPassword") ? (0, openclaw_plugin_sdk_secret_input.hasConfiguredSecretInput)(config.appPassword) : Boolean((0, openclaw_plugin_sdk_secret_input.normalizeSecretInputString)(env.MSTEAMS_APP_PASSWORD));
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
exports.hasConfiguredMSTeamsChannelState = hasConfiguredMSTeamsChannelState;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_resolve_allowlist = require("./resolve-allowlist-
|
|
2
|
+
const require_resolve_allowlist = require("./resolve-allowlist-B6FQAa3r.cjs");
|
|
3
3
|
let openclaw_plugin_sdk_directory_runtime = require("openclaw/plugin-sdk/directory-runtime");
|
|
4
4
|
const msteamsDirectoryContractPlugin = {
|
|
5
5
|
id: "msteams",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-D6vf50IK.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_channel_setup = require("./channel.setup-
|
|
4
|
+
const require_resolve_allowlist = require("./resolve-allowlist-B6FQAa3r.cjs");
|
|
5
|
+
const require_channel_setup = require("./channel.setup-BvYxZIFG.cjs");
|
|
6
6
|
const require_polls = require("./polls-DvuJvaDG.cjs");
|
|
7
7
|
let openclaw_plugin_sdk_lazy_runtime = require("openclaw/plugin-sdk/lazy-runtime");
|
|
8
8
|
let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
|
|
@@ -12,123 +12,17 @@ let openclaw_plugin_sdk_text_chunking = require("openclaw/plugin-sdk/text-chunki
|
|
|
12
12
|
let node_dns_promises = require("node:dns/promises");
|
|
13
13
|
let openclaw_plugin_sdk_ssrf_policy = require("openclaw/plugin-sdk/ssrf-policy");
|
|
14
14
|
let openclaw_plugin_sdk_text_utility_runtime = require("openclaw/plugin-sdk/text-utility-runtime");
|
|
15
|
-
let openclaw_plugin_sdk_html_entity_runtime = require("openclaw/plugin-sdk/html-entity-runtime");
|
|
16
15
|
let openclaw_plugin_sdk_retry_runtime = require("openclaw/plugin-sdk/retry-runtime");
|
|
17
16
|
let node_crypto = require("node:crypto");
|
|
18
17
|
node_crypto = require_rolldown_runtime.__toESM(node_crypto, 1);
|
|
19
18
|
let node_path = require("node:path");
|
|
20
19
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
20
|
+
let openclaw_plugin_sdk_runtime_env = require("openclaw/plugin-sdk/runtime-env");
|
|
21
21
|
let openclaw_plugin_sdk_global_singleton = require("openclaw/plugin-sdk/global-singleton");
|
|
22
22
|
let openclaw_plugin_sdk_error_runtime = require("openclaw/plugin-sdk/error-runtime");
|
|
23
23
|
let openclaw_plugin_sdk_reply_chunking = require("openclaw/plugin-sdk/reply-chunking");
|
|
24
|
-
let openclaw_plugin_sdk_runtime_env = require("openclaw/plugin-sdk/runtime-env");
|
|
25
24
|
let openclaw_plugin_sdk_web_media = require("openclaw/plugin-sdk/web-media");
|
|
26
25
|
let openclaw_plugin_sdk_media_runtime = require("openclaw/plugin-sdk/media-runtime");
|
|
27
|
-
//#region extensions/msteams/src/graph-thread.ts
|
|
28
|
-
/**
|
|
29
|
-
* Strip HTML tags from Teams message content, preserving @mention display names.
|
|
30
|
-
* Teams wraps mentions in <at>Name</at> tags.
|
|
31
|
-
*/
|
|
32
|
-
function stripHtmlFromTeamsMessage(html) {
|
|
33
|
-
let text = html.replace(/<at[^>]*>(.*?)<\/at>/gi, "@$1");
|
|
34
|
-
text = text.replace(/<[^>]*>/g, " ");
|
|
35
|
-
text = (0, openclaw_plugin_sdk_html_entity_runtime.decodeHtmlEntities)(text).replaceAll("\xA0", " ");
|
|
36
|
-
return text.replace(/\s+/g, " ").trim();
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Fetch a single channel message (the parent/root of a thread).
|
|
40
|
-
* Returns undefined on error so callers can degrade gracefully.
|
|
41
|
-
*/
|
|
42
|
-
async function fetchChannelMessage(token, groupId, channelId, messageId, deadline) {
|
|
43
|
-
const path = `/teams/${encodeURIComponent(groupId)}/channels/${encodeURIComponent(channelId)}/messages/${encodeURIComponent(messageId)}?$select=id,from,body,createdDateTime`;
|
|
44
|
-
try {
|
|
45
|
-
return await require_resolve_allowlist.fetchGraphJson({
|
|
46
|
-
token,
|
|
47
|
-
path,
|
|
48
|
-
...deadline ? { deadline } : {}
|
|
49
|
-
});
|
|
50
|
-
} catch {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Fetch a single chat message's full text via Graph and return plain text.
|
|
56
|
-
*
|
|
57
|
-
* Used to recover the complete quoted message for Teams quote replies: the
|
|
58
|
-
* inbound blockquote only carries a Teams-truncated `preview` snippet. The
|
|
59
|
-
* app-only `GET /chats/{chatId}/messages/{messageId}` endpoint IS permitted
|
|
60
|
-
* with the `Chat.Read.All` application permission.
|
|
61
|
-
*
|
|
62
|
-
* Returns undefined on any failure so callers degrade to the truncated preview.
|
|
63
|
-
*/
|
|
64
|
-
async function fetchChatMessageText(token, chatId, messageId, deadline) {
|
|
65
|
-
const path = `/chats/${encodeURIComponent(chatId)}/messages/${encodeURIComponent(messageId)}`;
|
|
66
|
-
try {
|
|
67
|
-
const msg = await require_resolve_allowlist.fetchGraphJson({
|
|
68
|
-
token,
|
|
69
|
-
path,
|
|
70
|
-
...deadline ? { deadline } : {}
|
|
71
|
-
});
|
|
72
|
-
const raw = msg.body?.content ?? "";
|
|
73
|
-
return (msg.body?.contentType === "html" ? stripHtmlFromTeamsMessage(raw) : raw.trim()) || void 0;
|
|
74
|
-
} catch {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Fetch thread replies for a channel message, ordered chronologically.
|
|
80
|
-
*
|
|
81
|
-
* **Limitation:** The Graph API replies endpoint (`/messages/{id}/replies`) does not
|
|
82
|
-
* support `$orderby`, so results are always returned in ascending (oldest-first) order.
|
|
83
|
-
* Combined with the `$top` cap of 50, this means only the **oldest 50 replies** are
|
|
84
|
-
* returned for long threads — newer replies are silently omitted. There is currently no
|
|
85
|
-
* Graph API workaround for this; pagination via `@odata.nextLink` can retrieve more
|
|
86
|
-
* replies but still in ascending order only.
|
|
87
|
-
*/
|
|
88
|
-
async function fetchThreadReplies(token, groupId, channelId, messageId, limit = 50, deadline) {
|
|
89
|
-
return (await require_resolve_allowlist.fetchGraphJson({
|
|
90
|
-
token,
|
|
91
|
-
path: `/teams/${encodeURIComponent(groupId)}/channels/${encodeURIComponent(channelId)}/messages/${encodeURIComponent(messageId)}/replies?$top=${Math.min(Math.max(limit, 1), 50)}&$select=id,from,body,createdDateTime`,
|
|
92
|
-
...deadline ? { deadline } : {}
|
|
93
|
-
})).value ?? [];
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Format thread messages into a context string for the agent.
|
|
97
|
-
* Skips the current message (by id) and blank messages.
|
|
98
|
-
*/
|
|
99
|
-
function formatThreadContext(messages, currentMessageId) {
|
|
100
|
-
const lines = [];
|
|
101
|
-
for (const msg of messages) {
|
|
102
|
-
if (msg.id && msg.id === currentMessageId) continue;
|
|
103
|
-
const sender = msg.from?.user?.displayName ?? msg.from?.application?.displayName ?? "unknown";
|
|
104
|
-
const contentType = msg.body?.contentType ?? "text";
|
|
105
|
-
const rawContent = msg.body?.content ?? "";
|
|
106
|
-
const content = contentType === "html" ? stripHtmlFromTeamsMessage(rawContent) : rawContent.trim();
|
|
107
|
-
if (!content) continue;
|
|
108
|
-
lines.push(`${sender}: ${content}`);
|
|
109
|
-
}
|
|
110
|
-
return lines.join("\n");
|
|
111
|
-
}
|
|
112
|
-
//#endregion
|
|
113
|
-
//#region extensions/msteams/src/reaction-types.ts
|
|
114
|
-
const TEAMS_REACTION_EMOJI = {
|
|
115
|
-
like: "👍",
|
|
116
|
-
heart: "❤️",
|
|
117
|
-
laugh: "😆",
|
|
118
|
-
surprised: "😮",
|
|
119
|
-
sad: "😢",
|
|
120
|
-
angry: "😡"
|
|
121
|
-
};
|
|
122
|
-
const TEAMS_REACTION_TYPES = Object.keys(TEAMS_REACTION_EMOJI);
|
|
123
|
-
function getMSTeamsReactionEmoji(raw) {
|
|
124
|
-
return TEAMS_REACTION_EMOJI[raw.trim().toLowerCase()];
|
|
125
|
-
}
|
|
126
|
-
function resolveMSTeamsReactionEmoji(raw) {
|
|
127
|
-
const normalized = raw.trim();
|
|
128
|
-
if (!normalized) throw new Error(`Reaction type is required. Common types: ${TEAMS_REACTION_TYPES.join(", ")}`);
|
|
129
|
-
return getMSTeamsReactionEmoji(normalized) ?? normalized;
|
|
130
|
-
}
|
|
131
|
-
//#endregion
|
|
132
26
|
//#region extensions/msteams/src/file-consent.ts
|
|
133
27
|
/**
|
|
134
28
|
* FileConsentCard utilities for MS Teams large file uploads (>4MB) in personal chats.
|
|
@@ -1394,10 +1288,9 @@ async function withRevokedProxyFallback(params) {
|
|
|
1394
1288
|
}
|
|
1395
1289
|
//#endregion
|
|
1396
1290
|
//#region extensions/msteams/src/sdk-proactive.ts
|
|
1397
|
-
const
|
|
1398
|
-
const loadMSTeamsQuoteModule = (0, openclaw_plugin_sdk_lazy_runtime.createLazyRuntimeModule)(() => import("@microsoft/teams.api/dist/activities/message/message.js").then((message) => ({ MessageActivityInput: message.MessageActivityInput })));
|
|
1291
|
+
const loadMSTeamsApiModule = (0, openclaw_plugin_sdk_lazy_runtime.createLazyRuntimeModule)(() => import("@microsoft/teams.api"));
|
|
1399
1292
|
async function quoteMSTeamsActivity(activity, messageId) {
|
|
1400
|
-
const { MessageActivityInput } = await
|
|
1293
|
+
const { MessageActivityInput } = await loadMSTeamsApiModule();
|
|
1401
1294
|
if (typeof activity === "string") return new MessageActivityInput(activity).prependQuote(messageId);
|
|
1402
1295
|
if (activity.type !== "message") return activity;
|
|
1403
1296
|
return MessageActivityInput.from(activity).prependQuote(messageId);
|
|
@@ -1466,7 +1359,7 @@ async function getApiClientForReference(app, ref) {
|
|
|
1466
1359
|
const appInternals = app;
|
|
1467
1360
|
const httpClient = appInternals.api?.http ?? appInternals.client;
|
|
1468
1361
|
if (!httpClient) return api;
|
|
1469
|
-
const { Client } = await
|
|
1362
|
+
const { Client } = await loadMSTeamsApiModule();
|
|
1470
1363
|
return new Client(ref.serviceUrl, httpClient);
|
|
1471
1364
|
}
|
|
1472
1365
|
function mergeReferenceIntoActivity(activity, ref) {
|
|
@@ -1747,13 +1640,14 @@ async function sendMSTeamsMessages(params) {
|
|
|
1747
1640
|
};
|
|
1748
1641
|
let providerDispatchStarted = false;
|
|
1749
1642
|
const sendMessageInContext = async (sendFn, message, messageIndex) => {
|
|
1643
|
+
let activity;
|
|
1750
1644
|
let pendingUploadId;
|
|
1751
1645
|
let response;
|
|
1752
1646
|
try {
|
|
1753
1647
|
response = await sendWithRetry(async () => {
|
|
1754
|
-
|
|
1755
|
-
pendingUploadId
|
|
1756
|
-
|
|
1648
|
+
activity ??= await buildActivity(message, params.conversationRef, params.tokenProvider, params.sharePointSiteId, params.mediaMaxBytes, { feedbackLoopEnabled: params.feedbackLoopEnabled });
|
|
1649
|
+
pendingUploadId ??= typeof activity["_pendingUploadId"] === "string" ? activity["_pendingUploadId"] : void 0;
|
|
1650
|
+
delete activity["_pendingUploadId"];
|
|
1757
1651
|
providerDispatchStarted = true;
|
|
1758
1652
|
return await sendFn(activity);
|
|
1759
1653
|
}, {
|
|
@@ -1852,48 +1746,18 @@ Object.defineProperty(exports, "extractMessageId", {
|
|
|
1852
1746
|
return extractMessageId;
|
|
1853
1747
|
}
|
|
1854
1748
|
});
|
|
1855
|
-
Object.defineProperty(exports, "fetchChannelMessage", {
|
|
1856
|
-
enumerable: true,
|
|
1857
|
-
get: function() {
|
|
1858
|
-
return fetchChannelMessage;
|
|
1859
|
-
}
|
|
1860
|
-
});
|
|
1861
|
-
Object.defineProperty(exports, "fetchChatMessageText", {
|
|
1862
|
-
enumerable: true,
|
|
1863
|
-
get: function() {
|
|
1864
|
-
return fetchChatMessageText;
|
|
1865
|
-
}
|
|
1866
|
-
});
|
|
1867
|
-
Object.defineProperty(exports, "fetchThreadReplies", {
|
|
1868
|
-
enumerable: true,
|
|
1869
|
-
get: function() {
|
|
1870
|
-
return fetchThreadReplies;
|
|
1871
|
-
}
|
|
1872
|
-
});
|
|
1873
1749
|
Object.defineProperty(exports, "formatMSTeamsMarkdown", {
|
|
1874
1750
|
enumerable: true,
|
|
1875
1751
|
get: function() {
|
|
1876
1752
|
return formatMSTeamsMarkdown;
|
|
1877
1753
|
}
|
|
1878
1754
|
});
|
|
1879
|
-
Object.defineProperty(exports, "formatThreadContext", {
|
|
1880
|
-
enumerable: true,
|
|
1881
|
-
get: function() {
|
|
1882
|
-
return formatThreadContext;
|
|
1883
|
-
}
|
|
1884
|
-
});
|
|
1885
1755
|
Object.defineProperty(exports, "getDriveItemProperties", {
|
|
1886
1756
|
enumerable: true,
|
|
1887
1757
|
get: function() {
|
|
1888
1758
|
return getDriveItemProperties;
|
|
1889
1759
|
}
|
|
1890
1760
|
});
|
|
1891
|
-
Object.defineProperty(exports, "getMSTeamsReactionEmoji", {
|
|
1892
|
-
enumerable: true,
|
|
1893
|
-
get: function() {
|
|
1894
|
-
return getMSTeamsReactionEmoji;
|
|
1895
|
-
}
|
|
1896
|
-
});
|
|
1897
1761
|
Object.defineProperty(exports, "getPendingUpload", {
|
|
1898
1762
|
enumerable: true,
|
|
1899
1763
|
get: function() {
|
|
@@ -1948,12 +1812,6 @@ Object.defineProperty(exports, "requiresFileConsent", {
|
|
|
1948
1812
|
return requiresFileConsent;
|
|
1949
1813
|
}
|
|
1950
1814
|
});
|
|
1951
|
-
Object.defineProperty(exports, "resolveMSTeamsReactionEmoji", {
|
|
1952
|
-
enumerable: true,
|
|
1953
|
-
get: function() {
|
|
1954
|
-
return resolveMSTeamsReactionEmoji;
|
|
1955
|
-
}
|
|
1956
|
-
});
|
|
1957
1815
|
Object.defineProperty(exports, "sendMSTeamsActivityWithReference", {
|
|
1958
1816
|
enumerable: true,
|
|
1959
1817
|
get: function() {
|
|
@@ -1978,12 +1836,6 @@ Object.defineProperty(exports, "setPendingUploadActivityIdFs", {
|
|
|
1978
1836
|
return setPendingUploadActivityIdFs;
|
|
1979
1837
|
}
|
|
1980
1838
|
});
|
|
1981
|
-
Object.defineProperty(exports, "stripHtmlFromTeamsMessage", {
|
|
1982
|
-
enumerable: true,
|
|
1983
|
-
get: function() {
|
|
1984
|
-
return stripHtmlFromTeamsMessage;
|
|
1985
|
-
}
|
|
1986
|
-
});
|
|
1987
1839
|
Object.defineProperty(exports, "updateMSTeamsActivityWithReference", {
|
|
1988
1840
|
enumerable: true,
|
|
1989
1841
|
get: function() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_resolve_allowlist = require("./resolve-allowlist-
|
|
1
|
+
const require_resolve_allowlist = require("./resolve-allowlist-B6FQAa3r.cjs");
|
|
2
2
|
let openclaw_plugin_sdk_runtime_env = require("openclaw/plugin-sdk/runtime-env");
|
|
3
3
|
let openclaw_plugin_sdk_provider_auth = require("openclaw/plugin-sdk/provider-auth");
|
|
4
4
|
let openclaw_plugin_sdk_provider_auth_runtime = require("openclaw/plugin-sdk/provider-auth-runtime");
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
const require_resolve_allowlist = require("./resolve-allowlist-B6FQAa3r.cjs");
|
|
2
|
+
let openclaw_plugin_sdk_html_entity_runtime = require("openclaw/plugin-sdk/html-entity-runtime");
|
|
3
|
+
//#region extensions/msteams/src/graph-thread.ts
|
|
4
|
+
/**
|
|
5
|
+
* Strip HTML tags from Teams message content, preserving @mention display names.
|
|
6
|
+
* Teams wraps mentions in <at>Name</at> tags.
|
|
7
|
+
*/
|
|
8
|
+
function stripHtmlFromTeamsMessage(html) {
|
|
9
|
+
let text = html.replace(/<at[^>]*>(.*?)<\/at>/gi, "@$1");
|
|
10
|
+
text = text.replace(/<[^>]*>/g, " ");
|
|
11
|
+
text = (0, openclaw_plugin_sdk_html_entity_runtime.decodeHtmlEntities)(text).replaceAll("\xA0", " ");
|
|
12
|
+
return text.replace(/\s+/g, " ").trim();
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Fetch a single channel message (the parent/root of a thread).
|
|
16
|
+
* Returns undefined on error so callers can degrade gracefully.
|
|
17
|
+
*/
|
|
18
|
+
async function fetchChannelMessage(token, groupId, channelId, messageId, deadline) {
|
|
19
|
+
const path = `/teams/${encodeURIComponent(groupId)}/channels/${encodeURIComponent(channelId)}/messages/${encodeURIComponent(messageId)}`;
|
|
20
|
+
try {
|
|
21
|
+
return await require_resolve_allowlist.fetchGraphJson({
|
|
22
|
+
token,
|
|
23
|
+
path,
|
|
24
|
+
...deadline ? { deadline } : {}
|
|
25
|
+
});
|
|
26
|
+
} catch {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Fetch a single chat message's full text via Graph and return plain text.
|
|
32
|
+
*
|
|
33
|
+
* Used to recover the complete quoted message for Teams quote replies: the
|
|
34
|
+
* inbound blockquote only carries a Teams-truncated `preview` snippet. The
|
|
35
|
+
* app-only `GET /chats/{chatId}/messages/{messageId}` endpoint IS permitted
|
|
36
|
+
* with the `Chat.Read.All` application permission.
|
|
37
|
+
*
|
|
38
|
+
* Returns undefined on any failure so callers degrade to the truncated preview.
|
|
39
|
+
*/
|
|
40
|
+
async function fetchChatMessageText(token, chatId, messageId, deadline) {
|
|
41
|
+
const path = `/chats/${encodeURIComponent(chatId)}/messages/${encodeURIComponent(messageId)}`;
|
|
42
|
+
try {
|
|
43
|
+
const msg = await require_resolve_allowlist.fetchGraphJson({
|
|
44
|
+
token,
|
|
45
|
+
path,
|
|
46
|
+
...deadline ? { deadline } : {}
|
|
47
|
+
});
|
|
48
|
+
const raw = msg.body?.content ?? "";
|
|
49
|
+
return (msg.body?.contentType === "html" ? stripHtmlFromTeamsMessage(raw) : raw.trim()) || void 0;
|
|
50
|
+
} catch {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Fetch thread replies for a channel message, ordered chronologically.
|
|
56
|
+
*
|
|
57
|
+
* **Limitation:** The Graph API replies endpoint (`/messages/{id}/replies`) does not
|
|
58
|
+
* support `$orderby`, so results are always returned in ascending (oldest-first) order.
|
|
59
|
+
* Combined with the `$top` cap of 50, this means only the **oldest 50 replies** are
|
|
60
|
+
* returned for long threads — newer replies are silently omitted. There is currently no
|
|
61
|
+
* Graph API workaround for this; pagination via `@odata.nextLink` can retrieve more
|
|
62
|
+
* replies but still in ascending order only.
|
|
63
|
+
*/
|
|
64
|
+
async function fetchThreadReplies(token, groupId, channelId, messageId, limit = 50, deadline) {
|
|
65
|
+
return (await require_resolve_allowlist.fetchGraphJson({
|
|
66
|
+
token,
|
|
67
|
+
path: `/teams/${encodeURIComponent(groupId)}/channels/${encodeURIComponent(channelId)}/messages/${encodeURIComponent(messageId)}/replies?$top=${Math.min(Math.max(limit, 1), 50)}`,
|
|
68
|
+
...deadline ? { deadline } : {}
|
|
69
|
+
})).value ?? [];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Format thread messages into a context string for the agent.
|
|
73
|
+
* Skips the current message (by id) and blank messages.
|
|
74
|
+
*/
|
|
75
|
+
function formatThreadContext(messages, currentMessageId) {
|
|
76
|
+
const lines = [];
|
|
77
|
+
for (const msg of messages) {
|
|
78
|
+
if (msg.id && msg.id === currentMessageId) continue;
|
|
79
|
+
const sender = msg.from?.user?.displayName ?? msg.from?.application?.displayName ?? "unknown";
|
|
80
|
+
const contentType = msg.body?.contentType ?? "text";
|
|
81
|
+
const rawContent = msg.body?.content ?? "";
|
|
82
|
+
const content = contentType === "html" ? stripHtmlFromTeamsMessage(rawContent) : rawContent.trim();
|
|
83
|
+
if (!content) continue;
|
|
84
|
+
lines.push(`${sender}: ${content}`);
|
|
85
|
+
}
|
|
86
|
+
return lines.join("\n");
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region extensions/msteams/src/reaction-types.ts
|
|
90
|
+
const TEAMS_REACTION_EMOJI = {
|
|
91
|
+
like: "👍",
|
|
92
|
+
heart: "❤️",
|
|
93
|
+
laugh: "😆",
|
|
94
|
+
surprised: "😮",
|
|
95
|
+
sad: "😢",
|
|
96
|
+
angry: "😡"
|
|
97
|
+
};
|
|
98
|
+
const TEAMS_REACTION_TYPES = Object.keys(TEAMS_REACTION_EMOJI);
|
|
99
|
+
function getMSTeamsReactionEmoji(raw) {
|
|
100
|
+
return TEAMS_REACTION_EMOJI[raw.trim().toLowerCase()];
|
|
101
|
+
}
|
|
102
|
+
function resolveMSTeamsReactionEmoji(raw) {
|
|
103
|
+
const normalized = raw.trim();
|
|
104
|
+
if (!normalized) throw new Error(`Reaction type is required. Common types: ${TEAMS_REACTION_TYPES.join(", ")}`);
|
|
105
|
+
return getMSTeamsReactionEmoji(normalized) ?? normalized;
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
108
|
+
Object.defineProperty(exports, "fetchChannelMessage", {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
get: function() {
|
|
111
|
+
return fetchChannelMessage;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
Object.defineProperty(exports, "fetchChatMessageText", {
|
|
115
|
+
enumerable: true,
|
|
116
|
+
get: function() {
|
|
117
|
+
return fetchChatMessageText;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
Object.defineProperty(exports, "fetchThreadReplies", {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function() {
|
|
123
|
+
return fetchThreadReplies;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
Object.defineProperty(exports, "formatThreadContext", {
|
|
127
|
+
enumerable: true,
|
|
128
|
+
get: function() {
|
|
129
|
+
return formatThreadContext;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
Object.defineProperty(exports, "getMSTeamsReactionEmoji", {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
get: function() {
|
|
135
|
+
return getMSTeamsReactionEmoji;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
Object.defineProperty(exports, "resolveMSTeamsReactionEmoji", {
|
|
139
|
+
enumerable: true,
|
|
140
|
+
get: function() {
|
|
141
|
+
return resolveMSTeamsReactionEmoji;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
Object.defineProperty(exports, "stripHtmlFromTeamsMessage", {
|
|
145
|
+
enumerable: true,
|
|
146
|
+
get: function() {
|
|
147
|
+
return stripHtmlFromTeamsMessage;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const require_runtime = require("./runtime-gZTAuFux.cjs");
|
|
2
2
|
require("./runtime-api.cjs");
|
|
3
3
|
const require_delegated_state = require("./delegated-state-DiEz9JIa.cjs");
|
|
4
|
+
require("./secret-input-C65t6kjM.cjs");
|
|
4
5
|
let openclaw_plugin_sdk_lazy_runtime = require("openclaw/plugin-sdk/lazy-runtime");
|
|
5
6
|
let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
|
|
6
7
|
let openclaw_plugin_sdk_allow_from = require("openclaw/plugin-sdk/allow-from");
|
|
@@ -14,8 +15,8 @@ let openclaw_plugin_sdk_number_runtime = require("openclaw/plugin-sdk/number-run
|
|
|
14
15
|
let openclaw_plugin_sdk_text_utility_runtime = require("openclaw/plugin-sdk/text-utility-runtime");
|
|
15
16
|
let openclaw_plugin_sdk_secret_file = require("openclaw/plugin-sdk/secret-file");
|
|
16
17
|
let node_module = require("node:module");
|
|
17
|
-
let openclaw_plugin_sdk_secret_input = require("openclaw/plugin-sdk/secret-input");
|
|
18
18
|
let openclaw_plugin_sdk_html_entity_runtime = require("openclaw/plugin-sdk/html-entity-runtime");
|
|
19
|
+
let openclaw_plugin_sdk_secret_input = require("openclaw/plugin-sdk/secret-input");
|
|
19
20
|
//#region extensions/msteams/src/request-timeout.ts
|
|
20
21
|
const MSTEAMS_REQUEST_TIMEOUT_MS = 3e4;
|
|
21
22
|
const MSTEAMS_SHAREPOINT_UPLOAD_BASE_TIMEOUT_MS = 5 * 6e4;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require("openclaw/plugin-sdk/secret-input");
|