codex

package
v1.166.0-beta.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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

func (f *Facade) AfterReply(ctx context.Context, method string)

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) Dispatch

func (f *Facade) Dispatch(ctx context.Context, method string, params json.RawMessage) (any, error)

Dispatch implements agentproxy.Facade.

func (*Facade) SetNotifier

func (f *Facade) SetNotifier(n agentproxy.Notifier)

SetNotifier implements agentproxy.NotifierAware.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL