/** * Change-point detection for an anchor pattern's rate curve. * * Replaces the old `timestamp(max_over_time(deriv(...)))` approximation * with an actual range-query over the anchor's rate, a per-bucket slope * computation, and a simple max-derivative scan. Returns the inflection * timestamp AND a confidence label ('sharp' | 'soft' | 'inferred') the * caller uses to decide whether to engage the inferred_midpoint fallback * in the investigate spec. * * Sub-minute resolution on the demo env (which scrapes every 15–30s) is * the practical limit — the detector picks the bucket whose local slope * maximum dominates, not a timestamp inside the bucket. */ import type { EnvConfig } from './environments.js'; export interface InflectionResult { /** UNIX seconds of the detected inflection (or window midpoint as fallback). */ timestamp: number; /** Shape classification of the detection quality. */ confidence: 'sharp' | 'soft' | 'inferred'; /** Peak slope value at the detection point. */ peakSlope: number; /** Ratio of peak slope to median slope — higher = sharper inflection. */ peakToMedianRatio: number; /** Human-readable note for the investigation metadata. */ note: string; } export declare function detectInflection(env: EnvConfig, metricsEnv: string, anchor: string, window: string, metricName?: string): Promise;