agentruntime

package
v0.35.4 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClaudeVersion

func ClaudeVersion(path string) string

func CodexVersion

func CodexVersion(path string) string

func FindBinary

func FindBinary(kind Kind) (string, error)

func OpenCodeVersion

func OpenCodeVersion(path string) string

func ParseCodexJSONEvent

func ParseCodexJSONEvent(line []byte) map[string]any

Types

type AuthStatus

type AuthStatus struct {
	LoggedIn bool
	Email    string
	Plan     string
	Detail   string
}

func CheckClaudeAuth

func CheckClaudeAuth(path string) *AuthStatus

func CheckCodexAuth

func CheckCodexAuth(path string) *AuthStatus

func CheckOpenCodeAuth

func CheckOpenCodeAuth(path string) *AuthStatus

type ClaudeRuntime

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

func NewClaude

func NewClaude(path string) *ClaudeRuntime

func (*ClaudeRuntime) AuthStatus

func (r *ClaudeRuntime) AuthStatus() *AuthStatus

func (*ClaudeRuntime) BinaryPath

func (r *ClaudeRuntime) BinaryPath() string

func (*ClaudeRuntime) DefaultModel

func (r *ClaudeRuntime) DefaultModel(_ Phase) string

func (*ClaudeRuntime) Descriptor

func (r *ClaudeRuntime) Descriptor() Descriptor

func (*ClaudeRuntime) DisplayName

func (r *ClaudeRuntime) DisplayName() string

func (*ClaudeRuntime) Generate

func (r *ClaudeRuntime) Generate(ctx context.Context, userMessage string, opts GenerateOpts) (*Response, error)

func (*ClaudeRuntime) GenerateStreaming

func (r *ClaudeRuntime) GenerateStreaming(ctx context.Context, userMessage string, opts GenerateOpts, onEvent func(StreamEvent)) (*Response, error)

func (*ClaudeRuntime) Kind

func (r *ClaudeRuntime) Kind() Kind

func (*ClaudeRuntime) RunInteractive

func (r *ClaudeRuntime) RunInteractive(ctx context.Context, prompt string, opts InteractiveOpts, onEvent func(StreamEvent), onQuestion func(question string) string) (*Response, error)

func (*ClaudeRuntime) SuggestedModels

func (r *ClaudeRuntime) SuggestedModels() []ModelOption

func (*ClaudeRuntime) SupportsInteractive

func (r *ClaudeRuntime) SupportsInteractive() bool

func (*ClaudeRuntime) Version

func (r *ClaudeRuntime) Version() string

type CodexRuntime

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

func NewCodex

func NewCodex(path string) *CodexRuntime

func (*CodexRuntime) AuthStatus

func (r *CodexRuntime) AuthStatus() *AuthStatus

func (*CodexRuntime) BinaryPath

func (r *CodexRuntime) BinaryPath() string

func (*CodexRuntime) DefaultModel

func (r *CodexRuntime) DefaultModel(_ Phase) string

func (*CodexRuntime) Descriptor

func (r *CodexRuntime) Descriptor() Descriptor

func (*CodexRuntime) DisplayName

func (r *CodexRuntime) DisplayName() string

func (*CodexRuntime) Generate

func (r *CodexRuntime) Generate(ctx context.Context, userMessage string, opts GenerateOpts) (*Response, error)

func (*CodexRuntime) GenerateStreaming

func (r *CodexRuntime) GenerateStreaming(ctx context.Context, userMessage string, opts GenerateOpts, onEvent func(StreamEvent)) (*Response, error)

func (*CodexRuntime) Kind

func (r *CodexRuntime) Kind() Kind

func (*CodexRuntime) RunInteractive

func (r *CodexRuntime) RunInteractive(_ context.Context, _ string, _ InteractiveOpts, _ func(StreamEvent), _ func(question string) string) (*Response, error)

func (*CodexRuntime) SuggestedModels

func (r *CodexRuntime) SuggestedModels() []ModelOption

func (*CodexRuntime) SupportsInteractive

func (r *CodexRuntime) SupportsInteractive() bool

func (*CodexRuntime) Version

func (r *CodexRuntime) Version() string

