TypeScript: add extensions to tsconfig and fix type errors (#12781)

* TypeScript: add extensions to tsconfig and fix type errors

- Add extensions/**/* to tsconfig.json includes
- Export ProviderAuthResult, AnyAgentTool from plugin-sdk
- Fix optional chaining for messageActions across channels
- Add missing type imports (MSTeamsConfig, GroupPolicy, etc.)
- Add type annotations for provider auth handlers
- Fix undici/fetch type compatibility in zalo proxy
- Correct ChannelAccountSnapshot property usage
- Add type casts for tool registrations
- Extract usage view styles and types to separate files

* TypeScript: fix optional debug calls and handleAction guards
This commit is contained in:
max
2026-02-09 10:05:38 -08:00
committed by GitHub
parent 2e4334c32c
commit 40b11db80e
87 changed files with 2947 additions and 2706 deletions

View File

@@ -111,7 +111,7 @@ export async function sendMessageMSTeams(
sharePointSiteId,
} = ctx;
log.debug("sending proactive message", {
log.debug?.("sending proactive message", {
conversationId,
conversationType,
textLength: messageText.length,
@@ -131,7 +131,7 @@ export async function sendMessageMSTeams(
const fallbackFileName = await extractFilename(mediaUrl);
const fileName = media.fileName ?? fallbackFileName;
log.debug("processing media", {
log.debug?.("processing media", {
fileName,
contentType: media.contentType,
size: media.buffer.length,
@@ -155,7 +155,7 @@ export async function sendMessageMSTeams(
description: messageText || undefined,
});
log.debug("sending file consent card", { uploadId, fileName, size: media.buffer.length });
log.debug?.("sending file consent card", { uploadId, fileName, size: media.buffer.length });
const baseRef = buildConversationReference(ref);
const proactiveRef = { ...baseRef, activityId: undefined };
@@ -205,7 +205,7 @@ export async function sendMessageMSTeams(
try {
if (sharePointSiteId) {
// Use SharePoint upload + Graph API for native file card
log.debug("uploading to SharePoint for native file card", {
log.debug?.("uploading to SharePoint for native file card", {
fileName,
conversationType,
siteId: sharePointSiteId,
@@ -221,7 +221,7 @@ export async function sendMessageMSTeams(
usePerUserSharing: conversationType === "groupChat",
});
log.debug("SharePoint upload complete", {
log.debug?.("SharePoint upload complete", {
itemId: uploaded.itemId,
shareUrl: uploaded.shareUrl,
});
@@ -233,7 +233,7 @@ export async function sendMessageMSTeams(
tokenProvider,
});
log.debug("driveItem properties retrieved", {
log.debug?.("driveItem properties retrieved", {
eTag: driveItem.eTag,
webDavUrl: driveItem.webDavUrl,
});
@@ -265,7 +265,7 @@ export async function sendMessageMSTeams(
}
// Fallback: no SharePoint site configured, use OneDrive with markdown link
log.debug("uploading to OneDrive (no SharePoint site configured)", {
log.debug?.("uploading to OneDrive (no SharePoint site configured)", {
fileName,
conversationType,
});
@@ -277,7 +277,7 @@ export async function sendMessageMSTeams(
tokenProvider,
});
log.debug("OneDrive upload complete", {
log.debug?.("OneDrive upload complete", {
itemId: uploaded.itemId,
shareUrl: uploaded.shareUrl,
});
@@ -349,7 +349,7 @@ async function sendTextWithMedia(
messages: [{ text: text || undefined, mediaUrl }],
retry: {},
onRetry: (event) => {
log.debug("retrying send", { conversationId, ...event });
log.debug?.("retrying send", { conversationId, ...event });
},
tokenProvider,
sharePointSiteId,
@@ -392,7 +392,7 @@ export async function sendPollMSTeams(
maxSelections,
});
log.debug("sending poll", {
log.debug?.("sending poll", {
conversationId,
pollId: pollCard.pollId,
optionCount: pollCard.options.length,
@@ -452,7 +452,7 @@ export async function sendAdaptiveCardMSTeams(
to,
});
log.debug("sending adaptive card", {
log.debug?.("sending adaptive card", {
conversationId,
cardType: card.type,
cardVersion: card.version,