mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 03:51:25 +00:00
refactor: rename clawdbot to moltbot with legacy compat
This commit is contained in:
@@ -8,7 +8,7 @@ import {
|
||||
import { buildChannelUiCatalog } from "../../channels/plugins/catalog.js";
|
||||
import { buildChannelAccountSnapshot } from "../../channels/plugins/status.js";
|
||||
import type { ChannelAccountSnapshot, ChannelPlugin } from "../../channels/plugins/types.js";
|
||||
import type { ClawdbotConfig } from "../../config/config.js";
|
||||
import type { MoltbotConfig } from "../../config/config.js";
|
||||
import { loadConfig, readConfigFileSnapshot } from "../../config/config.js";
|
||||
import { getChannelActivity } from "../../infra/channel-activity.js";
|
||||
import { DEFAULT_ACCOUNT_ID } from "../../routing/session-key.js";
|
||||
@@ -33,7 +33,7 @@ type ChannelLogoutPayload = {
|
||||
export async function logoutChannelAccount(params: {
|
||||
channelId: ChannelId;
|
||||
accountId?: string | null;
|
||||
cfg: ClawdbotConfig;
|
||||
cfg: MoltbotConfig;
|
||||
context: GatewayRequestContext;
|
||||
plugin: ChannelPlugin;
|
||||
}): Promise<ChannelLogoutPayload> {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../../agents/agent-scope.js";
|
||||
import {
|
||||
CONFIG_PATH_CLAWDBOT,
|
||||
CONFIG_PATH,
|
||||
loadConfig,
|
||||
parseConfigJson5,
|
||||
readConfigFileSnapshot,
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
writeRestartSentinel,
|
||||
} from "../../infra/restart-sentinel.js";
|
||||
import { listChannelPlugins } from "../../channels/plugins/index.js";
|
||||
import { loadClawdbotPlugins } from "../../plugins/loader.js";
|
||||
import { loadMoltbotPlugins } from "../../plugins/loader.js";
|
||||
import {
|
||||
ErrorCodes,
|
||||
errorShape,
|
||||
@@ -112,7 +112,7 @@ export const configHandlers: GatewayRequestHandlers = {
|
||||
}
|
||||
const cfg = loadConfig();
|
||||
const workspaceDir = resolveAgentWorkspaceDir(cfg, resolveDefaultAgentId(cfg));
|
||||
const pluginRegistry = loadClawdbotPlugins({
|
||||
const pluginRegistry = loadMoltbotPlugins({
|
||||
config: cfg,
|
||||
workspaceDir,
|
||||
logger: {
|
||||
@@ -186,7 +186,7 @@ export const configHandlers: GatewayRequestHandlers = {
|
||||
true,
|
||||
{
|
||||
ok: true,
|
||||
path: CONFIG_PATH_CLAWDBOT,
|
||||
path: CONFIG_PATH,
|
||||
config: validated.config,
|
||||
},
|
||||
undefined,
|
||||
@@ -284,7 +284,7 @@ export const configHandlers: GatewayRequestHandlers = {
|
||||
doctorHint: formatDoctorNonInteractiveHint(),
|
||||
stats: {
|
||||
mode: "config.patch",
|
||||
root: CONFIG_PATH_CLAWDBOT,
|
||||
root: CONFIG_PATH,
|
||||
},
|
||||
};
|
||||
let sentinelPath: string | null = null;
|
||||
@@ -301,7 +301,7 @@ export const configHandlers: GatewayRequestHandlers = {
|
||||
true,
|
||||
{
|
||||
ok: true,
|
||||
path: CONFIG_PATH_CLAWDBOT,
|
||||
path: CONFIG_PATH,
|
||||
config: validated.config,
|
||||
restart,
|
||||
sentinel: {
|
||||
@@ -381,7 +381,7 @@ export const configHandlers: GatewayRequestHandlers = {
|
||||
doctorHint: formatDoctorNonInteractiveHint(),
|
||||
stats: {
|
||||
mode: "config.apply",
|
||||
root: CONFIG_PATH_CLAWDBOT,
|
||||
root: CONFIG_PATH,
|
||||
},
|
||||
};
|
||||
let sentinelPath: string | null = null;
|
||||
@@ -398,7 +398,7 @@ export const configHandlers: GatewayRequestHandlers = {
|
||||
true,
|
||||
{
|
||||
ok: true,
|
||||
path: CONFIG_PATH_CLAWDBOT,
|
||||
path: CONFIG_PATH,
|
||||
config: validated.config,
|
||||
restart,
|
||||
sentinel: {
|
||||
|
||||
@@ -16,16 +16,16 @@ describe("logs.tail", () => {
|
||||
});
|
||||
|
||||
it("falls back to latest rolling log file when today is missing", async () => {
|
||||
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-logs-"));
|
||||
const older = path.join(tempDir, "clawdbot-2026-01-20.log");
|
||||
const newer = path.join(tempDir, "clawdbot-2026-01-21.log");
|
||||
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-logs-"));
|
||||
const older = path.join(tempDir, "moltbot-2026-01-20.log");
|
||||
const newer = path.join(tempDir, "moltbot-2026-01-21.log");
|
||||
|
||||
await fs.writeFile(older, '{"msg":"old"}\n');
|
||||
await fs.writeFile(newer, '{"msg":"new"}\n');
|
||||
await fs.utimes(older, new Date(0), new Date(0));
|
||||
await fs.utimes(newer, new Date(), new Date());
|
||||
|
||||
setLoggerOverride({ file: path.join(tempDir, "clawdbot-2026-01-22.log") });
|
||||
setLoggerOverride({ file: path.join(tempDir, "moltbot-2026-01-22.log") });
|
||||
|
||||
const respond = vi.fn();
|
||||
await logsHandlers["logs.tail"]({
|
||||
|
||||
@@ -13,7 +13,7 @@ const DEFAULT_LIMIT = 500;
|
||||
const DEFAULT_MAX_BYTES = 250_000;
|
||||
const MAX_LIMIT = 5000;
|
||||
const MAX_BYTES = 1_000_000;
|
||||
const ROLLING_LOG_RE = /^clawdbot-\d{4}-\d{2}-\d{2}\.log$/;
|
||||
const ROLLING_LOG_RE = /^moltbot-\d{4}-\d{2}-\d{2}\.log$/;
|
||||
|
||||
function clamp(value: number, min: number, max: number) {
|
||||
return Math.max(min, Math.min(max, value));
|
||||
|
||||
@@ -2,7 +2,7 @@ import { resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../../agents/ag
|
||||
import { installSkill } from "../../agents/skills-install.js";
|
||||
import { buildWorkspaceSkillStatus } from "../../agents/skills-status.js";
|
||||
import { loadWorkspaceSkillEntries, type SkillEntry } from "../../agents/skills.js";
|
||||
import type { ClawdbotConfig } from "../../config/config.js";
|
||||
import type { MoltbotConfig } from "../../config/config.js";
|
||||
import { loadConfig, writeConfigFile } from "../../config/config.js";
|
||||
import { getRemoteSkillEligibility } from "../../infra/skills-remote.js";
|
||||
import {
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
} from "../protocol/index.js";
|
||||
import type { GatewayRequestHandlers } from "./types.js";
|
||||
|
||||
function listWorkspaceDirs(cfg: ClawdbotConfig): string[] {
|
||||
function listWorkspaceDirs(cfg: MoltbotConfig): string[] {
|
||||
const dirs = new Set<string>();
|
||||
const list = cfg.agents?.list;
|
||||
if (Array.isArray(list)) {
|
||||
@@ -33,9 +33,9 @@ function listWorkspaceDirs(cfg: ClawdbotConfig): string[] {
|
||||
function collectSkillBins(entries: SkillEntry[]): string[] {
|
||||
const bins = new Set<string>();
|
||||
for (const entry of entries) {
|
||||
const required = entry.clawdbot?.requires?.bins ?? [];
|
||||
const anyBins = entry.clawdbot?.requires?.anyBins ?? [];
|
||||
const install = entry.clawdbot?.install ?? [];
|
||||
const required = entry.metadata?.requires?.bins ?? [];
|
||||
const anyBins = entry.metadata?.requires?.anyBins ?? [];
|
||||
const install = entry.metadata?.install ?? [];
|
||||
for (const bin of required) {
|
||||
const trimmed = bin.trim();
|
||||
if (trimmed) bins.add(trimmed);
|
||||
@@ -172,7 +172,7 @@ export const skillsHandlers: GatewayRequestHandlers = {
|
||||
}
|
||||
entries[p.skillKey] = current;
|
||||
skills.entries = entries;
|
||||
const nextConfig: ClawdbotConfig = {
|
||||
const nextConfig: MoltbotConfig = {
|
||||
...cfg,
|
||||
skills,
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { resolveClawdbotPackageRoot } from "../../infra/clawdbot-root.js";
|
||||
import { resolveMoltbotPackageRoot } from "../../infra/moltbot-root.js";
|
||||
import { scheduleGatewaySigusr1Restart } from "../../infra/restart.js";
|
||||
import {
|
||||
formatDoctorNonInteractiveHint,
|
||||
@@ -49,7 +49,7 @@ export const updateHandlers: GatewayRequestHandlers = {
|
||||
let result: Awaited<ReturnType<typeof runGatewayUpdate>>;
|
||||
try {
|
||||
const root =
|
||||
(await resolveClawdbotPackageRoot({
|
||||
(await resolveMoltbotPackageRoot({
|
||||
moduleUrl: import.meta.url,
|
||||
argv1: process.argv[1],
|
||||
cwd: process.cwd(),
|
||||
|
||||
Reference in New Issue
Block a user