Native mobile applications are product entrypoints under src/apps/mobile.
- Keep Android, iOS, and HarmonyOS lifecycle and platform API usage inside the corresponding platform directory.
- Keep reusable product logic platform-agnostic and expose it through stable contracts or adapters.
- Do not import implementation details from
src/apps/desktoporsrc/web-ui. - Treat remote workspace support as part of feature design. Gate unsupported behavior with a clear user-facing state.
- Keep credentials, signing files, provisioning profiles, device identifiers, and local SDK paths out of the repository.
- Add platform-specific build and verification commands here when a native toolchain is selected.
| Directory | Ownership |
|---|---|
android/ |
Android app, resources, lifecycle, and adapters |
ios/ |
iOS app, resources, lifecycle, and adapters |
harmonyos/ |
HarmonyOS app, resources, lifecycle, and adapters |
shared/ |
Kotlin Multiplatform core: protocol, crypto, transport, persistence, domain, feature stores |
miniapps/ |
Build-time packaging and isolated document bridge for product-owned offline tools; native storage and WebView lifecycle stay in each app |
design-system/ |
HarmonyOS-derived mobile tokens, component contracts, deterministic preview scenarios, and the desktop comparison surface |
HarmonyOS is the visual reference implementation. Stable colors, typography,
geometry, breakpoints, motion durations, component anatomy, and comparison
scenarios are recorded under design-system/; Android and iOS consume generated
native constants but continue to render with Compose and SwiftUI respectively.
Do not introduce a shared cross-platform renderer or make generated files the
source of truth.
- Change the HarmonyOS implementation and the source contract together when a stable visual fact changes.
- Run
pnpm run mobile:ui:generateafter contract changes and commit the generated native files. - Run
pnpm run mobile:ui:checkbefore pushing to reject generated drift. - Use
pnpm run mobile:ui:previewfor the local three-column HarmonyOS / Android / iOS comparison surface. Native captures belong under the documenteddesign-system/preview/snapshots/convention and are local evidence unless a fixture is intentionally reviewed into the repository. - Keep safe areas, keyboard behavior, accessibility, navigation gestures, and platform presentation primitives in each native app.
shared/ holds the Kotlin Multiplatform modules that android/ and ios/
build on. core-feature is the platform seam: everything the apps see is a
UiState or an Intent declared there, and no module above it is visible to them.
android/andios/may depend onshared/.shared/must not depend on any platform directory, andharmonyos/andshared/do not depend on each other.android/is its own build root and pullsshared/in withincludeBuild("../shared"), so the arrow points one way only: the app knows the shared build, never the reverse. That makes app dependencies read as coordinates —implementation("com.openbitfun.mobile:core-feature")— rather thanproject(":core-feature"). Both spellings are subject to the seam rule below.core-featureis the only shared module the apps may reference. Everything crossing that seam is a UiState or an Intent, never a repository or a DTO.core-domainis pure logic. Transport and persistence are adapters behind ports it declares, wired bycore-feature.- Shared code returns typed states, never localized display strings; the apps own all user-facing text.
- Remote session content is read on demand from the online desktop
(
core-transport/.../HostStream.kt,read_streamdevice RPC plus encryptedhost-stream-changedhints). The relay stores none of it and the apps keep no relay stream replica: aSTREAM_EVENT_GAPmeans the desktop restarted the stream and derived state must be dropped, and a host withouthost_stream_v1is surfaced asRemoteSessionFailureReason.HOST_STREAM_UNSUPPORTED, never probed with unknown commands. Do not reintroducerelay_stream_*tables. - Run
pnpm run mobile:architecturebefore pushing. It enforces the rules above, mirroringpnpm run harmony:architecture. - Build and test from
shared/:./gradlew jvmTestfor host logic,./gradlew assembleAndroidMain testAndroidHostTestfor Android, and./gradlew compileKotlinIosSimulatorArm64for iOS. Run iOS pure Swift infrastructure checks from the repository root with(cd src/apps/mobile/ios && ./Testing/run-pure-swift-tests.sh). The isolated native streaming fixture (no remote requests) is covered byxcodebuild -project src/apps/mobile/ios/OpenBitFun.xcodeproj -scheme OpenBitFun -configuration Debug -destination 'platform=iOS Simulator,name=iPhone 16 Plus' -parallel-testing-enabled NO -only-testing:OpenBitFunUITests/StreamingPresentationUITests test. Run it on one phone and one iPad destination when changing timeline layout, streaming reveal, keyboard dismissal, or history anchoring. The Debug-only launch argument--streaming-regressionopens the same deterministic fixture.local.propertiesholds the local SDK path and is not committed. - The Android app builds from
android/:./gradlew :app:assembleDebugand:app:installDebug; release verification is./gradlew :app:assembleRelease. Release builds use the standard local Android debug keystore when formal signing credentials are absent; all fourOPENBITFUN_ANDROID_KEYSTORE,OPENBITFUN_ANDROID_KEYSTORE_PASSWORD,OPENBITFUN_ANDROID_KEY_ALIAS, andOPENBITFUN_ANDROID_KEY_PASSWORDenvironment variables override it. Signing files and values must never be committed. AGP 9 compiles Kotlin itself — applyingorg.jetbrains.kotlin.androidis an error, not a no-op, andkotlin { jvmToolchain(...) }is no longer available in an app module. - Crypto and transport also run on a device:
./gradlew :core-crypto:connectedAndroidDeviceTest :core-transport:connectedAndroidDeviceTestfromshared/, with an emulator or handset attached. Those suites compile the samecommonTestsources onto ART; they are not in CI, so run them by hand when touching either module.
For chat Markdown ranges, double-tilde strikethrough, escapes and streaming
prefixes, run from shared/ with the Android guide's Java runtime:
./gradlew :core-feature:jvmTest --tests '*MarkdownParserTest*'.
Android and iOS share this parser; their native inline renderers own styles.
For next-input suggestion replay, stale-turn retirement, host restart and session
isolation, run from shared/ with the Android guide's Java runtime:
./gradlew :core-feature:jvmTest --tests '*promptSuggestion*' --tests '*SessionRecordReplicaTest*'.
These are simulated host streams, not evidence of a live remote connection.
Native mobile remote surfaces are controllers. Desktop and CLI own remote execution, files, terminals and SSH credentials. Mobile workspace selection may use only connections already saved on the controlled runtime; it must not create an SSH connection or instantiate another runtime. Carry the selected connection identity through every operation, and report missing identity instead of falling back to local files.
Android preBuild and the iOS resource phase run miniapps/generate.cjs (Node.js
must be on PATH). Generated native HTML is ignored; update product-owned built-in
sources or the packaging owner, never the generated resources. Harmony retains
its existing native host and invokes the same generator without native wrappers.
Run node --test src/apps/mobile/miniapps/*.test.cjs src/apps/mobile/harmonyos/miniapps/*.test.cjs
from the repository root after bundle/bridge changes. Storage keys remain scoped
to an allowlisted app; retain unreadable records and surface the error.
For host-queue negotiation, stale replies, disconnect retention and mutation
conflicts, run from shared/:
./gradlew :core-feature:jvmTest --tests '*MessageQueueStoreTest*'These simulated-host tests do not establish live Relay, SSH, Peer Device or Detached Dispatch behavior. Queue ordering belongs to the execution host; native views submit intents and never optimistically replace its order.