From 3f002b10d2810d0f0775b3adf94ae2a2ba925af0 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 1 May 2026 17:06:21 +0100 Subject: [PATCH] refactor: trim msteams helper exports --- extensions/msteams/src/attachments/shared.ts | 6 +++--- extensions/msteams/src/errors.ts | 4 ++-- .../msteams/src/feedback-reflection-prompt.ts | 2 +- extensions/msteams/src/feedback-reflection.ts | 4 ++-- .../msteams/src/file-consent-helpers.ts | 4 ++-- extensions/msteams/src/file-consent-invoke.ts | 2 +- extensions/msteams/src/file-consent.ts | 8 ++++---- .../msteams/src/graph-group-management.ts | 12 +++++------ extensions/msteams/src/graph-members.ts | 4 ++-- extensions/msteams/src/graph-teams.ts | 10 +++++----- extensions/msteams/src/graph-upload.ts | 12 +++++------ extensions/msteams/src/graph.ts | 8 ++++---- extensions/msteams/src/inbound.ts | 4 ++-- extensions/msteams/src/mentions.ts | 4 ++-- extensions/msteams/src/messenger.ts | 8 ++++---- extensions/msteams/src/monitor-handler.ts | 2 -- extensions/msteams/src/monitor.ts | 4 ++-- extensions/msteams/src/pending-uploads-fs.ts | 6 +++--- extensions/msteams/src/policy.ts | 6 +++--- extensions/msteams/src/polls.ts | 6 +++--- extensions/msteams/src/resolve-allowlist.ts | 4 ++-- extensions/msteams/src/sdk-types.ts | 2 +- extensions/msteams/src/sdk.ts | 6 +++--- extensions/msteams/src/secret-contract.ts | 3 +-- extensions/msteams/src/send-context.ts | 2 +- extensions/msteams/src/send.ts | 20 +++++++++---------- extensions/msteams/src/setup-surface.ts | 4 +--- extensions/msteams/src/sso-token-store.ts | 2 +- extensions/msteams/src/sso.ts | 14 ++++++------- extensions/msteams/src/storage.ts | 2 +- extensions/msteams/src/streaming-message.ts | 2 +- .../msteams/src/thread-parent-context.ts | 4 ++-- extensions/msteams/src/token.ts | 2 +- extensions/msteams/src/webhook-timeouts.ts | 2 +- extensions/msteams/src/welcome-card.ts | 2 +- 35 files changed, 91 insertions(+), 96 deletions(-) diff --git a/extensions/msteams/src/attachments/shared.ts b/extensions/msteams/src/attachments/shared.ts index 533ecf197bf..b970116ec11 100644 --- a/extensions/msteams/src/attachments/shared.ts +++ b/extensions/msteams/src/attachments/shared.ts @@ -34,12 +34,12 @@ type InlineImageLimitOptions = { maxInlineTotalBytes?: number; }; -export const IMAGE_EXT_RE = /\.(avif|bmp|gif|heic|heif|jpe?g|png|tiff?|webp)$/i; +const IMAGE_EXT_RE = /\.(avif|bmp|gif|heic|heif|jpe?g|png|tiff?|webp)$/i; export const IMG_SRC_RE = /]+src=["']([^"']+)["'][^>]*>/gi; export const ATTACHMENT_TAG_RE = /]+id=["']([^"']+)["'][^>]*>/gi; -export const DEFAULT_MEDIA_HOST_ALLOWLIST = [ +const DEFAULT_MEDIA_HOST_ALLOWLIST = [ "graph.microsoft.com", "graph.microsoft.us", "graph.microsoft.de", @@ -67,7 +67,7 @@ export const DEFAULT_MEDIA_HOST_ALLOWLIST = [ "microsoft.com", ] as const; -export const DEFAULT_MEDIA_AUTH_HOST_ALLOWLIST = [ +const DEFAULT_MEDIA_AUTH_HOST_ALLOWLIST = [ "api.botframework.com", "botframework.com", // Bot Framework Service URL (smba.trafficmanager.net) used for outbound diff --git a/extensions/msteams/src/errors.ts b/extensions/msteams/src/errors.ts index 47a223daf2d..d4da7035ff7 100644 --- a/extensions/msteams/src/errors.ts +++ b/extensions/msteams/src/errors.ts @@ -149,9 +149,9 @@ function extractRetryAfterMs(err: unknown): number | null { return null; } -export type MSTeamsSendErrorKind = "auth" | "throttled" | "transient" | "permanent" | "unknown"; +type MSTeamsSendErrorKind = "auth" | "throttled" | "transient" | "permanent" | "unknown"; -export type MSTeamsSendErrorClassification = { +type MSTeamsSendErrorClassification = { kind: MSTeamsSendErrorKind; statusCode?: number; retryAfterMs?: number; diff --git a/extensions/msteams/src/feedback-reflection-prompt.ts b/extensions/msteams/src/feedback-reflection-prompt.ts index 079879ee826..dfa7c2ee94d 100644 --- a/extensions/msteams/src/feedback-reflection-prompt.ts +++ b/extensions/msteams/src/feedback-reflection-prompt.ts @@ -3,7 +3,7 @@ import { normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/text-runti /** Max chars of the thumbed-down response to include in the reflection prompt. */ const MAX_RESPONSE_CHARS = 500; -export type ParsedReflectionResponse = { +type ParsedReflectionResponse = { learning: string; followUp: boolean; userMessage?: string; diff --git a/extensions/msteams/src/feedback-reflection.ts b/extensions/msteams/src/feedback-reflection.ts index 605ae402e18..731e97efd10 100644 --- a/extensions/msteams/src/feedback-reflection.ts +++ b/extensions/msteams/src/feedback-reflection.ts @@ -31,7 +31,7 @@ import { buildConversationReference } from "./messenger.js"; import type { MSTeamsMonitorLogger } from "./monitor-types.js"; import { getMSTeamsRuntime } from "./runtime.js"; -export type FeedbackEvent = { +type FeedbackEvent = { type: "custom"; event: "feedback"; ts: number; @@ -65,7 +65,7 @@ export function buildFeedbackEvent(params: { }; } -export type RunFeedbackReflectionParams = { +type RunFeedbackReflectionParams = { cfg: OpenClawConfig; adapter: MSTeamsAdapter; appId: string; diff --git a/extensions/msteams/src/file-consent-helpers.ts b/extensions/msteams/src/file-consent-helpers.ts index 2f8a8211ed5..e82140075d4 100644 --- a/extensions/msteams/src/file-consent-helpers.ts +++ b/extensions/msteams/src/file-consent-helpers.ts @@ -14,13 +14,13 @@ import { buildFileConsentCard } from "./file-consent.js"; import { storePendingUploadFs } from "./pending-uploads-fs.js"; import { storePendingUpload } from "./pending-uploads.js"; -export type FileConsentMedia = { +type FileConsentMedia = { buffer: Buffer; filename: string; contentType?: string; }; -export type FileConsentActivityResult = { +type FileConsentActivityResult = { activity: Record; uploadId: string; }; diff --git a/extensions/msteams/src/file-consent-invoke.ts b/extensions/msteams/src/file-consent-invoke.ts index e00fa1411a2..4ca27a98c6a 100644 --- a/extensions/msteams/src/file-consent-invoke.ts +++ b/extensions/msteams/src/file-consent-invoke.ts @@ -10,7 +10,7 @@ import type { MSTeamsTurnContext } from "./sdk-types.js"; /** * Handle fileConsent/invoke activities for large file uploads. */ -export async function handleMSTeamsFileConsentInvoke( +async function handleMSTeamsFileConsentInvoke( context: MSTeamsTurnContext, log: MSTeamsMonitorLogger, ): Promise { diff --git a/extensions/msteams/src/file-consent.ts b/extensions/msteams/src/file-consent.ts index ad34bc0b237..9829b5ae6fa 100644 --- a/extensions/msteams/src/file-consent.ts +++ b/extensions/msteams/src/file-consent.ts @@ -159,7 +159,7 @@ export async function validateConsentUploadUrl( } } -export interface FileConsentCardParams { +interface FileConsentCardParams { filename: string; description?: string; sizeInBytes: number; @@ -167,7 +167,7 @@ export interface FileConsentCardParams { context?: Record; } -export interface FileInfoCardParams { +interface FileInfoCardParams { filename: string; contentUrl: string; uniqueId: string; @@ -207,7 +207,7 @@ export function buildFileInfoCard(params: FileInfoCardParams) { }; } -export interface FileConsentUploadInfo { +interface FileConsentUploadInfo { name: string; uploadUrl: string; contentUrl: string; @@ -215,7 +215,7 @@ export interface FileConsentUploadInfo { fileType: string; } -export interface FileConsentResponse { +interface FileConsentResponse { action: "accept" | "decline"; uploadInfo?: FileConsentUploadInfo; context?: Record; diff --git a/extensions/msteams/src/graph-group-management.ts b/extensions/msteams/src/graph-group-management.ts index 3a3fd3071b6..db5493e90a2 100644 --- a/extensions/msteams/src/graph-group-management.ts +++ b/extensions/msteams/src/graph-group-management.ts @@ -13,14 +13,14 @@ import { // Add Participant // --------------------------------------------------------------------------- -export type AddParticipantMSTeamsParams = { +type AddParticipantMSTeamsParams = { cfg: OpenClawConfig; to: string; userId: string; role?: string; }; -export type AddParticipantMSTeamsResult = { +type AddParticipantMSTeamsResult = { added: { userId: string; chatId: string }; }; @@ -66,13 +66,13 @@ export async function addParticipantMSTeams( // Remove Participant // --------------------------------------------------------------------------- -export type RemoveParticipantMSTeamsParams = { +type RemoveParticipantMSTeamsParams = { cfg: OpenClawConfig; to: string; userId: string; }; -export type RemoveParticipantMSTeamsResult = { +type RemoveParticipantMSTeamsResult = { removed: { userId: string; chatId: string }; }; @@ -136,13 +136,13 @@ export async function removeParticipantMSTeams( // Rename Group // --------------------------------------------------------------------------- -export type RenameGroupMSTeamsParams = { +type RenameGroupMSTeamsParams = { cfg: OpenClawConfig; to: string; name: string; }; -export type RenameGroupMSTeamsResult = { +type RenameGroupMSTeamsResult = { renamed: { chatId: string; newName: string }; }; diff --git a/extensions/msteams/src/graph-members.ts b/extensions/msteams/src/graph-members.ts index 6c2b24b3eab..3390245d91d 100644 --- a/extensions/msteams/src/graph-members.ts +++ b/extensions/msteams/src/graph-members.ts @@ -10,12 +10,12 @@ type GraphUserProfile = { officeLocation?: string; }; -export type GetMemberInfoMSTeamsParams = { +type GetMemberInfoMSTeamsParams = { cfg: OpenClawConfig; userId: string; }; -export type GetMemberInfoMSTeamsResult = { +type GetMemberInfoMSTeamsResult = { user: { id: string | undefined; displayName: string | undefined; diff --git a/extensions/msteams/src/graph-teams.ts b/extensions/msteams/src/graph-teams.ts index 22d8e2ff7b8..a9cd425e738 100644 --- a/extensions/msteams/src/graph-teams.ts +++ b/extensions/msteams/src/graph-teams.ts @@ -5,7 +5,7 @@ import { type GraphResponse, fetchGraphJson, resolveGraphToken } from "./graph.j // Types // --------------------------------------------------------------------------- -export type GraphTeamsChannel = { +type GraphTeamsChannel = { id?: string; displayName?: string; description?: string; @@ -14,12 +14,12 @@ export type GraphTeamsChannel = { createdDateTime?: string; }; -export type ListChannelsMSTeamsParams = { +type ListChannelsMSTeamsParams = { cfg: OpenClawConfig; teamId: string; }; -export type ListChannelsMSTeamsResult = { +type ListChannelsMSTeamsResult = { channels: Array<{ id: string | undefined; displayName: string | undefined; @@ -29,13 +29,13 @@ export type ListChannelsMSTeamsResult = { truncated?: boolean; }; -export type GetChannelInfoMSTeamsParams = { +type GetChannelInfoMSTeamsParams = { cfg: OpenClawConfig; teamId: string; channelId: string; }; -export type GetChannelInfoMSTeamsResult = { +type GetChannelInfoMSTeamsResult = { channel: { id: string | undefined; displayName: string | undefined; diff --git a/extensions/msteams/src/graph-upload.ts b/extensions/msteams/src/graph-upload.ts index 3ff9a5fd44a..f435474068d 100644 --- a/extensions/msteams/src/graph-upload.ts +++ b/extensions/msteams/src/graph-upload.ts @@ -16,7 +16,7 @@ const GRAPH_ROOT = "https://graph.microsoft.com/v1.0"; const GRAPH_BETA = "https://graph.microsoft.com/beta"; const GRAPH_SCOPE = "https://graph.microsoft.com"; -export interface OneDriveUploadResult { +interface OneDriveUploadResult { id: string; webUrl: string; name: string; @@ -71,7 +71,7 @@ export async function uploadToOneDrive(params: { }; } -export interface OneDriveSharingLink { +interface OneDriveSharingLink { webUrl: string; } @@ -79,7 +79,7 @@ export interface OneDriveSharingLink { * Create a sharing link for a OneDrive file. * The link allows organization members to view the file. */ -export async function createSharingLink(params: { +async function createSharingLink(params: { itemId: string; tokenProvider: MSTeamsAccessTokenProvider; /** Sharing scope: "organization" (default) or "anonymous" */ @@ -219,7 +219,7 @@ export async function uploadToSharePoint(params: { }; } -export interface ChatMember { +interface ChatMember { aadObjectId: string; displayName?: string; } @@ -358,7 +358,7 @@ export async function resolveGraphChatId(params: { * Get members of a Teams chat for per-user sharing. * Used to create sharing links scoped to only the chat participants. */ -export async function getChatMembers(params: { +async function getChatMembers(params: { chatId: string; tokenProvider: MSTeamsAccessTokenProvider; fetchFn?: typeof fetch; @@ -395,7 +395,7 @@ export async function getChatMembers(params: { * For organization scope (default), uses v1.0 API. * For per-user scope, uses beta API with recipients. */ -export async function createSharePointSharingLink(params: { +async function createSharePointSharingLink(params: { siteId: string; itemId: string; tokenProvider: MSTeamsAccessTokenProvider; diff --git a/extensions/msteams/src/graph.ts b/extensions/msteams/src/graph.ts index 08fcce4fce3..2e9f00303aa 100644 --- a/extensions/msteams/src/graph.ts +++ b/extensions/msteams/src/graph.ts @@ -14,12 +14,12 @@ export type GraphUser = { mail?: string; }; -export type GraphGroup = { +type GraphGroup = { id?: string; displayName?: string; }; -export type GraphChannel = { +type GraphChannel = { id?: string; displayName?: string; }; @@ -125,13 +125,13 @@ export async function fetchGraphAbsoluteUrl(params: { } /** Graph collection response with optional pagination link. */ -export type GraphPagedResponse = { +type GraphPagedResponse = { value?: T[]; "@odata.nextLink"?: string; }; /** Result of a paginated Graph API fetch. */ -export type PaginatedResult = { +type PaginatedResult = { items: T[]; truncated: boolean; found?: T; diff --git a/extensions/msteams/src/inbound.ts b/extensions/msteams/src/inbound.ts index 29492350aa6..5b5681bbe2c 100644 --- a/extensions/msteams/src/inbound.ts +++ b/extensions/msteams/src/inbound.ts @@ -1,4 +1,4 @@ -export type MSTeamsQuoteInfo = { +type MSTeamsQuoteInfo = { sender: string; body: string; }; @@ -74,7 +74,7 @@ export function extractMSTeamsQuoteInfo( return undefined; } -export type MentionableActivity = { +type MentionableActivity = { recipient?: { id?: string } | null; entities?: Array<{ type?: string; diff --git a/extensions/msteams/src/mentions.ts b/extensions/msteams/src/mentions.ts index eda07f13fda..95bb5db8e9a 100644 --- a/extensions/msteams/src/mentions.ts +++ b/extensions/msteams/src/mentions.ts @@ -6,7 +6,7 @@ * 2. entities array with mention metadata */ -export type MentionEntity = { +type MentionEntity = { type: "mention"; text: string; mentioned: { @@ -15,7 +15,7 @@ export type MentionEntity = { }; }; -export type MentionInfo = { +type MentionInfo = { /** User/bot ID (e.g., "28:xxx" or AAD object ID) */ id: string; /** Display name */ diff --git a/extensions/msteams/src/messenger.ts b/extensions/msteams/src/messenger.ts index ba0a3e8d666..2e000df35a6 100644 --- a/extensions/msteams/src/messenger.ts +++ b/extensions/msteams/src/messenger.ts @@ -44,7 +44,7 @@ type SendContext = { deleteActivity: (activityId: string) => Promise; }; -export type MSTeamsConversationReference = { +type MSTeamsConversationReference = { activityId?: string; user?: { id?: string; name?: string; aadObjectId?: string }; agent?: { id?: string; name?: string; aadObjectId?: string } | null; @@ -81,7 +81,7 @@ export type MSTeamsAdapter = { deleteActivity: (context: unknown, reference: { activityId?: string }) => Promise; }; -export type MSTeamsReplyRenderOptions = { +type MSTeamsReplyRenderOptions = { textChunkLimit: number; chunkText?: boolean; mediaMode?: "split" | "inline"; @@ -98,13 +98,13 @@ export type MSTeamsRenderedMessage = { mediaUrl?: string; }; -export type MSTeamsSendRetryOptions = { +type MSTeamsSendRetryOptions = { maxAttempts?: number; baseDelayMs?: number; maxDelayMs?: number; }; -export type MSTeamsSendRetryEvent = { +type MSTeamsSendRetryEvent = { messageIndex: number; messageCount: number; nextAttempt: number; diff --git a/extensions/msteams/src/monitor-handler.ts b/extensions/msteams/src/monitor-handler.ts index 008db49680c..963281a5fe1 100644 --- a/extensions/msteams/src/monitor-handler.ts +++ b/extensions/msteams/src/monitor-handler.ts @@ -9,8 +9,6 @@ import { extractMSTeamsConversationMessageId, normalizeMSTeamsConversationId } f import { resolveMSTeamsSenderAccess } from "./monitor-handler/access.js"; import { createMSTeamsMessageHandler } from "./monitor-handler/message-handler.js"; import { createMSTeamsReactionHandler } from "./monitor-handler/reaction-handler.js"; -export type { MSTeamsAccessTokenProvider } from "./attachments/types.js"; -import type { MSTeamsAccessTokenProvider } from "./attachments/types.js"; import { getMSTeamsRuntime } from "./runtime.js"; import type { MSTeamsTurnContext } from "./sdk-types.js"; import { diff --git a/extensions/msteams/src/monitor.ts b/extensions/msteams/src/monitor.ts index e453258ab06..91f4826babf 100644 --- a/extensions/msteams/src/monitor.ts +++ b/extensions/msteams/src/monitor.ts @@ -29,7 +29,7 @@ import type { MSTeamsSsoDeps } from "./sso.js"; import { resolveMSTeamsCredentials } from "./token.js"; import { applyMSTeamsWebhookTimeouts } from "./webhook-timeouts.js"; -export type MonitorMSTeamsOpts = { +type MonitorMSTeamsOpts = { cfg: OpenClawConfig; runtime?: RuntimeEnv; abortSignal?: AbortSignal; @@ -37,7 +37,7 @@ export type MonitorMSTeamsOpts = { pollStore?: MSTeamsPollStore; }; -export type MonitorMSTeamsResult = { +type MonitorMSTeamsResult = { app: unknown; shutdown: () => Promise; }; diff --git a/extensions/msteams/src/pending-uploads-fs.ts b/extensions/msteams/src/pending-uploads-fs.ts index 5a96f1307bc..ba80a5f274a 100644 --- a/extensions/msteams/src/pending-uploads-fs.ts +++ b/extensions/msteams/src/pending-uploads-fs.ts @@ -25,7 +25,7 @@ const MAX_PENDING_UPLOADS = 100; const STORE_FILENAME = "msteams-pending-uploads.json"; -export type PendingUploadFsRecord = { +type PendingUploadFsRecord = { id: string; bufferBase64: string; filename: string; @@ -36,7 +36,7 @@ export type PendingUploadFsRecord = { createdAt: number; }; -export type PendingUploadFs = { +type PendingUploadFs = { id: string; buffer: Buffer; filename: string; @@ -53,7 +53,7 @@ type PendingUploadStoreData = { const empty: PendingUploadStoreData = { version: 1, uploads: {} }; -export type PendingUploadsFsOptions = { +type PendingUploadsFsOptions = { env?: NodeJS.ProcessEnv; homedir?: () => string; stateDir?: string; diff --git a/extensions/msteams/src/policy.ts b/extensions/msteams/src/policy.ts index 49479e1ce47..840313f8458 100644 --- a/extensions/msteams/src/policy.ts +++ b/extensions/msteams/src/policy.ts @@ -19,7 +19,7 @@ import { isDangerousNameMatchingEnabled, } from "../runtime-api.js"; -export type MSTeamsResolvedRouteConfig = { +type MSTeamsResolvedRouteConfig = { teamConfig?: MSTeamsTeamConfig; channelConfig?: MSTeamsChannelConfig; allowlistConfigured: boolean; @@ -203,12 +203,12 @@ export function resolveMSTeamsGroupToolPolicy( return undefined; } -export type MSTeamsReplyPolicy = { +type MSTeamsReplyPolicy = { requireMention: boolean; replyStyle: MSTeamsReplyStyle; }; -export type MSTeamsAllowlistMatch = AllowlistMatch<"wildcard" | "id" | "name">; +type MSTeamsAllowlistMatch = AllowlistMatch<"wildcard" | "id" | "name">; export function resolveMSTeamsAllowlistMatch(params: { allowFrom: Array; diff --git a/extensions/msteams/src/polls.ts b/extensions/msteams/src/polls.ts index feeb41c9d6e..c9a4a73c6c5 100644 --- a/extensions/msteams/src/polls.ts +++ b/extensions/msteams/src/polls.ts @@ -2,7 +2,7 @@ import crypto from "node:crypto"; import { resolveMSTeamsStorePath } from "./storage.js"; import { readJsonFile, withFileLock, writeJsonFile } from "./store-fs.js"; -export type MSTeamsPollVote = { +type MSTeamsPollVote = { pollId: string; selections: string[]; }; @@ -29,7 +29,7 @@ export type MSTeamsPollStore = { }) => Promise; }; -export type MSTeamsPollCard = { +type MSTeamsPollCard = { pollId: string; question: string; options: string[]; @@ -221,7 +221,7 @@ export function buildMSTeamsPollCard(params: { }; } -export type MSTeamsPollStoreFsOptions = { +type MSTeamsPollStoreFsOptions = { env?: NodeJS.ProcessEnv; homedir?: () => string; stateDir?: string; diff --git a/extensions/msteams/src/resolve-allowlist.ts b/extensions/msteams/src/resolve-allowlist.ts index 9df353e1535..60c558d714f 100644 --- a/extensions/msteams/src/resolve-allowlist.ts +++ b/extensions/msteams/src/resolve-allowlist.ts @@ -11,7 +11,7 @@ import { resolveGraphToken, } from "./graph.js"; -export type MSTeamsChannelResolution = { +type MSTeamsChannelResolution = { input: string; resolved: boolean; teamId?: string; @@ -21,7 +21,7 @@ export type MSTeamsChannelResolution = { note?: string; }; -export type MSTeamsUserResolution = { +type MSTeamsUserResolution = { input: string; resolved: boolean; id?: string; diff --git a/extensions/msteams/src/sdk-types.ts b/extensions/msteams/src/sdk-types.ts index 22654b6fdaa..e802564498c 100644 --- a/extensions/msteams/src/sdk-types.ts +++ b/extensions/msteams/src/sdk-types.ts @@ -7,7 +7,7 @@ * objects), so we model the minimal structural shape we rely on. */ -export type MSTeamsActivity = { +type MSTeamsActivity = { type: string; id?: string; timestamp?: string; diff --git a/extensions/msteams/src/sdk.ts b/extensions/msteams/src/sdk.ts index 3281f705a53..d3cabe41dca 100644 --- a/extensions/msteams/src/sdk.ts +++ b/extensions/msteams/src/sdk.ts @@ -20,13 +20,13 @@ export type MSTeamsTeamsSdk = { /** * A Teams SDK App instance used for token management and proactive messaging. */ -export type MSTeamsApp = InstanceType; +type MSTeamsApp = InstanceType; /** * Token provider compatible with the existing codebase, wrapping the Teams * SDK App's token methods. */ -export type MSTeamsTokenProvider = { +type MSTeamsTokenProvider = { getAccessToken: (scope: string) => Promise; }; @@ -76,7 +76,7 @@ async function loadAzureIdentity(): Promise { let msTeamsSdkPromise: Promise | null = null; -export async function loadMSTeamsSdk(): Promise { +async function loadMSTeamsSdk(): Promise { msTeamsSdkPromise ??= Promise.all([ import("@microsoft/teams.apps"), import("@microsoft/teams.api"), diff --git a/extensions/msteams/src/secret-contract.ts b/extensions/msteams/src/secret-contract.ts index 9ab4b24a169..9c64a709268 100644 --- a/extensions/msteams/src/secret-contract.ts +++ b/extensions/msteams/src/secret-contract.ts @@ -3,7 +3,6 @@ import { getChannelRecord, type ResolverContext, type SecretDefaults, - type SecretTargetRegistryEntry, } from "openclaw/plugin-sdk/channel-secret-basic-runtime"; export const secretTargetRegistryEntries = [ @@ -18,7 +17,7 @@ export const secretTargetRegistryEntries = [ includeInConfigure: true, includeInAudit: true, }, -] satisfies SecretTargetRegistryEntry[]; +] satisfies import("openclaw/plugin-sdk/channel-secret-basic-runtime").SecretTargetRegistryEntry[]; export function collectRuntimeConfigAssignments(params: { config: { channels?: Record }; diff --git a/extensions/msteams/src/send-context.ts b/extensions/msteams/src/send-context.ts index 80c883ff9ae..ff6d41f3c73 100644 --- a/extensions/msteams/src/send-context.ts +++ b/extensions/msteams/src/send-context.ts @@ -17,7 +17,7 @@ import { getMSTeamsRuntime } from "./runtime.js"; import { createMSTeamsAdapter, createMSTeamsTokenProvider, loadMSTeamsSdkWithAuth } from "./sdk.js"; import { resolveMSTeamsCredentials } from "./token.js"; -export type MSTeamsConversationType = "personal" | "groupChat" | "channel"; +type MSTeamsConversationType = "personal" | "groupChat" | "channel"; export type MSTeamsProactiveContext = { appId: string; diff --git a/extensions/msteams/src/send.ts b/extensions/msteams/src/send.ts index 22db50911d0..9ca161c6589 100644 --- a/extensions/msteams/src/send.ts +++ b/extensions/msteams/src/send.ts @@ -20,7 +20,7 @@ import { setPendingUploadActivityId } from "./pending-uploads.js"; import { buildMSTeamsPollCard } from "./polls.js"; import { resolveMSTeamsSendContext, type MSTeamsProactiveContext } from "./send-context.js"; -export type SendMSTeamsMessageParams = { +type SendMSTeamsMessageParams = { /** Full config (for credentials) */ cfg: OpenClawConfig; /** Conversation ID or user ID to send to */ @@ -35,7 +35,7 @@ export type SendMSTeamsMessageParams = { mediaReadFile?: (filePath: string) => Promise; }; -export type SendMSTeamsMessageResult = { +type SendMSTeamsMessageResult = { messageId: string; conversationId: string; /** If a FileConsentCard was sent instead of the file, this contains the upload ID */ @@ -51,7 +51,7 @@ const FILE_CONSENT_THRESHOLD_BYTES = 4 * 1024 * 1024; // 4MB */ const MSTEAMS_MAX_MEDIA_BYTES = 100 * 1024 * 1024; -export type SendMSTeamsPollParams = { +type SendMSTeamsPollParams = { /** Full config (for credentials) */ cfg: OpenClawConfig; /** Conversation ID or user ID to send to */ @@ -64,13 +64,13 @@ export type SendMSTeamsPollParams = { maxSelections?: number; }; -export type SendMSTeamsPollResult = { +type SendMSTeamsPollResult = { pollId: string; messageId: string; conversationId: string; }; -export type SendMSTeamsCardParams = { +type SendMSTeamsCardParams = { /** Full config (for credentials) */ cfg: OpenClawConfig; /** Conversation ID or user ID to send to */ @@ -79,7 +79,7 @@ export type SendMSTeamsCardParams = { card: Record; }; -export type SendMSTeamsCardResult = { +type SendMSTeamsCardResult = { messageId: string; conversationId: string; }; @@ -526,7 +526,7 @@ export async function sendAdaptiveCardMSTeams( }; } -export type EditMSTeamsMessageParams = { +type EditMSTeamsMessageParams = { /** Full config (for credentials) */ cfg: OpenClawConfig; /** Conversation ID or user ID */ @@ -537,11 +537,11 @@ export type EditMSTeamsMessageParams = { text: string; }; -export type EditMSTeamsMessageResult = { +type EditMSTeamsMessageResult = { conversationId: string; }; -export type DeleteMSTeamsMessageParams = { +type DeleteMSTeamsMessageParams = { /** Full config (for credentials) */ cfg: OpenClawConfig; /** Conversation ID or user ID */ @@ -550,7 +550,7 @@ export type DeleteMSTeamsMessageParams = { activityId: string; }; -export type DeleteMSTeamsMessageResult = { +type DeleteMSTeamsMessageResult = { conversationId: string; }; diff --git a/extensions/msteams/src/setup-surface.ts b/extensions/msteams/src/setup-surface.ts index f037682d955..5c612cc6ee2 100644 --- a/extensions/msteams/src/setup-surface.ts +++ b/extensions/msteams/src/setup-surface.ts @@ -17,7 +17,7 @@ import { resolveMSTeamsChannelAllowlist, resolveMSTeamsUserAllowlist, } from "./resolve-allowlist.js"; -import { createMSTeamsSetupWizardBase, msteamsSetupAdapter } from "./setup-core.js"; +import { createMSTeamsSetupWizardBase } from "./setup-core.js"; import { resolveMSTeamsCredentials, saveDelegatedTokens } from "./token.js"; const channel = "msteams" as const; @@ -244,8 +244,6 @@ const msteamsDmPolicy: ChannelSetupDmPolicy = createTopLevelChannelDmPolicy({ promptAllowFrom: promptMSTeamsAllowFrom, }); -export { msteamsSetupAdapter } from "./setup-core.js"; - const msteamsSetupWizardBase = createMSTeamsSetupWizardBase(); export const msteamsSetupWizard: ChannelSetupWizard = { diff --git a/extensions/msteams/src/sso-token-store.ts b/extensions/msteams/src/sso-token-store.ts index 554632d5b51..21fba4a12b6 100644 --- a/extensions/msteams/src/sso-token-store.ts +++ b/extensions/msteams/src/sso-token-store.ts @@ -14,7 +14,7 @@ import { resolveMSTeamsStorePath } from "./storage.js"; import { readJsonFile, withFileLock, writeJsonFile } from "./store-fs.js"; -export type MSTeamsSsoStoredToken = { +type MSTeamsSsoStoredToken = { /** Connection name from the Bot Framework OAuth connection setting. */ connectionName: string; /** Stable user identifier (AAD object ID preferred). */ diff --git a/extensions/msteams/src/sso.ts b/extensions/msteams/src/sso.ts index 4cb9d05c4a6..8696788518e 100644 --- a/extensions/msteams/src/sso.ts +++ b/extensions/msteams/src/sso.ts @@ -29,10 +29,10 @@ import type { MSTeamsSsoTokenStore } from "./sso-token-store.js"; import { buildUserAgent } from "./user-agent.js"; /** Scope used to obtain a Bot Framework service token. */ -export const BOT_FRAMEWORK_TOKEN_SCOPE = "https://api.botframework.com/.default"; +const BOT_FRAMEWORK_TOKEN_SCOPE = "https://api.botframework.com/.default"; /** Bot Framework User Token service base URL. */ -export const BOT_FRAMEWORK_USER_TOKEN_BASE_URL = "https://token.botframework.com"; +const BOT_FRAMEWORK_USER_TOKEN_BASE_URL = "https://token.botframework.com"; /** * Response shape returned by the Bot Framework User Token service for @@ -40,7 +40,7 @@ export const BOT_FRAMEWORK_USER_TOKEN_BASE_URL = "https://token.botframework.com * * @see https://learn.microsoft.com/azure/bot-service/rest-api/bot-framework-rest-connector-user-token-service */ -export type BotFrameworkUserTokenResponse = { +type BotFrameworkUserTokenResponse = { channelId?: string; connectionName: string; token: string; @@ -71,14 +71,14 @@ export type MSTeamsSsoDeps = { userTokenBaseUrl?: string; }; -export type MSTeamsSsoUser = { +type MSTeamsSsoUser = { /** Stable user identifier — AAD object ID when available. */ userId: string; /** Bot Framework channel ID (default: "msteams"). */ channelId?: string; }; -export type MSTeamsSsoResult = +type MSTeamsSsoResult = | { ok: true; token: string; @@ -97,13 +97,13 @@ export type MSTeamsSsoResult = status?: number; }; -export type SigninTokenExchangeValue = { +type SigninTokenExchangeValue = { id?: string; connectionName?: string; token?: string; }; -export type SigninVerifyStateValue = { +type SigninVerifyStateValue = { state?: string; }; diff --git a/extensions/msteams/src/storage.ts b/extensions/msteams/src/storage.ts index 3ae04de0f69..70a97f468d7 100644 --- a/extensions/msteams/src/storage.ts +++ b/extensions/msteams/src/storage.ts @@ -1,7 +1,7 @@ import path from "node:path"; import { getMSTeamsRuntime } from "./runtime.js"; -export type MSTeamsStorePathOptions = { +type MSTeamsStorePathOptions = { env?: NodeJS.ProcessEnv; homedir?: () => string; stateDir?: string; diff --git a/extensions/msteams/src/streaming-message.ts b/extensions/msteams/src/streaming-message.ts index 822c19d2872..9142f22b1b0 100644 --- a/extensions/msteams/src/streaming-message.ts +++ b/extensions/msteams/src/streaming-message.ts @@ -30,7 +30,7 @@ const MAX_STREAM_AGE_MS = 45_000; type StreamSendFn = (activity: Record) => Promise; -export type TeamsStreamOptions = { +type TeamsStreamOptions = { /** Function to send an activity (POST to Bot Framework). */ sendActivity: StreamSendFn; /** Whether to enable feedback loop on the final message. */ diff --git a/extensions/msteams/src/thread-parent-context.ts b/extensions/msteams/src/thread-parent-context.ts index 2ba381d91e9..957b39c790f 100644 --- a/extensions/msteams/src/thread-parent-context.ts +++ b/extensions/msteams/src/thread-parent-context.ts @@ -37,7 +37,7 @@ const parentCache = new Map(); const INJECTED_MAX = 200; const injectedParents = new Map(); -export type ThreadParentContextFetcher = ( +type ThreadParentContextFetcher = ( token: string, groupId: string, channelId: string, @@ -88,7 +88,7 @@ export async function fetchParentMessageCached( return message; } -export type ParentContextSummary = { +type ParentContextSummary = { /** Display name of the parent message author, or "unknown". */ sender: string; /** Stripped, single-line parent body text (or empty if unresolved). */ diff --git a/extensions/msteams/src/token.ts b/extensions/msteams/src/token.ts index 910327cefe9..271cf7ba144 100644 --- a/extensions/msteams/src/token.ts +++ b/extensions/msteams/src/token.ts @@ -143,7 +143,7 @@ export function resolveMSTeamsCredentials(cfg?: MSTeamsConfig): MSTeamsCredentia const DELEGATED_TOKEN_FILENAME = "msteams-delegated.json"; -export function resolveDelegatedTokenPath(): string { +function resolveDelegatedTokenPath(): string { return resolveMSTeamsStorePath({ filename: DELEGATED_TOKEN_FILENAME }); } diff --git a/extensions/msteams/src/webhook-timeouts.ts b/extensions/msteams/src/webhook-timeouts.ts index 957c976100e..4576ad54c34 100644 --- a/extensions/msteams/src/webhook-timeouts.ts +++ b/extensions/msteams/src/webhook-timeouts.ts @@ -4,7 +4,7 @@ const MSTEAMS_WEBHOOK_INACTIVITY_TIMEOUT_MS = 30_000; const MSTEAMS_WEBHOOK_REQUEST_TIMEOUT_MS = 30_000; const MSTEAMS_WEBHOOK_HEADERS_TIMEOUT_MS = 15_000; -export type ApplyMSTeamsWebhookTimeoutsOpts = { +type ApplyMSTeamsWebhookTimeoutsOpts = { inactivityTimeoutMs?: number; requestTimeoutMs?: number; headersTimeoutMs?: number; diff --git a/extensions/msteams/src/welcome-card.ts b/extensions/msteams/src/welcome-card.ts index 07c5cf98cb6..dcc29106139 100644 --- a/extensions/msteams/src/welcome-card.ts +++ b/extensions/msteams/src/welcome-card.ts @@ -8,7 +8,7 @@ const DEFAULT_PROMPT_STARTERS = [ "Help me draft an email", ]; -export type WelcomeCardOptions = { +type WelcomeCardOptions = { /** Bot display name. Falls back to "OpenClaw". */ botName?: string; /** Custom prompt starters. Falls back to defaults. */