tools

package
v0.330.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: MIT Imports: 51 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BashToolName = "bash"

	DefaultTimeout  = 1 * 60 * 1000  // 1 minutes in milliseconds
	MaxTimeout      = 10 * 60 * 1000 // 10 minutes in milliseconds
	MaxOutputLength = 30000
)
View Source
const (
	DefaultCacheMaxBytes  = 50 * 1024 * 1024 // 50MB per session
	DefaultCachePageLines = 200              // Default page size
)
View Source
const (
	// CacheThresholdBytes is the minimum response size to trigger auto-caching.
	CacheThresholdBytes = 15000
	// CacheThresholdLines is the minimum line count to trigger auto-caching.
	CacheThresholdLines = 300
	// CachePreviewLines is the number of lines shown inline when a response is cached.
	CachePreviewLines = 200
)
View Source
const (
	Context7ResolveToolName = "c7_resolve_library_id"
	Context7DocsToolName    = "c7_get_library_docs"
)
View Source
const (
	LSToolName = "ls"
	MaxLSFiles = 1000
)
View Source
const (
	ToolResponseTypeText  toolResponseType = "text"
	ToolResponseTypeImage toolResponseType = "image"

	SessionIDContextKey     sessionIDContextKey     = "session_id"
	MessageIDContextKey     messageIDContextKey     = "message_id"
	ACPClientConnContextKey acpClientConnContextKey = "acp_client_connection"
	SessionCacheContextKey  sessionCacheContextKey  = "session_cache"
	// RuntimeResolverContextKey is the hook point for injecting a non-host
	// RuntimeResolver in Phase 2 without changing existing execution paths.
	RuntimeResolverContextKey runtimeResolverContextKey = "runtime_resolver"
	WorkspaceFSContextKey     workspaceFSContextKey     = "workspace_fs"
)
View Source
const (
	ViewToolName       = "view"
	MaxReadSize        = 250 * 1024
	LargeFileProbeSize = 4096
	DefaultReadLimit   = 2000
	MaxLineLength      = 2000
)
View Source
const (
	BraveSearchToolName = "brave_search"
)
View Source
const (
	BrowserEvaluateToolName = "browser_evaluate"
)
View Source
const (
	BrowserGetContentToolName = "browser_get_content"
)
View Source
const (
	BrowserNavigateToolName = "browser_navigate"
)
View Source
const (
	BrowserScreenshotToolName = "browser_screenshot"
)
View Source
const (
	CacheReadToolName = "cache_read"
)
View Source
const (
	CacheStatsToolName = "cache_stats"
)
View Source
const (
	DiagnosticsToolName = "diagnostics"
)
View Source
const (
	EditToolName = "edit"
)
View Source
const (
	ExaSearchToolName = "exa_search"
)
View Source
const (
	FetchToolName = "fetch"
)
View Source
const (
	GlobToolName = "glob"
)
View Source
const (
	GoogleSearchToolName = "google_search"
)
View Source
const (
	GrepToolName = "grep"
)
View Source
const (
	PatchToolName = "patch"
)
View Source
const (
	PerplexitySearchToolName = "perplexity_search"
)
View Source
const (
	SourcegraphToolName = "sourcegraph"
)
View Source
const TodoWriteToolName = "TodoWrite"
View Source
const (
	WriteToolName = "write"
)

Variables

This section is empty.

Functions

func CloseAllBrowserSessions added in v0.30.0

func CloseAllBrowserSessions()

CloseAllBrowserSessions cancels all browser sessions. Call on app shutdown.

func CloseBrowserSession added in v0.30.0

func CloseBrowserSession(sessionID string)

CloseBrowserSession cancels and removes the browser session for the given pando sessionID.

func DecodeToolInput added in v0.310.0

func DecodeToolInput(input string, target any) error

DecodeToolInput normalizes malformed JSON generated by models and decodes it into the provided target structure.

func FormatJSONLikeContent added in v0.320.0

func FormatJSONLikeContent(content string) string

FormatJSONLikeContent attempts to interpret textual content as JSON and render it as TOML. If parsing or TOML conversion fails, the original content is returned unchanged.

func FormatStructuredData added in v0.320.0

func FormatStructuredData(value any) string

FormatStructuredData renders structured values as TOML when possible and otherwise falls back to indented JSON.

func GetContextValues

func GetContextValues(ctx context.Context) (string, string)

func GetOrCreateBrowserSession added in v0.30.0

func GetOrCreateBrowserSession(sessionID string) (*browserSession, error)

GetOrCreateBrowserSession returns the existing browser session for the given pando sessionID, or creates a new one if it doesn't exist.

func InitBrowserRegistry added in v0.30.0

func InitBrowserRegistry(cfg *config.InternalToolsConfig)

InitBrowserRegistry sets the config for the global browser registry. Must be called at app startup when BrowserEnabled=true.

func IsRemoteBrowserType added in v0.292.1

func IsRemoteBrowserType(browserType string) bool

