import { AgentRuntime, type Character, type LogEntry, type Plugin } from "@elizaos/core"; import { type MiladyConfig } from "../config/config"; import type { PluginInstallRecord } from "../config/types.milady"; import { CORE_PLUGINS, OPTIONAL_CORE_PLUGINS } from "./core-plugins"; /** Shape we expect from a dynamically-imported plugin package. */ interface PluginModuleShape { default?: Plugin; plugin?: Plugin; [key: string]: Plugin | undefined; } export declare function configureLocalEmbeddingPlugin(_plugin: Plugin, config?: MiladyConfig): void; /** * Best-effort runtime shutdown that also closes the database adapter. * * AgentRuntime.stop() only stops services. plugin-sql keeps a process-global * PGlite manager, so restarts must close the adapter or the next runtime can * silently reuse the same broken manager instance. */ export declare function shutdownRuntime(runtime: AgentRuntime | null | undefined, context: string): Promise; /** * Remove duplicate actions across an ordered list of plugins. * * When multiple plugins define an action with the same `name`, only the first * occurrence is kept. This prevents "Action already registered" warnings from * elizaOS core. The function mutates each plugin's `actions` array in-place. */ export declare function deduplicatePluginActions(plugins: Plugin[]): void; export { CORE_PLUGINS, OPTIONAL_CORE_PLUGINS }; /** Maps Milady channel names to plugin package names. */ export declare const CHANNEL_PLUGIN_MAP: Readonly>; export declare function findRuntimePluginExport(mod: PluginModuleShape): Plugin | null; /** * Collect the set of plugin package names that should be loaded * based on config, environment variables, and feature flags. */ /** @internal Exported for testing. */ export declare function collectPluginNames(config: MiladyConfig): Set; /** Subdirectory under the Milady state dir for drop-in custom plugins. */ export declare const CUSTOM_PLUGINS_DIRNAME = "plugins/custom"; /** Subdirectory under the Milady state dir for ejected plugins. */ export declare const EJECTED_PLUGINS_DIRNAME = "plugins/ejected"; /** * Scan a directory for drop-in plugin packages. Each immediate subdirectory * is treated as a plugin; name comes from package.json or the directory name. */ export declare function scanDropInPlugins(dir: string): Promise>; /** * Merge drop-in plugins into the load set. Filters out denied, core-colliding, * and already-installed names. Mutates `pluginsToLoad` and `installRecords`. */ export declare function mergeDropInPlugins(params: { dropInRecords: Record; installRecords: Record; corePluginNames: ReadonlySet; denyList: ReadonlySet; pluginsToLoad: Set; }): { accepted: string[]; skipped: string[]; }; export declare function resolveMiladyPluginImportSpecifier(pluginName: string, runtimeModuleUrl?: string): string; export declare function shouldIgnoreMissingPluginExport(pluginName: string): boolean; /** * The `@elizaos/plugin-browser` npm package expects a `dist/server/` directory * containing the compiled stagehand-server, but the npm publish doesn't include * it. The actual source/build lives in the workspace at * `plugins/plugin-browser/stagehand-server/`. * * This function checks whether the server is reachable from the installed * package and, if not, creates a symlink so the plugin's process-manager can * find it. Returns `true` when the server index.js is available (or was made * available via symlink), `false` otherwise. */ /** * Returns true if the given env var key is safe to forward to runtime.settings. * Blocks blockchain private keys, secrets, passwords, tokens, credentials, * mnemonics, and seed phrases while allowing API keys that plugins need. */ export declare function isEnvKeyAllowedForForwarding(key: string): boolean; export declare function ensureBrowserServerLink(): boolean; /** @internal Exported for testing. */ export declare function repairBrokenInstallRecord(config: MiladyConfig, pluginName: string): boolean; /** Read package.json exports/main to find the importable entry file. */ /** @internal Exported for testing. */ export declare function resolvePackageEntry(pkgRoot: string): Promise; /** * Propagate channel credentials from Milady config into process.env so * that elizaOS plugins can find them. */ /** @internal Exported for testing. */ export declare function applyConnectorSecretsToEnv(config: MiladyConfig): void; /** * Auto-resolve Discord Application ID from the bot token via Discord API. * Called during async runtime init so that users only need a bot token. */ /** @internal Exported for testing. */ export declare function autoResolveDiscordAppId(): Promise; /** * Propagate cloud config from Milady config into process.env so the * ElizaCloud plugin can discover settings at startup. */ /** @internal Exported for testing. */ export declare function applyCloudConfigToEnv(config: MiladyConfig): void; /** * Translate `config.database` into the environment variables that * `@elizaos/plugin-sql` reads at init time (`POSTGRES_URL`, `PGLITE_DATA_DIR`). * * When the provider is "postgres", we build a connection string from the * credentials (or use the explicit `connectionString` field) and set * `POSTGRES_URL`. When the provider is "pglite" (the default), we set * `PGLITE_DATA_DIR` to either the configured value or a stable workspace * default (`~/.milady/workspace/.eliza/.elizadb`) and remove any stale * `POSTGRES_URL`. */ /** @internal Exported for testing. */ export declare function applyX402ConfigToEnv(config: MiladyConfig): void; /** @internal Exported for testing. */ export declare function applyDatabaseConfigToEnv(config: MiladyConfig): void; type PgliteRecoveryAction = "none" | "retry-without-reset" | "reset-data-dir" | "fail-active-lock"; /** * Check for and remove a stale postmaster.pid in the PGlite data directory. * The pid file is stale if the recorded process is no longer running. */ export declare function cleanStalePglitePid(dataDir: string): void; /** @internal Exported for testing. */ export declare function isRecoverablePgliteInitError(err: unknown): boolean; /** @internal Exported for testing. */ export declare function getPgliteRecoveryAction(err: unknown, dataDir: string): PgliteRecoveryAction; export declare function installRuntimeMethodBindings(runtime: AgentRuntime): void; /** * Build an elizaOS Character from the Milady config. * * Resolves the agent name from `config.agents.list` (first entry) or * `config.ui.assistant.name`, falling back to "Milady". Character * personality data (bio, system prompt, style, etc.) is stored in the * database — not the config file — so we only provide sensible defaults * here for the initial bootstrap. */ /** @internal Exported for testing. */ export declare function buildCharacterFromConfig(config: MiladyConfig): Character; /** * Resolve the primary model identifier from Milady config. * * Milady stores the model under `agents.defaults.model.primary` as an * AgentModelListConfig object. Returns undefined when no model is * explicitly configured (elizaOS falls back to whichever model * plugin is loaded). */ /** @internal Exported for testing. */ export declare function resolvePrimaryModel(config: MiladyConfig): string | undefined; /** * Vision is a heavy optional plugin. When Milady enables it, keep the service * loaded but idle until the user explicitly selects CAMERA, SCREEN, or BOTH. * This avoids background capture loops during normal app startup. */ export declare function resolveVisionModeSetting(config: MiladyConfig, env?: NodeJS.ProcessEnv): string | undefined; /** Options accepted by {@link startEliza}. */ export interface StartElizaOptions { /** * When true, skip the interactive CLI chat loop and return the * initialised {@link AgentRuntime} so it can be wired into the API * server (used by `dev-server.ts`). */ headless?: boolean; /** * When true, start the API server and keep running without entering * the interactive chat loop. Used by `bun run start` for production * server mode (like dev but without watch). */ serverOnly?: boolean; /** * Internal guard to prevent infinite retry loops when recovering from * corrupt PGLite state. */ pgliteRecoveryAttempted?: boolean; } export interface BootElizaRuntimeOptions { /** * When true, require an existing ~/.milady/milady.json config file. * This is used by non-CLI UIs (like the @elizaos/tui interface) where interactive * onboarding prompts would break the alternate screen. */ requireConfig?: boolean; } /** * Boot the elizaOS runtime without starting the readline chat loop. * * This is a convenience wrapper around {@link startEliza} in headless mode, * with optional config guards. */ export declare function bootElizaRuntime(opts?: BootElizaRuntimeOptions): Promise; export declare const logToChatListener: (entry: LogEntry) => void; /** * Start the elizaOS runtime with Milady's configuration. * * In headless mode the runtime is returned instead of entering the * interactive readline loop. */ export declare function startEliza(opts?: StartElizaOptions): Promise; /** * Start in cloud mode — connect to a remote cloud agent via the thin client. * Skips all local runtime construction (plugins, database, etc.). */ export declare function startInCloudMode(config: MiladyConfig, agentId: string, opts?: StartElizaOptions): Promise; //# sourceMappingURL=eliza.d.ts.map