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:
@@ -174,6 +174,18 @@ class ChatRepository {
|
||||
});
|
||||
}
|
||||
|
||||
/// `/new`: the same chat continues on a fresh native session with an empty
|
||||
/// context. The reply's `chat_session` is the chat under its new id, with
|
||||
/// `previous_id` naming [sessionId].
|
||||
Future<JsonMap> newSession(String sessionId, {String instructions = ''}) =>
|
||||
gateway.call('chat_new_session', {
|
||||
'chat_new_session': {
|
||||
'session_id': sessionId,
|
||||
if (instructions.trim().isNotEmpty)
|
||||
'instructions': instructions.trim(),
|
||||
},
|
||||
});
|
||||
|
||||
Future<JsonMap> rename(String sessionId, String title) =>
|
||||
gateway.call('chat_rename', {
|
||||
'chat_rename': {'session_id': sessionId, 'title': title.trim()},
|
||||
|
||||
Reference in New Issue
Block a user