Process-scoped SharedFlow bus for HTTP request/response log lines emitted by the OkHttp interceptor. Reuse when you need lightweight, non-replaying network logging observable per task.
// Source: https://github.com/eggbrid2/mobileClaw | License: MIT | Copyright 2026 MobileClaw Contributors
// Provided via justclaw.it.com; keep this notice with the code.
package com.mobileclaw.agent
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.SharedFlow
import kotlinx.coroutines.flow.asSharedFlow
/**
* Process-scoped bus for HTTP request/response log lines.
* The OkHttp interceptor in OpenAiGateway emits here.
* ViewModel collects per-task (collection is cancelled when taskJob is cancelled).
* No replay buffer — new collectors only see future emissions.
*/
object NetworkTracer {
private val _events = MutableSharedFlow<String>(extraBufferCapacity = 128)
val events: SharedFlow<String> = _events.asSharedFlow()
fun log(message: String) {
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key