Documentation
¶
Overview ¶
path: codemode/codemode_utcp.go
Index ¶
- Constants
- type CacheStats
- type CodeModeArgs
- type CodeModeResult
- type CodeModeUTCP
- func (cm *CodeModeUTCP) CacheStats() CacheStats
- func (cm *CodeModeUTCP) CallTool(ctx context.Context, prompt string) (bool, any, error)
- func (c *CodeModeUTCP) Execute(ctx context.Context, args CodeModeArgs) (CodeModeResult, error)
- func (cm *CodeModeUTCP) InvalidateAllCaches()
- func (cm *CodeModeUTCP) InvalidateSelectionsCache()
- func (cm *CodeModeUTCP) InvalidateToolSpecsCache()
- func (cm *CodeModeUTCP) StartCacheCleanup(ctx context.Context, interval time.Duration)
- func (a *CodeModeUTCP) ToolSpecs() []tools.Tool
- func (c *CodeModeUTCP) Tools() ([]tools.Tool, error)
- type ToolCache
- func (tc *ToolCache) CleanExpired()
- func (tc *ToolCache) GetSelectedTools(query string, availableTools string) []string
- func (tc *ToolCache) GetToolSpecs() []tools.Tool
- func (tc *ToolCache) InvalidateAll()
- func (tc *ToolCache) InvalidateSelections()
- func (tc *ToolCache) InvalidateToolSpecs()
- func (tc *ToolCache) SetSelectedTools(query string, availableTools string, selectedTools []string)
- func (tc *ToolCache) SetToolSpecs(specs []tools.Tool)
- func (tc *ToolCache) StartCleanupRoutine(ctx context.Context, interval time.Duration)
- func (tc *ToolCache) Stats() CacheStats
Constants ¶
const CodeModeToolName = "codemode.run_code"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheStats ¶ added in v1.10.6
type CacheStats struct {
SpecsHits int64
SpecsMisses int64
SelectionHits int64
SelectionMisses int64
SelectionSize int
}
CacheStats holds cache performance metrics
func (CacheStats) SelectionHitRate ¶ added in v1.10.6
func (cs CacheStats) SelectionHitRate() float64
SelectionHitRate returns the cache hit rate for tool selections
func (CacheStats) SpecsHitRate ¶ added in v1.10.6
func (cs CacheStats) SpecsHitRate() float64
HitRate returns the cache hit rate for tool specs
type CodeModeArgs ¶
type CodeModeResult ¶
type CodeModeUTCP ¶
type CodeModeUTCP struct {
// contains filtered or unexported fields
}
func NewCodeModeUTCP ¶
func NewCodeModeUTCP(client utcp.UtcpClientInterface, model interface { Generate(ctx context.Context, prompt string) (any, error) }) *CodeModeUTCP
func (*CodeModeUTCP) CacheStats ¶ added in v1.10.6
func (cm *CodeModeUTCP) CacheStats() CacheStats
CacheStats returns performance statistics for the tool cache
func (*CodeModeUTCP) Execute ¶
func (c *CodeModeUTCP) Execute(ctx context.Context, args CodeModeArgs) (CodeModeResult, error)
func (*CodeModeUTCP) InvalidateAllCaches ¶ added in v1.10.6
func (cm *CodeModeUTCP) InvalidateAllCaches()
InvalidateAllCaches clears all caches (tool specs and selections)
func (*CodeModeUTCP) InvalidateSelectionsCache ¶ added in v1.10.6
func (cm *CodeModeUTCP) InvalidateSelectionsCache()
InvalidateSelectionsCache clears all cached tool selection results
func (*CodeModeUTCP) InvalidateToolSpecsCache ¶ added in v1.10.6
func (cm *CodeModeUTCP) InvalidateToolSpecsCache()
InvalidateToolSpecsCache clears the cached tool specifications
func (*CodeModeUTCP) StartCacheCleanup ¶ added in v1.10.6
func (cm *CodeModeUTCP) StartCacheCleanup(ctx context.Context, interval time.Duration)
StartCacheCleanup starts a background routine to clean expired cache entries Call this with a context to control the cleanup lifecycle
func (*CodeModeUTCP) ToolSpecs ¶ added in v1.10.0
func (a *CodeModeUTCP) ToolSpecs() []tools.Tool
type ToolCache ¶ added in v1.10.6
type ToolCache struct {
// contains filtered or unexported fields
}
ToolCache provides thread-safe caching for tool specs and selection results
func NewToolCache ¶ added in v1.10.6
func NewToolCache() *ToolCache
NewToolCache creates a new tool cache with configurable TTLs
func (*ToolCache) CleanExpired ¶ added in v1.10.6
func (tc *ToolCache) CleanExpired()
CleanExpired removes expired entries from selection cache
func (*ToolCache) GetSelectedTools ¶ added in v1.10.6
GetSelectedTools retrieves cached tool selection for a query
func (*ToolCache) GetToolSpecs ¶ added in v1.10.6
GetToolSpecs retrieves cached tool specs or returns nil if expired/missing
func (*ToolCache) InvalidateAll ¶ added in v1.10.6
func (tc *ToolCache) InvalidateAll()
InvalidateAll clears all caches
func (*ToolCache) InvalidateSelections ¶ added in v1.10.6
func (tc *ToolCache) InvalidateSelections()
InvalidateSelections clears all tool selection cache entries
func (*ToolCache) InvalidateToolSpecs ¶ added in v1.10.6
func (tc *ToolCache) InvalidateToolSpecs()
InvalidateToolSpecs clears the tool specs cache
func (*ToolCache) SetSelectedTools ¶ added in v1.10.6
SetSelectedTools stores tool selection result in cache
func (*ToolCache) SetToolSpecs ¶ added in v1.10.6
SetToolSpecs stores tool specs in cache
func (*ToolCache) StartCleanupRoutine ¶ added in v1.10.6
StartCleanupRoutine starts a background goroutine to periodically clean expired entries
func (*ToolCache) Stats ¶ added in v1.10.6
func (tc *ToolCache) Stats() CacheStats
Stats returns cache performance statistics