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
+13 -2
View File
@@ -234,6 +234,11 @@ export class PipelinesRepository {
return (await this.#client.call({ type: Protocol.CHAT_SESSIONS }))[ChatKeys.SESSIONS] ?? [];
}
/** The installed chat harnesses a new session can use. */
async chatBackends() {
return (await this.#client.call({ type: Protocol.CHAT_BACKENDS }))[ChatKeys.BACKENDS] ?? ["opencode"];
}
/**
* Loads a bounded chronological history page. `cursor` is the opaque
* continuation the server returned as `next_cursor`; it is passed back
@@ -469,10 +474,16 @@ export class PipelinesRepository {
* `chat_sessions` for the operator. Automated checks that drive this real page
* set it, so a run can never leave a stray "New chat" in the operator's list.
*/
async chatCreate(title, directory, operationId = newChatOperationId(), { ephemeral = false } = {}) {
async chatCreate(title, directory, operationId = newChatOperationId(), { backend = "opencode", ephemeral = false } = {}) {
const response = await this.#client.call({
type: Protocol.CHAT_CREATE,
[ChatKeys.CREATE]: { title, directory, operation_id: operationId, ...(ephemeral ? { ephemeral: true } : {}) },
[ChatKeys.CREATE]: {
title,
directory,
operation_id: operationId,
...(backend && backend !== "opencode" ? { backend } : {}),
...(ephemeral ? { ephemeral: true } : {}),
},
});
const session = response[ChatKeys.SESSION];
if (!session) {