codex

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package codex implements app-server RPC and durable native-history recovery.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Normalize

func Normalize(thread Thread, completed map[string]bool, outputs map[string]Output, limit int, orders map[string]int64, commands map[string]json.RawMessage) harness.Snapshot

Types

type Driver

type Driver struct {
	// contains filtered or unexported fields
}

func New

func New(s harness.Sandbox, timeout time.Duration, limit int) *Driver

func (*Driver) AccountLimitsDirty added in v0.1.7

func (d *Driver) AccountLimitsDirty() bool

func (*Driver) AccountLimitsEvents added in v0.1.7

func (d *Driver) AccountLimitsEvents() <-chan struct{}

func (*Driver) Attach

func (d *Driver) Attach(ctx context.Context, pid int) error

func (*Driver) Close

func (d *Driver) Close() error

func (*Driver) Committed

func (d *Driver) Committed()

func (*Driver) HasUpdates

func (d *Driver) HasUpdates() bool

func (*Driver) Initialize

func (d *Driver) Initialize(ctx context.Context, source session.Credentials, login bool) error

func (*Driver) Interrupt

func (d *Driver) Interrupt(ctx context.Context, thread, turn string) error

func (*Driver) Launch

func (d *Driver) Launch(ctx context.Context, env map[string]string, cwd string, source session.Credentials) (int, error)

func (*Driver) OpenContext

func (d *Driver) OpenContext(ctx context.Context, agent session.AgentConfiguration, cwd string, id *string) (harness.Context, error)

func (*Driver) ReadAccountLimits added in v0.1.7

func (d *Driver) ReadAccountLimits(ctx context.Context) (accountlimits.Snapshot, error)

func (*Driver) Recover

func (d *Driver) Recover(ctx context.Context, id, path, home *string) (harness.Snapshot, error)

func (*Driver) Snapshot

func (d *Driver) Snapshot(ctx context.Context, thread string, path *string, offset int64) (harness.Snapshot, error)

func (*Driver) Start

func (d *Driver) Start(ctx context.Context, agent session.AgentConfiguration, thread string, texts []string) (string, error)

func (*Driver) StateDir added in v0.1.6

func (d *Driver) StateDir(ctx context.Context) (string, error)

func (*Driver) Steer

func (d *Driver) Steer(ctx context.Context, thread, turn, text string) error

type NativeItem

type NativeItem struct {
	ID      string `json:"id"`
	Type    string `json:"type"`
	Content []struct {
		Text string `json:"text"`
	} `json:"content"`
	Text             string          `json:"text"`
	Phase            string          `json:"phase"`
	Tool             string          `json:"tool"`
	Status           string          `json:"status"`
	AggregatedOutput *string         `json:"aggregatedOutput"`
	Result           json.RawMessage `json:"result"`
	Arguments        json.RawMessage `json:"arguments"`
	Command          json.RawMessage `json:"command"`
	Changes          json.RawMessage `json:"changes"`
	ExitCode         *int            `json:"exitCode"`
}

type NativeTurn

type NativeTurn struct {
	ID     string          `json:"id"`
	Status string          `json:"status"`
	Items  []NativeItem    `json:"items"`
	Error  json.RawMessage `json:"error"`
}

type Output

type Output struct {
	Result       json.RawMessage `json:"result"`
	Completeness string          `json:"completeness"`
	Reason       *string         `json:"reason"`
}

func Bounded

func Bounded(value json.RawMessage, limit int, exit *int, incomplete bool) Output

type RPC

type RPC struct {
	// contains filtered or unexported fields
}

func NewRPC

func NewRPC(s harness.Sandbox, timeout time.Duration) *RPC

func (*RPC) Attach

func (r *RPC) Attach(ctx context.Context, pid int) error

func (*RPC) Call

func (r *RPC) Call(ctx context.Context, method string, params any, dest any) error

func (*RPC) Close

func (r *RPC) Close() error

func (*RPC) Initialize

func (r *RPC) Initialize(ctx context.Context) error

func (*RPC) Launch

func (r *RPC) Launch(ctx context.Context, command string, env map[string]string, cwd string) (int, error)

type RPCError

type RPCError struct {
	Code          int    `json:"code"`
	NativeMessage string `json:"-"`
}

func (*RPCError) Error

func (e *RPCError) Error() string

func (*RPCError) UnmarshalJSON

func (e *RPCError) UnmarshalJSON(raw []byte) error

func (*RPCError) Unwrap

func (e *RPCError) Unwrap() error

type Result

type Result struct {
	Type          string          `json:"type"`
	Text          *string         `json:"text,omitzero"`
	Value         json.RawMessage `json:"value,omitzero"`
	Head          *string         `json:"head,omitzero"`
	Tail          *string         `json:"tail,omitzero"`
	SourceType    string          `json:"source_type,omitzero"`
	ExitCode      *int            `json:"exit_code"`
	OriginalBytes *int            `json:"original_bytes"`
}

type Thread

type Thread struct {
	ID    string       `json:"id"`
	Path  *string      `json:"path"`
	Turns []NativeTurn `json:"turns"`
}

Jump to

Keyboard shortcuts

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