mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 23:31:24 +00:00
refactor: rename clawdbot to moltbot with legacy compat
This commit is contained in:
@@ -28,7 +28,7 @@ describe("browser chrome profile decoration", () => {
|
||||
});
|
||||
|
||||
it("writes expected name + signed ARGB seed to Chrome prefs", async () => {
|
||||
const userDataDir = await fsp.mkdtemp(path.join(os.tmpdir(), "clawdbot-chrome-test-"));
|
||||
const userDataDir = await fsp.mkdtemp(path.join(os.tmpdir(), "moltbot-chrome-test-"));
|
||||
try {
|
||||
decorateClawdProfile(userDataDir, { color: DEFAULT_CLAWD_BROWSER_COLOR });
|
||||
|
||||
@@ -66,7 +66,7 @@ describe("browser chrome profile decoration", () => {
|
||||
});
|
||||
|
||||
it("best-effort writes name when color is invalid", async () => {
|
||||
const userDataDir = await fsp.mkdtemp(path.join(os.tmpdir(), "clawdbot-chrome-test-"));
|
||||
const userDataDir = await fsp.mkdtemp(path.join(os.tmpdir(), "moltbot-chrome-test-"));
|
||||
try {
|
||||
decorateClawdProfile(userDataDir, { color: "lobster-orange" });
|
||||
const localState = await readJson(path.join(userDataDir, "Local State"));
|
||||
@@ -82,7 +82,7 @@ describe("browser chrome profile decoration", () => {
|
||||
});
|
||||
|
||||
it("recovers from missing/invalid preference files", async () => {
|
||||
const userDataDir = await fsp.mkdtemp(path.join(os.tmpdir(), "clawdbot-chrome-test-"));
|
||||
const userDataDir = await fsp.mkdtemp(path.join(os.tmpdir(), "moltbot-chrome-test-"));
|
||||
try {
|
||||
await fsp.mkdir(path.join(userDataDir, "Default"), { recursive: true });
|
||||
await fsp.writeFile(path.join(userDataDir, "Local State"), "{", "utf-8"); // invalid JSON
|
||||
@@ -105,7 +105,7 @@ describe("browser chrome profile decoration", () => {
|
||||
});
|
||||
|
||||
it("writes clean exit prefs to avoid restore prompts", async () => {
|
||||
const userDataDir = await fsp.mkdtemp(path.join(os.tmpdir(), "clawdbot-chrome-test-"));
|
||||
const userDataDir = await fsp.mkdtemp(path.join(os.tmpdir(), "moltbot-chrome-test-"));
|
||||
try {
|
||||
ensureProfileCleanExit(userDataDir);
|
||||
const prefs = await readJson(path.join(userDataDir, "Default", "Preferences"));
|
||||
@@ -117,7 +117,7 @@ describe("browser chrome profile decoration", () => {
|
||||
});
|
||||
|
||||
it("is idempotent when rerun on an existing profile", async () => {
|
||||
const userDataDir = await fsp.mkdtemp(path.join(os.tmpdir(), "clawdbot-chrome-test-"));
|
||||
const userDataDir = await fsp.mkdtemp(path.join(os.tmpdir(), "moltbot-chrome-test-"));
|
||||
try {
|
||||
decorateClawdProfile(userDataDir, { color: DEFAULT_CLAWD_BROWSER_COLOR });
|
||||
decorateClawdProfile(userDataDir, { color: DEFAULT_CLAWD_BROWSER_COLOR });
|
||||
|
||||
@@ -12,7 +12,7 @@ function isAbsoluteHttp(url: string): boolean {
|
||||
function enhanceBrowserFetchError(url: string, err: unknown, timeoutMs: number): Error {
|
||||
const hint = isAbsoluteHttp(url)
|
||||
? "If this is a sandboxed session, ensure the sandbox browser is running and try again."
|
||||
: `Start (or restart) the Clawdbot gateway (Clawdbot.app menubar, or \`${formatCliCommand("clawdbot gateway")}\`) and try again.`;
|
||||
: `Start (or restart) the Moltbot gateway (Moltbot.app menubar, or \`${formatCliCommand("moltbot gateway")}\`) and try again.`;
|
||||
const msg = String(err);
|
||||
const msgLower = msg.toLowerCase();
|
||||
const looksLikeTimeout =
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { BrowserConfig, BrowserProfileConfig, ClawdbotConfig } from "../config/config.js";
|
||||
import type { BrowserConfig, BrowserProfileConfig, MoltbotConfig } from "../config/config.js";
|
||||
import {
|
||||
deriveDefaultBrowserCdpPortRange,
|
||||
deriveDefaultBrowserControlPort,
|
||||
@@ -116,7 +116,7 @@ function ensureDefaultProfile(
|
||||
/**
|
||||
* Ensure a built-in "chrome" profile exists for the Chrome extension relay.
|
||||
*
|
||||
* Note: this is a Clawdbot browser profile (routing config), not a Chrome user profile.
|
||||
* Note: this is a Moltbot browser profile (routing config), not a Chrome user profile.
|
||||
* It points at the local relay CDP endpoint (controlPort + 1).
|
||||
*/
|
||||
function ensureDefaultChromeExtensionProfile(
|
||||
@@ -139,7 +139,7 @@ function ensureDefaultChromeExtensionProfile(
|
||||
}
|
||||
export function resolveBrowserConfig(
|
||||
cfg: BrowserConfig | undefined,
|
||||
rootConfig?: ClawdbotConfig,
|
||||
rootConfig?: MoltbotConfig,
|
||||
): ResolvedBrowserConfig {
|
||||
const enabled = cfg?.enabled ?? DEFAULT_CLAWD_BROWSER_ENABLED;
|
||||
const evaluateEnabled = cfg?.evaluateEnabled ?? DEFAULT_BROWSER_EVALUATE_ENABLED;
|
||||
|
||||
@@ -231,9 +231,9 @@ export async function ensureChromeExtensionRelayServer(opts: {
|
||||
case "Browser.getVersion":
|
||||
return {
|
||||
protocolVersion: "1.3",
|
||||
product: "Chrome/Clawdbot-Extension-Relay",
|
||||
product: "Chrome/Moltbot-Extension-Relay",
|
||||
revision: "0",
|
||||
userAgent: "Clawdbot-Extension-Relay",
|
||||
userAgent: "Moltbot-Extension-Relay",
|
||||
jsVersion: "V8",
|
||||
};
|
||||
case "Browser.setDownloadBehavior":
|
||||
@@ -318,7 +318,7 @@ export async function ensureChromeExtensionRelayServer(opts: {
|
||||
(req.method === "GET" || req.method === "PUT")
|
||||
) {
|
||||
const payload: Record<string, unknown> = {
|
||||
Browser: "Clawdbot/extension-relay",
|
||||
Browser: "Moltbot/extension-relay",
|
||||
"Protocol-Version": "1.3",
|
||||
};
|
||||
// Only advertise the WS URL if a real extension is connected.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
import type { BrowserProfileConfig, ClawdbotConfig } from "../config/config.js";
|
||||
import type { BrowserProfileConfig, MoltbotConfig } from "../config/config.js";
|
||||
import { loadConfig, writeConfigFile } from "../config/config.js";
|
||||
import { deriveDefaultBrowserCdpPortRange } from "../config/port-defaults.js";
|
||||
import { DEFAULT_BROWSER_DEFAULT_PROFILE_NAME } from "./constants.js";
|
||||
@@ -93,7 +93,7 @@ export function createBrowserProfilesService(ctx: BrowserRouteContext) {
|
||||
};
|
||||
}
|
||||
|
||||
const nextConfig: ClawdbotConfig = {
|
||||
const nextConfig: MoltbotConfig = {
|
||||
...cfg,
|
||||
browser: {
|
||||
...cfg.browser,
|
||||
@@ -162,7 +162,7 @@ export function createBrowserProfilesService(ctx: BrowserRouteContext) {
|
||||
}
|
||||
|
||||
const { [name]: _removed, ...remainingProfiles } = profiles;
|
||||
const nextConfig: ClawdbotConfig = {
|
||||
const nextConfig: MoltbotConfig = {
|
||||
...cfg,
|
||||
browser: {
|
||||
...cfg.browser,
|
||||
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
function buildTempDownloadPath(fileName: string): string {
|
||||
const id = crypto.randomUUID();
|
||||
const safeName = fileName.trim() ? fileName.trim() : "download.bin";
|
||||
return path.join("/tmp/clawdbot/downloads", `${id}-${safeName}`);
|
||||
return path.join("/tmp/moltbot/downloads", `${id}-${safeName}`);
|
||||
}
|
||||
|
||||
function createPageDownloadWaiter(page: Page, timeoutMs: number) {
|
||||
|
||||
@@ -427,11 +427,11 @@ export async function screenshotWithLabelsViaPlaywright(opts: {
|
||||
try {
|
||||
if (boxes.length > 0) {
|
||||
await page.evaluate((labels) => {
|
||||
const existing = document.querySelectorAll("[data-clawdbot-labels]");
|
||||
const existing = document.querySelectorAll("[data-moltbot-labels]");
|
||||
existing.forEach((el) => el.remove());
|
||||
|
||||
const root = document.createElement("div");
|
||||
root.setAttribute("data-clawdbot-labels", "1");
|
||||
root.setAttribute("data-moltbot-labels", "1");
|
||||
root.style.position = "fixed";
|
||||
root.style.left = "0";
|
||||
root.style.top = "0";
|
||||
@@ -445,7 +445,7 @@ export async function screenshotWithLabelsViaPlaywright(opts: {
|
||||
|
||||
for (const label of labels) {
|
||||
const box = document.createElement("div");
|
||||
box.setAttribute("data-clawdbot-labels", "1");
|
||||
box.setAttribute("data-moltbot-labels", "1");
|
||||
box.style.position = "absolute";
|
||||
box.style.left = `${label.x}px`;
|
||||
box.style.top = `${label.y}px`;
|
||||
@@ -455,7 +455,7 @@ export async function screenshotWithLabelsViaPlaywright(opts: {
|
||||
box.style.boxSizing = "border-box";
|
||||
|
||||
const tag = document.createElement("div");
|
||||
tag.setAttribute("data-clawdbot-labels", "1");
|
||||
tag.setAttribute("data-moltbot-labels", "1");
|
||||
tag.textContent = label.ref;
|
||||
tag.style.position = "absolute";
|
||||
tag.style.left = `${label.x}px`;
|
||||
@@ -482,7 +482,7 @@ export async function screenshotWithLabelsViaPlaywright(opts: {
|
||||
} finally {
|
||||
await page
|
||||
.evaluate(() => {
|
||||
const existing = document.querySelectorAll("[data-clawdbot-labels]");
|
||||
const existing = document.querySelectorAll("[data-moltbot-labels]");
|
||||
existing.forEach((el) => el.remove());
|
||||
})
|
||||
.catch(() => {});
|
||||
|
||||
@@ -66,7 +66,7 @@ export async function responseBodyViaPlaywright(opts: {
|
||||
cleanup();
|
||||
reject(
|
||||
new Error(
|
||||
`Response not found for url pattern "${pattern}". Run '${formatCliCommand("clawdbot browser requests")}' to inspect recent network activity.`,
|
||||
`Response not found for url pattern "${pattern}". Run '${formatCliCommand("moltbot browser requests")}' to inspect recent network activity.`,
|
||||
),
|
||||
);
|
||||
}, timeout);
|
||||
|
||||
@@ -112,7 +112,7 @@ export function registerBrowserAgentDebugRoutes(
|
||||
const pw = await requirePwAi(res, "trace stop");
|
||||
if (!pw) return;
|
||||
const id = crypto.randomUUID();
|
||||
const dir = "/tmp/clawdbot";
|
||||
const dir = "/tmp/moltbot";
|
||||
await fs.mkdir(dir, { recursive: true });
|
||||
const tracePath = out.trim() || path.join(dir, `browser-trace-${id}.zip`);
|
||||
await pw.traceStopViaPlaywright({
|
||||
|
||||
@@ -285,7 +285,7 @@ function createProfileContext(
|
||||
if (await isReachable(600)) return;
|
||||
// Relay server is up, but no attached tab yet. Prompt user to attach.
|
||||
throw new Error(
|
||||
`Chrome extension relay is running, but no tab is connected. Click the Clawdbot Chrome extension icon on a tab to attach it (profile "${profile.name}").`,
|
||||
`Chrome extension relay is running, but no tab is connected. Click the Moltbot Chrome extension icon on a tab to attach it (profile "${profile.name}").`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -312,7 +312,7 @@ function createProfileContext(
|
||||
// HTTP responds but WebSocket fails - port in use by something else
|
||||
if (!profileState.running) {
|
||||
throw new Error(
|
||||
`Port ${profile.cdpPort} is in use for profile "${profile.name}" but not by clawdbot. ` +
|
||||
`Port ${profile.cdpPort} is in use for profile "${profile.name}" but not by moltbot. ` +
|
||||
`Run action=reset-profile profile=${profile.name} to kill the process.`,
|
||||
);
|
||||
}
|
||||
@@ -351,7 +351,7 @@ function createProfileContext(
|
||||
if (profile.driver === "extension") {
|
||||
throw new Error(
|
||||
`tab not found (no attached Chrome tabs for profile "${profile.name}"). ` +
|
||||
"Click the Clawdbot Browser Relay toolbar icon on the tab you want to control (badge ON).",
|
||||
"Click the Moltbot Browser Relay toolbar icon on the tab you want to control (badge ON).",
|
||||
);
|
||||
}
|
||||
await openTab("about:blank");
|
||||
|
||||
Reference in New Issue
Block a user