chat: add the Codex backend

Store a chat's harness with its operator session, expose chat_backends and a
backend choice in New chat, and route each session through a manager. The Codex
adapter uses the App Server's Unix WebSocket for threads, turns, history,
questions and interrupt; OpenCode remains the default and Claude is not
advertised until its sidecar and login are wired.
This commit is contained in:
2026-10-20 12:10:39 +01:00
parent 74b74adee7
commit f7a3a49f94
25 changed files with 1287 additions and 32 deletions
+12 -3
View File
@@ -43,6 +43,9 @@ const (
// ChatRename records the operator's shared chat title on the server. Unlike
// a local override, every browser and device then lists the same name.
ChatRename = "chat_rename"
// ChatBackends lists the installed chat harnesses the server can create a
// session on. The reply is a bounded array of backend names.
ChatBackends = "chat_backends"
// 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.
@@ -154,7 +157,10 @@ const (
// phone: the nested location.directory and time{created,updated} fields are
// lifted to Directory, CreatedAt and UpdatedAt.
type ChatSession struct {
ID string `json:"id"`
ID string `json:"id"`
// Backend names the harness that owns this session: opencode, codex or
// claude. Empty on older peers and for legacy OpenCode rows.
Backend string `json:"backend,omitempty"`
Title string `json:"title,omitempty"`
Agent string `json:"agent,omitempty"`
Model string `json:"model,omitempty"`
@@ -203,8 +209,11 @@ type ChatCloseResult struct {
// correlation. Clients retrying a create across reconnects must retain it. The
// response carries the created session in Message.ChatSession.
type ChatCreateRequest struct {
Title string `json:"title,omitempty"`
Directory string `json:"directory,omitempty"`
Title string `json:"title,omitempty"`
Directory string `json:"directory,omitempty"`
// Backend selects the chat harness for a new session. Empty means opencode,
// preserving older clients and the default.
Backend string `json:"backend,omitempty"`
OperationID string `json:"operation_id,omitempty"`
// Ephemeral creates a chat for automated verification: the session is created,
// bootstrapped and usable exactly like a normal one, but no operator-registry
+3
View File
@@ -188,6 +188,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"`
// ChatBackends is the chat_backends reply: the installed harnesses a new
// chat can use.
ChatBackends []string `json:"chat_backends,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