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

@@ -3,7 +3,7 @@ import type { IncomingMessage, ServerResponse } from "node:http";
import { EventEmitter } from "node:events";
import { removeAckReactionAfterReply, shouldAckReaction } from "clawdbot/plugin-sdk";
import type { ClawdbotConfig, PluginRuntime } from "clawdbot/plugin-sdk";
import type { MoltbotConfig, PluginRuntime } from "clawdbot/plugin-sdk";
import {
handleBlueBubblesWebhookRequest,
registerBlueBubblesWebhookTarget,
@@ -178,7 +178,7 @@ function createMockRuntime(): PluginRuntime {
})) as unknown as PluginRuntime["logging"]["getChildLogger"],
},
state: {
resolveStateDir: vi.fn(() => "/tmp/clawdbot") as unknown as PluginRuntime["state"]["resolveStateDir"],
resolveStateDir: vi.fn(() => "/tmp/moltbot") as unknown as PluginRuntime["state"]["resolveStateDir"],
},
};
}
@@ -264,7 +264,7 @@ describe("BlueBubbles webhook monitor", () => {
describe("webhook parsing + auth handling", () => {
it("rejects non-POST requests", async () => {
const account = createMockAccount();
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -287,7 +287,7 @@ describe("BlueBubbles webhook monitor", () => {
it("accepts POST requests with valid JSON payload", async () => {
const account = createMockAccount();
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -323,7 +323,7 @@ describe("BlueBubbles webhook monitor", () => {
it("rejects requests with invalid JSON", async () => {
const account = createMockAccount();
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -346,7 +346,7 @@ describe("BlueBubbles webhook monitor", () => {
it("authenticates via password query parameter", async () => {
const account = createMockAccount({ password: "secret-token" });
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -380,7 +380,7 @@ describe("BlueBubbles webhook monitor", () => {
it("authenticates via x-password header", async () => {
const account = createMockAccount({ password: "secret-token" });
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -418,7 +418,7 @@ describe("BlueBubbles webhook monitor", () => {
it("rejects unauthorized requests with wrong password", async () => {
const account = createMockAccount({ password: "secret-token" });
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -451,7 +451,7 @@ describe("BlueBubbles webhook monitor", () => {
it("allows localhost requests without authentication", async () => {
const account = createMockAccount({ password: "secret-token" });
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -497,7 +497,7 @@ describe("BlueBubbles webhook monitor", () => {
vi.mocked(resolveChatGuidForTarget).mockClear();
const account = createMockAccount({ groupPolicy: "open" });
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -545,7 +545,7 @@ describe("BlueBubbles webhook monitor", () => {
});
const account = createMockAccount({ groupPolicy: "open" });
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -591,7 +591,7 @@ describe("BlueBubbles webhook monitor", () => {
dmPolicy: "allowlist",
allowFrom: ["+15551234567"],
});
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -632,7 +632,7 @@ describe("BlueBubbles webhook monitor", () => {
dmPolicy: "allowlist",
allowFrom: ["+15559999999"], // Different number
});
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -673,7 +673,7 @@ describe("BlueBubbles webhook monitor", () => {
dmPolicy: "pairing",
allowFrom: ["+15559999999"], // Different number than sender
});
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -716,7 +716,7 @@ describe("BlueBubbles webhook monitor", () => {
dmPolicy: "pairing",
allowFrom: ["+15559999999"], // Different number than sender
});
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -757,7 +757,7 @@ describe("BlueBubbles webhook monitor", () => {
dmPolicy: "open",
allowFrom: [],
});
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -794,7 +794,7 @@ describe("BlueBubbles webhook monitor", () => {
const account = createMockAccount({
dmPolicy: "disabled",
});
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -833,7 +833,7 @@ describe("BlueBubbles webhook monitor", () => {
const account = createMockAccount({
groupPolicy: "open",
});
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -871,7 +871,7 @@ describe("BlueBubbles webhook monitor", () => {
const account = createMockAccount({
groupPolicy: "disabled",
});
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -910,7 +910,7 @@ describe("BlueBubbles webhook monitor", () => {
groupPolicy: "allowlist",
dmPolicy: "open",
});
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -949,7 +949,7 @@ describe("BlueBubbles webhook monitor", () => {
groupPolicy: "allowlist",
groupAllowFrom: ["chat_guid:iMessage;+;chat123456"],
});
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -990,7 +990,7 @@ describe("BlueBubbles webhook monitor", () => {
mockMatchesMentionPatterns.mockReturnValue(true);
const account = createMockAccount({ groupPolicy: "open" });
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -1031,7 +1031,7 @@ describe("BlueBubbles webhook monitor", () => {
mockMatchesMentionPatterns.mockReturnValue(false);
const account = createMockAccount({ groupPolicy: "open" });
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -1069,7 +1069,7 @@ describe("BlueBubbles webhook monitor", () => {
mockResolveRequireMention.mockReturnValue(false);
const account = createMockAccount({ groupPolicy: "open" });
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -1107,7 +1107,7 @@ describe("BlueBubbles webhook monitor", () => {
describe("group metadata", () => {
it("includes group subject + members in ctx", async () => {
const account = createMockAccount({ groupPolicy: "open" });
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -1153,7 +1153,7 @@ describe("BlueBubbles webhook monitor", () => {
describe("reply metadata", () => {
it("surfaces reply fields in ctx when provided", async () => {
const account = createMockAccount({ dmPolicy: "open" });
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -1201,7 +1201,7 @@ describe("BlueBubbles webhook monitor", () => {
it("preserves part index prefixes in reply tags when short IDs are unavailable", async () => {
const account = createMockAccount({ dmPolicy: "open" });
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -1246,7 +1246,7 @@ describe("BlueBubbles webhook monitor", () => {
it("hydrates missing reply sender/body from the recent-message cache", async () => {
const account = createMockAccount({ dmPolicy: "open", groupPolicy: "open" });
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -1316,7 +1316,7 @@ describe("BlueBubbles webhook monitor", () => {
it("falls back to threadOriginatorGuid when reply metadata is absent", async () => {
const account = createMockAccount({ dmPolicy: "open" });
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -1357,7 +1357,7 @@ describe("BlueBubbles webhook monitor", () => {
describe("tapback text parsing", () => {
it("does not rewrite tapback-like text without metadata", async () => {
const account = createMockAccount({ dmPolicy: "open" });
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -1397,7 +1397,7 @@ describe("BlueBubbles webhook monitor", () => {
it("parses tapback text with custom emoji when metadata is present", async () => {
const account = createMockAccount({ dmPolicy: "open" });
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -1442,7 +1442,7 @@ describe("BlueBubbles webhook monitor", () => {
vi.mocked(sendBlueBubblesReaction).mockClear();
const account = createMockAccount({ dmPolicy: "open" });
const config: ClawdbotConfig = {
const config: MoltbotConfig = {
messages: {
ackReaction: "❤️",
ackReactionScope: "direct",
@@ -1500,7 +1500,7 @@ describe("BlueBubbles webhook monitor", () => {
groupPolicy: "open",
allowFrom: ["+15551234567"],
});
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -1543,7 +1543,7 @@ describe("BlueBubbles webhook monitor", () => {
groupPolicy: "open",
allowFrom: [], // No one authorized
});
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -1586,7 +1586,7 @@ describe("BlueBubbles webhook monitor", () => {
const account = createMockAccount({
sendReadReceipts: true,
});
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -1627,7 +1627,7 @@ describe("BlueBubbles webhook monitor", () => {
const account = createMockAccount({
sendReadReceipts: false,
});
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -1666,7 +1666,7 @@ describe("BlueBubbles webhook monitor", () => {
vi.mocked(sendBlueBubblesTyping).mockClear();
const account = createMockAccount();
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -1714,7 +1714,7 @@ describe("BlueBubbles webhook monitor", () => {
vi.mocked(sendBlueBubblesTyping).mockClear();
const account = createMockAccount();
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -1763,7 +1763,7 @@ describe("BlueBubbles webhook monitor", () => {
vi.mocked(sendBlueBubblesTyping).mockClear();
const account = createMockAccount();
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -1813,7 +1813,7 @@ describe("BlueBubbles webhook monitor", () => {
});
const account = createMockAccount();
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -1859,7 +1859,7 @@ describe("BlueBubbles webhook monitor", () => {
mockEnqueueSystemEvent.mockClear();
const account = createMockAccount();
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -1899,7 +1899,7 @@ describe("BlueBubbles webhook monitor", () => {
mockEnqueueSystemEvent.mockClear();
const account = createMockAccount();
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -1939,7 +1939,7 @@ describe("BlueBubbles webhook monitor", () => {
mockEnqueueSystemEvent.mockClear();
const account = createMockAccount();
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -1976,7 +1976,7 @@ describe("BlueBubbles webhook monitor", () => {
mockEnqueueSystemEvent.mockClear();
const account = createMockAccount();
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -2017,7 +2017,7 @@ describe("BlueBubbles webhook monitor", () => {
describe("short message ID mapping", () => {
it("assigns sequential short IDs to messages", async () => {
const account = createMockAccount({ dmPolicy: "open" });
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -2057,7 +2057,7 @@ describe("BlueBubbles webhook monitor", () => {
it("resolves short ID back to UUID", async () => {
const account = createMockAccount({ dmPolicy: "open" });
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);
@@ -2110,7 +2110,7 @@ describe("BlueBubbles webhook monitor", () => {
describe("fromMe messages", () => {
it("ignores messages from self (fromMe=true)", async () => {
const account = createMockAccount();
const config: ClawdbotConfig = {};
const config: MoltbotConfig = {};
const core = createMockRuntime();
setBlueBubblesRuntime(core);