code

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AvailableModels = []Model{
	{ID: "claude-sonnet-4-6", Name: "Claude Sonnet 4.6"},
	{ID: "claude-sonnet-4-5", Name: "Claude Sonnet 4.5"},

	{ID: "gpt-5.5", Name: "GPT 5.5"},
	{ID: "gpt-5.4", Name: "GPT 5.4"},

	{ID: "gpt-5.3-codex", Name: "GPT 5.3 Codex"},
	{ID: "gpt-5.2-codex", Name: "GPT 5.2 Codex"},

	{ID: "claude-opus-4-7", Name: "Claude Opus 4.7"},
	{ID: "claude-opus-4-6", Name: "Claude Opus 4.6"},
	{ID: "claude-opus-4-5", Name: "Claude Opus 4.5"},
}

AvailableModels is the curated allowlist of models that wingman exposes in its UI. Lives in this package (not pkg/agent) so the underlying agent runtime stays provider-agnostic — pkg/agent doesn't know or care which models are "blessed."

Functions

func BuildInstructions

func BuildInstructions(data prompt.SectionData) string

func ModelName

func ModelName(id string) string

ModelName returns the friendly display name for a model ID, falling back to the ID itself if the model isn't in the curated list.

func ReadProjectInstructions

func ReadProjectInstructions(wd string) string

ReadProjectInstructions walks from wd up to the filesystem root, collecting AGENTS.md and CLAUDE.md files. Returns them concatenated with headers, closest ancestor first. Truncates at 25KB.

Types

type Agent

type Agent struct {
	*agent.Agent

	Root        *os.Root
	RootPath    string
	MemoryPath  string
	ScratchPath string

	Skills []skill.Skill

	MCP *mcp.Manager
	// LSP is set by WarmUp when the workspace is a supported git repo;
	// nil otherwise. Callers nil-check before use.
	LSP *lsp.Manager
	// Rewind is set by WarmUp when the workspace is supported (git repo or
	// small enough to walk in time); nil otherwise. Rewind == nil is the
	// canonical "unsupported workspace" signal — UI shows the limited-mode
	// banner and hides the Changes/Problems tabs.
	Rewind *rewind.Manager
	Bridge *bridge.Bridge

	PlanMode bool
	// contains filtered or unexported fields
}

func New

func New(workDir string, ui UI) (*Agent, error)

func (*Agent) Close

func (a *Agent) Close()

func (*Agent) InitMCP

func (a *Agent) InitMCP(ctx context.Context) error

InitMCP connects MCP servers, fetches their tools, and sets up the IDE bridge. Call this after the UI is ready (typically async).

func (*Agent) InstructionsData

func (a *Agent) InstructionsData() prompt.SectionData

func (*Agent) IsGitRepo

func (a *Agent) IsGitRepo() bool

IsGitRepo reports whether the agent's working directory is currently a git repo. Re-evaluated on each call so callers can react to `git init` (or `rm -rf .git`) happening mid-session.

func (*Agent) MemoryContent

func (a *Agent) MemoryContent() string

func (*Agent) RestartRewind

func (a *Agent) RestartRewind()

RestartRewind tears down the existing rewind manager and creates a fresh one, re-baselining at the current state. Used on /sessions/new so the checkpoint history is scoped to one conversation. No-op on unsupported workspaces (Rewind == nil). LSP is intentionally untouched — gopls/etc. are slow to spin up and shouldn't churn on session boundaries.

func (*Agent) SyncProjectMode

func (a *Agent) SyncProjectMode()

SyncProjectMode rebuilds LSP when the working dir's git status flips (typically: agent ran `git init` in a scratch dir). No-op on unsupported workspaces — `git init` alone doesn't make a 1M-file home folder small enough to support full features.

func (*Agent) WaitWarmUp

func (a *Agent) WaitWarmUp()

WaitWarmUp blocks until WarmUp has completed.

func (*Agent) WarmUp

func (a *Agent) WarmUp()

WarmUp runs the slow workspace probe and initializes Rewind/LSP if the directory is supported. Idempotent and safe to call from any goroutine — the first call does the work, the rest wait on warmupDone. Callers that want to gate on completion (e.g. server startup) can use WaitWarmUp.

Three resulting modes:

  • supported git repo → Rewind set, LSP set, lspTools set
  • supported scratch → Rewind set, LSP nil, lspTools nil
  • unsupported (huge) → Rewind nil, LSP nil; UI falls back to chat-only

type Model

type Model struct {
	ID   string
	Name string
}

Model is a curated entry in wingman's UI model picker. It carries both the upstream provider's ID and a friendly display name.

type UI

type UI interface {
	Ask(ctx context.Context, message string) (string, error)
	Confirm(ctx context.Context, message string) (bool, error)
	StatusUpdate(status string)
}

UI is the interface a frontend must provide to the coding agent.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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