agent

package
v0.149.5 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultOllamaModel = "qwen3:4b"

DefaultOllamaModel is small enough for a developer workstation while still supporting Ollama's native structured tool-call protocol. Keep the catalog and headless adapter on the same model so PTY and prompt behavior agree.

Variables

This section is empty.

Functions

func InteractiveInvocation added in v0.144.0

func InteractiveInvocation(name string, unattended bool, resumeSessionID string, extra ...string) (string, []string, bool)

InteractiveInvocation builds the executable and arguments for a PTY-backed agent. Resume subcommands include the requested session ID explicitly.

extra is passed through verbatim after everything Wingthing generates, so a caller can select a model or set any other agent flag without Wingthing having to model that agent's options. Later flags win in every supported CLI, so appending is what makes the passthrough an override.

func SandboxFailure added in v0.149.0

func SandboxFailure(err error) error

SandboxFailure wraps a diagnostic produced by Wingthing's own policy code.

Types

type Agent

type Agent interface {
	Run(ctx context.Context, prompt string, opts RunOpts) (*Stream, error)
	Health() error
	ContextWindow() int
}

type Chunk

type Chunk struct {
	Text string
}

type Claude

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

func NewClaude

func NewClaude(contextWindow int) *Claude

func (*Claude) ContextWindow

func (c *Claude) ContextWindow() int

func (*Claude) Health

func (c *Claude) Health() error

func (*Claude) Run

func (c *Claude) Run(ctx context.Context, prompt string, opts RunOpts) (_ *Stream, err error)

type CmdFactory

type CmdFactory func(ctx context.Context, name string, args []string) (*exec.Cmd, error)

CmdFactory creates an exec.Cmd that may run inside a sandbox. When nil, agents fall back to exec.CommandContext.

type Codex

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

func NewCodex

func NewCodex(ctxWindow int) *Codex

func (*Codex) ContextWindow

func (c *Codex) ContextWindow() int

func (*Codex) Health

func (c *Codex) Health() error

func (*Codex) Run

func (c *Codex) Run(ctx context.Context, prompt string, opts RunOpts) (_ *Stream, err error)

type Cursor

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

func NewCursor

func NewCursor(ctxWindow int) *Cursor

func (*Cursor) ContextWindow

func (c *Cursor) ContextWindow() int

func (*Cursor) Health

func (c *Cursor) Health() error

func (*Cursor) Run

func (c *Cursor) Run(ctx context.Context, prompt string, opts RunOpts) (_ *Stream, err error)

type Definition added in v0.144.0

type Definition struct {
	Name                 string
	Command              string
	InteractiveArgs      []string
	UnattendedArgs       []string
	ResumeFlag           string
	ResumeSubcommand     bool
	ProviderSubstitution bool // accepts a non-vendor/local provider endpoint without patching the harness
	ReleaseCanary        bool // covered by the opt-in provider-substitution release matrix
	MaxParallel          int  // 0 means no agent-specific limit beyond the caller's budget
}

Definition is the executable contract Wingthing uses to discover and start an interactive coding agent. Headless prompt adapters live beside this catalog, but discovery and PTY launch must share this single source of truth.

func Definitions added in v0.144.0

func Definitions() []Definition

Definitions returns an isolated copy of the supported-agent catalog.

func LookupDefinition added in v0.144.0

func LookupDefinition(name string) (Definition, bool)

LookupDefinition resolves an agent name to its executable contract.

type ErrorKind added in v0.149.0

type ErrorKind string
const (
	ProviderRefused  ErrorKind = "provider_refused"
	AuthFailed       ErrorKind = "auth_failed"
	RateLimited      ErrorKind = "rate_limited"
	ContextExhausted ErrorKind = "context_exhausted"
	SandboxDenied    ErrorKind = "sandbox_denied"
	ProviderError    ErrorKind = "provider_error"
	ProviderExit     ErrorKind = "provider_exit"
	ProviderNotReady ErrorKind = "provider_not_ready"
	Timeout          ErrorKind = "timeout"
	Stopped          ErrorKind = "stopped"
	UnknownOutcome   ErrorKind = "unknown_outcome"
	InputConflict    ErrorKind = "input_conflict"
)

