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:
@@ -4,13 +4,12 @@ import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"git.a-wan.net/alan/pipelines/internal/opencode"
|
||||
"git.a-wan.net/alan/pipelines/internal/protocol"
|
||||
)
|
||||
|
||||
func handleChatMessages(ctx context.Context, request protocol.Message, broker chatBroker, hub *chatHub, write func(protocol.Message) error) {
|
||||
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
|
||||
}
|
||||
@@ -39,7 +38,7 @@ func handleChatSimple(ctx context.Context, request protocol.Message, broker chat
|
||||
}
|
||||
if request.Type == protocol.ChatInterrupt {
|
||||
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
|
||||
}
|
||||
@@ -51,7 +50,7 @@ func handleChatSimple(ctx context.Context, request protocol.Message, broker chat
|
||||
return
|
||||
}
|
||||
reply := request.ChatReply
|
||||
if reply == nil || !opencode.ValidSessionID(reply.SessionID) {
|
||||
if reply == nil || !validChatSessionID(reply.SessionID) {
|
||||
_ = write(protocol.Message{Type: protocol.Error, ID: request.ID, Error: "a valid OpenCode session id is required"})
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user