Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / communicate-dev / AGENTS.md
| 1 | # AGENTS.md — communicate-dev/ (':communicate-dev') |
| 2 | |
| 3 | > Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `communicate-dev/` + `communicate/`. |
| 4 | |
| 5 | - Gradle: :communicate-dev / dir: communicate-dev/ |
| 6 | - Module type: Android library (`common-conventions-library`); it is not an app and has no `applicationId`, launcher icon, or store metadata. |
| 7 | - Host: `:communicate` links this module only from its `dev` variant (`devImplementation`). Release builds do not compile, link, or package it. |
| 8 | - This module is dev-build-only by owner decision and is excluded from the repo line count for `:communicate`. |
| 9 | - Package names under `com.vayunmathur.communicate.*` are kept where JNI symbol names (Rust crates `communicate_signal` / `communicate_mls`), protobuf/wire formats, Room schemas, and persisted DataStore/auth formats freeze them. The library namespace (`com.vayunmathur.communicatedev`) only names this module's own R/resources. |
| 10 | - Entry files: none (no UI entry points). The host's registration entries live in `communicate/src/dev/java/com/vayunmathur/communicate/ui/RegistrationEntries.kt` (dev variant) with a Google-Voice-only release counterpart in `communicate/src/release/`; the three line feature gates (`data/{whatsapp,signal,rcs}/*Feature.kt`, `enabled = true`) live here, with `enabled = false` stubs in the host's `src/release`. |
| 11 | - Deps: :library, :library:ui, :library:log, :library:network, :library:image, :library:room (+ Room runtime/KSP), :library:aosp-stubs (compileOnly), RingRTC, libsignal, protobuf, libphonenumber |
| 12 | |
| 13 | ## Overview |
| 14 | **Purpose:** Owns the dev-only messaging lines of Communicate — WhatsApp, Signal, and RCS (data, transports, crypto, Room DBs, protos, Rust, registration data) — so those lines do not count against or ship in the `:communicate` release app. Dev builds of `:communicate` gain the lines through this module; release behaviour is unchanged. |
| 15 | **Key features:** |
| 16 | - WhatsApp primary client line (Noise + Double Ratchet), Signal line (libsignal + Rust protocol), and RCS line (SIP/MSRP + MLS E2EE) for dev builds |
| 17 | - Registration wizard data for the three lines (screens are host route sub-stacks in the host's `src/dev`) |
| 18 | - Line sync foreground services and the shared in-app Telecom services, declared in this module's manifest so they merge only into dev builds (the service classes live in the host's `src/dev` — they need host `MainActivity`/`R`/notifications) |
| 19 | **Architecture / data-flow:** Host (`:communicate`, dev variant) links this module via `devImplementation`. This module owns `data/whatsapp`, `data/signal`, `data/rcs` (transports under `data/<line>/transport/`, E2E under `data/<line>/e2e/`), the 11 protos in `src/main/proto` (hand-rolled `GenerateProtoTask`, no proto plugin), both Rust crates (`src/main/rust`, `src/main/rust-mls` via `rustNativeLib`), and the line Room schemas in `schemas/`. Host-side glue that needs host classes stays in the host's `src/dev`: repository extensions (`CommunicateRepository{Rcs,RcsGroup,Signal,WhatsApp,WhatsAppCalls}`), RCS file-transfer/outbox/typing repository glue, the sync services, and the UI/telecom seams; the host's `src/release` carries no-op counterparts. A library cannot depend on the host app, so line code here never references host classes: shared frozen types (`data/SecretSealer.kt`, `data/CommunicateLine.kt`, `data/call/{InAppCall,WebRtcInit}.kt`) are canonical here with byte-identical copies in the host's `src/release` for its Google Voice / call-UI paths, and Telecom/foreground-service mirroring goes through `data/call/InAppCallSystemBridge` (installed by the host's `InAppCallTelecom`). |
| 20 | **Gotchas:** |
| 21 | - Never add this module as an `implementation` dependency of `:communicate`; it is `devImplementation` only. A release APK containing these classes is a regression. |
| 22 | - `:library:aosp-stubs` is `compileOnly` only — it must never be packaged. |
| 23 | - Registration wizards are host route sub-stacks (`Route.WhatsAppRegistration`, `Route.SignalRegistration`, RCS routes); step state stays in route arguments, not in held selection state. |
| 24 | - RingRTC is the only WebRTC distribution allowed on the classpath; never add another WebRTC dependency. |
| 25 | - The `src/release` copies of `SecretSealer` / `CommunicateLine` / `InAppCall` / `WebRtcInit` in `:communicate` must stay byte-identical to the canonical files here (KeyStore alias `communicate_secret_key` and the `v1:` sealed format are frozen; in each variant exactly one copy compiles). |
| 26 | - Members used by host `src/dev` glue and by host integration tests are public here (the two clients' test-seam state, `RcsSessionManager.sessionsMutable`, `RcsMsrp` connection `isClosed()`, `RcsGbaAuth.digestAuthorizationHeader`, `canonicalWhatsAppChatJid`, the `*ForTest` database/base-url overrides, and similar) because Kotlin `internal` does not cross the module boundary; keep new additions minimal and prefer lib-local APIs. |
| 27 | |
| 28 | ## Verify (this module only) |
| 29 | ``` |
| 30 | ./gradlew :communicate-dev:compileDebugKotlin |
| 31 | ./gradlew :communicate-dev:testDebugUnitTest |
| 32 | ./gradlew :communicate-dev:lint |
| 33 | ./gradlew :communicate:compileDevKotlin |
| 34 | ./gradlew :communicate:compileReleaseKotlin |
| 35 | ``` |