IsRemoteBrowserType returns true for browser types that act as CDP servers (launched separately and connected to via WebSocket) rather than local executables.

func NormalizeBrowserType added in v0.291.0

func NormalizeBrowserType(value string) string

func NormalizeJSONInput added in v0.310.0

func NormalizeJSONInput(input string) (string, error)

NormalizeJSONInput ensures tool input is valid JSON before decoding. Empty input is normalized to an empty object so tools with optional parameters can omit arguments safely.

func RegisterTodoCallback added in v0.257.0

func RegisterTodoCallback(sessionID string, cb func([]TodoItem))

RegisterTodoCallback registers a function to be called whenever the todo list for sessionID is updated. Multiple callbacks can be registered per session.

func ResetAllCaches added in v0.14.0

func ResetAllCaches()

ResetAllCaches clears all session-scoped caches (file locks and regex cache). Call this at the end of each session to prevent memory leaks.

func ResetRegexCache added in v0.14.0

func ResetRegexCache()

ResetRegexCache clears all cached regular expressions. Should be called at session end to prevent memory leaks.

func TodoWriteSummary added in v0.257.0

func TodoWriteSummary(todos []TodoItem, maxWidth int) string

TodoWriteSummary returns a short single-line summary of the todo list, capped to maxWidth runes, suitable for TUI parameter display.

func UnregisterSessionCache added in v0.30.0

func UnregisterSessionCache(sessionID string)

UnregisterSessionCache removes and clears a session cache.

func UnregisterTodoCallbacks added in v0.257.0

func UnregisterTodoCallbacks(sessionID string)

UnregisterTodoCallbacks removes all callbacks registered for sessionID.

Types

type BaseTool

type BaseTool interface {
	Info() ToolInfo
	Run(ctx context.Context, params ToolCall) (ToolResponse, error)
}

func NewBashTool

func NewBashTool(permission permission.Service) BaseTool

func NewBraveSearchTool added in v0.20.0

func NewBraveSearchTool(permissions permission.Service) BaseTool

func NewCacheReadTool added in v0.30.0

func NewCacheReadTool() BaseTool

NewCacheReadTool creates a new cache_read tool instance.

func NewCacheStatsTool added in v0.30.0

func NewCacheStatsTool() BaseTool

NewCacheStatsTool returns a tool that reports session cache statistics.

func NewCodeDeleteProjectTool added in v0.162.0

func NewCodeDeleteProjectTool(indexer *code.CodeIndexer) BaseTool

func NewCodeFindReferencesTool added in v0.320.0

func NewCodeFindReferencesTool(indexer *code.CodeIndexer) BaseTool

func NewCodeFindSymbolTool added in v0.7.0

func NewCodeFindSymbolTool(indexer *code.CodeIndexer) BaseTool

func NewCodeGetProjectStatsTool added in v0.7.0

func NewCodeGetProjectStatsTool(indexer *code.CodeIndexer) BaseTool

func NewCodeGetSymbolsOverviewTool added in v0.7.0

func NewCodeGetSymbolsOverviewTool(indexer *code.CodeIndexer) BaseTool

func NewCodeHybridSearchTool added in v0.7.0

func NewCodeHybridSearchTool(indexer *code.CodeIndexer) BaseTool

func NewCodeIndexProjectTool added in v0.7.0

func NewCodeIndexProjectTool(indexer *code.CodeIndexer) BaseTool

func NewCodeIndexStatusTool added in v0.7.0

func NewCodeIndexStatusTool(indexer *code.CodeIndexer) BaseTool

func NewCodeListProjectsTool added in v0.7.0

func NewCodeListProjectsTool(indexer *code.CodeIndexer) BaseTool

func NewCodeReindexFileTool added in v0.7.0

func NewCodeReindexFileTool(indexer *code.CodeIndexer) BaseTool

func NewCodeSearchPatternTool added in v0.7.0

func NewCodeSearchPatternTool(indexer *code.CodeIndexer) BaseTool

func NewContext7Tools added in v0.20.0

func NewContext7Tools() []BaseTool

NewContext7Tools returns both Context7 tools.

func NewDiagnosticsTool

func NewDiagnosticsTool(lspClients map[string]*lsp.Client) BaseTool

func NewEditTool

func NewEditTool(lspClients map[string]*lsp.Client, permissions permission.Service, files history.Service) BaseTool

func NewExaSearchTool added in v0.32.1

func NewExaSearchTool(permissions permission.Service) BaseTool

func NewFetchTool

func NewFetchTool(permissions permission.Service) BaseTool

func NewGlobTool

func NewGlobTool() BaseTool

func NewGoogleSearchTool added in v0.20.0

func NewGoogleSearchTool(permissions permission.Service) BaseTool

func NewGrepTool

func NewGrepTool() BaseTool

func NewHybridSearchRemembrancesTool added in v0.210.0

func NewHybridSearchRemembrancesTool(service *rag.RemembrancesService) BaseTool

func NewKBAddDocumentTool added in v0.7.0

func NewKBAddDocumentTool(store *kb.KBStore) BaseTool

