agent

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendPrefrontal

func AppendPrefrontal(path, content string)

func AutoCondenseIfNeeded

func AutoCondenseIfNeeded(cfg Config) (bool, error)

func BuildDeveloperMessage

func BuildDeveloperMessage(agentConfig, soul, neo, stmContext, convContext, prompt string, refs []FileRef, fileList []string, listTruncated bool) string

func ClearShortTerm

func ClearShortTerm(cfg Config) error

func CondenseShortTerm

func CondenseShortTerm(cfg Config) (string, error)

func ContextFileSize

func ContextFileSize(brainDir string) int

func EnsureBrainLayout

func EnsureBrainLayout(brainDir, repoRoot string) error

func ExtractFileMentions

func ExtractFileMentions(prompt string) []string

func FormatDeletesSummary

func FormatDeletesSummary(deletes []DeleteOp) string

func FormatDeletesSummaryWithTitle

func FormatDeletesSummaryWithTitle(title string, deletes []DeleteOp) string

func FormatPatchesSummary

func FormatPatchesSummary(patches []PatchOp) string

func FormatPatchesSummaryWithTitle

func FormatPatchesSummaryWithTitle(title string, patches []PatchOp) string

func FormatWritesSummary

func FormatWritesSummary(writes []WriteOp) string

func FormatWritesSummaryWithTitle

func FormatWritesSummaryWithTitle(title string, writes []WriteOp) string

func ListFiles

func ListFiles(root string, maxFiles int) ([]string, bool)

func ListRelevantFiles

func ListRelevantFiles(root, prompt string, maxFiles int) ([]string, bool)

func ParseReadLines

func ParseReadLines(s string) []string

func ProjectConfigPath

func ProjectConfigPath(root string) string

func ResolveBrainDir

func ResolveBrainDir() (string, error)

func SaveProjectConfig

func SaveProjectConfig(root string, cfg ProjectConfig) error

func WritePrefrontalHeader

func WritePrefrontalHeader(path, prompt string, mentions []string, refs []FileRef) error

Types

type Config

type Config struct {
	RootDir             string
	BrainDir            string
	Model               string
	TimeoutSec          int
	NeoPath             string
	PrefrontalPath      string
	StmMaxBytes         int
	StmContextBytes     int
	ConversationBytes   int
	ContextBudgetTokens int
	AllowReadAll        bool
	ApplyWrites         bool
	ReadPaths           []string
	MaxFilesListed      int
	MaxFileBytes        int
	MaxTotalReadBytes   int
}

type DeleteOp

type DeleteOp struct {
	Path string
}

func ApplyDeletes

func ApplyDeletes(root string, deletes []DeleteOp) []DeleteOp

func ParseDeleteLines

func ParseDeleteLines(s string) []DeleteOp

type FileRef

type FileRef struct {
	Mention string
	Path    string
	Content string
	Err     error
}

func LoadMentionedFiles

func LoadMentionedFiles(root string, mentions []string, allowRead bool, maxFileBytes, maxTotalBytes int) []FileRef

func MergeFileRefs

func MergeFileRefs(a, b []FileRef) []FileRef

type MemoryStats

type MemoryStats struct {
	LtmLines int
	StmLines int
	LtmBytes int
	StmBytes int
}

func GetMemoryStats

func GetMemoryStats(brainDir, neoPath, prefrontalPath string) (MemoryStats, error)

type PatchOp

type PatchOp struct {
	Path  string
	Patch string
}

func ApplyPatches

func ApplyPatches(root string, patches []PatchOp) []PatchOp

func ParsePatchBlocks

func ParsePatchBlocks(s string) []PatchOp

type PermissionState

type PermissionState struct {
	Project    ProjectConfig
	AllowRead  bool
	AllowWrite bool
	DenyWrite  bool
}

func ResolvePermissionState

func ResolvePermissionState(root string, envRead, envWrite bool) PermissionState

type ProjectConfig

type ProjectConfig struct {
	AllowReadAlways  bool `json:"allow_read_always"`
	AllowWriteAlways bool `json:"allow_write_always"`
	DenyWriteAlways  bool `json:"deny_write_always"`
}

func LoadProjectConfig

func LoadProjectConfig(root string) ProjectConfig

type Result

type Result struct {
	LLMOutput         string
	ProposedWrites    []WriteOp
	ProposedDeletes   []DeleteOp
	ProposedPatches   []PatchOp
	AppliedWrites     []WriteOp
	AppliedDeletes    []DeleteOp
	AppliedPatches    []PatchOp
	Applied           bool
	PrefrontalPath    string
	Mentions          []string
	FileRefs          []FileRef
	FileList          []string
	FileListTruncated bool
	Memory            MemoryStats
	Condensed         bool
}

func Run

func Run(prompt string, cfg Config) (Result, error)

func RunStream

func RunStream(prompt string, cfg Config, onDelta func(string)) (Result, error)

type UsageStats

type UsageStats struct {
	LtmBytes         int
	StmBytes         int
	StmContextBytes  int
	ConvBytes        int
	ConvContextBytes int
	ApproxTokens     int
	BudgetTokens     int
}

func GetUsageStats

func GetUsageStats(cfg Config) (UsageStats, error)

type WriteOp

type WriteOp struct {
	Path    string
	Content string
}

func ApplyWrites

func ApplyWrites(root string, writes []WriteOp) []WriteOp

func ParseWriteBlocks

func ParseWriteBlocks(s string) []WriteOp

Jump to

Keyboard shortcuts

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