refactor: rename to openclaw

This commit is contained in:
Peter Steinberger
2026-01-30 03:15:10 +01:00
parent 4583f88626
commit 9a7160786a
2357 changed files with 16688 additions and 16788 deletions

View File

@@ -1,4 +1,4 @@
import type { MoltbotConfig } from "../config/config.js";
import type { OpenClawConfig } 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: MoltbotConfig;
cfg: OpenClawConfig;
accountId?: string | null;
}) => Array<string | number> | undefined;
formatAllowFrom?: (params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
accountId?: string | null;
allowFrom: Array<string | number>;
}) => string[];

View File

@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from "vitest";
import type { MoltbotConfig } from "../../../config/config.js";
import type { OpenClawConfig } 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 MoltbotConfig;
const cfg = { channels: { discord: { token: "d0" } } } as OpenClawConfig;
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 MoltbotConfig;
} as OpenClawConfig;
const discordMessageActions = await loadDiscordMessageActions();
const actions = discordMessageActions.listActions?.({ cfg }) ?? [];
@@ -65,7 +65,7 @@ describe("handleDiscordMessageAction", () => {
to: "channel:123",
message: "hi",
},
cfg: {} as MoltbotConfig,
cfg: {} as OpenClawConfig,
accountId: "ops",
});
@@ -90,7 +90,7 @@ describe("handleDiscordMessageAction", () => {
pollOption: ["Yes", "No"],
accountId: "marve",
},
cfg: {} as MoltbotConfig,
cfg: {} as OpenClawConfig,
});
expect(sendPollDiscord).toHaveBeenCalledWith(
@@ -115,7 +115,7 @@ describe("handleDiscordMessageAction", () => {
channelId: "123",
message: "hi",
},
cfg: {} as MoltbotConfig,
cfg: {} as OpenClawConfig,
accountId: "ops",
});
@@ -141,7 +141,7 @@ describe("handleDiscordMessageAction", () => {
channelId: "123",
message: "hi",
},
cfg: {} as MoltbotConfig,
cfg: {} as OpenClawConfig,
accountId: "ops",
});

View File