NewKBAddDocumentTool creates a new KBAddDocumentTool.

func NewKBDeleteDocumentTool added in v0.7.0

func NewKBDeleteDocumentTool(store *kb.KBStore) BaseTool

NewKBDeleteDocumentTool creates a new KBDeleteDocumentTool.

func NewKBGetDocumentTool added in v0.7.0

func NewKBGetDocumentTool(store *kb.KBStore) BaseTool

NewKBGetDocumentTool creates a new KBGetDocumentTool.

func NewKBImportPathTool added in v0.160.0

func NewKBImportPathTool(store *kb.KBStore) BaseTool

NewKBImportPathTool creates a new KBImportPathTool.

func NewKBSearchDocumentsTool added in v0.7.0

func NewKBSearchDocumentsTool(store *kb.KBStore) BaseTool

NewKBSearchDocumentsTool creates a new KBSearchDocumentsTool.

func NewLsTool

func NewLsTool() BaseTool

func NewMesnadaCancelTaskTool

func NewMesnadaCancelTaskTool(orch *orchestrator.Orchestrator) BaseTool

func NewMesnadaGetOutputTool

func NewMesnadaGetOutputTool(orch *orchestrator.Orchestrator) BaseTool

func NewMesnadaGetTaskTool

func NewMesnadaGetTaskTool(orch *orchestrator.Orchestrator) BaseTool

func NewMesnadaListTasksTool

func NewMesnadaListTasksTool(orch *orchestrator.Orchestrator) BaseTool

func NewMesnadaSpawnTool

func NewMesnadaSpawnTool(orch *orchestrator.Orchestrator) BaseTool

func NewMesnadaWaitTaskTool

func NewMesnadaWaitTaskTool(orch *orchestrator.Orchestrator) BaseTool

func NewPatchTool

func NewPatchTool(lspClients map[string]*lsp.Client, permissions permission.Service, files history.Service) BaseTool

func NewPerplexitySearchTool added in v0.20.0

func NewPerplexitySearchTool(permissions permission.Service) BaseTool

func NewSaveEventTool added in v0.7.0

func NewSaveEventTool(store *events.EventStore) BaseTool

NewSaveEventTool creates a new SaveEventTool.

func NewSearchEventsTool added in v0.7.0

func NewSearchEventsTool(store *events.EventStore) BaseTool

NewSearchEventsTool creates a new SearchEventsTool.

func NewSourcegraphTool

func NewSourcegraphTool() BaseTool

func NewTodoWriteTool added in v0.257.0

func NewTodoWriteTool() BaseTool

NewTodoWriteTool creates a new TodoWrite tool instance.

func NewViewTool

func NewViewTool(lspClients map[string]*lsp.Client) BaseTool

func NewWriteTool

func NewWriteTool(lspClients map[string]*lsp.Client, permissions permission.Service, files history.Service) BaseTool

type BashParams

type BashParams struct {
	Command   string `json:"command"`
	Timeout   int    `json:"timeout"`
	HeadLimit int    `json:"head_limit"` // Max output lines to return (0 = no limit)
	TailLines int    `json:"tail_lines"` // Only return last N lines (0 = no limit)
}

type BashPermissionsParams

type BashPermissionsParams struct {
	Command string `json:"command"`
	Timeout int    `json:"timeout"`
}

type BashResponseMetadata

type BashResponseMetadata struct {
	StartTime  int64 `json:"start_time"`
	EndTime    int64 `json:"end_time"`
	TotalLines int   `json:"total_lines"`
	Truncated  bool  `json:"truncated"`
}

type BrowserClickTool added in v0.30.0

type BrowserClickTool struct{}

func NewBrowserClickTool added in v0.30.0

func NewBrowserClickTool() *BrowserClickTool

func (*BrowserClickTool) Info added in v0.30.0

func (t *BrowserClickTool) Info() ToolInfo

func (*BrowserClickTool) Run added in v0.30.0

type BrowserConsoleEntry added in v0.30.0

type BrowserConsoleEntry struct {
	Level   string
	Message string
	Time    time.Time
}

BrowserConsoleEntry holds a single JS console message captured during a browser session.

type BrowserConsoleLogsTool added in v0.30.0

type BrowserConsoleLogsTool struct{}

func NewBrowserConsoleLogsTool added in v0.30.0

func NewBrowserConsoleLogsTool() *BrowserConsoleLogsTool

func (*BrowserConsoleLogsTool) Info added in v0.30.0

func (t *BrowserConsoleLogsTool) Info() ToolInfo

func (*BrowserConsoleLogsTool) Run added in v0.30.0

type BrowserEvaluateParams added in v0.30.0

type BrowserEvaluateParams struct {
	Expression string `json:"expression"`
}

type BrowserEvaluateTool added in v0.30.0

type BrowserEvaluateTool struct{}

func NewBrowserEvaluateTool added in v0.30.0

func NewBrowserEvaluateTool() *BrowserEvaluateTool

func (*BrowserEvaluateTool) Info added in v0.30.0

