From 3d799ba004eb560c61e2af35a96e96a49296c272 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sat, 4 Apr 2026 01:00:45 +0900 Subject: [PATCH] fix(ci): tighten whatsapp and openai transport types --- extensions/whatsapp/src/setup-surface.ts | 16 +++++++++------- src/agents/openai-transport-stream.ts | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/extensions/whatsapp/src/setup-surface.ts b/extensions/whatsapp/src/setup-surface.ts index 787d6bc9075..3d4e416d630 100644 --- a/extensions/whatsapp/src/setup-surface.ts +++ b/extensions/whatsapp/src/setup-surface.ts @@ -14,6 +14,7 @@ import type { ChannelSetupWizard } from "openclaw/plugin-sdk/setup"; import { formatCliCommand, formatDocsLink } from "openclaw/plugin-sdk/setup-tools"; import { listWhatsAppAccountIds, resolveWhatsAppAccount, resolveWhatsAppAuthDir } from "./accounts.js"; import { loginWeb } from "./login.js"; +import type { WhatsAppAccountConfig, WhatsAppConfig } from "./runtime-api.js"; import { whatsappSetupAdapter } from "./setup-core.js"; const channel = "whatsapp" as const; @@ -24,16 +25,16 @@ function mergeWhatsAppConfig( patch: Partial["whatsapp"]>>, options?: { unsetOnUndefined?: string[] }, ): OpenClawConfig { - const channelConfig = { ...(cfg.channels?.whatsapp ?? {}) } as Record; + const channelConfig: WhatsAppConfig = { ...(cfg.channels?.whatsapp ?? {}) }; if (accountId === DEFAULT_ACCOUNT_ID) { for (const [key, value] of Object.entries(patch)) { if (value === undefined) { if (options?.unsetOnUndefined?.includes(key)) { - delete channelConfig[key]; + delete channelConfig[key as keyof WhatsAppConfig]; } continue; } - channelConfig[key] = value; + channelConfig[key as keyof WhatsAppConfig] = value as WhatsAppConfig[keyof WhatsAppConfig]; } return { ...cfg, @@ -45,17 +46,18 @@ function mergeWhatsAppConfig( } const accounts = { - ...((channelConfig.accounts as Record | undefined> | undefined) ?? {}), + ...(channelConfig.accounts ?? {}), }; - const nextAccount = { ...(accounts[accountId] ?? {}) }; + const nextAccount: WhatsAppAccountConfig = { ...(accounts[accountId] ?? {}) }; for (const [key, value] of Object.entries(patch)) { if (value === undefined) { if (options?.unsetOnUndefined?.includes(key)) { - delete nextAccount[key]; + delete nextAccount[key as keyof WhatsAppAccountConfig]; } continue; } - nextAccount[key] = value; + nextAccount[key as keyof WhatsAppAccountConfig] = + value as WhatsAppAccountConfig[keyof WhatsAppAccountConfig]; } accounts[accountId] = nextAccount; return { diff --git a/src/agents/openai-transport-stream.ts b/src/agents/openai-transport-stream.ts index c68daed1356..a5a86b72272 100644 --- a/src/agents/openai-transport-stream.ts +++ b/src/agents/openai-transport-stream.ts @@ -965,7 +965,7 @@ export function buildOpenAIResponsesParams( { supportsDeveloperRole: compat.supportsDeveloperRole }, ); const cacheRetention = resolveCacheRetention(options?.cacheRetention); - const params: Record = { + const params: ResponseCreateParamsStreaming & Record = { model: model.id, input: messages, stream: true,