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
+3 -3
View File
@@ -4,7 +4,6 @@ import (
"context"
"strings"
"git.a-wan.net/alan/pipelines/internal/opencode"
"git.a-wan.net/alan/pipelines/internal/pipeline"
"git.a-wan.net/alan/pipelines/internal/protocol"
)
@@ -28,7 +27,7 @@ func handleChatClose(ctx context.Context, request protocol.Message, broker chatB
return
}
query := request.ChatQuery
if query == nil || !opencode.ValidSessionID(query.SessionID) {
if query == nil || !validChatSessionID(query.SessionID) {
_ = write(protocol.Message{Type: protocol.Error, ID: request.ID, Error: "a valid OpenCode session id is required"})
return
}
@@ -88,7 +87,7 @@ func handleChatReopen(ctx context.Context, request protocol.Message, registry op
return
}
query := request.ChatQuery
if query == nil || !opencode.ValidSessionID(query.SessionID) {
if query == nil || !validChatSessionID(query.SessionID) {
_ = write(protocol.Message{Type: protocol.Error, ID: request.ID, Error: "a valid OpenCode session id is required"})
return
}
@@ -135,6 +134,7 @@ func chatSessionFromOperator(session pipeline.OperatorSession) protocol.ChatSess
Tag: session.Tag,
CreatedAt: session.CreatedAt,
UpdatedAt: session.UpdatedAt,
Backend: session.Backend,
}
if session.ClosedAt > 0 {
out.Closed = true