refactor: rename clawdbot to moltbot with legacy compat

This commit is contained in:
Peter Steinberger
2026-01-27 12:19:58 +00:00
parent 83460df96f
commit 6d16a658e5
1839 changed files with 11250 additions and 11199 deletions

View File

@@ -12,7 +12,7 @@ vi.mock("./targets.js", async () => {
};
});
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { resolveAgentDeliveryPlan, resolveAgentOutboundTarget } from "./agent-delivery.js";
describe("agent delivery helpers", () => {
@@ -45,7 +45,7 @@ describe("agent delivery helpers", () => {
});
const resolved = resolveAgentOutboundTarget({
cfg: {} as ClawdbotConfig,
cfg: {} as MoltbotConfig,
plan,
targetMode: "implicit",
});
@@ -68,7 +68,7 @@ describe("agent delivery helpers", () => {
mocks.resolveOutboundTarget.mockClear();
const resolved = resolveAgentOutboundTarget({
cfg: {} as ClawdbotConfig,
cfg: {} as MoltbotConfig,
plan,
targetMode: "explicit",
validateExplicitTarget: false,

View File

@@ -14,7 +14,7 @@ import {
resolveSessionDeliveryTarget,
type SessionDeliveryTarget,
} from "./targets.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OutboundTargetResolution } from "./targets.js";
export type AgentDeliveryPlan = {
@@ -98,7 +98,7 @@ export function resolveAgentDeliveryPlan(params: {
}
export function resolveAgentOutboundTarget(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
plan: AgentDeliveryPlan;
targetMode?: ChannelOutboundTargetMode;
validateExplicitTarget?: boolean;

View File

@@ -1,6 +1,6 @@
import { listChannelPlugins } from "../../channels/plugins/index.js";
import type { ChannelPlugin } from "../../channels/plugins/types.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import {
listDeliverableMessageChannels,
type DeliverableMessageChannel,
@@ -21,7 +21,7 @@ function isAccountEnabled(account: unknown): boolean {
return enabled !== false;
}
async function isPluginConfigured(plugin: ChannelPlugin, cfg: ClawdbotConfig): Promise<boolean> {
async function isPluginConfigured(plugin: ChannelPlugin, cfg: MoltbotConfig): Promise<boolean> {
const accountIds = plugin.config.listAccountIds(cfg);
if (accountIds.length === 0) return false;
@@ -40,7 +40,7 @@ async function isPluginConfigured(plugin: ChannelPlugin, cfg: ClawdbotConfig): P
}
export async function listConfiguredMessageChannels(
cfg: ClawdbotConfig,
cfg: MoltbotConfig,
): Promise<MessageChannelId[]> {
const channels: MessageChannelId[] = [];
for (const plugin of listChannelPlugins()) {
@@ -53,7 +53,7 @@ export async function listConfiguredMessageChannels(
}
export async function resolveMessageChannelSelection(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
channel?: string | null;
}): Promise<{ channel: MessageChannelId; configured: MessageChannelId[] }> {
const normalized = normalizeMessageChannel(params.channel);

View File

@@ -1,6 +1,6 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { signalOutbound } from "../../channels/plugins/outbound/signal.js";
import { telegramOutbound } from "../../channels/plugins/outbound/telegram.js";
import { whatsappOutbound } from "../../channels/plugins/outbound/whatsapp.js";
@@ -38,7 +38,7 @@ describe("deliverOutboundPayloads", () => {
});
it("chunks telegram markdown and passes through accountId", async () => {
const sendTelegram = vi.fn().mockResolvedValue({ messageId: "m1", chatId: "c1" });
const cfg: ClawdbotConfig = {
const cfg: MoltbotConfig = {
channels: { telegram: { botToken: "tok-1", textChunkLimit: 2 } },
};
const prevTelegramToken = process.env.TELEGRAM_BOT_TOKEN;
@@ -71,7 +71,7 @@ describe("deliverOutboundPayloads", () => {
it("passes explicit accountId to sendTelegram", async () => {
const sendTelegram = vi.fn().mockResolvedValue({ messageId: "m1", chatId: "c1" });
const cfg: ClawdbotConfig = {
const cfg: MoltbotConfig = {
channels: { telegram: { botToken: "tok-1", textChunkLimit: 2 } },
};
@@ -93,7 +93,7 @@ describe("deliverOutboundPayloads", () => {
it("uses signal media maxBytes from config", async () => {
const sendSignal = vi.fn().mockResolvedValue({ messageId: "s1", timestamp: 123 });
const cfg: ClawdbotConfig = { channels: { signal: { mediaMaxMb: 2 } } };
const cfg: MoltbotConfig = { channels: { signal: { mediaMaxMb: 2 } } };
const results = await deliverOutboundPayloads({
cfg,
@@ -118,7 +118,7 @@ describe("deliverOutboundPayloads", () => {
it("chunks Signal markdown using the format-first chunker", async () => {
const sendSignal = vi.fn().mockResolvedValue({ messageId: "s1", timestamp: 123 });
const cfg: ClawdbotConfig = {
const cfg: MoltbotConfig = {
channels: { signal: { textChunkLimit: 20 } },
};
const text = `Intro\\n\\n\`\`\`\`md\\n${"y".repeat(60)}\\n\`\`\`\\n\\nOutro`;
@@ -152,7 +152,7 @@ describe("deliverOutboundPayloads", () => {
.fn()
.mockResolvedValueOnce({ messageId: "w1", toJid: "jid" })
.mockResolvedValueOnce({ messageId: "w2", toJid: "jid" });
const cfg: ClawdbotConfig = {
const cfg: MoltbotConfig = {
channels: { whatsapp: { textChunkLimit: 2 } },
};
@@ -170,7 +170,7 @@ describe("deliverOutboundPayloads", () => {
it("respects newline chunk mode for WhatsApp", async () => {
const sendWhatsApp = vi.fn().mockResolvedValue({ messageId: "w1", toJid: "jid" });
const cfg: ClawdbotConfig = {
const cfg: MoltbotConfig = {
channels: { whatsapp: { textChunkLimit: 4000, chunkMode: "newline" } },
};
@@ -229,7 +229,7 @@ describe("deliverOutboundPayloads", () => {
]),
);
const cfg: ClawdbotConfig = {
const cfg: MoltbotConfig = {
channels: { matrix: { textChunkLimit: 4000, chunkMode: "newline" } },
};
const text = "```js\nconst a = 1;\nconst b = 2;\n```\nAfter";
@@ -256,7 +256,7 @@ describe("deliverOutboundPayloads", () => {
},
]),
);
const cfg: ClawdbotConfig = {
const cfg: MoltbotConfig = {
agents: { defaults: { mediaMaxMb: 3 } },
};
@@ -293,7 +293,7 @@ describe("deliverOutboundPayloads", () => {
.mockRejectedValueOnce(new Error("fail"))
.mockResolvedValueOnce({ messageId: "w2", toJid: "jid" });
const onError = vi.fn();
const cfg: ClawdbotConfig = {};
const cfg: MoltbotConfig = {};
const results = await deliverOutboundPayloads({
cfg,
@@ -313,7 +313,7 @@ describe("deliverOutboundPayloads", () => {
it("passes normalized payload to onError", async () => {
const sendWhatsApp = vi.fn().mockRejectedValue(new Error("boom"));
const onError = vi.fn();
const cfg: ClawdbotConfig = {};
const cfg: MoltbotConfig = {};
await deliverOutboundPayloads({
cfg,
@@ -334,7 +334,7 @@ describe("deliverOutboundPayloads", () => {
it("mirrors delivered output when mirror options are provided", async () => {
const sendTelegram = vi.fn().mockResolvedValue({ messageId: "m1", chatId: "c1" });
const cfg: ClawdbotConfig = {
const cfg: MoltbotConfig = {
channels: { telegram: { botToken: "tok-1", textChunkLimit: 2 } },
};
mocks.appendAssistantMessageToSessionTranscript.mockClear();

View File

@@ -8,7 +8,7 @@ import type { ReplyPayload } from "../../auto-reply/types.js";
import { resolveChannelMediaMaxBytes } from "../../channels/plugins/media-limits.js";
import { loadChannelOutboundAdapter } from "../../channels/plugins/outbound/load.js";
import type { ChannelOutboundAdapter } from "../../channels/plugins/types.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { resolveMarkdownTableMode } from "../../config/markdown-tables.js";
import type { sendMessageDiscord } from "../../discord/send.js";
import type { sendMessageIMessage } from "../../imessage/send.js";
@@ -82,7 +82,7 @@ function throwIfAborted(abortSignal?: AbortSignal): void {
// Channel docking: outbound delivery delegates to plugin.outbound adapters.
async function createChannelHandler(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
channel: Exclude<OutboundChannel, "none">;
to: string;
accountId?: string;
@@ -114,7 +114,7 @@ async function createChannelHandler(params: {
function createPluginHandler(params: {
outbound?: ChannelOutboundAdapter;
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
channel: Exclude<OutboundChannel, "none">;
to: string;
accountId?: string;
@@ -175,7 +175,7 @@ function createPluginHandler(params: {
}
export async function deliverOutboundPayloads(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
channel: Exclude<OutboundChannel, "none">;
to: string;
accountId?: string;

View File

@@ -1,5 +1,5 @@
import type { ChannelDirectoryEntryKind, ChannelId } from "../../channels/plugins/types.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
type CacheEntry<T> = {
value: T;
@@ -21,11 +21,11 @@ export function buildDirectoryCacheKey(key: DirectoryCacheKey): string {
export class DirectoryCache<T> {
private readonly cache = new Map<string, CacheEntry<T>>();
private lastConfigRef: ClawdbotConfig | null = null;
private lastConfigRef: MoltbotConfig | null = null;
constructor(private readonly ttlMs: number) {}
get(key: string, cfg: ClawdbotConfig): T | undefined {
get(key: string, cfg: MoltbotConfig): T | undefined {
this.resetIfConfigChanged(cfg);
const entry = this.cache.get(key);
if (!entry) return undefined;
@@ -36,7 +36,7 @@ export class DirectoryCache<T> {
return entry.value;
}
set(key: string, value: T, cfg: ClawdbotConfig): void {
set(key: string, value: T, cfg: MoltbotConfig): void {
this.resetIfConfigChanged(cfg);
this.cache.set(key, { value, fetchedAt: Date.now() });
}
@@ -47,12 +47,12 @@ export class DirectoryCache<T> {
}
}
clear(cfg?: ClawdbotConfig): void {
clear(cfg?: MoltbotConfig): void {
this.cache.clear();
if (cfg) this.lastConfigRef = cfg;
}
private resetIfConfigChanged(cfg: ClawdbotConfig): void {
private resetIfConfigChanged(cfg: MoltbotConfig): void {
if (this.lastConfigRef && this.lastConfigRef !== cfg) {
this.cache.clear();
}

View File

@@ -1,6 +1,6 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { setActivePluginRegistry } from "../../plugins/runtime.js";
import { createIMessageTestPlugin, createTestRegistry } from "../../test-utils/channel-plugins.js";
import { slackPlugin } from "../../../extensions/slack/src/channel.js";
@@ -26,7 +26,7 @@ const slackConfig = {
appToken: "xapp-test",
},
},
} as ClawdbotConfig;
} as MoltbotConfig;
const whatsappConfig = {
channels: {
@@ -34,7 +34,7 @@ const whatsappConfig = {
allowFrom: ["*"],
},
},
} as ClawdbotConfig;
} as MoltbotConfig;
describe("runMessageAction context isolation", () => {
beforeEach(async () => {
@@ -263,7 +263,7 @@ describe("runMessageAction context isolation", () => {
token: "tg-test",
},
},
} as ClawdbotConfig;
} as MoltbotConfig;
const result = await runMessageAction({
cfg: multiConfig,
@@ -305,7 +305,7 @@ describe("runMessageAction context isolation", () => {
},
},
},
} as ClawdbotConfig;
} as MoltbotConfig;
await expect(
runMessageAction({
@@ -423,7 +423,7 @@ describe("runMessageAction sendAttachment hydration", () => {
password: "test-password",
},
},
} as ClawdbotConfig;
} as MoltbotConfig;
const result = await runMessageAction({
cfg,
@@ -491,7 +491,7 @@ describe("runMessageAction accountId defaults", () => {
it("propagates defaultAccountId into params", async () => {
await runMessageAction({
cfg: {} as ClawdbotConfig,
cfg: {} as MoltbotConfig,
action: "send",
params: {
channel: "discord",

View File

@@ -1,6 +1,6 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { setActivePluginRegistry } from "../../plugins/runtime.js";
import { createTestRegistry } from "../../test-utils/channel-plugins.js";
import { slackPlugin } from "../../../extensions/slack/src/channel.js";
@@ -39,7 +39,7 @@ const slackConfig = {
appToken: "xapp-test",
},
},
} as ClawdbotConfig;
} as MoltbotConfig;
describe("runMessageAction Slack threading", () => {
beforeEach(async () => {

View File

@@ -15,7 +15,7 @@ import type {
ChannelMessageActionName,
ChannelThreadingToolContext,
} from "../../channels/plugins/types.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import {
isDeliverableMessageChannel,
normalizeMessageChannel,
@@ -54,7 +54,7 @@ export type MessageActionRunnerGateway = {
};
export type RunMessageActionParams = {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
action: ChannelMessageActionName;
params: Record<string, unknown>;
defaultAccountId?: string;
@@ -168,7 +168,7 @@ function applyCrossContextMessageDecoration({
}
async function maybeApplyCrossContextMarker(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
channel: ChannelId;
action: ChannelMessageActionName;
target: string;
@@ -224,7 +224,7 @@ function resolveSlackAutoThreadId(params: {
}
function resolveAttachmentMaxBytes(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
channel: ChannelId;
accountId?: string | null;
}): number | undefined {
@@ -298,7 +298,7 @@ function normalizeBase64Payload(params: { base64?: string; contentType?: string
}
async function hydrateSetGroupIconParams(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
channel: ChannelId;
accountId?: string | null;
args: Record<string, unknown>;
@@ -355,7 +355,7 @@ async function hydrateSetGroupIconParams(params: {
}
async function hydrateSendAttachmentParams(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
channel: ChannelId;
accountId?: string | null;
args: Record<string, unknown>;
@@ -444,7 +444,7 @@ function parseCardParam(params: Record<string, unknown>): void {
}
}
async function resolveChannel(cfg: ClawdbotConfig, params: Record<string, unknown>) {
async function resolveChannel(cfg: MoltbotConfig, params: Record<string, unknown>) {
const channelHint = readStringParam(params, "channel");
const selection = await resolveMessageChannelSelection({
cfg,
@@ -454,7 +454,7 @@ async function resolveChannel(cfg: ClawdbotConfig, params: Record<string, unknow
}
async function resolveActionTarget(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
channel: ChannelId;
action: ChannelMessageActionName;
args: Record<string, unknown>;
@@ -499,7 +499,7 @@ async function resolveActionTarget(params: {
}
type ResolvedActionContext = {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
params: Record<string, unknown>;
channel: ChannelId;
accountId?: string | null;

View File

@@ -1,6 +1,6 @@
import { getChannelPlugin, normalizeChannelId } from "../../channels/plugins/index.js";
import type { ChannelId } from "../../channels/plugins/types.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { loadConfig } from "../../config/config.js";
import { callGateway, randomIdempotencyKey } from "../../gateway/call.js";
import type { PollInput } from "../../polls.js";
@@ -41,7 +41,7 @@ type MessageSendParams = {
dryRun?: boolean;
bestEffort?: boolean;
deps?: OutboundSendDeps;
cfg?: ClawdbotConfig;
cfg?: MoltbotConfig;
gateway?: MessageGatewayOptions;
idempotencyKey?: string;
mirror?: {
@@ -71,7 +71,7 @@ type MessagePollParams = {
durationHours?: number;
channel?: string;
dryRun?: boolean;
cfg?: ClawdbotConfig;
cfg?: MoltbotConfig;
gateway?: MessageGatewayOptions;
idempotencyKey?: string;
};

View File

@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import {
applyCrossContextDecoration,
buildCrossContextDecoration,
@@ -14,13 +14,13 @@ const slackConfig = {
appToken: "xapp-test",
},
},
} as ClawdbotConfig;
} as MoltbotConfig;
const discordConfig = {
channels: {
discord: {},
},
} as ClawdbotConfig;
} as MoltbotConfig;
describe("outbound policy", () => {
it("blocks cross-provider sends by default", () => {
@@ -41,7 +41,7 @@ describe("outbound policy", () => {
tools: {
message: { crossContext: { allowAcrossProviders: true } },
},
} as ClawdbotConfig;
} as MoltbotConfig;
expect(() =>
enforceCrossContextPolicy({
@@ -58,7 +58,7 @@ describe("outbound policy", () => {
const cfg = {
...slackConfig,
tools: { message: { crossContext: { allowWithinProvider: false } } },
} as ClawdbotConfig;
} as MoltbotConfig;
expect(() =>
enforceCrossContextPolicy({

View File

@@ -4,7 +4,7 @@ import type {
ChannelMessageActionName,
ChannelThreadingToolContext,
} from "../../channels/plugins/types.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { getChannelMessageAdapter } from "./channel-adapters.js";
import { formatTargetDisplay, lookupDirectoryDisplay } from "./target-resolver.js";
@@ -74,7 +74,7 @@ export function enforceCrossContextPolicy(params: {
action: ChannelMessageActionName;
args: Record<string, unknown>;
toolContext?: ChannelThreadingToolContext;
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
}): void {
const currentTarget = params.toolContext?.currentChannelId?.trim();
if (!currentTarget) return;
@@ -112,7 +112,7 @@ export function enforceCrossContextPolicy(params: {
}
export async function buildCrossContextDecoration(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
channel: ChannelId;
target: string;
toolContext?: ChannelThreadingToolContext;

View File

@@ -1,7 +1,7 @@
import type { AgentToolResult } from "@mariozechner/pi-agent-core";
import { dispatchChannelMessageAction } from "../../channels/plugins/message-actions.js";
import type { ChannelId, ChannelThreadingToolContext } from "../../channels/plugins/types.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { appendAssistantMessageToSessionTranscript } from "../../config/sessions.js";
import type { GatewayClientMode, GatewayClientName } from "../../utils/message-channel.js";
import type { OutboundSendDeps } from "./deliver.js";
@@ -18,7 +18,7 @@ export type OutboundGatewayContext = {
};
export type OutboundSendContext = {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
channel: ChannelId;
params: Record<string, unknown>;
accountId?: string | null;

View File

@@ -1,9 +1,9 @@
import { describe, expect, it } from "vitest";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { resolveOutboundSessionRoute } from "./outbound-session.js";
const baseConfig = {} as ClawdbotConfig;
const baseConfig = {} as MoltbotConfig;
describe("resolveOutboundSessionRoute", () => {
it("builds Slack thread session keys", async () => {
@@ -36,7 +36,7 @@ describe("resolveOutboundSessionRoute", () => {
});
it("treats Telegram usernames as DMs when unresolved", async () => {
const cfg = { session: { dmScope: "per-channel-peer" } } as ClawdbotConfig;
const cfg = { session: { dmScope: "per-channel-peer" } } as MoltbotConfig;
const route = await resolveOutboundSessionRoute({
cfg,
channel: "telegram",
@@ -56,7 +56,7 @@ describe("resolveOutboundSessionRoute", () => {
alice: ["discord:123"],
},
},
} as ClawdbotConfig;
} as MoltbotConfig;
const route = await resolveOutboundSessionRoute({
cfg,
@@ -81,7 +81,7 @@ describe("resolveOutboundSessionRoute", () => {
});
it("treats Zalo Personal DM targets as direct sessions", async () => {
const cfg = { session: { dmScope: "per-channel-peer" } } as ClawdbotConfig;
const cfg = { session: { dmScope: "per-channel-peer" } } as MoltbotConfig;
const route = await resolveOutboundSessionRoute({
cfg,
channel: "zalouser",
@@ -102,7 +102,7 @@ describe("resolveOutboundSessionRoute", () => {
},
},
},
} as ClawdbotConfig;
} as MoltbotConfig;
const route = await resolveOutboundSessionRoute({
cfg,

View File

@@ -1,7 +1,7 @@
import type { MsgContext } from "../../auto-reply/templating.js";
import { getChannelPlugin } from "../../channels/plugins/index.js";
import type { ChannelId } from "../../channels/plugins/types.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { recordSessionMetaFromInbound, resolveStorePath } from "../../config/sessions.js";
import { parseDiscordTarget } from "../../discord/targets.js";
import { parseIMessageTarget, normalizeIMessageHandle } from "../../imessage/targets.js";
@@ -37,7 +37,7 @@ export type OutboundSessionRoute = {
};
export type ResolveOutboundSessionRouteParams = {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
channel: ChannelId;
agentId: string;
accountId?: string | null;
@@ -100,7 +100,7 @@ function inferPeerKind(params: {
}
function buildBaseSessionKey(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
agentId: string;
channel: ChannelId;
peer: RoutePeer;
@@ -116,7 +116,7 @@ function buildBaseSessionKey(params: {
// Best-effort mpim detection: allowlist/config, then Slack API (if token available).
async function resolveSlackChannelType(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId?: string | null;
channelId: string;
}): Promise<"channel" | "group" | "dm" | "unknown"> {
@@ -805,7 +805,7 @@ export async function resolveOutboundSessionRoute(
}
export async function ensureOutboundSessionEntry(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
agentId: string;
channel: ChannelId;
accountId?: string | null;

View File

@@ -1,7 +1,7 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { ChannelDirectoryEntry } from "../../channels/plugins/types.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { resetDirectoryCache, resolveMessagingTarget } from "./target-resolver.js";
const mocks = vi.hoisted(() => ({
@@ -16,7 +16,7 @@ vi.mock("../../channels/plugins/index.js", () => ({
}));
describe("resolveMessagingTarget (directory fallback)", () => {
const cfg = {} as ClawdbotConfig;
const cfg = {} as MoltbotConfig;
beforeEach(() => {
mocks.listGroups.mockReset();

View File

@@ -4,7 +4,7 @@ import type {
ChannelDirectoryEntryKind,
ChannelId,
} from "../../channels/plugins/types.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { defaultRuntime, type RuntimeEnv } from "../../runtime.js";
import { buildDirectoryCacheKey, DirectoryCache } from "./directory-cache.js";
import {
@@ -30,7 +30,7 @@ export type ResolveMessagingTargetResult =
| { ok: false; error: Error; candidates?: ChannelDirectoryEntry[] };
export async function resolveChannelTarget(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
channel: ChannelId;
input: string;
accountId?: string | null;
@@ -177,7 +177,7 @@ function resolveMatch(params: {
}
async function listDirectoryEntries(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
channel: ChannelId;
accountId?: string | null;
kind: ChannelDirectoryEntryKind;
@@ -213,7 +213,7 @@ async function listDirectoryEntries(params: {
}
async function getDirectoryEntries(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
channel: ChannelId;
accountId?: string | null;
kind: ChannelDirectoryEntryKind;
@@ -281,7 +281,7 @@ function pickAmbiguousMatch(
}
export async function resolveMessagingTarget(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
channel: ChannelId;
input: string;
accountId?: string | null;
@@ -397,7 +397,7 @@ export async function resolveMessagingTarget(params: {
}
export async function lookupDirectoryDisplay(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
channel: ChannelId;
targetId: string;
accountId?: string | null;

View File

@@ -1,5 +1,5 @@
import { beforeEach, describe, expect, it } from "vitest";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { setActivePluginRegistry } from "../../plugins/runtime.js";
import { createTestRegistry } from "../../test-utils/channel-plugins.js";
@@ -18,7 +18,7 @@ describe("resolveOutboundTarget", () => {
});
it("falls back to whatsapp allowFrom via config", () => {
const cfg: ClawdbotConfig = {
const cfg: MoltbotConfig = {
channels: { whatsapp: { allowFrom: ["+1555"] } },
};
const res = resolveOutboundTarget({

View File

@@ -1,7 +1,7 @@
import { getChannelPlugin, normalizeChannelId } from "../../channels/plugins/index.js";
import { formatCliCommand } from "../../cli/command-format.js";
import type { ChannelId, ChannelOutboundTargetMode } from "../../channels/plugins/types.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { SessionEntry } from "../../config/sessions.js";
import type { AgentDefaultsConfig } from "../../config/types.agent-defaults.js";
import { deliveryContextFromSession } from "../../utils/delivery-context.js";
@@ -119,7 +119,7 @@ export function resolveOutboundTarget(params: {
channel: GatewayMessageChannel;
to?: string;
allowFrom?: string[];
cfg?: ClawdbotConfig;
cfg?: MoltbotConfig;
accountId?: string | null;
mode?: ChannelOutboundTargetMode;
}): OutboundTargetResolution {
@@ -127,7 +127,7 @@ export function resolveOutboundTarget(params: {
return {
ok: false,
error: new Error(
`Delivering to WebChat is not supported via \`${formatCliCommand("clawdbot agent")}\`; use WhatsApp/Telegram or run with --deliver=false.`,
`Delivering to WebChat is not supported via \`${formatCliCommand("moltbot agent")}\`; use WhatsApp/Telegram or run with --deliver=false.`,
),
};
}
@@ -172,7 +172,7 @@ export function resolveOutboundTarget(params: {
}
export function resolveHeartbeatDeliveryTarget(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
entry?: SessionEntry;
heartbeat?: AgentDefaultsConfig["heartbeat"];
}): OutboundTarget {
@@ -289,7 +289,7 @@ function resolveHeartbeatSenderId(params: {
}
export function resolveHeartbeatSenderContext(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
entry?: SessionEntry;
delivery: OutboundTarget;
}): HeartbeatSenderContext {