@openclaw/msteams 2026.6.2-beta.1 → 2026.6.5-beta.2

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,4 +1,5 @@
1
- import { M as getMSTeamsRuntime, h as fetchWithSsrFGuard$1 } from "./runtime-api-BlvMnDKz.js";
1
+ import { t as getMSTeamsRuntime } from "./runtime-BS5AZrKK.js";
2
+ import { fetchWithSsrFGuard as fetchWithSsrFGuard$1 } from "./runtime-api.js";
2
3
  import { createRequire } from "node:module";
3
4
  import { mapAllowlistResolutionInputs } from "openclaw/plugin-sdk/allow-from";
4
5
  import { isRecord as isRecord$1, normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -1375,4 +1376,4 @@ async function resolveMSTeamsUserAllowlist(params) {
1375
1376
  });
1376
1377
  }
1377
1378
  //#endregion
1378
- export { extractInlineImageCandidates as $, MSTEAMS_OAUTH_CALLBACK_PORT as A, isAllowedBotFrameworkServiceUrl as B, resolveMSTeamsCredentials as C, exchangeMSTeamsCodeForTokens as D, normalizeSecretInputString as E, createMSTeamsTokenProvider as F, validateMSTeamsProactiveServiceUrlBoundary as G, tryNormalizeBotFrameworkServiceUrl as H, loadMSTeamsSdkWithAuth as I, IMG_SRC_RE as J, ATTACHMENT_TAG_RE as K, buildUserAgent as L, buildMSTeamsAuthEndpoint as M, readAccessToken as N, MSTEAMS_DEFAULT_DELEGATED_SCOPES as O, createMSTeamsExpressAdapter as P, extractHtmlFromAttachment as Q, ensureUserAgentHeader as R, loadDelegatedTokens as S, resolveMSTeamsStorePath as T, createMSTeamsHttpError as U, normalizeBotFrameworkServiceUrl as V, resolveMSTeamsSdkCloudOptions as W, encodeGraphShareId as X, applyAuthorizationHeaderForUrl as Y, estimateBase64DecodedBytes as Z, patchGraphJson as _, parseMSTeamsTeamChannelInput as a, normalizeContentType as at, resolveGraphToken as b, resolveMSTeamsUserAllowlist as c, resolveMediaSsrfPolicy as ct, escapeOData as d, safeHostForUrl as dt, inferPlaceholder as et, fetchGraphAbsoluteUrl as f, tryBuildGraphSharesUrlForSharedLink as ft, normalizeQuery as g, listTeamsByName as h, parseMSTeamsConversationId as i, isUrlAllowed as it, MSTEAMS_OAUTH_REDIRECT_URI as j, MSTEAMS_OAUTH_CALLBACK_PATH as k, searchGraphUsers as l, resolveRequestUrl as lt, listChannelsForTeam as m, normalizeMSTeamsMessagingTarget as n, isLikelyImageAttachment as nt, parseMSTeamsTeamEntry as o, readNestedString as ot, fetchGraphJson as p, GRAPH_ROOT as q, normalizeMSTeamsUserInput as r, isRecord$1 as rt, resolveMSTeamsChannelAllowlist as s, resolveAttachmentFetchPolicy as st, looksLikeMSTeamsTargetId as t, isDownloadableAttachment as tt, deleteGraphRequest as u, safeFetchWithPolicy as ut, postGraphBetaJson as v, saveDelegatedTokens as w, hasConfiguredMSTeamsCredentials as x, postGraphJson as y, describeBotFrameworkServiceUrlHost as z };
1379
+ export { inferPlaceholder as $, MSTEAMS_OAUTH_REDIRECT_URI as A, normalizeBotFrameworkServiceUrl as B, resolveMSTeamsCredentials as C, MSTEAMS_DEFAULT_DELEGATED_SCOPES as D, exchangeMSTeamsCodeForTokens as E, loadMSTeamsSdkWithAuth as F, ATTACHMENT_TAG_RE as G, createMSTeamsHttpError as H, buildUserAgent as I, applyAuthorizationHeaderForUrl as J, GRAPH_ROOT as K, ensureUserAgentHeader as L, readAccessToken as M, createMSTeamsExpressAdapter as N, MSTEAMS_OAUTH_CALLBACK_PATH as O, createMSTeamsTokenProvider as P, extractInlineImageCandidates as Q, describeBotFrameworkServiceUrlHost as R, loadDelegatedTokens as S, normalizeSecretInputString as T, resolveMSTeamsSdkCloudOptions as U, tryNormalizeBotFrameworkServiceUrl as V, validateMSTeamsProactiveServiceUrlBoundary as W, estimateBase64DecodedBytes as X, encodeGraphShareId as Y, extractHtmlFromAttachment as Z, patchGraphJson as _, parseMSTeamsTeamChannelInput as a, readNestedString as at, resolveGraphToken as b, resolveMSTeamsUserAllowlist as c, resolveRequestUrl as ct, escapeOData as d, tryBuildGraphSharesUrlForSharedLink as dt, isDownloadableAttachment as et, fetchGraphAbsoluteUrl as f, normalizeQuery as g, listTeamsByName as h, parseMSTeamsConversationId as i, normalizeContentType as it, buildMSTeamsAuthEndpoint as j, MSTEAMS_OAUTH_CALLBACK_PORT as k, searchGraphUsers as l, safeFetchWithPolicy as lt, listChannelsForTeam as m, normalizeMSTeamsMessagingTarget as n, isRecord$1 as nt, parseMSTeamsTeamEntry as o, resolveAttachmentFetchPolicy as ot, fetchGraphJson as p, IMG_SRC_RE as q, normalizeMSTeamsUserInput as r, isUrlAllowed as rt, resolveMSTeamsChannelAllowlist as s, resolveMediaSsrfPolicy as st, looksLikeMSTeamsTargetId as t, isLikelyImageAttachment as tt, deleteGraphRequest as u, safeHostForUrl as ut, postGraphBetaJson as v, saveDelegatedTokens as w, hasConfiguredMSTeamsCredentials as x, postGraphJson as y, isAllowedBotFrameworkServiceUrl as z };
@@ -0,0 +1,8 @@
1
+ import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
2
+ //#region extensions/msteams/src/runtime.ts
3
+ const { setRuntime: setMSTeamsRuntime, getRuntime: getMSTeamsRuntime, tryGetRuntime: getOptionalMSTeamsRuntime } = createPluginRuntimeStore({
4
+ pluginId: "msteams",
5
+ errorMessage: "MSTeams runtime not initialized"
6
+ });
7
+ //#endregion
8
+ export { getOptionalMSTeamsRuntime as n, setMSTeamsRuntime as r, getMSTeamsRuntime as t };
@@ -1,2 +1,20 @@
1
- import { A as summarizeMapping, C as normalizeStringEntries, D as resolveDefaultGroupPolicy, E as resolveChannelMediaMaxBytes, O as resolveNestedAllowlistDecision, P as setMSTeamsRuntime, S as normalizeChannelSlug, T as resolveChannelEntryMatchWithFallback, _ as isDangerousNameMatchingEnabled, a as buildMediaPayload, b as logTypingFailure, c as createChannelMessageReplyPipeline, d as detectMime, f as dispatchReplyFromConfigWithSettledDispatcher, g as getFileExtension, h as fetchWithSsrFGuard, i as buildChannelKeyCandidates, j as withFileLock, k as resolveToolsBySender, l as createChannelPairingController, m as extractOriginalFilename, n as DEFAULT_WEBHOOK_MAX_BODY_BYTES, o as buildProbeChannelStatusSummary, p as extensionForMime, r as PAIRING_APPROVED_MESSAGE, s as chunkTextForOutbound, t as DEFAULT_ACCOUNT_ID, u as createDefaultChannelRuntimeState, v as keepHttpServerTaskAlive, w as resolveAllowlistMatchSimple, x as mergeAllowlist, y as loadOutboundMediaFromUrl } from "./runtime-api-BlvMnDKz.js";
1
+ import { r as setMSTeamsRuntime } from "./runtime-BS5AZrKK.js";
2
+ import { mergeAllowlist, resolveAllowlistMatchSimple, summarizeMapping } from "openclaw/plugin-sdk/allow-from";
3
+ import { createChannelMessageReplyPipeline, keepHttpServerTaskAlive, logTypingFailure } from "openclaw/plugin-sdk/channel-outbound";
4
+ import { createChannelPairingController } from "openclaw/plugin-sdk/channel-pairing";
5
+ import { resolveToolsBySender } from "openclaw/plugin-sdk/channel-policy";
6
+ import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
7
+ import { PAIRING_APPROVED_MESSAGE, buildProbeChannelStatusSummary, createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/channel-status";
8
+ import { buildChannelKeyCandidates, normalizeChannelSlug, resolveChannelEntryMatchWithFallback, resolveNestedAllowlistDecision } from "openclaw/plugin-sdk/channel-targets";
9
+ import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
10
+ import { resolveDefaultGroupPolicy } from "openclaw/plugin-sdk/runtime-group-policy";
11
+ import { withFileLock } from "openclaw/plugin-sdk/file-lock";
12
+ import { detectMime, extensionForMime, extractOriginalFilename, getFileExtension, resolveChannelMediaMaxBytes } from "openclaw/plugin-sdk/media-runtime";
13
+ import { dispatchReplyFromConfigWithSettledDispatcher } from "openclaw/plugin-sdk/channel-inbound";
14
+ import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/outbound-media";
15
+ import { buildMediaPayload } from "openclaw/plugin-sdk/reply-payload";
16
+ import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/ssrf-runtime";
17
+ import { normalizeStringEntries } from "openclaw/plugin-sdk/string-normalization-runtime";
18
+ import { chunkTextForOutbound } from "openclaw/plugin-sdk/text-chunking";
19
+ import { DEFAULT_WEBHOOK_MAX_BODY_BYTES } from "openclaw/plugin-sdk/webhook-ingress";
2
20
  export { DEFAULT_ACCOUNT_ID, DEFAULT_WEBHOOK_MAX_BODY_BYTES, PAIRING_APPROVED_MESSAGE, buildChannelKeyCandidates, buildMediaPayload, buildProbeChannelStatusSummary, chunkTextForOutbound, createChannelMessageReplyPipeline, createChannelPairingController, createDefaultChannelRuntimeState, detectMime, dispatchReplyFromConfigWithSettledDispatcher, extensionForMime, extractOriginalFilename, fetchWithSsrFGuard, getFileExtension, isDangerousNameMatchingEnabled, keepHttpServerTaskAlive, loadOutboundMediaFromUrl, logTypingFailure, mergeAllowlist, normalizeChannelSlug, normalizeStringEntries, resolveAllowlistMatchSimple, resolveChannelEntryMatchWithFallback, resolveChannelMediaMaxBytes, resolveDefaultGroupPolicy, resolveNestedAllowlistDecision, resolveToolsBySender, setMSTeamsRuntime, summarizeMapping, withFileLock };
@@ -1,6 +1,6 @@
1
- import { C as resolveMSTeamsCredentials } from "./resolve-allowlist-C6VVTfbj.js";
1
+ import { C as resolveMSTeamsCredentials } from "./resolve-allowlist-BzIUWmMm.js";
2
2
  import { t as MSTeamsChannelConfigSchema } from "./config-schema-BL4qQZiA.js";
3
- import { c as msteamsSetupAdapter, t as msteamsSetupWizard } from "./setup-surface-DdyMxq-W.js";
3
+ import { c as msteamsSetupAdapter, t as msteamsSetupWizard } from "./setup-surface-Dik4VU7f.js";
4
4
  import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
5
5
  import { formatAllowFromLowercase } from "openclaw/plugin-sdk/allow-from";
6
6
  import { createTopLevelChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
@@ -1,4 +1,4 @@
1
- import { C as resolveMSTeamsCredentials, E as normalizeSecretInputString, c as resolveMSTeamsUserAllowlist, o as parseMSTeamsTeamEntry, s as resolveMSTeamsChannelAllowlist, w as saveDelegatedTokens, x as hasConfiguredMSTeamsCredentials } from "./resolve-allowlist-C6VVTfbj.js";
1
+ import { C as resolveMSTeamsCredentials, T as normalizeSecretInputString, c as resolveMSTeamsUserAllowlist, o as parseMSTeamsTeamEntry, s as resolveMSTeamsChannelAllowlist, w as saveDelegatedTokens, x as hasConfiguredMSTeamsCredentials } from "./resolve-allowlist-BzIUWmMm.js";
2
2
  import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
3
3
  import { asFiniteNumberInRange, parseStrictFiniteNumber } from "openclaw/plugin-sdk/number-runtime";
4
4
  import { DEFAULT_ACCOUNT_ID, createSetupTranslator, createStandardChannelSetupStatus, createTopLevelChannelAllowFromSetter, createTopLevelChannelDmPolicy, createTopLevelChannelGroupPolicySetter, mergeAllowFromEntries, splitSetupEntries } from "openclaw/plugin-sdk/setup";
@@ -449,7 +449,7 @@ const msteamsSetupWizard = {
449
449
  }
450
450
  };
451
451
  try {
452
- const { loginMSTeamsDelegated } = await import("./oauth-CJj-b_Kn.js");
452
+ const { loginMSTeamsDelegated } = await import("./oauth-CDUB5xPY.js");
453
453
  const progress = params.prompter.progress(t("wizard.msteams.delegatedOAuthProgress"));
454
454
  saveDelegatedTokens(await loginMSTeamsDelegated({
455
455
  isRemote: true,
@@ -1,8 +1,11 @@
1
- import { A as summarizeMapping, D as resolveDefaultGroupPolicy, E as resolveChannelMediaMaxBytes, M as getMSTeamsRuntime, N as getOptionalMSTeamsRuntime, _ as isDangerousNameMatchingEnabled, a as buildMediaPayload, b as logTypingFailure, c as createChannelMessageReplyPipeline, f as dispatchReplyFromConfigWithSettledDispatcher$1, l as createChannelPairingController, n as DEFAULT_WEBHOOK_MAX_BODY_BYTES, t as DEFAULT_ACCOUNT_ID, v as keepHttpServerTaskAlive, x as mergeAllowlist } from "./runtime-api-BlvMnDKz.js";
2
- import { $ as extractInlineImageCandidates, C as resolveMSTeamsCredentials, F as createMSTeamsTokenProvider, H as tryNormalizeBotFrameworkServiceUrl, I as loadMSTeamsSdkWithAuth, J as IMG_SRC_RE, K as ATTACHMENT_TAG_RE, P as createMSTeamsExpressAdapter, Q as extractHtmlFromAttachment, R as ensureUserAgentHeader, T as resolveMSTeamsStorePath, W as resolveMSTeamsSdkCloudOptions, X as encodeGraphShareId, Y as applyAuthorizationHeaderForUrl, Z as estimateBase64DecodedBytes, at as normalizeContentType, c as resolveMSTeamsUserAllowlist, ct as resolveMediaSsrfPolicy, dt as safeHostForUrl, et as inferPlaceholder, ft as tryBuildGraphSharesUrlForSharedLink, it as isUrlAllowed, lt as resolveRequestUrl, nt as isLikelyImageAttachment, ot as readNestedString, p as fetchGraphJson, q as GRAPH_ROOT, rt as isRecord$1, s as resolveMSTeamsChannelAllowlist, st as resolveAttachmentFetchPolicy, tt as isDownloadableAttachment, ut as safeFetchWithPolicy } from "./resolve-allowlist-C6VVTfbj.js";
3
- import { a as resolveMSTeamsReplyPolicy, i as resolveMSTeamsAllowlistMatch, o as resolveMSTeamsRouteConfig } from "./channel-BwNnuHbh.js";
4
- import { a as formatUnknownError, i as formatMSTeamsSendErrorHint, r as classifyMSTeamsSendError } from "./setup-surface-DdyMxq-W.js";
5
- import { C as resolveMSTeamsSqliteStateEnv, E as readJsonFile, S as createMSTeamsConversationStoreState, T as withMSTeamsSqliteMutationLock, _ as buildFileInfoCard, b as createMSTeamsPollStoreState, c as renderReplyPayloadsToMessages, d as withRevokedProxyFallback, f as resolveGraphChatId, g as removePendingUploadFs, h as getPendingUploadFs, l as sendMSTeamsMessages, m as removePendingUpload, p as getPendingUpload, s as buildConversationReference, u as sendMSTeamsActivityWithReference, v as parseFileConsentInvoke, w as toPluginJsonValue, x as extractMSTeamsPollVote, y as uploadToConsentUrl } from "./probe-bq_Uev4c.js";
1
+ import { n as getOptionalMSTeamsRuntime, t as getMSTeamsRuntime } from "./runtime-BS5AZrKK.js";
2
+ import { DEFAULT_ACCOUNT_ID, DEFAULT_WEBHOOK_MAX_BODY_BYTES, buildMediaPayload, createChannelMessageReplyPipeline, createChannelPairingController, dispatchReplyFromConfigWithSettledDispatcher as dispatchReplyFromConfigWithSettledDispatcher$1, isDangerousNameMatchingEnabled, keepHttpServerTaskAlive, logTypingFailure, mergeAllowlist, resolveChannelMediaMaxBytes, resolveDefaultGroupPolicy, summarizeMapping } from "./runtime-api.js";
3
+ import { $ as inferPlaceholder, C as resolveMSTeamsCredentials, F as loadMSTeamsSdkWithAuth, G as ATTACHMENT_TAG_RE, J as applyAuthorizationHeaderForUrl, K as GRAPH_ROOT, L as ensureUserAgentHeader, N as createMSTeamsExpressAdapter, P as createMSTeamsTokenProvider, Q as extractInlineImageCandidates, U as resolveMSTeamsSdkCloudOptions, V as tryNormalizeBotFrameworkServiceUrl, X as estimateBase64DecodedBytes, Y as encodeGraphShareId, Z as extractHtmlFromAttachment, at as readNestedString, c as resolveMSTeamsUserAllowlist, ct as resolveRequestUrl, dt as tryBuildGraphSharesUrlForSharedLink, et as isDownloadableAttachment, it as normalizeContentType, lt as safeFetchWithPolicy, nt as isRecord$1, ot as resolveAttachmentFetchPolicy, p as fetchGraphJson, q as IMG_SRC_RE, rt as isUrlAllowed, s as resolveMSTeamsChannelAllowlist, st as resolveMediaSsrfPolicy, tt as isLikelyImageAttachment, ut as safeHostForUrl } from "./resolve-allowlist-BzIUWmMm.js";
4
+ import { a as resolveMSTeamsReplyPolicy, i as resolveMSTeamsAllowlistMatch, o as resolveMSTeamsRouteConfig } from "./channel--oT3fyD5.js";
5
+ import { a as formatUnknownError, i as formatMSTeamsSendErrorHint, r as classifyMSTeamsSendError } from "./setup-surface-Dik4VU7f.js";
6
+ import { l as createMSTeamsPollStoreState, u as extractMSTeamsPollVote, v as createMSTeamsConversationStoreState } from "./polls-C1VgSvKE.js";
7
+ import { i as createMSTeamsSsoTokenStoreFs } from "./sso-token-store-BYZaKr82.js";
8
+ import { _ as buildFileInfoCard, c as renderReplyPayloadsToMessages, d as withRevokedProxyFallback, f as resolveGraphChatId, g as removePendingUploadFs, h as getPendingUploadFs, l as sendMSTeamsMessages, m as removePendingUpload, p as getPendingUpload, s as buildConversationReference, u as sendMSTeamsActivityWithReference, v as parseFileConsentInvoke, y as uploadToConsentUrl } from "./probe-C-rWMb-m.js";
6
9
  import { formatAllowlistMatchMeta } from "openclaw/plugin-sdk/allow-from";
7
10
  import { buildChannelProgressDraftLine, buildChannelProgressDraftLineForEntry, createChannelProgressDraftGate, formatChannelProgressDraftText, isChannelProgressDraftWorkToolName, mergeChannelProgressDraftLine, normalizeChannelProgressDraftLineIdentity, resolveChannelPreviewStreamMode, resolveChannelProgressDraftMaxLines, resolveChannelStreamingBlockEnabled, resolveChannelStreamingPreviewToolProgress, resolveChannelStreamingSuppressDefaultToolProgressMessages } from "openclaw/plugin-sdk/channel-outbound";
8
11
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -12,8 +15,7 @@ import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/ssrf-runtime";
12
15
  import path from "node:path";
13
16
  import { asDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
14
17
  import { appendRegularFile } from "openclaw/plugin-sdk/security-runtime";
15
- import crypto, { createHash } from "node:crypto";
16
- import fs from "node:fs/promises";
18
+ import crypto from "node:crypto";
17
19
  import { resolveThreadSessionKeys } from "openclaw/plugin-sdk/routing";
18
20
  import { channelIngressRoutes, resolveStableChannelMessageIngress } from "openclaw/plugin-sdk/channel-ingress-runtime";
19
21
  import { filterSupplementalContextItems, resolveChannelContextVisibilityMode } from "openclaw/plugin-sdk/context-visibility-runtime";
@@ -3425,123 +3427,6 @@ async function runMSTeamsFileConsentInvokeHandler(context, log) {
3425
3427
  }
3426
3428
  }
3427
3429
  //#endregion
3428
- //#region extensions/msteams/src/sso-token-store.ts
3429
- /**
3430
- * SQLite-backed store for Bot Framework OAuth SSO tokens.
3431
- *
3432
- * Tokens are keyed by (connectionName, userId). `userId` should be the
3433
- * stable AAD object ID (`activity.from.aadObjectId`) when available,
3434
- * falling back to the Bot Framework `activity.from.id`.
3435
- *
3436
- * The store is intentionally minimal: it persists the exchanged user
3437
- * token plus its expiration so consumers (for example tool handlers
3438
- * that call Microsoft Graph with delegated permissions) can fetch a
3439
- * valid token without reaching back into Bot Framework every turn.
3440
- */
3441
- const STORE_FILENAME = "msteams-sso-tokens.json";
3442
- const SSO_TOKENS_NAMESPACE = "sso-tokens";
3443
- const SSO_TOKEN_MIGRATIONS_NAMESPACE = "sso-token-migrations";
3444
- const SSO_TOKEN_LOCK_FILENAME = "msteams-sso-tokens.sqlite.lock";
3445
- const MAX_SSO_TOKENS = 5e3;
3446
- const STORE_KEY_VERSION_PREFIX = "v2:";
3447
- function makeKey(connectionName, userId) {
3448
- return `${STORE_KEY_VERSION_PREFIX}${createHash("sha256").update(JSON.stringify([connectionName, userId])).digest("hex")}`;
3449
- }
3450
- function buildMigrationKey(filePath) {
3451
- return `legacy-json:${createHash("sha256").update(filePath).digest("hex")}`;
3452
- }
3453
- function buildMigrationContentKey(filePath, value) {
3454
- return `legacy-json-content:${createHash("sha256").update(filePath).update("\0").update(JSON.stringify(value) ?? "undefined").digest("hex")}`;
3455
- }
3456
- function createTokenStore(params) {
3457
- return getMSTeamsRuntime().state.openKeyedStore({
3458
- namespace: SSO_TOKENS_NAMESPACE,
3459
- maxEntries: MAX_SSO_TOKENS,
3460
- env: resolveMSTeamsSqliteStateEnv(params)
3461
- });
3462
- }
3463
- function createMigrationStore(params) {
3464
- return getMSTeamsRuntime().state.openKeyedStore({
3465
- namespace: SSO_TOKEN_MIGRATIONS_NAMESPACE,
3466
- maxEntries: 100,
3467
- env: resolveMSTeamsSqliteStateEnv(params)
3468
- });
3469
- }
3470
- function normalizeStoredToken(value) {
3471
- if (!value || typeof value !== "object") return null;
3472
- const token = value;
3473
- if (typeof token.connectionName !== "string" || !token.connectionName || typeof token.userId !== "string" || !token.userId || typeof token.token !== "string" || !token.token || typeof token.updatedAt !== "string" || !token.updatedAt) return null;
3474
- return {
3475
- connectionName: token.connectionName,
3476
- userId: token.userId,
3477
- token: token.token,
3478
- ...typeof token.expiresAt === "string" ? { expiresAt: token.expiresAt } : {},
3479
- updatedAt: token.updatedAt
3480
- };
3481
- }
3482
- function isSsoStoreData(value) {
3483
- if (!value || typeof value !== "object") return false;
3484
- const obj = value;
3485
- return obj.version === 1 && typeof obj.tokens === "object" && obj.tokens !== null;
3486
- }
3487
- function createMSTeamsSsoTokenStoreFs(params) {
3488
- const legacyFilePath = resolveMSTeamsStorePath({
3489
- filename: STORE_FILENAME,
3490
- env: params?.env,
3491
- homedir: params?.homedir,
3492
- stateDir: params?.stateDir,
3493
- storePath: params?.storePath
3494
- });
3495
- const empty = {
3496
- version: 1,
3497
- tokens: {}
3498
- };
3499
- const tokenStore = createTokenStore(params);
3500
- const migrationStore = createMigrationStore(params);
3501
- const migrationKey = buildMigrationKey(legacyFilePath);
3502
- let legacyImportPromise = null;
3503
- const importLegacyStore = async () => {
3504
- const imported = await migrationStore.lookup(migrationKey) !== void 0;
3505
- const { value, exists } = await readJsonFile(legacyFilePath, empty);
3506
- const contentKey = exists ? buildMigrationContentKey(legacyFilePath, value) : null;
3507
- if (contentKey && await migrationStore.lookup(contentKey)) return;
3508
- if (exists && isSsoStoreData(value)) for (const stored of Object.values(value.tokens)) {
3509
- const normalized = normalizeStoredToken(stored);
3510
- if (!normalized) continue;
3511
- await tokenStore.registerIfAbsent(makeKey(normalized.connectionName, normalized.userId), toPluginJsonValue(normalized));
3512
- }
3513
- if (contentKey) await migrationStore.register(contentKey, { importedAt: (/* @__PURE__ */ new Date()).toISOString() });
3514
- if (!imported) await migrationStore.register(migrationKey, { importedAt: (/* @__PURE__ */ new Date()).toISOString() });
3515
- if (exists) await fs.rm(legacyFilePath, { force: true }).catch(() => {});
3516
- };
3517
- const ensureLegacyImported = async () => {
3518
- if (!legacyImportPromise) legacyImportPromise = withMSTeamsSqliteMutationLock(params, SSO_TOKEN_LOCK_FILENAME, () => importLegacyStore()).finally(() => {
3519
- legacyImportPromise = null;
3520
- });
3521
- await legacyImportPromise;
3522
- };
3523
- return {
3524
- async get({ connectionName, userId }) {
3525
- await ensureLegacyImported();
3526
- return await tokenStore.lookup(makeKey(connectionName, userId)) ?? null;
3527
- },
3528
- async save(token) {
3529
- await withMSTeamsSqliteMutationLock(params, SSO_TOKEN_LOCK_FILENAME, async () => {
3530
- await importLegacyStore();
3531
- await tokenStore.register(makeKey(token.connectionName, token.userId), toPluginJsonValue({ ...token }));
3532
- });
3533
- },
3534
- async remove({ connectionName, userId }) {
3535
- let removed = false;
3536
- await withMSTeamsSqliteMutationLock(params, SSO_TOKEN_LOCK_FILENAME, async () => {
3537
- await importLegacyStore();
3538
- removed = await tokenStore.delete(makeKey(connectionName, userId));
3539
- });
3540
- return removed;
3541
- }
3542
- };
3543
- }
3544
- //#endregion
3545
3430
  //#region extensions/msteams/src/webhook-timeouts.ts
3546
3431
  const MSTEAMS_WEBHOOK_INACTIVITY_TIMEOUT_MS = 3e4;
3547
3432
  const MSTEAMS_WEBHOOK_REQUEST_TIMEOUT_MS = 3e4;
@@ -0,0 +1,70 @@
1
+ import { t as getMSTeamsRuntime } from "./runtime-BS5AZrKK.js";
2
+ import { C as toPluginJsonValue, S as resolveMSTeamsSqliteStateEnv, w as withMSTeamsSqliteMutationLock } from "./polls-C1VgSvKE.js";
3
+ import { createHash } from "node:crypto";
4
+ //#region extensions/msteams/src/sso-token-store.ts
5
+ /**
6
+ * SQLite-backed store for Bot Framework OAuth SSO tokens.
7
+ *
8
+ * Tokens are keyed by (connectionName, userId). `userId` should be the
9
+ * stable AAD object ID (`activity.from.aadObjectId`) when available,
10
+ * falling back to the Bot Framework `activity.from.id`.
11
+ *
12
+ * The store is intentionally minimal: it persists the exchanged user
13
+ * token plus its expiration so consumers (for example tool handlers
14
+ * that call Microsoft Graph with delegated permissions) can fetch a
15
+ * valid token without reaching back into Bot Framework every turn.
16
+ */
17
+ const MSTEAMS_SSO_TOKENS_LEGACY_FILENAME = "msteams-sso-tokens.json";
18
+ const MSTEAMS_SSO_TOKENS_NAMESPACE = "sso-tokens";
19
+ const SSO_TOKEN_LOCK_FILENAME = "msteams-sso-tokens.sqlite.lock";
20
+ const MSTEAMS_MAX_SSO_TOKENS = 5e3;
21
+ const STORE_KEY_VERSION_PREFIX = "v2:";
22
+ function makeMSTeamsSsoTokenStoreKey(connectionName, userId) {
23
+ return `${STORE_KEY_VERSION_PREFIX}${createHash("sha256").update(JSON.stringify([connectionName, userId])).digest("hex")}`;
24
+ }
25
+ function createTokenStore(params) {
26
+ return getMSTeamsRuntime().state.openKeyedStore({
27
+ namespace: MSTEAMS_SSO_TOKENS_NAMESPACE,
28
+ maxEntries: MSTEAMS_MAX_SSO_TOKENS,
29
+ env: resolveMSTeamsSqliteStateEnv(params)
30
+ });
31
+ }
32
+ function normalizeMSTeamsSsoStoredToken(value) {
33
+ if (!value || typeof value !== "object") return null;
34
+ const token = value;
35
+ if (typeof token.connectionName !== "string" || !token.connectionName || typeof token.userId !== "string" || !token.userId || typeof token.token !== "string" || !token.token || typeof token.updatedAt !== "string" || !token.updatedAt) return null;
36
+ return {
37
+ connectionName: token.connectionName,
38
+ userId: token.userId,
39
+ token: token.token,
40
+ ...typeof token.expiresAt === "string" ? { expiresAt: token.expiresAt } : {},
41
+ updatedAt: token.updatedAt
42
+ };
43
+ }
44
+ function isMSTeamsSsoStoreData(value) {
45
+ if (!value || typeof value !== "object") return false;
46
+ const obj = value;
47
+ return obj.version === 1 && typeof obj.tokens === "object" && obj.tokens !== null;
48
+ }
49
+ function createMSTeamsSsoTokenStoreFs(params) {
50
+ const tokenStore = createTokenStore(params);
51
+ return {
52
+ async get({ connectionName, userId }) {
53
+ return await tokenStore.lookup(makeMSTeamsSsoTokenStoreKey(connectionName, userId)) ?? null;
54
+ },
55
+ async save(token) {
56
+ await withMSTeamsSqliteMutationLock(params, SSO_TOKEN_LOCK_FILENAME, async () => {
57
+ await tokenStore.register(makeMSTeamsSsoTokenStoreKey(token.connectionName, token.userId), toPluginJsonValue({ ...token }));
58
+ });
59
+ },
60
+ async remove({ connectionName, userId }) {
61
+ let removed = false;
62
+ await withMSTeamsSqliteMutationLock(params, SSO_TOKEN_LOCK_FILENAME, async () => {
63
+ removed = await tokenStore.delete(makeMSTeamsSsoTokenStoreKey(connectionName, userId));
64
+ });
65
+ return removed;
66
+ }
67
+ };
68
+ }
69
+ //#endregion
70
+ export { isMSTeamsSsoStoreData as a, createMSTeamsSsoTokenStoreFs as i, MSTEAMS_SSO_TOKENS_LEGACY_FILENAME as n, makeMSTeamsSsoTokenStoreKey as o, MSTEAMS_SSO_TOKENS_NAMESPACE as r, normalizeMSTeamsSsoStoredToken as s, MSTEAMS_MAX_SSO_TOKENS as t };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@openclaw/msteams",
3
- "version": "2026.6.2-beta.1",
3
+ "version": "2026.6.5-beta.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@openclaw/msteams",
9
- "version": "2026.6.2-beta.1",
9
+ "version": "2026.6.5-beta.2",
10
10
  "dependencies": {
11
11
  "@azure/identity": "4.13.1",
12
12
  "@microsoft/teams.api": "2.0.12",
@@ -15,7 +15,7 @@
15
15
  "typebox": "1.1.39"
16
16
  },
17
17
  "peerDependencies": {
18
- "openclaw": ">=2026.6.2-beta.1"
18
+ "openclaw": ">=2026.6.5-beta.2"
19
19
  },
20
20
  "peerDependenciesMeta": {
21
21
  "openclaw": {
@@ -353,6 +353,9 @@
353
353
  "raw",
354
354
  "status"
355
355
  ]
356
+ },
357
+ "commentary": {
358
+ "type": "boolean"
356
359
  }
357
360
  },
358
361
  "additionalProperties": false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/msteams",
3
- "version": "2026.6.2-beta.1",
3
+ "version": "2026.6.5-beta.2",
4
4
  "description": "OpenClaw Microsoft Teams channel plugin for bot conversations.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,7 +15,7 @@
15
15
  "typebox": "1.1.39"
16
16
  },
17
17
  "peerDependencies": {
18
- "openclaw": ">=2026.6.2-beta.1"
18
+ "openclaw": ">=2026.6.5-beta.2"
19
19
  },
20
20
  "peerDependenciesMeta": {
21
21
  "openclaw": {
@@ -51,10 +51,10 @@
51
51
  "minHostVersion": ">=2026.4.10"
52
52
  },
53
53
  "compat": {
54
- "pluginApi": ">=2026.6.2-beta.1"
54
+ "pluginApi": ">=2026.6.5-beta.2"
55
55
  },
56
56
  "build": {
57
- "openclawVersion": "2026.6.2-beta.1"
57
+ "openclawVersion": "2026.6.5-beta.2"
58
58
  },
59
59
  "release": {
60
60
  "publishToClawHub": true,
@@ -1,26 +0,0 @@
1
- import { mergeAllowlist, resolveAllowlistMatchSimple, summarizeMapping } from "openclaw/plugin-sdk/allow-from";
2
- import { createChannelMessageReplyPipeline, keepHttpServerTaskAlive, logTypingFailure } from "openclaw/plugin-sdk/channel-outbound";
3
- import { createChannelPairingController } from "openclaw/plugin-sdk/channel-pairing";
4
- import { resolveToolsBySender } from "openclaw/plugin-sdk/channel-policy";
5
- import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
6
- import { PAIRING_APPROVED_MESSAGE, buildProbeChannelStatusSummary, createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/channel-status";
7
- import { buildChannelKeyCandidates, normalizeChannelSlug, resolveChannelEntryMatchWithFallback, resolveNestedAllowlistDecision } from "openclaw/plugin-sdk/channel-targets";
8
- import { isDangerousNameMatchingEnabled } from "openclaw/plugin-sdk/dangerous-name-runtime";
9
- import { resolveDefaultGroupPolicy } from "openclaw/plugin-sdk/runtime-group-policy";
10
- import { withFileLock as withFileLock$1 } from "openclaw/plugin-sdk/file-lock";
11
- import { detectMime, extensionForMime, extractOriginalFilename, getFileExtension, resolveChannelMediaMaxBytes } from "openclaw/plugin-sdk/media-runtime";
12
- import { dispatchReplyFromConfigWithSettledDispatcher as dispatchReplyFromConfigWithSettledDispatcher$1 } from "openclaw/plugin-sdk/channel-inbound";
13
- import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/outbound-media";
14
- import { buildMediaPayload } from "openclaw/plugin-sdk/reply-payload";
15
- import { fetchWithSsrFGuard as fetchWithSsrFGuard$1 } from "openclaw/plugin-sdk/ssrf-runtime";
16
- import { normalizeStringEntries } from "openclaw/plugin-sdk/string-normalization-runtime";
17
- import { chunkTextForOutbound } from "openclaw/plugin-sdk/text-chunking";
18
- import { DEFAULT_WEBHOOK_MAX_BODY_BYTES } from "openclaw/plugin-sdk/webhook-ingress";
19
- import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
20
- //#region extensions/msteams/src/runtime.ts
21
- const { setRuntime: setMSTeamsRuntime, getRuntime: getMSTeamsRuntime, tryGetRuntime: getOptionalMSTeamsRuntime } = createPluginRuntimeStore({
22
- pluginId: "msteams",
23
- errorMessage: "MSTeams runtime not initialized"
24
- });
25
- //#endregion
26
- export { summarizeMapping as A, normalizeStringEntries as C, resolveDefaultGroupPolicy as D, resolveChannelMediaMaxBytes as E, getMSTeamsRuntime as M, getOptionalMSTeamsRuntime as N, resolveNestedAllowlistDecision as O, setMSTeamsRuntime as P, normalizeChannelSlug as S, resolveChannelEntryMatchWithFallback as T, isDangerousNameMatchingEnabled as _, buildMediaPayload as a, logTypingFailure as b, createChannelMessageReplyPipeline as c, detectMime as d, dispatchReplyFromConfigWithSettledDispatcher$1 as f, getFileExtension as g, fetchWithSsrFGuard$1 as h, buildChannelKeyCandidates as i, withFileLock$1 as j, resolveToolsBySender as k, createChannelPairingController as l, extractOriginalFilename as m, DEFAULT_WEBHOOK_MAX_BODY_BYTES as n, buildProbeChannelStatusSummary as o, extensionForMime as p, PAIRING_APPROVED_MESSAGE as r, chunkTextForOutbound as s, DEFAULT_ACCOUNT_ID as t, createDefaultChannelRuntimeState as u, keepHttpServerTaskAlive as v, resolveAllowlistMatchSimple as w, mergeAllowlist as x, loadOutboundMediaFromUrl as y };