From 24a311f23461278d7c07b221e3049082ef2b9ec7 Mon Sep 17 00:00:00 2001 From: Wang Zichong Date: Wed, 18 Nov 2026 13:20:20 +0800 Subject: [PATCH] docs: README and PLAN for the MyGo port; sign 0.3.0 release - README describes the MyGo toolchain, the third_party fork's minSdk 24 patch, the cleartext rationale, and the release signing - PLAN.md records the Asuka 0.2 vs MyGo decision and the 0.3.0 status - mygo.json signs with the test keystore and sets an adaptive icon --- PLAN.md | 37 ++++++++++++++++++++++++---- README.md | 74 +++++++++++++++++++++++++------------------------------ mygo.json | 5 +++- 3 files changed, 70 insertions(+), 46 deletions(-) diff --git a/PLAN.md b/PLAN.md index 06e086b..c03d357 100644 --- a/PLAN.md +++ b/PLAN.md @@ -1,13 +1,39 @@ -# OpenChamber 手机客户端(asuka/Go)调研与开发计划 +# OpenChamber 手机客户端(MyGo/Go)开发计划 -> 调研对象:asuka(Go + 原生控件)v0.1.1 / main,OpenChamber 2.7.0,opencode v2.2.7 +> 调研对象:MyGo 0.10.0(Go + 自绘原生 UI)、OpenChamber 2.7.0、opencode v2.2.7 > 目标:Android 优先的手机客户端,MVP = 输入地址 + 密码连接(可选 http/socks5 代理),浏览并操作现有会话 --- -## 0. 结论 +## 0.2 迁移到 MyGo(2026-11-18,分支 `mygo`,0.3.0) -**可行,且 asuka 的覆盖度比预期好。** 但真正的风险不在 UI,而在三处: +**背景**:Asuka 0.2 把应用语言从 Go 换成了自研 Asuka 语言(C 内核、无 Go 运行时),继续留在 Go 线已没有上游维护; +同一作者的 **MyGo 0.10.0 在 2026-11-17 发布了手机端支持**(iOS/Android,纯 Go,GPU 自绘 UI)。评估后选择迁移到 MyGo。 + +**结论与现状**: + +| 项 | 结果 | +| --- | --- | +| Go | mise 升级到 **1.27.4**(MyGo 要求 1.27.3+);`GOROOT` 必须 unset(环境里有旧的 1.26.3 全局 GOROOT) | +| 最低 Android | **24(Android 7.0)**:MyGo 宿主默认 26,`third_party/mygo`(本地 fork)把宿主库的 `minSdk` 改为读 `mygoMinSdk` 属性,并给通知加 API<26 守卫 | +| 复用 | `internal/ocapi`(约 1800 行纯 Go)**原样保留**;`storage` 改为 `connections.json` + `mygo.Secrets`;`appui` 按 MyGo 的 ui API 重写(视图=状态的每帧函数,非信号模型) | +| 明文 HTTP | Go 的 net/http 直接建 socket,绕开 Android 的 cleartext 策略,**release 连 `http://` LAN 服务器无需 manifest 开关**(已实测) | +| 构建 | `go tool mygo build -platform android` 产出 `dist/android/openchamber-0.3.0.apk/.aab`(v0.3.0 / code 300,签名 `~/SDK/test-upload.jks`) | +| 模拟器实测 | 服务器列表→添加/连接(无密码服务器自动跳过密码)→会话列表(搜索/新建/实例切换)→聊天(流式 Markdown、工具行、页脚菜单、上下文占用 Sheet、工具图片预览)全部跑通 | +| 终端 | 暂不做;MyGo 的 Terminal 插件只支持桌面(libghostty-vt 无 Android 库),后续走 native module(Kotlin)或 WebView + xterm.js | +| TTS | MyGo 无朗读 API;`internal/tts` 是一个 Kotlin TextToSpeech 插件(mygo-plugin.json),朗读/停止已接通 | +| a11y | uiautomator 的树在 Android 上只反映首帧(MyGo 宿主同步问题),验证靠截图 + 坐标点击 | + +**为什么不是 Asuka 0.2**:0.2 换语言(Go → Asuka DSL)+ C 内核,等于全量重写一门 alpha 语言;MyGo 保住 Go 和 ocapi, +手机端刚发布(一天)但与我们已验证的 asuka Go 版同样新,且 minSdk 更低、生态(markdown、native module、自动化测试)更贴本项目。 + +--- + +## 0.1 前情(Asuka/Go,2026-11-15 ~ 11-17,`main` 分支 0.2.x) + +> 以下为 asuka 时期的调研与进度,供参考;0.3 起已迁 MyGo。 + +**结论**:asuka(Go + 原生控件)可用来实现本项目,真实风险在三处: 1. **Android 构建链**:本机没有 JDK / Android SDK / NDK。asuka 要求每个平台自己的工具链,第一次搭环境要花半天,且 **asuka v0.1.1 在 Linux 上 `go install` 会编译失败**(`syscall.SO_REUSEPORT`),必须从 `main` 安装。 2. **release 版默认禁止明文 HTTP**:asuka 只在 debug manifest 里开 `usesCleartextTraffic`。连 `http://192.168.x.x:3000` 这类自建服务需要额外处理(加一个只声明 manifest 的 native 包,或统一走 HTTPS)。 @@ -19,7 +45,8 @@ --- -## 0.1 进展(2026-11-15) +### 0.1 进展(2026-11-15) + M0 完成,并继续做到了 M3。所有验证都连的是本机正在运行的 OpenChamber 2.7.0(无密码): diff --git a/README.md b/README.md index 72ce9a0..3b09696 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,36 @@ # OpenChamber Native A lightweight OpenChamber client for phones, written in Go with -[Asuka](https://asuka.egoist.dev/)'s native widgets. Android first. +[MyGo](https://mygo.run/)'s native UI. Android first. -Status: 0.2.2 — multiple saved servers with a connect list (add, edit, -delete, switch; password prompt; 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. +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. ## 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 `asuka/sdk/store`, one device token per server in `asuka/sdk/secure` (Android Keystore), per-install id for device dedupe, migration from the single-server record | -| `internal/appui/` | Screens: connect, sessions, chat (streaming Markdown, reasoning/tool folding, permissions) | +| `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 | ## 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. + ```bash # terminal probe against a running server go run ./cmd/ocprobe -url http://127.0.0.1:3000 health @@ -31,47 +38,34 @@ 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 -# the app on this computer (browser / GTK window) -asuka dev --platform web -asuka dev - # headless tests, including the UI go test ./... -race ``` -`asuka` must be installed from `main`; the v0.1.1 release does not build on -Linux: - -```bash -go install github.com/egoist/asuka/cmd/asuka@main -``` - ## Android -The SDK lives at `~/SDK/AndroidSDK`, the JDKs at `~/SDK/jdk-21` (Gradle) and -`~/SDK/jdk-17` (the Android toolchain; registered in -`~/.gradle/gradle.properties` via `org.gradle.java.installations.paths`). +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 ANDROID_HOME=$HOME/SDK/AndroidSDK export JAVA_HOME=$HOME/SDK/jdk-21 -export PATH=$ANDROID_HOME/platform-tools:$ANDROID_HOME/emulator:$JAVA_HOME/bin:$PATH +export PATH=$ANDROID_HOME/platform-tools:$JAVA_HOME/bin:$PATH -asuka dev --platform android --device emulator-5554 # hot reload -asuka dev --platform android --once --no-vet # build in, launch once +go tool mygo dev -platform android --device emulator-5554 # live reload -# release: a keystore is required -export ASUKA_KEYSTORE=$HOME/SDK/test-upload.jks ASUKA_KEY_ALIAS=upload -export ASUKA_KEYSTORE_PASSWORD=… ASUKA_KEY_PASSWORD=… -asuka build --platform android # dist/OpenChamber.aab +# 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 ``` -`netcfg/` is a native module whose only job is the Android manifest: it merges -`android:usesCleartextTraffic="true"` into **release** builds too, because -self-hosted OpenChamber servers are often plain HTTP on a LAN. Asuka enables it -for debug only. Delete the package (and its blank import in `main.go`) to -require HTTPS everywhere. +`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. -Proxies are entered as `http://host:port` or `socks5://host:port` -(no proxy authentication). Plain `http://` works in debug builds; the release -cleartext policy is decided in M5 (see `PLAN.md`). +The earlier Asuka version of this app lived on the `main` branch; this +branch (`mygo`) is the 0.3 rewrite. diff --git a/mygo.json b/mygo.json index a90a1a2..1068e4f 100644 --- a/mygo.json +++ b/mygo.json @@ -4,6 +4,9 @@ "version": "0.3.0", "out": "dist", "android": { - "minSdk": 24 + "minSdk": 24, + "adaptiveIcon": { "foreground": "resources/icon.png", "background": "#101015" }, + "keystore": "/home/blumia/SDK/test-upload.jks", + "keyAlias": "upload" } }