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

@@ -8,17 +8,17 @@ import type {
import { registerInternalHook } from "../hooks/internal-hooks.js";
import { resolveUserPath } from "../utils.js";
import type {
ClawdbotPluginApi,
ClawdbotPluginChannelRegistration,
ClawdbotPluginCliRegistrar,
ClawdbotPluginCommandDefinition,
ClawdbotPluginHttpHandler,
ClawdbotPluginHttpRouteHandler,
ClawdbotPluginHookOptions,
MoltbotPluginApi,
MoltbotPluginChannelRegistration,
MoltbotPluginCliRegistrar,
MoltbotPluginCommandDefinition,
MoltbotPluginHttpHandler,
MoltbotPluginHttpRouteHandler,
MoltbotPluginHookOptions,
ProviderPlugin,
ClawdbotPluginService,
ClawdbotPluginToolContext,
ClawdbotPluginToolFactory,
MoltbotPluginService,
MoltbotPluginToolContext,
MoltbotPluginToolFactory,
PluginConfigUiHint,
PluginDiagnostic,
PluginLogger,
@@ -36,7 +36,7 @@ import { normalizePluginHttpPath } from "./http-path.js";
export type PluginToolRegistration = {
pluginId: string;
factory: ClawdbotPluginToolFactory;
factory: MoltbotPluginToolFactory;
names: string[];
optional: boolean;
source: string;
@@ -44,21 +44,21 @@ export type PluginToolRegistration = {
export type PluginCliRegistration = {
pluginId: string;
register: ClawdbotPluginCliRegistrar;
register: MoltbotPluginCliRegistrar;
commands: string[];
source: string;
};
export type PluginHttpRegistration = {
pluginId: string;
handler: ClawdbotPluginHttpHandler;
handler: MoltbotPluginHttpHandler;
source: string;
};
export type PluginHttpRouteRegistration = {
pluginId?: string;
path: string;
handler: ClawdbotPluginHttpRouteHandler;
handler: MoltbotPluginHttpRouteHandler;
source?: string;
};
@@ -84,13 +84,13 @@ export type PluginHookRegistration = {
export type PluginServiceRegistration = {
pluginId: string;
service: ClawdbotPluginService;
service: MoltbotPluginService;
source: string;
};
export type PluginCommandRegistration = {
pluginId: string;
command: ClawdbotPluginCommandDefinition;
command: MoltbotPluginCommandDefinition;
source: string;
};
@@ -167,13 +167,13 @@ export function createPluginRegistry(registryParams: PluginRegistryParams) {
const registerTool = (
record: PluginRecord,
tool: AnyAgentTool | ClawdbotPluginToolFactory,
tool: AnyAgentTool | MoltbotPluginToolFactory,
opts?: { name?: string; names?: string[]; optional?: boolean },
) => {
const names = opts?.names ?? (opts?.name ? [opts.name] : []);
const optional = opts?.optional === true;
const factory: ClawdbotPluginToolFactory =
typeof tool === "function" ? tool : (_ctx: ClawdbotPluginToolContext) => tool;
const factory: MoltbotPluginToolFactory =
typeof tool === "function" ? tool : (_ctx: MoltbotPluginToolContext) => tool;
if (typeof tool !== "function") {
names.push(tool.name);
@@ -196,8 +196,8 @@ export function createPluginRegistry(registryParams: PluginRegistryParams) {
record: PluginRecord,
events: string | string[],
handler: Parameters<typeof registerInternalHook>[1],
opts: ClawdbotPluginHookOptions | undefined,
config: ClawdbotPluginApi["config"],
opts: MoltbotPluginHookOptions | undefined,
config: MoltbotPluginApi["config"],
) => {
const eventList = Array.isArray(events) ? events : [events];
const normalizedEvents = eventList.map((event) => event.trim()).filter(Boolean);
@@ -221,11 +221,11 @@ export function createPluginRegistry(registryParams: PluginRegistryParams) {
...entry.hook,
name,
description,
source: "clawdbot-plugin",
source: "moltbot-plugin",
pluginId: record.id,
},
clawdbot: {
...entry.clawdbot,
metadata: {
...entry.metadata,
events: normalizedEvents,
},
}
@@ -233,14 +233,14 @@ export function createPluginRegistry(registryParams: PluginRegistryParams) {
hook: {
name,
description,
source: "clawdbot-plugin",
source: "moltbot-plugin",
pluginId: record.id,
filePath: record.source,
baseDir: path.dirname(record.source),
handlerPath: record.source,
},
frontmatter: {},
clawdbot: { events: normalizedEvents },
metadata: { events: normalizedEvents },
invocation: { enabled: true },
};
@@ -282,7 +282,7 @@ export function createPluginRegistry(registryParams: PluginRegistryParams) {
record.gatewayMethods.push(trimmed);
};
const registerHttpHandler = (record: PluginRecord, handler: ClawdbotPluginHttpHandler) => {
const registerHttpHandler = (record: PluginRecord, handler: MoltbotPluginHttpHandler) => {
record.httpHandlers += 1;
registry.httpHandlers.push({
pluginId: record.id,
@@ -293,7 +293,7 @@ export function createPluginRegistry(registryParams: PluginRegistryParams) {
const registerHttpRoute = (
record: PluginRecord,
params: { path: string; handler: ClawdbotPluginHttpRouteHandler },
params: { path: string; handler: MoltbotPluginHttpRouteHandler },
) => {
const normalizedPath = normalizePluginHttpPath(params.path);
if (!normalizedPath) {
@@ -325,11 +325,11 @@ export function createPluginRegistry(registryParams: PluginRegistryParams) {
const registerChannel = (
record: PluginRecord,
registration: ClawdbotPluginChannelRegistration | ChannelPlugin,
registration: MoltbotPluginChannelRegistration | ChannelPlugin,
) => {
const normalized =
typeof (registration as ClawdbotPluginChannelRegistration).plugin === "object"
? (registration as ClawdbotPluginChannelRegistration)
typeof (registration as MoltbotPluginChannelRegistration).plugin === "object"
? (registration as MoltbotPluginChannelRegistration)
: { plugin: registration as ChannelPlugin };
const plugin = normalized.plugin;
const id = typeof plugin?.id === "string" ? plugin.id.trim() : String(plugin?.id ?? "").trim();
@@ -382,7 +382,7 @@ export function createPluginRegistry(registryParams: PluginRegistryParams) {
const registerCli = (
record: PluginRecord,
registrar: ClawdbotPluginCliRegistrar,
registrar: MoltbotPluginCliRegistrar,
opts?: { commands?: string[] },
) => {
const commands = (opts?.commands ?? []).map((cmd) => cmd.trim()).filter(Boolean);
@@ -395,7 +395,7 @@ export function createPluginRegistry(registryParams: PluginRegistryParams) {
});
};
const registerService = (record: PluginRecord, service: ClawdbotPluginService) => {
const registerService = (record: PluginRecord, service: MoltbotPluginService) => {
const id = service.id.trim();
if (!id) return;
record.services.push(id);
@@ -406,7 +406,7 @@ export function createPluginRegistry(registryParams: PluginRegistryParams) {
});
};
const registerCommand = (record: PluginRecord, command: ClawdbotPluginCommandDefinition) => {
const registerCommand = (record: PluginRecord, command: MoltbotPluginCommandDefinition) => {
const name = command.name.trim();
if (!name) {
pushDiagnostic({
@@ -464,10 +464,10 @@ export function createPluginRegistry(registryParams: PluginRegistryParams) {
const createApi = (
record: PluginRecord,
params: {
config: ClawdbotPluginApi["config"];
config: MoltbotPluginApi["config"];
pluginConfig?: Record<string, unknown>;
},
): ClawdbotPluginApi => {
): MoltbotPluginApi => {
return {
id: record.id,
name: record.name,