diff --git a/src/cron/isolated-agent.isolated-auth-session-flag.test.ts b/src/cron/isolated-agent.isolated-auth-session-flag.test.ts index 140b4933878..826193d63bf 100644 --- a/src/cron/isolated-agent.isolated-auth-session-flag.test.ts +++ b/src/cron/isolated-agent.isolated-auth-session-flag.test.ts @@ -12,15 +12,18 @@ import { const runCronIsolatedAgentTurn = await loadRunCronIsolatedAgentTurn(); -function makeParams(overrides?: Record) { +type RunCronIsolatedAgentTurnParams = Parameters[0]; + +function makeParams( + overrides?: Partial, +): RunCronIsolatedAgentTurnParams { return { cfg: { auth: { profiles: { "openrouter:default": { - type: "api_key", provider: "openrouter", - key: "sk-or-test-key", + mode: "api_key", }, }, order: { openrouter: ["openrouter:default"] }, diff --git a/src/gateway/server-methods/channels.status.test.ts b/src/gateway/server-methods/channels.status.test.ts index e334052eaec..a7434043659 100644 --- a/src/gateway/server-methods/channels.status.test.ts +++ b/src/gateway/server-methods/channels.status.test.ts @@ -25,6 +25,7 @@ vi.mock("../../config/plugin-auto-enable.js", () => ({ vi.mock("../../channels/plugins/index.js", () => ({ listChannelPlugins: mocks.listChannelPlugins, + getLoadedChannelPlugin: vi.fn(), getChannelPlugin: vi.fn(), normalizeChannelId: (value: string) => value, })); diff --git a/src/gateway/server-methods/commands.test.ts b/src/gateway/server-methods/commands.test.ts index 348cd353bcf..ddca9c4e870 100644 --- a/src/gateway/server-methods/commands.test.ts +++ b/src/gateway/server-methods/commands.test.ts @@ -108,6 +108,27 @@ vi.mock("../../agents/agent-scope.js", () => ({ resolveDefaultAgentId: vi.fn(() => "main"), })); vi.mock("../../channels/plugins/index.js", () => ({ + getLoadedChannelPlugin: vi.fn((provider: string) => { + if (provider === "discord") { + return { + commands: { + resolveNativeCommandName: ({ + commandKey, + defaultName, + }: { + commandKey: string; + defaultName: string; + }) => { + if (commandKey === "model") { + return "set_model"; + } + return defaultName; + }, + }, + }; + } + return undefined; + }), getChannelPlugin: vi.fn((provider: string) => { if (provider === "discord") { return { diff --git a/src/gateway/server-methods/send.test.ts b/src/gateway/server-methods/send.test.ts index 15044fa43ef..3b1b7f141b1 100644 --- a/src/gateway/server-methods/send.test.ts +++ b/src/gateway/server-methods/send.test.ts @@ -39,6 +39,7 @@ vi.mock("../../config/config.js", async () => { }); vi.mock("../../channels/plugins/index.js", () => ({ + getLoadedChannelPlugin: mocks.getChannelPlugin, getChannelPlugin: mocks.getChannelPlugin, normalizeChannelId: (value: string) => (value === "webchat" ? null : value), })); diff --git a/src/infra/outbound/channel-selection.test.ts b/src/infra/outbound/channel-selection.test.ts index 092d9f65e5d..aa9bf18070c 100644 --- a/src/infra/outbound/channel-selection.test.ts +++ b/src/infra/outbound/channel-selection.test.ts @@ -6,6 +6,7 @@ const mocks = vi.hoisted(() => ({ })); vi.mock("../../channels/plugins/index.js", () => ({ + getLoadedChannelPlugin: vi.fn(), listChannelPlugins: mocks.listChannelPlugins, })); diff --git a/src/infra/outbound/format.test.ts b/src/infra/outbound/format.test.ts index 66172750369..37e5b4607f6 100644 --- a/src/infra/outbound/format.test.ts +++ b/src/infra/outbound/format.test.ts @@ -8,6 +8,7 @@ import { const getChannelPluginMock = vi.hoisted(() => vi.fn((_channel: unknown) => undefined)); vi.mock("../../channels/plugins/index.js", () => ({ + getLoadedChannelPlugin: getChannelPluginMock, getChannelPlugin: getChannelPluginMock, })); describe("formatOutboundDeliverySummary", () => { diff --git a/src/infra/outbound/message.test.ts b/src/infra/outbound/message.test.ts index 62cfbea14d2..af2e8ed3354 100644 --- a/src/infra/outbound/message.test.ts +++ b/src/infra/outbound/message.test.ts @@ -9,6 +9,7 @@ const mocks = vi.hoisted(() => ({ vi.mock("../../channels/plugins/index.js", () => ({ normalizeChannelId: (channel?: string) => channel?.trim().toLowerCase() ?? undefined, + getLoadedChannelPlugin: mocks.getChannelPlugin, getChannelPlugin: mocks.getChannelPlugin, listChannelPlugins: () => [], })); diff --git a/src/infra/outbound/target-resolver.test.ts b/src/infra/outbound/target-resolver.test.ts index 28069dfb0a1..b2fb8d7f2ef 100644 --- a/src/infra/outbound/target-resolver.test.ts +++ b/src/infra/outbound/target-resolver.test.ts @@ -18,6 +18,7 @@ const mocks = vi.hoisted(() => ({ })); vi.mock("../../channels/plugins/index.js", () => ({ + getLoadedChannelPlugin: (...args: unknown[]) => mocks.getChannelPlugin(...args), getChannelPlugin: (...args: unknown[]) => mocks.getChannelPlugin(...args), normalizeChannelId: (value: string) => value, }));