@openclaw/msteams 2026.8.1-beta.2 → 2026.8.1-beta.3
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/{adapter.runtime-DEYjslFX.cjs → adapter.runtime-8g-MOPfb.cjs} +4 -2
- package/dist/api.cjs +6 -6
- package/dist/{channel-DfCbi0d_.cjs → channel-KpWENcgK.cjs} +21 -64
- package/dist/channel-plugin-api.cjs +1 -1
- package/dist/{channel.runtime-BJmueA4q.cjs → channel.runtime-Bkzj8jZ0.cjs} +45 -32
- package/dist/{setup-surface-DAhGL2h8.cjs → channel.setup-mOFtsfYz.cjs} +88 -42
- package/dist/directory-contract-api.cjs +1 -1
- package/dist/{messenger-BqA8G3pY.cjs → messenger-IISPSOvj.cjs} +46 -40
- package/dist/{oauth-DktsbN22.cjs → oauth-C9So7uld.cjs} +2 -2
- package/dist/qa-runner-api.cjs +1 -1
- package/dist/{resolve-allowlist-C6YcNC9a.cjs → resolve-allowlist-CIfWUwuc.cjs} +70 -68
- package/dist/runtime-api.cjs +1 -1
- package/dist/setup-plugin-api.cjs +2 -36
- package/dist/{src-Bz9wY0Mr.cjs → src-C127-DcQ.cjs} +102 -96
- package/package.json +4 -4
|
@@ -1,25 +1,27 @@
|
|
|
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
|
|
4
|
+
const require_resolve_allowlist = require("./resolve-allowlist-CIfWUwuc.cjs");
|
|
5
|
+
const require_channel_setup = require("./channel.setup-mOFtsfYz.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");
|
|
9
|
+
let openclaw_plugin_sdk_provider_http = require("openclaw/plugin-sdk/provider-http");
|
|
9
10
|
let openclaw_plugin_sdk_reply_payload = require("openclaw/plugin-sdk/reply-payload");
|
|
10
11
|
let openclaw_plugin_sdk_text_chunking = require("openclaw/plugin-sdk/text-chunking");
|
|
11
|
-
let openclaw_plugin_sdk_html_entity_runtime = require("openclaw/plugin-sdk/html-entity-runtime");
|
|
12
|
-
let openclaw_plugin_sdk_provider_http = require("openclaw/plugin-sdk/provider-http");
|
|
13
12
|
let node_dns_promises = require("node:dns/promises");
|
|
14
13
|
let openclaw_plugin_sdk_ssrf_policy = require("openclaw/plugin-sdk/ssrf-policy");
|
|
15
14
|
let openclaw_plugin_sdk_text_utility_runtime = require("openclaw/plugin-sdk/text-utility-runtime");
|
|
16
|
-
let
|
|
15
|
+
let openclaw_plugin_sdk_html_entity_runtime = require("openclaw/plugin-sdk/html-entity-runtime");
|
|
16
|
+
let openclaw_plugin_sdk_retry_runtime = require("openclaw/plugin-sdk/retry-runtime");
|
|
17
17
|
let node_crypto = require("node:crypto");
|
|
18
18
|
node_crypto = require_rolldown_runtime.__toESM(node_crypto, 1);
|
|
19
19
|
let node_path = require("node:path");
|
|
20
20
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
21
21
|
let openclaw_plugin_sdk_global_singleton = require("openclaw/plugin-sdk/global-singleton");
|
|
22
|
+
let openclaw_plugin_sdk_error_runtime = require("openclaw/plugin-sdk/error-runtime");
|
|
22
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");
|
|
23
25
|
let openclaw_plugin_sdk_web_media = require("openclaw/plugin-sdk/web-media");
|
|
24
26
|
let openclaw_plugin_sdk_media_runtime = require("openclaw/plugin-sdk/media-runtime");
|
|
25
27
|
//#region extensions/msteams/src/graph-thread.ts
|
|
@@ -1323,6 +1325,15 @@ function extractMessageId(response) {
|
|
|
1323
1325
|
return id;
|
|
1324
1326
|
}
|
|
1325
1327
|
//#endregion
|
|
1328
|
+
//#region extensions/msteams/src/ai-entity.ts
|
|
1329
|
+
/** AI-generated content entity added to every outbound AI message. */
|
|
1330
|
+
const AI_GENERATED_ENTITY = {
|
|
1331
|
+
type: "https://schema.org/Message",
|
|
1332
|
+
"@type": "Message",
|
|
1333
|
+
"@id": "",
|
|
1334
|
+
additionalType: ["AIGeneratedContent"]
|
|
1335
|
+
};
|
|
1336
|
+
//#endregion
|
|
1326
1337
|
//#region extensions/msteams/src/mentions.ts
|
|
1327
1338
|
/**
|
|
1328
1339
|
* Check whether an ID looks like a valid Teams user/bot identifier.
|
|
@@ -1376,14 +1387,21 @@ async function withRevokedProxyFallback(params) {
|
|
|
1376
1387
|
try {
|
|
1377
1388
|
return await params.run();
|
|
1378
1389
|
} catch (err) {
|
|
1379
|
-
if (!
|
|
1390
|
+
if (!require_channel_setup.isRevokedProxyError(err)) throw err;
|
|
1380
1391
|
params.onRevokedLog?.();
|
|
1381
1392
|
return await params.onRevoked();
|
|
1382
1393
|
}
|
|
1383
1394
|
}
|
|
1384
1395
|
//#endregion
|
|
1385
1396
|
//#region extensions/msteams/src/sdk-proactive.ts
|
|
1386
|
-
const
|
|
1397
|
+
const loadMSTeamsApiClient = (0, openclaw_plugin_sdk_lazy_runtime.createLazyRuntimeModule)(() => import("@microsoft/teams.api").then((api) => ({ Client: api.Client })));
|
|
1398
|
+
const loadMSTeamsQuoteModule = (0, openclaw_plugin_sdk_lazy_runtime.createLazyRuntimeModule)(() => import("@microsoft/teams.api/dist/activities/message/message.js").then((message) => ({ MessageActivityInput: message.MessageActivityInput })));
|
|
1399
|
+
async function quoteMSTeamsActivity(activity, messageId) {
|
|
1400
|
+
const { MessageActivityInput } = await loadMSTeamsQuoteModule();
|
|
1401
|
+
if (typeof activity === "string") return new MessageActivityInput(activity).prependQuote(messageId);
|
|
1402
|
+
if (activity.type !== "message") return activity;
|
|
1403
|
+
return MessageActivityInput.from(activity).prependQuote(messageId);
|
|
1404
|
+
}
|
|
1387
1405
|
function resolveThreadedConversationId(conversationId, threadActivityId) {
|
|
1388
1406
|
if (!threadActivityId) return conversationId.split(";")[0] ?? conversationId;
|
|
1389
1407
|
return `${conversationId.split(";")[0] ?? conversationId};messageid=${threadActivityId}`;
|
|
@@ -1448,7 +1466,7 @@ async function getApiClientForReference(app, ref) {
|
|
|
1448
1466
|
const appInternals = app;
|
|
1449
1467
|
const httpClient = appInternals.api?.http ?? appInternals.client;
|
|
1450
1468
|
if (!httpClient) return api;
|
|
1451
|
-
const { Client } = await
|
|
1469
|
+
const { Client } = await loadMSTeamsApiClient();
|
|
1452
1470
|
return new Client(ref.serviceUrl, httpClient);
|
|
1453
1471
|
}
|
|
1454
1472
|
function mergeReferenceIntoActivity(activity, ref) {
|
|
@@ -1481,7 +1499,7 @@ function mergeReferenceIntoActivity(activity, ref) {
|
|
|
1481
1499
|
async function sendMSTeamsActivityWithReference(app, source, activity, options) {
|
|
1482
1500
|
const ref = buildSdkConversationReference(source, options);
|
|
1483
1501
|
const activities = (await getApiClientForReference(app, ref)).conversations.activities(ref.conversation.id);
|
|
1484
|
-
const activityWithRef = mergeReferenceIntoActivity(activity, ref);
|
|
1502
|
+
const activityWithRef = mergeReferenceIntoActivity(options?.quoteActivityId ? await quoteMSTeamsActivity(activity, options.quoteActivityId) : activity, ref);
|
|
1485
1503
|
const isTargeted = activityWithRef.recipient?.isTargeted === true;
|
|
1486
1504
|
if (isTargeted && ref.conversation.conversationType === "personal") throw new Error("Targeted messages are not supported in 1:1 (personal) chats.");
|
|
1487
1505
|
const activityId = typeof activityWithRef.id === "string" ? activityWithRef.id : void 0;
|
|
@@ -1507,15 +1525,6 @@ async function deleteMSTeamsActivityWithReference(app, source, activityId, optio
|
|
|
1507
1525
|
return (await getApiClientForReference(app, ref)).conversations.activities(ref.conversation.id).delete(activityId);
|
|
1508
1526
|
}
|
|
1509
1527
|
//#endregion
|
|
1510
|
-
//#region extensions/msteams/src/ai-entity.ts
|
|
1511
|
-
/** AI-generated content entity added to every outbound AI message. */
|
|
1512
|
-
const AI_GENERATED_ENTITY = {
|
|
1513
|
-
type: "https://schema.org/Message",
|
|
1514
|
-
"@type": "Message",
|
|
1515
|
-
"@id": "",
|
|
1516
|
-
additionalType: ["AIGeneratedContent"]
|
|
1517
|
-
};
|
|
1518
|
-
//#endregion
|
|
1519
1528
|
//#region extensions/msteams/src/messenger.ts
|
|
1520
1529
|
/**
|
|
1521
1530
|
* MSTeams-specific media size limit (100MB).
|
|
@@ -1591,12 +1600,9 @@ function resolveRetryOptions(retry) {
|
|
|
1591
1600
|
};
|
|
1592
1601
|
}
|
|
1593
1602
|
function computeRetryDelayMs(attempt, classification, opts) {
|
|
1594
|
-
if (classification.retryAfterMs != null) return clampMs(classification.retryAfterMs, opts.maxDelayMs);
|
|
1603
|
+
if (classification.kind === "replay-safe" && classification.retryAfterMs != null) return clampMs(classification.retryAfterMs, opts.maxDelayMs);
|
|
1595
1604
|
return clampMs(opts.baseDelayMs * 2 ** Math.max(0, attempt - 1), opts.maxDelayMs);
|
|
1596
1605
|
}
|
|
1597
|
-
function shouldRetry(classification) {
|
|
1598
|
-
return classification.kind === "throttled" || classification.kind === "transient";
|
|
1599
|
-
}
|
|
1600
1606
|
function renderReplyPayloadsToMessages(replies, options) {
|
|
1601
1607
|
const out = [];
|
|
1602
1608
|
const chunkLimit = Math.min(options.textChunkLimit, 4e3);
|
|
@@ -1720,24 +1726,24 @@ async function sendMSTeamsMessages(params) {
|
|
|
1720
1726
|
const retryOptions = resolveRetryOptions(params.retry);
|
|
1721
1727
|
const sendWithRetry = async (sendOnce, meta) => {
|
|
1722
1728
|
if (!retryOptions.enabled) return await sendOnce();
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1729
|
+
return await (0, openclaw_plugin_sdk_retry_runtime.retryAsync)(sendOnce, {
|
|
1730
|
+
attempts: retryOptions.maxAttempts,
|
|
1731
|
+
minDelayMs: 0,
|
|
1732
|
+
maxDelayMs: retryOptions.maxDelayMs,
|
|
1733
|
+
shouldRetry: (err) => require_channel_setup.classifyMSTeamsSendError(err).kind === "replay-safe",
|
|
1734
|
+
delayMs: ({ attempt, err }) => computeRetryDelayMs(attempt, require_channel_setup.classifyMSTeamsSendError(err), retryOptions),
|
|
1735
|
+
onRetry: ({ attempt, err, delayMs }) => {
|
|
1736
|
+
params.onRetry?.({
|
|
1737
|
+
messageIndex: meta.messageIndex,
|
|
1738
|
+
messageCount: meta.messageCount,
|
|
1739
|
+
nextAttempt: attempt + 1,
|
|
1740
|
+
maxAttempts: retryOptions.maxAttempts,
|
|
1741
|
+
delayMs,
|
|
1742
|
+
classification: require_channel_setup.classifyMSTeamsSendError(err)
|
|
1743
|
+
});
|
|
1744
|
+
},
|
|
1745
|
+
sleep: (delayMs) => (0, openclaw_plugin_sdk_runtime_env.sleepWithAbort)(delayMs)
|
|
1746
|
+
});
|
|
1741
1747
|
};
|
|
1742
1748
|
let providerDispatchStarted = false;
|
|
1743
1749
|
const sendMessageInContext = async (sendFn, message, messageIndex) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const require_resolve_allowlist = require("./resolve-allowlist-
|
|
1
|
+
const require_resolve_allowlist = require("./resolve-allowlist-CIfWUwuc.cjs");
|
|
2
|
+
let openclaw_plugin_sdk_runtime_env = require("openclaw/plugin-sdk/runtime-env");
|
|
2
3
|
let openclaw_plugin_sdk_provider_auth = require("openclaw/plugin-sdk/provider-auth");
|
|
3
4
|
let openclaw_plugin_sdk_provider_auth_runtime = require("openclaw/plugin-sdk/provider-auth-runtime");
|
|
4
|
-
let openclaw_plugin_sdk_runtime_env = require("openclaw/plugin-sdk/runtime-env");
|
|
5
5
|
//#region extensions/msteams/src/oauth.flow.ts
|
|
6
6
|
function shouldUseManualOAuthFlow(isRemote) {
|
|
7
7
|
return isRemote || (0, openclaw_plugin_sdk_runtime_env.isWSL2Sync)();
|
package/dist/qa-runner-api.cjs
CHANGED
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
let openclaw_plugin_sdk_qa_runner_runtime = require("openclaw/plugin-sdk/qa-runner-runtime");
|
|
3
3
|
//#region extensions/msteams/src/qa/cli.ts
|
|
4
4
|
const DEFAULT_MSTEAMS_QA_SCENARIOS = ["channel-canary"];
|
|
5
|
-
const loadMSTeamsQaAdapterRuntime = (0, openclaw_plugin_sdk_qa_runner_runtime.createLazyCliRuntimeLoader)(() => Promise.resolve().then(() => require("./adapter.runtime-
|
|
5
|
+
const loadMSTeamsQaAdapterRuntime = (0, openclaw_plugin_sdk_qa_runner_runtime.createLazyCliRuntimeLoader)(() => Promise.resolve().then(() => require("./adapter.runtime-8g-MOPfb.cjs")));
|
|
6
6
|
async function runQaMSTeams(options) {
|
|
7
7
|
await (0, openclaw_plugin_sdk_qa_runner_runtime.runLiveTransportQaSuiteCommand)({
|
|
8
8
|
channelId: "msteams",
|
|
@@ -4,75 +4,18 @@ const require_delegated_state = require("./delegated-state-DiEz9JIa.cjs");
|
|
|
4
4
|
let openclaw_plugin_sdk_lazy_runtime = require("openclaw/plugin-sdk/lazy-runtime");
|
|
5
5
|
let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
|
|
6
6
|
let openclaw_plugin_sdk_allow_from = require("openclaw/plugin-sdk/allow-from");
|
|
7
|
-
let openclaw_plugin_sdk_ssrf_runtime = require("openclaw/plugin-sdk/ssrf-runtime");
|
|
8
|
-
let openclaw_plugin_sdk_html_entity_runtime = require("openclaw/plugin-sdk/html-entity-runtime");
|
|
9
7
|
let openclaw_plugin_sdk_fetch_runtime = require("openclaw/plugin-sdk/fetch-runtime");
|
|
10
8
|
let openclaw_plugin_sdk_provider_http = require("openclaw/plugin-sdk/provider-http");
|
|
9
|
+
let openclaw_plugin_sdk_ssrf_runtime = require("openclaw/plugin-sdk/ssrf-runtime");
|
|
11
10
|
let node_buffer = require("node:buffer");
|
|
12
11
|
let node_dns_promises = require("node:dns/promises");
|
|
13
12
|
let openclaw_plugin_sdk_ssrf_policy = require("openclaw/plugin-sdk/ssrf-policy");
|
|
14
13
|
let openclaw_plugin_sdk_number_runtime = require("openclaw/plugin-sdk/number-runtime");
|
|
15
14
|
let openclaw_plugin_sdk_text_utility_runtime = require("openclaw/plugin-sdk/text-utility-runtime");
|
|
16
|
-
let openclaw_plugin_sdk_error_runtime = require("openclaw/plugin-sdk/error-runtime");
|
|
17
15
|
let openclaw_plugin_sdk_secret_file = require("openclaw/plugin-sdk/secret-file");
|
|
18
16
|
let node_module = require("node:module");
|
|
19
17
|
let openclaw_plugin_sdk_secret_input = require("openclaw/plugin-sdk/secret-input");
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Strip HTML tags, preserving text content.
|
|
23
|
-
*/
|
|
24
|
-
function htmlToPlainText(html) {
|
|
25
|
-
return (0, openclaw_plugin_sdk_html_entity_runtime.decodeHtmlEntities)(html.replace(/<[^>]*>/g, " ")).replaceAll("\xA0", " ").replace(/\s+/g, " ").trim();
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Extract quote info from MS Teams HTML reply attachments.
|
|
29
|
-
* Teams wraps quoted content in a blockquote with itemtype="http://schema.skype.com/Reply".
|
|
30
|
-
*/
|
|
31
|
-
function extractMSTeamsQuoteInfo(attachments) {
|
|
32
|
-
for (const att of attachments) {
|
|
33
|
-
let content = "";
|
|
34
|
-
if (typeof att.content === "string") content = att.content;
|
|
35
|
-
else if (typeof att.content === "object" && att.content !== null) {
|
|
36
|
-
const record = att.content;
|
|
37
|
-
content = typeof record.text === "string" ? record.text : typeof record.body === "string" ? record.body : "";
|
|
38
|
-
}
|
|
39
|
-
if (!content) continue;
|
|
40
|
-
if (!content.includes("http://schema.skype.com/Reply")) continue;
|
|
41
|
-
const senderMatch = /<strong[^>]*itemprop=["']mri["'][^>]*>(.*?)<\/strong>/i.exec(content);
|
|
42
|
-
const sender = senderMatch?.[1] ? htmlToPlainText(senderMatch[1]) : void 0;
|
|
43
|
-
const bodyMatch = /<p[^>]*itemprop=["']copy["'][^>]*>(.*?)<\/p>/is.exec(content) ?? /<p[^>]*itemprop=["']preview["'][^>]*>(.*?)<\/p>/is.exec(content);
|
|
44
|
-
const body = bodyMatch?.[1] ? htmlToPlainText(bodyMatch[1]) : void 0;
|
|
45
|
-
const id = /<blockquote[^>]*\bitemid=["']([^"']+)["'][^>]*>/is.exec(content)?.[1]?.trim() || void 0;
|
|
46
|
-
if (body) return {
|
|
47
|
-
sender: sender ?? "unknown",
|
|
48
|
-
body,
|
|
49
|
-
...id ? { id } : {}
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
function normalizeMSTeamsConversationId(raw) {
|
|
54
|
-
return raw.split(";")[0] ?? raw;
|
|
55
|
-
}
|
|
56
|
-
function extractMSTeamsConversationMessageId(raw) {
|
|
57
|
-
if (!raw) return;
|
|
58
|
-
return (/(?:^|;)messageid=([^;]+)/i.exec(raw)?.[1]?.trim() ?? "") || void 0;
|
|
59
|
-
}
|
|
60
|
-
function parseMSTeamsActivityTimestamp(value) {
|
|
61
|
-
if (!value) return;
|
|
62
|
-
if (value instanceof Date) return value;
|
|
63
|
-
if (typeof value !== "string") return;
|
|
64
|
-
const date = new Date(value);
|
|
65
|
-
return Number.isNaN(date.getTime()) ? void 0 : date;
|
|
66
|
-
}
|
|
67
|
-
function stripMSTeamsMentionTags(text) {
|
|
68
|
-
return text.replace(/<at[^>]*>.*?<\/at>/gi, "").trim();
|
|
69
|
-
}
|
|
70
|
-
function wasMSTeamsBotMentioned(activity) {
|
|
71
|
-
const botId = activity.recipient?.id;
|
|
72
|
-
if (!botId) return false;
|
|
73
|
-
return (activity.entities ?? []).some((e) => e.type === "mention" && e.mentioned?.id === botId);
|
|
74
|
-
}
|
|
75
|
-
//#endregion
|
|
18
|
+
let openclaw_plugin_sdk_html_entity_runtime = require("openclaw/plugin-sdk/html-entity-runtime");
|
|
76
19
|
//#region extensions/msteams/src/request-timeout.ts
|
|
77
20
|
const MSTEAMS_REQUEST_TIMEOUT_MS = 3e4;
|
|
78
21
|
const MSTEAMS_SHAREPOINT_UPLOAD_BASE_TIMEOUT_MS = 5 * 6e4;
|
|
@@ -210,14 +153,15 @@ const GRAPH_SHARED_LINK_HOST_SUFFIXES = [
|
|
|
210
153
|
* than directly.
|
|
211
154
|
*/
|
|
212
155
|
function isGraphSharedLinkUrl(url) {
|
|
213
|
-
let
|
|
156
|
+
let parsed;
|
|
214
157
|
try {
|
|
215
|
-
|
|
158
|
+
parsed = new URL(url);
|
|
216
159
|
} catch {
|
|
217
160
|
return false;
|
|
218
161
|
}
|
|
219
|
-
|
|
220
|
-
|
|
162
|
+
const host = (0, openclaw_plugin_sdk_string_coerce_runtime.normalizeLowercaseStringOrEmpty)(parsed.hostname);
|
|
163
|
+
if (parsed.protocol !== "https:" || !host) return false;
|
|
164
|
+
return GRAPH_SHARED_LINK_HOST_SUFFIXES.some((suffix) => host === suffix || host.endsWith(suffix.startsWith(".") ? suffix : `.${suffix}`));
|
|
221
165
|
}
|
|
222
166
|
/**
|
|
223
167
|
* Encode a SharePoint/OneDrive URL as a Graph shareId using the documented
|
|
@@ -715,7 +659,7 @@ var PrivateQaHttpClient = class PrivateQaHttpClient {
|
|
|
715
659
|
try {
|
|
716
660
|
const text = await response.text();
|
|
717
661
|
const data = text ? JSON.parse(text) : void 0;
|
|
718
|
-
if (!response.ok) throw new Error(`Microsoft Teams private QA connector returned HTTP ${response.status}`);
|
|
662
|
+
if (!response.ok) throw Object.assign(/* @__PURE__ */ new Error(`Microsoft Teams private QA connector returned HTTP ${response.status}`), { statusCode: response.status });
|
|
719
663
|
return {
|
|
720
664
|
data,
|
|
721
665
|
status: response.status,
|
|
@@ -879,7 +823,10 @@ async function createMSTeamsApp(creds, options) {
|
|
|
879
823
|
...serviceUrl ? { serviceUrl } : {},
|
|
880
824
|
...options?.oauthDefaultConnectionName ? { oauth: { defaultConnectionName: options.oauthDefaultConnectionName } } : {}
|
|
881
825
|
};
|
|
882
|
-
if (creds.type === "federated") return await createFederatedApp(creds, App,
|
|
826
|
+
if (creds.type === "federated") return await createFederatedApp(creds, App, {
|
|
827
|
+
clientSecret: "",
|
|
828
|
+
...appOptions
|
|
829
|
+
});
|
|
883
830
|
return new App({
|
|
884
831
|
clientId: creds.appId,
|
|
885
832
|
clientSecret: creds.appPassword,
|
|
@@ -898,9 +845,8 @@ async function createFederatedApp(creds, App, appOptions) {
|
|
|
898
845
|
let privateKey;
|
|
899
846
|
try {
|
|
900
847
|
privateKey = await (0, openclaw_plugin_sdk_secret_file.readSecretFile)(creds.certificatePath, "Microsoft Teams certificate");
|
|
901
|
-
} catch
|
|
902
|
-
|
|
903
|
-
throw new Error(`Failed to read certificate file at '${creds.certificatePath}': ${msg}`, { cause: err });
|
|
848
|
+
} catch {
|
|
849
|
+
throw new Error("Failed to read certificate file: the configured credential is unavailable.");
|
|
904
850
|
}
|
|
905
851
|
return createCertificateApp(creds, privateKey, App, appOptions);
|
|
906
852
|
}
|
|
@@ -1359,6 +1305,62 @@ async function findGraphUsersByExactIdentity(params) {
|
|
|
1359
1305
|
});
|
|
1360
1306
|
}
|
|
1361
1307
|
//#endregion
|
|
1308
|
+
//#region extensions/msteams/src/inbound.ts
|
|
1309
|
+
/**
|
|
1310
|
+
* Strip HTML tags, preserving text content.
|
|
1311
|
+
*/
|
|
1312
|
+
function htmlToPlainText(html) {
|
|
1313
|
+
return (0, openclaw_plugin_sdk_html_entity_runtime.decodeHtmlEntities)(html.replace(/<[^>]*>/g, " ")).replaceAll("\xA0", " ").replace(/\s+/g, " ").trim();
|
|
1314
|
+
}
|
|
1315
|
+
/**
|
|
1316
|
+
* Extract quote info from MS Teams HTML reply attachments.
|
|
1317
|
+
* Teams wraps quoted content in a blockquote with itemtype="http://schema.skype.com/Reply".
|
|
1318
|
+
*/
|
|
1319
|
+
function extractMSTeamsQuoteInfo(attachments) {
|
|
1320
|
+
for (const att of attachments) {
|
|
1321
|
+
let content = "";
|
|
1322
|
+
if (typeof att.content === "string") content = att.content;
|
|
1323
|
+
else if (typeof att.content === "object" && att.content !== null) {
|
|
1324
|
+
const record = att.content;
|
|
1325
|
+
content = typeof record.text === "string" ? record.text : typeof record.body === "string" ? record.body : "";
|
|
1326
|
+
}
|
|
1327
|
+
if (!content) continue;
|
|
1328
|
+
if (!content.includes("http://schema.skype.com/Reply")) continue;
|
|
1329
|
+
const senderMatch = /<strong[^>]*itemprop=["']mri["'][^>]*>(.*?)<\/strong>/i.exec(content);
|
|
1330
|
+
const sender = senderMatch?.[1] ? htmlToPlainText(senderMatch[1]) : void 0;
|
|
1331
|
+
const bodyMatch = /<p[^>]*itemprop=["']copy["'][^>]*>(.*?)<\/p>/is.exec(content) ?? /<p[^>]*itemprop=["']preview["'][^>]*>(.*?)<\/p>/is.exec(content);
|
|
1332
|
+
const body = bodyMatch?.[1] ? htmlToPlainText(bodyMatch[1]) : void 0;
|
|
1333
|
+
const id = /<blockquote[^>]*\bitemid=["']([^"']+)["'][^>]*>/is.exec(content)?.[1]?.trim() || void 0;
|
|
1334
|
+
if (body) return {
|
|
1335
|
+
sender: sender ?? "unknown",
|
|
1336
|
+
body,
|
|
1337
|
+
...id ? { id } : {}
|
|
1338
|
+
};
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
function normalizeMSTeamsConversationId(raw) {
|
|
1342
|
+
return raw.split(";")[0] ?? raw;
|
|
1343
|
+
}
|
|
1344
|
+
function extractMSTeamsConversationMessageId(raw) {
|
|
1345
|
+
if (!raw) return;
|
|
1346
|
+
return (/(?:^|;)messageid=([^;]+)/i.exec(raw)?.[1]?.trim() ?? "") || void 0;
|
|
1347
|
+
}
|
|
1348
|
+
function parseMSTeamsActivityTimestamp(value) {
|
|
1349
|
+
if (!value) return;
|
|
1350
|
+
if (value instanceof Date) return value;
|
|
1351
|
+
if (typeof value !== "string") return;
|
|
1352
|
+
const date = new Date(value);
|
|
1353
|
+
return Number.isNaN(date.getTime()) ? void 0 : date;
|
|
1354
|
+
}
|
|
1355
|
+
function stripMSTeamsMentionTags(text) {
|
|
1356
|
+
return text.replace(/<at[^>]*>.*?<\/at>/gi, "").trim();
|
|
1357
|
+
}
|
|
1358
|
+
function wasMSTeamsBotMentioned(activity) {
|
|
1359
|
+
const botId = activity.recipient?.id;
|
|
1360
|
+
if (!botId) return false;
|
|
1361
|
+
return (activity.entities ?? []).some((e) => e.type === "mention" && e.mentioned?.id === botId);
|
|
1362
|
+
}
|
|
1363
|
+
//#endregion
|
|
1362
1364
|
//#region extensions/msteams/src/resolve-allowlist.ts
|
|
1363
1365
|
const MSTEAMS_GROUP_CONVERSATION_ID = /^19:.+@thread\.(?:tacv2|skype|v2)$/i;
|
|
1364
1366
|
function normalizeExactMatch(value) {
|
package/dist/runtime-api.cjs
CHANGED
|
@@ -3,8 +3,8 @@ const require_runtime = require("./runtime-gZTAuFux.cjs");
|
|
|
3
3
|
let openclaw_plugin_sdk_channel_outbound = require("openclaw/plugin-sdk/channel-outbound");
|
|
4
4
|
let openclaw_plugin_sdk_channel_pairing = require("openclaw/plugin-sdk/channel-pairing");
|
|
5
5
|
let openclaw_plugin_sdk_channel_policy = require("openclaw/plugin-sdk/channel-policy");
|
|
6
|
-
let openclaw_plugin_sdk_account_id = require("openclaw/plugin-sdk/account-id");
|
|
7
6
|
let openclaw_plugin_sdk_allow_from = require("openclaw/plugin-sdk/allow-from");
|
|
7
|
+
let openclaw_plugin_sdk_account_id = require("openclaw/plugin-sdk/account-id");
|
|
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,37 +1,3 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
const require_config_schema = require("./config-schema-C4CszdDi.cjs");
|
|
5
|
-
let openclaw_plugin_sdk_account_helpers = require("openclaw/plugin-sdk/account-helpers");
|
|
6
|
-
//#region extensions/msteams/src/channel.setup.ts
|
|
7
|
-
const msteamsSetupPlugin = {
|
|
8
|
-
id: "msteams",
|
|
9
|
-
meta: {
|
|
10
|
-
...require_setup_surface.msteamsMeta,
|
|
11
|
-
aliases: [...require_setup_surface.msteamsMeta.aliases]
|
|
12
|
-
},
|
|
13
|
-
capabilities: {
|
|
14
|
-
chatTypes: [
|
|
15
|
-
"direct",
|
|
16
|
-
"channel",
|
|
17
|
-
"thread"
|
|
18
|
-
],
|
|
19
|
-
polls: true,
|
|
20
|
-
threads: true,
|
|
21
|
-
media: true
|
|
22
|
-
},
|
|
23
|
-
reload: { configPrefixes: ["channels.msteams"] },
|
|
24
|
-
configSchema: require_config_schema.MSTeamsChannelConfigSchema,
|
|
25
|
-
config: {
|
|
26
|
-
...require_setup_surface.msteamsConfigAdapter,
|
|
27
|
-
isConfigured: (_account, cfg) => Boolean(require_resolve_allowlist.resolveMSTeamsCredentials(cfg.channels?.msteams)),
|
|
28
|
-
describeAccount: (account) => (0, openclaw_plugin_sdk_account_helpers.describeAccountSnapshot)({
|
|
29
|
-
account,
|
|
30
|
-
configured: account.configured
|
|
31
|
-
})
|
|
32
|
-
},
|
|
33
|
-
setupWizard: require_setup_surface.msteamsSetupWizard,
|
|
34
|
-
setupContract: require_setup_surface.msteamsSetupContract
|
|
35
|
-
};
|
|
36
|
-
//#endregion
|
|
37
|
-
exports.msteamsSetupPlugin = msteamsSetupPlugin;
|
|
2
|
+
const require_channel_setup = require("./channel.setup-mOFtsfYz.cjs");
|
|
3
|
+
exports.msteamsSetupPlugin = require_channel_setup.msteamsSetupPlugin;
|