feat(chat): per-chat permission modes for Claude, Codex and OpenCode
This commit is contained in:
@@ -51,6 +51,13 @@ const (
|
||||
ChatModels = "chat_models"
|
||||
// ChatModelSelect switches one session's model for subsequent turns.
|
||||
ChatModelSelect = "chat_model"
|
||||
// ChatModes lists the permission modes the chat's harness offers (Claude
|
||||
// Code's permission modes, Codex approval/sandbox presets, OpenCode agents);
|
||||
// its request body is ChatQuery and the reply also carries the current mode.
|
||||
ChatModes = "chat_modes"
|
||||
// ChatModeSelect switches one session's mode. The choice is stored with the
|
||||
// operator session and applied now and before every later turn.
|
||||
ChatModeSelect = "chat_mode"
|
||||
// ChatStar records the operator's star on the server, so every browser and
|
||||
// device shows the same starred group. It takes a ChatQuery with SessionID
|
||||
// and Starred, and echoes the updated session like close/reopen.
|
||||
@@ -169,6 +176,19 @@ type ChatModel struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// ChatMode is one permission mode a chat harness offers.
|
||||
type ChatMode struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description,omitempty"`
|
||||
}
|
||||
|
||||
// ChatModeRequest switches one session's mode; the reply echoes the stored mode.
|
||||
type ChatModeRequest struct {
|
||||
SessionID string `json:"session_id"`
|
||||
Mode string `json:"mode"`
|
||||
}
|
||||
|
||||
// ChatModelRequest switches the model for one session's subsequent turns.
|
||||
type ChatModelRequest struct {
|
||||
// Selection is reply-only: next_turn means a durable local override was saved.
|
||||
@@ -186,6 +206,12 @@ type ChatSession struct {
|
||||
// ModelSelection == next_turn denotes a durable Pipelines override, not an
|
||||
// acknowledgement that a remote thread's current configuration changed.
|
||||
ModelSelection string `json:"model_selection,omitempty"`
|
||||
// Mode is the stored permission mode (a ChatMode id); empty is the
|
||||
// harness's own default.
|
||||
Mode string `json:"mode,omitempty"`
|
||||
// ModeName is Mode's display name. With no stored mode both name the
|
||||
// harness default, so a client can show the mode without a chat_modes read.
|
||||
ModeName string `json:"mode_name,omitempty"`
|
||||
// InstructionStatus is the observed create-time preload outcome: applied,
|
||||
// unsupported, failed, or not_requested. Ordinary list rows omit it.
|
||||
InstructionStatus string `json:"instruction_status,omitempty"`
|
||||
|
||||
@@ -210,6 +210,11 @@ type Message struct {
|
||||
ChatModels []ChatModel `json:"chat_models,omitempty"`
|
||||
// ModelRequest is the chat_model body and echoed selection.
|
||||
ModelRequest *ChatModelRequest `json:"chat_model,omitempty"`
|
||||
// ChatModes is the chat_modes reply: the permission modes the session's
|
||||
// harness offers, with the session's current mode in ModeRequest.
|
||||
ChatModes []ChatMode `json:"chat_modes,omitempty"`
|
||||
// ModeRequest is the chat_mode body and echoed selection.
|
||||
ModeRequest *ChatModeRequest `json:"chat_mode,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
|
||||
|
||||
Reference in New Issue
Block a user