feat: search sessions, attach files, read aloud, jump to latest

Reach the first-party mobile client's everyday features:

- sessions: a search button opens a field; typing asks the server with
  its search parameter (350 ms settle) and clearing restores the list
- composer: attach photos or files (up to five, 10 MB each) as data
  URLs with the prompt; attachments show as removable chips and are
  named under the sent message
- turn menu: read the answer aloud with the system voice, or stop it
- chat: a "latest" button appears after scrolling up and returns to the
  end of the conversation
- reset a live search when a connection ends

Bump version to 0.2.0 (build 14).
This commit is contained in:
blumia committed 2026-11-17 21:52:06 +08:00
1 parent 4c6fcf4cbe
commit 72119b73e8
11 files changed
+445 -56

No files matched your search

+12 -1
View File
@@ -157,12 +157,23 @@ func TestMessagesAndTurn(t *testing.T) {
if len(page.Data) != 1 || page.Data[0].Content[0].Text != "hello" {
t.Fatalf("unexpected messages: %+v", page)
}
if err := c.Prompt(context.Background(), "ses_1", PromptOptions{Text: "ping", MessageID: "msg_9"}); err != nil {
if err := c.Prompt(context.Background(), "ses_1", PromptOptions{
Text: "ping", MessageID: "msg_9",
Files: []PromptFile{{URI: "data:text/plain;base64,aGk=", Name: "note.txt"}},
}); err != nil {
t.Fatal(err)
}
if promptBody["text"] != "ping" || promptBody["id"] != "msg_9" {
t.Errorf("prompt body: %v", promptBody)
}
files, _ := promptBody["files"].([]any)
if len(files) != 1 {
t.Fatalf("prompt files: %v", promptBody["files"])
}
file, _ := files[0].(map[string]any)
if file["name"] != "note.txt" || file["uri"] != "data:text/plain;base64,aGk=" {
t.Errorf("prompt file: %v", file)
}
ok, err := c.Interrupt(context.Background(), "ses_1", "")
if err != nil || !ok {
t.Fatalf("interrupt: %v %v", ok, err)
+6
View File
@@ -13,6 +13,9 @@ type PromptOptions struct {
// retry after a lost response a no-op instead of a duplicate.
MessageID string
Text string
// Files ride with the prompt as data URLs (or URIs the server can
// read), as the web client sends them.
Files []PromptFile
}
// Prompt sends a user message to a session. The reply arrives through the
@@ -22,6 +25,9 @@ func (c *Client) Prompt(ctx context.Context, sessionID string, o PromptOptions)
if o.MessageID != "" {
body["id"] = o.MessageID
}
if len(o.Files) > 0 {
body["files"] = o.Files
}
path := "/api/session/" + url.PathEscape(sessionID) + "/prompt"
return c.do(ctx, http.MethodPost, path, requestOptions{directory: o.Directory}, body, nil)
}
+7
View File
@@ -169,6 +169,13 @@ type ToolState struct {
Error json.RawMessage `json:"error,omitempty"`
}
// PromptFile is a file riding with a prompt: a data URL or a URI the
// server can read, and its name.
type PromptFile struct {
URI string `json:"uri"`
Name string `json:"name,omitempty"`
}
// FileAttachment is a file attached to a user prompt.
type FileAttachment struct {
URI string `json:"uri"`