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

@@ -1,4 +1,5 @@
import type {
ChannelAccountSnapshot,
ChannelOutboundAdapter,
ChannelPlugin,
ChannelSetupInput,
@@ -154,7 +155,7 @@ const tlonOutbound: ChannelOutboundAdapter = {
},
sendMedia: async ({ cfg, to, text, mediaUrl, accountId, replyToId, threadId }) => {
const mergedText = buildMediaText(text, mediaUrl);
return await tlonOutbound.sendText({
return await tlonOutbound.sendText!({
cfg,
to,
text: mergedText,
@@ -224,9 +225,11 @@ export const tlonPlugin: ChannelPlugin = {
deleteAccount: ({ cfg, accountId }) => {
const useDefault = !accountId || accountId === "default";
if (useDefault) {
// @ts-expect-error
// oxlint-disable-next-line no-unused-vars
const { ship, code, url, name, ...rest } = cfg.channels?.tlon ?? {};
const { ship, code, url, name, ...rest } = (cfg.channels?.tlon ?? {}) as Record<
string,
unknown
>;
return {
...cfg,
channels: {
@@ -235,9 +238,9 @@ export const tlonPlugin: ChannelPlugin = {
},
} as OpenClawConfig;
}
// @ts-expect-error
// oxlint-disable-next-line no-unused-vars
const { [accountId]: removed, ...remainingAccounts } = cfg.channels?.tlon?.accounts ?? {};
const { [accountId]: removed, ...remainingAccounts } = (cfg.channels?.tlon?.accounts ??
{}) as Record<string, unknown>;
return {
...cfg,
channels: {
@@ -334,8 +337,8 @@ export const tlonPlugin: ChannelPlugin = {
},
buildChannelSummary: ({ snapshot }) => ({
configured: snapshot.configured ?? false,
ship: snapshot.ship ?? null,
url: snapshot.url ?? null,
ship: (snapshot as { ship?: string | null }).ship ?? null,
url: (snapshot as { url?: string | null }).url ?? null,
}),
probeAccount: async ({ account }) => {
if (!account.configured || !account.ship || !account.url || !account.code) {
@@ -356,7 +359,7 @@ export const tlonPlugin: ChannelPlugin = {
await api.delete();
}
} catch (error) {
return { ok: false, error: error?.message ?? String(error) };
return { ok: false, error: (error as { message?: string })?.message ?? String(error) };
}
},
buildAccountSnapshot: ({ account, runtime, probe }) => ({
@@ -380,7 +383,7 @@ export const tlonPlugin: ChannelPlugin = {
accountId: account.accountId,
ship: account.ship,
url: account.url,
});
} as ChannelAccountSnapshot);
ctx.log?.info(`[${account.accountId}] starting Tlon provider for ${account.ship ?? "tlon"}`);
return monitorTlonProvider({
runtime: ctx.runtime,