func (t *BrowserEvaluateTool) Info() ToolInfo

func (*BrowserEvaluateTool) Run added in v0.30.0

type BrowserFillTool added in v0.30.0

type BrowserFillTool struct{}

func NewBrowserFillTool added in v0.30.0

func NewBrowserFillTool() *BrowserFillTool

func (*BrowserFillTool) Info added in v0.30.0

func (t *BrowserFillTool) Info() ToolInfo

func (*BrowserFillTool) Run added in v0.30.0

type BrowserGetContentParams added in v0.30.0

type BrowserGetContentParams struct {
	Format   string `json:"format,omitempty"`
	Selector string `json:"selector,omitempty"`
}

type BrowserGetContentTool added in v0.30.0

type BrowserGetContentTool struct{}

func NewBrowserGetContentTool added in v0.30.0

func NewBrowserGetContentTool() *BrowserGetContentTool

func (*BrowserGetContentTool) Info added in v0.30.0

func (t *BrowserGetContentTool) Info() ToolInfo

func (*BrowserGetContentTool) Run added in v0.30.0

type BrowserInstall added in v0.291.0

type BrowserInstall struct {
	Type        string `json:"type"`
	Label       string `json:"label"`
	Executable  string `json:"executable"`
	UserDataDir string `json:"userDataDir,omitempty"`
	ProfileDir  string `json:"profileDir,omitempty"`
}

func DetectInstalledBrowsers added in v0.291.0

func DetectInstalledBrowsers() []BrowserInstall

func ResolveBrowserInstall added in v0.291.0

func ResolveBrowserInstall(browserType, executable string) (BrowserInstall, bool)

type BrowserNavigateParams added in v0.30.0

type BrowserNavigateParams struct {
	URL     string `json:"url"`
	WaitFor string `json:"wait_for,omitempty"`
	Timeout int    `json:"timeout,omitempty"`
}

type BrowserNavigateTool added in v0.30.0

type BrowserNavigateTool struct{}

func NewBrowserNavigateTool added in v0.30.0

func NewBrowserNavigateTool() *BrowserNavigateTool

func (*BrowserNavigateTool) Info added in v0.30.0

func (t *BrowserNavigateTool) Info() ToolInfo

func (*BrowserNavigateTool) Run added in v0.30.0

type BrowserNetworkEntry added in v0.30.0

type BrowserNetworkEntry struct {
	RequestID string
	URL       string
	Method    string
	Status    int
	MimeType  string
	Time      time.Time
}

BrowserNetworkEntry holds metadata for a single network request captured during a browser session.

type BrowserNetworkTool added in v0.30.0

type BrowserNetworkTool struct{}

func NewBrowserNetworkTool added in v0.30.0

func NewBrowserNetworkTool() *BrowserNetworkTool

func (*BrowserNetworkTool) Info added in v0.30.0

func (t *BrowserNetworkTool) Info() ToolInfo

func (*BrowserNetworkTool) Run added in v0.30.0

type BrowserPDFTool added in v0.30.0

type BrowserPDFTool struct{}

func NewBrowserPDFTool added in v0.30.0

func NewBrowserPDFTool() *BrowserPDFTool

func (*BrowserPDFTool) Info added in v0.30.0

func (t *BrowserPDFTool) Info() ToolInfo

func (*BrowserPDFTool) Run added in v0.30.0

type BrowserScreenshotParams added in v0.30.0

type BrowserScreenshotParams struct {
	Selector string `json:"selector,omitempty"`
	Quality  int    `json:"quality,omitempty"`
	FullPage bool   `json:"full_page,omitempty"`
}

type BrowserScreenshotTool added in v0.30.0

type BrowserScreenshotTool struct{}

func NewBrowserScreenshotTool added in v0.30.0

func NewBrowserScreenshotTool() *BrowserScreenshotTool

func (*BrowserScreenshotTool) Info added in v0.30.0

func (t *BrowserScreenshotTool) Info() ToolInfo

func (*BrowserScreenshotTool) Run added in v0.30.0

type BrowserScrollTool added in v0.30.0

type BrowserScrollTool struct{}

func NewBrowserScrollTool added in v0.30.0

func NewBrowserScrollTool() *BrowserScrollTool

func (*BrowserScrollTool) Info added in v0.30.0

func (t *BrowserScrollTool) Info() ToolInfo

func (*BrowserScrollTool) Run added in v0.30.0

type CacheEntry added in v0.30.0

type CacheEntry struct {
	ID         string
	ToolCallID string
	ToolName   string
	Content    string   // Full raw response
	Lines      []string // Pre-split lines for O(1) pagination
	TotalLines int
	TotalBytes int
	CreatedAt  time.Time
	LastUsed   time.Time
}

CacheEntry holds a cached tool response with pagination support.

type CacheEntrySummary added in v0.30.0

type CacheEntrySummary struct {
	CacheID    string `json:"cache_id"`
	ToolName   string `json:"tool_name"`
	TotalLines int    `json:"total_lines"`
	TotalBytes int    `json:"total_bytes"`
	AgeSeconds int    `json:"age_seconds"`
}

