Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / auto / protocol / AGENTS.md
| 1 | # AGENTS.md — auto/protocol/ (':auto:protocol') |
| 2 | |
| 3 | > Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `auto/protocol/` + allowed shared modules. Do not root-scan. |
| 4 | |
| 5 | <!-- last-reviewed: 2026-10-16 --> |
| 6 | - Gradle: :auto:protocol / dir: auto/protocol/ |
| 7 | - Package roots present: (pure-Kotlin protocol library — single package, no Android roots) |
| 8 | - Entry files: GalConnection.kt + GalControlSession.kt (no MainActivity/Route — library) |
| 9 | - Deps: :library |
| 10 | - Metadata: metadata_data/auto-protocol.md (absent — libraries have none by design) |
| 11 | - Rust: no / screenshotTest: no |
| 12 | |
| 13 | ## Overview |
| 14 | **Purpose:** Pure-Kotlin GAL (head-unit) protocol library for `:auto` — framing, session control, TLS, and media/input/sensor codecs. No Android, no UI; testable as plain JVM. |
| 15 | **Covers:** Frame read/write + fragmenter/assembler, version negotiation, USB/wireless sessions, transport selector, reconnect backoff, ack tracking; codecs for video, audio, input, sensors, nav status, maps guidance, messaging; TLS + credential/key handling; host-vs-mirror role policy and display routing. |
| 16 | **Entry points + reading order:** `GalConnection.kt` → `GalControlSession.kt` → `FrameReader.kt`/`FrameWriter.kt` → `VersionNegotiation.kt` → the codec for your channel (`VideoCodec`, `InputCodec`, `SensorCodec`, …). |
| 17 | **Gotchas:** |
| 18 | - Protocol changes break car interop — version negotiation must stay backward-compatible |
| 19 | - Keep it pure Kotlin (no Android imports) so it stays unit-testable without a device |
| 20 | |
| 21 | ## Key files |
| 22 | ### Session + framing |
| 23 | - com/vayunmathur/auto/protocol/GalConnection.kt |
| 24 | - com/vayunmathur/auto/protocol/GalControlSession.kt |
| 25 | - com/vayunmathur/auto/protocol/GalTransport.kt |
| 26 | - com/vayunmathur/auto/protocol/StreamTransport.kt |
| 27 | - com/vayunmathur/auto/protocol/FrameHeader.kt |
| 28 | - com/vayunmathur/auto/protocol/FrameReader.kt |
| 29 | - com/vayunmathur/auto/protocol/FrameWriter.kt |
| 30 | - com/vayunmathur/auto/protocol/Fragmenter.kt |
| 31 | - com/vayunmathur/auto/protocol/FrameAssembler.kt |
| 32 | - com/vayunmathur/auto/protocol/FrameId.kt |
| 33 | - com/vayunmathur/auto/protocol/ChannelSendQueue.kt |
| 34 | - com/vayunmathur/auto/protocol/AckTracker.kt |
| 35 | ### Negotiation + transports |
| 36 | - com/vayunmathur/auto/protocol/VersionNegotiation.kt |
| 37 | - com/vayunmathur/auto/protocol/TransportKind.kt |
| 38 | - com/vayunmathur/auto/protocol/TransportSelector.kt |
| 39 | - com/vayunmathur/auto/protocol/UsbSession.kt |
| 40 | - com/vayunmathur/auto/protocol/WirelessSession.kt |
| 41 | - com/vayunmathur/auto/protocol/ReconnectBackoff.kt |
| 42 | ### Codecs |
| 43 | - com/vayunmathur/auto/protocol/VideoCodec.kt |
| 44 | - com/vayunmathur/auto/protocol/AudioCodec.kt |
| 45 | - com/vayunmathur/auto/protocol/InputCodec.kt |
| 46 | - com/vayunmathur/auto/protocol/SensorCodec.kt |
| 47 | - com/vayunmathur/auto/protocol/NavStatusCodec.kt |
| 48 | - com/vayunmathur/auto/protocol/MapsGuidance.kt |
| 49 | - com/vayunmathur/auto/protocol/MessageCodec.kt |
| 50 | - com/vayunmathur/auto/protocol/MessagingCodec.kt |
| 51 | ### Security + roles |
| 52 | - com/vayunmathur/auto/protocol/TlsCodec.kt |
| 53 | - com/vayunmathur/auto/protocol/GalCredential.kt |
| 54 | - com/vayunmathur/auto/protocol/GalMessage.kt |
| 55 | - com/vayunmathur/auto/protocol/FocusArbitration.kt |
| 56 | - com/vayunmathur/auto/protocol/HostVsMirror.kt |
| 57 | - com/vayunmathur/auto/protocol/MaosRole.kt |
| 58 | - com/vayunmathur/auto/protocol/DisplayRoutePolicy.kt |
| 59 | |
| 60 | ## Verify (this module only) |
| 61 | ``` |
| 62 | ./gradlew :auto:protocol:compileDevKotlin |
| 63 | ./gradlew :auto:protocol:lint |
| 64 | ``` |