agent

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildUserPrompt

func BuildUserPrompt(input PromptInput) (string, error)

func ExecutePlan

func ExecutePlan(ctx context.Context, dir string, plan ExecutionPlan) error

func GoalSystemPrompt

func GoalSystemPrompt() string

Types

type ActionKind

type ActionKind string
const (
	ActionSortRule ActionKind = "sort_rule"
	ActionDedupe   ActionKind = "dedupe"
	ActionRename   ActionKind = "rename"
	ActionMkdir    ActionKind = "mkdir"
)

type DirectorySnapshot

type DirectorySnapshot struct {
	FileCount       int            `json:"file_count"`
	FolderCount     int            `json:"folder_count"`
	ObservedFiles   []string       `json:"observed_files"`
	ObservedFolders []string       `json:"observed_folders"`
	ExtensionCounts map[string]int `json:"extension_counts"`
}

func SummarizeDirectory

func SummarizeDirectory(ctx context.Context, dir string) (DirectorySnapshot, error)

type ExecutionPlan

type ExecutionPlan struct {
	Summary          string          `json:"summary"`
	RequestFilenames []string        `json:"request_filenames,omitempty"`
	Actions          []PlannedAction `json:"actions"`
}

func ParseExecutionPlan

func ParseExecutionPlan(raw string) (ExecutionPlan, error)

func (ExecutionPlan) String

func (p ExecutionPlan) String() string

func (*ExecutionPlan) Validate

func (p *ExecutionPlan) Validate() error

type MkdirAction

type MkdirAction struct {
	Path string `json:"path"`
}

type PlannedAction

type PlannedAction struct {
	Kind     ActionKind      `json:"kind"`
	SortRule *SortRuleAction `json:"sort_rule,omitempty"`
	Rename   *RenameAction   `json:"rename,omitempty"`
	Mkdir    *MkdirAction    `json:"mkdir,omitempty"`
}

func (*PlannedAction) ToSorter

func (a *PlannedAction) ToSorter() (core.Sorter, error)

type PromptInput

type PromptInput struct {
	Directory   string            `json:"directory"`
	Instruction string            `json:"instruction"`
	Observed    DirectorySnapshot `json:"observed_names"`
	UserHints   []string          `json:"user_hints"`
}

type RenameAction

type RenameAction struct {
	Files []string `json:"files,omitempty"`
	Hints []string `json:"hints,omitempty"`
}

type Session

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

func NewSession

func NewSession(client llm.Client, opts SessionOptions) *Session

func (*Session) Plan

func (s *Session) Plan(ctx context.Context, dir, instruction, model string, hints []string) (ExecutionPlan, error)

type SessionOptions

type SessionOptions struct {
	MaxSteps int
}

type SortRuleAction

type SortRuleAction struct {
	Folder   string   `json:"folder"`
	Keywords []string `json:"keywords"`
}

Jump to

Keyboard shortcuts

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