SnoopCore

object SnoopCore

Central, DI-agnostic entry point that the capture adapters (Ktor, analytics) write to and the UI reads from. Holds the single shared SnoopStore. Adapters never reference the UI or each other — they only talk to this bridge, keeping capture, storage and UI fully decoupled.

Properties

Link copied to clipboard

Master switch; when false, adapters drop everything (used by no-op / release gating). Volatile because it is flipped from wherever the host happens to be and read on every capture from the Ktor and analytics threads, which share no happens-before with the writer.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

What every viewer calls itself — the inspector's header, the notification, the web page. Set it through configure when the host would rather the tool carried its own name.

Functions

Link copied to clipboard
fun configure(capacity: Int = store.capacity, maxTotalBytes: Long = store.maxTotalBytes, title: String = this.title)

Reconfigure the store limits and the name the viewers show. Changing the limits clears existing entries — set them before traffic starts; changing the title leaves the store alone. The store and its StateFlow survive, so already-attached collectors (Compose UI, SSE) keep working. reset restores the defaults.

Link copied to clipboard
fun nextId(): String
Link copied to clipboard
fun now(): Instant
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun reset()

Test/utility hook to reset all state.

Link copied to clipboard