declare module "openclaw/plugin-sdk/plugin-entry" {
  export type ToolExecutionResult = {
    content: Array<{ type: "text"; text: string }>;
    details?: unknown;
  };

  export type OpenClawPluginApi = {
    id: string;
    name: string;
    version?: string;
    description?: string;
    source: string;
    registrationMode: string;
    config: Record<string, unknown>;
    pluginConfig?: Record<string, unknown>;
    runtime: unknown;
    logger: {
      info?: (message: string) => void;
      warn?: (message: string) => void;
      error?: (message: string) => void;
      debug?: (message: string) => void;
    };
    registerTool: (tool: unknown, opts?: unknown) => void;
    registerCommand: (command: OpenClawPluginCommandDefinition) => void;
    registerHook: (...args: unknown[]) => void;
    registerHttpRoute: (...args: unknown[]) => void;
    registerChannel: (...args: unknown[]) => void;
    registerGatewayMethod: (...args: unknown[]) => void;
    registerCli: (...args: unknown[]) => void;
    registerCliBackend: (...args: unknown[]) => void;
    registerService: (...args: unknown[]) => void;
    registerReload: (...args: unknown[]) => void;
    registerNodeHostCommand: (...args: unknown[]) => void;
    registerSecurityAuditCollector: (...args: unknown[]) => void;
    registerConfigMigration: (...args: unknown[]) => void;
    registerAutoEnableProbe: (...args: unknown[]) => void;
    registerProvider: (...args: unknown[]) => void;
    registerSpeechProvider: (...args: unknown[]) => void;
    registerRealtimeTranscriptionProvider: (...args: unknown[]) => void;
    registerRealtimeVoiceProvider: (...args: unknown[]) => void;
    registerMediaUnderstandingProvider: (...args: unknown[]) => void;
    registerImageGenerationProvider: (...args: unknown[]) => void;
    registerMusicGenerationProvider: (...args: unknown[]) => void;
    registerVideoGenerationProvider: (...args: unknown[]) => void;
    registerWebFetchProvider: (...args: unknown[]) => void;
    registerWebSearchProvider: (...args: unknown[]) => void;
    registerInteractiveHandler: (...args: unknown[]) => void;
    onConversationBindingResolved: (...args: unknown[]) => void;
    registerContextEngine: (...args: unknown[]) => void;
    registerCompactionProvider: (...args: unknown[]) => void;
    registerMemoryCapability: (...args: unknown[]) => void;
    registerMemoryPromptSection: (...args: unknown[]) => void;
    registerMemoryPromptSupplement: (...args: unknown[]) => void;
    registerMemoryCorpusSupplement: (...args: unknown[]) => void;
    registerMemoryFlushPlan: (...args: unknown[]) => void;
    registerMemoryRuntime: (...args: unknown[]) => void;
    registerMemoryEmbeddingProvider: (...args: unknown[]) => void;
    resolvePath: (input: string) => string;
    on: (...args: unknown[]) => void;
  };

  export type OpenClawPluginCommandDefinition = {
    name: string;
    description: string;
    acceptsArgs?: boolean;
    nativeNames?: Record<string, string>;
    handler: (ctx: {
      args?: string;
    }) => Promise<{ text: string }> | { text: string };
  };

  export function definePluginEntry<
    T extends {
      id: string;
      name: string;
      description?: string;
      register(api: OpenClawPluginApi): void | Promise<void>;
    },
  >(entry: T): T;
}
