/** * log10x_rank_by_shape_similarity — deterministic primitive: rank a * candidate set against an anchor by Pearson + lag, returning ONLY raw * arithmetic. No tier, no causal framing, no judgment. * * Design rationale: Pearson IS deterministic given inputs. The fuzzy * compression is in TIER labels ("confirmed" / "service-match" / * "coincidence") and implicit "this is the cause" framing — both * compress what the agent needs to judge. This primitive keeps the * math, drops the compression. The agent reads pearson_signed + * lag_direction + flags and decides. metric_overlay verifies the * curves. metrics_that_moved filters anchor-aligned movement. * * No tier. No "confirmed." No "coincidence." Just numbers. */ import { z } from 'zod'; import type { EnvConfig } from '../lib/environments.js'; import { type StructuredOutput } from '../lib/output-types.js'; export declare const LAG_OFFSETS_SECONDS: number[]; export declare const DEFAULT_LAG_SEARCH_MAX_ABS: number; export declare const DEFAULT_ANCHOR_PHASE_ALIGNED_FLOOR = 0.15; export declare const rankByShapeSimilaritySchema: { anchor_type: z.ZodEnum<["log10x_pattern", "customer_metric"]>; anchor: z.ZodString; candidates: z.ZodArray; window: z.ZodDefault; timeRange: z.ZodOptional; step: z.ZodDefault; lag_search_max_abs: z.ZodDefault; anchor_phase_aligned_floor: z.ZodDefault; environment: z.ZodOptional; customer_metrics_url: z.ZodOptional; customer_metrics_type: z.ZodOptional>; customer_metrics_auth: z.ZodOptional; }; /** * Top-level call status. Agent branches on this before reading anything else. * - `success`: math ran cleanly; read `ranked[]`. * - `anchor_no_phase_separation`: anchor MAD/median < 0.15. Refused. * - `no_signal`: every candidate either failed or returned r≈0. Stop searching. * - `error`: structural failure; read `data.error`. */ export type RankByShapeStatus = 'success' | 'anchor_no_phase_separation' | 'no_signal' | 'error'; export declare function executeRankByShapeSimilarity(args: { anchor_type: 'log10x_pattern' | 'customer_metric'; anchor: string; candidates: string[]; window?: string; timeRange?: string; step?: string; lag_search_max_abs?: number; anchor_phase_aligned_floor?: number; environment?: string; customer_metrics_url?: string; customer_metrics_type?: string; customer_metrics_auth?: string; /** Ignored. Retained in the args type for backward-compat with * in-process callers (tests, eval harness); the markdown view was * removed from the public schema in favor of the structured * `human_summary` field. */ view?: 'summary' | 'markdown'; }, env: EnvConfig): Promise; export interface TemporalResult { r: number; lagSeconds: number; lagTightness: number; } export declare function computeTemporalCorrelation(anchor: number[], candidate: number[], step: number, offsetsSeconds?: number[]): TemporalResult; export declare function pearsonWithOffset(a: number[], b: number[], offset: number): number; export declare function anchorPhaseGap(anchor: number[], candidate: number[]): number;