/** * OpenClaw Extension Discovery — scans the openclaw submodule's extensions/ * directory for channel plugins and provider connectors. * * Extensions in OpenClaw are full plugin packages that provide channels * (Telegram, Discord, Slack, etc.) and providers (Copilot proxy, etc.). * This module discovers them and returns their metadata without loading them. * * @module */ import type { Connector } from "../types.js"; /** Metadata about a discovered openclaw extension. */ export interface ExtensionInfo { /** Plugin ID from the manifest. */ id: string; /** Human-readable name. */ name: string; /** Description from the manifest. */ description?: string; /** Channel IDs provided by this extension. */ channels: string[]; /** Provider IDs provided by this extension. */ providers: string[]; /** Absolute path to the extension directory. */ path: string; /** Absolute path to the entry point file. */ entryPoint?: string; } /** * Discover all extensions in the openclaw submodule. * * Scans `openclaw/extensions/` for directories with `openclaw.plugin.json` * manifests and returns their metadata. * * @param extensionsDir - Override the extensions directory path. * @returns Array of discovered extension metadata. */ export declare function discoverExtensions(extensionsDir?: string): ExtensionInfo[]; /** * Get the path to a specific extension by its plugin ID. * * @param extensionId - The plugin ID to look for. * @param extensionsDir - Override the extensions directory path. * @returns The absolute path to the extension directory, or undefined. */ export declare function getExtensionPath(extensionId: string, extensionsDir?: string): string | undefined; /** * List all available channel extension IDs. */ export declare function listChannelExtensions(extensionsDir?: string): string[]; /** * List all available provider extension IDs. */ export declare function listProviderExtensions(extensionsDir?: string): string[]; /** * Discover and return all built-in LLM connectors. * * Built-in connectors are backed by `@mariozechner/pi-ai` provider * implementations, bundled at build time into `dist/core-connectors/builtins.js`. * One connector is returned per pi-ai provider (anthropic, openai, google, …). * * ## Loading strategy * * 1. **Bundled** (preferred): Loads `dist/core-connectors/builtins.js` — a * self-contained ESM bundle compiled from `src/connectors/pi-ai-bridge.ts`. * Works in any Node 18+ environment; requires `npm run build` to have run. * 2. **Source fallback** (development / vitest): If the bundle is absent, falls * back to importing `src/connectors/pi-ai-bridge.ts` directly. Requires a * TypeScript-capable runtime (vitest, tsx, ts-node). * * ## Caching * * The result is memoised after the first successful call. Calling this * function multiple times is safe and cheap — subsequent calls return the * same array instance without repeating the dynamic import or filesystem * check. The cache is module-level, so it persists for the lifetime of the * process. * * @returns Array of fully executable `Connector` objects, or an empty array if * the connector bundle is not available. */ export declare function discoverBuiltinConnectors(): Promise; /** * @deprecated Use {@link discoverBuiltinConnectors} instead. * Renamed to drop the `Async` suffix per the async-by-default naming convention. */ export declare function discoverBuiltinConnectorsAsync(): Promise; //# sourceMappingURL=discovery.d.ts.map