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:
@@ -0,0 +1,47 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"git.a-wan.net/alan/pipelines/internal/protocol"
|
||||
)
|
||||
|
||||
// A chat created without a name records no operator title, so the list shows
|
||||
// the harness's own title for it; a named chat keeps the operator's name.
|
||||
func TestChatCreateWithoutTitleListsTheHarnessTitle(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
dir := t.TempDir()
|
||||
store := newOperatorStore(t)
|
||||
broker := &fakeChat{created: protocol.ChatSession{ID: "ses_untitled"}}
|
||||
var created protocol.Message
|
||||
handleChatCreate(ctx, protocol.Message{ID: "c1", Type: protocol.ChatCreate, ChatCreate: &protocol.ChatCreateRequest{Directory: dir, OperationID: "op-untitled"}}, broker, store, func(message protocol.Message) error {
|
||||
created = message
|
||||
return nil
|
||||
})
|
||||
if created.Type != protocol.ChatCreate {
|
||||
t.Fatalf("create reply = %#v", created)
|
||||
}
|
||||
if _, title, _ := broker.createQuery(); title != "" {
|
||||
t.Fatalf("harness asked to create %q, want no title", title)
|
||||
}
|
||||
rows, err := store.OperatorSessions(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(rows) != 1 || rows[0].Title != "" {
|
||||
t.Fatalf("registry rows = %+v, want one without a title", rows)
|
||||
}
|
||||
|
||||
broker.mu.Lock()
|
||||
broker.sessions = []protocol.ChatSession{{ID: "ses_untitled", Title: "Fix the flaky test"}}
|
||||
broker.mu.Unlock()
|
||||
var listed protocol.Message
|
||||
handleChatSessions(ctx, protocol.Message{ID: "list", Type: protocol.ChatSessions}, broker, nil, store, func(message protocol.Message) error {
|
||||
listed = message
|
||||
return nil
|
||||
})
|
||||
if len(listed.ChatSessions) != 1 || listed.ChatSessions[0].Title != "Fix the flaky test" {
|
||||
t.Fatalf("listed = %+v, want the harness title", listed.ChatSessions)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user