@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from "vitest";
import type { MoltbotConfig } from "../../../config/config.js";
import type { OpenClawConfig } 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 MoltbotConfig;
const cfg = {} as OpenClawConfig;
expect(signalMessageActions.listActions({ cfg })).toEqual([]);
});
it("hides react when reactions are disabled", () => {
const cfg = {
channels: { signal: { account: "+15550001111", actions: { reactions: false } } },
} as MoltbotConfig;
} as OpenClawConfig;
expect(signalMessageActions.listActions({ cfg })).toEqual(["send"]);
});
@@ -34,7 +34,7 @@ describe("signalMessageActions", () => {
},
},
},
} as MoltbotConfig;
} as OpenClawConfig;
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 MoltbotConfig;
} as OpenClawConfig;
await expect(
signalMessageActions.handleAction({
@@ -69,7 +69,7 @@ describe("signalMessageActions", () => {
},
},
},
} as MoltbotConfig;
} as OpenClawConfig;
await signalMessageActions.handleAction({
action: "react",
@@ -87,7 +87,7 @@ describe("signalMessageActions", () => {
sendReactionSignal.mockClear();
const cfg = {
channels: { signal: { account: "+15550001111" } },
} as MoltbotConfig;
} as OpenClawConfig;
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 MoltbotConfig;
} as OpenClawConfig;
await expect(
signalMessageActions.handleAction({
@@ -127,7 +127,7 @@ describe("signalMessageActions", () => {
sendReactionSignal.mockClear();
const cfg = {
channels: { signal: { account: "+15550001111" } },
} as MoltbotConfig;
} as OpenClawConfig;
await signalMessageActions.handleAction({
action: "react",

View File

@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from "vitest";
import type { MoltbotConfig } from "../../../config/config.js";
import type { OpenClawConfig } 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 MoltbotConfig;
const cfg = { channels: { telegram: { botToken: "tok" } } } as OpenClawConfig;
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 MoltbotConfig;
const cfg = { channels: { telegram: { botToken: "tok" } } } as OpenClawConfig;
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 MoltbotConfig;
const cfg = { channels: { telegram: { botToken: "tok" } } } as OpenClawConfig;
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 MoltbotConfig;
const cfg = { channels: { telegram: { botToken: "tok" } } } as OpenClawConfig;
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 MoltbotConfig;
const cfg = { channels: { telegram: { botToken: "tok" } } } as OpenClawConfig;
await expect(
telegramMessageActions.handleAction({

View File

@@ -8,7 +8,7 @@ import { getChannelPluginCatalogEntry, listChannelPluginCatalogEntries } from ".
describe("channel plugin catalog", () => {
it("includes Microsoft Teams", () => {
const entry = getChannelPluginCatalogEntry("msteams");
expect(entry?.install.npmSpec).toBe("@moltbot/msteams");
expect(entry?.install.npmSpec).toBe("@openclaw/msteams");
expect(entry?.meta.aliases).toContain("teams");
});
@@ -18,15 +18,15 @@ describe("channel plugin catalog", () => {
});
it("includes external catalog entries", () => {
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "moltbot-catalog-"));
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-catalog-"));
const catalogPath = path.join(dir, "catalog.json");
fs.writeFileSync(
catalogPath,
JSON.stringify({
entries: [
{
name: "@moltbot/demo-channel",
moltbot: {
name: "@openclaw/demo-channel",
openclaw: {
channel: {
id: "demo-channel",
label: "Demo Channel",
@@ -36,7 +36,7 @@ describe("channel plugin catalog", () => {
order: 999,
},
install: {
npmSpec: "@moltbot/demo-channel",
npmSpec: "@openclaw/demo-channel",
},
},
},

View File

@@ -1,10 +1,10 @@
import fs from "node:fs";
import path from "node:path";
import { LEGACY_MANIFEST_KEY } from "../../compat/legacy-names.js";
import { discoverMoltbotPlugins } from "../../plugins/discovery.js";
import { MANIFEST_KEY } from "../../compat/legacy-names.js";
import { discoverOpenClawPlugins } from "../../plugins/discovery.js";
import type { PluginOrigin } from "../../plugins/types.js";
import type { MoltbotPackageManifest } from "../../plugins/manifest.js";
import type { OpenClawPackageManifest } from "../../plugins/manifest.js";
import { CONFIG_DIR, resolveUserPath } from "../../utils.js";
import type { ChannelMeta } from "./types.js";
@@ -50,9 +50,7 @@ type ExternalCatalogEntry = {
name?: string;
version?: string;
description?: string;
moltbot?: MoltbotPackageManifest;
[LEGACY_MANIFEST_KEY]?: MoltbotPackageManifest;
};
} & Partial<Record<ManifestKey, OpenClawPackageManifest>>;
const DEFAULT_CATALOG_PATHS = [
path.join(CONFIG_DIR, "mpm", "plugins.json"),
@@ -60,7 +58,9 @@ const DEFAULT_CATALOG_PATHS = [
path.join(CONFIG_DIR, "plugins", "catalog.json"),
];
const ENV_CATALOG_PATHS = ["CLAWDBOT_PLUGIN_CATALOG_PATHS", "CLAWDBOT_MPM_CATALOG_PATHS"];
const ENV_CATALOG_PATHS = ["OPENCLAW_PLUGIN_CATALOG_PATHS", "OPENCLAW_MPM_CATALOG_PATHS"];
type ManifestKey = typeof MANIFEST_KEY;
function isRecord(value: unknown): value is Record<string, unknown> {
return Boolean(value && typeof value === "object" && !Array.isArray(value));
@@ -116,7 +116,7 @@ function loadExternalCatalogEntries(options: CatalogOptions): ExternalCatalogEnt
}
function toChannelMeta(params: {
channel: NonNullable<MoltbotPackageManifest["channel"]>;
channel: NonNullable<OpenClawPackageManifest["channel"]>;
id: string;
}): ChannelMeta | null {
const label = params.channel.label?.trim();
@@ -164,7 +164,7 @@ function toChannelMeta(params: {
}
function resolveInstallInfo(params: {
manifest: MoltbotPackageManifest;
manifest: OpenClawPackageManifest;
packageName?: string;
packageDir?: string;
workspaceDir?: string;
@@ -187,9 +187,9 @@ function buildCatalogEntry(candidate: {
packageName?: string;
packageDir?: string;
workspaceDir?: string;
packageMoltbot?: MoltbotPackageManifest;
packageManifest?: OpenClawPackageManifest;
}): ChannelPluginCatalogEntry | null {
const manifest = candidate.packageMoltbot;
const manifest = candidate.packageManifest;
if (!manifest?.channel) return null;
const id = manifest.channel.id?.trim();
if (!id) return null;
@@ -206,10 +206,10 @@ function buildCatalogEntry(candidate: {
}
function buildExternalCatalogEntry(entry: ExternalCatalogEntry): ChannelPluginCatalogEntry | null {
const manifest = entry.moltbot ?? entry[LEGACY_MANIFEST_KEY];
const manifest = entry[MANIFEST_KEY];
return buildCatalogEntry({
packageName: entry.name,
packageMoltbot: manifest,
packageManifest: manifest,
});
}
@@ -244,7 +244,7 @@ export function buildChannelUiCatalog(
export function listChannelPluginCatalogEntries(
options: CatalogOptions = {},
): ChannelPluginCatalogEntry[] {
const discovery = discoverMoltbotPlugins({ workspaceDir: options.workspaceDir });
const discovery = discoverOpenClawPlugins({ 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 { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } 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: MoltbotConfig;
cfg: OpenClawConfig;
sectionKey: string;
accountId: string;
enabled: boolean;
allowTopLevel?: boolean;
}): MoltbotConfig {
}): OpenClawConfig {
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 MoltbotConfig;
} as OpenClawConfig;
}
const baseAccounts = (base?.accounts ?? {}) as Record<string, Record<string, unknown>>;
@@ -47,15 +47,15 @@ export function setAccountEnabledInConfigSection(params: {
},
},
},
} as MoltbotConfig;
} as OpenClawConfig;
}
export function deleteAccountFromConfigSection(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
sectionKey: string;
accountId: string;
clearBaseFields?: string[];
}): MoltbotConfig {
}): OpenClawConfig {
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 MoltbotConfig;
} as OpenClawConfig;
}
if (baseAccounts && Object.keys(baseAccounts).length > 0) {
@@ -94,14 +94,14 @@ export function deleteAccountFromConfigSection(params: {
accounts: Object.keys(baseAccounts).length ? baseAccounts : undefined,
},
},
} as MoltbotConfig;
} as OpenClawConfig;
}
const nextChannels = { ...params.cfg.channels } as Record<string, unknown>;
delete nextChannels[params.sectionKey];
const nextCfg = { ...params.cfg } as MoltbotConfig;
const nextCfg = { ...params.cfg } as OpenClawConfig;
if (Object.keys(nextChannels).length > 0) {
nextCfg.channels = nextChannels as MoltbotConfig["channels"];
nextCfg.channels = nextChannels as OpenClawConfig["channels"];
} else {
delete nextCfg.channels;
}

View File

@@ -1,4 +1,4 @@
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } 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: MoltbotConfig;
cfg: OpenClawConfig;
channelId?: ChannelId | null;
accountId?: string | null;
}): boolean {

View File

@@ -1,4 +1,4 @@
import type { MoltbotConfig } from "../../config/types.js";
import type { OpenClawConfig } 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: MoltbotConfig;
cfg: OpenClawConfig;
accountId?: string | null;
query?: string | null;
limit?: number | null;

View File

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

View File

@@ -1,12 +1,12 @@
import { formatCliCommand } from "../../cli/command-format.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } 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: MoltbotConfig;
cfg: OpenClawConfig;
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(`moltbot pairing list ${channelId}`);
const approveCmd = formatCliCommand(`moltbot pairing approve ${channelId} <code>`);
const listCmd = formatCliCommand(`openclaw pairing list ${channelId}`);
const approveCmd = formatCliCommand(`openclaw pairing approve ${channelId} <code>`);
return `Approve via: ${listCmd} / ${approveCmd}`;
}

View File

@@ -1,13 +1,13 @@
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import { normalizeAccountId } from "../../routing/session-key.js";
const MB = 1024 * 1024;
export function resolveChannelMediaMaxBytes(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
// Channel-specific config lives under different keys; keep this helper generic
// so shared plugin helpers don't need channel-id branching.
resolveChannelLimitMb: (params: { cfg: MoltbotConfig; accountId: string }) => number | undefined;
resolveChannelLimitMb: (params: { cfg: OpenClawConfig; 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 { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import { getChannelPlugin, listChannelPlugins } from "./index.js";
import type { ChannelMessageActionContext, ChannelMessageActionName } from "./types.js";
export function listChannelMessageActions(cfg: MoltbotConfig): ChannelMessageActionName[] {
export function listChannelMessageActions(cfg: OpenClawConfig): 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: MoltbotConfig): ChannelMessageAct
return Array.from(actions);
}
export function supportsChannelMessageButtons(cfg: MoltbotConfig): boolean {
export function supportsChannelMessageButtons(cfg: OpenClawConfig): boolean {
for (const plugin of listChannelPlugins()) {
if (plugin.actions?.supportsButtons?.({ cfg })) return true;
}
return false;
}
export function supportsChannelMessageCards(cfg: MoltbotConfig): boolean {
export function supportsChannelMessageCards(cfg: OpenClawConfig): boolean {
for (const plugin of listChannelPlugins()) {
if (plugin.actions?.supportsCards?.({ cfg })) return true;
}

View File

@@ -1,4 +1,4 @@
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } 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: MoltbotConfig;
cfg: OpenClawConfig;
prompter: WizardPrompter;
label: string;
currentId?: string;
listAccountIds: (cfg: MoltbotConfig) => string[];
listAccountIds: (cfg: OpenClawConfig) => string[];
defaultAccountId: string;
};
@@ -42,13 +42,13 @@ export type ChannelOnboardingStatus = {
};
export type ChannelOnboardingStatusContext = {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
options?: SetupChannelsOptions;
accountOverrides: Partial<Record<ChannelId, string>>;
};
export type ChannelOnboardingConfigureContext = {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
runtime: RuntimeEnv;
prompter: WizardPrompter;
options?: SetupChannelsOptions;
@@ -58,7 +58,7 @@ export type ChannelOnboardingConfigureContext = {
};
export type ChannelOnboardingResult = {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
accountId?: string;
};
@@ -67,13 +67,13 @@ export type ChannelOnboardingDmPolicy = {
channel: ChannelId;
policyKey: string;
allowFromKey: string;
getCurrent: (cfg: MoltbotConfig) => DmPolicy;
setPolicy: (cfg: MoltbotConfig, policy: DmPolicy) => MoltbotConfig;
getCurrent: (cfg: OpenClawConfig) => DmPolicy;
setPolicy: (cfg: OpenClawConfig, policy: DmPolicy) => OpenClawConfig;
promptAllowFrom?: (params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
prompter: WizardPrompter;
accountId?: string;
}) => Promise<MoltbotConfig>;
}) => Promise<OpenClawConfig>;
};
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: MoltbotConfig) => MoltbotConfig;
disable?: (cfg: OpenClawConfig) => OpenClawConfig;
};

View File

@@ -1,4 +1,4 @@
import type { MoltbotConfig } from "../../../config/config.js";
import type { OpenClawConfig } 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: MoltbotConfig, dmPolicy: DmPolicy) {
function setDiscordDmPolicy(cfg: OpenClawConfig, 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: MoltbotConfig,
cfg: OpenClawConfig,
accountId: string,
groupPolicy: "open" | "allowlist" | "disabled",
): MoltbotConfig {
): OpenClawConfig {
if (accountId === DEFAULT_ACCOUNT_ID) {
return {
...cfg,
@@ -93,13 +93,13 @@ function setDiscordGroupPolicy(
}
function setDiscordGuildChannelAllowlist(
cfg: MoltbotConfig,
cfg: OpenClawConfig,
accountId: string,
entries: Array<{
guildKey: string;
channelKey?: string;
}>,
): MoltbotConfig {
): OpenClawConfig {
const baseGuilds =
accountId === DEFAULT_ACCOUNT_ID
? (cfg.channels?.discord?.guilds ?? {})
@@ -149,7 +149,7 @@ function setDiscordGuildChannelAllowlist(
};
}
function setDiscordAllowFrom(cfg: MoltbotConfig, allowFrom: string[]): MoltbotConfig {
function setDiscordAllowFrom(cfg: OpenClawConfig, allowFrom: string[]): OpenClawConfig {
return {
...cfg,
channels: {
@@ -174,10 +174,10 @@ function parseDiscordAllowFromInput(raw: string): string[] {
}
async function promptDiscordAllowFrom(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
prompter: WizardPrompter;
accountId?: string;
}): Promise<MoltbotConfig> {
}): Promise<OpenClawConfig> {
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 { MoltbotConfig } from "../../../config/config.js";
import type { OpenClawConfig } 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: MoltbotConfig, dmPolicy: DmPolicy) {
function setIMessageDmPolicy(cfg: OpenClawConfig, dmPolicy: DmPolicy) {
const allowFrom =
dmPolicy === "open" ? addWildcardAllowFrom(cfg.channels?.imessage?.allowFrom) : undefined;
return {
@@ -32,10 +32,10 @@ function setIMessageDmPolicy(cfg: MoltbotConfig, dmPolicy: DmPolicy) {
}
function setIMessageAllowFrom(
cfg: MoltbotConfig,
cfg: OpenClawConfig,
accountId: string,
allowFrom: string[],
): MoltbotConfig {
): OpenClawConfig {
if (accountId === DEFAULT_ACCOUNT_ID) {
return {
...cfg,
@@ -74,10 +74,10 @@ function parseIMessageAllowFromInput(raw: string): string[] {
}
async function promptIMessageAllowFrom(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
prompter: WizardPrompter;
accountId?: string;
}): Promise<MoltbotConfig> {
}): Promise<OpenClawConfig> {
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 Moltbot has Full Disk Access to Messages DB.",
"Ensure OpenClaw 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 { MoltbotConfig } from "../../../config/config.js";
import type { OpenClawConfig } 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: MoltbotConfig, dmPolicy: DmPolicy) {
function setSignalDmPolicy(cfg: OpenClawConfig, dmPolicy: DmPolicy) {
const allowFrom =
dmPolicy === "open" ? addWildcardAllowFrom(cfg.channels?.signal?.allowFrom) : undefined;
return {
@@ -34,10 +34,10 @@ function setSignalDmPolicy(cfg: MoltbotConfig, dmPolicy: DmPolicy) {
}
function setSignalAllowFrom(
cfg: MoltbotConfig,
cfg: OpenClawConfig,
accountId: string,
allowFrom: string[],
): MoltbotConfig {
): OpenClawConfig {
if (accountId === DEFAULT_ACCOUNT_ID) {
return {
...cfg,
@@ -80,10 +80,10 @@ function isUuidLike(value: string): boolean {
}
async function promptSignalAllowFrom(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
prompter: WizardPrompter;
accountId?: string;
}): Promise<MoltbotConfig> {
}): Promise<OpenClawConfig> {
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 "Moltbot"',
'Link device with: signal-cli link -n "OpenClaw"',
"Scan QR in Signal → Linked Devices",
`Then run: ${formatCliCommand("moltbot gateway call channels.status --params '{\"probe\":true}'")}`,
`Then run: ${formatCliCommand("openclaw gateway call channels.status --params '{\"probe\":true}'")}`,
`Docs: ${formatDocsLink("/signal", "signal")}`,
].join("\n"),
"Signal next steps",

View File

@@ -1,4 +1,4 @@
import type { MoltbotConfig } from "../../../config/config.js";
import type { OpenClawConfig } 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: MoltbotConfig, dmPolicy: DmPolicy) {
function setSlackDmPolicy(cfg: OpenClawConfig, dmPolicy: DmPolicy) {
const allowFrom =
dmPolicy === "open" ? addWildcardAllowFrom(cfg.channels?.slack?.dm?.allowFrom) : undefined;
return {
@@ -37,11 +37,11 @@ function setSlackDmPolicy(cfg: MoltbotConfig, dmPolicy: DmPolicy) {
}
function buildSlackManifest(botName: string) {
const safeName = botName.trim() || "Moltbot";
const safeName = botName.trim() || "OpenClaw";
const manifest = {
display_information: {
name: safeName,
description: `${safeName} connector for Moltbot`,
description: `${safeName} connector for OpenClaw`,
},
features: {
bot_user: {
@@ -54,8 +54,8 @@ function buildSlackManifest(botName: string) {
},
slash_commands: [
{
command: "/clawd",
description: "Send a message to Moltbot",
command: "/openclaw",
description: "Send a message to OpenClaw",
should_escape: false,
},
],
@@ -125,10 +125,10 @@ async function noteSlackTokenHelp(prompter: WizardPrompter, botName: string): Pr
}
function setSlackGroupPolicy(
cfg: MoltbotConfig,
cfg: OpenClawConfig,
accountId: string,
groupPolicy: "open" | "allowlist" | "disabled",
): MoltbotConfig {
): OpenClawConfig {
if (accountId === DEFAULT_ACCOUNT_ID) {
return {
...cfg,
@@ -163,10 +163,10 @@ function setSlackGroupPolicy(
}
function setSlackChannelAllowlist(
cfg: MoltbotConfig,
cfg: OpenClawConfig,
accountId: string,
channelKeys: string[],
): MoltbotConfig {
): OpenClawConfig {
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: MoltbotConfig, allowFrom: string[]): MoltbotConfig {
function setSlackAllowFrom(cfg: OpenClawConfig, allowFrom: string[]): OpenClawConfig {
return {
...cfg,
channels: {
@@ -226,10 +226,10 @@ function parseSlackAllowFromInput(raw: string): string[] {
}
async function promptSlackAllowFrom(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
prompter: WizardPrompter;
accountId?: string;
}): Promise<MoltbotConfig> {
}): Promise<OpenClawConfig> {
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: "Moltbot",
initialValue: "OpenClaw",
}),
).trim();
if (!accountConfigured) {

View File

@@ -1,4 +1,4 @@
import type { MoltbotConfig } from "../../../config/config.js";
import type { OpenClawConfig } 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: MoltbotConfig, dmPolicy: DmPolicy) {
function setTelegramDmPolicy(cfg: OpenClawConfig, dmPolicy: DmPolicy) {
const allowFrom =
dmPolicy === "open" ? addWildcardAllowFrom(cfg.channels?.telegram?.allowFrom) : undefined;
return {
@@ -38,7 +38,7 @@ async function noteTelegramTokenHelp(prompter: WizardPrompter): Promise<void> {
"3) Copy the token (looks like 123456:ABC...)",
"Tip: you can also set TELEGRAM_BOT_TOKEN in your env.",
`Docs: ${formatDocsLink("/telegram")}`,
"Website: https://molt.bot",
"Website: https://openclaw.ai",
].join("\n"),
"Telegram bot token",
);
@@ -47,21 +47,21 @@ 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("moltbot logs --follow")}\` (safest)`,
`1) DM your bot, then read from.id in \`${formatCliCommand("openclaw 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")}`,
"Website: https://molt.bot",
"Website: https://openclaw.ai",
].join("\n"),
"Telegram user id",
);
}
async function promptTelegramAllowFrom(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
prompter: WizardPrompter;
accountId: string;
}): Promise<MoltbotConfig> {
}): Promise<OpenClawConfig> {
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: MoltbotConfig;
cfg: OpenClawConfig;
prompter: WizardPrompter;
accountId?: string;
}): Promise<MoltbotConfig> {
}): Promise<OpenClawConfig> {
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 { MoltbotConfig } from "../../../config/config.js";
import type { OpenClawConfig } 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: MoltbotConfig, dmPolicy: DmPolicy): MoltbotConfig {
function setWhatsAppDmPolicy(cfg: OpenClawConfig, dmPolicy: DmPolicy): OpenClawConfig {
return mergeWhatsAppConfig(cfg, { dmPolicy });
}
function setWhatsAppAllowFrom(cfg: MoltbotConfig, allowFrom?: string[]): MoltbotConfig {
function setWhatsAppAllowFrom(cfg: OpenClawConfig, allowFrom?: string[]): OpenClawConfig {
return mergeWhatsAppConfig(cfg, { allowFrom }, { unsetOnUndefined: ["allowFrom"] });
}
function setWhatsAppSelfChatMode(cfg: MoltbotConfig, selfChatMode: boolean): MoltbotConfig {
function setWhatsAppSelfChatMode(cfg: OpenClawConfig, selfChatMode: boolean): OpenClawConfig {
return mergeWhatsAppConfig(cfg, { selfChatMode });
}
@@ -41,25 +41,25 @@ async function pathExists(filePath: string): Promise<boolean> {
}
}
async function detectWhatsAppLinked(cfg: MoltbotConfig, accountId: string): Promise<boolean> {
async function detectWhatsAppLinked(cfg: OpenClawConfig, accountId: string): Promise<boolean> {
const { authDir } = resolveWhatsAppAuthDir({ cfg, accountId });
const credsPath = path.join(authDir, "creds.json");
return await pathExists(credsPath);
}
async function promptWhatsAppAllowFrom(
cfg: MoltbotConfig,
cfg: OpenClawConfig,
_runtime: RuntimeEnv,
prompter: WizardPrompter,
options?: { forceAllowlist?: boolean },
): Promise<MoltbotConfig> {
): Promise<OpenClawConfig> {
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 Moltbot can allowlist you.",
"We need the sender/owner number so OpenClaw 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 Moltbot" },
{ value: "separate", label: "Separate phone just for OpenClaw" },
],
})) as "personal" | "separate";
if (phoneMode === "personal") {
await prompter.note(
"We need the sender/owner number so Moltbot can allowlist you.",
"We need the sender/owner number so OpenClaw 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("moltbot channels login")}\` later to link WhatsApp.`,
`Run \`${formatCliCommand("openclaw channels login")}\` later to link WhatsApp.`,
"WhatsApp",
);
}

View File

@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from "vitest";
import type { MoltbotConfig } from "../../../config/config.js";
import type { OpenClawConfig } 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 MoltbotConfig,
cfg: {} as OpenClawConfig,
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 MoltbotConfig,
cfg: {} as OpenClawConfig,
to: "telegram:123",
text: "ignored",
payload: {

View File

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

View File

@@ -1,4 +1,4 @@
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } 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: MoltbotConfig;
cfg: OpenClawConfig;
runtime?: RuntimeEnv;
/** Extension channels can pass their adapter directly to bypass registry lookup. */
pairingAdapter?: ChannelPairingAdapter;

View File

@@ -1,4 +1,4 @@
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } 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: MoltbotConfig, channelKey: string): boolean {
function channelHasAccounts(cfg: OpenClawConfig, 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: MoltbotConfig;
cfg: OpenClawConfig;
channelKey: string;
accountId: string;
alwaysUseAccounts?: boolean;
@@ -24,12 +24,12 @@ function shouldStoreNameInAccounts(params: {
}
export function applyAccountNameToChannelSection(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
channelKey: string;
accountId: string;
name?: string;
alwaysUseAccounts?: boolean;
}): MoltbotConfig {
}): OpenClawConfig {
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 MoltbotConfig;
} as OpenClawConfig;
}
const baseAccounts: Record<string, Record<string, unknown>> = base?.accounts ?? {};
const existingAccount = baseAccounts[accountId] ?? {};
@@ -77,14 +77,14 @@ export function applyAccountNameToChannelSection(params: {
},
},
},
} as MoltbotConfig;
} as OpenClawConfig;
}
export function migrateBaseNameToDefaultAccount(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
channelKey: string;
alwaysUseAccounts?: boolean;
}): MoltbotConfig {
}): OpenClawConfig {
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 MoltbotConfig;
} as OpenClawConfig;
}

View File

@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from "vitest";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } 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 MoltbotConfig;
const cfg = { channels: { slack: { botToken: "tok" } } } as OpenClawConfig;
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: moltbot channels add bluebubbles --http-url <server-url> --password <password>",
fix: "Run: openclaw 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("moltbot channels login")} (scan QR on the gateway host).`,
fix: `Run: ${formatCliCommand("openclaw 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("moltbot doctor")} (or restart the gateway). If it persists, relink via channels login and check logs.`,
fix: `Run: ${formatCliCommand("openclaw doctor")} (or restart the gateway). If it persists, relink via channels login and check logs.`,
});
}
}

View File

@@ -1,10 +1,10 @@
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } 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: MoltbotConfig;
cfg: OpenClawConfig;
accountId: string;
runtime?: ChannelAccountSnapshot;
probe?: unknown;

View File

@@ -1,4 +1,4 @@
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } 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: MoltbotConfig; accountId?: string }) => string;
resolveAccountId?: (params: { cfg: OpenClawConfig; accountId?: string }) => string;
applyAccountName?: (params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
accountId: string;
name?: string;
}) => MoltbotConfig;
}) => OpenClawConfig;
applyAccountConfig: (params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
accountId: string;
input: ChannelSetupInput;
}) => MoltbotConfig;
}) => OpenClawConfig;
validateInput?: (params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
accountId: string;
input: ChannelSetupInput;
}) => string | null;
};
export type ChannelConfigAdapter<ResolvedAccount> = {
listAccountIds: (cfg: MoltbotConfig) => string[];
resolveAccount: (cfg: MoltbotConfig, accountId?: string | null) => ResolvedAccount;
defaultAccountId?: (cfg: MoltbotConfig) => string;
listAccountIds: (cfg: OpenClawConfig) => string[];
resolveAccount: (cfg: OpenClawConfig, accountId?: string | null) => ResolvedAccount;
defaultAccountId?: (cfg: OpenClawConfig) => string;
setAccountEnabled?: (params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
accountId: string;
enabled: boolean;
}) => 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;
}) => OpenClawConfig;
deleteAccount?: (params: { cfg: OpenClawConfig; accountId: string }) => OpenClawConfig;
isEnabled?: (account: ResolvedAccount, cfg: OpenClawConfig) => boolean;
disabledReason?: (account: ResolvedAccount, cfg: OpenClawConfig) => string;
isConfigured?: (account: ResolvedAccount, cfg: OpenClawConfig) => boolean | Promise<boolean>;
unconfiguredReason?: (account: ResolvedAccount, cfg: OpenClawConfig) => string;
describeAccount?: (account: ResolvedAccount, cfg: OpenClawConfig) => ChannelAccountSnapshot;
resolveAllowFrom?: (params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
accountId?: string | null;
}) => string[] | undefined;
formatAllowFrom?: (params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
accountId?: string | null;
allowFrom: Array<string | number>;
}) => string[];
@@ -71,7 +71,7 @@ export type ChannelGroupAdapter = {
};
export type ChannelOutboundContext = {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
to: string;
text: string;
mediaUrl?: string;
@@ -93,7 +93,7 @@ export type ChannelOutboundAdapter = {
textChunkLimit?: number;
pollMaxOptions?: number;
resolveTarget?: (params: {
cfg?: MoltbotConfig;
cfg?: OpenClawConfig;
to?: string;
allowFrom?: string[];
accountId?: string | null;
@@ -109,37 +109,37 @@ export type ChannelStatusAdapter<ResolvedAccount> = {
defaultRuntime?: ChannelAccountSnapshot;
buildChannelSummary?: (params: {
account: ResolvedAccount;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
defaultAccountId: string;
snapshot: ChannelAccountSnapshot;
}) => Record<string, unknown> | Promise<Record<string, unknown>>;
probeAccount?: (params: {
account: ResolvedAccount;
timeoutMs: number;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
}) => Promise<unknown>;
auditAccount?: (params: {
account: ResolvedAccount;
timeoutMs: number;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
probe?: unknown;
}) => Promise<unknown>;
buildAccountSnapshot?: (params: {
account: ResolvedAccount;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
runtime?: ChannelAccountSnapshot;
probe?: unknown;
audit?: unknown;
}) => ChannelAccountSnapshot | Promise<ChannelAccountSnapshot>;
logSelfId?: (params: {
account: ResolvedAccount;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
runtime: RuntimeEnv;
includeChannelPrefix?: boolean;
}) => void;
resolveAccountState?: (params: {
account: ResolvedAccount;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
configured: boolean;
enabled: boolean;
}) => ChannelAccountState;
@@ -147,7 +147,7 @@ export type ChannelStatusAdapter<ResolvedAccount> = {
};
export type ChannelGatewayContext<ResolvedAccount = unknown> = {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
accountId: string;
account: ResolvedAccount;
runtime: RuntimeEnv;
@@ -174,7 +174,7 @@ export type ChannelLoginWithQrWaitResult = {
};
export type ChannelLogoutContext<ResolvedAccount = unknown> = {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
accountId: string;
account: ResolvedAccount;
runtime: RuntimeEnv;
@@ -185,7 +185,7 @@ export type ChannelPairingAdapter = {
idLabel: string;
normalizeAllowEntry?: (entry: string) => string;
notifyApproval?: (params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
id: string;
runtime?: RuntimeEnv;
}) => Promise<void>;
@@ -209,7 +209,7 @@ export type ChannelGatewayAdapter<ResolvedAccount = unknown> = {
export type ChannelAuthAdapter = {
login?: (params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
accountId?: string | null;
runtime: RuntimeEnv;
verbose?: boolean;
@@ -219,11 +219,11 @@ export type ChannelAuthAdapter = {
export type ChannelHeartbeatAdapter = {
checkReady?: (params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
accountId?: string | null;
deps?: ChannelHeartbeatDeps;
}) => Promise<{ ok: boolean; reason: string }>;
resolveRecipients?: (params: { cfg: MoltbotConfig; opts?: { to?: string; all?: boolean } }) => {
resolveRecipients?: (params: { cfg: OpenClawConfig; opts?: { to?: string; all?: boolean } }) => {
recipients: string[];
source: string;
};
@@ -231,40 +231,40 @@ export type ChannelHeartbeatAdapter = {
export type ChannelDirectoryAdapter = {
self?: (params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
accountId?: string | null;
runtime: RuntimeEnv;
}) => Promise<ChannelDirectoryEntry | null>;
listPeers?: (params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
accountId?: string | null;
query?: string | null;
limit?: number | null;
runtime: RuntimeEnv;
}) => Promise<ChannelDirectoryEntry[]>;
listPeersLive?: (params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
accountId?: string | null;
query?: string | null;
limit?: number | null;
runtime: RuntimeEnv;
}) => Promise<ChannelDirectoryEntry[]>;
listGroups?: (params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
accountId?: string | null;
query?: string | null;
limit?: number | null;
runtime: RuntimeEnv;
}) => Promise<ChannelDirectoryEntry[]>;
listGroupsLive?: (params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
accountId?: string | null;
query?: string | null;
limit?: number | null;
runtime: RuntimeEnv;
}) => Promise<ChannelDirectoryEntry[]>;
listGroupMembers?: (params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
accountId?: string | null;
groupId: string;
limit?: number | null;
@@ -284,7 +284,7 @@ export type ChannelResolveResult = {
export type ChannelResolverAdapter = {
resolveTargets: (params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
accountId?: string | null;
inputs: string[];
kind: ChannelResolveKind;
@@ -294,7 +294,7 @@ export type ChannelResolverAdapter = {
export type ChannelElevatedAdapter = {
allowFromFallback?: (params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
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 { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } 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?: MoltbotConfig }) => ChannelAgentTool[];
export type ChannelAgentToolFactory = (params: { cfg?: OpenClawConfig }) => ChannelAgentTool[];
export type ChannelSetupInput = {
name?: string;
@@ -149,7 +149,7 @@ export type ChannelLogSink = {
};
export type ChannelGroupContext = {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
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: MoltbotConfig;
cfg: OpenClawConfig;
accountId?: string | null;
account: ResolvedAccount;
};
@@ -194,13 +194,13 @@ export type ChannelSecurityContext<ResolvedAccount = unknown> = {
export type ChannelMentionAdapter = {
stripPatterns?: (params: {
ctx: MsgContext;
cfg: MoltbotConfig | undefined;
cfg: OpenClawConfig | undefined;
agentId?: string;
}) => string[];
stripMentions?: (params: {
text: string;
ctx: MsgContext;
cfg: MoltbotConfig | undefined;
cfg: OpenClawConfig | undefined;
agentId?: string;
}) => string;
};
@@ -214,13 +214,13 @@ export type ChannelStreamingAdapter = {
export type ChannelThreadingAdapter = {
resolveReplyToMode?: (params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
accountId?: string | null;
chatType?: string | null;
}) => "off" | "first" | "all";
allowTagsWhenOff?: boolean;
buildToolContext?: (params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
accountId?: string | null;
context: ChannelThreadingContext;
hasRepliedRef?: { value: boolean };
@@ -266,7 +266,7 @@ export type ChannelMessagingAdapter = {
};
export type ChannelAgentPromptAdapter = {
messageToolHints?: (params: { cfg: MoltbotConfig; accountId?: string | null }) => string[];
messageToolHints?: (params: { cfg: OpenClawConfig; 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: MoltbotConfig;
cfg: OpenClawConfig;
params: Record<string, unknown>;
accountId?: string | null;
gateway?: {
@@ -307,10 +307,10 @@ export type ChannelToolSend = {
};
export type ChannelMessageActionAdapter = {
listActions?: (params: { cfg: MoltbotConfig }) => ChannelMessageActionName[];
listActions?: (params: { cfg: OpenClawConfig }) => ChannelMessageActionName[];
supportsAction?: (params: { action: ChannelMessageActionName }) => boolean;
supportsButtons?: (params: { cfg: MoltbotConfig }) => boolean;
supportsCards?: (params: { cfg: MoltbotConfig }) => boolean;
supportsButtons?: (params: { cfg: OpenClawConfig }) => boolean;
supportsCards?: (params: { cfg: OpenClawConfig }) => 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: MoltbotConfig;
cfg: OpenClawConfig;
to: string;
poll: PollInput;
accountId?: string | null;

View File

@@ -1,12 +1,12 @@
import { normalizeChatChannelId } from "../../channels/registry.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } 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: MoltbotConfig) {
function getSessionRecipients(cfg: OpenClawConfig) {
const sessionCfg = cfg.session;
const scope = sessionCfg?.scope ?? "per-sender";
if (scope === "global") return [];
@@ -39,7 +39,7 @@ function getSessionRecipients(cfg: MoltbotConfig) {
}
export function resolveWhatsAppHeartbeatRecipients(
cfg: MoltbotConfig,
cfg: OpenClawConfig,
opts: HeartbeatRecipientsOpts = {},
): HeartbeatRecipientsResult {
if (opts.to) {

View File

@@ -33,6 +33,6 @@ describe("channel registry", () => {
);
expect(line).not.toContain("Docs:");
expect(line).toContain("/channels/telegram");
expect(line).toContain("https://molt.bot");
expect(line).toContain("https://openclaw.ai");
});
});

View File

@@ -22,7 +22,7 @@ export const DEFAULT_CHAT_CHANNEL: ChatChannelId = "whatsapp";
export type ChatChannelMeta = ChannelMeta;
const WEBSITE_URL = "https://molt.bot";
const WEBSITE_URL = "https://openclaw.ai";
const CHAT_CHANNEL_META: Record<ChatChannelId, ChannelMeta> = {
telegram: {

View File

@@ -1,5 +1,5 @@
import { resolveEffectiveMessagesConfig, resolveIdentityName } from "../agents/identity.js";
import type { MoltbotConfig } from "../config/config.js";
import type { OpenClawConfig } 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: MoltbotConfig;
cfg: OpenClawConfig;
agentId: string;
}): ReplyPrefixContextBundle {
const { cfg, agentId } = params;