# @mosaicstack/telemetry-client TypeScript/JavaScript client SDK for Mosaic Stack Telemetry. Zero runtime dependencies. ## Commands ```bash npm install # Install dependencies npm run typecheck # Type check npm run lint # Lint npm run format:check # Format check npm test # Run tests npm run test:coverage # Tests with coverage (85% threshold) npm run build # Build to dist/ ``` ## Architecture - `client.ts` — TelemetryClient (main public API, setInterval-based background flush) - `queue.ts` — EventQueue (bounded FIFO array) - `submitter.ts` — BatchSubmitter (native fetch, exponential backoff, Retry-After) - `prediction-cache.ts` — PredictionCache (Map + TTL) - `event-builder.ts` — EventBuilder (auto-generates event_id, timestamp) - `types/` — Standalone type definitions matching server API schema v1.0 ## Key Patterns - `track()` never throws — catches everything, routes to `onError` callback - Zero runtime deps: uses native `fetch` (Node 18+), `crypto.randomUUID()`, `setInterval` - All types are standalone — no dependency on the telemetry server package