Files
alan e42f9cc031 Send mid-turn chat prompts to the harness and queue the rest durably on the server
Claude Code (stream-json stdin) and Codex (turn/steer pinned to the active
turn) receive a prompt sent while a turn runs immediately. Other harnesses
(OpenCode) get a durable chat_prompt_queue row owned by the session: it
survives the last client detaching and a server restart, is delivered in
order when the turn ends with or without a client, and is deduplicated by
operation id. chat_subscribe carries the queue, chat_queue frames report
delivered/removed/failed changes, and chat_unqueue removes a waiting prompt.
2026-11-01 18:30:20 +00:00

43 lines
1.3 KiB
Go

package server
import (
"context"
"testing"
"git.a-wan.net/alan/pipelines/internal/claude"
"git.a-wan.net/alan/pipelines/internal/codex"
"git.a-wan.net/alan/pipelines/internal/opencode"
)
// Advertising either real harness must not regress to a broker that can stream
// text but cannot deliver the interactive tools the web needs to finish a turn.
type interactiveWebChat interface {
chatBroker
chatPromptWithFiles
chatAnswerer
chatFormReader
chatModeler
chatShellOutputReader
}
var _ interactiveWebChat = (*opencode.Chat)(nil)
var _ interactiveWebChat = (*codex.Chat)(nil)
var _ interactiveWebChat = (*claude.Chat)(nil)
func TestAdvertisedChatHarnessesExposeInteractiveWebContract(t *testing.T) {
claudeChat := claude.New(context.Background())
defer claudeChat.Close()
m := &chatManager{opencode: opencode.NewChat(&opencode.Connection{}), codex: &codex.Chat{}, claude: claudeChat}
for _, backend := range m.Backends() {
if _, ok := m.adapter(backend).(interactiveWebChat); !ok {
t.Errorf("advertised harness %s lacks web tool controls", backend)
}
}
}
// Claude Code and Codex take a prompt into a running turn; OpenCode does not
// (its prompts are queued durably on the server behind the running turn).
var _ chatMidTurn = (*claude.Chat)(nil)
var _ chatMidTurn = (*codex.Chat)(nil)
var _ chatMidTurn = (*chatManager)(nil)