chat: add model switching and preloaded instructions

Expose the OpenCode model list and session model switch over the chat protocol,
carry a per-session model provider on chat rows, and apply a preloaded behavior
brief as a durable session instruction entry when a chat is created.
This commit is contained in:
2026-10-20 14:58:20 +01:00
parent f982c0b712
commit 6bfe4c8921
12 changed files with 468 additions and 17 deletions
+4
View File
@@ -194,6 +194,10 @@ type Message struct {
// ChatBackends is the chat_backends reply: the installed harnesses a new
// chat can use.
ChatBackends []string `json:"chat_backends,omitempty"`
// ChatModels is the chat_models reply: models the session's harness offers.
ChatModels []ChatModel `json:"chat_models,omitempty"`
// ModelRequest is the chat_model body and echoed selection.
ModelRequest *ChatModelRequest `json:"chat_model,omitempty"`
// ChatSubscribe attaches this connection to one session's shared stream; the
// body names the session like ChatQuery. A chat_prompt response sets
// ChatQueued when the prompt had to wait for an in-flight turn and was