Versions in this module Expand all Collapse all v0 v0.8.2 May 24, 2026 v0.8.1 May 20, 2026 v0.8.0 May 17, 2026 v0.7.10 May 13, 2026 v0.7.9 May 11, 2026 v0.7.8 May 7, 2026 Changes in this version + func KnownToolNames() []string type ToolContent + Warning string v0.7.7 May 3, 2026 v0.7.6 May 3, 2026 v0.7.5 May 2, 2026 v0.7.4 Apr 27, 2026 v0.7.3 Apr 3, 2026 Changes in this version + var DefaultToolResultTruncator = &ToolResultTruncator + var SegmentExamples = map[string]string + func AllExampleNames() []string + func ArrangeArgs(ctx context.Context, cacheFile string) (context.Context, bool) + func ContentLikePattern(maxLength int) string + func CreateOrGetSessionID(ctx context.Context) (sessionID int64, err error) + func CreateProjectSkill(ctx context.Context, id int64) (err error) + func CreateSegment(domainID, modelID int64, name, content string, sortOrder int) (err error) + func CreateSkill(ctx context.Context, skill *Skill) error + func Error(err error) string + func ExampleUsage() string + func FixBrokenJSON(broken string) (result string) + func GetCurrentDomainID(ctx context.Context) int64 + func GetCurrentModelID(ctx context.Context) int64 + func GetCurrentSessionID(ctx context.Context) (sessionID int64) + func GetEnhancedSystemPrompt(ctx context.Context) string + func GetExampleSegment(name string) string + func GetOrCreateCacheFile(ctx context.Context, script string) (cacheFile string, err error) + func GetOrCreateTool(name, description, category string) (int64, error) + func GetSystemPrompt(ctx context.Context) string + func GetTemplateSystemPrompt(ctx context.Context) string + func GetTokenFromNetrc(host string) (string, error) + func GetToolDisplayName(name string) string + func GuessLanguage(path string) string + func HandleToolCall(ctx context.Context, toolName string, argsRaw string) (result string, user string, err error) + func JudgeHistory(messages []*Message) + func OpenEditor(ctx context.Context, initialContent string) (content string, err error) + func RecordSkillUsage(skillID int64, projectPath string) error + func RecordToolUsage(ctx context.Context, toolID int64, success bool, errorMsg string) error + func RegisterTool(tool ToolDef) + func RunShell(ctx context.Context, script string) (result string, err error) + func SafeAsyncRecordUsage(skillID int64, projectPath string) + func SaveMessages(ctx context.Context, msgs ...Message) error + func Shebang(script string) (name string, arg []string) + func ShellExec(ctx context.Context, script string) (out string, err error) + func ShortenShellScript(ctx context.Context, script string) string + func TitleLikePattern(maxLength int) string + func ToArrayType[T PrimitiveType](anyValues []any, anyValuesLen int) []T + func ToSQLNullString(tcs []ToolCall) (toolCalls sql.NullString) + func ToolArgsValue[T Primitive](args ToolArgs, key string, defaultValue T) T + func ToolCallsID(tcs []ToolCall) string + func TruncateHead(s string, maxLen int) string + func TruncateHeadTail(s string, maxLen int) string + func TruncateJSON(content string, maxRunes int) string + func TruncateMarkdown(content string, maxRunes int) string + func TruncateString(s string, maxLen int) string + func TruncateSummary(result string, maxRunes int) string + func TruncateTail(s string, maxLen int) string + func TruncateToolResult(result string) string + func UpdateContent(ctx context.Context, id int64, content string) (err error) + func UpdateHistory(ctx context.Context, id int64) (err error) + func UpdateSegmentContent(id int64, content string) (err error) + func UpdateToolCalls(ctx context.Context, id int64, tcs []ToolCall) (err error) + type ArrayType interface + type Domain struct + CreatedAt time.Time + Description string + ID int64 + Name string + type FileStructure struct + Classes []*Symbol + Errors []string + FilePath string + Functions []*Symbol + Imports []string + Language string + Package string + func ParseFileStructure(ctx context.Context, filePath string) (*FileStructure, error) + func ParseFileStructure0(ctx context.Context, filePath, lang string, usePython bool) (*FileStructure, error) + type Function struct + Description string + Name string + Parameters map[string]any + Strict bool + type Message struct + Content string + CreatedAt time.Time + ID int64 + ModelID int64 + OK bool + ReasoningContent string + Role string + SessionID int64 + ToolCallID string + ToolCalls []ToolCall + func BuildSystemMessages(ctx context.Context) ([]Message, error) + func BuildSystemMessagesWithSegments(ctx context.Context) ([]Message, error) + func CleanupReverse(messages []Message) (cleaned []Message) + func HandleToolCalls(ctx context.Context, tcs []ToolCall) (inputs []Message) + func ListHistory(ctx context.Context) ([]*Message, error) + func LoadEnhancedPrompts(ctx context.Context) ([]Message, error) + func LoadHistory(ctx context.Context) ([]Message, error) + func LoadPrompts(ctx context.Context) ([]Message, error) + func LoadSkills(ctx context.Context) (messages []Message, err error) + func ShowMessage(ctx context.Context, id int64) (message *Message, err error) + func (m *Message) GetTokens() int + type NetrcEntry struct + Login string + Machine string + Password string + func ParseNetrc(path string) ([]NetrcEntry, error) + type Primitive interface + type PrimitiveType interface + type ProjectDomain struct + CreatedAt time.Time + DomainID int64 + ID int64 + ProjectRoot string + type ProjectSkill struct + EnabledAt time.Time + IsEnabled bool + LastUsed sql.NullTime + ProjectPath string + SkillID int64 + type PromptSegment struct + Content string + CreatedAt time.Time + DomainID int64 + Enabled bool + ID int64 + ModelID int64 + Name string + SortOrder int + UpdatedAt time.Time + type SegmentManager struct + func NewSegmentManager() *SegmentManager + func (sm *SegmentManager) CreateSegment(ctx context.Context, domainID, modelID int64, name, content string, ...) error + func (sm *SegmentManager) DeleteSegment(ctx context.Context, id int64) error + func (sm *SegmentManager) GetDomainByID(ctx context.Context, id int64) (*Domain, error) + func (sm *SegmentManager) GetSegmentByID(ctx context.Context, id int64) (*PromptSegment, error) + func (sm *SegmentManager) GetSegmentsForPrompt(ctx context.Context, modelID int64, domainID int64) ([]PromptSegment, error) + func (sm *SegmentManager) GetSystemPrompt(ctx context.Context, modelID int64, domainID int64) (string, error) + func (sm *SegmentManager) ListDomains(ctx context.Context) ([]Domain, error) + func (sm *SegmentManager) ListSegments(ctx context.Context) ([]PromptSegment, error) + func (sm *SegmentManager) RenderSystemPrompt(ctx context.Context, modelID int64, domainID int64, config *SystemPromptConfig) (string, error) + func (sm *SegmentManager) UpdateSegment(ctx context.Context, id int64, name, content string, sortOrder int, ...) error + type SegmentTemplateRenderer struct + func NewSegmentTemplateRenderer(ctx context.Context) *SegmentTemplateRenderer + func (r *SegmentTemplateRenderer) GetSegmentsForProject() (segment []PromptSegment, err error) + func (r *SegmentTemplateRenderer) RenderAllSegments() (string, error) + func (r *SegmentTemplateRenderer) RenderSegment(content string) (string, error) + type Skill struct + Category string + Content string + CreatedAt time.Time + Description string + ID int64 + IsGlobal bool + Name string + Priority int + UpdatedAt time.Time + UsageCount int + func GetProjectSkills(ctx context.Context) (skills []*Skill, err error) + func GetSkillByID(id int64) (*Skill, error) + func GetSkillByName(name string) (*Skill, error) + type Symbol struct + Column int + EndColumn int + EndLine int + Line int + Name string + Receiver string + Signature string + Type string + type SystemPromptConfig struct + ConfigDir string + CurrentDate string + GitBranch string + GitStatus string + GitUserEmail string + GitUserName string + Hostname string + ModelID int64 + ProjectName string + ProjectRoot string + ProjectType string + Username string + WorkingDirectory string + func GetSystemPromptConfig(ctx context.Context) *SystemPromptConfig + func NewSystemPromptConfig(ctx context.Context) *SystemPromptConfig + func (c *SystemPromptConfig) FormatDate() string + func (c *SystemPromptConfig) GeneratePrompt() string + func (c *SystemPromptConfig) GeneratePromptWithTemplate() string + func (c *SystemPromptConfig) IsGitClean() bool + func (c *SystemPromptConfig) IsGoProject() bool + type SystemPromptTemplate struct + Name string + Template string + func GetTemplateForModel(modelID int64) *SystemPromptTemplate + func (t *SystemPromptTemplate) Render(data *TemplateData) (string, error) + type TemplateData struct + ConfigDir string + CurrentDate string + GitBranch string + GitStatus string + GitUserEmail string + GitUserName string + Hostname string + ModelID int64 + ProjectName string + ProjectRoot string + ProjectType string + Username string + WorkingDirectory string + func NewTemplateData(config *SystemPromptConfig) *TemplateData + type TemplateVariable struct + Description string + Example string + Name string + func GetTemplateVariables() []TemplateVariable + type Tool struct + Function Function + Type string + func GetAllTools(ctx context.Context) []Tool + func (t *Tool) GetTokens() int + type ToolArgs map[string]any + type ToolCall struct + Function ToolCallFunction + ID string + Type string + type ToolCallFunction struct + Arguments string + Name string + type ToolContent struct + Error string + Result string + Suggestion string + func (tc *ToolContent) String() (content string) + type ToolDef struct + Category string + Description string + DisplayName string + Handler func(ctx context.Context, args ToolArgs) (string, string, error) + Name string + Parameters map[string]any + Strict bool + Timeout time.Duration + func GetToolDef(ctx context.Context, toolName string) (tool ToolDef, ok bool) + type ToolDesc struct + Category string + CreatedAt time.Time + Description string + ID int64 + Name string + UpdatedAt time.Time + UsageCount int + func GetTool(id int64) (*ToolDesc, error) + func GetToolByName(name string) (*ToolDesc, error) + func ListTools(category string) ([]ToolDesc, error) + type ToolResultTruncator struct + KeepBothEnds bool + MaxBytes int + MaxRunes int + TruncationMarker string + func (t *ToolResultTruncator) Truncate(result string) string + type ToolUsage struct + ErrorMsg string + ID int64 + ProjectPath string + Success bool + ToolID int64 + UsedAt time.Time + type ToolUsageStat struct + LastUsed time.Time + Name string + SuccessRate float64 + UsageCount int + func GetProjectToolUsage(ctx context.Context, days int) ([]ToolUsageStat, error) + func GetToolUsageStats(days int) ([]ToolUsageStat, error)