/** * Microsoft Graph file access for Teams CHANNEL messages. * * The Teams bot file API (the `file.download.info` attachment) only fires in a * 1:1 personal chat. In a channel the bot's inbound activity carries no file at * all — the upload lives in the team's SharePoint document library and is only * referenced from the channel *message*, which the bot doesn't receive inline. * So to chart "a CSV someone dropped in a channel" we go through Graph: * * 1. Acquire an app-only Graph token (client credentials — the same * clientId/clientSecret/tenantId the adapter already uses for Teams). * 2. Read the channel message to find its file attachments * (`GET /teams/{team}/channels/{channel}/messages/{id}` — app-only via the * RSC permission `ChannelMessage.Read.Group`, declared in the app * manifest; no tenant admin consent or protected-API approval needed). * 3. Download each referenced SharePoint file via the `/shares` endpoint * (needs the `Files.Read.All` application permission + admin consent). * * Returns nothing (with a note) when Graph isn't configured or a step fails, so * the bot degrades to asking the user to paste the data rather than crashing. */ import { type FileDeliveryConfig } from "./download-files.js"; import type { AgentContentPart } from "@copilotkit/channels-ui"; /** The Microsoft credentials needed for an app-only Graph token. */ export interface GraphCredentials { clientId: string; clientSecret: string; tenantId: string; } /** Identifiers needed to read a channel message, pulled from the activity. */ export interface ChannelMessageRef { /** The team's Entra (AAD) group id — `channelData.team.aadGroupId`. */ teamId: string; /** The channel thread id — `channelData.teamsChannelId`. */ channelId: string; /** The inbound message id (`activity.id`). */ messageId: string; /** Root message id when this is a reply; equals `messageId` for a top-level post. */ rootId: string; } /** * Resolve a channel message's uploaded files into AG-UI content parts via * Graph. Returns `{ parts, notes }`; on any failure the parts are empty and a * note explains why (so the caller can tell the user to paste the data). */ export declare function buildChannelFileContentParts(ref: ChannelMessageRef, creds: GraphCredentials, config?: FileDeliveryConfig): Promise<{ parts: AgentContentPart[]; notes: string[]; }>; //# sourceMappingURL=graph-files.d.ts.map