/** * Fresh-session nudge: fires once per session when context is BOTH long * (fill >= FRESH_NUDGE_MIN_FILL_PCT) AND degraded (quality < FRESH_NUDGE_QUALITY_THRESHOLD). * * Confidently reassures the user that Token Optimizer has checkpointed their * active task so a fresh session resumes exactly where they stopped, and shows * the concrete tokens they would reclaim by starting fresh now. * * Takes PRECEDENCE over the ordinary quality/compact nudge (the caller skips * that when this fires — both messages would be noise). * * Ported from Python _maybe_fresh_session_nudge / _fresh_session_savings_estimate * in skills/token-optimizer/scripts/measure.py. */ /** * Look up the API input rate ($/M tokens) for the given model. * Substring-matches the lowercase model id against the table — same * strategy as contextWindowForModel. Falls back to the (date-gated) Sonnet rate. */ export declare function modelInputRatePer1M(model?: string): number; /** * API-equivalent dollar value of the reclaimed tokens, priced at the session's * own model input rate. Returns 0 on any error (best-effort). * Mirrors Python _fresh_session_savings_usd. */ export declare function freshSessionSavingsUsd(savedTokens: number, model?: string): number; export declare const FRESH_NUDGE_QUALITY_THRESHOLD: number; export declare const FRESH_NUDGE_MIN_FILL_PCT: number; export interface FreshNudgeResult { shouldNudge: boolean; message: string | null; } /** * Estimate tokens reclaimed by starting a fresh session now. * current context size = (fillPct / 100) * contextWindow * savings = current context - lean block re-injection overhead * * @param fillPct 0-100 (percentage, not fraction) * @param model optional model id — used only as a last-resort fallback * when sessionWindow is unavailable * @param sessionWindow the EXACT context-window value the fill% was measured * against (pass the same value used in computeQualityScore). * When provided this takes priority over re-deriving from the * model, which guarantees token count == fill% of that window * (e.g. 54% of 1_000_000 ≈ 540K, never ~107K on a 200K fallback). * @returns [savedTokens, contextWindow] */ export declare function freshSessionSavingsEstimate(fillPct: number, model?: string, sessionWindow?: number): [number, number]; /** * Check whether the fresh-session nudge should fire for this turn. * * @param currentScore current quality/resource-health score (0-100) * @param fillPct current context fill as 0-100 (percentage, not fraction) * @param previousScore score from the previous turn (null = no prior score yet) * @param freshNudgeFired whether the nudge already fired this session * @param nudgesEnabled whether quality nudges are enabled in config * @param continuityEnabled whether checkpoint continuity is enabled. The nudge's * whole pitch ("start fresh, your place is saved") only * holds when continuity actually restores the checkpoint * in the new session. With continuity off, suppress the * nudge so the ordinary quality nudge (/compact) takes * over instead of promising a restore that never happens. * @param model optional model id — fallback for context-window lookup * @param sessionWindow the EXACT context-window value the fill% was measured * against; threads through to freshSessionSavingsEstimate * so the token count is consistent with the fill% display * @param qualityThreshold score below which (with fill) the nudge may fire; defaults * to the env-tunable module constant, overridable via config * @param minFillPct fill% at/above which the nudge may fire; same default rule */ export declare function checkFreshSessionNudge(currentScore: number, fillPct: number, previousScore: number | null, freshNudgeFired: boolean, nudgesEnabled: boolean, continuityEnabled: boolean, model?: string, sessionWindow?: number, qualityThreshold?: number, minFillPct?: number): FreshNudgeResult; //# sourceMappingURL=fresh-session-nudge.d.ts.map