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,6 +1,7 @@
import fs from "node:fs/promises";
import path from "node:path";
import { describe, expect, it } from "vitest";
import { LEGACY_MACOS_APP_SOURCES_DIR } from "../compat/legacy-names.js";
import { CronPayloadSchema } from "../gateway/protocol/schema.js";
type SchemaLike = {
@@ -29,7 +30,7 @@ function extractCronChannels(schema: SchemaLike): string[] {
const UI_FILES = ["ui/src/ui/types.ts", "ui/src/ui/ui-types.ts", "ui/src/ui/views/cron.ts"];
const SWIFT_FILES = ["apps/macos/Sources/Clawdbot/GatewayConnection.swift"];
const SWIFT_FILES = [`${LEGACY_MACOS_APP_SOURCES_DIR}/GatewayConnection.swift`];
describe("cron protocol conformance", () => {
it("ui + swift include all cron providers from gateway schema", async () => {
@@ -60,10 +61,8 @@ describe("cron protocol conformance", () => {
expect(uiTypes.includes("jobs:")).toBe(true);
expect(uiTypes.includes("jobCount")).toBe(false);
const swift = await fs.readFile(
path.join(cwd, "apps/macos/Sources/Clawdbot/GatewayConnection.swift"),
"utf-8",
);
const swiftPath = path.join(cwd, SWIFT_FILES[0]);
const swift = await fs.readFile(swiftPath, "utf-8");
expect(swift.includes("struct CronSchedulerStatus")).toBe(true);
expect(swift.includes("let jobs:")).toBe(true);
});

View File

@@ -5,7 +5,7 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
import { withTempHome as withTempHomeBase } from "../../test/helpers/temp-home.js";
import type { CliDeps } from "../cli/deps.js";
import type { ClawdbotConfig } from "../config/config.js";
import type { MoltbotConfig } from "../config/config.js";
import type { CronJob } from "./types.js";
vi.mock("../agents/pi-embedded.js", () => ({
@@ -22,7 +22,7 @@ import { runEmbeddedPiAgent } from "../agents/pi-embedded.js";
import { runCronIsolatedAgentTurn } from "./isolated-agent.js";
async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
return withTempHomeBase(fn, { prefix: "clawdbot-cron-" });
return withTempHomeBase(fn, { prefix: "moltbot-cron-" });
}
async function writeSessionStore(home: string) {
@@ -51,9 +51,9 @@ async function writeSessionStore(home: string) {
function makeCfg(
home: string,
storePath: string,
overrides: Partial<ClawdbotConfig> = {},
): ClawdbotConfig {
const base: ClawdbotConfig = {
overrides: Partial<MoltbotConfig> = {},
): MoltbotConfig {
const base: MoltbotConfig = {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
@@ -61,7 +61,7 @@ function makeCfg(
},
},
session: { store: storePath, mainKey: "main" },
} as ClawdbotConfig;
} as MoltbotConfig;
return { ...base, ...overrides };
}

View File

@@ -5,7 +5,7 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
import { withTempHome as withTempHomeBase } from "../../test/helpers/temp-home.js";
import type { CliDeps } from "../cli/deps.js";
import type { ClawdbotConfig } from "../config/config.js";
import type { MoltbotConfig } from "../config/config.js";
import { setActivePluginRegistry } from "../plugins/runtime.js";
import { createPluginRuntime } from "../plugins/runtime/index.js";
import { createTestRegistry } from "../test-utils/channel-plugins.js";
@@ -31,7 +31,7 @@ import { runEmbeddedPiAgent } from "../agents/pi-embedded.js";
import { runCronIsolatedAgentTurn } from "./isolated-agent.js";
async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
return withTempHomeBase(fn, { prefix: "clawdbot-cron-" });
return withTempHomeBase(fn, { prefix: "moltbot-cron-" });
}
async function writeSessionStore(home: string) {
@@ -60,9 +60,9 @@ async function writeSessionStore(home: string) {
function makeCfg(
home: string,
storePath: string,
overrides: Partial<ClawdbotConfig> = {},
): ClawdbotConfig {
const base: ClawdbotConfig = {
overrides: Partial<MoltbotConfig> = {},
): MoltbotConfig {
const base: MoltbotConfig = {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
@@ -70,7 +70,7 @@ function makeCfg(
},
},
session: { store: storePath, mainKey: "main" },
} as ClawdbotConfig;
} as MoltbotConfig;
return { ...base, ...overrides };
}

View File

@@ -5,7 +5,7 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
import { withTempHome as withTempHomeBase } from "../../test/helpers/temp-home.js";
import type { CliDeps } from "../cli/deps.js";
import type { ClawdbotConfig } from "../config/config.js";
import type { MoltbotConfig } from "../config/config.js";
import type { CronJob } from "./types.js";
vi.mock("../agents/pi-embedded.js", () => ({
@@ -22,7 +22,7 @@ import { runEmbeddedPiAgent } from "../agents/pi-embedded.js";
import { runCronIsolatedAgentTurn } from "./isolated-agent.js";
async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
return withTempHomeBase(fn, { prefix: "clawdbot-cron-" });
return withTempHomeBase(fn, { prefix: "moltbot-cron-" });
}
async function writeSessionStore(home: string) {
@@ -57,9 +57,9 @@ async function readSessionEntry(storePath: string, key: string) {
function makeCfg(
home: string,
storePath: string,
overrides: Partial<ClawdbotConfig> = {},
): ClawdbotConfig {
const base: ClawdbotConfig = {
overrides: Partial<MoltbotConfig> = {},
): MoltbotConfig {
const base: MoltbotConfig = {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
@@ -67,7 +67,7 @@ function makeCfg(
},
},
session: { store: storePath, mainKey: "main" },
} as ClawdbotConfig;
} as MoltbotConfig;
return { ...base, ...overrides };
}

View File

@@ -1,6 +1,6 @@
import type { ChannelId } from "../../channels/plugins/types.js";
import { DEFAULT_CHAT_CHANNEL } from "../../channels/registry.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import {
loadSessionStore,
resolveAgentMainSessionKey,
@@ -14,7 +14,7 @@ import {
} from "../../infra/outbound/targets.js";
export async function resolveDeliveryTarget(
cfg: ClawdbotConfig,
cfg: MoltbotConfig,
agentId: string,
jobPayload: {
channel?: "last" | ChannelId;

View File

@@ -38,7 +38,7 @@ import {
supportsXHighThinking,
} from "../../auto-reply/thinking.js";
import { createOutboundSendDeps, type CliDeps } from "../../cli/outbound-send-deps.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { resolveSessionTranscriptPath, updateSessionStore } from "../../config/sessions.js";
import type { AgentDefaultsConfig } from "../../config/types.js";
import { registerAgentRunContext } from "../../infra/agent-events.js";
@@ -86,7 +86,7 @@ export type RunCronAgentTurnResult = {
};
export async function runCronIsolatedAgentTurn(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
deps: CliDeps;
job: CronJob;
message: string;
@@ -117,7 +117,7 @@ export async function runCronIsolatedAgentTurn(params: {
} else if (overrideModel) {
agentCfg.model = overrideModel;
}
const cfgWithAgentDefaults: ClawdbotConfig = {
const cfgWithAgentDefaults: MoltbotConfig = {
...params.cfg,
agents: Object.assign({}, params.cfg.agents, { defaults: agentCfg }),
};

View File

@@ -1,10 +1,10 @@
import crypto from "node:crypto";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { loadSessionStore, resolveStorePath, type SessionEntry } from "../../config/sessions.js";
export function resolveCronSession(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
sessionKey: string;
nowMs: number;
agentId: string;

View File

@@ -14,7 +14,7 @@ describe("cron run log", () => {
});
it("appends JSONL and prunes by line count", async () => {
const dir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-cron-log-"));
const dir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-cron-log-"));
const logPath = path.join(dir, "runs", "job-1.jsonl");
for (let i = 0; i < 10; i++) {
@@ -44,7 +44,7 @@ describe("cron run log", () => {
});
it("reads newest entries and filters by jobId", async () => {
const dir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-cron-log-read-"));
const dir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-cron-log-read-"));
const logPathA = path.join(dir, "runs", "a.jsonl");
const logPathB = path.join(dir, "runs", "b.jsonl");

View File

@@ -14,7 +14,7 @@ const noopLogger = {
};
async function makeStorePath() {
const dir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-cron-"));
const dir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-cron-"));
return {
storePath: path.join(dir, "cron", "jobs.json"),
cleanup: async () => {

View File

@@ -15,7 +15,7 @@ const noopLogger = {
};
async function makeStorePath() {
const dir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-cron-"));
const dir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-cron-"));
return {
storePath: path.join(dir, "cron", "jobs.json"),
cleanup: async () => {

View File

@@ -14,7 +14,7 @@ const noopLogger = {
};
async function makeStorePath() {
const dir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-cron-"));
const dir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-cron-"));
return {
storePath: path.join(dir, "cron", "jobs.json"),
cleanup: async () => {