@openclaw/msteams 2026.7.2-beta.1 → 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.
@@ -1,15 +1,13 @@
1
- const require_rolldown_runtime = require("./rolldown-runtime-D6vf50IK.cjs");
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 = require_rolldown_runtime.__toESM(node_crypto, 1);
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, lockFilename, fn) {
107
- const lockPath = node_path.default.join(resolveMSTeamsSqliteStateDir(options), lockFilename);
108
- return await withProcessMutationLock(lockPath, async () => {
109
- return await withFileLock(lockPath, { version: 1 }, fn);
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 CONVERSATION_LOCK_FILENAME = "msteams-conversations.sqlite.lock";
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, CONVERSATION_LOCK_FILENAME, async () => {
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, CONVERSATION_LOCK_FILENAME, async () => {
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 POLL_LOCK_FILENAME = "msteams-polls.sqlite.lock";
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, POLL_LOCK_FILENAME, async () => {
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, POLL_LOCK_FILENAME, async () => {
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 require_rolldown_runtime = require("./rolldown-runtime-D6vf50IK.cjs");
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 = require_rolldown_runtime.__toESM(node_fs, 1);
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;
@@ -44,6 +41,22 @@ function resolveMSTeamsSharePointUploadTimeoutMs(sizeInBytes) {
44
41
  const transferBudgetMs = Math.ceil((Number.isFinite(sizeInBytes) && sizeInBytes > 0 ? Math.ceil(sizeInBytes) : 0) / MSTEAMS_SHAREPOINT_UPLOAD_MIN_BYTES_PER_SECOND * 1e3);
45
42
  return (0, openclaw_plugin_sdk_number_runtime.resolveTimerTimeoutMs)(MSTEAMS_SHAREPOINT_UPLOAD_BASE_TIMEOUT_MS + transferBudgetMs, MSTEAMS_SHAREPOINT_UPLOAD_BASE_TIMEOUT_MS, 1);
46
43
  }
44
+ function createMSTeamsRequestTimeoutError(label, timeoutMs) {
45
+ const error = /* @__PURE__ */ new Error(`${label} timed out after ${timeoutMs}ms`);
46
+ error.name = "TimeoutError";
47
+ return error;
48
+ }
49
+ async function withMSTeamsAbortableRequestTimeout(params) {
50
+ const controller = new AbortController();
51
+ const timeoutMs = (0, openclaw_plugin_sdk_number_runtime.resolveTimerTimeoutMs)(params.timeoutMs, MSTEAMS_REQUEST_TIMEOUT_MS, 1);
52
+ const work = Promise.resolve().then(() => params.work(controller.signal));
53
+ try {
54
+ return await (0, openclaw_plugin_sdk_text_utility_runtime.withTimeout)(work, timeoutMs, { createError: () => createMSTeamsRequestTimeoutError(params.label, timeoutMs) });
55
+ } catch (error) {
56
+ controller.abort(error);
57
+ throw error;
58
+ }
59
+ }
47
60
  //#endregion
48
61
  //#region extensions/msteams/src/response-with-release.ts
49
62
  const NULL_BODY_STATUSES = /* @__PURE__ */ new Set([
@@ -624,6 +637,16 @@ function resolveOpenClawVersion() {
624
637
  return "unknown";
625
638
  }
626
639
  }
640
+ /**
641
+ * Build a combined User-Agent string that preserves the Teams SDK identity
642
+ * and appends the OpenClaw version.
643
+ *
644
+ * Format: "teams.ts[apps]/<sdk-version> OpenClaw/<openclaw-version>"
645
+ * Example: "teams.ts[apps]/2.0.5 OpenClaw/2026.3.22"
646
+ *
647
+ * This lets the Teams backend track SDK usage while also identifying the
648
+ * host application.
649
+ */
627
650
  function buildUserAgent() {
628
651
  if (cachedUserAgent) return cachedUserAgent;
629
652
  cachedUserAgent = `teams.ts[apps]/${resolveTeamsSdkVersion()} OpenClaw/${resolveOpenClawVersion()}`;
@@ -883,15 +906,6 @@ async function refreshMSTeamsDelegatedTokens(params) {
883
906
  });
884
907
  }
885
908
  //#endregion
886
- //#region extensions/msteams/src/storage.ts
887
- function resolveMSTeamsStorePath(params) {
888
- if (params.storePath) return params.storePath;
889
- if (params.stateDir) return node_path.default.join(params.stateDir, params.filename);
890
- const env = params.env ?? process.env;
891
- const stateDir = params.homedir ? require_runtime.getMSTeamsRuntime().state.resolveStateDir(env, params.homedir) : require_runtime.getMSTeamsRuntime().state.resolveStateDir(env);
892
- return node_path.default.join(stateDir, params.filename);
893
- }
894
- //#endregion
895
909
  //#region extensions/msteams/src/token.ts
896
910
  function resolveAuthType(cfg) {
897
911
  const fromCfg = cfg?.authType;
@@ -943,21 +957,11 @@ function resolveMSTeamsCredentials(cfg) {
943
957
  tenantId
944
958
  };
945
959
  }
946
- const DELEGATED_TOKEN_FILENAME = "msteams-delegated.json";
947
- function resolveDelegatedTokenPath() {
948
- return resolveMSTeamsStorePath({ filename: DELEGATED_TOKEN_FILENAME });
949
- }
950
960
  function loadDelegatedTokens() {
951
- try {
952
- const content = (0, node_fs.readFileSync)(resolveDelegatedTokenPath(), "utf8");
953
- return JSON.parse(content);
954
- } catch {
955
- return;
956
- }
961
+ return require_delegated_state.loadMSTeamsDelegatedTokens();
957
962
  }
958
963
  function saveDelegatedTokens(tokens) {
959
- const tokenPath = resolveDelegatedTokenPath();
960
- (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);
961
965
  }
962
966
  async function resolveDelegatedAccessToken(params) {
963
967
  const tokens = loadDelegatedTokens();
@@ -1098,7 +1102,11 @@ async function resolveGraphToken(cfg, options) {
1098
1102
  if (delegated) return delegated;
1099
1103
  }
1100
1104
  const { app } = await loadMSTeamsSdkWithAuth(creds, resolveMSTeamsSdkCloudOptions(msteamsCfg));
1101
- const accessToken = readAccessToken(await createMSTeamsTokenProvider(app).getAccessToken("https://graph.microsoft.com"));
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
+ }));
1102
1110
  if (!accessToken) throw new Error("MS Teams graph token unavailable");
1103
1111
  return accessToken;
1104
1112
  }
@@ -2038,6 +2046,12 @@ Object.defineProperty(exports, "validateMSTeamsProactiveServiceUrlBoundary", {
2038
2046
  return validateMSTeamsProactiveServiceUrlBoundary;
2039
2047
  }
2040
2048
  });
2049
+ Object.defineProperty(exports, "withMSTeamsAbortableRequestTimeout", {
2050
+ enumerable: true,
2051
+ get: function() {
2052
+ return withMSTeamsAbortableRequestTimeout;
2053
+ }
2054
+ });
2041
2055
  Object.defineProperty(exports, "withMSTeamsRequestDeadline", {
2042
2056
  enumerable: true,
2043
2057
  get: function() {
@@ -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-CyQ57MfH.cjs");
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-BDTPN3dX.cjs");
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,8 +1,9 @@
1
- const require_resolve_allowlist = require("./resolve-allowlist-CyQ57MfH.cjs");
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");
5
5
  let openclaw_plugin_sdk_setup_tools = require("openclaw/plugin-sdk/setup-tools");
6
+ let openclaw_plugin_sdk_retry_runtime = require("openclaw/plugin-sdk/retry-runtime");
6
7
  let openclaw_plugin_sdk_secret_input = require("openclaw/plugin-sdk/secret-input");
7
8
  //#region extensions/msteams/src/setup-core.ts
8
9
  const t$1 = (0, openclaw_plugin_sdk_setup.createSetupTranslator)();
@@ -181,14 +182,14 @@ function extractRetryAfterMs(err) {
181
182
  if ((0, openclaw_plugin_sdk_string_coerce_runtime.isRecord)(headers)) {
182
183
  const raw = headers["retry-after"] ?? headers["Retry-After"];
183
184
  if (typeof raw === "string") {
184
- const parsed = parseNonNegativeRetryAfterSeconds(raw);
185
+ const parsed = (0, openclaw_plugin_sdk_retry_runtime.parseRetryAfterHeaderSeconds)(raw);
185
186
  if (parsed !== void 0) return parsed * 1e3;
186
187
  }
187
188
  }
188
189
  if (typeof headers === "object" && headers !== null && "get" in headers && typeof headers.get === "function") {
189
190
  const raw = headers.get("retry-after");
190
191
  if (raw) {
191
- const parsed = parseNonNegativeRetryAfterSeconds(raw);
192
+ const parsed = (0, openclaw_plugin_sdk_retry_runtime.parseRetryAfterHeaderSeconds)(raw);
192
193
  if (parsed !== void 0) return parsed * 1e3;
193
194
  }
194
195
  }
@@ -454,7 +455,7 @@ const msteamsSetupWizard = {
454
455
  };
455
456
  let oauthModule;
456
457
  try {
457
- oauthModule = await Promise.resolve().then(() => require("./oauth-C5E5powI.cjs"));
458
+ oauthModule = await Promise.resolve().then(() => require("./oauth-BUFvYhIw.cjs"));
458
459
  } catch (err) {
459
460
  await noteDelegatedAuthFailure(err);
460
461
  return {
@@ -505,16 +506,7 @@ const msteamsSetupWizard = {
505
506
  },
506
507
  dmPolicy: msteamsDmPolicy,
507
508
  groupAccess: msteamsGroupAccess,
508
- disable: (cfg) => ({
509
- ...cfg,
510
- channels: {
511
- ...cfg.channels,
512
- msteams: {
513
- ...cfg.channels?.msteams,
514
- enabled: false
515
- }
516
- }
517
- })
509
+ disable: (cfg) => (0, openclaw_plugin_sdk_setup.setSetupChannelEnabled)(cfg, channel, false)
518
510
  };
519
511
  //#endregion
520
512
  Object.defineProperty(exports, "classifyMSTeamsSendError", {