This document maps core control-plane modules to the current codebase. Where a module is not implemented (or exists only in a non-release build), it is labeled explicitly.
The Detector subsystem provides monitoring of network health and censorship signals.
sunlionet-inside):
pkg/detector/real/real.go and pkg/detector/*.The Policy Engine ranks candidates deterministically and produces a safe fallback decision path when optional orchestrators are unavailable.
Implemented in the release build:
pkg/policy/engine.go (EWMA success, latency penalties/bonuses, cooldown filtering, trust weighting).pkg/policy/adaptive.go + pkg/policy/adaptive_store.go (encrypted at-rest).pkg/orchestrator/* + cmd/inside flags. Orchestrator output is enforced by safety constraints and falls back to deterministic policy on failure.LLM-based decisioning exists in a non-release runtime path (cmd/inside with build tag daemon) and is not part of the current public release boundary.
The Secure Store ensures that configuration state is encrypted at rest on disk. Runtime event streams are separate and are intentionally bounded/sanitized.
pkg/profile/store.go and other pkg/*/store.go).android/app/src/main/java/com/sunlionet/agent/SecureStore.kt).pkg/profile/*.pkg/importctl/import.go and pkg/bundle/verify.go.pkg/profile/store.go deletes the encrypted store file on request.Conceptual (non-release): the supervisor/daemon architecture described below reflects an earlier or experimental control loop (see cmd/inside/daemon.go) and is not the default release runtime.
The supervisor loop orchestrates the pipeline:
Detector emits an event to the EventChan.Supervisor appends the event to the ring buffer.Policy Engine evaluates the events and ranks profiles.ActionSwitchProfile is generated.LLM Advisor is invoked with the ranked candidate list.Supervisor generates a new JSON configuration and calls ApplyAndReload on the sbctl (sing-box controller) for a seamless atomic config reload.