Help us shape the future of Go! Take the 2026 Go Developer Survey

agent

package
v0.2.39 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const CodexBillingRoute = "codex.chatgpt_subscription"
View Source
const CodexVersion = "0.150.1"

Variables

View Source
var ErrDenied = errors.New("official agent effect denied")
View Source
var ErrDisabled = errors.New("official agent route is not qualified")
View Source
var ErrInvalidQualification = errors.New("agent qualification is invalid")
View Source
var ErrProtocol = errors.New("official agent protocol violation")
View Source
var ErrUncertain = errors.New("official agent outcome uncertain; reconcile before retry")

Functions

func Capabilities

func Capabilities(q Qualification, b Binding, provider string, found bool) map[string]domain.Capability

func OfficialSupportMatrix

func OfficialSupportMatrix() map[string]domain.Capability

Types

type AgentExecutor

type AgentExecutor interface {
	ProbeVersionAndAuth(context.Context) (Probe, error)
	Start(context.Context, Request) (string, error)
	StreamEvents(context.Context, string, func(Event) error) error
	DecideApproval(context.Context, string, Approval) error
	DelegateIsolatedCommand(context.Context, string, sandbox.Command) (sandbox.CommandResult, error)
	ResumeIfSupported(context.Context, string) error
	Cancel(context.Context, string) error
}

type Approval

type Approval struct {
	ID         string
	Allow      bool
	Reason     string
	PolicyHash string
}

type AuthService

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

func NewAuthService

func NewAuthService(db *store.Store, identity *auth.Service, reader ConnectionReader, qualifications *QualificationService, factory *Factory) *AuthService

func (*AuthService) Login

func (s *AuthService) Login(ctx context.Context, session auth.Session, org, connectionID string) (Login, error)

func (*AuthService) Logout

func (s *AuthService) Logout(ctx context.Context, session auth.Session, org, connectionID string) error

type Binding

type Binding struct {
	OrgID             string `json:"org_id"`
	ConnectionID      string `json:"connection_id"`
	RunnerID          string `json:"runner_id,omitempty"`
	ConnectionVersion int64  `json:"connection_version"`
	CredentialVersion int64  `json:"credential_version"`
	AccountID         string `json:"account_id"`
	Model             string `json:"model"`
	RuntimeDigest     string `json:"runtime_digest"`
	Deployment        string `json:"deployment"`
}

func BindingFor

func BindingFor(connection connections.Connection) Binding

type Codex

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

func NewCodex

func NewCodex(config CodexConfig) (*Codex, error)

func (*Codex) Cancel

func (c *Codex) Cancel(ctx context.Context, session string) error

func (*Codex) Close

func (c *Codex) Close() error

func (*Codex) DecideApproval

func (c *Codex) DecideApproval(ctx context.Context, session string, approval Approval) error

func (*Codex) DelegateIsolatedCommand

func (c *Codex) DelegateIsolatedCommand(ctx context.Context, session string, command sandbox.Command) (sandbox.CommandResult, error)

func (*Codex) ManagedLogin

func (c *Codex) ManagedLogin(ctx context.Context, action UserAction) (Login, error)

func (*Codex) ManagedLoginStatus

func (c *Codex) ManagedLoginStatus(ctx context.Context, loginID string) (string, error)

func (*Codex) ManagedLogout

func (c *Codex) ManagedLogout(ctx context.Context, action UserAction) error

func (*Codex) ProbeVersionAndAuth

func (c *Codex) ProbeVersionAndAuth(ctx context.Context) (Probe, error)

func (*Codex) ResumeIfSupported

func (c *Codex) ResumeIfSupported(ctx context.Context, session string) error

func (*Codex) Start

func (c *Codex) Start(ctx context.Context, request Request) (string, error)

func (*Codex) StreamEvents

func (c *Codex) StreamEvents(ctx context.Context, session string, emit func(Event) error) error

type CodexConfig

type CodexConfig struct {
	Binding             Binding
	Open                func(context.Context, Binding) (Runtime, error)
	Qualify             func(context.Context, Binding) (Qualification, error)
	Authorize           func(context.Context, Effect, func() error) error
	AuthorizeUserAction func(context.Context, Binding, UserAction, func() error) error
	Sandbox             sandbox.SandboxRuntime
	Timeout             time.Duration
	MaxToolCalls        int
}

