Chat: unnamed chats take the harness title, harness default per folder, word-safe tables, Send later
- New chat: a cleared Name creates the chat without an operator title; the list shows the harness's own title, or the default name until it has one. The server no longer records "New chat" for a blank title and OpenCode is created without a title so it names the session itself. - New chat harness defaults to the one last used in the chosen folder, else anywhere, else OpenCode; remembered on the device per server. - Markdown tables wrap at word boundaries and never go below a column's longest word (tokens over ~40 characters may break); a table whose words cannot fit scrolls sideways with the code block affordance. - Composer: right-click, long-press, Shift+F10 or the context menu key on Send opens Send later... (30 min, 1 h, tomorrow 9:00, usage reset, pick a time), sent through the same path with send_at. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -555,7 +555,9 @@ func (c *Chat) ActivateSkill(ctx context.Context, id, skill string) error {
|
||||
|
||||
func (c *Chat) Create(ctx context.Context, title, directory string) (protocol.ChatSession, error) {
|
||||
body := struct {
|
||||
Title string `json:"title"`
|
||||
// Omitted when blank, so OpenCode gives the session its placeholder
|
||||
// title and later names it from the conversation.
|
||||
Title string `json:"title,omitempty"`
|
||||
Location struct {
|
||||
Directory string `json:"directory"`
|
||||
} `json:"location"`
|
||||
|
||||
@@ -838,6 +838,26 @@ func TestChatCreatePostsSessionEndpoint(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestChatCreateWithoutTitleOmitsIt pins that an unnamed chat sends no title,
|
||||
// so OpenCode keeps its placeholder and later names the session itself.
|
||||
func TestChatCreateWithoutTitleOmitsIt(t *testing.T) {
|
||||
var body string
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
data, _ := io.ReadAll(r.Body)
|
||||
body = string(data)
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
_, _ = w.Write([]byte(`{"data":{"id":"ses_new","title":"New session - 2026-12-02T09:00:00.000Z","location":{"directory":"/work"}}}`))
|
||||
}))
|
||||
defer srv.Close()
|
||||
chat := NewChat(&Connection{Backend: "v2", URL: srv.URL})
|
||||
if _, err := chat.Create(context.Background(), "", "/work"); err != nil {
|
||||
t.Fatalf("create: %v", err)
|
||||
}
|
||||
if body != `{"location":{"directory":"/work"}}` {
|
||||
t.Fatalf("create body = %q", body)
|
||||
}
|
||||
}
|
||||
|
||||
// TestChatCreateRejectsMalformedSession pins that a response without a valid
|
||||
// session id is an error, not a silent empty success.
|
||||
func TestChatCreateRejectsMalformedSession(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user