feat: one server button, and only primary agents to pick
The session screen now has a single server icon that opens the instance list; picking an instance drops the live connection and connects to it, and disconnecting moved into that list. A custom SVG rack stands in for the missing server symbol on Android. The agent sheet lists primary agents only: a session cannot run a subagent (General, Explore) as its own agent. Bump version to 0.1.5 (build 6).
This commit is contained in:
1 parent
9d9678e294
commit
e240a33e31
8 files changed
+76
-10
No files matched your search
@@ -41,6 +41,8 @@ M0 完成,并继续做到了 M3。所有验证都连的是本机正在运行
|
||||
| 权限审批 | 聊天页内联卡片(允许一次/总是允许/拒绝),启动时补齐待批列表,SSE 实时增删 |
|
||||
| 多实例 | 保存多个服务器,按最近使用排序;首屏选择连接,连接后可切换;添加/编辑/删除;从旧的单连接记录自动迁移 |
|
||||
| 连接界面(对齐官方) | 首连引导 →「手动输入地址」;有保存时列表:最近使用的置顶卡片(连接/已连接)、其他服务器、添加按钮;每行「…」菜单(连接/编辑/删除,删除二次确认);密码按需弹层、失败保留并可从表单重试;连接失败时回到表单并保留输入 |
|
||||
| 顶栏服务器入口 | 会话页只保留一个「服务器」图标按钮,打开实例列表;点选实例即断开当前连接并连到所选实例;「断开当前连接」移入实例列表 |
|
||||
| Agent 选择 | 只列 `mode=primary` 的 Agent,子智能体(General/Explore)不再出现 |
|
||||
| 模型/Agent | 聊天页顶栏打开选择 Sheet(可搜索),切换后同步会话列表 |
|
||||
| 新建会话 | 会话页「新建」:标题 + 工作目录(服务端默认目录与已加载会话的目录),创建后直接进入聊天 |
|
||||
| 下一步 | 打磨:图标/splash、中英 i18n、空态与错误页;可选 fork asuka 支持更低 minSdk |
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "OpenChamber",
|
||||
"id": "com.openchamber.native",
|
||||
"version": "0.1.4",
|
||||
"build": 5,
|
||||
"version": "0.1.5",
|
||||
"build": 6,
|
||||
"orientations": ["portrait", "landscape"]
|
||||
}
|
||||
@@ -495,7 +495,9 @@ func (ch *chat) openPicker(kind string) {
|
||||
var agents []ocapi.AgentInfo
|
||||
agents, err = client.Agents(ctx, ch.dir)
|
||||
for _, a := range agents {
|
||||
if a.Hidden {
|
||||
// A session runs a primary agent; subagents are what the
|
||||
// primary one delegates to.
|
||||
if a.Hidden || a.Mode == "subagent" {
|
||||
continue
|
||||
}
|
||||
items = append(items, pickerItem{
|
||||
|
||||
@@ -87,7 +87,11 @@ func newChatServer(t *testing.T) *chatServer {
|
||||
{"id":"claude","providerID":"anthropic","name":"Claude"}]}`)
|
||||
})
|
||||
mux.HandleFunc("/api/agent", func(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprint(w, `{"data":[{"id":"build","name":"Build"},{"id":"plan","name":"Plan"}]}`)
|
||||
fmt.Fprint(w, `{"data":[
|
||||
{"id":"build","name":"Build","mode":"primary"},
|
||||
{"id":"plan","name":"Plan","mode":"primary"},
|
||||
{"id":"general","name":"General","mode":"subagent","hidden":false},
|
||||
{"id":"explore","name":"Explore","mode":"subagent"}]}`)
|
||||
})
|
||||
mux.HandleFunc("/api/session/ses_1/model", func(w http.ResponseWriter, r *http.Request) {
|
||||
var body map[string]any
|
||||
@@ -260,3 +264,18 @@ func TestCreateSession(t *testing.T) {
|
||||
t.Fatal("no create request reached the server")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAgentPickerSkipsSubagents(t *testing.T) {
|
||||
srv := newChatServer(t)
|
||||
a := uitest.Mount(t, func() ui.Node { return rootWithStore(&memStore{}) }, uitest.Platform(ui.PlatformAndroid))
|
||||
connectViaForm(t, a, srv.URL)
|
||||
a.WaitFor("First session")
|
||||
a.Tap("First session")
|
||||
a.WaitFor("Hello from the agent")
|
||||
|
||||
a.Tap("Agent")
|
||||
a.WaitFor("Build")
|
||||
a.Expect("Plan")
|
||||
a.ExpectNo("General")
|
||||
a.ExpectNo("Explore")
|
||||
}
|
||||
@@ -341,6 +341,17 @@ func (c *controller) instancesSheet() ui.Node {
|
||||
}),
|
||||
)
|
||||
}),
|
||||
ui.Show(signal.Func(func() bool { return c.connected.Get() }),
|
||||
func() ui.Node {
|
||||
return ui.Button(ui.ButtonProps{
|
||||
Title: ui.Val("断开当前连接"),
|
||||
Variant: ui.ButtonGray,
|
||||
OnPress: func() {
|
||||
c.instancesOpen.Set(false)
|
||||
c.disconnect()
|
||||
},
|
||||
})
|
||||
}),
|
||||
ui.Button(ui.ButtonProps{
|
||||
Title: ui.Val("添加服务器"),
|
||||
Icon: ui.IconPlus,
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package appui
|
||||
|
||||
import (
|
||||
"github.com/egoist/asuka/colors"
|
||||
"github.com/egoist/asuka/sdk/svg"
|
||||
"github.com/egoist/asuka/ui"
|
||||
)
|
||||
|
||||
// serverIcon is a rack, drawn as vector paths: Asuka's built-in symbols
|
||||
// have no server glyph on Android, and an SVG keeps it crisp at any size.
|
||||
var serverIcon = svg.MustParse(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="20" height="8" x="2" y="2" rx="2"/><rect width="20" height="8" x="2" y="14" rx="2"/><line x1="6" x2="6.01" y1="6" y2="6"/><line x1="6" x2="6.01" y1="18" y2="18"/></svg>`)
|
||||
|
||||
// instancesButton opens the server list: one button, because picking a
|
||||
// server is also how the live one is replaced.
|
||||
func (c *controller) instancesButton() ui.Node {
|
||||
return ui.View(ui.ViewProps{
|
||||
OnPress: func() { c.instancesOpen.Set(true) },
|
||||
Label: ui.Val("实例"),
|
||||
Hint: ui.Val("打开服务器列表"),
|
||||
Style: ui.Style{Padding: ui.All(8)},
|
||||
}, svg.View(svg.Props{
|
||||
Icon: serverIcon,
|
||||
Color: ui.Val(colors.Accent),
|
||||
Style: ui.Style{Width: ui.Pt(22), Height: ui.Pt(22)},
|
||||
}))
|
||||
}
|
||||
@@ -171,6 +171,14 @@ func connectViaForm(t *testing.T, a *uitest.App, url string) {
|
||||
a.Tap("连接")
|
||||
}
|
||||
|
||||
// disconnectViaInstances opens the instance list and drops the live
|
||||
// connection from there; the sessions header has only the list button.
|
||||
func disconnectViaInstances(t *testing.T, a *uitest.App) {
|
||||
t.Helper()
|
||||
a.Tap("实例")
|
||||
a.Tap("断开当前连接")
|
||||
}
|
||||
|
||||
func unlockWith(t *testing.T, a *uitest.App, password string) {
|
||||
t.Helper()
|
||||
a.WaitFor("这台服务器需要密码。")
|
||||
@@ -261,7 +269,7 @@ func TestMultipleConnectionsAndSwitch(t *testing.T) {
|
||||
a := mount(t, st)
|
||||
a.WaitFor("Session A")
|
||||
|
||||
a.Tap("断开")
|
||||
disconnectViaInstances(t, a)
|
||||
a.Expect("A")
|
||||
a.Expect("B")
|
||||
|
||||
@@ -277,7 +285,7 @@ func TestAddAnotherConnection(t *testing.T) {
|
||||
}}
|
||||
a := mount(t, st)
|
||||
a.WaitFor("Session A")
|
||||
a.Tap("断开")
|
||||
disconnectViaInstances(t, a)
|
||||
a.Tap("添加服务器")
|
||||
a.Type("http://192.168.1.5:3000", srvB.URL)
|
||||
a.Type("名称(可选)", "B")
|
||||
@@ -296,7 +304,7 @@ func TestDeleteConnection(t *testing.T) {
|
||||
}}
|
||||
a := mount(t, st)
|
||||
a.WaitFor("Session A")
|
||||
a.Tap("断开")
|
||||
disconnectViaInstances(t, a)
|
||||
|
||||
a.Tap("操作")
|
||||
a.Tap("删除")
|
||||
|
||||
@@ -22,9 +22,7 @@ func (c *controller) sessionsScreen() ui.Node {
|
||||
return ui.Text(c.errorMsg, ui.Style{Font: fonts.Footnote, Color: colors.Red, Lines: 2})
|
||||
}),
|
||||
),
|
||||
ui.Button(ui.ButtonProps{Title: ui.Val("实例"), Variant: ui.ButtonPlain,
|
||||
OnPress: func() { c.instancesOpen.Set(true) }}),
|
||||
ui.Button(ui.ButtonProps{Title: ui.Val("断开"), Variant: ui.ButtonPlain, OnPress: c.disconnect}),
|
||||
c.instancesButton(),
|
||||
),
|
||||
ui.Show(signal.Func(func() bool { return len(c.sessions.Get()) == 0 }),
|
||||
func() ui.Node {
|
||||
|
||||
Reference in new issue
Block a user