/** * Autoresearch harness contract: the `autoresearch.sh` entrypoint contract plus * parsing of `METRIC =` and `ASI =` lines out of * captured output. * * The contract (ported from the deleted extension's `helpers.ts`): * - the harness is `./autoresearch.sh` at the working directory; * - it exits 0 on success and non-zero on failure; * - it prints the primary metric as `METRIC =` and any secondary * metrics as additional `METRIC` lines; * - it may print `ASI =` lines for opaque structured learnings. * * Parsing tolerates interleaved noise: only well-formed lines are recognized, * malformed lines are ignored (never thrown), and prototype-polluting key * names are dropped. */ import type { ASIData, MetricDirection, NumericMetricMap } from "./types"; export declare const HARNESS_FILENAME = "autoresearch.sh"; export declare const DEFAULT_HARNESS_COMMAND = "bash autoresearch.sh"; export declare const METRIC_LINE_PREFIX = "METRIC"; export declare const ASI_LINE_PREFIX = "ASI"; export declare const EXPERIMENT_MAX_LINES = 10; export declare const EXPERIMENT_MAX_BYTES: number; /** All `METRIC name=value` lines found anywhere in the captured output. */ export declare function parseMetricLines(output: string): Map; /** All `ASI key=value` lines found anywhere in the captured output, or null when none parse. */ export declare function parseAsiLines(output: string): ASIData | null; export interface ParsedHarnessOutput { /** Every parsed metric, keyed by name. */ metrics: NumericMetricMap; /** * The surfaced primary metric: `metrics[primaryMetricName]` when a name is * supplied, otherwise the value of the first `METRIC` line in the output. */ primary: number | null; /** Parsed ASI learnings, or null when no ASI line parsed. */ asi: ASIData | null; } /** * Parse captured harness output into the primary metric, secondary values, and * ASI learnings. Malformed or noisy lines are ignored, never thrown. */ export declare function parseHarnessOutput(output: string, primaryMetricName?: string): ParsedHarnessOutput; export declare function mergeAsi(base: ASIData | null, override: ASIData | undefined): ASIData | undefined; export declare function commas(value: number): string; export declare function fmtNum(value: number, decimals?: number): string; export declare function formatNum(value: number | null, unit: string): string; export declare function formatElapsed(milliseconds: number): string; /** True when `current` beats `best` under the given direction. */ export declare function isBetter(current: number, best: number, direction: MetricDirection): boolean; export declare function inferMetricUnitFromName(name: string): string; export declare function normalizePathSpec(value: string): string; export declare function pathMatchesSpec(pathValue: string, specValue: string): boolean; export declare function dedupeStrings(values: readonly string[]): string[]; export declare function ensureNumericMetricMap(value: NumericMetricMap | undefined): NumericMetricMap; export declare function sanitizeAsi(value: { [key: string]: unknown; } | undefined): ASIData | undefined;