mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 08:00:42 +00:00
refactor: trim msteams helper exports
This commit is contained in:
@@ -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 = /<img[^>]+src=["']([^"']+)["'][^>]*>/gi;
|
||||
export const ATTACHMENT_TAG_RE = /<attachment[^>]+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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<string, unknown>;
|
||||
uploadId: string;
|
||||
};
|
||||
|
||||
@@ -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<boolean> {
|
||||
|
||||
@@ -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<string, unknown>;
|
||||
}
|
||||
|
||||
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<string, unknown>;
|
||||
|
||||
@@ -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 };
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<T>(params: {
|
||||
}
|
||||
|
||||
/** Graph collection response with optional pagination link. */
|
||||
export type GraphPagedResponse<T> = {
|
||||
type GraphPagedResponse<T> = {
|
||||
value?: T[];
|
||||
"@odata.nextLink"?: string;
|
||||
};
|
||||
|
||||
/** Result of a paginated Graph API fetch. */
|
||||
export type PaginatedResult<T> = {
|
||||
type PaginatedResult<T> = {
|
||||
items: T[];
|
||||
truncated: boolean;
|
||||
found?: T;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -44,7 +44,7 @@ type SendContext = {
|
||||
deleteActivity: (activityId: string) => Promise<void>;
|
||||
};
|
||||
|
||||
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<void>;
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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<void>;
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<string | number>;
|
||||
|
||||
@@ -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<MSTeamsPoll | null>;
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -20,13 +20,13 @@ export type MSTeamsTeamsSdk = {
|
||||
/**
|
||||
* A Teams SDK App instance used for token management and proactive messaging.
|
||||
*/
|
||||
export type MSTeamsApp = InstanceType<MSTeamsTeamsSdk["App"]>;
|
||||
type MSTeamsApp = InstanceType<MSTeamsTeamsSdk["App"]>;
|
||||
|
||||
/**
|
||||
* Token provider compatible with the existing codebase, wrapping the Teams
|
||||
* SDK App's token methods.
|
||||
*/
|
||||
export type MSTeamsTokenProvider = {
|
||||
type MSTeamsTokenProvider = {
|
||||
getAccessToken: (scope: string) => Promise<string>;
|
||||
};
|
||||
|
||||
@@ -76,7 +76,7 @@ async function loadAzureIdentity(): Promise<AzureIdentityModule> {
|
||||
|
||||
let msTeamsSdkPromise: Promise<MSTeamsTeamsSdk> | null = null;
|
||||
|
||||
export async function loadMSTeamsSdk(): Promise<MSTeamsTeamsSdk> {
|
||||
async function loadMSTeamsSdk(): Promise<MSTeamsTeamsSdk> {
|
||||
msTeamsSdkPromise ??= Promise.all([
|
||||
import("@microsoft/teams.apps"),
|
||||
import("@microsoft/teams.api"),
|
||||
|
||||
@@ -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<string, unknown> };
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<Buffer>;
|
||||
};
|
||||
|
||||
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<string, unknown>;
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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). */
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -30,7 +30,7 @@ const MAX_STREAM_AGE_MS = 45_000;
|
||||
|
||||
type StreamSendFn = (activity: Record<string, unknown>) => Promise<unknown>;
|
||||
|
||||
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. */
|
||||
|
||||
@@ -37,7 +37,7 @@ const parentCache = new Map<string, ParentCacheEntry>();
|
||||
const INJECTED_MAX = 200;
|
||||
const injectedParents = new Map<string, string>();
|
||||
|
||||
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). */
|
||||
|
||||
@@ -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 });
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user