func ClassifyProviderDiagnostic added in v0.149.0

func ClassifyProviderDiagnostic(text string) ErrorKind

ClassifyProviderDiagnostic is for bounded transient native error diagnostics.

func ClassifyProviderFailure added in v0.149.0

func ClassifyProviderFailure(provider string, record []byte) (ErrorKind, bool)

ClassifyProviderFailure consumes native failure records without retaining diagnostics.

func FailureKind added in v0.149.0

func FailureKind(err error) ErrorKind

type Failure added in v0.149.0

type Failure struct {
	Kind     ErrorKind
	Provider string
	// contains filtered or unexported fields
}

Failure contains only Wingthing-authored diagnostics. Provider messages are classification input and must never be retained in an error or its cause.

func (*Failure) Error added in v0.149.0

func (f *Failure) Error() string

func (*Failure) Unwrap added in v0.149.0

func (f *Failure) Unwrap() error

type Gemini

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

func NewGemini

func NewGemini(model string, ctxWindow int) *Gemini

func (*Gemini) ContextWindow

func (g *Gemini) ContextWindow() int

func (*Gemini) Health

func (g *Gemini) Health() error

func (*Gemini) Run

func (g *Gemini) Run(ctx context.Context, prompt string, opts RunOpts) (_ *Stream, err error)

type Hermes added in v0.144.0

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

Hermes adapts Nous Research's pure one-shot interface. `hermes -z` is deliberately machine-facing: one prompt in, final response on stdout, no banner/spinner/session preamble.

func NewHermes added in v0.144.0

func NewHermes(ctxWindow int) *Hermes

func (*Hermes) ContextWindow added in v0.144.0

func (h *Hermes) ContextWindow() int

func (*Hermes) Health added in v0.144.0

func (h *Hermes) Health() error

func (*Hermes) Run added in v0.144.0

func (h *Hermes) Run(ctx context.Context, prompt string, opts RunOpts) (_ *Stream, err error)

type Ollama

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

func NewOllama

func NewOllama(model string, ctxWindow int) *Ollama

func (*Ollama) ContextWindow

func (o *Ollama) ContextWindow() int

func (*Ollama) Health

func (o *Ollama) Health() error

func (*Ollama) Run

func (o *Ollama) Run(ctx context.Context, prompt string, opts RunOpts) (_ *Stream, err error)

type OpenCode added in v0.121.0

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

func NewOpenCode added in v0.121.0

func NewOpenCode(ctxWindow int) *OpenCode

func (*OpenCode) ContextWindow added in v0.121.0

func (o *OpenCode) ContextWindow() int

func (*OpenCode) Health added in v0.121.0

func (o *OpenCode) Health() error

func (*OpenCode) Run added in v0.121.0

func (o *OpenCode) Run(ctx context.Context, prompt string, opts RunOpts) (_ *Stream, err error)

type RunOpts

type RunOpts struct {
	AllowedTools        []string
	SystemPrompt        string
	ReplaceSystemPrompt bool
	Timeout             time.Duration
	WorkDir             string
	Model               string
	CmdFactory          CmdFactory
}

type Stream

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

func NewTestStream

func NewTestStream(text string) *Stream

NewTestStream creates a Stream pre-loaded with the given text, for testing.

func (*Stream) Err

func (s *Stream) Err() error

func (*Stream) Next

func (s *Stream) Next() (Chunk, bool)

func (*Stream) SetTokens

func (s *Stream) SetTokens(input, output int)

func (*Stream) Text

func (s *Stream) Text() string

func (*Stream) Tokens

func (s *Stream) Tokens() (input, output int)

Jump to

Keyboard shortcuts

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