feat: inline image previews, revert, and the official icon

- sent images keep a local copy and render as rounded thumbnails in the
  message, surviving later page reloads
- a prompt's menu can revert it and everything after it: confirm, then
  stage and commit the server-side revert
- the app icon is OpenChamber's own (packages/mobile/assets/icon-only.png)
- document a terminal assessment (native view vs Go ANSI vs xterm.js in
  a WebView) for the next decision

Bump version to 0.2.1 (build 15).
This commit is contained in:
blumia committed 2026-11-17 23:46:06 +08:00
1 parent 72119b73e8
commit dc3730eba7
9 files changed
+221 -22

No files matched your search

+51 -7
View File
@@ -22,6 +22,7 @@ type chatServer struct {
models chan map[string]any
created chan map[string]any
forked chan map[string]any
reverted chan map[string]any
events chan string
ready chan struct{}
readyOne sync.Once
@@ -38,13 +39,14 @@ func (cs *chatServer) push(ev string) {
func newChatServer(t *testing.T) *chatServer {
t.Helper()
cs := &chatServer{
prompts: make(chan map[string]any, 1),
replies: make(chan map[string]any, 1),
models: make(chan map[string]any, 1),
created: make(chan map[string]any, 1),
forked: make(chan map[string]any, 1),
events: make(chan string, 8),
ready: make(chan struct{}),
prompts: make(chan map[string]any, 1),
replies: make(chan map[string]any, 1),
models: make(chan map[string]any, 1),
created: make(chan map[string]any, 1),
forked: make(chan map[string]any, 1),
reverted: make(chan map[string]any, 2),
events: make(chan string, 8),
ready: make(chan struct{}),
}
mux := http.NewServeMux()
mux.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
@@ -130,6 +132,22 @@ func newChatServer(t *testing.T) *chatServer {
{"type":"tool","id":"call_1","name":"shell","state":{"status":"completed",
"input":{"command":"echo hi"},"content":[{"type":"text","text":"tool output here"}]}}]}`)
})
mux.HandleFunc("/api/session/ses_1/revert/stage", func(w http.ResponseWriter, r *http.Request) {
var body map[string]any
_ = json.NewDecoder(r.Body).Decode(&body)
select {
case cs.reverted <- body:
default:
}
fmt.Fprint(w, `{"data":{"messageID":"msg_1"}}`)
})
mux.HandleFunc("/api/session/ses_1/revert/commit", func(w http.ResponseWriter, r *http.Request) {
select {
case cs.reverted <- map[string]any{"commit": true}:
default:
}
w.WriteHeader(http.StatusNoContent)
})
mux.HandleFunc("/api/session/ses_1/fork", func(w http.ResponseWriter, r *http.Request) {
var body map[string]any
_ = json.NewDecoder(r.Body).Decode(&body)
@@ -372,3 +390,29 @@ func TestToolResultLoadsOnExpand(t *testing.T) {
a.Tap("✓ shell echo hi ▸")
a.WaitFor("tool output here")
}
func TestRevertFromUserMessage(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("What is this?")
a.Tap("消息操作")
a.Tap("撤回此消息及之后")
a.WaitFor("撤回消息?")
a.Tap("撤回")
stage := <-srv.reverted
if _, ok := stage["commit"]; ok {
t.Fatalf("unexpected first message: %v", stage)
}
if stage["messageID"] != "msg_1" {
t.Errorf("stage messageID = %v", stage["messageID"])
}
commit := <-srv.reverted
if _, ok := commit["commit"]; !ok {
t.Errorf("commit not sent: %v", commit)
}
}