feat: port the client to MyGo native UI (0.3.0)

Switch from Asuka to MyGo, keeping the API client and the feature set:

- servers: saved servers, passwordless and password login, proxy,
  self-signed certificates, per-server device tokens (Keystore), connect
  form, instance list sheet with switch/disconnect
- sessions: virtualized list, search, new session, rename/archive/delete,
  running indicator, event stream keeps it live
- chat: pushed window with system back bar, streaming Markdown via
  ui/markdown, reasoning and tool rows with image previews, footer menu
  (read aloud via a Kotlin TTS plugin, copy, fork), user message menu
  (copy, revert, fork), context usage ring and detail sheet, attachments
  (photos/files via the document picker), permissions
- release builds allow plain http:// LAN servers (Go's net/http dials
  directly, no cleartext manifest needed)
- a local fork of MyGo (third_party/mygo) lowers the Android host's
  minSdk to 24 (Android 7.0); Go 1.27.4 via mise

Version 0.3.0.
This commit is contained in:
OpenChamber committed 2026-11-18 13:22:59 +08:00
1 parent 2fb4a8ea79
commit 6c0ee61750
2538 files changed
+675779 -4792

No files matched your search

+57
View File
@@ -0,0 +1,57 @@
//go:build !js
package mygo
import (
"slices"
"strings"
"testing"
)
// Services, events and plugins are registered for the whole process. These
// helpers register them for one test and remove them when it ends, so the
// tests can run again (go test -count).
// bindForTest is BindAs for the duration of t.
func bindForTest(t testing.TB, name string, svc any) {
t.Helper()
BindAs(name, svc)
t.Cleanup(func() { unbind(name) })
}
// newEventForTest is NewEvent for the duration of t.
func newEventForTest[T any](t testing.TB, name string) *Event[T] {
t.Helper()
e := NewEvent[T](name)
t.Cleanup(func() {
ipc.Lock()
defer ipc.Unlock()
ipc.events = slices.DeleteFunc(ipc.events, func(e *eventInfo) bool { return e.name == name })
})
return e
}
// useForTest is Use for the duration of t. Plugins that fail are removed
// too.
func useForTest(t testing.TB, p Plugin) {
t.Helper()
t.Cleanup(func() {
plugins.Lock()
delete(plugins.used, p.Name)
plugins.Unlock()
unbind(pluginPrefix + p.Name)
})
Use(p)
}
// unbind removes the service name.
func unbind(name string) {
ipc.Lock()
defer ipc.Unlock()
ipc.services = slices.DeleteFunc(ipc.services, func(s *service) bool { return s.name == name })
for m := range ipc.methods {
if strings.HasPrefix(m, name+".") {
delete(ipc.methods, m)
}
}
}