fix(tests): unblock current typecheck drift
This commit is contained in:
parent
25a1f49c9c
commit
4f9ab1b438
@ -13,6 +13,7 @@ beforeEach(() => {
|
||||
code: 1,
|
||||
signal: null,
|
||||
killed: false,
|
||||
termination: "exit",
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ beforeEach(() => {
|
||||
warn: warnMock,
|
||||
child: () => logger,
|
||||
};
|
||||
return logger as ReturnType<typeof subsystemModule.createSubsystemLogger>;
|
||||
return logger as unknown as ReturnType<typeof subsystemModule.createSubsystemLogger>;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -8,9 +8,9 @@ import {
|
||||
getChatChannelMeta,
|
||||
normalizeAccountId,
|
||||
TelegramConfigSchema,
|
||||
type ChannelPlugin,
|
||||
type OpenClawConfig,
|
||||
} from "openclaw/plugin-sdk/telegram";
|
||||
import type { ChannelPlugin } from "../../../src/channels/plugins/types.js";
|
||||
import { inspectTelegramAccount } from "./account-inspect.js";
|
||||
import {
|
||||
listTelegramAccountIds,
|
||||
|
||||
@ -28,10 +28,10 @@ import {
|
||||
resolveTelegramGroupToolPolicy,
|
||||
TelegramConfigSchema,
|
||||
type ChannelMessageActionAdapter,
|
||||
type ChannelPlugin,
|
||||
type OpenClawConfig,
|
||||
} from "openclaw/plugin-sdk/telegram";
|
||||
import { parseTelegramTopicConversation } from "../../../src/acp/conversation-id.js";
|
||||
import type { ChannelPlugin } from "../../../src/channels/plugins/types.js";
|
||||
import { resolveExecApprovalCommandDisplay } from "../../../src/infra/exec-approval-command-display.js";
|
||||
import { buildExecApprovalPendingReplyPayload } from "../../../src/infra/exec-approval-reply.js";
|
||||
import {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import path from "node:path";
|
||||
import {
|
||||
DEFAULT_ACCOUNT_ID,
|
||||
type DmPolicy,
|
||||
type ChannelSetupDmPolicy,
|
||||
formatCliCommand,
|
||||
formatDocsLink,
|
||||
normalizeAccountId,
|
||||
@ -18,10 +18,14 @@ import { loginWeb } from "./login.js";
|
||||
import { whatsappSetupAdapter } from "./setup-core.js";
|
||||
|
||||
const channel = "whatsapp" as const;
|
||||
type WhatsAppConfig = NonNullable<NonNullable<OpenClawConfig["channels"]>["whatsapp"]>;
|
||||
type WhatsAppDmPolicy = ChannelSetupDmPolicy["getCurrent"] extends (...args: never[]) => infer T
|
||||
? T
|
||||
: never;
|
||||
|
||||
function mergeWhatsAppConfig(
|
||||
cfg: OpenClawConfig,
|
||||
patch: Partial<NonNullable<OpenClawConfig["channels"]>["whatsapp"]>,
|
||||
patch: Partial<WhatsAppConfig>,
|
||||
options?: { unsetOnUndefined?: string[] },
|
||||
): OpenClawConfig {
|
||||
const base = { ...(cfg.channels?.whatsapp ?? {}) } as Record<string, unknown>;
|
||||
@ -43,7 +47,7 @@ function mergeWhatsAppConfig(
|
||||
};
|
||||
}
|
||||
|
||||
function setWhatsAppDmPolicy(cfg: OpenClawConfig, dmPolicy: DmPolicy): OpenClawConfig {
|
||||
function setWhatsAppDmPolicy(cfg: OpenClawConfig, dmPolicy: WhatsAppDmPolicy): OpenClawConfig {
|
||||
return mergeWhatsAppConfig(cfg, { dmPolicy });
|
||||
}
|
||||
|
||||
@ -202,7 +206,7 @@ async function promptWhatsAppDmAccess(params: {
|
||||
{ value: "open", label: "Open (public inbound DMs)" },
|
||||
{ value: "disabled", label: "Disabled (ignore WhatsApp DMs)" },
|
||||
],
|
||||
})) as DmPolicy;
|
||||
})) as WhatsAppDmPolicy;
|
||||
|
||||
let next = setWhatsAppSelfChatMode(params.cfg, false);
|
||||
next = setWhatsAppDmPolicy(next, policy);
|
||||
|
||||
@ -153,9 +153,7 @@ describe("stageBundledPluginRuntime", () => {
|
||||
description: string;
|
||||
acceptsArgs: boolean;
|
||||
}>;
|
||||
matchPluginCommand: (
|
||||
commandBody: string,
|
||||
) => {
|
||||
matchPluginCommand: (commandBody: string) => {
|
||||
command: { handler: ({ args }: { args?: string }) => Promise<{ text: string }> };
|
||||
args?: string;
|
||||
} | null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user