CacheEntrySummary is a compact descriptor for a single cached entry.

type CacheReadParams added in v0.30.0

type CacheReadParams struct {
	CacheID      string `json:"cache_id"`                // Required: ID from truncated response
	Offset       int    `json:"offset"`                  // Line offset (0-based), default 0
	Limit        int    `json:"limit"`                   // Lines to read, default 200
	Pattern      string `json:"pattern"`                 // Optional: search within cached content
	ContextLines int    `json:"context_lines,omitempty"` // Context lines around matches (default 2)
}

CacheReadParams defines the parameters for the cache_read tool.

type CacheStats added in v0.30.0

type CacheStats struct {
	EntryCount int   `json:"entry_count"`
	TotalBytes int64 `json:"total_bytes"`
	MaxBytes   int64 `json:"max_bytes"`
	Evictions  int   `json:"evictions"`
}

CacheStats provides statistics about the cache state.

type CacheStatsResponse added in v0.30.0

type CacheStatsResponse struct {
	Stats   CacheStats          `json:"stats"`
	Entries []CacheEntrySummary `json:"entries"`
}

CacheStatsResponse is the structured metadata attached to the stats response.

type CodeDeleteProjectTool added in v0.162.0

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

CodeDeleteProjectTool deletes an indexed project and its data.

func (*CodeDeleteProjectTool) Info added in v0.162.0

func (t *CodeDeleteProjectTool) Info() ToolInfo

func (*CodeDeleteProjectTool) Run added in v0.162.0

type CodeFindReferencesTool added in v0.320.0

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

CodeFindReferencesTool finds references to a symbol across the indexed codebase.

func (*CodeFindReferencesTool) Info added in v0.320.0

func (t *CodeFindReferencesTool) Info() ToolInfo

func (*CodeFindReferencesTool) Run added in v0.320.0

type CodeFindSymbolTool added in v0.7.0

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

CodeFindSymbolTool finds symbols by name pattern.

func (*CodeFindSymbolTool) Info added in v0.7.0

func (t *CodeFindSymbolTool) Info() ToolInfo

func (*CodeFindSymbolTool) Run added in v0.7.0

type CodeGetProjectStatsTool added in v0.7.0

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

CodeGetProjectStatsTool returns statistics for an indexed project.

func (*CodeGetProjectStatsTool) Info added in v0.7.0

func (*CodeGetProjectStatsTool) Run added in v0.7.0

type CodeGetSymbolsOverviewTool added in v0.7.0

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

CodeGetSymbolsOverviewTool returns a high-level overview of symbols in a file.

func (*CodeGetSymbolsOverviewTool) Info added in v0.7.0

func (*CodeGetSymbolsOverviewTool) Run added in v0.7.0

type CodeHybridSearchTool added in v0.7.0

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

CodeHybridSearchTool performs hybrid semantic + FTS search over code symbols.

func (*CodeHybridSearchTool) Info added in v0.7.0

func (t *CodeHybridSearchTool) Info() ToolInfo

func (*CodeHybridSearchTool) Run added in v0.7.0

type CodeIndexProjectTool added in v0.7.0

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

CodeIndexProjectTool starts indexing a code project.

func (*CodeIndexProjectTool) Info added in v0.7.0

func (t *CodeIndexProjectTool) Info() ToolInfo

func (*CodeIndexProjectTool) Run added in v0.7.0

type CodeIndexStatusTool added in v0.7.0

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

CodeIndexStatusTool returns the status of an indexing job.

func (*CodeIndexStatusTool) Info added in v0.7.0

func (t *CodeIndexStatusTool) Info() ToolInfo

func (*CodeIndexStatusTool) Run added in v0.7.0

type CodeListProjectsTool added in v0.7.0

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

CodeListProjectsTool lists all indexed projects.

func (*CodeListProjectsTool) Info added in v0.7.0

func (t *CodeListProjectsTool) Info() ToolInfo

func (*CodeListProjectsTool) Run added in v0.7.0

type CodeReindexFileTool added in v0.7.0

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

CodeReindexFileTool re-indexes a single file.

func (*CodeReindexFileTool) Info added in v0.7.0

func (t *CodeReindexFileTool) Info() ToolInfo

func (*CodeReindexFileTool) Run added in v0.7.0

type CodeSearchPatternTool added in v0.7.0

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

CodeSearchPatternTool searches for text patterns in code symbols.

func (*CodeSearchPatternTool) Info added in v0.7.0

func (t *CodeSearchPatternTool) Info() ToolInfo

func (*CodeSearchPatternTool) Run added in v0.7.0

type DiagnosticsParams

type DiagnosticsParams struct {
	FilePath string `json:"file_path"`
}

type EditParams

type EditParams struct {
	FilePath  string `json:"file_path"`
	OldString string `json:"old_string"`
	NewString string `json:"new_string"`
}

type EditPermissionsParams

