2026-11-16 09:09:09 +08:00
# OpenChamber Native
2026-11-18 19:08:06 +08:00
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.
2026-11-16 09:09:09 +08:00
2026-11-22 16:51:44 +08:00
Status: 0.4.4 — servers (passwordless / password login, HTTP/HTTPS and
SOCKS5/socks5h proxy, self-signed certificates and pinning, or a pairing link
over the OpenChamber private relay with end-to-end encryption), session list with search and live
2026-11-19 14:58:18 +08:00
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,
2026-11-21 01:16:10 +08:00
current one checked), copy / fork / revert, attachments (photos/files, kept
2026-11-21 02:49:07 +08:00
after a reload), the agent's native forms, permissions. The files sidebar also
2026-11-21 11:09:44 +08:00
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
2026-11-22 15:23:21 +08:00
show their progress and can be cancelled. The terminal holds several tabs per
project, switched from a dropdown next to the status (new tab included), and
remembers them per connection and directory: reopening after an app restart
attaches to the shells the server still holds instead of starting new ones. The panel is a tab row with its own
2026-11-21 14:29:52 +08:00
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
2026-11-21 17:03:22 +08:00
grouped by project with date captions, pins, archive and swipe actions. The
2026-11-21 18:32:57 +08:00
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
2026-11-22 11:59:33 +08:00
pending bubble that can be withdrawn; while a turn runs, an activity strip above
the input names the current step and its clock instead of the finished turn's
2026-11-22 13:39:49 +08:00
footer. Pets are opt-in: nothing is built in, and a dsh-Go sprite pack (a zip
with pack.json) is imported from Settings → 宠物 to stand above the input and
2026-11-22 14:30:30 +08:00
react to the turn's mood. The pet floats over the messages (only its body
takes touches) and can be dragged along the input's top edge; the spot is
remembered on the device. The picker groups providers, favourites,
2026-11-21 19:17:22 +08:00
recents and context size. The sidebar footer names the connected server (tap to
switch) beside a settings key; settings holds appearance (theme mode and seed
colour, device-local), the server's follow-up behavior (steer or queue on a send
while a turn runs) and a pet placeholder. A
2026-11-21 02:49:07 +08:00
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.
2026-11-16 09:09:09 +08:00
## What is here
| Path | What |
| --- | --- |
2026-11-21 01:16:10 +08:00
| `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 |
2026-11-18 19:08:06 +08:00
| `lib/storage.dart` | Saved servers in `shared_preferences` , tokens in `flutter_secure_storage` (Android Keystore) |
2026-11-21 19:17:22 +08:00
| `lib/state.dart` | The app state: connections, live sessions, the open chat, the server's follow-up behavior, and SSE event folding |
| `lib/appearance_prefs.dart` | Device-local theme mode and seed colour (`shared_preferences` ) |
2026-11-22 13:39:49 +08:00
| `lib/pets/` | Imported pet packs: the dsh-Go `pack.json` sprite format, unpacked into the app's documents, plus the one-sheet image cache |
| `lib/widgets/pet_sprite.dart` | The pet strip above the composer and its sprite player (frames, moods, tap reactions) |
2026-11-22 15:23:21 +08:00
| `lib/terminal_state.dart` | Terminal workspaces and tabs: each tab is an xterm model plus its `/api/terminal/ws` socket; switching detaches the old tab, the saved tab list lets a restart reattach |
2026-11-21 02:49:07 +08:00
| `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 |
2026-11-18 19:08:06 +08:00
| `lib/widgets/` | The context usage ring |
2026-11-18 20:11:49 +08:00
Markdown rendering reuses ** `gpt_markdown` ** (BSD-3), the Flutter AI-output renderer
that [dsh-Go ](https://github.com/ccch1mneyyy/dsh-go ) uses: streaming-friendly,
2026-11-18 20:48:12 +08:00
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).
2026-11-16 09:09:09 +08:00
## Run
2026-11-18 19:08:06 +08:00
Flutter 3.50 (stable) lives at `~/SDK/flutter` ; artifacts use the China
mirrors.
2026-11-18 13:20:20 +08:00
2026-11-16 09:09:09 +08:00
```bash
2026-11-18 19:08:06 +08:00
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
2026-11-16 09:09:09 +08:00
export ANDROID_HOME = $HOME /SDK/AndroidSDK
export JAVA_HOME = $HOME /SDK/jdk-21
2026-11-18 19:08:06 +08:00
flutter pub get
flutter test
flutter build apk --release # dist artifacts in build/app/outputs/flutter-apk
2026-11-19 12:34:25 +08:00
flutter build linux --debug # faster UI checks on the desktop
2026-11-16 09:09:09 +08:00
```
2026-11-19 12:34:25 +08:00
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:
```bash
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.
2026-11-18 22:18:45 +08:00
`android/app/build.gradle.kts` sets the application id
`net.blumia.openchamber.flutter` , `minSdk 24` , and signs releases with
2026-11-18 19:08:06 +08:00
`~/SDK/test-upload.jks` (override via `OPENCHAMBER_KEYSTORE*` env). Dart's
`HttpClient` dials sockets itself, so plain `http://` LAN servers work in
2026-11-18 22:18:45 +08:00
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.
2026-11-16 09:09:09 +08:00
2026-11-18 19:08:06 +08:00
Earlier attempts: `main` (Asuka/Go, 0.2.x) and `mygo` (MyGo, 0.3.0).