@@ -4,7 +4,10 @@ import fs from "node:fs/promises";
44import os from "node:os" ;
55import path from "node:path" ;
66import { Mock , vi } from "vitest" ;
7+ import type { MsgContext } from "../auto-reply/templating.js" ;
8+ import type { GetReplyOptions , ReplyPayload } from "../auto-reply/types.js" ;
79import type { ChannelPlugin , ChannelOutboundAdapter } from "../channels/plugins/types.js" ;
10+ import type { OpenClawConfig } from "../config/config.js" ;
811import { applyPluginAutoEnable } from "../config/plugin-auto-enable.js" ;
912import type { AgentBinding } from "../config/types.agents.js" ;
1013import type { HooksConfig } from "../config/types.hooks.js" ;
@@ -19,6 +22,12 @@ type StubChannelOptions = {
1922 summary ?: Record < string , unknown > ;
2023} ;
2124
25+ type GetReplyFromConfigFn = (
26+ ctx : MsgContext ,
27+ opts ?: GetReplyOptions ,
28+ configOverride ?: OpenClawConfig ,
29+ ) => Promise < ReplyPayload | ReplyPayload [ ] | undefined > ;
30+
2231const createStubOutboundAdapter = ( channelId : ChannelPlugin [ "id" ] ) : ChannelOutboundAdapter => ( {
2332 deliveryMode : "direct" ,
2433 sendText : async ( ) => ( {
@@ -169,7 +178,7 @@ const hoisted = vi.hoisted(() => ({
169178 waitResults : new Map < string , boolean > ( ) ,
170179 } ,
171180 testTailscaleWhois : { value : null as TailscaleWhoisIdentity | null } ,
172- getReplyFromConfig : vi . fn ( ) . mockResolvedValue ( undefined ) ,
181+ getReplyFromConfig : vi . fn < GetReplyFromConfigFn > ( ) . mockResolvedValue ( undefined ) ,
173182 sendWhatsAppMock : vi . fn ( ) . mockResolvedValue ( { messageId : "msg-1" , toJid : "jid-1" } ) ,
174183} ) ) ;
175184
@@ -202,7 +211,7 @@ export const testTailscaleWhois = hoisted.testTailscaleWhois;
202211export const piSdkMock = hoisted . piSdkMock ;
203212export const cronIsolatedRun = hoisted . cronIsolatedRun ;
204213export const agentCommand : Mock < ( ) => void > = hoisted . agentCommand ;
205- export const getReplyFromConfig : Mock < ( ) => void > = hoisted . getReplyFromConfig ;
214+ export const getReplyFromConfig : Mock < GetReplyFromConfigFn > = hoisted . getReplyFromConfig ;
206215
207216export const testState = {
208217 agentConfig : undefined as Record < string , unknown > | undefined ,
0 commit comments