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

@@ -1,4 +1,4 @@
import type { ClawdbotConfig } from "../config/config.js";
import type { MoltbotConfig } from "../config/config.js";
import { resolveDiscordAccount } from "../discord/accounts.js";
import { resolveIMessageAccount } from "../imessage/accounts.js";
import { resolveSignalAccount } from "../signal/accounts.js";
@@ -48,11 +48,11 @@ export type ChannelDock = {
elevated?: ChannelElevatedAdapter;
config?: {
resolveAllowFrom?: (params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId?: string | null;
}) => Array<string | number> | undefined;
formatAllowFrom?: (params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId?: string | null;
allowFrom: Array<string | number>;
}) => string[];

View File

@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from "vitest";
import type { ClawdbotConfig } from "../../../config/config.js";
import type { MoltbotConfig } from "../../../config/config.js";
type SendMessageDiscord = typeof import("../../../discord/send.js").sendMessageDiscord;
type SendPollDiscord = typeof import("../../../discord/send.js").sendPollDiscord;
@@ -34,7 +34,7 @@ const loadDiscordMessageActions = async () => {
describe("discord message actions", () => {
it("lists channel and upload actions by default", async () => {
const cfg = { channels: { discord: { token: "d0" } } } as ClawdbotConfig;
const cfg = { channels: { discord: { token: "d0" } } } as MoltbotConfig;
const discordMessageActions = await loadDiscordMessageActions();
const actions = discordMessageActions.listActions?.({ cfg }) ?? [];
@@ -46,7 +46,7 @@ describe("discord message actions", () => {
it("respects disabled channel actions", async () => {
const cfg = {
channels: { discord: { token: "d0", actions: { channels: false } } },
} as ClawdbotConfig;
} as MoltbotConfig;
const discordMessageActions = await loadDiscordMessageActions();
const actions = discordMessageActions.listActions?.({ cfg }) ?? [];
@@ -65,7 +65,7 @@ describe("handleDiscordMessageAction", () => {
to: "channel:123",
message: "hi",
},
cfg: {} as ClawdbotConfig,
cfg: {} as MoltbotConfig,
accountId: "ops",
});
@@ -90,7 +90,7 @@ describe("handleDiscordMessageAction", () => {
pollOption: ["Yes", "No"],
accountId: "marve",
},
cfg: {} as ClawdbotConfig,
cfg: {} as MoltbotConfig,
});
expect(sendPollDiscord).toHaveBeenCalledWith(
@@ -115,7 +115,7 @@ describe("handleDiscordMessageAction", () => {
channelId: "123",
message: "hi",
},
cfg: {} as ClawdbotConfig,
cfg: {} as MoltbotConfig,
accountId: "ops",
});
@@ -141,7 +141,7 @@ describe("handleDiscordMessageAction", () => {
channelId: "123",
message: "hi",
},
cfg: {} as ClawdbotConfig,
cfg: {} as MoltbotConfig,
accountId: "ops",
});

View File

@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from "vitest";
import type { ClawdbotConfig } from "../../../config/config.js";
import type { MoltbotConfig } from "../../../config/config.js";
import { signalMessageActions } from "./signal.js";
const sendReactionSignal = vi.fn(async () => ({ ok: true }));
@@ -13,14 +13,14 @@ vi.mock("../../../signal/send-reactions.js", () => ({
describe("signalMessageActions", () => {
it("returns no actions when no configured accounts exist", () => {
const cfg = {} as ClawdbotConfig;
const cfg = {} as MoltbotConfig;
expect(signalMessageActions.listActions({ cfg })).toEqual([]);
});
it("hides react when reactions are disabled", () => {
const cfg = {
channels: { signal: { account: "+15550001111", actions: { reactions: false } } },
} as ClawdbotConfig;
} as MoltbotConfig;
expect(signalMessageActions.listActions({ cfg })).toEqual(["send"]);
});
@@ -34,7 +34,7 @@ describe("signalMessageActions", () => {
},
},
},
} as ClawdbotConfig;
} as MoltbotConfig;
expect(signalMessageActions.listActions({ cfg })).toEqual(["send", "react"]);
});
@@ -46,7 +46,7 @@ describe("signalMessageActions", () => {
it("blocks reactions when action gate is disabled", async () => {
const cfg = {
channels: { signal: { account: "+15550001111", actions: { reactions: false } } },
} as ClawdbotConfig;
} as MoltbotConfig;
await expect(
signalMessageActions.handleAction({
@@ -69,7 +69,7 @@ describe("signalMessageActions", () => {
},
},
},
} as ClawdbotConfig;
} as MoltbotConfig;
await signalMessageActions.handleAction({
action: "react",
@@ -87,7 +87,7 @@ describe("signalMessageActions", () => {
sendReactionSignal.mockClear();
const cfg = {
channels: { signal: { account: "+15550001111" } },
} as ClawdbotConfig;
} as MoltbotConfig;
await signalMessageActions.handleAction({
action: "react",
@@ -111,7 +111,7 @@ describe("signalMessageActions", () => {
it("requires targetAuthor for group reactions", async () => {
const cfg = {
channels: { signal: { account: "+15550001111" } },
} as ClawdbotConfig;
} as MoltbotConfig;
await expect(
signalMessageActions.handleAction({
@@ -127,7 +127,7 @@ describe("signalMessageActions", () => {
sendReactionSignal.mockClear();
const cfg = {
channels: { signal: { account: "+15550001111" } },
} as ClawdbotConfig;
} as MoltbotConfig;
await signalMessageActions.handleAction({
action: "react",

View File

@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from "vitest";
import type { ClawdbotConfig } from "../../../config/config.js";
import type { MoltbotConfig } from "../../../config/config.js";
import { telegramMessageActions } from "./telegram.js";
const handleTelegramAction = vi.fn(async () => ({ ok: true }));
@@ -11,7 +11,7 @@ vi.mock("../../../agents/tools/telegram-actions.js", () => ({
describe("telegramMessageActions", () => {
it("excludes sticker actions when not enabled", () => {
const cfg = { channels: { telegram: { botToken: "tok" } } } as ClawdbotConfig;
const cfg = { channels: { telegram: { botToken: "tok" } } } as MoltbotConfig;
const actions = telegramMessageActions.listActions({ cfg });
expect(actions).not.toContain("sticker");
expect(actions).not.toContain("sticker-search");
@@ -19,7 +19,7 @@ describe("telegramMessageActions", () => {
it("allows media-only sends and passes asVoice", async () => {
handleTelegramAction.mockClear();
const cfg = { channels: { telegram: { botToken: "tok" } } } as ClawdbotConfig;
const cfg = { channels: { telegram: { botToken: "tok" } } } as MoltbotConfig;
await telegramMessageActions.handleAction({
action: "send",
@@ -46,7 +46,7 @@ describe("telegramMessageActions", () => {
it("passes silent flag for silent sends", async () => {
handleTelegramAction.mockClear();
const cfg = { channels: { telegram: { botToken: "tok" } } } as ClawdbotConfig;
const cfg = { channels: { telegram: { botToken: "tok" } } } as MoltbotConfig;
await telegramMessageActions.handleAction({
action: "send",
@@ -72,7 +72,7 @@ describe("telegramMessageActions", () => {
it("maps edit action params into editMessage", async () => {
handleTelegramAction.mockClear();
const cfg = { channels: { telegram: { botToken: "tok" } } } as ClawdbotConfig;
const cfg = { channels: { telegram: { botToken: "tok" } } } as MoltbotConfig;
await telegramMessageActions.handleAction({
action: "edit",
@@ -101,7 +101,7 @@ describe("telegramMessageActions", () => {
it("rejects non-integer messageId for edit before reaching telegram-actions", async () => {
handleTelegramAction.mockClear();
const cfg = { channels: { telegram: { botToken: "tok" } } } as ClawdbotConfig;
const cfg = { channels: { telegram: { botToken: "tok" } } } as MoltbotConfig;
await expect(
telegramMessageActions.handleAction({

View File

@@ -18,15 +18,15 @@ describe("channel plugin catalog", () => {
});
it("includes external catalog entries", () => {
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "clawdbot-catalog-"));
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "moltbot-catalog-"));
const catalogPath = path.join(dir, "catalog.json");
fs.writeFileSync(
catalogPath,
JSON.stringify({
entries: [
{
name: "@clawdbot/demo-channel",
clawdbot: {
name: "@moltbot/demo-channel",
moltbot: {
channel: {
id: "demo-channel",
label: "Demo Channel",
@@ -36,7 +36,7 @@ describe("channel plugin catalog", () => {
order: 999,
},
install: {
npmSpec: "@clawdbot/demo-channel",
npmSpec: "@moltbot/demo-channel",
},
},
},

View File

@@ -1,9 +1,10 @@
import fs from "node:fs";
import path from "node:path";
import { discoverClawdbotPlugins } from "../../plugins/discovery.js";
import { LEGACY_MANIFEST_KEY } from "../../compat/legacy-names.js";
import { discoverMoltbotPlugins } from "../../plugins/discovery.js";
import type { PluginOrigin } from "../../plugins/types.js";
import type { ClawdbotPackageManifest } from "../../plugins/manifest.js";
import type { MoltbotPackageManifest } from "../../plugins/manifest.js";
import { CONFIG_DIR, resolveUserPath } from "../../utils.js";
import type { ChannelMeta } from "./types.js";
@@ -49,7 +50,8 @@ type ExternalCatalogEntry = {
name?: string;
version?: string;
description?: string;
clawdbot?: ClawdbotPackageManifest;
moltbot?: MoltbotPackageManifest;
[LEGACY_MANIFEST_KEY]?: MoltbotPackageManifest;
};
const DEFAULT_CATALOG_PATHS = [
@@ -114,7 +116,7 @@ function loadExternalCatalogEntries(options: CatalogOptions): ExternalCatalogEnt
}
function toChannelMeta(params: {
channel: NonNullable<ClawdbotPackageManifest["channel"]>;
channel: NonNullable<MoltbotPackageManifest["channel"]>;
id: string;
}): ChannelMeta | null {
const label = params.channel.label?.trim();
@@ -162,7 +164,7 @@ function toChannelMeta(params: {
}
function resolveInstallInfo(params: {
manifest: ClawdbotPackageManifest;
manifest: MoltbotPackageManifest;
packageName?: string;
packageDir?: string;
workspaceDir?: string;
@@ -185,9 +187,9 @@ function buildCatalogEntry(candidate: {
packageName?: string;
packageDir?: string;
workspaceDir?: string;
packageClawdbot?: ClawdbotPackageManifest;
packageMoltbot?: MoltbotPackageManifest;
}): ChannelPluginCatalogEntry | null {
const manifest = candidate.packageClawdbot;
const manifest = candidate.packageMoltbot;
if (!manifest?.channel) return null;
const id = manifest.channel.id?.trim();
if (!id) return null;
@@ -204,9 +206,10 @@ function buildCatalogEntry(candidate: {
}
function buildExternalCatalogEntry(entry: ExternalCatalogEntry): ChannelPluginCatalogEntry | null {
const manifest = entry.moltbot ?? entry[LEGACY_MANIFEST_KEY];
return buildCatalogEntry({
packageName: entry.name,
packageClawdbot: entry.clawdbot,
packageMoltbot: manifest,
});
}
@@ -241,7 +244,7 @@ export function buildChannelUiCatalog(
export function listChannelPluginCatalogEntries(
options: CatalogOptions = {},
): ChannelPluginCatalogEntry[] {
const discovery = discoverClawdbotPlugins({ workspaceDir: options.workspaceDir });
const discovery = discoverMoltbotPlugins({ workspaceDir: options.workspaceDir });
const resolved = new Map<string, { entry: ChannelPluginCatalogEntry; priority: number }>();
for (const candidate of discovery.candidates) {

View File

@@ -1,4 +1,4 @@
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { DEFAULT_ACCOUNT_ID } from "../../routing/session-key.js";
type ChannelSection = {
@@ -7,12 +7,12 @@ type ChannelSection = {
};
export function setAccountEnabledInConfigSection(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
sectionKey: string;
accountId: string;
enabled: boolean;
allowTopLevel?: boolean;
}): ClawdbotConfig {
}): MoltbotConfig {
const accountKey = params.accountId || DEFAULT_ACCOUNT_ID;
const channels = params.cfg.channels as Record<string, unknown> | undefined;
const base = channels?.[params.sectionKey] as ChannelSection | undefined;
@@ -27,7 +27,7 @@ export function setAccountEnabledInConfigSection(params: {
enabled: params.enabled,
},
},
} as ClawdbotConfig;
} as MoltbotConfig;
}
const baseAccounts = (base?.accounts ?? {}) as Record<string, Record<string, unknown>>;
@@ -47,15 +47,15 @@ export function setAccountEnabledInConfigSection(params: {
},
},
},
} as ClawdbotConfig;
} as MoltbotConfig;
}
export function deleteAccountFromConfigSection(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
sectionKey: string;
accountId: string;
clearBaseFields?: string[];
}): ClawdbotConfig {
}): MoltbotConfig {
const accountKey = params.accountId || DEFAULT_ACCOUNT_ID;
const channels = params.cfg.channels as Record<string, unknown> | undefined;
const base = channels?.[params.sectionKey] as ChannelSection | undefined;
@@ -76,7 +76,7 @@ export function deleteAccountFromConfigSection(params: {
accounts: Object.keys(accounts).length ? accounts : undefined,
},
},
} as ClawdbotConfig;
} as MoltbotConfig;
}
if (baseAccounts && Object.keys(baseAccounts).length > 0) {
@@ -94,14 +94,14 @@ export function deleteAccountFromConfigSection(params: {
accounts: Object.keys(baseAccounts).length ? baseAccounts : undefined,
},
},
} as ClawdbotConfig;
} as MoltbotConfig;
}
const nextChannels = { ...params.cfg.channels } as Record<string, unknown>;
delete nextChannels[params.sectionKey];
const nextCfg = { ...params.cfg } as ClawdbotConfig;
const nextCfg = { ...params.cfg } as MoltbotConfig;
if (Object.keys(nextChannels).length > 0) {
nextCfg.channels = nextChannels as ClawdbotConfig["channels"];
nextCfg.channels = nextChannels as MoltbotConfig["channels"];
} else {
delete nextCfg.channels;
}

View File

@@ -1,4 +1,4 @@
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { ChannelId } from "./types.js";
import { normalizeAccountId } from "../../routing/session-key.js";
@@ -17,7 +17,7 @@ function resolveAccountConfig(accounts: ChannelConfigWithAccounts["accounts"], a
}
export function resolveChannelConfigWrites(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
channelId?: ChannelId | null;
accountId?: string | null;
}): boolean {

View File

@@ -1,4 +1,4 @@
import type { ClawdbotConfig } from "../../config/types.js";
import type { MoltbotConfig } from "../../config/types.js";
import type { ChannelDirectoryEntry } from "./types.js";
import { resolveSlackAccount } from "../../slack/accounts.js";
import { resolveDiscordAccount } from "../../discord/accounts.js";
@@ -8,7 +8,7 @@ import { normalizeSlackMessagingTarget } from "./normalize/slack.js";
import { isWhatsAppGroupJid, normalizeWhatsAppTarget } from "../../whatsapp/normalize.js";
export type DirectoryConfigParams = {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId?: string | null;
query?: string | null;
limit?: number | null;

View File

@@ -1,4 +1,4 @@
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import {
resolveChannelGroupRequireMention,
resolveChannelGroupToolsPolicy,
@@ -12,7 +12,7 @@ import type {
import { resolveSlackAccount } from "../../slack/accounts.js";
type GroupMentionParams = {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
groupId?: string | null;
groupChannel?: string | null;
groupSpace?: string | null;
@@ -61,7 +61,7 @@ function parseTelegramGroupId(value?: string | null) {
}
function resolveTelegramRequireMention(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
chatId?: string;
topicId?: string;
}): boolean | undefined {

View File

@@ -1,12 +1,12 @@
import { formatCliCommand } from "../../cli/command-format.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { DEFAULT_ACCOUNT_ID } from "../../routing/session-key.js";
import type { ChannelPlugin } from "./types.js";
// Channel docking helper: use this when selecting the default account for a plugin.
export function resolveChannelDefaultAccountId<ResolvedAccount>(params: {
plugin: ChannelPlugin<ResolvedAccount>;
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountIds?: string[];
}): string {
const accountIds = params.accountIds ?? params.plugin.config.listAccountIds(params.cfg);
@@ -14,7 +14,7 @@ export function resolveChannelDefaultAccountId<ResolvedAccount>(params: {
}
export function formatPairingApproveHint(channelId: string): string {
const listCmd = formatCliCommand(`clawdbot pairing list ${channelId}`);
const approveCmd = formatCliCommand(`clawdbot pairing approve ${channelId} <code>`);
const listCmd = formatCliCommand(`moltbot pairing list ${channelId}`);
const approveCmd = formatCliCommand(`moltbot pairing approve ${channelId} <code>`);
return `Approve via: ${listCmd} / ${approveCmd}`;
}

View File

@@ -1,13 +1,13 @@
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { normalizeAccountId } from "../../routing/session-key.js";
const MB = 1024 * 1024;
export function resolveChannelMediaMaxBytes(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
// Channel-specific config lives under different keys; keep this helper generic
// so shared plugin helpers don't need channel-id branching.
resolveChannelLimitMb: (params: { cfg: ClawdbotConfig; accountId: string }) => number | undefined;
resolveChannelLimitMb: (params: { cfg: MoltbotConfig; accountId: string }) => number | undefined;
accountId?: string | null;
}): number | undefined {
const accountId = normalizeAccountId(params.accountId);

View File

@@ -1,10 +1,10 @@
import type { AgentToolResult } from "@mariozechner/pi-agent-core";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { getChannelPlugin, listChannelPlugins } from "./index.js";
import type { ChannelMessageActionContext, ChannelMessageActionName } from "./types.js";
export function listChannelMessageActions(cfg: ClawdbotConfig): ChannelMessageActionName[] {
export function listChannelMessageActions(cfg: MoltbotConfig): ChannelMessageActionName[] {
const actions = new Set<ChannelMessageActionName>(["send", "broadcast"]);
for (const plugin of listChannelPlugins()) {
const list = plugin.actions?.listActions?.({ cfg });
@@ -14,14 +14,14 @@ export function listChannelMessageActions(cfg: ClawdbotConfig): ChannelMessageAc
return Array.from(actions);
}
export function supportsChannelMessageButtons(cfg: ClawdbotConfig): boolean {
export function supportsChannelMessageButtons(cfg: MoltbotConfig): boolean {
for (const plugin of listChannelPlugins()) {
if (plugin.actions?.supportsButtons?.({ cfg })) return true;
}
return false;
}
export function supportsChannelMessageCards(cfg: ClawdbotConfig): boolean {
export function supportsChannelMessageCards(cfg: MoltbotConfig): boolean {
for (const plugin of listChannelPlugins()) {
if (plugin.actions?.supportsCards?.({ cfg })) return true;
}

View File

@@ -1,4 +1,4 @@
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { DmPolicy } from "../../config/types.js";
import type { RuntimeEnv } from "../../runtime.js";
import type { WizardPrompter } from "../../wizard/prompts.js";
@@ -23,11 +23,11 @@ export type SetupChannelsOptions = {
};
export type PromptAccountIdParams = {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
prompter: WizardPrompter;
label: string;
currentId?: string;
listAccountIds: (cfg: ClawdbotConfig) => string[];
listAccountIds: (cfg: MoltbotConfig) => string[];
defaultAccountId: string;
};
@@ -42,13 +42,13 @@ export type ChannelOnboardingStatus = {
};
export type ChannelOnboardingStatusContext = {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
options?: SetupChannelsOptions;
accountOverrides: Partial<Record<ChannelId, string>>;
};
export type ChannelOnboardingConfigureContext = {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
runtime: RuntimeEnv;
prompter: WizardPrompter;
options?: SetupChannelsOptions;
@@ -58,7 +58,7 @@ export type ChannelOnboardingConfigureContext = {
};
export type ChannelOnboardingResult = {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId?: string;
};
@@ -67,13 +67,13 @@ export type ChannelOnboardingDmPolicy = {
channel: ChannelId;
policyKey: string;
allowFromKey: string;
getCurrent: (cfg: ClawdbotConfig) => DmPolicy;
setPolicy: (cfg: ClawdbotConfig, policy: DmPolicy) => ClawdbotConfig;
getCurrent: (cfg: MoltbotConfig) => DmPolicy;
setPolicy: (cfg: MoltbotConfig, policy: DmPolicy) => MoltbotConfig;
promptAllowFrom?: (params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
prompter: WizardPrompter;
accountId?: string;
}) => Promise<ClawdbotConfig>;
}) => Promise<MoltbotConfig>;
};
export type ChannelOnboardingAdapter = {
@@ -82,5 +82,5 @@ export type ChannelOnboardingAdapter = {
configure: (ctx: ChannelOnboardingConfigureContext) => Promise<ChannelOnboardingResult>;
dmPolicy?: ChannelOnboardingDmPolicy;
onAccountRecorded?: (accountId: string, options?: SetupChannelsOptions) => void;
disable?: (cfg: ClawdbotConfig) => ClawdbotConfig;
disable?: (cfg: MoltbotConfig) => MoltbotConfig;
};

View File

@@ -1,4 +1,4 @@
import type { ClawdbotConfig } from "../../../config/config.js";
import type { MoltbotConfig } from "../../../config/config.js";
import type { DmPolicy } from "../../../config/types.js";
import type { DiscordGuildEntry } from "../../../config/types.discord.js";
import {
@@ -21,7 +21,7 @@ import { addWildcardAllowFrom, promptAccountId } from "./helpers.js";
const channel = "discord" as const;
function setDiscordDmPolicy(cfg: ClawdbotConfig, dmPolicy: DmPolicy) {
function setDiscordDmPolicy(cfg: MoltbotConfig, dmPolicy: DmPolicy) {
const allowFrom =
dmPolicy === "open" ? addWildcardAllowFrom(cfg.channels?.discord?.dm?.allowFrom) : undefined;
return {
@@ -55,10 +55,10 @@ async function noteDiscordTokenHelp(prompter: WizardPrompter): Promise<void> {
}
function setDiscordGroupPolicy(
cfg: ClawdbotConfig,
cfg: MoltbotConfig,
accountId: string,
groupPolicy: "open" | "allowlist" | "disabled",
): ClawdbotConfig {
): MoltbotConfig {
if (accountId === DEFAULT_ACCOUNT_ID) {
return {
...cfg,
@@ -93,13 +93,13 @@ function setDiscordGroupPolicy(
}
function setDiscordGuildChannelAllowlist(
cfg: ClawdbotConfig,
cfg: MoltbotConfig,
accountId: string,
entries: Array<{
guildKey: string;
channelKey?: string;
}>,
): ClawdbotConfig {
): MoltbotConfig {
const baseGuilds =
accountId === DEFAULT_ACCOUNT_ID
? (cfg.channels?.discord?.guilds ?? {})
@@ -149,7 +149,7 @@ function setDiscordGuildChannelAllowlist(
};
}
function setDiscordAllowFrom(cfg: ClawdbotConfig, allowFrom: string[]): ClawdbotConfig {
function setDiscordAllowFrom(cfg: MoltbotConfig, allowFrom: string[]): MoltbotConfig {
return {
...cfg,
channels: {
@@ -174,10 +174,10 @@ function parseDiscordAllowFromInput(raw: string): string[] {
}
async function promptDiscordAllowFrom(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
prompter: WizardPrompter;
accountId?: string;
}): Promise<ClawdbotConfig> {
}): Promise<MoltbotConfig> {
const accountId =
params.accountId && normalizeAccountId(params.accountId)
? (normalizeAccountId(params.accountId) ?? DEFAULT_ACCOUNT_ID)

View File

@@ -1,5 +1,5 @@
import { detectBinary } from "../../../commands/onboard-helpers.js";
import type { ClawdbotConfig } from "../../../config/config.js";
import type { MoltbotConfig } from "../../../config/config.js";
import type { DmPolicy } from "../../../config/types.js";
import {
listIMessageAccountIds,
@@ -15,7 +15,7 @@ import { addWildcardAllowFrom, promptAccountId } from "./helpers.js";
const channel = "imessage" as const;
function setIMessageDmPolicy(cfg: ClawdbotConfig, dmPolicy: DmPolicy) {
function setIMessageDmPolicy(cfg: MoltbotConfig, dmPolicy: DmPolicy) {
const allowFrom =
dmPolicy === "open" ? addWildcardAllowFrom(cfg.channels?.imessage?.allowFrom) : undefined;
return {
@@ -32,10 +32,10 @@ function setIMessageDmPolicy(cfg: ClawdbotConfig, dmPolicy: DmPolicy) {
}
function setIMessageAllowFrom(
cfg: ClawdbotConfig,
cfg: MoltbotConfig,
accountId: string,
allowFrom: string[],
): ClawdbotConfig {
): MoltbotConfig {
if (accountId === DEFAULT_ACCOUNT_ID) {
return {
...cfg,
@@ -74,10 +74,10 @@ function parseIMessageAllowFromInput(raw: string): string[] {
}
async function promptIMessageAllowFrom(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
prompter: WizardPrompter;
accountId?: string;
}): Promise<ClawdbotConfig> {
}): Promise<MoltbotConfig> {
const accountId =
params.accountId && normalizeAccountId(params.accountId)
? (normalizeAccountId(params.accountId) ?? DEFAULT_ACCOUNT_ID)
@@ -240,7 +240,7 @@ export const imessageOnboardingAdapter: ChannelOnboardingAdapter = {
await prompter.note(
[
"This is still a work in progress.",
"Ensure Clawdbot has Full Disk Access to Messages DB.",
"Ensure Moltbot has Full Disk Access to Messages DB.",
"Grant Automation permission for Messages when prompted.",
"List chats with: imsg chats --limit 20",
`Docs: ${formatDocsLink("/imessage", "imessage")}`,

View File

@@ -1,6 +1,6 @@
import { detectBinary } from "../../../commands/onboard-helpers.js";
import { installSignalCli } from "../../../commands/signal-install.js";
import type { ClawdbotConfig } from "../../../config/config.js";
import type { MoltbotConfig } from "../../../config/config.js";
import type { DmPolicy } from "../../../config/types.js";
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../../../routing/session-key.js";
import {
@@ -17,7 +17,7 @@ import { addWildcardAllowFrom, promptAccountId } from "./helpers.js";
const channel = "signal" as const;
function setSignalDmPolicy(cfg: ClawdbotConfig, dmPolicy: DmPolicy) {
function setSignalDmPolicy(cfg: MoltbotConfig, dmPolicy: DmPolicy) {
const allowFrom =
dmPolicy === "open" ? addWildcardAllowFrom(cfg.channels?.signal?.allowFrom) : undefined;
return {
@@ -34,10 +34,10 @@ function setSignalDmPolicy(cfg: ClawdbotConfig, dmPolicy: DmPolicy) {
}
function setSignalAllowFrom(
cfg: ClawdbotConfig,
cfg: MoltbotConfig,
accountId: string,
allowFrom: string[],
): ClawdbotConfig {
): MoltbotConfig {
if (accountId === DEFAULT_ACCOUNT_ID) {
return {
...cfg,
@@ -80,10 +80,10 @@ function isUuidLike(value: string): boolean {
}
async function promptSignalAllowFrom(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
prompter: WizardPrompter;
accountId?: string;
}): Promise<ClawdbotConfig> {
}): Promise<MoltbotConfig> {
const accountId =
params.accountId && normalizeAccountId(params.accountId)
? (normalizeAccountId(params.accountId) ?? DEFAULT_ACCOUNT_ID)
@@ -282,9 +282,9 @@ export const signalOnboardingAdapter: ChannelOnboardingAdapter = {
await prompter.note(
[
'Link device with: signal-cli link -n "Clawdbot"',
'Link device with: signal-cli link -n "Moltbot"',
"Scan QR in Signal → Linked Devices",
`Then run: ${formatCliCommand("clawdbot gateway call channels.status --params '{\"probe\":true}'")}`,
`Then run: ${formatCliCommand("moltbot gateway call channels.status --params '{\"probe\":true}'")}`,
`Docs: ${formatDocsLink("/signal", "signal")}`,
].join("\n"),
"Signal next steps",

View File

@@ -1,4 +1,4 @@
import type { ClawdbotConfig } from "../../../config/config.js";
import type { MoltbotConfig } from "../../../config/config.js";
import type { DmPolicy } from "../../../config/types.js";
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../../../routing/session-key.js";
import {
@@ -16,7 +16,7 @@ import { addWildcardAllowFrom, promptAccountId } from "./helpers.js";
const channel = "slack" as const;
function setSlackDmPolicy(cfg: ClawdbotConfig, dmPolicy: DmPolicy) {
function setSlackDmPolicy(cfg: MoltbotConfig, dmPolicy: DmPolicy) {
const allowFrom =
dmPolicy === "open" ? addWildcardAllowFrom(cfg.channels?.slack?.dm?.allowFrom) : undefined;
return {
@@ -37,11 +37,11 @@ function setSlackDmPolicy(cfg: ClawdbotConfig, dmPolicy: DmPolicy) {
}
function buildSlackManifest(botName: string) {
const safeName = botName.trim() || "Clawdbot";
const safeName = botName.trim() || "Moltbot";
const manifest = {
display_information: {
name: safeName,
description: `${safeName} connector for Clawdbot`,
description: `${safeName} connector for Moltbot`,
},
features: {
bot_user: {
@@ -55,7 +55,7 @@ function buildSlackManifest(botName: string) {
slash_commands: [
{
command: "/clawd",
description: "Send a message to Clawdbot",
description: "Send a message to Moltbot",
should_escape: false,
},
],
@@ -125,10 +125,10 @@ async function noteSlackTokenHelp(prompter: WizardPrompter, botName: string): Pr
}
function setSlackGroupPolicy(
cfg: ClawdbotConfig,
cfg: MoltbotConfig,
accountId: string,
groupPolicy: "open" | "allowlist" | "disabled",
): ClawdbotConfig {
): MoltbotConfig {
if (accountId === DEFAULT_ACCOUNT_ID) {
return {
...cfg,
@@ -163,10 +163,10 @@ function setSlackGroupPolicy(
}
function setSlackChannelAllowlist(
cfg: ClawdbotConfig,
cfg: MoltbotConfig,
accountId: string,
channelKeys: string[],
): ClawdbotConfig {
): MoltbotConfig {
const channels = Object.fromEntries(channelKeys.map((key) => [key, { allow: true }]));
if (accountId === DEFAULT_ACCOUNT_ID) {
return {
@@ -201,7 +201,7 @@ function setSlackChannelAllowlist(
};
}
function setSlackAllowFrom(cfg: ClawdbotConfig, allowFrom: string[]): ClawdbotConfig {
function setSlackAllowFrom(cfg: MoltbotConfig, allowFrom: string[]): MoltbotConfig {
return {
...cfg,
channels: {
@@ -226,10 +226,10 @@ function parseSlackAllowFromInput(raw: string): string[] {
}
async function promptSlackAllowFrom(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
prompter: WizardPrompter;
accountId?: string;
}): Promise<ClawdbotConfig> {
}): Promise<MoltbotConfig> {
const accountId =
params.accountId && normalizeAccountId(params.accountId)
? (normalizeAccountId(params.accountId) ?? DEFAULT_ACCOUNT_ID)
@@ -364,7 +364,7 @@ export const slackOnboardingAdapter: ChannelOnboardingAdapter = {
const slackBotName = String(
await prompter.text({
message: "Slack bot display name (used for manifest)",
initialValue: "Clawdbot",
initialValue: "Moltbot",
}),
).trim();
if (!accountConfigured) {

View File

@@ -1,4 +1,4 @@
import type { ClawdbotConfig } from "../../../config/config.js";
import type { MoltbotConfig } from "../../../config/config.js";
import type { DmPolicy } from "../../../config/types.js";
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../../../routing/session-key.js";
import {
@@ -14,7 +14,7 @@ import { addWildcardAllowFrom, promptAccountId } from "./helpers.js";
const channel = "telegram" as const;
function setTelegramDmPolicy(cfg: ClawdbotConfig, dmPolicy: DmPolicy) {
function setTelegramDmPolicy(cfg: MoltbotConfig, dmPolicy: DmPolicy) {
const allowFrom =
dmPolicy === "open" ? addWildcardAllowFrom(cfg.channels?.telegram?.allowFrom) : undefined;
return {
@@ -47,7 +47,7 @@ async function noteTelegramTokenHelp(prompter: WizardPrompter): Promise<void> {
async function noteTelegramUserIdHelp(prompter: WizardPrompter): Promise<void> {
await prompter.note(
[
`1) DM your bot, then read from.id in \`${formatCliCommand("clawdbot logs --follow")}\` (safest)`,
`1) DM your bot, then read from.id in \`${formatCliCommand("moltbot logs --follow")}\` (safest)`,
"2) Or call https://api.telegram.org/bot<bot_token>/getUpdates and read message.from.id",
"3) Third-party: DM @userinfobot or @getidsbot",
`Docs: ${formatDocsLink("/telegram")}`,
@@ -58,10 +58,10 @@ async function noteTelegramUserIdHelp(prompter: WizardPrompter): Promise<void> {
}
async function promptTelegramAllowFrom(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
prompter: WizardPrompter;
accountId: string;
}): Promise<ClawdbotConfig> {
}): Promise<MoltbotConfig> {
const { cfg, prompter, accountId } = params;
const resolved = resolveTelegramAccount({ cfg, accountId });
const existingAllowFrom = resolved.config.allowFrom ?? [];
@@ -166,10 +166,10 @@ async function promptTelegramAllowFrom(params: {
}
async function promptTelegramAllowFromForAccount(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
prompter: WizardPrompter;
accountId?: string;
}): Promise<ClawdbotConfig> {
}): Promise<MoltbotConfig> {
const accountId =
params.accountId && normalizeAccountId(params.accountId)
? (normalizeAccountId(params.accountId) ?? DEFAULT_ACCOUNT_ID)

View File

@@ -1,7 +1,7 @@
import fs from "node:fs/promises";
import path from "node:path";
import { loginWeb } from "../../../channel-web.js";
import type { ClawdbotConfig } from "../../../config/config.js";
import type { MoltbotConfig } from "../../../config/config.js";
import { mergeWhatsAppConfig } from "../../../config/merge-config.js";
import type { DmPolicy } from "../../../config/types.js";
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../../../routing/session-key.js";
@@ -20,15 +20,15 @@ import { promptAccountId } from "./helpers.js";
const channel = "whatsapp" as const;
function setWhatsAppDmPolicy(cfg: ClawdbotConfig, dmPolicy: DmPolicy): ClawdbotConfig {
function setWhatsAppDmPolicy(cfg: MoltbotConfig, dmPolicy: DmPolicy): MoltbotConfig {
return mergeWhatsAppConfig(cfg, { dmPolicy });
}
function setWhatsAppAllowFrom(cfg: ClawdbotConfig, allowFrom?: string[]): ClawdbotConfig {
function setWhatsAppAllowFrom(cfg: MoltbotConfig, allowFrom?: string[]): MoltbotConfig {
return mergeWhatsAppConfig(cfg, { allowFrom }, { unsetOnUndefined: ["allowFrom"] });
}
function setWhatsAppSelfChatMode(cfg: ClawdbotConfig, selfChatMode: boolean): ClawdbotConfig {
function setWhatsAppSelfChatMode(cfg: MoltbotConfig, selfChatMode: boolean): MoltbotConfig {
return mergeWhatsAppConfig(cfg, { selfChatMode });
}
@@ -41,25 +41,25 @@ async function pathExists(filePath: string): Promise<boolean> {
}
}
async function detectWhatsAppLinked(cfg: ClawdbotConfig, accountId: string): Promise<boolean> {
async function detectWhatsAppLinked(cfg: MoltbotConfig, accountId: string): Promise<boolean> {
const { authDir } = resolveWhatsAppAuthDir({ cfg, accountId });
const credsPath = path.join(authDir, "creds.json");
return await pathExists(credsPath);
}
async function promptWhatsAppAllowFrom(
cfg: ClawdbotConfig,
cfg: MoltbotConfig,
_runtime: RuntimeEnv,
prompter: WizardPrompter,
options?: { forceAllowlist?: boolean },
): Promise<ClawdbotConfig> {
): Promise<MoltbotConfig> {
const existingPolicy = cfg.channels?.whatsapp?.dmPolicy ?? "pairing";
const existingAllowFrom = cfg.channels?.whatsapp?.allowFrom ?? [];
const existingLabel = existingAllowFrom.length > 0 ? existingAllowFrom.join(", ") : "unset";
if (options?.forceAllowlist) {
await prompter.note(
"We need the sender/owner number so Clawdbot can allowlist you.",
"We need the sender/owner number so Moltbot can allowlist you.",
"WhatsApp number",
);
const entry = await prompter.text({
@@ -111,13 +111,13 @@ async function promptWhatsAppAllowFrom(
message: "WhatsApp phone setup",
options: [
{ value: "personal", label: "This is my personal phone number" },
{ value: "separate", label: "Separate phone just for Clawdbot" },
{ value: "separate", label: "Separate phone just for Moltbot" },
],
})) as "personal" | "separate";
if (phoneMode === "personal") {
await prompter.note(
"We need the sender/owner number so Clawdbot can allowlist you.",
"We need the sender/owner number so Moltbot can allowlist you.",
"WhatsApp number",
);
const entry = await prompter.text({
@@ -323,7 +323,7 @@ export const whatsappOnboardingAdapter: ChannelOnboardingAdapter = {
}
} else if (!linked) {
await prompter.note(
`Run \`${formatCliCommand("clawdbot channels login")}\` later to link WhatsApp.`,
`Run \`${formatCliCommand("moltbot channels login")}\` later to link WhatsApp.`,
"WhatsApp",
);
}

View File

@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from "vitest";
import type { ClawdbotConfig } from "../../../config/config.js";
import type { MoltbotConfig } from "../../../config/config.js";
import { telegramOutbound } from "./telegram.js";
describe("telegramOutbound.sendPayload", () => {
@@ -8,7 +8,7 @@ describe("telegramOutbound.sendPayload", () => {
const sendTelegram = vi.fn(async () => ({ messageId: "m1", chatId: "c1" }));
const result = await telegramOutbound.sendPayload?.({
cfg: {} as ClawdbotConfig,
cfg: {} as MoltbotConfig,
to: "telegram:123",
text: "ignored",
payload: {
@@ -41,7 +41,7 @@ describe("telegramOutbound.sendPayload", () => {
.mockResolvedValueOnce({ messageId: "m2", chatId: "c1" });
const result = await telegramOutbound.sendPayload?.({
cfg: {} as ClawdbotConfig,
cfg: {} as MoltbotConfig,
to: "telegram:123",
text: "ignored",
payload: {

View File

@@ -1,2 +1,2 @@
export const PAIRING_APPROVED_MESSAGE =
"✅ Clawdbot access approved. Send a message to start chatting.";
"✅ Moltbot access approved. Send a message to start chatting.";

View File

@@ -1,4 +1,4 @@
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { RuntimeEnv } from "../../runtime.js";
import {
type ChannelId,
@@ -51,7 +51,7 @@ export function resolvePairingChannel(raw: unknown): ChannelId {
export async function notifyPairingApproved(params: {
channelId: ChannelId;
id: string;
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
runtime?: RuntimeEnv;
/** Extension channels can pass their adapter directly to bypass registry lookup. */
pairingAdapter?: ChannelPairingAdapter;

View File

@@ -1,4 +1,4 @@
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../../routing/session-key.js";
type ChannelSectionBase = {
@@ -6,14 +6,14 @@ type ChannelSectionBase = {
accounts?: Record<string, Record<string, unknown>>;
};
function channelHasAccounts(cfg: ClawdbotConfig, channelKey: string): boolean {
function channelHasAccounts(cfg: MoltbotConfig, channelKey: string): boolean {
const channels = cfg.channels as Record<string, unknown> | undefined;
const base = channels?.[channelKey] as ChannelSectionBase | undefined;
return Boolean(base?.accounts && Object.keys(base.accounts).length > 0);
}
function shouldStoreNameInAccounts(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
channelKey: string;
accountId: string;
alwaysUseAccounts?: boolean;
@@ -24,12 +24,12 @@ function shouldStoreNameInAccounts(params: {
}
export function applyAccountNameToChannelSection(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
channelKey: string;
accountId: string;
name?: string;
alwaysUseAccounts?: boolean;
}): ClawdbotConfig {
}): MoltbotConfig {
const trimmed = params.name?.trim();
if (!trimmed) return params.cfg;
const accountId = normalizeAccountId(params.accountId);
@@ -54,7 +54,7 @@ export function applyAccountNameToChannelSection(params: {
name: trimmed,
},
},
} as ClawdbotConfig;
} as MoltbotConfig;
}
const baseAccounts: Record<string, Record<string, unknown>> = base?.accounts ?? {};
const existingAccount = baseAccounts[accountId] ?? {};
@@ -77,14 +77,14 @@ export function applyAccountNameToChannelSection(params: {
},
},
},
} as ClawdbotConfig;
} as MoltbotConfig;
}
export function migrateBaseNameToDefaultAccount(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
channelKey: string;
alwaysUseAccounts?: boolean;
}): ClawdbotConfig {
}): MoltbotConfig {
if (params.alwaysUseAccounts) return params.cfg;
const channels = params.cfg.channels as Record<string, unknown> | undefined;
const base = channels?.[params.channelKey] as ChannelSectionBase | undefined;
@@ -107,5 +107,5 @@ export function migrateBaseNameToDefaultAccount(params: {
accounts,
},
},
} as ClawdbotConfig;
} as MoltbotConfig;
}

View File

@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from "vitest";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { createSlackActions } from "./slack.actions.js";
const handleSlackAction = vi.fn(async () => ({ details: { ok: true } }));
@@ -11,7 +11,7 @@ vi.mock("../../agents/tools/slack-actions.js", () => ({
describe("slack actions adapter", () => {
it("forwards threadId for read", async () => {
const cfg = { channels: { slack: { botToken: "tok" } } } as ClawdbotConfig;
const cfg = { channels: { slack: { botToken: "tok" } } } as MoltbotConfig;
const actions = createSlackActions("slack");
await actions.handleAction?.({

View File

@@ -64,7 +64,7 @@ export function collectBlueBubblesStatusIssues(
accountId,
kind: "config",
message: "Not configured (missing serverUrl or password).",
fix: "Run: clawdbot channels add bluebubbles --http-url <server-url> --password <password>",
fix: "Run: moltbot channels add bluebubbles --http-url <server-url> --password <password>",
});
continue;
}

View File

@@ -48,7 +48,7 @@ export function collectWhatsAppStatusIssues(
accountId,
kind: "auth",
message: "Not linked (no WhatsApp Web session).",
fix: `Run: ${formatCliCommand("clawdbot channels login")} (scan QR on the gateway host).`,
fix: `Run: ${formatCliCommand("moltbot channels login")} (scan QR on the gateway host).`,
});
continue;
}
@@ -59,7 +59,7 @@ export function collectWhatsAppStatusIssues(
accountId,
kind: "runtime",
message: `Linked but disconnected${reconnectAttempts != null ? ` (reconnectAttempts=${reconnectAttempts})` : ""}${lastError ? `: ${lastError}` : "."}`,
fix: `Run: ${formatCliCommand("clawdbot doctor")} (or restart the gateway). If it persists, relink via channels login and check logs.`,
fix: `Run: ${formatCliCommand("moltbot doctor")} (or restart the gateway). If it persists, relink via channels login and check logs.`,
});
}
}

View File

@@ -1,10 +1,10 @@
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { ChannelAccountSnapshot, ChannelPlugin } from "./types.js";
// Channel docking: status snapshots flow through plugin.status hooks here.
export async function buildChannelAccountSnapshot<ResolvedAccount>(params: {
plugin: ChannelPlugin<ResolvedAccount>;
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId: string;
runtime?: ChannelAccountSnapshot;
probe?: unknown;

View File

@@ -1,4 +1,4 @@
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { ReplyPayload } from "../../auto-reply/types.js";
import type { GroupToolPolicyConfig } from "../../config/types.tools.js";
import type { OutboundDeliveryResult, OutboundSendDeps } from "../../infra/outbound/deliver.js";
@@ -20,45 +20,45 @@ import type {
} from "./types.core.js";
export type ChannelSetupAdapter = {
resolveAccountId?: (params: { cfg: ClawdbotConfig; accountId?: string }) => string;
resolveAccountId?: (params: { cfg: MoltbotConfig; accountId?: string }) => string;
applyAccountName?: (params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId: string;
name?: string;
}) => ClawdbotConfig;
}) => MoltbotConfig;
applyAccountConfig: (params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId: string;
input: ChannelSetupInput;
}) => ClawdbotConfig;
}) => MoltbotConfig;
validateInput?: (params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId: string;
input: ChannelSetupInput;
}) => string | null;
};
export type ChannelConfigAdapter<ResolvedAccount> = {
listAccountIds: (cfg: ClawdbotConfig) => string[];
resolveAccount: (cfg: ClawdbotConfig, accountId?: string | null) => ResolvedAccount;
defaultAccountId?: (cfg: ClawdbotConfig) => string;
listAccountIds: (cfg: MoltbotConfig) => string[];
resolveAccount: (cfg: MoltbotConfig, accountId?: string | null) => ResolvedAccount;
defaultAccountId?: (cfg: MoltbotConfig) => string;
setAccountEnabled?: (params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId: string;
enabled: boolean;
}) => ClawdbotConfig;
deleteAccount?: (params: { cfg: ClawdbotConfig; accountId: string }) => ClawdbotConfig;
isEnabled?: (account: ResolvedAccount, cfg: ClawdbotConfig) => boolean;
disabledReason?: (account: ResolvedAccount, cfg: ClawdbotConfig) => string;
isConfigured?: (account: ResolvedAccount, cfg: ClawdbotConfig) => boolean | Promise<boolean>;
unconfiguredReason?: (account: ResolvedAccount, cfg: ClawdbotConfig) => string;
describeAccount?: (account: ResolvedAccount, cfg: ClawdbotConfig) => ChannelAccountSnapshot;
}) => MoltbotConfig;
deleteAccount?: (params: { cfg: MoltbotConfig; accountId: string }) => MoltbotConfig;
isEnabled?: (account: ResolvedAccount, cfg: MoltbotConfig) => boolean;
disabledReason?: (account: ResolvedAccount, cfg: MoltbotConfig) => string;
isConfigured?: (account: ResolvedAccount, cfg: MoltbotConfig) => boolean | Promise<boolean>;
unconfiguredReason?: (account: ResolvedAccount, cfg: MoltbotConfig) => string;
describeAccount?: (account: ResolvedAccount, cfg: MoltbotConfig) => ChannelAccountSnapshot;
resolveAllowFrom?: (params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId?: string | null;
}) => string[] | undefined;
formatAllowFrom?: (params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId?: string | null;
allowFrom: Array<string | number>;
}) => string[];
@@ -71,7 +71,7 @@ export type ChannelGroupAdapter = {
};
export type ChannelOutboundContext = {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
to: string;
text: string;
mediaUrl?: string;
@@ -93,7 +93,7 @@ export type ChannelOutboundAdapter = {
textChunkLimit?: number;
pollMaxOptions?: number;
resolveTarget?: (params: {
cfg?: ClawdbotConfig;
cfg?: MoltbotConfig;
to?: string;
allowFrom?: string[];
accountId?: string | null;
@@ -109,37 +109,37 @@ export type ChannelStatusAdapter<ResolvedAccount> = {
defaultRuntime?: ChannelAccountSnapshot;
buildChannelSummary?: (params: {
account: ResolvedAccount;
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
defaultAccountId: string;
snapshot: ChannelAccountSnapshot;
}) => Record<string, unknown> | Promise<Record<string, unknown>>;
probeAccount?: (params: {
account: ResolvedAccount;
timeoutMs: number;
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
}) => Promise<unknown>;
auditAccount?: (params: {
account: ResolvedAccount;
timeoutMs: number;
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
probe?: unknown;
}) => Promise<unknown>;
buildAccountSnapshot?: (params: {
account: ResolvedAccount;
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
runtime?: ChannelAccountSnapshot;
probe?: unknown;
audit?: unknown;
}) => ChannelAccountSnapshot | Promise<ChannelAccountSnapshot>;
logSelfId?: (params: {
account: ResolvedAccount;
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
runtime: RuntimeEnv;
includeChannelPrefix?: boolean;
}) => void;
resolveAccountState?: (params: {
account: ResolvedAccount;
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
configured: boolean;
enabled: boolean;
}) => ChannelAccountState;
@@ -147,7 +147,7 @@ export type ChannelStatusAdapter<ResolvedAccount> = {
};
export type ChannelGatewayContext<ResolvedAccount = unknown> = {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId: string;
account: ResolvedAccount;
runtime: RuntimeEnv;
@@ -174,7 +174,7 @@ export type ChannelLoginWithQrWaitResult = {
};
export type ChannelLogoutContext<ResolvedAccount = unknown> = {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId: string;
account: ResolvedAccount;
runtime: RuntimeEnv;
@@ -185,7 +185,7 @@ export type ChannelPairingAdapter = {
idLabel: string;
normalizeAllowEntry?: (entry: string) => string;
notifyApproval?: (params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
id: string;
runtime?: RuntimeEnv;
}) => Promise<void>;
@@ -209,7 +209,7 @@ export type ChannelGatewayAdapter<ResolvedAccount = unknown> = {
export type ChannelAuthAdapter = {
login?: (params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId?: string | null;
runtime: RuntimeEnv;
verbose?: boolean;
@@ -219,11 +219,11 @@ export type ChannelAuthAdapter = {
export type ChannelHeartbeatAdapter = {
checkReady?: (params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId?: string | null;
deps?: ChannelHeartbeatDeps;
}) => Promise<{ ok: boolean; reason: string }>;
resolveRecipients?: (params: { cfg: ClawdbotConfig; opts?: { to?: string; all?: boolean } }) => {
resolveRecipients?: (params: { cfg: MoltbotConfig; opts?: { to?: string; all?: boolean } }) => {
recipients: string[];
source: string;
};
@@ -231,40 +231,40 @@ export type ChannelHeartbeatAdapter = {
export type ChannelDirectoryAdapter = {
self?: (params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId?: string | null;
runtime: RuntimeEnv;
}) => Promise<ChannelDirectoryEntry | null>;
listPeers?: (params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId?: string | null;
query?: string | null;
limit?: number | null;
runtime: RuntimeEnv;
}) => Promise<ChannelDirectoryEntry[]>;
listPeersLive?: (params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId?: string | null;
query?: string | null;
limit?: number | null;
runtime: RuntimeEnv;
}) => Promise<ChannelDirectoryEntry[]>;
listGroups?: (params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId?: string | null;
query?: string | null;
limit?: number | null;
runtime: RuntimeEnv;
}) => Promise<ChannelDirectoryEntry[]>;
listGroupsLive?: (params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId?: string | null;
query?: string | null;
limit?: number | null;
runtime: RuntimeEnv;
}) => Promise<ChannelDirectoryEntry[]>;
listGroupMembers?: (params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId?: string | null;
groupId: string;
limit?: number | null;
@@ -284,7 +284,7 @@ export type ChannelResolveResult = {
export type ChannelResolverAdapter = {
resolveTargets: (params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId?: string | null;
inputs: string[];
kind: ChannelResolveKind;
@@ -294,7 +294,7 @@ export type ChannelResolverAdapter = {
export type ChannelElevatedAdapter = {
allowFromFallback?: (params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId?: string | null;
}) => Array<string | number> | undefined;
};

View File

@@ -1,7 +1,7 @@
import type { AgentTool, AgentToolResult } from "@mariozechner/pi-agent-core";
import type { TSchema } from "@sinclair/typebox";
import type { MsgContext } from "../../auto-reply/templating.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { PollInput } from "../../polls.js";
import type { GatewayClientMode, GatewayClientName } from "../../utils/message-channel.js";
import type { NormalizedChatType } from "../chat-type.js";
@@ -14,7 +14,7 @@ export type ChannelOutboundTargetMode = "explicit" | "implicit" | "heartbeat";
export type ChannelAgentTool = AgentTool<TSchema, unknown>;
export type ChannelAgentToolFactory = (params: { cfg?: ClawdbotConfig }) => ChannelAgentTool[];
export type ChannelAgentToolFactory = (params: { cfg?: MoltbotConfig }) => ChannelAgentTool[];
export type ChannelSetupInput = {
name?: string;
@@ -149,7 +149,7 @@ export type ChannelLogSink = {
};
export type ChannelGroupContext = {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
groupId?: string | null;
/** Human label for channel-like group conversations (e.g. #general). */
groupChannel?: string | null;
@@ -186,7 +186,7 @@ export type ChannelSecurityDmPolicy = {
};
export type ChannelSecurityContext<ResolvedAccount = unknown> = {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId?: string | null;
account: ResolvedAccount;
};
@@ -194,13 +194,13 @@ export type ChannelSecurityContext<ResolvedAccount = unknown> = {
export type ChannelMentionAdapter = {
stripPatterns?: (params: {
ctx: MsgContext;
cfg: ClawdbotConfig | undefined;
cfg: MoltbotConfig | undefined;
agentId?: string;
}) => string[];
stripMentions?: (params: {
text: string;
ctx: MsgContext;
cfg: ClawdbotConfig | undefined;
cfg: MoltbotConfig | undefined;
agentId?: string;
}) => string;
};
@@ -214,13 +214,13 @@ export type ChannelStreamingAdapter = {
export type ChannelThreadingAdapter = {
resolveReplyToMode?: (params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId?: string | null;
chatType?: string | null;
}) => "off" | "first" | "all";
allowTagsWhenOff?: boolean;
buildToolContext?: (params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId?: string | null;
context: ChannelThreadingContext;
hasRepliedRef?: { value: boolean };
@@ -266,7 +266,7 @@ export type ChannelMessagingAdapter = {
};
export type ChannelAgentPromptAdapter = {
messageToolHints?: (params: { cfg: ClawdbotConfig; accountId?: string | null }) => string[];
messageToolHints?: (params: { cfg: MoltbotConfig; accountId?: string | null }) => string[];
};
export type ChannelDirectoryEntryKind = "user" | "group" | "channel";
@@ -286,7 +286,7 @@ export type ChannelMessageActionName = ChannelMessageActionNameFromList;
export type ChannelMessageActionContext = {
channel: ChannelId;
action: ChannelMessageActionName;
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
params: Record<string, unknown>;
accountId?: string | null;
gateway?: {
@@ -307,10 +307,10 @@ export type ChannelToolSend = {
};
export type ChannelMessageActionAdapter = {
listActions?: (params: { cfg: ClawdbotConfig }) => ChannelMessageActionName[];
listActions?: (params: { cfg: MoltbotConfig }) => ChannelMessageActionName[];
supportsAction?: (params: { action: ChannelMessageActionName }) => boolean;
supportsButtons?: (params: { cfg: ClawdbotConfig }) => boolean;
supportsCards?: (params: { cfg: ClawdbotConfig }) => boolean;
supportsButtons?: (params: { cfg: MoltbotConfig }) => boolean;
supportsCards?: (params: { cfg: MoltbotConfig }) => boolean;
extractToolSend?: (params: { args: Record<string, unknown> }) => ChannelToolSend | null;
handleAction?: (ctx: ChannelMessageActionContext) => Promise<AgentToolResult<unknown>>;
};
@@ -324,7 +324,7 @@ export type ChannelPollResult = {
};
export type ChannelPollContext = {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
to: string;
poll: PollInput;
accountId?: string | null;

View File

@@ -1,12 +1,12 @@
import { normalizeChatChannelId } from "../../channels/registry.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { loadSessionStore, resolveStorePath } from "../../config/sessions.js";
import { normalizeE164 } from "../../utils.js";
type HeartbeatRecipientsResult = { recipients: string[]; source: string };
type HeartbeatRecipientsOpts = { to?: string; all?: boolean };
function getSessionRecipients(cfg: ClawdbotConfig) {
function getSessionRecipients(cfg: MoltbotConfig) {
const sessionCfg = cfg.session;
const scope = sessionCfg?.scope ?? "per-sender";
if (scope === "global") return [];
@@ -39,7 +39,7 @@ function getSessionRecipients(cfg: ClawdbotConfig) {
}
export function resolveWhatsAppHeartbeatRecipients(
cfg: ClawdbotConfig,
cfg: MoltbotConfig,
opts: HeartbeatRecipientsOpts = {},
): HeartbeatRecipientsResult {
if (opts.to) {

View File

@@ -1,5 +1,5 @@
import { resolveEffectiveMessagesConfig, resolveIdentityName } from "../agents/identity.js";
import type { ClawdbotConfig } from "../config/config.js";
import type { MoltbotConfig } from "../config/config.js";
import type { GetReplyOptions } from "../auto-reply/types.js";
import {
extractShortModelName,
@@ -16,7 +16,7 @@ export type ReplyPrefixContextBundle = {
};
export function createReplyPrefixContext(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
agentId: string;
}): ReplyPrefixContextBundle {
const { cfg, agentId } = params;