refactor(cli): split outbound send deps
This commit is contained in:
23
src/cli/outbound-send-deps.ts
Normal file
23
src/cli/outbound-send-deps.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import type { OutboundSendDeps } from "../infra/outbound/deliver.js";
|
||||||
|
|
||||||
|
export type CliDeps = {
|
||||||
|
sendMessageWhatsApp: NonNullable<OutboundSendDeps["sendWhatsApp"]>;
|
||||||
|
sendMessageTelegram: NonNullable<OutboundSendDeps["sendTelegram"]>;
|
||||||
|
sendMessageDiscord: NonNullable<OutboundSendDeps["sendDiscord"]>;
|
||||||
|
sendMessageSlack: NonNullable<OutboundSendDeps["sendSlack"]>;
|
||||||
|
sendMessageSignal: NonNullable<OutboundSendDeps["sendSignal"]>;
|
||||||
|
sendMessageIMessage: NonNullable<OutboundSendDeps["sendIMessage"]>;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Provider docking: extend this mapping when adding new outbound send deps.
|
||||||
|
export function createOutboundSendDeps(deps: CliDeps): OutboundSendDeps {
|
||||||
|
return {
|
||||||
|
sendWhatsApp: deps.sendMessageWhatsApp,
|
||||||
|
sendTelegram: deps.sendMessageTelegram,
|
||||||
|
sendDiscord: deps.sendMessageDiscord,
|
||||||
|
sendSlack: deps.sendMessageSlack,
|
||||||
|
sendSignal: deps.sendMessageSignal,
|
||||||
|
sendIMessage: deps.sendMessageIMessage,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
import { getChannelPlugin, normalizeChannelId } from "../../channels/plugins/index.js";
|
import { getChannelPlugin, normalizeChannelId } from "../../channels/plugins/index.js";
|
||||||
import type { ChannelOutboundTargetMode } from "../../channels/plugins/types.js";
|
import type { ChannelOutboundTargetMode } from "../../channels/plugins/types.js";
|
||||||
import { DEFAULT_CHAT_CHANNEL } from "../../channels/registry.js";
|
import { DEFAULT_CHAT_CHANNEL } from "../../channels/registry.js";
|
||||||
import type { CliDeps } from "../../cli/deps.js";
|
import { createOutboundSendDeps, type CliDeps } from "../../cli/outbound-send-deps.js";
|
||||||
import { createOutboundSendDeps } from "../../cli/deps.js";
|
|
||||||
import type { ClawdbotConfig } from "../../config/config.js";
|
import type { ClawdbotConfig } from "../../config/config.js";
|
||||||
import type { SessionEntry } from "../../config/sessions.js";
|
import type { SessionEntry } from "../../config/sessions.js";
|
||||||
import { deliverOutboundPayloads } from "../../infra/outbound/deliver.js";
|
import { deliverOutboundPayloads } from "../../infra/outbound/deliver.js";
|
||||||
|
|||||||
@@ -316,6 +316,10 @@ vi.mock("./doctor-state-migrations.js", () => ({
|
|||||||
}),
|
}),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
vi.mock("./doctor-update.js", () => ({
|
||||||
|
maybeOfferUpdateBeforeDoctor: vi.fn().mockResolvedValue({ handled: false }),
|
||||||
|
}));
|
||||||
|
|
||||||
describe("doctor command", () => {
|
describe("doctor command", () => {
|
||||||
it("warns when the state directory is missing", async () => {
|
it("warns when the state directory is missing", async () => {
|
||||||
readConfigFileSnapshot.mockResolvedValue({
|
readConfigFileSnapshot.mockResolvedValue({
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import {
|
|||||||
CHANNEL_MESSAGE_ACTION_NAMES,
|
CHANNEL_MESSAGE_ACTION_NAMES,
|
||||||
type ChannelMessageActionName,
|
type ChannelMessageActionName,
|
||||||
} from "../channels/plugins/types.js";
|
} from "../channels/plugins/types.js";
|
||||||
import { createOutboundSendDeps, type CliDeps } from "../cli/deps.js";
|
import { createOutboundSendDeps, type CliDeps } from "../cli/outbound-send-deps.js";
|
||||||
import { withProgress } from "../cli/progress.js";
|
import { withProgress } from "../cli/progress.js";
|
||||||
import { loadConfig } from "../config/config.js";
|
import { loadConfig } from "../config/config.js";
|
||||||
import type { OutboundSendDeps } from "../infra/outbound/deliver.js";
|
import type { OutboundSendDeps } from "../infra/outbound/deliver.js";
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import {
|
|||||||
normalizeThinkLevel,
|
normalizeThinkLevel,
|
||||||
supportsXHighThinking,
|
supportsXHighThinking,
|
||||||
} from "../../auto-reply/thinking.js";
|
} from "../../auto-reply/thinking.js";
|
||||||
import { createOutboundSendDeps, type CliDeps } from "../../cli/deps.js";
|
import { createOutboundSendDeps, type CliDeps } from "../../cli/outbound-send-deps.js";
|
||||||
import type { ClawdbotConfig } from "../../config/config.js";
|
import type { ClawdbotConfig } from "../../config/config.js";
|
||||||
import { resolveSessionTranscriptPath, updateSessionStore } from "../../config/sessions.js";
|
import { resolveSessionTranscriptPath, updateSessionStore } from "../../config/sessions.js";
|
||||||
import type { AgentDefaultsConfig } from "../../config/types.js";
|
import type { AgentDefaultsConfig } from "../../config/types.js";
|
||||||
|
|||||||
Reference in New Issue
Block a user