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

@@ -625,7 +625,7 @@ export const zalouserPlugin: ChannelPlugin<ResolvedZalouserAccount> = {
}
ctx.setStatus({
accountId: account.accountId,
user: userInfo,
profile: userInfo,
});
} catch {
// ignore probe errors

View File

@@ -3,6 +3,11 @@ import { runZca, parseJsonOutput } from "./zca.js";
const ACTIONS = ["send", "image", "link", "friends", "groups", "me", "status"] as const;
type AgentToolResult = {
content: Array<{ type: string; text: string }>;
details?: unknown;
};
function stringEnum<T extends readonly string[]>(
values: T,
options: { description?: string } = {},
@@ -38,12 +43,7 @@ type ToolParams = {
url?: string;
};
type ToolResult = {
content: Array<{ type: string; text: string }>;
details: unknown;
};
function json(payload: unknown): ToolResult {
function json(payload: unknown): AgentToolResult {
return {
content: [{ type: "text", text: JSON.stringify(payload, null, 2) }],
details: payload,
@@ -53,7 +53,9 @@ function json(payload: unknown): ToolResult {
export async function executeZalouserTool(
_toolCallId: string,
params: ToolParams,
): Promise<ToolResult> {
_signal?: AbortSignal,
_onUpdate?: unknown,
): Promise<AgentToolResult> {
try {
switch (params.action) {
case "send": {