/** * Product telemetry snapshot contract — Anonymous Product Telemetry v1 * (PRI-598, SPEC §23-§34; review remediation: tri-state milestone facts). * * Pure contract: schema, strict validator, and snapshot builder. No I/O. * Durable-fact readers live in host-runtime (I/O boundary); this module only * validates and assembles what they provide. * * Privacy invariants enforced here: * - Exact-key strictness: unknown top-level or nested fields are validation * errors (mirrored by the collector, which must reject them with 400). * - Only boolean-or-null milestones — no counts, no content, no paths. * - A privacy guard makes schema scope creep (fields whose names carry * prohibited concepts) fail tests, not just review. * * Tri-state semantics (measurement honesty — "Unknown ≠ false"): * - `true` = source evaluable AND evidence observed; * - `false` = source evaluable AND no evidence observed; * - `null` = source not currently evaluable (missing/unreadable/degraded). * A null milestone is excluded from the dashboard denominator — it must * never be summed, counted as 0, or interpreted as "not observed". */ import { type Static } from '@sinclair/typebox'; export declare const PRODUCT_TELEMETRY_SNAPSHOT_SCHEMA_VERSION = "1"; export declare const PRODUCT_TELEMETRY_CONSENT_VERSION = "1"; /** Coarse host kind derived from the install manifest, not the triggering process. */ export declare const PRODUCT_TELEMETRY_HOST_KINDS: readonly ['openclaw', 'codex', 'other']; export type ProductTelemetryHostKind = (typeof PRODUCT_TELEMETRY_HOST_KINDS)[number]; /** Bounded PD version (npm version string, e.g. "1.218.0"). */ export declare const PRODUCT_TELEMETRY_PD_VERSION_MAX_LENGTH = 32; /** A milestone or reliability fact: observed true / evaluated false / unavailable null. */ export type TelemetryFact = boolean | null; export declare const ProductTelemetrySnapshotV1Schema: import("@sinclair/typebox").TObject<{ schemaVersion: import("@sinclair/typebox").TLiteral<"1">; dailyTelemetryId: import("@sinclair/typebox").TString; bucketDate: import("@sinclair/typebox").TString; pdVersion: import("@sinclair/typebox").TString; hostKind: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"openclaw">, import("@sinclair/typebox").TLiteral<"codex">, import("@sinclair/typebox").TLiteral<"other">]>; milestones: import("@sinclair/typebox").TObject<{ initialized: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull]>; painObserved: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull]>; principleObserved: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull]>; activationObserved: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull]>; presenceReceiptObserved: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull]>; effectReceiptObserved: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull]>; }>; reliability: import("@sinclair/typebox").TObject<{ initializationFailed: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull]>; }>; consentVersion: import("@sinclair/typebox").TString; }>; export type ProductTelemetrySnapshotV1 = Static; /** The 8 top-level fields, in wire order. The collector allowlist must equal this set. */ export declare const PRODUCT_TELEMETRY_TOP_LEVEL_FIELDS: readonly ["schemaVersion", "dailyTelemetryId", "bucketDate", "pdVersion", "hostKind", "milestones", "reliability", "consentVersion"]; /** * Field-name concepts that must never appear in the telemetry schema. * Guard (SPEC §64): makes privacy regression technically difficult — adding * a field whose name matches one of these tokens fails the privacy guard * test unless explicitly allowlisted here with a justification. */ export declare const PROHIBITED_TELEMETRY_FIELD_TOKENS: readonly ['content', 'prompt', 'message', 'path', 'file', 'repo', 'email', 'username', 'hostname', 'stack', 'arguments', 'payload', 'toolinput', 'tooloutput']; /** * Collect all field names of the schema contract (recursively) and assert * none matches a prohibited token. Throws with the offending names. */ export declare function assertTelemetrySchemaPrivacy(fieldNames: readonly string[]): void; export interface SnapshotValidationOk { ok: true; value: ProductTelemetrySnapshotV1; } export interface SnapshotValidationErr { ok: false; errors: string[]; } export type SnapshotValidationResult = SnapshotValidationOk | SnapshotValidationErr; /** * Strict validation of an untrusted parsed snapshot (EP-01: unknown until * proven). Rejects unknown keys at both levels, wrong types, malformed * dates/IDs, overlong versions, and non-allowlisted host kinds. */ export declare function validateProductTelemetrySnapshot(raw: unknown): SnapshotValidationResult; /** Milestone facts derived by the host-runtime reader from durable sources. */ export interface ProductTelemetryMilestoneInput { initialized: TelemetryFact; painObserved: TelemetryFact; principleObserved: TelemetryFact; activationObserved: TelemetryFact; presenceReceiptObserved: TelemetryFact; effectReceiptObserved: TelemetryFact; } /** Reliability facts (coarse; no messages, no stacks, no enums). */ export interface ProductTelemetryReliabilityInput { initializationFailed: TelemetryFact; } export interface BuildSnapshotInput { dailyTelemetryId: string; bucketDate: string; pdVersion: string; hostKind: ProductTelemetryHostKind; milestones: ProductTelemetryMilestoneInput; reliability: ProductTelemetryReliabilityInput; } /** * Assemble and validate one daily snapshot. Inputs are validated with the * same strict validator the collector applies, so a snapshot that leaves * this function is wire-valid by construction (fail loud on programmer * error rather than letting an invalid payload reach the network). */ export declare function buildProductTelemetrySnapshot(input: BuildSnapshotInput): ProductTelemetrySnapshotV1; //# sourceMappingURL=snapshot-contract.d.ts.map