type EditPermissionsParams struct {
	FilePath string `json:"file_path"`
	Diff     string `json:"diff"`
}

type EditResponseMetadata

type EditResponseMetadata struct {
	Diff      string `json:"diff"`
	Additions int    `json:"additions"`
	Removals  int    `json:"removals"`
}

type EditStrategy added in v0.14.0

type EditStrategy interface {
	Apply(content, oldStr, newStr string) (result string, matched bool)
	Name() string
}

EditStrategy tries to find oldStr in content and replace it with newStr. Returns (result, true) on success, ("", false) if not matched. IMPORTANT: normalization is applied only for MATCHING, not for the replacement. The actual replacement must use the original content at the found position.

type FetchParams

type FetchParams struct {
	URL       string `json:"url"`
	Format    string `json:"format"`
	Timeout   int    `json:"timeout,omitempty"`
	Browser   string `json:"browser,omitempty"`
	MaxLength int    `json:"max_length,omitempty"` // Max chars to return (0 = no limit beyond defaults)
}

type FetchPermissionsParams

type FetchPermissionsParams struct {
	URL     string `json:"url"`
	Format  string `json:"format"`
	Timeout int    `json:"timeout,omitempty"`
	Browser string `json:"browser,omitempty"`
}

type GlobParams

type GlobParams struct {
	Pattern   string `json:"pattern"`
	Path      string `json:"path"`
	HeadLimit int    `json:"head_limit"` // Max files to return (default 100)
	Offset    int    `json:"offset"`     // Skip first N files for pagination
}

type GlobResponseMetadata

type GlobResponseMetadata struct {
	NumberOfFiles int  `json:"number_of_files"`
	Truncated     bool `json:"truncated"`
	TotalFound    int  `json:"total_found"` // Total before offset/limit
	Offset        int  `json:"offset"`
	HasMore       bool `json:"has_more"`
}

type GrepParams

type GrepParams struct {
	Pattern     string `json:"pattern"`
	Path        string `json:"path"`
	Include     string `json:"include"`
	LiteralText bool   `json:"literal_text"`
	// Extended parameters
	OutputMode string `json:"output_mode"` // "content" | "files_with_matches" | "count" (default: "files_with_matches")
	Context    int    `json:"context"`     // lines of context before AND after (-C)
	Before     int    `json:"before"`      // lines before match (-B), overrides Context
	After      int    `json:"after"`       // lines after match (-A), overrides Context
	Type       string `json:"type"`        // file type filter: "go", "js", "py", "ts", "rust", etc.
	Multiline  bool   `json:"multiline"`   // enable multiline matching
	HeadLimit  int    `json:"head_limit"`  // cap total results (0 = use default 100)
	Offset     int    `json:"offset"`      // skip first N results for pagination
}

type GrepResponseMetadata

type GrepResponseMetadata struct {
	NumberOfMatches int  `json:"number_of_matches"`
	Truncated       bool `json:"truncated"`
}

type HybridSearchRemembrancesTool added in v0.210.0

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

func (*HybridSearchRemembrancesTool) Info added in v0.210.0

func (*HybridSearchRemembrancesTool) Run added in v0.210.0

type KBAddDocumentTool added in v0.7.0

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

KBAddDocumentTool adds a document to the knowledge base.

func (*KBAddDocumentTool) Info added in v0.7.0

func (t *KBAddDocumentTool) Info() ToolInfo

func (*KBAddDocumentTool) Run added in v0.7.0

type KBDeleteDocumentTool added in v0.7.0

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

KBDeleteDocumentTool removes a document from the knowledge base.

func (*KBDeleteDocumentTool) Info added in v0.7.0

func (t *KBDeleteDocumentTool) Info() ToolInfo

func (*KBDeleteDocumentTool) Run added in v0.7.0

type KBGetDocumentTool added in v0.7.0

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

KBGetDocumentTool retrieves a document from the knowledge base by path.

func (*KBGetDocumentTool) Info added in v0.7.0

func (t *KBGetDocumentTool) Info() ToolInfo

func (*KBGetDocumentTool) Run added in v0.7.0

type KBImportPathTool added in v0.160.0

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

KBImportPathTool imports/syncs markdown files from a filesystem path.

func (*KBImportPathTool) Info added in v0.160.0

func (t *KBImportPathTool) Info() ToolInfo

func (*KBImportPathTool) Run added in v0.160.0

func (t *KBImportPathTool) Run(ctx context.Context, params ToolCall) (ToolResponse, error)

type KBSearchDocumentsTool added in v0.7.0

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

KBSearchDocumentsTool searches documents in the knowledge base.

func (*KBSearchDocumentsTool) Info added in v0.7.0

func (t *KBSearchDocumentsTool) Info() ToolInfo

func (*KBSearchDocumentsTool) Run added in v0.7.0

type LSParams

type LSParams struct {
	Path   string   `json:"path"`
	Ignore []string `json:"ignore"`
}

type LSResponseMetadata

