mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-26 21:08:37 +00:00
refactor: rename clawdbot to moltbot with legacy compat
This commit is contained in:
@@ -7,7 +7,7 @@ import type { AuthProfileCredential, OAuthCredential } from "../agents/auth-prof
|
||||
import type { AnyAgentTool } from "../agents/tools/common.js";
|
||||
import type { ChannelDock } from "../channels/dock.js";
|
||||
import type { ChannelPlugin } from "../channels/plugins/types.js";
|
||||
import type { ClawdbotConfig } from "../config/config.js";
|
||||
import type { MoltbotConfig } from "../config/config.js";
|
||||
import type { InternalHookHandler } from "../hooks/internal-hooks.js";
|
||||
import type { HookEntry } from "../hooks/types.js";
|
||||
import type { ModelProviderConfig } from "../config/types.js";
|
||||
@@ -41,7 +41,7 @@ export type PluginConfigValidation =
|
||||
| { ok: true; value?: unknown }
|
||||
| { ok: false; errors: string[] };
|
||||
|
||||
export type ClawdbotPluginConfigSchema = {
|
||||
export type MoltbotPluginConfigSchema = {
|
||||
safeParse?: (value: unknown) => {
|
||||
success: boolean;
|
||||
data?: unknown;
|
||||
@@ -55,8 +55,8 @@ export type ClawdbotPluginConfigSchema = {
|
||||
jsonSchema?: Record<string, unknown>;
|
||||
};
|
||||
|
||||
export type ClawdbotPluginToolContext = {
|
||||
config?: ClawdbotConfig;
|
||||
export type MoltbotPluginToolContext = {
|
||||
config?: MoltbotConfig;
|
||||
workspaceDir?: string;
|
||||
agentDir?: string;
|
||||
agentId?: string;
|
||||
@@ -66,17 +66,17 @@ export type ClawdbotPluginToolContext = {
|
||||
sandboxed?: boolean;
|
||||
};
|
||||
|
||||
export type ClawdbotPluginToolFactory = (
|
||||
ctx: ClawdbotPluginToolContext,
|
||||
export type MoltbotPluginToolFactory = (
|
||||
ctx: MoltbotPluginToolContext,
|
||||
) => AnyAgentTool | AnyAgentTool[] | null | undefined;
|
||||
|
||||
export type ClawdbotPluginToolOptions = {
|
||||
export type MoltbotPluginToolOptions = {
|
||||
name?: string;
|
||||
names?: string[];
|
||||
optional?: boolean;
|
||||
};
|
||||
|
||||
export type ClawdbotPluginHookOptions = {
|
||||
export type MoltbotPluginHookOptions = {
|
||||
entry?: HookEntry;
|
||||
name?: string;
|
||||
description?: string;
|
||||
@@ -87,13 +87,13 @@ export type ProviderAuthKind = "oauth" | "api_key" | "token" | "device_code" | "
|
||||
|
||||
export type ProviderAuthResult = {
|
||||
profiles: Array<{ profileId: string; credential: AuthProfileCredential }>;
|
||||
configPatch?: Partial<ClawdbotConfig>;
|
||||
configPatch?: Partial<MoltbotConfig>;
|
||||
defaultModel?: string;
|
||||
notes?: string[];
|
||||
};
|
||||
|
||||
export type ProviderAuthContext = {
|
||||
config: ClawdbotConfig;
|
||||
config: MoltbotConfig;
|
||||
agentDir?: string;
|
||||
workspaceDir?: string;
|
||||
prompter: WizardPrompter;
|
||||
@@ -125,7 +125,7 @@ export type ProviderPlugin = {
|
||||
refreshOAuth?: (cred: OAuthCredential) => Promise<OAuthCredential>;
|
||||
};
|
||||
|
||||
export type ClawdbotPluginGatewayMethod = {
|
||||
export type MoltbotPluginGatewayMethod = {
|
||||
method: string;
|
||||
handler: GatewayRequestHandler;
|
||||
};
|
||||
@@ -148,8 +148,8 @@ export type PluginCommandContext = {
|
||||
args?: string;
|
||||
/** The full normalized command body */
|
||||
commandBody: string;
|
||||
/** Current clawdbot configuration */
|
||||
config: ClawdbotConfig;
|
||||
/** Current moltbot configuration */
|
||||
config: MoltbotConfig;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -167,7 +167,7 @@ export type PluginCommandHandler = (
|
||||
/**
|
||||
* Definition for a plugin-registered command.
|
||||
*/
|
||||
export type ClawdbotPluginCommandDefinition = {
|
||||
export type MoltbotPluginCommandDefinition = {
|
||||
/** Command name without leading slash (e.g., "tts") */
|
||||
name: string;
|
||||
/** Description shown in /help and command menus */
|
||||
@@ -180,90 +180,90 @@ export type ClawdbotPluginCommandDefinition = {
|
||||
handler: PluginCommandHandler;
|
||||
};
|
||||
|
||||
export type ClawdbotPluginHttpHandler = (
|
||||
export type MoltbotPluginHttpHandler = (
|
||||
req: IncomingMessage,
|
||||
res: ServerResponse,
|
||||
) => Promise<boolean> | boolean;
|
||||
|
||||
export type ClawdbotPluginHttpRouteHandler = (
|
||||
export type MoltbotPluginHttpRouteHandler = (
|
||||
req: IncomingMessage,
|
||||
res: ServerResponse,
|
||||
) => Promise<void> | void;
|
||||
|
||||
export type ClawdbotPluginCliContext = {
|
||||
export type MoltbotPluginCliContext = {
|
||||
program: Command;
|
||||
config: ClawdbotConfig;
|
||||
config: MoltbotConfig;
|
||||
workspaceDir?: string;
|
||||
logger: PluginLogger;
|
||||
};
|
||||
|
||||
export type ClawdbotPluginCliRegistrar = (ctx: ClawdbotPluginCliContext) => void | Promise<void>;
|
||||
export type MoltbotPluginCliRegistrar = (ctx: MoltbotPluginCliContext) => void | Promise<void>;
|
||||
|
||||
export type ClawdbotPluginServiceContext = {
|
||||
config: ClawdbotConfig;
|
||||
export type MoltbotPluginServiceContext = {
|
||||
config: MoltbotConfig;
|
||||
workspaceDir?: string;
|
||||
stateDir: string;
|
||||
logger: PluginLogger;
|
||||
};
|
||||
|
||||
export type ClawdbotPluginService = {
|
||||
export type MoltbotPluginService = {
|
||||
id: string;
|
||||
start: (ctx: ClawdbotPluginServiceContext) => void | Promise<void>;
|
||||
stop?: (ctx: ClawdbotPluginServiceContext) => void | Promise<void>;
|
||||
start: (ctx: MoltbotPluginServiceContext) => void | Promise<void>;
|
||||
stop?: (ctx: MoltbotPluginServiceContext) => void | Promise<void>;
|
||||
};
|
||||
|
||||
export type ClawdbotPluginChannelRegistration = {
|
||||
export type MoltbotPluginChannelRegistration = {
|
||||
plugin: ChannelPlugin;
|
||||
dock?: ChannelDock;
|
||||
};
|
||||
|
||||
export type ClawdbotPluginDefinition = {
|
||||
export type MoltbotPluginDefinition = {
|
||||
id?: string;
|
||||
name?: string;
|
||||
description?: string;
|
||||
version?: string;
|
||||
kind?: PluginKind;
|
||||
configSchema?: ClawdbotPluginConfigSchema;
|
||||
register?: (api: ClawdbotPluginApi) => void | Promise<void>;
|
||||
activate?: (api: ClawdbotPluginApi) => void | Promise<void>;
|
||||
configSchema?: MoltbotPluginConfigSchema;
|
||||
register?: (api: MoltbotPluginApi) => void | Promise<void>;
|
||||
activate?: (api: MoltbotPluginApi) => void | Promise<void>;
|
||||
};
|
||||
|
||||
export type ClawdbotPluginModule =
|
||||
| ClawdbotPluginDefinition
|
||||
| ((api: ClawdbotPluginApi) => void | Promise<void>);
|
||||
export type MoltbotPluginModule =
|
||||
| MoltbotPluginDefinition
|
||||
| ((api: MoltbotPluginApi) => void | Promise<void>);
|
||||
|
||||
export type ClawdbotPluginApi = {
|
||||
export type MoltbotPluginApi = {
|
||||
id: string;
|
||||
name: string;
|
||||
version?: string;
|
||||
description?: string;
|
||||
source: string;
|
||||
config: ClawdbotConfig;
|
||||
config: MoltbotConfig;
|
||||
pluginConfig?: Record<string, unknown>;
|
||||
runtime: PluginRuntime;
|
||||
logger: PluginLogger;
|
||||
registerTool: (
|
||||
tool: AnyAgentTool | ClawdbotPluginToolFactory,
|
||||
opts?: ClawdbotPluginToolOptions,
|
||||
tool: AnyAgentTool | MoltbotPluginToolFactory,
|
||||
opts?: MoltbotPluginToolOptions,
|
||||
) => void;
|
||||
registerHook: (
|
||||
events: string | string[],
|
||||
handler: InternalHookHandler,
|
||||
opts?: ClawdbotPluginHookOptions,
|
||||
opts?: MoltbotPluginHookOptions,
|
||||
) => void;
|
||||
registerHttpHandler: (handler: ClawdbotPluginHttpHandler) => void;
|
||||
registerHttpRoute: (params: { path: string; handler: ClawdbotPluginHttpRouteHandler }) => void;
|
||||
registerChannel: (registration: ClawdbotPluginChannelRegistration | ChannelPlugin) => void;
|
||||
registerHttpHandler: (handler: MoltbotPluginHttpHandler) => void;
|
||||
registerHttpRoute: (params: { path: string; handler: MoltbotPluginHttpRouteHandler }) => void;
|
||||
registerChannel: (registration: MoltbotPluginChannelRegistration | ChannelPlugin) => void;
|
||||
registerGatewayMethod: (method: string, handler: GatewayRequestHandler) => void;
|
||||
registerCli: (registrar: ClawdbotPluginCliRegistrar, opts?: { commands?: string[] }) => void;
|
||||
registerService: (service: ClawdbotPluginService) => void;
|
||||
registerCli: (registrar: MoltbotPluginCliRegistrar, opts?: { commands?: string[] }) => void;
|
||||
registerService: (service: MoltbotPluginService) => void;
|
||||
registerProvider: (provider: ProviderPlugin) => void;
|
||||
/**
|
||||
* Register a custom command that bypasses the LLM agent.
|
||||
* Plugin commands are processed before built-in commands and before agent invocation.
|
||||
* Use this for simple state-toggling or status commands that don't need AI reasoning.
|
||||
*/
|
||||
registerCommand: (command: ClawdbotPluginCommandDefinition) => void;
|
||||
registerCommand: (command: MoltbotPluginCommandDefinition) => void;
|
||||
resolvePath: (input: string) => string;
|
||||
/** Register a lifecycle hook handler */
|
||||
on: <K extends PluginHookName>(
|
||||
|
||||
Reference in New Issue
Block a user