import type { PlanReporter } from "./plan-reporter.js"; import type { ReporterRegistry } from "./registry.js"; /** A plugin-contributed reporter paired with the stable identity derived at * load time. The CLI passes {@link name} to `CompositeEvalReporter.add()` so * a throwing plain-object reporter is attributable in error logs (its * `constructor.name` is the useless `"Object"`). */ export interface LoadedReporter { reporter: PlanReporter; /** Stable label: a reporter-provided `name` if present, else the plugin * specifier (suffixed with `#` when one plugin registers several * reporters, e.g. `"./slack.mjs#0"`). */ name: string; } /** * Dynamically import a reporter plugin package and register it. * * The package must export a `registerReporters(registry)` function that * calls `registry.register()` with one or more {@link PlanReporter} * instances. Reporters are additive — multiple plugins (and multiple * reporters per plugin) may be loaded, and there is no name-conflict * check (a reporter has no unique name). * * Each registered reporter is validated at load: it MUST be a non-null object * implementing the required {@link PlanReporter} methods (`onTrialResult`, * `onRunComplete`). Validation happens at the registration boundary — the * staging registry's `register()` (see {@link assertValidReporter}) — so a * malformed reporter (missing a method, or `null`/`undefined`/a primitive) * fails the load atomically with a clear error naming the specifier. This is * intentional and distinct from a runtime throw during the run (which stays * isolated and never fails the run). * * Loaded reporters are layered onto the run's {@link CompositeEvalReporter} * via `composite.add()`, so they inherit its per-reporter error isolation: * a reporter that throws or rejects logs to stderr and is skipped for that * event — it NEVER fails the run or stalls sibling reporters. * * @param specifier - npm package name or local file path * @param registry - the ReporterRegistry to register into * @param options - optional settings * @param options.cwd - directory to resolve specifiers from (defaults to `process.cwd()`) * @returns the reporters registered by THIS plugin, each paired with a stable * identity for error attribution (see {@link LoadedReporter}). * @throws if the import fails, the module lacks a registerReporters export, or * a registered reporter is missing a required method */ export declare function loadReporterPlugin(specifier: string, registry: ReporterRegistry, options?: { cwd?: string; }): Promise; //# sourceMappingURL=discovery.d.ts.map