/** * log10x_find_skew — surfaces patterns where one slot value dominates * (sampling opportunity). * * Stage 1 implementation: accepts an `events` paste (the same shape as * `log10x_resolve_batch`) and runs the local 10x engine + skew detector. * Env-mode auto-pull (query customer TSDB for top patterns, fetch sample * events, run detector) is a follow-up feature in Stage 2. * * Pre-launch GA-track audit (2026-05-28): unified envelope with status, * threshold_basis, threshold_audit, structured errors, observation-vs- * floor disclosure. The math (concentration percentage) is deterministic. * The agent is honest about the floor being unvalidated. */ import { z } from 'zod'; import type { ExtractedPatterns, ExtractPatternsOptions } from '../lib/pattern-extraction.js'; import { type StructuredOutput } from '../lib/output-types.js'; /** Default minimum dominant-value fraction. Hand-picked, unvalidated. */ export declare const DEFAULT_MIN_CONCENTRATION = 0.6; /** Default sampling rate for the savings projection. Hand-picked, unvalidated. */ export declare const DEFAULT_SAMPLE_N = 10; /** Default minimum events per pattern to bother checking. */ export declare const DEFAULT_MIN_EVENTS = 10; export declare const findSkewSchema: { events: z.ZodArray; min_concentration: z.ZodDefault; top_n: z.ZodDefault; min_events: z.ZodDefault; sample_n: z.ZodDefault; }; export type FindSkewArgs = { events: unknown[]; min_concentration?: number; top_n?: number; min_events?: number; sample_n?: number; /** Ignored. Retained in the signature for backward-compat with * in-process callers; the markdown view was removed from the public * schema in favor of the structured `human_summary` field. */ view?: 'summary' | 'markdown'; }; /** * Top-level call status. Agent branches on this before reading anything else. * - `success`: candidates evaluated, ≥1 found above the concentration floor. * - `no_signal`: candidates evaluated, NONE crossed the floor. Stop searching. * - `insufficient_data`: not enough events to bother analyzing OR no * pattern had ≥ min_events after templating. * - `error`: structural failure (engine crash, input validation failed). */ export type FindSkewStatus = 'success' | 'no_signal' | 'insufficient_data' | 'error'; /** * Engine seam (dependency injection). * * `executeFindSkew` runs the local 10x engine via `extractPatterns`, which * shells out to a locally-installed `tenx` binary (or local Docker). * That is not available deterministically in CI / offline test runs, and * the engine's literal-token handling makes it impossible to * hand-craft an event string that yields a genuine intra-pattern slot * with a controllable dominant percentage. * * This seam lets tests inject a synthetic `ExtractedPatterns` result so * the envelope + detector wrapper can be exercised without a backend. * Mirrors the `_setVerifyRunner` injection pattern in commitment-report.ts. * Production code path is unchanged: the default impl is the real * `extractPatterns`. */ type ExtractPatternsFn = (events: unknown[], opts?: ExtractPatternsOptions) => Promise; /** Test-only seam: override the engine. Pass nothing to reset. */ export declare function _setExtractPatterns(impl?: ExtractPatternsFn): void; export declare function executeFindSkew(args: FindSkewArgs): Promise; export {};