import type { Logger } from '../types/logger.js'; import type { Plugin, PluginAPI } from '../types/plugin.js'; export interface PluginLoadFailure { plugin: Plugin; err: unknown; } export interface PluginHostHandle { loaded: Plugin[]; failed: PluginLoadFailure[]; readonly disposed: boolean; /** Dispose successfully loaded plugins in reverse dependency order. */ dispose(): Promise; } /** * Stable plugin API contract version. This is intentionally independent of * the package version: bump only when the surface visible to plugins * (PluginAPI, types/plugin) changes in a way that breaks existing setup * functions. Plugins declare `apiVersion: "^1.0"` to opt into this contract. * * 0.1.9: additive — `FleetSpawnBudgetError|FleetCostCapError` plus `FLEET_ROSTER` and the * pre-built fleet agent configs (Audit Log, Bug Hunter, Refactor Planner, * Security Scanner) now exported from `@wrongstack/core`. * 0.1.10: additive — extended-thinking stream events, core subpath * exports, tool output size chips on `tool.executed`. Plugin contract * unchanged otherwise; 0.1.x range still loads cleanly. * * Note: the package shipped as 0.2.0, but the *plugin contract* didn't * change in a breaking way — `SubagentError`, `subagent.tool_executed`, * `transcriptPath`, `planTool`, `delegate`, `runText`, and Director * sessionWriter are all additive to the surface. We deliberately keep * the kernel API at 0.1.10 so plugins pinning `apiVersion: "^0.1"` * keep loading. Bump to 1.0 when we stabilize and want the freedom to * remove deprecated surfaces. */ export declare const KERNEL_API_VERSION = "0.1.10"; export interface LoadPluginsOptions { apiFactory: (plugin: Plugin, resolvedOptions: Readonly>) => PluginAPI; log: Logger; kernelApiVersion?: string | undefined; /** * Per-plugin options keyed by plugin name. When a plugin declares * `configSchema`, the loader validates `pluginOptions[plugin.name]` * against it before calling `setup`. Pass `Config.plugins` shaped * `{ [name]: { options } }` or any flat record. */ pluginOptions?: Record>; /** * When true, the loader throws a PluginError if a plugin calls an API * method that contradicts its declared `capabilities` — instead of * just logging a warning. Use in CI/strict deployments to enforce * manifest honesty. Default: false (log-only, backward-compatible). */ enforceCapabilities?: boolean | undefined; /** * Timeout in milliseconds for each plugin's `setup()` call. If the * plugin's setup exceeds this deadline it is treated as a failure * and the plugin is not loaded. Default: 30 000 ms. */ setupTimeoutMs?: number | undefined; /** * Timeout in milliseconds for each plugin's `teardown()` call. If the * plugin's teardown exceeds this deadline it is treated as a best-effort * failure (logged but not propagated). Default: 10 000 ms. */ teardownTimeoutMs?: number | undefined; } export declare function loadPlugins(plugins: Plugin[], opts: LoadPluginsOptions): Promise; /** * Tear down loaded plugins in reverse-dependency order. `teardown()` is * best-effort: errors are caught and logged so a single misbehaving plugin * can't abort the host shutdown sequence. * * @deprecated Prefer `loadPlugins(...).dispose()`. The handle has exact host * ownership and remains unambiguous when the same Plugin object is loaded by * more than one host. This legacy path shares a process-wide registry, so * when multiple hosts load the same Plugin object, `unloadPlugins` may * dispose another host's registration. Use the handle's `dispose()` instead. */ export declare function unloadPlugins(loadedPlugins: Plugin[], opts: LoadPluginsOptions): Promise; //# sourceMappingURL=loader.d.ts.map