Files
openchamber-android-native/README.md
T
blumia 1aa84a53e5 feat: queue a message for the running turn, and fold the composer when the IME closes
- A send while a turn runs joins it (delivery "steer") on a short press; a
  long press offers steer or queue. Queue/steer prompts wait in the server's
  inbox and show as a pending bubble at the end of the transcript, with
  改为排队/转为转向 and 撤回 (which puts the text back into the composer).
  The inbox is read on open and resume and kept current by the
  session.inbox.* events; delivery reloads the tail.
- The send key is stop only while running with an empty draft; with text it
  sends (as dsh-Go does), leaving the long press for the delivery choice.
- The composer also folds to one line when the phone's back gesture closes
  the keyboard while the field keeps focus: the page passes the keyboard
  height (a Scaffold strips the bottom inset from its body) and the composer
  treats a fall below half the peak as a dismissal.
- The Build/Plan chip now opens a bottom sheet with icons, hints and a check,
  instead of a popup menu.
- Tests: composer_box_test (focus opens, IME dismissal folds, typing reopens)
  and inbox_item_test (list items, enqueued events, delivery changes).
- 0.3.16 (316).
2026-11-21 18:32:57 +08:00

5.5 KiB

OpenChamber Native

A lightweight OpenChamber client for phones, written in Flutter (Dart). Android first. This branch (flutter) is a framework evaluation: the same feature set as the earlier Asuka/Go and MyGo attempts, reimplemented in Flutter to compare mobile UI maturity.

Status: 0.3.16 — servers (passwordless / password login, HTTP/HTTPS and SOCKS5/socks5h proxy, self-signed certificates and pinning), session list with search and live events, chat with streaming Markdown and full history paging, tool steps grouped per turn (icon, one-line summary, foldable run) with image previews, a context usage ring with a detail sheet, model/agent switching (Build/Plan only, current one checked), copy / fork / revert, attachments (photos/files, kept after a reload), the agent's native forms, permissions. The files sidebar also carries the project knowledge (notes, todos, plans, and agent memory when the server enables it) and a full terminal with a Termux-style key bar; downloads show their progress and can be cancelled. The panel is a tab row with its own close button, and each tab has its own header row. Starting a session opens a draft that only creates the session on the first send; the session list is grouped by project with date captions, pins, archive and swipe actions. The composer folds to one line when unfocused (or when the keyboard is dismissed) and opens into two rows on focus, as in dsh-Go: the model and its thinking level form one pill, the Build/Plan mode a separate chip (picked from a sheet). A message sent while a turn runs can steer it or queue for its end, and waits as a pending bubble that can be withdrawn. The picker groups providers, favourites, recents and context size. A phone opens the session list as the left drawer and a wide window (tablet, desktop) shows it beside the chat. Android 7.0 (API 24)+, plus a Linux desktop target used for local testing.

What is here

Path What
lib/api/ Dart OpenChamber client: auth, sessions, messages, SSE, models/agents, forms, permissions, prompt/interrupt/fork/revert, /api/fs/raw; every request goes through Transport (today DirectTransport: HTTP/HTTPS proxies via HttpClient.findProxy, SOCKS5/socks5h via socks5_proxy, pinning/self-signed via badCertificateCallback), so a relay tunnel only adds an implementation
lib/storage.dart Saved servers in shared_preferences, tokens in flutter_secure_storage (Android Keystore)
lib/state.dart The app state: connections, live sessions, the open chat, and SSE event folding
lib/terminal_state.dart The terminal session: an xterm model plus the /api/terminal/ws socket (binary control frames), kept per workspace so closing the panel keeps the shell
lib/screens/ Servers, the connected shell (home_screen.dart: drawer on a phone, two columns from 840 px), sessions, chat (streaming Markdown via gpt_markdown, composer, sheets, the native form dock, the files sidebar with the knowledge and terminal tabs); the message list is reversed so older pages grow above without moving the viewport
lib/widgets/ The context usage ring

Markdown rendering reuses gpt_markdown (BSD-3), the Flutter AI-output renderer that dsh-Go uses: streaming-friendly, syntax-highlighted code blocks with copy, tables, LaTeX and task lists. The input bar and the model chip follow dsh-Go's composer design (MIT, referenced rather than copied): a rounded capsule, a leading attach key, an auto-growing borderless field, the usage ring, and a 36px send/stop key that morphs while a turn runs. Read-aloud (TTS) is intentionally not implemented (matching the original).

Run

Flutter 3.50 (stable) lives at ~/SDK/flutter; artifacts use the China mirrors.

export PATH=$HOME/SDK/flutter/bin:$PATH
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export ANDROID_HOME=$HOME/SDK/AndroidSDK
export JAVA_HOME=$HOME/SDK/jdk-21

flutter pub get
flutter test
flutter build apk --release     # dist artifacts in build/app/outputs/flutter-apk
flutter build linux --debug     # faster UI checks on the desktop

The Linux build only needs a C toolchain and GTK 3 development headers; on this machine clang was extracted into ~/SDK/localbin (from the clang-17 package) and the two missing -dev files (libsecret-1-dev, libjsoncpp-dev) into ~/SDK/linuxdev, so:

export PATH=$HOME/SDK/localbin:$HOME/SDK/flutter/bin:$PATH
export PKG_CONFIG_PATH=$HOME/SDK/linuxdev/usr/lib/x86_64-linux-gnu/pkgconfig
export LIBRARY_PATH=$HOME/SDK/linuxdev/usr/lib/x86_64-linux-gnu
flutter build linux --debug
DISPLAY=:99 GDK_BACKEND=x11 ./build/linux/x64/debug/bundle/openchamber

tool/history_probe.dart pages a session exactly as the chat does and reports whether every message is reached.

android/app/build.gradle.kts sets the application id net.blumia.openchamber.flutter, minSdk 24, and signs releases with ~/SDK/test-upload.jks (override via OPENCHAMBER_KEYSTORE* env). Dart's HttpClient dials sockets itself, so plain http:// LAN servers work in release without a cleartext manifest flag, as with the Go clients. Only a working connection is saved: a failed attempt stays in the form.

Proxies accept http://, https://, socks5:// and socks5h:// (the last two resolve names at the proxy). tool/proxy_probe.dart checks the client against a live server through local test proxies.

Earlier attempts: main (Asuka/Go, 0.2.x) and mygo (MyGo, 0.3.0).