/** * Context window threshold crossing alerts. * * Detects when context usage crosses warning/caution/critical/emergency * thresholds and emits alerts. Supports suppression and per-command filtering. * * @task T4454 * @epic T4454 */ /** Context alert thresholds (percentage of context window). */ export declare const THRESHOLDS: { readonly WARNING: 70; readonly CAUTION: 85; readonly CRITICAL: 90; readonly EMERGENCY: 95; }; /** Alert level names. */ export type AlertLevel = 'warning' | 'caution' | 'critical' | 'emergency'; /** * Get the current session ID from the environment (T11347 ยท Epic T11284). * * Unified resolution via the canonical {@link resolveSessionIdFromEnv}, which * reads `CLEO_SESSION_ID` (canonical) then `CLEO_SESSION` (legacy alias) then * the harness keys. The dead `.current-session` file read was removed: it had * ZERO writers anywhere in the codebase (a stale stub), so it could only ever * return null. `cwd` is retained for signature stability. * * @param _cwd - Unused (retained for API stability after the dead-file removal). * @returns The resolved session id, or `null`. * @task T11347 */ export declare function getCurrentSessionId(_cwd?: string): string | null; /** Get the root session ID that originated the current workflow/saga, if any. */ export declare function getCurrentOriginSessionId(): string | null; /** Get the execution/session attempt ID for the current command, if any. */ export declare function getCurrentExecutionSessionId(): string | null; /** Get context state file path for a session. */ export declare function getContextStatePath(sessionId?: string, cwd?: string): string; /** Read context state for a session. Returns null if stale or missing. */ export declare function readContextState(sessionId?: string, cwd?: string): Record | null; /** Determine the threshold level for a given percentage. */ export declare function getThresholdLevel(percentage: number): AlertLevel | null; /** * Determine if we should alert based on threshold crossing. * Returns the alert level if a new threshold was crossed, null otherwise. */ export declare function shouldAlert(currentPct: number, lastAlertedPct?: number, minThreshold?: AlertLevel): AlertLevel | null; /** Alert result from check_context_alert. */ export interface AlertCheckResult { alerted: boolean; level: AlertLevel | null; percentage: number; currentTokens: number; maxTokens: number; action: string | null; } /** Get recommended action for an alert level. */ export declare function getRecommendedAction(percentage: number): string | null; /** * Main function to check and determine if an alert should fire. * Non-blocking - always returns a result. */ export declare function checkContextAlert(currentCommand?: string, cwd?: string): AlertCheckResult; //# sourceMappingURL=context-alert.d.ts.map