/** * The only shapes telemetry puts on the wire. Each payload is built from an * allowlist of bounded facts and encoded with the published contract schema, * so delivery and preview carry the same sanitized value and a value outside * the contract's bounds is never sent. */ import * as Option from "effect/Option"; import type { AppErrorCode } from "../app-error/index.js"; import type * as GeneratedTelemetryClient from "./__generated__/telemetry-client.js"; type TelemetryPropertyValue = string | number | boolean | null; export type TelemetryProperties = Record; export type TelemetryFailurePhase = GeneratedTelemetryClient.TelemetryErrorReport["phase"]; type TelemetryErrorClass = GeneratedTelemetryClient.TelemetryErrorReport["failure"]["class"]; export type TelemetryPreviewFormat = "text" | "json"; /** One terminal failure, already reduced to its allowlisted diagnostic identity. */ export interface TelemetryFailureReport { readonly phase: TelemetryFailurePhase; /** Stable identifier from the caller's enumerated failure set. */ readonly kind: string; readonly category: AppErrorCode; readonly errorClass: TelemetryErrorClass; /** False for a defect. */ readonly handled: boolean; /** Canonical command identity when known; never arguments. */ readonly command?: string; readonly activityId?: string; } export interface TelemetryClientIdentity { readonly name: string; readonly version: string; } /** Bounded facts about this client build and the host executing it. */ export declare const reportingClientFacts: (client: TelemetryClientIdentity, ci: boolean, versions?: Readonly>) => GeneratedTelemetryClient.TelemetryReportingClient; /** The shared environment metadata attached to usage event batches. */ export declare const usageEventContext: (facts: GeneratedTelemetryClient.TelemetryReportingClient, invocationId: string) => GeneratedTelemetryClient.TelemetryContext; export declare const buildErrorReport: (input: { readonly eventId: string; readonly invocationId: string; readonly occurredAt: string; readonly installationId: Option.Option; readonly client: GeneratedTelemetryClient.TelemetryReportingClient; readonly failure: TelemetryFailureReport; }) => GeneratedTelemetryClient.TelemetryErrorReport; export declare const buildEventsRequest: (input: { readonly eventId: string; readonly event: string; readonly installationId: string; readonly timestamp: string; readonly sentAt: string; readonly properties: TelemetryProperties; readonly context: GeneratedTelemetryClient.TelemetryContext; }) => GeneratedTelemetryClient.TelemetryEventsRequest; /** * One diagnostic line showing the encoded payload a send would carry. Machine * output keeps stderr NDJSON, so the line is one log event there. */ export declare const previewLine: (format: TelemetryPreviewFormat, route: string, encoded: unknown) => string; export {}; //# sourceMappingURL=payloads.d.ts.map