/** * FU-5-shaped telemetry: every fusion run is a controlled A/B on identical * input. Records are local-first (ren A1: standalone mode writes the same * file). When a Cortex project is attached (managed mode), each record is * also exported as a Cortex artifact — the queryable, embeddable store. * * Two boundaries are redacted before anything leaves the process: the task * text and each role's output pass through redactSecrets (../secrets.js) on * BOTH the local append and the Cortex export. The in-memory FuseResult is * never redacted — the operator sees their own run verbatim; the persistent * stores get the sanitised copy. * * The log is bounded: when an append pushes the file past 2000 lines it is * compacted to the most recent 1000 records. Rotation is best-effort like * the append itself — a failed compaction never fails the run. */ import type { CortexClient } from "../cortex/client.js"; import type { FusionRunRecord } from "./types.js"; /** Default fusion telemetry log: `.openkai/fusion/runs.jsonl` under cwd. */ export declare function defaultFusionLogPath(cwd?: string): string; /** Append one run record. Creates the directory lazily; never throws on I/O * failure — telemetry must not fail the run that produced it. */ export declare function recordFusionRun(record: FusionRunRecord, logPath?: string): Promise; /** * Read every record (for the report command). One corrupt line is skipped, * never fatal: a torn write, a hand-edit, or a schema-drifting line must not * zero the history (K3: a parseable-but-wrong-shape line used to crash the * dashboard aggregation downstream). */ export declare function readFusionRuns(logPath?: string): Promise; /** * Export one run record as a Cortex artifact (managed mode). Best-effort: * like the local log, a failed export never fails the run. */ export declare function exportFusionRunArtifact(client: CortexClient, record: FusionRunRecord, agent: string): Promise; /** Per-model-pair rollup for the fusion report. */ export interface FusionPairStats { pair: string; runs: number; gatePassRate: number | undefined; avgWallMs: number; totalTokens: number; avgRoleLatencyMs: number; } /** Aggregate run records into per-pair comparison stats (FU-5's A/B shape). */ export declare function summariseFusionRuns(records: FusionRunRecord[]): FusionPairStats[]; /** * Fusion telemetry dashboard (E015, K3 #4): aggregate the runs log into * per-pair A/B stats + gate-outcome distribution. Pure over the records. */ export interface PairStats { /** "providerA/modelA + providerB/modelB" (sorted; self-pairs keep both). */ pair: string; runs: number; pass: number; passRate: number; avgWallMs: number; totalTokens: number; } export interface FusionDashboard { totalRuns: number; pairs: PairStats[]; gateOutcomes: Record; } export declare function aggregateFusionRuns(records: FusionRunRecord[]): FusionDashboard; /** Render the dashboard as plain lines (the CLI prints them). */ export declare function renderFusionDashboard(d: FusionDashboard): string[]; //# sourceMappingURL=telemetry.d.ts.map