Skip to main content

Clients and device bridges

One Flutter codebase builds the web, Android and desktop apps; native code covers what Flutter cannot, and every client talks to the same server API.

Targets​

TargetBuildNotes
Webflutter build web into server/publicServed at /app; built by the release pipeline only
Androidflutter build apkApplication ID com.neoagent.flutter_app
Android launcherNEOAGENT_ANDROID_LAUNCHER_MODE=true, -t lib/main_launcher_entry.dartApplication ID com.neoagent.flutter_app.launcher; replaces the home screen
macOS, Windows, Linuxflutter build macos, windows, linuxCan install a local server and act as the local computer
Wearablefirmware/neoagent_wearable_esp32s3_amoled (ESP-IDF)ESP32-S3, push-to-talk voice
  • No iOS. There is no iOS build.
  • Release names. Android releases ship neoagent-android-<version>.apk and neoagent-android-launcher-<version>.apk.

App structure​

PieceLocation
Root stateMainController in lib/main_controller.dart, the only global ChangeNotifier
Screenslib/main_*.dart (parts of lib/main.dart) and lib/features/
Platform logiclib/src/*_bridge.dart and lib/src/*_service.dart
Platform variants_io, _web and _stub files behind conditional exports
HTTPlib/src/backend_client.dart on lib/src/network/app_http_client*.dart
Real timesocket_io_client; events update MainController, which notifies the UI
Stringslib/l10n/app_en.arb, lib/l10n/app_de.arb, generated into lib/l10n/gen/
  • Discovery. Desktop and mobile apps find servers on the LAN over mDNS (_neoagent._tcp.local) and confirm with GET /api/setup/handshake.
  • Setup contract. lib/src/setup_contract.g.dart is generated from lib/setup/contract.json by scripts/generate_setup_contract.js.

QR pairing​

Two directions, both ending in a normal session.

DirectionShows the codeScans itServer
Pair a phoneA signed-in screen: Settings › Sign-in & security › Pair a phoneThe phone app's sign-in or server screen, Scan QR codeservices/account/pairing.js
QR loginA signed-out screen's sign-in card, or the wearableA signed-in phone, Scan login QRservices/account/qr_login.js
  • Pair a phone. POST /api/account/pairing returns a single-use code that lives five minutes (only its hash is stored) and neoagent://pair?server=<public URL>&code=<code>. The server is PUBLIC_URL with its base path. The dialog polls GET /api/account/pairing/:code until the phone redeems the code at POST /api/auth/pair, which signs it in.
  • No camera. The dialog also shows <server>/app/pair?code=…. Opened in a phone browser, it offers to open the app (neoagent://pair) or download it; pasted into the server field of the setup screen, it signs in the same way.

Android native code​

Kotlin lives in android/app/src/main/kotlin/com/neoagent/flutter_app/.

FeatureNative sideFlutter side
Agent callstelecom/NeoAgentConnectionService.kt, call/CallBridge.kt (channel neoagent/telecom)lib/src/call/call_bridge.dart, lib/src/telecom_bridge.dart
Health Connecthealth/HealthSyncWorker.kt posts to /api/mobile/health/synclib/src/health_bridge.dart
Home widgetswidgets/StatusWidgetProvider.kt, widgets/CallWidgetProvider.ktlib/src/home_widget_bridge.dart
LauncherChannels neoagent/launcher_device, neoagent/launcher_buttonslib/src/android_launcher_bridge.dart
Live voice audiovoice/VoicePcmPlayer.kt (channel neoagent/voice_audio)lib/src/live_voice_player.dart
Notificationsnotification_listener_service pluginlib/features/notifications/ posts to /api/triggers/notification
Locationgeolocator pluginGeofence events post to /api/triggers/geofence
  • Background work. Health sync and widget refresh run in WorkManager jobs and call the server natively while the app is closed.
  • Calls. call_user emits voice:incoming_call; Android rings through the Telecom ConnectionService, and accepting opens a live voice session.

Cloud computer display​

  1. The app asks for a display session; the server issues a token valid for 5 minutes.
  2. The noVNC client loads from /api/computer/novnc.
  3. It connects to /api/computer/display-ws with the token and the session cookie.
  4. Input is accepted only while the user holds the control lease.

Local computer​

  • Registration. Desktop apps connect outbound to /api/computer/local/ws with the signed-in session.
  • Implementation. lib/src/desktop_companion_io.dart; screen capture in lib/src/desktop_screen_capture_io.dart.
  • Permissions. screen, input, files and shell, each granted once or always, denied or revoked in the app.
  • Limits. Web and mobile clients can select or watch the cloud computer but cannot register as the local computer.
  • Details. See Runtime and tool execution.

Local server install​

Desktop apps can install the server on the same machine from the signed runtime; see Runtime packaging and trust.

Wearable​

  • Gateway. The ESP32-S3 wearable connects to /api/wearable/ws with a session and streams push-to-talk audio into a live voice session.
  • Firmware updates. services/wearable/firmware_manifest.js reads neoagent-wearable-firmware.bin from GitHub releases.
  • Flashing. scripts/flash_wearable.sh builds and flashes a connected board with ESP-IDF.

ADB device control​

ADB control is a server capability that drives an emulator or a device attached to the NeoAgent host, independent of the Flutter Android app (details).

Mascot​

The live mascot (user guide) is a 9×9 dot-matrix face drawn from one frame table.

FileRole
lib/src/mascot/mascot_frames.dartFrames and clips for each mood (source of truth)
lib/src/mascot/mascot_mood.dartMascotMood and MascotMoodStabilizer (dwell times, one-shot done and blocked)
lib/src/mascot/neo_mascot.dartNeoMascot widget: frames step on timers, only cross-fades use the ticker
lib/main_mascot.dartMaps controller state to a mood and drives _LiveMascot
tool/render_widget_faces.dartRenders the Android home-widget faces from the Dart frames
Frame tables are duplicated

landing/js/mascot.js (landing page) and firmware/neoagent_wearable_esp32s3_amoled/components/mascot/mascot_frames.c (wearable) copy the Dart frames, so change all three together.