Documentation
¶
Overview ¶
Package codex implements agentproxy.Facade for the codex CLI's app-server JSON-RPC protocol (github.com/openai/codex, codex-rs/app-server).
Package codex: --replay support, feeding a session's durable event history into the first thread this facade bootstraps.
Package codex: canonical-event-to-codex-notification translation.
This file is the "translator-strategy seam" the original implementation plan called for: the logic that decides what a canonical event means in codex terms lives here, not scattered inline in runEventLoop/drainStream's own dispatch loop (facade.go). A future raw-passthrough strategy — preferring an event's native codex bytes when the harness exposes them, falling back to this reconstruction otherwise — would extend or replace translateEvent, not runEventLoop's own retry/reconnect machinery.
This is deliberately not a Go interface with multiple implementations: there is exactly one strategy today (canonical reconstruction), and godo.HostedAgentEvent doesn't even have a source_raw field yet (see the RFC's own gap analysis — the harness doesn't expose it on the client stream yet either). Building a pluggable-strategy interface with nothing real to plug in would be speculative abstraction; the seam that matters right now is that this logic is self-contained in its own file, ready to grow a conditional (prefer source_raw when present) once the data exists.
Index ¶
Constants ¶
const TestedVersion = "0.142.5"
TestedVersion is the codex-cli version this facade's protocol handling was captured against (hosted-agents' docs/design/codex-app-server-protocol-capture.md: stdio send-message-v2 capture plus a live codex --remote / app-server pairing over WebSocket). Re-run that capture and update this pin on every codex upgrade — the WS/app-server transport is officially experimental and can change without notice.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Facade ¶
type Facade struct {
// SessionID is the hosted session this facade bridges to. thread/start's
// synthesized thread id is exactly this value — simplest possible way to
// satisfy "a synthesized thread whose id embeds the session id" while
// matching what the real capture showed too (thread.id == thread.sessionId
// there as well).
SessionID string
// Sessions is the harness bridge: turn/start calls SendInput on it, and
// the background streaming goroutine reads StreamSession's SSE events to
// translate into codex notifications. The bootstrap methods (initialize,
// thread/start, etc.) don't touch it.
Sessions do.HostedAgentsService
// Replay, when true, feeds this session's full durable event history
// into the first thread this facade bootstraps before that thread would
// otherwise appear to start with no prior conversation — see
// replaySessionHistory. Set once at construction from the --replay CLI
// flag; never toggled per-connection.
Replay bool
// contains filtered or unexported fields
}
Facade implements agentproxy.Facade for codex --remote.
func (*Facade) AfterReply ¶
AfterReply implements agentproxy.AfterReply: once handleConn has written a successful thread/start or thread/resume result, start the deferred replaySessionHistory goroutine if maybeReplay armed one.
func (*Facade) SetNotifier ¶
func (f *Facade) SetNotifier(n agentproxy.Notifier)
SetNotifier implements agentproxy.NotifierAware.