@@ -3,6 +3,7 @@ import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
33const mocks = vi . hoisted ( ( ) => ( {
44 listChannelPlugins : vi . fn ( ) ,
55 resolveOutboundChannelPlugin : vi . fn ( ) ,
6+ missingOfficialExternalChannels : new Set < string > ( ) ,
67} ) ) ;
78
89const deliverableChannelIds = vi . hoisted ( ( ) => [
@@ -31,6 +32,21 @@ vi.mock("./channel-resolution.js", () => ({
3132 resolveOutboundChannelPlugin : mocks . resolveOutboundChannelPlugin ,
3233} ) ) ;
3334
35+ vi . mock ( "../../plugins/official-external-plugin-repair-hints.js" , ( ) => ( {
36+ resolveMissingOfficialExternalChannelPluginRepairHint : ( { channelId } : { channelId : string } ) =>
37+ mocks . missingOfficialExternalChannels . has ( channelId )
38+ ? {
39+ pluginId : channelId ,
40+ channelId,
41+ label : channelId === "whatsapp" ? "WhatsApp" : "Feishu" ,
42+ installSpec : `@openclaw/${ channelId } ` ,
43+ installCommand : `openclaw plugins install @openclaw/${ channelId } ` ,
44+ doctorFixCommand : "openclaw doctor --fix" ,
45+ repairHint : `Install the official external plugin with: openclaw plugins install @openclaw/${ channelId } , or run: openclaw doctor --fix.` ,
46+ }
47+ : null ,
48+ } ) ) ;
49+
3450type ChannelSelectionModule = typeof import ( "./channel-selection.js" ) ;
3551type RuntimeModule = typeof import ( "../../runtime.js" ) ;
3652
@@ -153,6 +169,7 @@ describe("resolveMessageChannelSelection", () => {
153169 mocks . resolveOutboundChannelPlugin . mockImplementation ( ( { channel } : { channel : string } ) => ( {
154170 id : channel ,
155171 } ) ) ;
172+ mocks . missingOfficialExternalChannels . clear ( ) ;
156173 } ) ;
157174
158175 it . each ( [
@@ -243,6 +260,7 @@ describe("resolveMessageChannelSelection", () => {
243260 {
244261 setup : ( ) => {
245262 mocks . resolveOutboundChannelPlugin . mockReturnValue ( undefined ) ;
263+ mocks . missingOfficialExternalChannels . add ( "feishu" ) ;
246264 } ,
247265 params : {
248266 cfg : { channels : { feishu : { appId : "cli_xxx" } } } as never ,
@@ -258,6 +276,7 @@ describe("resolveMessageChannelSelection", () => {
258276 {
259277 setup : ( ) => {
260278 mocks . resolveOutboundChannelPlugin . mockReturnValue ( undefined ) ;
279+ mocks . missingOfficialExternalChannels . add ( "whatsapp" ) ;
261280 } ,
262281 params : { cfg : { channels : { whatsapp : { enabled : true } } } as never } ,
263282 expectedMessage :
0 commit comments