Documentation
¶
Index ¶
- Constants
- type AgentMessageDelta
- type Client
- func (c *Client) Call(ctx context.Context, method string, params any, out any) error
- func (c *Client) Close() error
- func (c *Client) Err() error
- func (c *Client) Initialize(ctx context.Context, params InitializeParams) (InitializeResponse, error)
- func (c *Client) InterruptTurn(ctx context.Context, params TurnInterruptParams) (TurnInterruptResponse, error)
- func (c *Client) Notify(ctx context.Context, method string, params any) error
- func (c *Client) ResumeThread(ctx context.Context, params ThreadResumeParams) (ThreadResumeResponse, error)
- func (c *Client) StartThread(ctx context.Context, params ThreadStartParams) (ThreadStartResponse, error)
- func (c *Client) StartTurn(ctx context.Context, params TurnStartParams) (TurnStartResponse, error)
- func (c *Client) SubscribeTurn(threadID, turnID string) *TurnSubscription
- type ClientInfo
- type Conn
- type ContextCompactedNotification
- type DecodeFailure
- type ErrorNotification
- type FileChangePatchUpdated
- type FileUpdateChange
- type InitializeCapabilities
- type InitializeParams
- type InitializeResponse
- type ItemNotification
- type Notification
- type ProcessOptions
- type ReasoningTextDelta
- type Runtime
- func (r *Runtime) Available(ctx context.Context) externalagents.Availability
- func (r *Runtime) Close() error
- func (r *Runtime) DisplayName() string
- func (r *Runtime) GenerateImage(ctx context.Context, req externalagents.ImageRequest) ([]byte, error)
- func (r *Runtime) ID() string
- func (r *Runtime) Interrupt(ctx context.Context, session externalagents.ExternalSession) error
- func (r *Runtime) Models(context.Context) []string
- func (r *Runtime) ResumeSession(ctx context.Context, session externalagents.ExternalSession) (externalagents.ExternalSession, error)
- func (r *Runtime) Send(ctx context.Context, session externalagents.ExternalSession, ...) (<-chan externalagents.Event, error)
- func (r *Runtime) StartSession(ctx context.Context, req externalagents.StartSessionRequest) (externalagents.ExternalSession, error)
- type RuntimeOptions
- type TextElement
- type Thread
- type ThreadResumeParams
- type ThreadResumeResponse
- type ThreadStartParams
- type ThreadStartResponse
- type ToolOutputDelta
- type Turn
- type TurnCompleted
- type TurnError
- type TurnInterruptParams
- type TurnInterruptResponse
- type TurnStartParams
- type TurnStartResponse
- type TurnStarted
- type TurnStatus
- type TurnSubscription
- type UserInput
Constants ¶
const AgentID = "codex-app"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentMessageDelta ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Initialize ¶
func (c *Client) Initialize(ctx context.Context, params InitializeParams) (InitializeResponse, error)
func (*Client) InterruptTurn ¶ added in v0.2.0
func (c *Client) InterruptTurn(ctx context.Context, params TurnInterruptParams) (TurnInterruptResponse, error)
func (*Client) ResumeThread ¶
func (c *Client) ResumeThread(ctx context.Context, params ThreadResumeParams) (ThreadResumeResponse, error)
func (*Client) StartThread ¶
func (c *Client) StartThread(ctx context.Context, params ThreadStartParams) (ThreadStartResponse, error)
func (*Client) StartTurn ¶
func (c *Client) StartTurn(ctx context.Context, params TurnStartParams) (TurnStartResponse, error)
func (*Client) SubscribeTurn ¶ added in v0.1.17
func (c *Client) SubscribeTurn(threadID, turnID string) *TurnSubscription
SubscribeTurn starts the turn's queue with what arrived for it so far. Close the subscription when done with the turn.
type ClientInfo ¶
type Conn ¶
type Conn interface {
io.ReadWriteCloser
SetWriteDeadline(t time.Time) error
}
Conn is the app-server's stdio; writes take a deadline so a wedged server fails the write instead of stalling its caller.
type ContextCompactedNotification ¶ added in v0.2.0
type DecodeFailure ¶ added in v0.2.1
DecodeFailure stands for params of a known notification the client could not decode; the IDs are what could be read of its thread and turn.
type ErrorNotification ¶ added in v0.2.0
type FileChangePatchUpdated ¶ added in v0.1.5
type FileChangePatchUpdated struct {
ThreadID string `json:"threadId"`
TurnID string `json:"turnId"`
ItemID string `json:"itemId"`
Changes []FileUpdateChange `json:"changes"`
}
type FileUpdateChange ¶ added in v0.1.5
type FileUpdateChange struct {
Path string `json:"path"`
Diff string `json:"diff"`
Kind json.RawMessage `json:"kind"`
}
type InitializeCapabilities ¶
type InitializeParams ¶
type InitializeParams struct {
ClientInfo ClientInfo `json:"clientInfo"`
Capabilities *InitializeCapabilities `json:"capabilities"`
}
type InitializeResponse ¶
type ItemNotification ¶ added in v0.1.5
type ItemNotification struct {
ThreadID string `json:"threadId"`
TurnID string `json:"turnId"`
Item json.RawMessage `json:"item"`
}
type Notification ¶
type ReasoningTextDelta ¶ added in v0.1.5
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
func NewRuntime ¶
func NewRuntime(opts RuntimeOptions) *Runtime
func (*Runtime) Available ¶ added in v0.2.0
func (r *Runtime) Available(ctx context.Context) externalagents.Availability
func (*Runtime) DisplayName ¶ added in v0.2.0
func (*Runtime) GenerateImage ¶ added in v0.2.4
func (r *Runtime) GenerateImage(ctx context.Context, req externalagents.ImageRequest) ([]byte, error)
GenerateImage runs one `codex exec` turn that draws with Codex's own image generation tool and returns the file Codex saves under $CODEX_HOME/generated_images/<thread id>/. Images go in with --image, so the turn can edit them.
func (*Runtime) Interrupt ¶
func (r *Runtime) Interrupt(ctx context.Context, session externalagents.ExternalSession) error
func (*Runtime) ResumeSession ¶
func (r *Runtime) ResumeSession(ctx context.Context, session externalagents.ExternalSession) (externalagents.ExternalSession, error)
func (*Runtime) Send ¶
func (r *Runtime) Send(ctx context.Context, session externalagents.ExternalSession, input externalagents.Input) (<-chan externalagents.Event, error)
func (*Runtime) StartSession ¶
func (r *Runtime) StartSession(ctx context.Context, req externalagents.StartSessionRequest) (externalagents.ExternalSession, error)
type RuntimeOptions ¶
type TextElement ¶
type TextElement struct{}
type Thread ¶
type Thread struct {
ID string `json:"id"`
SessionID string `json:"sessionId"`
ForkedFromID *string `json:"forkedFromId"`
Preview string `json:"preview"`
Ephemeral bool `json:"ephemeral"`
ModelProvider string `json:"modelProvider"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
Status any `json:"status"`
Path *string `json:"path"`
CWD string `json:"cwd"`
CLIVersion string `json:"cliVersion"`
Name *string `json:"name"`
}
type ThreadResumeParams ¶
type ThreadResumeParams struct {
ThreadID string `json:"threadId"`
Model string `json:"model,omitempty"`
ModelProvider string `json:"modelProvider,omitempty"`
CWD string `json:"cwd,omitempty"`
ApprovalPolicy string `json:"approvalPolicy,omitempty"`
ApprovalsReviewer string `json:"approvalsReviewer,omitempty"`
Sandbox string `json:"sandbox,omitempty"`
}
type ThreadResumeResponse ¶
type ThreadResumeResponse = ThreadStartResponse
type ThreadStartParams ¶
type ThreadStartParams struct {
Model string `json:"model,omitempty"`
ModelProvider string `json:"modelProvider,omitempty"`
CWD string `json:"cwd,omitempty"`
ApprovalPolicy string `json:"approvalPolicy,omitempty"`
ApprovalsReviewer string `json:"approvalsReviewer,omitempty"`
Sandbox string `json:"sandbox,omitempty"`
Ephemeral *bool `json:"ephemeral,omitempty"`
}
type ThreadStartResponse ¶
type ThreadStartResponse struct {
Thread Thread `json:"thread"`
Model string `json:"model"`
ModelProvider string `json:"modelProvider"`
ServiceTier *string `json:"serviceTier"`
CWD string `json:"cwd"`
ApprovalPolicy string `json:"approvalPolicy"`
Sandbox any `json:"sandbox"`
ReasoningEffort *string `json:"reasoningEffort"`
}
type ToolOutputDelta ¶ added in v0.1.5
type Turn ¶
type Turn struct {
ID string `json:"id"`
ThreadID string `json:"threadId,omitempty"`
Status TurnStatus `json:"status"`
Error *TurnError `json:"error,omitempty"`
StartedAt int64 `json:"startedAt,omitempty"`
}
type TurnCompleted ¶
type TurnInterruptParams ¶ added in v0.2.0
type TurnInterruptResponse ¶ added in v0.2.0
type TurnInterruptResponse struct{}
type TurnStartParams ¶
type TurnStartParams struct {
ThreadID string `json:"threadId"`
Input []UserInput `json:"input"`
CWD string `json:"cwd,omitempty"`
ApprovalPolicy string `json:"approvalPolicy,omitempty"`
ApprovalsReviewer string `json:"approvalsReviewer,omitempty"`
Model string `json:"model,omitempty"`
Effort string `json:"effort,omitempty"`
Summary string `json:"summary,omitempty"`
OutputSchema any `json:"outputSchema,omitempty"`
}
type TurnStartResponse ¶
type TurnStartResponse struct {
Turn Turn `json:"turn"`
}
type TurnStarted ¶ added in v0.2.0
type TurnStatus ¶ added in v0.2.0
type TurnStatus string
const ( TurnStatusCompleted TurnStatus = "completed" TurnStatusInterrupted TurnStatus = "interrupted" TurnStatusFailed TurnStatus = "failed" TurnStatusInProgress TurnStatus = "inProgress" )
type TurnSubscription ¶ added in v0.2.1
type TurnSubscription struct {
// contains filtered or unexported fields
}
TurnSubscription is one turn's queue, filled by the read loop and drained by Next.
func (*TurnSubscription) Close ¶ added in v0.2.1
func (s *TurnSubscription) Close()
Close ends the subscription and forgets its turn; later notifications of the turn are backlogged until turnBacklogTTL drops them.
func (*TurnSubscription) Next ¶ added in v0.2.1
func (s *TurnSubscription) Next(ctx context.Context) (Notification, bool)
Next returns the turn's next notification; false once the subscription ended and is drained, or ctx is done.