Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Call ¶
type Call struct {
ID string
Name string
Input json.RawMessage
}
Call is what the LLM emits when it wants to invoke a tool.
type ContentBlock ¶
type ContentBlock struct {
Type ContentBlockType
Text string // populated when Type == ContentBlockText
Image *ImageBlock // populated when Type == ContentBlockImage
}
ContentBlock is one element in a tool result's content list.
type ContentBlockType ¶
type ContentBlockType string
ContentBlockType discriminates the kind of content in a block.
const ( ContentBlockText ContentBlockType = "text" ContentBlockImage ContentBlockType = "image" )
type Descriptor ¶
type Descriptor struct {
Name string
Description string
Schema json.RawMessage
Tags []string
// SearchHint is a short curated capability phrase that the TOOL_SEARCH
// matcher prioritizes over the long-form description. One sentence is
// enough — think "what would the LLM type to find this tool that isn't
// already in the tags or name?". Optional; empty means fall back to
// description matching.
//
// Word-boundary scoring (+4 in TOOL_SEARCH ranking) gives hint matches
// stronger signal than description hits (+2) but lower than exact name
// part matches.
SearchHint string
}
Descriptor is the LLM-facing metadata for a tool — name, description, JSON input schema, and a short list of keyword tags for discovery.
Describing a tool does NOT make it callable. TOOL_SEARCH and any future schema-introspection consumer use this type to surface deferred-tool metadata without paying for tool construction or state allocation.
Lives in the tools package (not toolset) so meta/toolsearch can reference it without importing toolset — toolset already depends on meta, so the reverse edge would cycle.
type ImageBlock ¶
type ImageBlock struct {
MIMEType string // "image/png", "image/jpeg", "image/gif", "image/webp"
Base64Data string // base64-encoded image bytes
OriginalSize int64 // original file size in bytes
}
ImageBlock holds base64-encoded image data for multimodal tool results.
type Result ¶
type Result struct {
Content string
IsError bool
Metadata any
ContentBlocks []ContentBlock
}
Result is what every tool returns to the agent.
Metadata is an optional, tool-specific structured payload that flows through to the event sink (carried on ToolUseResultPayload.Metadata) so UIs can render richer detail than the human-readable Content string allows. Stays opaque to the agent layer — the UI type-asserts on it. Common payloads today:
- *fs.FileDiff for write_file / edit_file mutations
LLM-facing tool results carry only Content + IsError; Metadata never goes to the model.
type State ¶
type State interface {
// Config returns the runtime configuration the agent was built with.
// Tools that need runtime settings read fields off this pointer at
// Execute time so the /config form's mutations take effect.
// Returns nil when no Config was installed (rare; only in tests or
// narrow harnesses).
Config() *config.Config
// Workdir returns the process working directory the agent captured
// at construction. Convenience over reading Config().WorkDir so
// downstream tools don't have to nil-check the Config pointer.
// Returns "" when neither WithConfig nor a process workdir is set.
Workdir() string
}
State is the narrow surface a tool factory receives from the registry when building a per-agent instance. Carries only what downstream tools can rely on across evva versions — the runtime Config (TavilyAPIKey, FetchMaxBytes, AppHome, custom fields) and the agent's working dir.
Evva-internal tools (meta/AGENT, mode/EnterPlanMode, todo/Write, fs/*) need richer state — the subagent spawner, the plan controller, the ReadTracker, etc. Those factories type-assert State to the concrete internal toolset.ToolState. Downstream-authored tools should not reach for that assertion; rely on Config() instead.
type Tool ¶
type Tool interface {
Name() string
Description() string
Schema() json.RawMessage
Execute(ctx context.Context, logger *slog.Logger, input json.RawMessage) (Result, error)
}
Tool is the contract every tool must satisfy. Stateless tools are typically package-level singletons (shell.Bash). Stateful tools receive backing state via constructor (fs.NewRead, task.NewCreate).
logger is pre-scoped by the agent dispatcher with "tool" and "tool_id" attrs so every line a tool emits is correlated with the call. Tools must not assume logger is non-nil only in production — tests pass NopLogger().
func NewStub ¶
NewStub creates a Tool whose Execute always returns a "not implemented" error. Useful for declaring a tool's name/description/schema before its behavior is built — the LLM sees a real tool definition, and any call surfaces a clear "TODO" instead of silently doing nothing.
Once a stub's Execute is implemented, replace the variable with the real type and the LLM contract stays stable.
type ToolName ¶
type ToolName string
ToolName is the canonical identifier the LLM sees for each tool. Values are the strings sent to the model in tool definitions; the SCREAMING_SNAKE constant names are how Go code refers to them.
const ( // READ_FILE — read a file by absolute path. Handles text, PDFs (with pages), // Jupyter notebooks, images. First-line defense for "what's in this file." READ_FILE ToolName = "read" // WRITE_FILE — create a new file or fully overwrite one. Use only when Edit // doesn't fit. WRITE_FILE ToolName = "write" // EDIT_FILE — exact string replacement in a file. Requires prior Read. // Preferred over Write for modifying existing files. EDIT_FILE ToolName = "edit" // BASH — run shell commands. Catch-all for git, build/test runs, find/grep/rg, // any CLI. Supports background execution. BASH ToolName = "bash" // AGENT — spawn a subagent (Explore, Plan, general-purpose, code-review, etc.) // for parallel/independent work or to protect main context from big result dumps. AGENT ToolName = "agent" // TOOL_SEARCH — load schemas for deferred tools by name (select:Foo,Bar) or // keyword search. Required before calling anything deferred. TOOL_SEARCH ToolName = "tool_search" // SKILL — invoke a user-installed skill by name (e.g. commit, code-review, // make-prd, pgagent). Same as the user typing /skill-name. SKILL ToolName = "skill" // SCHEDULE_WAKEUP — self-pace iterations in /loop dynamic mode. // Not relevant outside loops. SCHEDULE_WAKEUP ToolName = "schedule_wakeup" // TODO_WRITE — write the session's todo list (full-list replacement). // Used proactively at the start of any non-trivial task; subsequent calls // flip statuses and add/remove entries. One in_progress entry at a time. TODO_WRITE ToolName = "todo_write" // UPDATE_USER_PROFILE — merge sections into <APP_HOME>/USER_PROFILE.md. // Persistent across sessions; auto-memory feature. Section keys are fixed: // "Preferences", "Working style", "Recurring topics". UPDATE_USER_PROFILE ToolName = "update_user_profile" // UPDATE_PROJECT_MEMORY — merge sections into // <APP_HOME>/projects/<slug>/MEMORY.md keyed by slugified workdir path. // Section keys are fixed: "Project facts", "Decisions", "Open issues", // "References". UPDATE_PROJECT_MEMORY ToolName = "update_project_memory" )
Active tools — always available, no schema lookup required. ===============
const ( MONITOR ToolName = "monitor" // DAEMON_LIST — enumerate every registered daemon with status + metadata. // Optional kind filter and include_terminal flag. DAEMON_LIST ToolName = "daemon_list" // DAEMON_OUTPUT — fetch the captured output of one daemon. Format is // kind-specific: bash stdout/stderr tail, monitor event ring, agent // prompt/summary. Optional tail limits to the last N lines. DAEMON_OUTPUT ToolName = "daemon_output" // DAEMON_STOP — terminate a running daemon by id. Works uniformly // across bash background tasks, monitors, and async subagents. // Idempotent for daemons that have already reached a terminal status. DAEMON_STOP ToolName = "daemon_stop" ENTER_PLAN_MODE ToolName = "enter_plan_mode" EXIT_PLAN_MODE ToolName = "exit_plan_mode" ENTER_WORKTREE ToolName = "enter_worktree" EXIT_WORKTREE ToolName = "exit_worktree" NOTEBOOK_EDIT ToolName = "notebook_edit" // LSP (Language Server Protocol) — semantic code intelligence. // Deferred: the LLM discovers it via tool_search when it needs // definition, references, hover, or document symbols. LSP_REQUEST ToolName = "lsp_request" )
Process management. Daemons are the unified abstraction over background units — bash run_in_background tasks, async subagents, monitor streams, and future kinds (remote_agent, in_process_teammate, local_workflow, dream). See docs/design/daemon-design.md.
- Bash run_in_background:true spawns a bash daemon (id prefix "b").
- MONITOR spawns a monitor daemon (id prefix "m") streaming stdout lines as agent-loop events.
- Async Agent calls register an agent daemon (id prefix "a").
- DAEMON_LIST / DAEMON_OUTPUT / DAEMON_STOP introspect and control any daemon uniformly.
The previous TASK_LIST / TASK_OUTPUT / TASK_STOP names have been removed — the task_* namespace is reserved for the future todo-v2 implementation (see docs/design/task-design.md).
const ( ASK_USER_QUESTION ToolName = "ask_user_question" PUSH_NOTIFICATION ToolName = "push_notification" )
User interaction.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cron hosts scheduling tools: CronCreate, CronList, CronDelete, RemoteTrigger.
|
Package cron hosts scheduling tools: CronCreate, CronList, CronDelete, RemoteTrigger. |
|
Package daemon is the unified abstraction over every long-running background unit the agent can spawn — bash run_in_background tasks, async subagents, monitor streams, and future kinds (remote_agent, in_process_teammate, local_workflow, dream).
|
Package daemon is the unified abstraction over every long-running background unit the agent can spawn — bash run_in_background tasks, async subagents, monitor streams, and future kinds (remote_agent, in_process_teammate, local_workflow, dream). |
|
Package fs exposes filesystem tools (Read, Write, Edit) as stateless singletons.
|
Package fs exposes filesystem tools (Read, Write, Edit) as stateless singletons. |
|
Package kits exposes pre-composed tool-name lists a downstream consumer can hand to agent.NewProfile without re-typing the canonical evva tool selections from scratch.
|
Package kits exposes pre-composed tool-name lists a downstream consumer can hand to agent.NewProfile without re-typing the canonical evva tool selections from scratch. |
|
Package lsp provides Language Server Protocol integration for evva.
|
Package lsp provides Language Server Protocol integration for evva. |
|
protocol
Package protocol holds hand-written LSP protocol types covering the subset of the LSP 3.17 spec needed by evva's Phase 1 operations (definition, references, hover, document symbols) plus the lifecycle handshake.
|
Package protocol holds hand-written LSP protocol types covering the subset of the LSP 3.17 spec needed by evva's Phase 1 operations (definition, references, hover, document symbols) plus the lifecycle handshake. |
|
Package monitor hosts the deferred Monitor tool — a background process watcher that streams stdout lines as agent-loop notifications.
|
Package monitor hosts the deferred Monitor tool — a background process watcher that streams stdout lines as agent-loop notifications. |
|
Package notebook hosts the NotebookEdit tool.
|
Package notebook hosts the NotebookEdit tool. |
|
Package shell hosts shell-side tools: Bash, Ls, Grep, Tree.
|
Package shell hosts shell-side tools: Bash, Ls, Grep, Tree. |
|
Package todo exposes the single todo_write tool.
|
Package todo exposes the single todo_write tool. |
|
Package util hosts miscellaneous stateless utility tools.
|
Package util hosts miscellaneous stateless utility tools. |
|
Package web hosts web tools: web_search (Tavily-backed) and web_fetch (HTTP GET + readable-text extraction).
|
Package web hosts web tools: web_search (Tavily-backed) and web_fetch (HTTP GET + readable-text extraction). |