feat: save several servers and pick one to connect

Match the first-party mobile client's connection screen:

- the first screen lists saved servers, the one last used leading with
  its connect button or connected state, the others below, and adding
  is one tap
- servers can be added, edited (name, address, proxy, self-signed) and
  deleted; deleting the live or last one returns to the list
- a password sheet prompts only when the server asks for one, keeps the
  error and the typed password for a retry
- while connected, the instances sheet switches servers
- proxy and self-signed options stay per server (the native app's own)
- the single-server record and its token migrate automatically
- permission cards read a plain signal, fixing a flaky update
- bump version to 0.1.2 (build 3)
This commit is contained in:
blumia committed 2026-11-16 11:52:38 +08:00
1 parent ef0b63ceee
commit 13aca21d99
12 files changed
+966 -361

No files matched your search

+5 -8
View File
@@ -151,8 +151,7 @@ func TestOpenSessionAndSend(t *testing.T) {
st := &memStore{}
a := uitest.Mount(t, func() ui.Node { return rootWithStore(st) }, uitest.Platform(ui.PlatformAndroid))
a.Type("http://192.168.1.5:3000", srv.URL)
a.Tap("连接")
connectViaForm(t, a, srv.URL)
a.WaitFor("First session")
select {
case <-srv.ready:
@@ -186,8 +185,7 @@ func TestPermissionCardAndReply(t *testing.T) {
srv := newChatServer(t)
// The session list's pending-permission read.
a := uitest.Mount(t, func() ui.Node { return rootWithStore(&memStore{}) }, uitest.Platform(ui.PlatformAndroid))
a.Type("http://192.168.1.5:3000", srv.URL)
a.Tap("连接")
connectViaForm(t, a, srv.URL)
a.WaitFor("First session")
select {
case <-srv.ready:
@@ -199,6 +197,7 @@ func TestPermissionCardAndReply(t *testing.T) {
a.WaitFor("Hello from the agent")
srv.push(`{"id":"evt_10","created":200,"type":"permission.asked","data":{"sessionID":"ses_1","id":"per_1","action":"bash","resources":["npm test"]}}`)
a.Settle()
a.WaitFor("需要权限:bash")
a.Expect("npm test")
@@ -216,8 +215,7 @@ func TestPermissionCardAndReply(t *testing.T) {
func TestSwitchModel(t *testing.T) {
srv := newChatServer(t)
a := uitest.Mount(t, func() ui.Node { return rootWithStore(&memStore{}) }, uitest.Platform(ui.PlatformAndroid))
a.Type("http://192.168.1.5:3000", srv.URL)
a.Tap("连接")
connectViaForm(t, a, srv.URL)
a.WaitFor("First session")
a.Tap("First session")
a.WaitFor("Hello from the agent")
@@ -240,8 +238,7 @@ func TestSwitchModel(t *testing.T) {
func TestCreateSession(t *testing.T) {
srv := newChatServer(t)
a := uitest.Mount(t, func() ui.Node { return rootWithStore(&memStore{}) }, uitest.Platform(ui.PlatformAndroid))
a.Type("http://192.168.1.5:3000", srv.URL)
a.Tap("连接")
connectViaForm(t, a, srv.URL)
a.WaitFor("First session")
a.Tap("新建")