import { ToolResult } from '@conveniencepro/ctp-core'; /** * ConveniencePro Tool Protocol (CTP) - Client Runtime * * Browser-based tool execution runtime. * Uses Web APIs (Web Crypto, btoa/atob, etc.) for processing. * * @module @conveniencepro/ctp-runtime/client */ /** * Check if running in browser environment */ declare function isBrowser(): boolean; /** * Check if Web Crypto API is available */ declare function hasWebCrypto(): boolean; /** * Assert browser environment */ declare function assertBrowser(): void; /** * Encode text to Base64 (browser) */ declare function base64Encode(text: string, urlSafe?: boolean): string; /** * Decode Base64 to text (browser) */ declare function base64Decode(input: string): string; /** * URL encode text */ declare function urlEncode(text: string): string; /** * URL decode text */ declare function urlDecode(input: string): string; /** * HTML encode (escape special characters) */ declare function htmlEncode(text: string): string; /** * HTML decode (unescape entities) */ declare function htmlDecode(input: string): string; /** * Supported hash algorithms */ type HashAlgorithm = 'SHA-1' | 'SHA-256' | 'SHA-384' | 'SHA-512'; /** * Hash text using Web Crypto API */ declare function hash(text: string, algorithm: HashAlgorithm): Promise; /** * SHA-256 hash */ declare function sha256(text: string): Promise; /** * SHA-512 hash */ declare function sha512(text: string): Promise; /** * SHA-1 hash (deprecated for security) */ declare function sha1(text: string): Promise; /** * Generate a UUID v4 using crypto.randomUUID or fallback */ declare function generateUUID(): string; /** * Validate UUID format */ declare function isValidUUID(uuid: string): boolean; /** * Get UUID version */ declare function getUUIDVersion(uuid: string): number | null; /** * Format JSON with indentation */ declare function formatJSON(json: string, indent?: number): ToolResult; /** * Minify JSON */ declare function minifyJSON(json: string): ToolResult; /** * Validate JSON */ declare function validateJSON(json: string): ToolResult; /** * Get text statistics */ declare function getTextStats(text: string): ToolResult; /** * Case conversion types */ type CaseType = 'upper' | 'lower' | 'title' | 'sentence' | 'camel' | 'pascal' | 'snake' | 'kebab' | 'constant'; /** * Convert text case */ declare function convertCase(text: string, to: CaseType): string; /** * Client runtime configuration */ interface ClientRuntimeConfig { /** Timeout for async operations (ms) */ timeout?: number; /** Enable performance tracking */ trackPerformance?: boolean; } /** * Client runtime instance */ declare class ClientRuntime { private config; constructor(config?: ClientRuntimeConfig); /** * Check environment compatibility */ checkEnvironment(): { compatible: boolean; features: Record; }; /** * Execute a function with timeout */ withTimeout(fn: () => Promise, timeout?: number): Promise; /** * Execute and track performance */ track(name: string, fn: () => T | Promise): Promise<{ result: T; duration: number; }>; } /** * Create a client runtime instance */ declare function createClientRuntime(config?: ClientRuntimeConfig): ClientRuntime; /** * Default client runtime */ declare const clientRuntime: ClientRuntime; export { type CaseType, ClientRuntime, type ClientRuntimeConfig, type HashAlgorithm, assertBrowser, base64Decode, base64Encode, clientRuntime, convertCase, createClientRuntime, formatJSON, generateUUID, getTextStats, getUUIDVersion, hasWebCrypto, hash, htmlDecode, htmlEncode, isBrowser, isValidUUID, minifyJSON, sha1, sha256, sha512, urlDecode, urlEncode, validateJSON };