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

+26
View File
@@ -192,3 +192,29 @@ func TestPartShellsHeaderAndGetMessage(t *testing.T) {
t.Fatalf("message = %+v", msg)
}
}
func TestRevertEndpoints(t *testing.T) {
var staged map[string]any
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case "/api/session/ses_1/revert/stage":
_ = json.NewDecoder(r.Body).Decode(&staged)
fmt.Fprint(w, `{"data":{"messageID":"msg_1"}}`)
case "/api/session/ses_1/revert/commit":
w.WriteHeader(http.StatusNoContent)
default:
t.Errorf("unexpected path %q", r.URL.Path)
}
}))
defer srv.Close()
c, _ := New(srv.URL, Options{})
if err := c.StageRevert(context.Background(), "ses_1", "", "msg_1"); err != nil {
t.Fatal(err)
}
if staged["messageID"] != "msg_1" {
t.Errorf("staged = %v", staged)
}
if err := c.CommitRevert(context.Background(), "ses_1", ""); err != nil {
t.Fatal(err)
}
}
+14
View File
@@ -32,6 +32,20 @@ func (c *Client) Prompt(ctx context.Context, sessionID string, o PromptOptions)
return c.do(ctx, http.MethodPost, path, requestOptions{directory: o.Directory}, body, nil)
}
// StageRevert marks a reversible boundary at a message: everything after it
// can be dropped with CommitRevert.
func (c *Client) StageRevert(ctx context.Context, sessionID, directory, messageID string) error {
path := "/api/session/" + url.PathEscape(sessionID) + "/revert/stage"
return c.do(ctx, http.MethodPost, path, requestOptions{directory: directory},
map[string]any{"messageID": messageID}, nil)
}
// CommitRevert drops the messages a staged revert marked.
func (c *Client) CommitRevert(ctx context.Context, sessionID, directory string) error {
path := "/api/session/" + url.PathEscape(sessionID) + "/revert/commit"
return c.do(ctx, http.MethodPost, path, requestOptions{directory: directory}, map[string]any{}, nil)
}
// ForkSession copies the session's history before a message into a new
// session. An empty before copies the whole history.
func (c *Client) ForkSession(ctx context.Context, sessionID, directory, before string) (Session, error) {