feat: port the client to Flutter (0.3.0)
Replace the MyGo/Go app with a Flutter client that keeps the feature set: - servers: saved servers, passwordless and password login, HTTP/SOCKS5 proxy via dart:io, self-signed certificates and pinning, tokens in flutter_secure_storage (Keystore) - sessions: list with live events, search, new/rename/archive/delete, instance sheet - chat: streaming Markdown (flutter_markdown), reasoning and tool rows, image previews, context usage ring and sheet, model/agent switching, fork/revert, attachments (file_picker), permissions - Android 7.0 (API 24)+, plain http:// works in release (Dart dials sockets directly) - build: China mirrors for Gradle/NDK, Aliyun Maven repositories, and the Gradle distribution pre-seeded; release signed with the test keystore Read-aloud is dropped as requested. Version 0.3.0.
This commit is contained in:
1 parent
24a311f234
commit
aee560172c
2616 files changed
+5810
-672083
No files matched your search
@@ -1,71 +1,48 @@
|
||||
# OpenChamber Native
|
||||
|
||||
A lightweight OpenChamber client for phones, written in Go with
|
||||
[MyGo](https://mygo.run/)'s native UI. Android first.
|
||||
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.0 — multiple saved servers with a connect list (add, edit,
|
||||
delete, switch; passwordless and password login; HTTP or SOCKS5 proxy and
|
||||
self-signed certificates per server), session search, live session list,
|
||||
chat with streaming Markdown, image and file attachments with inline
|
||||
previews, a context usage ring with a detail sheet, previews of images
|
||||
named by tool calls, permissions, model/agent switching, turn and prompt
|
||||
actions (copy, fork, revert, read aloud), new sessions,
|
||||
archive/delete/rename, the OpenChamber icon, and a UI-independent API
|
||||
client. Android 7.0 (API 24) and later.
|
||||
Status: 0.3.0 — servers (passwordless / password login, HTTP/SOCKS5 proxy,
|
||||
self-signed certificates and pinning), session list with search and live
|
||||
events, chat with streaming Markdown, tool rows with image previews, a
|
||||
context usage ring with a detail sheet, model/agent switching, copy / fork /
|
||||
revert, attachments (photos/files), permissions. Android 7.0 (API 24)+.
|
||||
|
||||
## What is here
|
||||
|
||||
| Path | What |
|
||||
| --- | --- |
|
||||
| `internal/ocapi/` | OpenChamber HTTP client: auth (password → device token), sessions, messages, prompt/interrupt/model/agent, permissions, SSE events, HTTP/SOCKS5 proxy, certificate pinning |
|
||||
| `internal/storage/` | Saved servers in `connections.json` (app data), one device token per server in `mygo.Secrets` (Android Keystore), per-install id for device dedupe |
|
||||
| `internal/appui/` | Screens: servers, sessions, chat (streaming Markdown via `ui/markdown`, reasoning/tool folding, permissions, context usage, previews) |
|
||||
| `internal/tts/` | A Kotlin TextToSpeech plugin (read-aloud), compiled into the app by `mygo build` |
|
||||
| `third_party/mygo/` | A small local fork of MyGo 0.10.0: its Android host's `minSdk` reads the `mygoMinSdk` property (24), and notifications are guarded for API < 26 |
|
||||
| `cmd/ocprobe/` | Terminal probe used to validate the API without a device |
|
||||
| `PLAN.md` | Research, API contract, architecture, milestones, risks |
|
||||
| `lib/api/` | Dart OpenChamber client: auth, sessions, messages, SSE, models/agents, permissions, prompt/interrupt/fork/revert, `/api/fs/raw`; HTTP proxy via `HttpClient.findProxy`, SOCKS5 via dart:io's SOCKS, pinning/self-signed via `badCertificateCallback` |
|
||||
| `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/screens/` | Servers, sessions, chat (streaming Markdown via `flutter_markdown`, composer, sheets) |
|
||||
| `lib/widgets/` | The context usage ring |
|
||||
|
||||
Read-aloud (TTS) is intentionally **not** implemented (matching the original).
|
||||
|
||||
## Run
|
||||
|
||||
MyGo requires **Go 1.27.3+**; install it with mise (`mise install go@1.27.4`),
|
||||
and make sure a stale `GOROOT` env var is not set. The `mygo` CLI is pinned as
|
||||
a Go tool in `go.mod` and builds from the local fork.
|
||||
Flutter 3.50 (stable) lives at `~/SDK/flutter`; artifacts use the China
|
||||
mirrors.
|
||||
|
||||
```bash
|
||||
# terminal probe against a running server
|
||||
go run ./cmd/ocprobe -url http://127.0.0.1:3000 health
|
||||
go run ./cmd/ocprobe -url http://127.0.0.1:3000 -limit 5 sessions
|
||||
go run ./cmd/ocprobe -url http://127.0.0.1:3000 -password secret sessions
|
||||
go run ./cmd/ocprobe -url http://127.0.0.1:3000 -seconds 20 events
|
||||
|
||||
# headless tests, including the UI
|
||||
go test ./... -race
|
||||
```
|
||||
|
||||
## Android
|
||||
|
||||
The SDK lives at `~/SDK/AndroidSDK`, the JDK for Gradle at `~/SDK/jdk-21`.
|
||||
|
||||
```bash
|
||||
export PATH=$HOME/.local/share/mise/installs/go/1.27.4/bin:$PATH
|
||||
unset GOROOT
|
||||
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
|
||||
export PATH=$ANDROID_HOME/platform-tools:$JAVA_HOME/bin:$PATH
|
||||
|
||||
go tool mygo dev -platform android --device emulator-5554 # live reload
|
||||
|
||||
# release: dist/android/openchamber-0.3.0.apk and .aab
|
||||
export MYGO_ANDROID_KEYSTORE_PASSWORD=… MYGO_ANDROID_KEY_PASSWORD=…
|
||||
go tool mygo build -platform android
|
||||
flutter pub get
|
||||
flutter test
|
||||
flutter build apk --release # dist artifacts in build/app/outputs/flutter-apk
|
||||
```
|
||||
|
||||
`android.minSdk` is 24 (Android 7.0). Release builds talk to plain `http://`
|
||||
LAN servers: the Go HTTP client dials sockets itself, so Android's cleartext
|
||||
policy (which applies to platform HTTP libraries) never sees the traffic —
|
||||
no manifest flag is needed. The local fork exists only to let the MyGo host
|
||||
build with `minSdk 24` (upstream pins 26) and to guard its notification code
|
||||
on API < 26.
|
||||
`android/app/build.gradle.kts` sets `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.
|
||||
|
||||
The earlier Asuka version of this app lived on the `main` branch; this
|
||||
branch (`mygo`) is the 0.3 rewrite.
|
||||
Earlier attempts: `main` (Asuka/Go, 0.2.x) and `mygo` (MyGo, 0.3.0).
|
||||
Reference in new issue
Block a user