codex

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 27 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 connects a per-run Codex app-server and remote TUI to otag.

Index

Constants

View Source
const (
	ReasonNotReady      = "not_ready"      // listener not connected/reconciled, or TUI not attached
	ReasonWaitingDialog = "waiting_dialog" // an approval or question is open
	ReasonBusy          = "busy"           // a turn is running and steer was not allowed
	ReasonBusyMismatch  = "busy_mismatch"  // steer refused: the expected turn is no longer active
	ReasonRejected      = "rejected"       // Codex refused the request
	ReasonUnknown       = "unknown"        // sent, but no answer: it may have been delivered
	ReasonBadRequest    = "bad_request"
)

Delivery refusal reasons of the control protocol (DeliveryError.Reason).

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter struct{}

func New

func New() *Adapter

func (*Adapter) Deliver

func (*Adapter) Deliver(ctx context.Context, t adapter.Target, msg adapter.Message) error

Deliver implements adapter.Deliverer (mode B) through the listener's control socket. msg.ID is the attempt nonce and msg.Text must carry the caller's marker.

func (*Adapter) DeliverReceipt

func (*Adapter) DeliverReceipt(ctx context.Context, t adapter.Target, m adapter.Message) (adapter.Receipt, error)

DeliverReceipt implements adapter.ReceiptDeliverer (mode B) on DeliverReceipt: the receipt is the turn the text went into (turn/start's or turn/steer's turn id). A refusal before anything reached Codex wraps adapter.ErrNotSent: a "not now" one (busy, not_ready, busy_mismatch, waiting_dialog) wraps adapter.ErrNotReady, retried soon without using up attempts; rejected and bad_request are definite. unknown (and any reason this otag does not know) is ambiguous.

func (*Adapter) DenyOutput

func (*Adapter) DenyOutput(kind, reason string) []byte

DenyOutput implements adapter.Guarder.

func (*Adapter) GuardKind

func (*Adapter) GuardKind(kind string) bool

GuardKind implements adapter.Guarder: the pre-tool and permission hooks decide.

func (*Adapter) Harness

func (*Adapter) Harness() string

func (*Adapter) NoopOutput

func (*Adapter) NoopOutput(string) []byte

func (*Adapter) ParseEvent

func (a *Adapter) ParseEvent(hc adapter.HookContext, kind string, raw []byte) (adapter.HookResult, error)

func (*Adapter) Prepare

func (*Adapter) Prepare(ctx context.Context, spec adapter.RunSpec) (*adapter.LaunchSpec, error)

func (*Adapter) RunSidecar

func (*Adapter) RunSidecar(ctx context.Context, sc adapter.Sidecar, args []string) error

func (*Adapter) SetupServer

func (*Adapter) SetupServer(ctx context.Context, spec adapter.RunSpec, launch *adapter.LaunchSpec) error

func (*Adapter) Stop

func (*Adapter) Stop(ctx context.Context, target adapter.Target) error

type DeliveryError

type DeliveryError struct {
	Reason  string
	Message string
}

DeliveryError is a delivery the listener refused or could not confirm. Reason is one of the Reason* constants; only ReasonUnknown may have reached Codex.

func (*DeliveryError) Error

func (e *DeliveryError) Error() string

func (*DeliveryError) Unknown

func (e *DeliveryError) Unknown() bool

Unknown reports that the message may have been delivered (never resend it).

type Receipt

type Receipt struct {
	Kind   string
	TurnID string
}

Receipt is Codex's acknowledgement of a delivered message: Kind "start" (a new turn, result.turn.id) or "steer" (added to the active turn, result.turnId).

func DeliverReceipt

func DeliverReceipt(ctx context.Context, t adapter.Target, msg adapter.Message) (Receipt, error)

DeliverReceipt is Deliver returning Codex's receipt. Errors are *DeliveryError.

Jump to

Keyboard shortcuts

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