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

@@ -5,7 +5,7 @@ import path from "node:path";
import type { AssistantMessage } from "@mariozechner/pi-ai";
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import type { ClawdbotConfig } from "../config/config.js";
import type { MoltbotConfig } from "../config/config.js";
import type { EmbeddedRunAttemptResult } from "./pi-embedded-runner/run/types.js";
const runEmbeddedAttemptMock = vi.fn<Promise<EmbeddedRunAttemptResult>, [unknown]>();
@@ -63,7 +63,7 @@ const makeAttempt = (overrides: Partial<EmbeddedRunAttemptResult>): EmbeddedRunA
...overrides,
});
const makeConfig = (opts?: { fallbacks?: string[]; apiKey?: string }): ClawdbotConfig =>
const makeConfig = (opts?: { fallbacks?: string[]; apiKey?: string }): MoltbotConfig =>
({
agents: {
defaults: {
@@ -92,7 +92,7 @@ const makeConfig = (opts?: { fallbacks?: string[]; apiKey?: string }): ClawdbotC
},
},
},
}) satisfies ClawdbotConfig;
}) satisfies MoltbotConfig;
const writeAuthStore = async (
agentDir: string,
@@ -123,8 +123,8 @@ const writeAuthStore = async (
describe("runEmbeddedPiAgent auth profile rotation", () => {
it("rotates for auto-pinned profiles", async () => {
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-agent-"));
const workspaceDir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-workspace-"));
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-agent-"));
const workspaceDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-workspace-"));
try {
await writeAuthStore(agentDir);
@@ -177,8 +177,8 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {
});
it("does not rotate for user-pinned profiles", async () => {
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-agent-"));
const workspaceDir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-workspace-"));
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-agent-"));
const workspaceDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-workspace-"));
try {
await writeAuthStore(agentDir);
@@ -223,8 +223,8 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {
it("honors user-pinned profiles even when in cooldown", async () => {
vi.useFakeTimers();
try {
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-agent-"));
const workspaceDir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-workspace-"));
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-agent-"));
const workspaceDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-workspace-"));
const now = Date.now();
vi.setSystemTime(now);
@@ -289,8 +289,8 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {
});
it("ignores user-locked profile when provider mismatches", async () => {
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-agent-"));
const workspaceDir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-workspace-"));
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-agent-"));
const workspaceDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-workspace-"));
try {
await writeAuthStore(agentDir, { includeAnthropic: true });
@@ -330,8 +330,8 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {
it("skips profiles in cooldown during initial selection", async () => {
vi.useFakeTimers();
try {
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-agent-"));
const workspaceDir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-workspace-"));
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-agent-"));
const workspaceDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-workspace-"));
const now = Date.now();
vi.setSystemTime(now);
@@ -395,8 +395,8 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {
it("fails over when all profiles are in cooldown and fallbacks are configured", async () => {
vi.useFakeTimers();
try {
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-agent-"));
const workspaceDir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-workspace-"));
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-agent-"));
const workspaceDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-workspace-"));
const now = Date.now();
vi.setSystemTime(now);
@@ -441,8 +441,8 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {
});
it("fails over when auth is unavailable and fallbacks are configured", async () => {
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-agent-"));
const workspaceDir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-workspace-"));
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-agent-"));
const workspaceDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-workspace-"));
const previousOpenAiKey = process.env.OPENAI_API_KEY;
delete process.env.OPENAI_API_KEY;
try {
@@ -481,8 +481,8 @@ describe("runEmbeddedPiAgent auth profile rotation", () => {
it("skips profiles in cooldown when rotating after failure", async () => {
vi.useFakeTimers();
try {
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-agent-"));
const workspaceDir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-workspace-"));
const agentDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-agent-"));
const workspaceDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-workspace-"));
const now = Date.now();
vi.setSystemTime(now);