Chat: /new continues the same chat on a fresh session

The composer's /new used to create a separate chat. It now sends
chat_new_session. The server starts a fresh native session on the chat's
own harness (OpenCode, Codex or Claude Code) and re-keys the
operator_sessions row in one transaction. The chat keeps its title,
directory, backend, colour, star, model and mode. The old row is kept
unlisted with replaced_by, and its native session stays resumable.

The reply and the chat_session_changed push carry previous_id, so every
client swaps the row in place and an open conversation follows it to the
fresh, empty transcript with a notice.
This commit is contained in:
2026-11-03 14:06:44 +00:00
parent 251cc4f274
commit ad4233f7b8
21 changed files with 910 additions and 131 deletions
+3
View File
@@ -203,6 +203,9 @@ type Message struct {
ChatAnswer *ChatAnswerRequest `json:"chat_answer,omitempty"`
// ChatRename is the chat_rename body; the reply echoes the updated session.
ChatRename *ChatRenameRequest `json:"chat_rename,omitempty"`
// ChatNewSession is the chat_new_session body; the reply carries the
// re-keyed session in ChatSession with PreviousID set.
ChatNewSession *ChatNewSessionRequest `json:"chat_new_session,omitempty"`
// ChatExport is the chat_export body and ChatExportFile its reply.
ChatExport *ChatExportRequest `json:"chat_export,omitempty"`
ChatExportFile *ChatExportFile `json:"chat_export_file,omitempty"`