import { trackEvent } from "../analytics.js"; import type { RunOutcomeReport } from "./run-outcome.js"; /** * One event per run outcome, so "how do runs end" is a rate and not a set of * reports. A run that did not finish well (`interrupted`, `failed`, * `unverified`) or that the user stopped is always reported, up to a per-page * cap, because each one names a thing to fix and Analytics counts them per * session. Stops have a cap of their own, so a page of stopped runs never * crowds out a later failure. Only `succeeded` is sampled and carries its * weight, so rates still add up. The server counts every run exactly (`agent_run_outcome_daily`, * `$ai_trace`); this event is what the browser saw and how it came to know. * * A failure carries its named `cause` when it has one and its error `code`, * so Analytics can group agent trouble. Never its message: no redaction can * tell an unquoted document or person's name from the words around it. A code * that is not an identifier is sent as `unrecognized_code` for the same reason. */ export declare const RUN_OUTCOME_EVENT = "agent_run_outcome"; declare const stats: { sent: number; unexpectedSent: number; unexpectedDropped: number; stoppedSent: number; stoppedDropped: number; sampledOut: number; }; export declare function getRunOutcomeTelemetryStats(): Readonly; export declare function resetRunOutcomeTelemetryForTests(): void; export declare function trackRunOutcome(report: RunOutcomeReport, send?: typeof trackEvent, random?: () => number): void; /** * A thumbs rating as the page saw it. The server's `$ai_feedback` carries no * browser session, so Analytics counts ratings per session from this event. */ export declare const RUN_FEEDBACK_EVENT = "agent_feedback_submitted"; export declare function trackRunFeedback(feedback: { runId?: string; threadId: string; positive: boolean; }, send?: typeof trackEvent): void; export {};