type Descriptor

type Descriptor struct {
	Kind                Kind
	DisplayName         string
	BinaryName          string
	InstallCommand      string
	SetupHint           string
	SupportsInteractive bool
}

func AllDescriptors

func AllDescriptors() []Descriptor

func DescriptorForKind

func DescriptorForKind(kind Kind) Descriptor

type GenerateOpts

type GenerateOpts = claude.GenerateOpts

type InteractiveOpts

type InteractiveOpts = claude.InteractiveOpts

type Kind

type Kind string
const (
	KindClaude   Kind = "claude"
	KindCodex    Kind = "codex"
	KindOpenCode Kind = "opencode"
)

func FirstInstalledKind

func FirstInstalledKind() (Kind, string, bool)

func NormalizeKind

func NormalizeKind(raw string) Kind

func SupportedKinds

func SupportedKinds() []Kind

type ModelOption

type ModelOption struct {
	ID          string
	Description string
}

func MergeModelOptions

func MergeModelOptions(groups ...[]ModelOption) []ModelOption

type OpenCodeRuntime

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

func NewOpenCode

func NewOpenCode(path string) *OpenCodeRuntime

func (*OpenCodeRuntime) AuthStatus

func (r *OpenCodeRuntime) AuthStatus() *AuthStatus

func (*OpenCodeRuntime) BinaryPath

func (r *OpenCodeRuntime) BinaryPath() string

func (*OpenCodeRuntime) DefaultModel

func (r *OpenCodeRuntime) DefaultModel(_ Phase) string

func (*OpenCodeRuntime) Descriptor

func (r *OpenCodeRuntime) Descriptor() Descriptor

func (*OpenCodeRuntime) DisplayName

func (r *OpenCodeRuntime) DisplayName() string

func (*OpenCodeRuntime) Generate

func (r *OpenCodeRuntime) Generate(ctx context.Context, userMessage string, opts GenerateOpts) (*Response, error)

func (*OpenCodeRuntime) GenerateStreaming

func (r *OpenCodeRuntime) GenerateStreaming(ctx context.Context, userMessage string, opts GenerateOpts, onEvent func(StreamEvent)) (*Response, error)

func (*OpenCodeRuntime) Kind

func (r *OpenCodeRuntime) Kind() Kind

func (*OpenCodeRuntime) RunInteractive

func (r *OpenCodeRuntime) RunInteractive(_ context.Context, _ string, _ InteractiveOpts, _ func(StreamEvent), _ func(question string) string) (*Response, error)

func (*OpenCodeRuntime) SuggestedModels

func (r *OpenCodeRuntime) SuggestedModels() []ModelOption

func (*OpenCodeRuntime) SupportsInteractive

func (r *OpenCodeRuntime) SupportsInteractive() bool

func (*OpenCodeRuntime) Version

func (r *OpenCodeRuntime) Version() string

type Phase

type Phase string
const (
	PhaseIntent   Phase = "intent"
	PhaseAnalyze  Phase = "analyze"
	PhasePlan     Phase = "plan"
	PhaseBuild    Phase = "build"
	PhaseFix      Phase = "fix"
	PhaseQuestion Phase = "question"
)

type Response

type Response = claude.Response

type Runtime

type Runtime interface {
	Kind() Kind
	DisplayName() string
	Descriptor() Descriptor
	BinaryPath() string
	Version() string
	AuthStatus() *AuthStatus
	DefaultModel(phase Phase) string
	SuggestedModels() []ModelOption
	SupportsInteractive() bool
	GenerateStreaming(ctx context.Context, userMessage string, opts GenerateOpts, onEvent func(StreamEvent)) (*Response, error)
	Generate(ctx context.Context, userMessage string, opts GenerateOpts) (*Response, error)
	RunInteractive(ctx context.Context, prompt string, opts InteractiveOpts, onEvent func(StreamEvent), onQuestion func(question string) string) (*Response, error)
}

func New

func New(kind Kind, path string) (Runtime, error)

type StreamEvent

type StreamEvent = claude.StreamEvent

type Usage

type Usage = claude.Usage

Jump to

Keyboard shortcuts

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