/** * In-process access to @metaharness/darwin (ADR-526). * * darwin is a regular dependency of the CLI, so the long-lived MCP server can * import it once and answer `metaharness_bench --op verify` and every * `metaharness_gepa` op without spawning `node bench.mjs` → `node darwin/cli.js` * per call. Each function returns the same {exitCode, json} pair the plugin * script would have produced, so callers keep the existing * {success, data, degraded, exitCode} contract. * * Graceful degradation (ADR-150 rule 3) still holds: if the import fails, every * function returns null and the caller falls back to the subprocess path. */ import { readFileSync } from 'node:fs'; export interface DarwinResult { exitCode: number; /** Parsed payload, or null where the script would have printed only to stderr. */ json: unknown; } type DarwinRoot = { bench: { loadSuite(path: string): Promise<{ id: string; version: string; tasks: unknown[]; }>; verifySuite(suite: unknown): { ok: boolean; actual: string; }; }; }; type DarwinGepa = { loadGenome(read: typeof readFileSync, path: string): unknown; loadCand6Genome(): unknown; validateGenome(genome: unknown): unknown[]; buildSystemFromGenome(genome: unknown, ext?: string, glob?: string): string; analyzeTranscript(entries: unknown[]): unknown; CAND6_GENOME_PATH: string; }; export declare function loadDarwin(): Promise; export declare function loadDarwinGepa(): Promise; /** Test hook: forget the cached modules. */ export declare function resetDarwinCache(): void; /** * `bench verify ` in-process. Mirrors plugins/ruflo-metaharness/scripts/bench.mjs: * exit 2 + no payload for a missing path, exit 1 when the suite fails to load * (darwin's loadSuite throws on tamper) or its hash does not match, exit 0 otherwise. * Returns null when darwin cannot be imported. */ export declare function benchVerify(suitePath: string): Promise; export interface GepaInput { op: string; path?: string; transcript?: string; ext?: string; glob?: string; alertOnInvalid?: boolean; } /** * GEPA genome ops in-process. Mirrors plugins/ruflo-metaharness/scripts/gepa.mjs, * including its exit codes: 2 for input errors (no payload), 1 for an invalid * genome with alertOnInvalid, 0 otherwise. Returns null when darwin/gepa cannot * be imported. */ export declare function gepaOp(input: GepaInput): Promise; export {}; //# sourceMappingURL=darwin-lib.d.ts.map