/** * A summary of one run small enough to paste into a chat window, and safe * enough to paste without reading it first. * * This exists because the most valuable report this project can receive — "that * verdict is wrong" — is also the most awkward one to send. `flightrec report * --json` is the full record: prompts, file contents, absolute paths, commands. * Asking a colleague to redact that by hand before sending it is asking them not * to bother. * * **The safety mechanism is the allowlist, not the redactor.** `redact()` finds * credentials; it is explicitly documented as conservative, because * over-redaction destroys the evidence value of a stored record. It does not and * should not strip a goal, a branch name or a repository path — and those are * exactly what leaks an employer. So nothing here copies a free-text field. * Every value below is an enum, a number, a version string, or a detector name. * `redact()` runs over the rendered output as a second line of defence, where it * should always be a no-op; if it ever is not, the allowlist has a bug. * * What is deliberately left out, and why it is not obvious: * * - **Finding titles and details.** These look like safe summaries and are not. * `loops.ts` builds titles like `` `` failed 3× ``, * and stop-point triggers carry file basenames. This is the single most likely * thing for a future edit to add back. * - **Full finding ids.** The third segment is a hash of a file path or a * command. One-way, but a stable identifier for a private path does not belong * in a paste. `detectorOf()` keeps the part that carries the meaning. * - **Tool names, unless recognised.** MCP tools are named * `mcp____` and `` is routinely an internal system name. * - **schemaDrift strings.** They interpolate raw transcript field names. The * count is the useful part; the detail is one local command away. * - **Timestamps.** `startedAt`/`endedAt` are working-hours metadata and explain * no verdict. `durationS` does. * * Cost *is* included: `costUsd >= 1.0` is a verdict branch, so omitting it would * make half the `wasteful` grades unexplainable to whoever reads the paste. * * Nothing here writes, and nothing here sends. */ import type { Analysis } from "./analyze/index.js"; import { type Label, type Severity } from "./model.js"; import type { Store } from "./store.js"; export interface FeedbackDetector { detector: string; severity: Severity; category: string; count: number; } export interface Feedback { runId: string; source: string; label: Label; labelRule: string; maxSeverity: Severity; trivial: boolean; synthetic: boolean; goalIsKnown: boolean; detectors: FeedbackDetector[]; verification: { status: string; checksRun: number; passed: number; failed: number; frameworks: string[]; }; stopPoint: { detector: string; eventsAfter: number; minutesAfter: number | null; editsAfter: number; checksAfter: number; } | null; metrics: Analysis["metrics"]; tools: { name: string; count: number; }[]; commands: { category: string; count: number; }[]; schemaDriftCount: number; analyzerVersion: string; packageVersion: string; nodeVersion: string; platform: string; } /** * Build the summary for one run, or null when the id is unknown. * * Reads only the allowlisted fields. A `StoredRun` carries the whole trace; the * discipline is that this function never touches a free-text member of it. */ export declare function buildFeedback(store: Store, runId: string, packageVersion: string): Feedback | null; /** Render the summary. Short on purpose — a summary that grows is a report. */ export declare function formatFeedback(f: Feedback): string;