code

package
v0.6.9 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MIT Imports: 32 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 lives here (not pkg/agent) so the agent runtime stays provider-agnostic.

Functions

func BuildInstructions

func BuildInstructions(data prompt.SectionData) string

func ModelName

func ModelName(id string) string

func ReadProjectInstructions

func ReadProjectInstructions(wd string) string

ReadProjectInstructions walks from wd up to the filesystem root, concatenating AGENTS.md / CLAUDE.md with headers, closest ancestor first. Truncates at 25KB. Use Agent.projectInstructions for the cached path.

func SessionsDir added in v0.6.9

func SessionsDir(workingDir string) string

Types

type Agent

type Agent struct {
	*agent.Agent
	*Workspace

	PlanMode bool
	// contains filtered or unexported fields
}

func (*Agent) Instructions added in v0.6.9

func (a *Agent) Instructions() string

func (*Agent) InstructionsData

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

type Model

type Model struct {
	ID   string
	Name string
}

type UI

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

UI is the elicitation hook a frontend provides for tool ask/confirm prompts. Pass nil to NewAgent for safe defaults (Confirm → true, Ask → "").

type Workspace added in v0.6.9

type Workspace struct {
	Root        *os.Root
	RootPath    string
	MemoryPath  string
	ScratchPath string

	Skills []skill.Skill

	MCP *mcp.Manager
	// LSP and Rewind are set by WarmUp; nil for unsupported workspaces.
	LSP    *lsp.Manager
	Rewind *rewind.Manager
	// contains filtered or unexported fields
}

func NewWorkspace added in v0.6.9

func NewWorkspace(workDir string) (*Workspace, error)

func (*Workspace) Checkpoints added in v0.6.9

func (w *Workspace) Checkpoints() ([]rewind.Checkpoint, error)

func (*Workspace) Close added in v0.6.9

func (w *Workspace) Close()

func (*Workspace) Commit added in v0.6.9

func (w *Workspace) Commit(msg string) error

func (*Workspace) Diagnostics added in v0.6.9

func (w *Workspace) Diagnostics(ctx context.Context) map[string][]lsp.Diagnostic

func (*Workspace) Diffs added in v0.6.9

func (w *Workspace) Diffs() ([]rewind.FileDiff, error)

func (*Workspace) InitMCP added in v0.6.9

func (w *Workspace) InitMCP(ctx context.Context) error

func (*Workspace) IsGitRepo added in v0.6.9

func (w *Workspace) IsGitRepo() bool

IsGitRepo is re-evaluated each call so callers can react to mid-session `git init` / `rm -rf .git`.

func (*Workspace) MemoryContent added in v0.6.9

func (w *Workspace) MemoryContent() string

MemoryContent renders an index of the memory dir for injection into the system prompt: one line per `*.md` file with a short hook. The hook is the file's frontmatter `description`, falling back to the first non-empty line of the body (heading markers stripped). Cached by per-file mtime so repeat turns don't re-read.

func (*Workspace) NewAgent added in v0.6.9

func (ws *Workspace) NewAgent(cfg *agent.Config, ui UI) *Agent

func (*Workspace) Restore added in v0.6.9

func (w *Workspace) Restore(hash string) error

func (*Workspace) SyncProjectMode added in v0.6.9

func (w *Workspace) SyncProjectMode()

SyncProjectMode rebuilds LSP when the working dir's git status flips. No-op on unsupported workspaces.

func (*Workspace) WarmUp added in v0.6.9

func (w *Workspace) WarmUp()

WarmUp probes the workspace and initializes Rewind/LSP. Idempotent. 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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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