/** * Telemetry Sanitization Utilities * * Provides utilities to safely hash/obfuscate customer data for telemetry. * * Security Principle: "When in doubt, hash it out" */ import type { ToolName } from '../tools'; /** * Hash a string using SHA256 and return first 16 characters * Provides enough uniqueness for grouping while preventing reverse lookup */ export declare function hashValue(value: string): string; /** * Sanitize a file path for telemetry * Replaces path segments with hashed values * * Security strategy: * - Relative paths (./ or ../): Keep as-is (no customer data) * - Short paths (<=4 segments): Hash all (too risky to preserve any) * - Long paths (5+ segments): Hash all except last 2 (preserve structure like src/index.ts) * * @example * sanitizePath('/home/user/myapp/src/index.ts') * // Returns: '///src/index.ts' * * sanitizePath('/home/user/myapp/src') * // Returns: '///' (all hashed - too short, 4 segments) */ export declare function sanitizePath(path: string): string; /** * Sanitize tool input parameters for telemetry * Removes or hashes sensitive fields */ export declare function sanitizeToolInput(params: Record): Record; /** * Extract safe telemetry metrics from tool results * Returns only aggregate metrics, no sensitive data */ export declare function extractSafeTelemetryMetrics(toolName: ToolName, result: Record): Record; /** * Safe telemetry event structure */ export interface SafeTelemetryEvent { toolName: ToolName; success: boolean; durationMs?: number; sanitizedInput: Record; metrics: Record; errorType?: string; } /** * Create a safe telemetry event from tool execution */ export declare function createSafeTelemetryEvent(toolName: ToolName, params: Record, result: { ok: boolean; value?: Record; error?: string; }, durationMs?: number): SafeTelemetryEvent; //# sourceMappingURL=telemetry-utils.d.ts.map