type CommandConfig

type CommandConfig struct {
	Executable     string
	Args           []string
	ExpectedSHA256 string
}

type ConnectionReader

type ConnectionReader interface {
	Get(context.Context, auth.Session, string, string) (connections.Connection, error)
}

type ContainerConfig

type ContainerConfig struct {
	Docker      string
	Image       string
	Executable  string
	Args        []string
	Environment []string
}

type Effect

type Effect struct {
	Binding     Binding
	Request     Request
	OperationID string
	Kind        string
	CallID      string
	Arguments   json.RawMessage
}

type Event

type Event struct {
	Type       string
	ID         string
	Text       string
	ApprovalID string
	Command    *sandbox.Command
	Data       json.RawMessage
}

type Factory

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

func NewFactory

func NewFactory(launch Launcher, box sandbox.SandboxRuntime) *Factory

func (*Factory) Bridge

func (f *Factory) Bridge(
	binding Binding,
	qualify func(context.Context, Binding) (Qualification, error),
	authorize func(context.Context, Effect, func() error) error,
	authorizeUser func(context.Context, Binding, UserAction, func() error) error,
) (*Codex, error)

func (*Factory) Configured

func (f *Factory) Configured() bool

type Launcher

type Launcher func(context.Context, Binding) (Runtime, error)

func NewCommandLauncher

func NewCommandLauncher(config CommandConfig) Launcher

func NewContainerLauncher

func NewContainerLauncher(config ContainerConfig) Launcher

type Login

type Login struct {
	ID   string `json:"id"`
	URL  string `json:"url"`
	Code string `json:"code,omitempty"`
}

func (Login) GoString

func (l Login) GoString() string

func (Login) LogValue

func (l Login) LogValue() slog.Value

func (Login) String

func (l Login) String() string

type Probe

type Probe struct {
	Runtime      string
	Version      string
	AuthState    string
	BillingRoute string
	Features     map[string]domain.Capability
}

type Qualification

type Qualification struct {
	Binding               Binding   `json:"binding"`
	EvidenceID            string    `json:"evidence_id"`
	CheckedAt             time.Time `json:"checked_at"`
	ExpiresAt             time.Time `json:"expires_at"`
	AuthCustody           bool      `json:"auth_custody"`
	NativeToolContainment bool      `json:"native_tool_containment"`
	Terms                 bool      `json:"terms"`
	Topology              bool      `json:"topology"`
	Entitlement           bool      `json:"entitlement"`
	Quota                 bool      `json:"quota"`
	NoPaidOverage         bool      `json:"no_paid_overage"`
}

type QualificationService

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

func NewQualificationService

func NewQualificationService(db *store.Store, identity *auth.Service) *QualificationService

func (*QualificationService) Delete

func (s *QualificationService) Delete(ctx context.Context, session auth.Session, org, connectionID string) error

func (*QualificationService) Get

func (s *QualificationService) Get(ctx context.Context, session auth.Session, org, connectionID string) (Qualification, bool, error)

func (*QualificationService) Put

func (s *QualificationService) Put(ctx context.Context, session auth.Session, org, connectionID string, q Qualification) (Qualification, error)

type Request

type Request struct {
	JobID      string
	AttemptID  string
	Prompt     string
	Workspace  sandbox.Workspace
	Model      string
	PolicyHash string
	MaxTurns   int
}

type Runtime

type Runtime struct {
	Transport Transport
	Binding   Binding
}

type StdioProcess

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

func StartPreparedRuntime

func StartPreparedRuntime(command *exec.Cmd) (*StdioProcess, error)

func (*StdioProcess) Close

func (p *StdioProcess) Close() error

func (*StdioProcess) Read

func (p *StdioProcess) Read(b []byte) (int, error)

func (*StdioProcess) Write

func (p *StdioProcess) Write(b []byte) (int, error)

type Transport

type Transport interface {
	io.Reader
	io.Writer
	io.Closer
}

type UserAction

type UserAction struct {
	ID     string
	UserID string
	Kind   string
}

Jump to

Keyboard shortcuts

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