type LSResponseMetadata struct {
	NumberOfFiles int  `json:"number_of_files"`
	Truncated     bool `json:"truncated"`
}

type LineScanner

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

func NewLineScanner

func NewLineScanner(r io.Reader) *LineScanner

func (*LineScanner) Err

func (s *LineScanner) Err() error

func (*LineScanner) Scan

func (s *LineScanner) Scan() bool

func (*LineScanner) Text

func (s *LineScanner) Text() string

type MesnadaCancelTaskTool

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

MesnadaCancelTaskTool cancels a running or pending Mesnada task.

func (*MesnadaCancelTaskTool) Info

func (t *MesnadaCancelTaskTool) Info() ToolInfo

func (*MesnadaCancelTaskTool) Run

type MesnadaGetOutputTool

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

MesnadaGetOutputTool returns task output for a Mesnada task.

func (*MesnadaGetOutputTool) Info

func (t *MesnadaGetOutputTool) Info() ToolInfo

func (*MesnadaGetOutputTool) Run

type MesnadaGetTaskTool

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

MesnadaGetTaskTool returns full task information for a Mesnada task.

func (*MesnadaGetTaskTool) Info

func (t *MesnadaGetTaskTool) Info() ToolInfo

func (*MesnadaGetTaskTool) Run

type MesnadaListTasksTool

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

MesnadaListTasksTool lists Mesnada tasks using optional filters.

func (*MesnadaListTasksTool) Info

func (t *MesnadaListTasksTool) Info() ToolInfo

func (*MesnadaListTasksTool) Run

type MesnadaSpawnTool

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

MesnadaSpawnTool creates and runs a Mesnada task directly through the orchestrator.

func (*MesnadaSpawnTool) Info

func (t *MesnadaSpawnTool) Info() ToolInfo

func (*MesnadaSpawnTool) Run

func (t *MesnadaSpawnTool) Run(ctx context.Context, params ToolCall) (ToolResponse, error)

type MesnadaWaitTaskTool

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

MesnadaWaitTaskTool waits for a Mesnada task to reach a terminal state.

func (*MesnadaWaitTaskTool) Info

func (t *MesnadaWaitTaskTool) Info() ToolInfo

func (*MesnadaWaitTaskTool) Run

type PaginationInfo added in v0.30.0

type PaginationInfo struct {
	TotalItems    int    `json:"total_items,omitempty"`
	ReturnedItems int    `json:"returned_items,omitempty"`
	Offset        int    `json:"offset,omitempty"`
	Limit         int    `json:"limit,omitempty"`
	HasMore       bool   `json:"has_more,omitempty"`
	CacheID       string `json:"cache_id,omitempty"` // Set if response was auto-cached
}

PaginationInfo is a standardized pagination descriptor included in tool metadata.

type PaginationMetadata added in v0.30.0

type PaginationMetadata struct {
	CacheID       string `json:"cache_id"`
	TotalLines    int    `json:"total_lines"`
	TotalBytes    int    `json:"total_bytes"`
	Offset        int    `json:"offset"`
	Limit         int    `json:"limit"`
	HasMore       bool   `json:"has_more"`
	ReturnedLines int    `json:"returned_lines"`
	ToolName      string `json:"tool_name"`
}

PaginationMetadata describes a paginated result from the cache.

type PatchParams

type PatchParams struct {
	PatchText string `json:"patch_text"`
}

type PatchResponseMetadata

type PatchResponseMetadata struct {
	FilesChanged []string `json:"files_changed"`
	Additions    int      `json:"additions"`
	Removals     int      `json:"removals"`
}

type SaveEventTool added in v0.7.0

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

SaveEventTool stores a temporal event with semantic search.

func (*SaveEventTool) Info added in v0.7.0

func (t *SaveEventTool) Info() ToolInfo

func (*SaveEventTool) Run added in v0.7.0

func (t *SaveEventTool) Run(ctx context.Context, params ToolCall) (ToolResponse, error)

type SearchEventsTool added in v0.7.0

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

SearchEventsTool searches events with hybrid text and time filters.

func (*SearchEventsTool) Info added in v0.7.0

func (t *SearchEventsTool) Info() ToolInfo

func (*SearchEventsTool) Run added in v0.7.0

func (t *SearchEventsTool) Run(ctx context.Context, params ToolCall) (ToolResponse, error)

type SessionCache added in v0.30.0

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

SessionCache is a thread-safe, LRU in-memory cache scoped to a single session.

func GetSessionCache added in v0.30.0

func GetSessionCache(ctx context.Context) *SessionCache

GetSessionCache retrieves the session cache from context.

func GetSessionCacheByID added in v0.30.0

func GetSessionCacheByID(sessionID string) (*SessionCache, bool)

GetSessionCacheByID retrieves a session cache by session ID.

func NewSessionCache added in v0.30.0

func NewSessionCache(sessionID string) *SessionCache

NewSessionCache creates a new session-scoped cache.

func RegisterSessionCache added in v0.30.0

func RegisterSessionCache(sessionID string) *SessionCache

RegisterSessionCache creates and registers a new cache for a session.

