Documentation
¶
Index ¶
- Constants
- Variables
- func CoderAgentTools(permissions permission.Service, sessions session.Service, ...) []tools.BaseTool
- func CoderAgentToolsWithMesnada(mesnadaOrchestrator *orchestrator.Orchestrator, ...) []tools.BaseTool
- func GetMcpTools(ctx context.Context, permissions permission.Service) []tools.BaseTool
- func GetMcpToolsWithGateway(ctx context.Context, permissions permission.Service, gw *mcpgateway.Gateway) []tools.BaseTool
- func NewAgentTool(Sessions session.Service, Messages message.Service, ...) tools.BaseTool
- func NewMcpTool(name string, tool mcp.Tool, permissions permission.Service, ...) tools.BaseTool
- func SetLuaManager(fm *luaengine.FilterManager)
- func SetPersonaSelector(ps *PersonaSelector)
- func TaskAgentTools(lspClients map[string]*lsp.Client) []tools.BaseTool
- type AgentEvent
- type AgentEventType
- type AgentParams
- type MCPClient
- type PersonaSelector
- type Service
Constants ¶
const (
AgentToolName = "agent"
)
Variables ¶
var ( ErrRequestCancelled = errors.New("request cancelled by user") ErrSessionBusy = errors.New("session is currently processing another request") )
Common errors
var ErrNoModel = fmt.Errorf("no model configured, please select a model")
ErrNoModel is returned when the agent has no model configured.
Functions ¶
func CoderAgentTools ¶
func CoderAgentToolsWithMesnada ¶
func CoderAgentToolsWithMesnada( mesnadaOrchestrator *orchestrator.Orchestrator, remembrances *rag.RemembrancesService, gateway *mcpgateway.Gateway, permissions permission.Service, sessions session.Service, messages message.Service, history history.Service, lspClients map[string]*lsp.Client, skillManager *skills.SkillManager, ) []tools.BaseTool
func GetMcpTools ¶
func GetMcpToolsWithGateway ¶ added in v0.8.0
func GetMcpToolsWithGateway(ctx context.Context, permissions permission.Service, gw *mcpgateway.Gateway) []tools.BaseTool
GetMcpToolsWithGateway returns MCP-backed tools for the LLM agent. When gw is non-nil (gateway mode), it exposes two proxy tools plus any favorite tools as direct wrappers. When gw is nil it falls back to the standard per-server tool list.
func NewAgentTool ¶
func NewMcpTool ¶
func SetLuaManager ¶ added in v0.8.0
func SetLuaManager(fm *luaengine.FilterManager)
SetLuaManager sets the global Lua filter manager used for MCP tool input/output filtering.
func SetPersonaSelector ¶ added in v0.41.0
func SetPersonaSelector(ps *PersonaSelector)
SetPersonaSelector sets the global persona selector used in the main conversation agent.
Types ¶
type AgentEvent ¶
type AgentEventType ¶
type AgentEventType string
const ( AgentEventTypeError AgentEventType = "error" AgentEventTypeResponse AgentEventType = "response" AgentEventTypeSummarize AgentEventType = "summarize" AgentEventTypeContentDelta AgentEventType = "content_delta" AgentEventTypeThinkingDelta AgentEventType = "thinking_delta" AgentEventTypeToolCall AgentEventType = "tool_call" AgentEventTypeToolResult AgentEventType = "tool_result" )
type AgentParams ¶
type AgentParams struct {
Prompt string `json:"prompt"`
}
type MCPClient ¶
type MCPClient interface {
Initialize(
ctx context.Context,
request mcp.InitializeRequest,
) (*mcp.InitializeResult, error)
ListTools(ctx context.Context, request mcp.ListToolsRequest) (*mcp.ListToolsResult, error)
CallTool(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error)
Close() error
}
type PersonaSelector ¶ added in v0.41.0
type PersonaSelector struct {
// contains filtered or unexported fields
}
PersonaSelector automatically selects and applies a persona for each user prompt. It uses a lite LLM provider (configured via agents["persona-selector"]) to pick the best matching persona from the personas directory, then prepends its content to the user message before it reaches the main conversation model.
func NewPersonaSelector ¶ added in v0.41.0
func NewPersonaSelector(personaPath string) (*PersonaSelector, error)
NewPersonaSelector creates a PersonaSelector that loads personas from personaPath and uses the model configured under agents["persona-selector"] to perform selection. Returns an error if the persona-selector agent is not configured or the model is unavailable.
func (*PersonaSelector) SelectAndApply ¶ added in v0.41.0
func (ps *PersonaSelector) SelectAndApply(ctx context.Context, userPrompt string) string
SelectAndApply selects the best persona for userPrompt and returns the prompt with the persona content prepended. Returns the original prompt unchanged if no persona matches, the selector is disabled, or an error occurs.
type Service ¶
type Service interface {
pubsub.Suscriber[AgentEvent]
Model() models.Model
Run(ctx context.Context, sessionID string, content string, attachments ...message.Attachment) (<-chan AgentEvent, error)
Cancel(sessionID string)
IsSessionBusy(sessionID string) bool
IsBusy() bool
Update(agentName config.AgentName, modelID models.ModelID) (models.Model, error)
Summarize(ctx context.Context, sessionID string) error
SetLuaManager(fm *luaengine.FilterManager)
}