/**
 * Input sanitization utilities to prevent injection attacks
 * and validate user input
 */
/**
 * Sanitize a file path to prevent directory traversal attacks
 * @param filePath - The file path to sanitize
 * @param allowAbsolute - Whether to allow absolute paths
 * @returns Sanitized file path
 * @throws ValidationError if path is invalid or contains dangerous patterns
 */
export declare function sanitizeFilePath(filePath: string, allowAbsolute?: boolean): string;
/**
 * Sanitize command arguments to prevent command injection
 * @param arg - The argument to sanitize
 * @returns Sanitized argument
 * @throws ValidationError if argument contains dangerous characters
 */
export declare function sanitizeCommandArg(arg: string): string;
/**
 * Escape special characters in a string for safe use in regex
 * @param str - The string to escape
 * @returns Escaped string safe for regex
 */
export declare function escapeRegex(str: string): string;
/**
 * Sanitize HTML to prevent XSS attacks
 * Basic implementation - for terminal output
 * @param html - The HTML string to sanitize
 * @returns Sanitized HTML
 */
export declare function sanitizeHTML(html: string): string;
/**
 * Validate and sanitize an email address
 * @param email - The email to validate
 * @returns Sanitized email
 * @throws ValidationError if email is invalid
 */
export declare function sanitizeEmail(email: string): string;
/**
 * Validate and sanitize a URL
 * @param url - The URL to validate
 * @param allowedProtocols - List of allowed protocols (default: ['http', 'https'])
 * @returns Sanitized URL
 * @throws ValidationError if URL is invalid
 */
export declare function sanitizeURL(url: string, allowedProtocols?: string[]): string;
/**
 * Validate that a string contains only alphanumeric characters and specific allowed characters
 * @param str - The string to validate
 * @param allowedChars - Additional characters to allow (e.g., '-_')
 * @returns True if valid, false otherwise
 */
export declare function isAlphanumeric(str: string, allowedChars?: string): boolean;
/**
 * Limit string length and add ellipsis if needed
 * @param str - The string to truncate
 * @param maxLength - Maximum length
 * @param ellipsis - String to append when truncated (default: '...')
 * @returns Truncated string
 */
export declare function truncateString(str: string, maxLength: number, ellipsis?: string): string;
/**
 * Remove control characters from a string
 * @param str - The string to clean
 * @returns String without control characters
 */
export declare function removeControlCharacters(str: string): string;
/**
 * Validate JSON string and parse safely
 * @param jsonString - The JSON string to parse
 * @returns Parsed JSON object
 * @throws ValidationError if JSON is invalid
 */
export declare function sanitizeJSON<T = unknown>(jsonString: string): T;
/**
 * Validate and sanitize a port number
 * @param port - The port number (string or number)
 * @returns Valid port number
 * @throws ValidationError if port is invalid
 */
export declare function sanitizePort(port: string | number): number;
/**
 * Sanitize LLM output by removing control tokens and internal markers
 * These tokens can leak from models like Grok and should not be displayed
 * @param content - The LLM output content to sanitize
 * @returns Sanitized content without control tokens
 */
export declare function sanitizeLLMOutput(content: string): string;
/**
 * Sanitize tool result content before sending back to the LLM.
 * Strips patterns that could be interpreted as system prompts or role overrides.
 */
export declare function sanitizeToolResult(content: string): string;
/**
 * Tool call extracted from commentary format
 */
export interface ExtractedToolCall {
    name: string;
    arguments: Record<string, unknown>;
    raw: string;
}
/**
 * Extract tool calls from "commentary to=tool_name {...}" format
 * Used for models that don't support native OpenAI tool calls
 *
 * @param content - Raw LLM output content
 * @returns Array of extracted tool calls and remaining content
 */
export declare function extractCommentaryToolCalls(content: string): {
    toolCalls: ExtractedToolCall[];
    remainingContent: string;
};
