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

@@ -22,7 +22,7 @@ import type { ReplyPayload } from "../auto-reply/types.js";
import { getChannelPlugin } from "../channels/plugins/index.js";
import type { ChannelHeartbeatDeps } from "../channels/plugins/types.js";
import { parseDurationMs } from "../cli/parse-duration.js";
import type { ClawdbotConfig } from "../config/config.js";
import type { MoltbotConfig } from "../config/config.js";
import { loadConfig } from "../config/config.js";
import {
canonicalizeMainSessionAlias,
@@ -97,7 +97,7 @@ const EXEC_EVENT_PROMPT =
"Please relay the command output to the user in a helpful way. If the command succeeded, share the relevant output. " +
"If it failed, explain what went wrong.";
function resolveActiveHoursTimezone(cfg: ClawdbotConfig, raw?: string): string {
function resolveActiveHoursTimezone(cfg: MoltbotConfig, raw?: string): string {
const trimmed = raw?.trim();
if (!trimmed || trimmed === "user") {
return resolveUserTimezone(cfg.agents?.defaults?.userTimezone);
@@ -149,7 +149,7 @@ function resolveMinutesInTimeZone(nowMs: number, timeZone: string): number | nul
}
function isWithinActiveHours(
cfg: ClawdbotConfig,
cfg: MoltbotConfig,
heartbeat?: HeartbeatConfig,
nowMs?: number,
): boolean {
@@ -181,15 +181,15 @@ type HeartbeatAgentState = {
export type HeartbeatRunner = {
stop: () => void;
updateConfig: (cfg: ClawdbotConfig) => void;
updateConfig: (cfg: MoltbotConfig) => void;
};
function hasExplicitHeartbeatAgents(cfg: ClawdbotConfig) {
function hasExplicitHeartbeatAgents(cfg: MoltbotConfig) {
const list = cfg.agents?.list ?? [];
return list.some((entry) => Boolean(entry?.heartbeat));
}
export function isHeartbeatEnabledForAgent(cfg: ClawdbotConfig, agentId?: string): boolean {
export function isHeartbeatEnabledForAgent(cfg: MoltbotConfig, agentId?: string): boolean {
const resolvedAgentId = normalizeAgentId(agentId ?? resolveDefaultAgentId(cfg));
const list = cfg.agents?.list ?? [];
const hasExplicit = hasExplicitHeartbeatAgents(cfg);
@@ -201,10 +201,7 @@ export function isHeartbeatEnabledForAgent(cfg: ClawdbotConfig, agentId?: string
return resolvedAgentId === resolveDefaultAgentId(cfg);
}
function resolveHeartbeatConfig(
cfg: ClawdbotConfig,
agentId?: string,
): HeartbeatConfig | undefined {
function resolveHeartbeatConfig(cfg: MoltbotConfig, agentId?: string): HeartbeatConfig | undefined {
const defaults = cfg.agents?.defaults?.heartbeat;
if (!agentId) return defaults;
const overrides = resolveAgentConfig(cfg, agentId)?.heartbeat;
@@ -213,7 +210,7 @@ function resolveHeartbeatConfig(
}
export function resolveHeartbeatSummaryForAgent(
cfg: ClawdbotConfig,
cfg: MoltbotConfig,
agentId?: string,
): HeartbeatSummary {
const defaults = cfg.agents?.defaults?.heartbeat;
@@ -260,7 +257,7 @@ export function resolveHeartbeatSummaryForAgent(
};
}
function resolveHeartbeatAgents(cfg: ClawdbotConfig): HeartbeatAgent[] {
function resolveHeartbeatAgents(cfg: MoltbotConfig): HeartbeatAgent[] {
const list = cfg.agents?.list ?? [];
if (hasExplicitHeartbeatAgents(cfg)) {
return list
@@ -276,7 +273,7 @@ function resolveHeartbeatAgents(cfg: ClawdbotConfig): HeartbeatAgent[] {
}
export function resolveHeartbeatIntervalMs(
cfg: ClawdbotConfig,
cfg: MoltbotConfig,
overrideEvery?: string,
heartbeat?: HeartbeatConfig,
) {
@@ -298,11 +295,11 @@ export function resolveHeartbeatIntervalMs(
return ms;
}
export function resolveHeartbeatPrompt(cfg: ClawdbotConfig, heartbeat?: HeartbeatConfig) {
export function resolveHeartbeatPrompt(cfg: MoltbotConfig, heartbeat?: HeartbeatConfig) {
return resolveHeartbeatPromptText(heartbeat?.prompt ?? cfg.agents?.defaults?.heartbeat?.prompt);
}
function resolveHeartbeatAckMaxChars(cfg: ClawdbotConfig, heartbeat?: HeartbeatConfig) {
function resolveHeartbeatAckMaxChars(cfg: MoltbotConfig, heartbeat?: HeartbeatConfig) {
return Math.max(
0,
heartbeat?.ackMaxChars ??
@@ -312,7 +309,7 @@ function resolveHeartbeatAckMaxChars(cfg: ClawdbotConfig, heartbeat?: HeartbeatC
}
function resolveHeartbeatSession(
cfg: ClawdbotConfig,
cfg: MoltbotConfig,
agentId?: string,
heartbeat?: HeartbeatConfig,
) {
@@ -431,7 +428,7 @@ function normalizeHeartbeatReply(
}
export async function runHeartbeatOnce(opts: {
cfg?: ClawdbotConfig;
cfg?: MoltbotConfig;
agentId?: string;
heartbeat?: HeartbeatConfig;
reason?: string;
@@ -758,7 +755,7 @@ export async function runHeartbeatOnce(opts: {
}
export function startHeartbeatRunner(opts: {
cfg?: ClawdbotConfig;
cfg?: MoltbotConfig;
runtime?: RuntimeEnv;
abortSignal?: AbortSignal;
runOnce?: typeof runHeartbeatOnce;
@@ -804,7 +801,7 @@ export function startHeartbeatRunner(opts: {
state.timer.unref?.();
};
const updateConfig = (cfg: ClawdbotConfig) => {
const updateConfig = (cfg: MoltbotConfig) => {
if (state.stopped) return;
const now = Date.now();
const prevAgents = state.agents;