@openclaw/msteams 2026.7.2-beta.2 → 2026.7.2-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/api.cjs +2 -2
- package/dist/{channel-BKc8zroK.cjs → channel-oNBYNcJT.cjs} +4 -4
- package/dist/channel-plugin-api.cjs +1 -1
- package/dist/{channel.runtime-hd1Zsoo2.cjs → channel.runtime-Sn3hY2Lu.cjs} +13 -7
- package/dist/delegated-state-DOSCHaAB.cjs +98 -0
- package/dist/directory-contract-api.cjs +1 -1
- package/dist/doctor-contract-api.cjs +86 -7
- package/dist/{messenger-BVcKl6dv.cjs → messenger-Do4oje4J.cjs} +10 -9
- package/dist/{oauth-yNoKtU_3.cjs → oauth-BUFvYhIw.cjs} +1 -1
- package/dist/{polls-BhoI4VaN.cjs → polls-CWExq2xZ.cjs} +24 -40
- package/dist/{resolve-allowlist-DXd097EP.cjs → resolve-allowlist-Dk-1CqBm.cjs} +9 -27
- package/dist/runtime-api.cjs +0 -7
- package/dist/secret-contract-api.cjs +6 -0
- package/dist/setup-plugin-api.cjs +2 -2
- package/dist/{setup-surface-D4f6x5cx.cjs → setup-surface-BcRVoUY8.cjs} +2 -2
- package/dist/{src-20YasZEp.cjs → src-BQM9QUTF.cjs} +441 -303
- package/dist/{sso-token-store-CktCz88k.cjs → sso-token-store-OSg229re.cjs} +4 -4
- package/npm-shrinkwrap.json +3 -3
- package/package.json +4 -4
- package/dist/rolldown-runtime-D6vf50IK.cjs +0 -28
package/dist/api.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_channel = require("./channel-
|
|
3
|
-
const require_setup_surface = require("./setup-surface-
|
|
2
|
+
const require_channel = require("./channel-oNBYNcJT.cjs");
|
|
3
|
+
const require_setup_surface = require("./setup-surface-BcRVoUY8.cjs");
|
|
4
4
|
exports.createMSTeamsSetupWizardBase = require_setup_surface.createMSTeamsSetupWizardBase;
|
|
5
5
|
exports.msteamsPlugin = require_channel.msteamsPlugin;
|
|
6
6
|
exports.msteamsSetupAdapter = require_setup_surface.msteamsSetupAdapter;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require("./runtime-api.cjs");
|
|
2
|
-
const require_resolve_allowlist = require("./resolve-allowlist-
|
|
2
|
+
const require_resolve_allowlist = require("./resolve-allowlist-Dk-1CqBm.cjs");
|
|
3
3
|
const require_config_schema = require("./config-schema-BSNLJUta.cjs");
|
|
4
|
-
const require_setup_surface = require("./setup-surface-
|
|
4
|
+
const require_setup_surface = require("./setup-surface-BcRVoUY8.cjs");
|
|
5
5
|
let openclaw_plugin_sdk_account_helpers = require("openclaw/plugin-sdk/account-helpers");
|
|
6
6
|
let openclaw_plugin_sdk_allow_from = require("openclaw/plugin-sdk/allow-from");
|
|
7
7
|
let openclaw_plugin_sdk_channel_config_helpers = require("openclaw/plugin-sdk/channel-config-helpers");
|
|
@@ -671,7 +671,7 @@ const collectMSTeamsSecurityWarnings = (0, openclaw_plugin_sdk_channel_policy.cr
|
|
|
671
671
|
resolveGroupPolicy: ({ cfg }) => cfg.channels?.msteams?.groupPolicy,
|
|
672
672
|
collect: ({ groupPolicy }) => groupPolicy === "open" ? ["- MS Teams groups: groupPolicy=\"open\" allows any member to trigger (mention-gated). Set channels.msteams.groupPolicy=\"allowlist\" + channels.msteams.groupAllowFrom to restrict senders."] : []
|
|
673
673
|
});
|
|
674
|
-
const loadMSTeamsChannelRuntime = (0, openclaw_plugin_sdk_lazy_runtime.createLazyRuntimeNamedExport)(() => Promise.resolve().then(() => require("./channel.runtime-
|
|
674
|
+
const loadMSTeamsChannelRuntime = (0, openclaw_plugin_sdk_lazy_runtime.createLazyRuntimeNamedExport)(() => Promise.resolve().then(() => require("./channel.runtime-Sn3hY2Lu.cjs")), "msTeamsChannelRuntime");
|
|
675
675
|
const resolveMSTeamsChannelConfig = (cfg) => ({
|
|
676
676
|
allowFrom: cfg.channels?.msteams?.allowFrom,
|
|
677
677
|
defaultTo: cfg.channels?.msteams?.defaultTo
|
|
@@ -1565,7 +1565,7 @@ const msteamsPlugin = (0, openclaw_plugin_sdk_channel_core.createChatChannelPlug
|
|
|
1565
1565
|
})
|
|
1566
1566
|
}),
|
|
1567
1567
|
gateway: { startAccount: async (ctx) => {
|
|
1568
|
-
const { monitorMSTeamsProvider } = await Promise.resolve().then(() => require("./src-
|
|
1568
|
+
const { monitorMSTeamsProvider } = await Promise.resolve().then(() => require("./src-BQM9QUTF.cjs"));
|
|
1569
1569
|
const port = ctx.cfg.channels?.msteams?.webhook?.port ?? 3978;
|
|
1570
1570
|
ctx.setStatus({
|
|
1571
1571
|
accountId: ctx.accountId,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const require_runtime = require("./runtime-gZTAuFux.cjs");
|
|
2
2
|
require("./runtime-api.cjs");
|
|
3
|
-
const require_resolve_allowlist = require("./resolve-allowlist-
|
|
4
|
-
const require_channel = require("./channel-
|
|
5
|
-
const require_setup_surface = require("./setup-surface-
|
|
6
|
-
const require_polls = require("./polls-
|
|
7
|
-
const require_messenger = require("./messenger-
|
|
3
|
+
const require_resolve_allowlist = require("./resolve-allowlist-Dk-1CqBm.cjs");
|
|
4
|
+
const require_channel = require("./channel-oNBYNcJT.cjs");
|
|
5
|
+
const require_setup_surface = require("./setup-surface-BcRVoUY8.cjs");
|
|
6
|
+
const require_polls = require("./polls-CWExq2xZ.cjs");
|
|
7
|
+
const require_messenger = require("./messenger-Do4oje4J.cjs");
|
|
8
8
|
let openclaw_plugin_sdk_channel_outbound = require("openclaw/plugin-sdk/channel-outbound");
|
|
9
9
|
let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
|
|
10
10
|
let openclaw_plugin_sdk_reply_payload = require("openclaw/plugin-sdk/reply-payload");
|
|
@@ -1291,10 +1291,16 @@ async function probeMSTeams(cfg) {
|
|
|
1291
1291
|
try {
|
|
1292
1292
|
const { app } = await require_resolve_allowlist.loadMSTeamsSdkWithAuth(creds, require_resolve_allowlist.resolveMSTeamsSdkCloudOptions(cfg));
|
|
1293
1293
|
const tokenProvider = require_resolve_allowlist.createMSTeamsTokenProvider(app);
|
|
1294
|
-
if (!await
|
|
1294
|
+
if (!await require_resolve_allowlist.withMSTeamsRequestDeadline({
|
|
1295
|
+
label: "MS Teams Bot Framework probe token",
|
|
1296
|
+
work: () => tokenProvider.getAccessToken("https://api.botframework.com")
|
|
1297
|
+
})) throw new Error("Failed to acquire bot token");
|
|
1295
1298
|
let graph;
|
|
1296
1299
|
try {
|
|
1297
|
-
const accessToken = require_resolve_allowlist.readAccessToken(await
|
|
1300
|
+
const accessToken = require_resolve_allowlist.readAccessToken(await require_resolve_allowlist.withMSTeamsRequestDeadline({
|
|
1301
|
+
label: "MS Teams Graph probe token",
|
|
1302
|
+
work: () => tokenProvider.getAccessToken("https://graph.microsoft.com")
|
|
1303
|
+
}));
|
|
1298
1304
|
const payload = accessToken ? decodeJwtPayload(accessToken) : null;
|
|
1299
1305
|
graph = {
|
|
1300
1306
|
ok: true,
|
|
@@ -0,0 +1,98 @@
|
|
|
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
|
|
23
|
+
const require_runtime = require("./runtime-gZTAuFux.cjs");
|
|
24
|
+
//#region extensions/msteams/src/delegated-state.ts
|
|
25
|
+
const MSTEAMS_DELEGATED_TOKEN_LEGACY_FILENAME = "msteams-delegated.json";
|
|
26
|
+
const MSTEAMS_DELEGATED_TOKEN_NAMESPACE = "delegated-token";
|
|
27
|
+
const MSTEAMS_DELEGATED_TOKEN_KEY = "current";
|
|
28
|
+
function openDelegatedTokenStore(env) {
|
|
29
|
+
return require_runtime.getMSTeamsRuntime().state.openSyncKeyedStore({
|
|
30
|
+
namespace: MSTEAMS_DELEGATED_TOKEN_NAMESPACE,
|
|
31
|
+
maxEntries: 1,
|
|
32
|
+
overflowPolicy: "reject-new",
|
|
33
|
+
...env ? { env } : {}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function normalizeMSTeamsDelegatedTokens(value) {
|
|
37
|
+
if (!value || typeof value !== "object") return null;
|
|
38
|
+
const token = value;
|
|
39
|
+
if (typeof token.accessToken !== "string" || !token.accessToken || typeof token.refreshToken !== "string" || !token.refreshToken || typeof token.expiresAt !== "number" || !Number.isFinite(token.expiresAt) || !Array.isArray(token.scopes) || !token.scopes.every((scope) => typeof scope === "string" && scope.length > 0)) return null;
|
|
40
|
+
return {
|
|
41
|
+
accessToken: token.accessToken,
|
|
42
|
+
refreshToken: token.refreshToken,
|
|
43
|
+
expiresAt: token.expiresAt,
|
|
44
|
+
scopes: [...token.scopes],
|
|
45
|
+
...typeof token.userPrincipalName === "string" ? { userPrincipalName: token.userPrincipalName } : {}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function loadMSTeamsDelegatedTokens(env) {
|
|
49
|
+
return normalizeMSTeamsDelegatedTokens(openDelegatedTokenStore(env).lookup("current")) ?? void 0;
|
|
50
|
+
}
|
|
51
|
+
function saveMSTeamsDelegatedTokens(tokens, env) {
|
|
52
|
+
const normalized = normalizeMSTeamsDelegatedTokens(tokens);
|
|
53
|
+
if (!normalized) throw new Error("Invalid Microsoft Teams delegated token payload");
|
|
54
|
+
openDelegatedTokenStore(env).register(MSTEAMS_DELEGATED_TOKEN_KEY, normalized);
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
Object.defineProperty(exports, "MSTEAMS_DELEGATED_TOKEN_KEY", {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
get: function() {
|
|
60
|
+
return MSTEAMS_DELEGATED_TOKEN_KEY;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
Object.defineProperty(exports, "MSTEAMS_DELEGATED_TOKEN_LEGACY_FILENAME", {
|
|
64
|
+
enumerable: true,
|
|
65
|
+
get: function() {
|
|
66
|
+
return MSTEAMS_DELEGATED_TOKEN_LEGACY_FILENAME;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
Object.defineProperty(exports, "MSTEAMS_DELEGATED_TOKEN_NAMESPACE", {
|
|
70
|
+
enumerable: true,
|
|
71
|
+
get: function() {
|
|
72
|
+
return MSTEAMS_DELEGATED_TOKEN_NAMESPACE;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
Object.defineProperty(exports, "__toESM", {
|
|
76
|
+
enumerable: true,
|
|
77
|
+
get: function() {
|
|
78
|
+
return __toESM;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
Object.defineProperty(exports, "loadMSTeamsDelegatedTokens", {
|
|
82
|
+
enumerable: true,
|
|
83
|
+
get: function() {
|
|
84
|
+
return loadMSTeamsDelegatedTokens;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
Object.defineProperty(exports, "normalizeMSTeamsDelegatedTokens", {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
get: function() {
|
|
90
|
+
return normalizeMSTeamsDelegatedTokens;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
Object.defineProperty(exports, "saveMSTeamsDelegatedTokens", {
|
|
94
|
+
enumerable: true,
|
|
95
|
+
get: function() {
|
|
96
|
+
return saveMSTeamsDelegatedTokens;
|
|
97
|
+
}
|
|
98
|
+
});
|
|
@@ -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-Dk-1CqBm.cjs");
|
|
3
3
|
let openclaw_plugin_sdk_directory_runtime = require("openclaw/plugin-sdk/directory-runtime");
|
|
4
4
|
const msteamsDirectoryContractPlugin = {
|
|
5
5
|
id: "msteams",
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
const require_polls = require("./polls-
|
|
4
|
-
const require_sso_token_store = require("./sso-token-store-
|
|
2
|
+
const require_delegated_state = require("./delegated-state-DOSCHaAB.cjs");
|
|
3
|
+
const require_polls = require("./polls-CWExq2xZ.cjs");
|
|
4
|
+
const require_sso_token_store = require("./sso-token-store-OSg229re.cjs");
|
|
5
5
|
let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
|
|
6
|
-
let node_path = require("node:path");
|
|
7
|
-
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
8
6
|
let node_crypto = require("node:crypto");
|
|
9
|
-
node_crypto =
|
|
7
|
+
node_crypto = require_delegated_state.__toESM(node_crypto, 1);
|
|
10
8
|
let node_fs_promises = require("node:fs/promises");
|
|
11
|
-
node_fs_promises =
|
|
9
|
+
node_fs_promises = require_delegated_state.__toESM(node_fs_promises, 1);
|
|
10
|
+
let node_path = require("node:path");
|
|
11
|
+
node_path = require_delegated_state.__toESM(node_path, 1);
|
|
12
12
|
let openclaw_plugin_sdk_runtime_doctor = require("openclaw/plugin-sdk/runtime-doctor");
|
|
13
13
|
let openclaw_plugin_sdk_session_store_runtime = require("openclaw/plugin-sdk/session-store-runtime");
|
|
14
14
|
//#region extensions/msteams/doctor-contract-api.ts
|
|
@@ -314,6 +314,85 @@ const stateMigrations = [
|
|
|
314
314
|
};
|
|
315
315
|
}
|
|
316
316
|
},
|
|
317
|
+
{
|
|
318
|
+
id: "msteams-delegated-token-json-to-plugin-state",
|
|
319
|
+
label: "Microsoft Teams delegated OAuth token",
|
|
320
|
+
async detectLegacyState(params) {
|
|
321
|
+
const filePath = resolveStateFilePath(params.stateDir, require_delegated_state.MSTEAMS_DELEGATED_TOKEN_LEGACY_FILENAME);
|
|
322
|
+
try {
|
|
323
|
+
return (await node_fs_promises.default.stat(filePath)).isFile() ? { preview: [`- ${MSTEAMS_PLUGIN_ID} delegated OAuth token -> plugin state (${require_delegated_state.MSTEAMS_DELEGATED_TOKEN_NAMESPACE})`] } : null;
|
|
324
|
+
} catch {
|
|
325
|
+
return null;
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
async migrateLegacyState(params) {
|
|
329
|
+
const changes = [];
|
|
330
|
+
const warnings = [];
|
|
331
|
+
const filePath = resolveStateFilePath(params.stateDir, require_delegated_state.MSTEAMS_DELEGATED_TOKEN_LEGACY_FILENAME);
|
|
332
|
+
let token;
|
|
333
|
+
try {
|
|
334
|
+
token = require_delegated_state.normalizeMSTeamsDelegatedTokens(JSON.parse(await node_fs_promises.default.readFile(filePath, "utf8")));
|
|
335
|
+
} catch (error) {
|
|
336
|
+
if (error.code === "ENOENT") return {
|
|
337
|
+
changes,
|
|
338
|
+
warnings
|
|
339
|
+
};
|
|
340
|
+
warnings.push(`Failed reading ${MSTEAMS_PLUGIN_ID} delegated OAuth token legacy source; left it in place`);
|
|
341
|
+
return {
|
|
342
|
+
changes,
|
|
343
|
+
warnings
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
if (!token) {
|
|
347
|
+
warnings.push(`Invalid ${MSTEAMS_PLUGIN_ID} delegated OAuth token legacy source; left it in place`);
|
|
348
|
+
return {
|
|
349
|
+
changes,
|
|
350
|
+
warnings
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
const store = params.context.openPluginStateKeyedStore({
|
|
354
|
+
namespace: require_delegated_state.MSTEAMS_DELEGATED_TOKEN_NAMESPACE,
|
|
355
|
+
maxEntries: 1,
|
|
356
|
+
overflowPolicy: "reject-new"
|
|
357
|
+
});
|
|
358
|
+
const existing = await store.lookup(require_delegated_state.MSTEAMS_DELEGATED_TOKEN_KEY);
|
|
359
|
+
if (existing && JSON.stringify(existing) !== JSON.stringify(token)) {
|
|
360
|
+
warnings.push(`Kept existing ${MSTEAMS_PLUGIN_ID} delegated OAuth token in plugin state; left differing legacy source in place`);
|
|
361
|
+
return {
|
|
362
|
+
changes,
|
|
363
|
+
warnings
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
if (!existing) try {
|
|
367
|
+
await store.registerIfAbsent(require_delegated_state.MSTEAMS_DELEGATED_TOKEN_KEY, token);
|
|
368
|
+
} catch (error) {
|
|
369
|
+
warnings.push(`Failed importing ${MSTEAMS_PLUGIN_ID} delegated OAuth token: ${String(error)}; left legacy source in place`);
|
|
370
|
+
return {
|
|
371
|
+
changes,
|
|
372
|
+
warnings
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
const persisted = require_delegated_state.normalizeMSTeamsDelegatedTokens(await store.lookup(require_delegated_state.MSTEAMS_DELEGATED_TOKEN_KEY));
|
|
376
|
+
if (!persisted || JSON.stringify(persisted) !== JSON.stringify(token)) {
|
|
377
|
+
warnings.push(`Failed verifying ${MSTEAMS_PLUGIN_ID} delegated OAuth token in plugin state; left legacy source in place`);
|
|
378
|
+
return {
|
|
379
|
+
changes,
|
|
380
|
+
warnings
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
changes.push(`Migrated ${MSTEAMS_PLUGIN_ID} delegated OAuth token -> plugin state`);
|
|
384
|
+
await (0, openclaw_plugin_sdk_runtime_doctor.archiveLegacyStateSource)({
|
|
385
|
+
filePath,
|
|
386
|
+
label: `${MSTEAMS_PLUGIN_ID} delegated OAuth token`,
|
|
387
|
+
changes,
|
|
388
|
+
warnings
|
|
389
|
+
});
|
|
390
|
+
return {
|
|
391
|
+
changes,
|
|
392
|
+
warnings
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
},
|
|
317
396
|
{
|
|
318
397
|
id: "msteams-feedback-learnings-json-to-plugin-state",
|
|
319
398
|
label: "Microsoft Teams feedback learnings",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_delegated_state = require("./delegated-state-DOSCHaAB.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-
|
|
4
|
+
const require_resolve_allowlist = require("./resolve-allowlist-Dk-1CqBm.cjs");
|
|
5
|
+
const require_setup_surface = require("./setup-surface-BcRVoUY8.cjs");
|
|
6
|
+
const require_polls = require("./polls-CWExq2xZ.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
9
|
let openclaw_plugin_sdk_reply_payload = require("openclaw/plugin-sdk/reply-payload");
|
|
@@ -11,11 +11,11 @@ let openclaw_plugin_sdk_provider_http = require("openclaw/plugin-sdk/provider-ht
|
|
|
11
11
|
let node_dns_promises = require("node:dns/promises");
|
|
12
12
|
let openclaw_plugin_sdk_ssrf_policy = require("openclaw/plugin-sdk/ssrf-policy");
|
|
13
13
|
let openclaw_plugin_sdk_text_utility_runtime = require("openclaw/plugin-sdk/text-utility-runtime");
|
|
14
|
-
let node_path = require("node:path");
|
|
15
|
-
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
16
14
|
let openclaw_plugin_sdk_html_entity_runtime = require("openclaw/plugin-sdk/html-entity-runtime");
|
|
17
15
|
let node_crypto = require("node:crypto");
|
|
18
|
-
node_crypto =
|
|
16
|
+
node_crypto = require_delegated_state.__toESM(node_crypto, 1);
|
|
17
|
+
let node_path = require("node:path");
|
|
18
|
+
node_path = require_delegated_state.__toESM(node_path, 1);
|
|
19
19
|
let openclaw_plugin_sdk_reply_chunking = require("openclaw/plugin-sdk/reply-chunking");
|
|
20
20
|
let openclaw_plugin_sdk_web_media = require("openclaw/plugin-sdk/web-media");
|
|
21
21
|
let openclaw_plugin_sdk_media_runtime = require("openclaw/plugin-sdk/media-runtime");
|
|
@@ -256,6 +256,7 @@ async function uploadToConsentUrl(params) {
|
|
|
256
256
|
},
|
|
257
257
|
body: new Uint8Array(params.buffer)
|
|
258
258
|
}, params.timeoutMs ?? require_resolve_allowlist.resolveMSTeamsSharePointUploadTimeoutMs(params.buffer.length), fetchFn);
|
|
259
|
+
await res.body?.cancel().catch(() => void 0);
|
|
259
260
|
if (!res.ok) throw new Error(`File upload to consent URL failed: ${res.status} ${res.statusText}`);
|
|
260
261
|
}
|
|
261
262
|
//#endregion
|
|
@@ -270,7 +271,7 @@ const RAW_CHUNK_BYTES = 36 * 1024;
|
|
|
270
271
|
const PENDING_UPLOAD_META_MAX_ENTRIES = 200;
|
|
271
272
|
const PENDING_UPLOAD_META_NAMESPACE = "pending-uploads";
|
|
272
273
|
const PENDING_UPLOAD_CHUNKS_NAMESPACE = "pending-upload-chunks";
|
|
273
|
-
const
|
|
274
|
+
const PENDING_UPLOAD_MUTATION_KEY = "pending-uploads";
|
|
274
275
|
function createMetaStore(options) {
|
|
275
276
|
return require_runtime.getMSTeamsRuntime().state.openKeyedStore({
|
|
276
277
|
namespace: PENDING_UPLOAD_META_NAMESPACE,
|
|
@@ -339,7 +340,7 @@ async function registerUploadRows(record, metaStore, chunkStore, ttlMs, overwrit
|
|
|
339
340
|
}));
|
|
340
341
|
}
|
|
341
342
|
async function withPendingUploadLock(options, run) {
|
|
342
|
-
return await require_polls.withMSTeamsSqliteMutationLock(options,
|
|
343
|
+
return await require_polls.withMSTeamsSqliteMutationLock(options, PENDING_UPLOAD_MUTATION_KEY, run);
|
|
343
344
|
}
|
|
344
345
|
async function readUploadRows(id, metaStore, chunkStore) {
|
|
345
346
|
const meta = await metaStore.lookup(buildMetaKey(id));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_resolve_allowlist = require("./resolve-allowlist-
|
|
1
|
+
const require_resolve_allowlist = require("./resolve-allowlist-Dk-1CqBm.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,15 +1,13 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_delegated_state = require("./delegated-state-DOSCHaAB.cjs");
|
|
2
2
|
const require_runtime = require("./runtime-gZTAuFux.cjs");
|
|
3
3
|
let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
|
|
4
4
|
let openclaw_plugin_sdk_file_lock = require("openclaw/plugin-sdk/file-lock");
|
|
5
5
|
let openclaw_plugin_sdk_number_runtime = require("openclaw/plugin-sdk/number-runtime");
|
|
6
|
-
let node_path = require("node:path");
|
|
7
|
-
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
8
|
-
let openclaw_plugin_sdk_security_runtime = require("openclaw/plugin-sdk/security-runtime");
|
|
9
6
|
let node_crypto = require("node:crypto");
|
|
10
|
-
node_crypto =
|
|
7
|
+
node_crypto = require_delegated_state.__toESM(node_crypto, 1);
|
|
8
|
+
let node_path = require("node:path");
|
|
9
|
+
node_path = require_delegated_state.__toESM(node_path, 1);
|
|
11
10
|
let openclaw_plugin_sdk_keyed_async_queue = require("openclaw/plugin-sdk/keyed-async-queue");
|
|
12
|
-
let openclaw_plugin_sdk_json_store = require("openclaw/plugin-sdk/json-store");
|
|
13
11
|
//#region extensions/msteams/src/conversation-store-helpers.ts
|
|
14
12
|
function normalizeStoredConversationId(raw) {
|
|
15
13
|
return raw.split(";")[0] ?? raw;
|
|
@@ -52,30 +50,6 @@ function findPreferredDmConversationByUserId(entries, id) {
|
|
|
52
50
|
return candidates[0] ?? null;
|
|
53
51
|
}
|
|
54
52
|
//#endregion
|
|
55
|
-
//#region extensions/msteams/src/store-fs.ts
|
|
56
|
-
const STORE_LOCK_OPTIONS = {
|
|
57
|
-
retries: {
|
|
58
|
-
retries: 10,
|
|
59
|
-
factor: 2,
|
|
60
|
-
minTimeout: 100,
|
|
61
|
-
maxTimeout: 1e4,
|
|
62
|
-
randomize: true
|
|
63
|
-
},
|
|
64
|
-
stale: 3e4
|
|
65
|
-
};
|
|
66
|
-
async function writeJsonFile(filePath, value) {
|
|
67
|
-
await (0, openclaw_plugin_sdk_json_store.writeJsonFileAtomically)(filePath, value);
|
|
68
|
-
}
|
|
69
|
-
async function ensureJsonFile(filePath, fallback) {
|
|
70
|
-
if (!await (0, openclaw_plugin_sdk_security_runtime.pathExists)(filePath)) await writeJsonFile(filePath, fallback);
|
|
71
|
-
}
|
|
72
|
-
async function withFileLock(filePath, fallback, fn) {
|
|
73
|
-
await ensureJsonFile(filePath, fallback);
|
|
74
|
-
return await (0, openclaw_plugin_sdk_file_lock.withFileLock)(filePath, STORE_LOCK_OPTIONS, async () => {
|
|
75
|
-
return await fn();
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
//#endregion
|
|
79
53
|
//#region extensions/msteams/src/sqlite-state.ts
|
|
80
54
|
function resolveStateDirOverride(options) {
|
|
81
55
|
if (!options) return;
|
|
@@ -100,13 +74,23 @@ function resolveMSTeamsSqliteStateDir(options) {
|
|
|
100
74
|
return resolveStateDirOverride(options) ?? require_runtime.getMSTeamsRuntime().state.resolveStateDir(options?.env ?? process.env, options?.homedir);
|
|
101
75
|
}
|
|
102
76
|
const sqliteMutationLocks = new openclaw_plugin_sdk_keyed_async_queue.KeyedAsyncQueue();
|
|
77
|
+
const MSTEAMS_MUTATION_LOCK_OPTIONS = {
|
|
78
|
+
retries: {
|
|
79
|
+
retries: 10,
|
|
80
|
+
factor: 2,
|
|
81
|
+
minTimeout: 100,
|
|
82
|
+
maxTimeout: 1e4,
|
|
83
|
+
randomize: true
|
|
84
|
+
},
|
|
85
|
+
stale: 3e4
|
|
86
|
+
};
|
|
103
87
|
async function withProcessMutationLock(lockPath, fn) {
|
|
104
88
|
return await sqliteMutationLocks.enqueue(lockPath, fn);
|
|
105
89
|
}
|
|
106
|
-
async function withMSTeamsSqliteMutationLock(options,
|
|
107
|
-
const
|
|
108
|
-
return await withProcessMutationLock(
|
|
109
|
-
return await withFileLock(
|
|
90
|
+
async function withMSTeamsSqliteMutationLock(options, mutationKey, fn) {
|
|
91
|
+
const scopedMutationKey = node_path.default.join(resolveMSTeamsSqliteStateDir(options), mutationKey);
|
|
92
|
+
return await withProcessMutationLock(scopedMutationKey, async () => {
|
|
93
|
+
return await (0, openclaw_plugin_sdk_file_lock.withFileLock)(scopedMutationKey, MSTEAMS_MUTATION_LOCK_OPTIONS, fn);
|
|
110
94
|
});
|
|
111
95
|
}
|
|
112
96
|
//#endregion
|
|
@@ -116,7 +100,7 @@ const MSTEAMS_CONVERSATIONS_NAMESPACE = "conversations";
|
|
|
116
100
|
const MSTEAMS_MAX_CONVERSATIONS = 1e3;
|
|
117
101
|
const MSTEAMS_SQLITE_MAX_CONVERSATION_ROWS = 2e3;
|
|
118
102
|
const MSTEAMS_CONVERSATION_TTL_MS = 365 * 24 * 60 * 60 * 1e3;
|
|
119
|
-
const
|
|
103
|
+
const CONVERSATION_MUTATION_KEY = "conversations";
|
|
120
104
|
function createConversationStateStore(params) {
|
|
121
105
|
return require_runtime.getMSTeamsRuntime().state.openKeyedStore({
|
|
122
106
|
namespace: MSTEAMS_CONVERSATIONS_NAMESPACE,
|
|
@@ -217,14 +201,14 @@ function createMSTeamsConversationStoreState(params) {
|
|
|
217
201
|
};
|
|
218
202
|
const upsert = async (conversationId, reference) => {
|
|
219
203
|
const normalizedId = normalizeStoredConversationId(conversationId);
|
|
220
|
-
await withMSTeamsSqliteMutationLock(params,
|
|
204
|
+
await withMSTeamsSqliteMutationLock(params, CONVERSATION_MUTATION_KEY, async () => {
|
|
221
205
|
const existing = await lookupStored(normalizedId);
|
|
222
206
|
await register(normalizedId, mergeStoredConversationReference(existing ?? void 0, reference, (/* @__PURE__ */ new Date()).toISOString()));
|
|
223
207
|
});
|
|
224
208
|
};
|
|
225
209
|
const remove = async (conversationId) => {
|
|
226
210
|
const normalizedId = normalizeStoredConversationId(conversationId);
|
|
227
|
-
return await withMSTeamsSqliteMutationLock(params,
|
|
211
|
+
return await withMSTeamsSqliteMutationLock(params, CONVERSATION_MUTATION_KEY, async () => {
|
|
228
212
|
return await conversationStore.delete(buildMSTeamsConversationStateKey(normalizedId));
|
|
229
213
|
});
|
|
230
214
|
};
|
|
@@ -246,7 +230,7 @@ const MSTEAMS_SQLITE_MAX_POLL_ROWS = 2e3;
|
|
|
246
230
|
const MSTEAMS_POLL_VOTE_BUCKET_COUNT = 32;
|
|
247
231
|
const MSTEAMS_MAX_POLL_VOTE_BUCKET_ROWS = 1001 * MSTEAMS_POLL_VOTE_BUCKET_COUNT;
|
|
248
232
|
const MSTEAMS_POLL_TTL_MS = 720 * 60 * 60 * 1e3;
|
|
249
|
-
const
|
|
233
|
+
const POLL_MUTATION_KEY = "polls";
|
|
250
234
|
function normalizeChoiceValue(value) {
|
|
251
235
|
if (typeof value === "string") {
|
|
252
236
|
const trimmed = value.trim();
|
|
@@ -496,7 +480,7 @@ function createMSTeamsPollStoreState(params) {
|
|
|
496
480
|
}
|
|
497
481
|
};
|
|
498
482
|
const createPoll = async (poll) => {
|
|
499
|
-
await withMSTeamsSqliteMutationLock(params,
|
|
483
|
+
await withMSTeamsSqliteMutationLock(params, POLL_MUTATION_KEY, async () => {
|
|
500
484
|
const { metadata, votes } = splitMSTeamsPoll(poll);
|
|
501
485
|
await pollStore.register(buildMSTeamsPollStateKey(poll.id), toPluginJsonValue(metadata));
|
|
502
486
|
await deletePollVotes(poll.id);
|
|
@@ -511,7 +495,7 @@ function createMSTeamsPollStoreState(params) {
|
|
|
511
495
|
return await reconstructPoll(poll);
|
|
512
496
|
};
|
|
513
497
|
const recordVote = async (vote) => {
|
|
514
|
-
return await withMSTeamsSqliteMutationLock(params,
|
|
498
|
+
return await withMSTeamsSqliteMutationLock(params, POLL_MUTATION_KEY, async () => {
|
|
515
499
|
const pollKey = buildMSTeamsPollStateKey(vote.pollId);
|
|
516
500
|
const poll = await pollStore.lookup(pollKey);
|
|
517
501
|
if (!poll) return null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_delegated_state = require("./delegated-state-DOSCHaAB.cjs");
|
|
2
2
|
const require_runtime = require("./runtime-gZTAuFux.cjs");
|
|
3
3
|
require("./runtime-api.cjs");
|
|
4
4
|
let openclaw_plugin_sdk_allow_from = require("openclaw/plugin-sdk/allow-from");
|
|
@@ -12,11 +12,8 @@ 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
14
|
let node_fs = require("node:fs");
|
|
15
|
-
node_fs =
|
|
15
|
+
node_fs = require_delegated_state.__toESM(node_fs, 1);
|
|
16
16
|
let node_module = require("node:module");
|
|
17
|
-
let node_path = require("node:path");
|
|
18
|
-
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
19
|
-
let openclaw_plugin_sdk_security_runtime = require("openclaw/plugin-sdk/security-runtime");
|
|
20
17
|
let openclaw_plugin_sdk_secret_input = require("openclaw/plugin-sdk/secret-input");
|
|
21
18
|
//#region extensions/msteams/src/request-timeout.ts
|
|
22
19
|
const MSTEAMS_REQUEST_TIMEOUT_MS = 3e4;
|
|
@@ -909,15 +906,6 @@ async function refreshMSTeamsDelegatedTokens(params) {
|
|
|
909
906
|
});
|
|
910
907
|
}
|
|
911
908
|
//#endregion
|
|
912
|
-
//#region extensions/msteams/src/storage.ts
|
|
913
|
-
function resolveMSTeamsStorePath(params) {
|
|
914
|
-
if (params.storePath) return params.storePath;
|
|
915
|
-
if (params.stateDir) return node_path.default.join(params.stateDir, params.filename);
|
|
916
|
-
const env = params.env ?? process.env;
|
|
917
|
-
const stateDir = params.homedir ? require_runtime.getMSTeamsRuntime().state.resolveStateDir(env, params.homedir) : require_runtime.getMSTeamsRuntime().state.resolveStateDir(env);
|
|
918
|
-
return node_path.default.join(stateDir, params.filename);
|
|
919
|
-
}
|
|
920
|
-
//#endregion
|
|
921
909
|
//#region extensions/msteams/src/token.ts
|
|
922
910
|
function resolveAuthType(cfg) {
|
|
923
911
|
const fromCfg = cfg?.authType;
|
|
@@ -969,21 +957,11 @@ function resolveMSTeamsCredentials(cfg) {
|
|
|
969
957
|
tenantId
|
|
970
958
|
};
|
|
971
959
|
}
|
|
972
|
-
const DELEGATED_TOKEN_FILENAME = "msteams-delegated.json";
|
|
973
|
-
function resolveDelegatedTokenPath() {
|
|
974
|
-
return resolveMSTeamsStorePath({ filename: DELEGATED_TOKEN_FILENAME });
|
|
975
|
-
}
|
|
976
960
|
function loadDelegatedTokens() {
|
|
977
|
-
|
|
978
|
-
const content = (0, node_fs.readFileSync)(resolveDelegatedTokenPath(), "utf8");
|
|
979
|
-
return JSON.parse(content);
|
|
980
|
-
} catch {
|
|
981
|
-
return;
|
|
982
|
-
}
|
|
961
|
+
return require_delegated_state.loadMSTeamsDelegatedTokens();
|
|
983
962
|
}
|
|
984
963
|
function saveDelegatedTokens(tokens) {
|
|
985
|
-
|
|
986
|
-
(0, openclaw_plugin_sdk_security_runtime.privateFileStoreSync)((0, node_path.dirname)(tokenPath)).writeJson((0, node_path.basename)(tokenPath), tokens);
|
|
964
|
+
require_delegated_state.saveMSTeamsDelegatedTokens(tokens);
|
|
987
965
|
}
|
|
988
966
|
async function resolveDelegatedAccessToken(params) {
|
|
989
967
|
const tokens = loadDelegatedTokens();
|
|
@@ -1124,7 +1102,11 @@ async function resolveGraphToken(cfg, options) {
|
|
|
1124
1102
|
if (delegated) return delegated;
|
|
1125
1103
|
}
|
|
1126
1104
|
const { app } = await loadMSTeamsSdkWithAuth(creds, resolveMSTeamsSdkCloudOptions(msteamsCfg));
|
|
1127
|
-
const
|
|
1105
|
+
const tokenProvider = createMSTeamsTokenProvider(app);
|
|
1106
|
+
const accessToken = readAccessToken(await withMSTeamsRequestDeadline({
|
|
1107
|
+
label: "MS Teams Graph token",
|
|
1108
|
+
work: () => tokenProvider.getAccessToken("https://graph.microsoft.com")
|
|
1109
|
+
}));
|
|
1128
1110
|
if (!accessToken) throw new Error("MS Teams graph token unavailable");
|
|
1129
1111
|
return accessToken;
|
|
1130
1112
|
}
|
package/dist/runtime-api.cjs
CHANGED
|
@@ -11,7 +11,6 @@ let openclaw_plugin_sdk_dangerous_name_runtime = require("openclaw/plugin-sdk/da
|
|
|
11
11
|
let openclaw_plugin_sdk_runtime_group_policy = require("openclaw/plugin-sdk/runtime-group-policy");
|
|
12
12
|
let openclaw_plugin_sdk_file_lock = require("openclaw/plugin-sdk/file-lock");
|
|
13
13
|
let openclaw_plugin_sdk_media_runtime = require("openclaw/plugin-sdk/media-runtime");
|
|
14
|
-
let openclaw_plugin_sdk_channel_inbound = require("openclaw/plugin-sdk/channel-inbound");
|
|
15
14
|
let openclaw_plugin_sdk_outbound_media = require("openclaw/plugin-sdk/outbound-media");
|
|
16
15
|
let openclaw_plugin_sdk_reply_payload = require("openclaw/plugin-sdk/reply-payload");
|
|
17
16
|
let openclaw_plugin_sdk_ssrf_runtime = require("openclaw/plugin-sdk/ssrf-runtime");
|
|
@@ -84,12 +83,6 @@ Object.defineProperty(exports, "detectMime", {
|
|
|
84
83
|
return openclaw_plugin_sdk_media_runtime.detectMime;
|
|
85
84
|
}
|
|
86
85
|
});
|
|
87
|
-
Object.defineProperty(exports, "dispatchReplyFromConfigWithSettledDispatcher", {
|
|
88
|
-
enumerable: true,
|
|
89
|
-
get: function() {
|
|
90
|
-
return openclaw_plugin_sdk_channel_inbound.dispatchReplyFromConfigWithSettledDispatcher;
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
86
|
Object.defineProperty(exports, "extensionForMime", {
|
|
94
87
|
enumerable: true,
|
|
95
88
|
get: function() {
|
|
@@ -16,6 +16,12 @@ function collectRuntimeConfigAssignments(params) {
|
|
|
16
16
|
context: params.context,
|
|
17
17
|
active: msteams.enabled !== false,
|
|
18
18
|
inactiveReason: "Microsoft Teams channel is disabled.",
|
|
19
|
+
owner: {
|
|
20
|
+
ownerKind: "account",
|
|
21
|
+
ownerId: "msteams:default",
|
|
22
|
+
requiredForGateway: false,
|
|
23
|
+
disposition: "isolate"
|
|
24
|
+
},
|
|
19
25
|
apply: (value) => {
|
|
20
26
|
msteams.appPassword = value;
|
|
21
27
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
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-Dk-1CqBm.cjs");
|
|
3
3
|
const require_config_schema = require("./config-schema-BSNLJUta.cjs");
|
|
4
|
-
const require_setup_surface = require("./setup-surface-
|
|
4
|
+
const require_setup_surface = require("./setup-surface-BcRVoUY8.cjs");
|
|
5
5
|
let openclaw_plugin_sdk_account_helpers = require("openclaw/plugin-sdk/account-helpers");
|
|
6
6
|
let openclaw_plugin_sdk_allow_from = require("openclaw/plugin-sdk/allow-from");
|
|
7
7
|
let openclaw_plugin_sdk_channel_config_helpers = require("openclaw/plugin-sdk/channel-config-helpers");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_resolve_allowlist = require("./resolve-allowlist-
|
|
1
|
+
const require_resolve_allowlist = require("./resolve-allowlist-Dk-1CqBm.cjs");
|
|
2
2
|
let openclaw_plugin_sdk_string_coerce_runtime = require("openclaw/plugin-sdk/string-coerce-runtime");
|
|
3
3
|
let openclaw_plugin_sdk_number_runtime = require("openclaw/plugin-sdk/number-runtime");
|
|
4
4
|
let openclaw_plugin_sdk_setup = require("openclaw/plugin-sdk/setup");
|
|
@@ -455,7 +455,7 @@ const msteamsSetupWizard = {
|
|
|
455
455
|
};
|
|
456
456
|
let oauthModule;
|
|
457
457
|
try {
|
|
458
|
-
oauthModule = await Promise.resolve().then(() => require("./oauth-
|
|
458
|
+
oauthModule = await Promise.resolve().then(() => require("./oauth-BUFvYhIw.cjs"));
|
|
459
459
|
} catch (err) {
|
|
460
460
|
await noteDelegatedAuthFailure(err);
|
|
461
461
|
return {
|