func (*SessionCache) Clear added in v0.30.0

func (c *SessionCache) Clear()

Clear removes all entries from the cache.

func (*SessionCache) Delete added in v0.30.0

func (c *SessionCache) Delete(cacheID string)

Delete removes a single entry from the cache.

func (*SessionCache) Get added in v0.30.0

func (c *SessionCache) Get(cacheID string) (*CacheEntry, bool)

Get retrieves a cache entry by ID.

func (*SessionCache) GetPage added in v0.30.0

func (c *SessionCache) GetPage(cacheID string, offset, limit int) (string, PaginationMetadata, error)

GetPage returns a paginated slice of lines from a cached entry.

func (*SessionCache) SearchInCache added in v0.30.0

func (c *SessionCache) SearchInCache(cacheID, pattern string, contextLines, limit int) (string, PaginationMetadata, error)

SearchInCache searches for a pattern within cached content and returns matching lines with context.

func (*SessionCache) Stats added in v0.30.0

func (c *SessionCache) Stats() CacheStats

Stats returns current cache statistics.

func (*SessionCache) Store added in v0.30.0

func (c *SessionCache) Store(toolCallID, toolName, content string) string

Store saves content in the cache and returns a unique cacheID.

type SourcegraphParams

type SourcegraphParams struct {
	Query         string `json:"query"`
	Count         int    `json:"count,omitempty"`
	ContextWindow int    `json:"context_window,omitempty"`
	Timeout       int    `json:"timeout,omitempty"`
}

type SourcegraphResponseMetadata

type SourcegraphResponseMetadata struct {
	NumberOfMatches int  `json:"number_of_matches"`
	Truncated       bool `json:"truncated"`
}

type TodoItem added in v0.257.0

type TodoItem struct {
	Content  string `json:"content"`
	Status   string `json:"status"`   // pending | in_progress | completed
	Priority string `json:"priority"` // high | medium | low
}

TodoItem represents a single entry in the todo list.

func GetSessionTodos added in v0.257.0

func GetSessionTodos(sessionID string) []TodoItem

GetSessionTodos returns the current todo list for a session, or nil if none.

type TodoWriteParams added in v0.257.0

type TodoWriteParams struct {
	Todos []TodoItem `json:"todos"`
}

TodoWriteParams holds the input for the TodoWrite tool.

type ToolCall

type ToolCall struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Input string `json:"input"`
}

func MustNormalizeToolCallInput added in v0.310.0

func MustNormalizeToolCallInput(call ToolCall) (ToolCall, error)

MustNormalizeToolCallInput returns a copy of the call with normalized JSON input.

type ToolInfo

type ToolInfo struct {
	Name        string
	Description string
	Parameters  map[string]any
	Required    []string
}

type ToolResponse

type ToolResponse struct {
	Type     toolResponseType `json:"type"`
	Content  string           `json:"content"`
	Metadata string           `json:"metadata,omitempty"`
	IsError  bool             `json:"is_error"`
}

func InterceptToolResponse added in v0.30.0

func InterceptToolResponse(
	cache *SessionCache,
	toolCallID string,
	toolName string,
	response ToolResponse,
) ToolResponse

InterceptToolResponse checks if a tool response exceeds caching thresholds. If so, it stores the full content in the session cache and returns a compact reference containing the first CachePreviewLines lines and a cache_id. If below thresholds or cache is unavailable, the response is returned unchanged.

func NewStructuredResponse added in v0.320.0

func NewStructuredResponse(value any) ToolResponse

NewStructuredResponse formats structured data for tool consumers. It prefers TOML output for readability and falls back to pretty JSON when TOML encoding fails or the value cannot be decoded as JSON-compatible data.

func NewTextErrorResponse

func NewTextErrorResponse(content string) ToolResponse

func NewTextResponse

func NewTextResponse(content string) ToolResponse

func WithResponseMetadata

func WithResponseMetadata(response ToolResponse, metadata any) ToolResponse

type TreeNode

type TreeNode struct {
	Name     string      `json:"name"`
	Path     string      `json:"path"`
	Type     string      `json:"type"` // "file" or "directory"
	Children []*TreeNode `json:"children,omitempty"`
}

type ViewParams

type ViewParams struct {
	FilePath string `json:"file_path"`
	Offset   int    `json:"offset"`
	Limit    int    `json:"limit"`
	EndLine  int    `json:"end_line"`
}

type ViewResponseMetadata

type ViewResponseMetadata struct {
	FilePath string `json:"file_path"`
	Content  string `json:"content"`
}

type WriteParams

type WriteParams struct {
	FilePath string `json:"file_path"`
	Content  string `json:"content"`
}

type WritePermissionsParams

type WritePermissionsParams struct {
	FilePath string `json:"file_path"`
	Diff     string `json:"diff"`
}

type WriteResponseMetadata

type WriteResponseMetadata struct {
	Diff      string `json:"diff"`
	Additions int    `json:"additions"`
	Removals  int    `json:"removals"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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