Documentation
¶
Index ¶
- func HintFor(name tools.ToolName) string
- func TagsFor(name tools.ToolName) []string
- type Registry
- func (r *Registry) Build(name tools.ToolName, state tools.State) (tools.Tool, error)
- func (r *Registry) Has(name tools.ToolName) bool
- func (r *Registry) MustRegister(name tools.ToolName, factory ToolFactory)
- func (r *Registry) Names() []tools.ToolName
- func (r *Registry) Register(name tools.ToolName, factory ToolFactory) error
- type ToolFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry maps tool names to factories. Downstream apps register their own tools by calling DefaultRegistry().Register at startup before the first agent is constructed; evva's bundled tools are registered by internal/toolset during init.
Registry is safe for concurrent use. Register fails on duplicate names — silently overwriting would let a typo route an LLM-facing name to the wrong implementation. Use MustRegister at init time when a duplicate is a programming bug.
func DefaultRegistry ¶
func DefaultRegistry() *Registry
DefaultRegistry returns the process-wide registry. Pre-population is the caller's responsibility — evva's bundled tools register themselves via internal/toolset's init function (which cmd/evva imports transitively through internal/agent). Downstream apps consume the same registry to register custom tools:
toolset.DefaultRegistry().Register("my_tool", myFactory)
before the first agent is constructed.
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry returns an empty registry. Most callers want DefaultRegistry instead — it's the one evva's bundled tools register into.
func (*Registry) Build ¶
Build instantiates the named tool against state. Returns an error for unregistered names — there is no silent fallback.
func (*Registry) MustRegister ¶
func (r *Registry) MustRegister(name tools.ToolName, factory ToolFactory)
MustRegister wraps Register and panics on error. Use only at init time where a duplicate or nil factory is a programmer bug.
type ToolFactory ¶
ToolFactory builds one tool instance against the supplied state. The state parameter exposes the per-agent runtime config and workdir; evva-internal factories type-assert it to the concrete internal/toolset.ToolState to reach private accessors (ReadTracker, subagent spawner, etc.).
Factories must not retain the State beyond the call — the tool itself either captures the late-binding closures it needs (e.g. the AGENT tool's spawner lookup) or holds the cfg / workdir values it received.