Documentation
¶
Overview ¶
Package tools implements the agent's callable tool surface and the toolset groupings that decide which tools a given platform exposes.
Index ¶
- Constants
- Variables
- func CloseBrowsers()
- func ExpandToolset(name string) []string
- func InterceptActivate(ctx context.Context, id string, extra map[string]any) (intercept.Session, error)
- func InterceptProxy() (*intercept.Proxy, error)
- func InterceptRegistry() *intercept.Registry
- func NeedsApproval(t Tool) bool
- func ToolsetNames() []string
- func ToolsetsFor(name string) []string
- func UploadsDir() string
- type Approval
- type AskFunc
- type AskQuestion
- type BackgroundTasks
- type Deps
- type FindingStore
- type GoogleAccount
- type Input
- type IntelStore
- type Progress
- type RAGDoc
- type RAGProvider
- type RAGResult
- type Registry
- type Result
- type RoleInfo
- type ShellManager
- type SkillInfo
- type SkillLibrary
- type SubAgent
- type SubAgentRequest
- type TaskInfo
- type TodoItem
- type Tool
Constants ¶
const MCPPrefix = "mcp__"
MCPPrefix namespaces tools imported from MCP servers.
Variables ¶
var Toolsets = map[string][]string{ "minimal": {"read_file", "list_files", "grep", "todo"}, "coding": { "read_file", "read_document", "write_file", "edit_file", "list_files", "glob", "grep", "terminal", "todo", "board", "project_info", "set_soul", "skill", "delegate_task", "task", "list_roles", "diagnostics", "http_request", "ask_user", "schedule", }, "research": { "read_file", "read_document", "web_search", "web_fetch", "http_request", "browser", "grep", "todo", "memory", "session_search", "rag_search", "skill", "view_image", "report_finding", "add_intel", "methodology_status", "delegate_task", "task", "list_roles", }, "browser": {"browser", "web_search", "web_fetch", "http_request", "read_file", "write_file", "todo", "report_finding", "add_intel", "methodology_status"}, "security": { "read_file", "write_file", "list_files", "glob", "grep", "terminal", "web_search", "web_fetch", "http_request", "browser", "todo", "skill", "report_finding", "triage_finding", "add_intel", "methodology_status", "delegate_task", "task", "list_roles", "diagnostics", "ask_user", "vps_run", "osint_dns", "osint_dorks", "osint_whois", "osint_ip", "osint_username", "osint_github", "osint_email", "osint_email_full", "list_proxies", "osint_breach", "osint_shodan", "osint_reputation", "osint_crypto", "osint_domain", "osint_phone", "osint_scrape", "osint_paste", "osint_footprint", "osint_pivot", "osint_google", "osint_dorks_live", "check_dependencies", "re_info", "re_strings", "re_analyze", "re_decompile", "solve_captcha", "intercept", "attack_script", "awshook", "azurehook", "kubehook", "winhook", "machook", "cipipe", "ebpf", "hackbrowser", }, "osint": { "osint_dns", "osint_dorks", "osint_whois", "osint_ip", "osint_username", "osint_github", "osint_email", "osint_email_full", "list_proxies", "osint_breach", "osint_shodan", "osint_reputation", "osint_crypto", "osint_domain", "osint_phone", "osint_scrape", "osint_paste", "osint_footprint", "osint_pivot", "osint_google", "osint_dorks_live", "check_dependencies", "re_info", "re_strings", "re_analyze", "re_decompile", "solve_captcha", "intercept", "web_search", "web_fetch", "http_request", "read_file", "todo", "add_intel", "report_finding", }, "reverse": { "re_info", "re_strings", "re_analyze", "re_decompile", "check_dependencies", "read_file", "list_files", "glob", "grep", "terminal", "todo", "report_finding", }, "vibecoder": { "web_fetch", "http_request", "browser", "web_search", "terminal", "read_file", "write_file", "list_files", "glob", "grep", "check_dependencies", "todo", "report_finding", "add_intel", "methodology_status", "skill", "rag_search", }, "intercept": { "intercept", "browser", "http_request", "web_fetch", "solve_captcha", "read_file", "write_file", "todo", "report_finding", "add_intel", }, "default": { "read_file", "read_document", "write_file", "edit_file", "list_files", "glob", "grep", "terminal", "web_search", "web_fetch", "http_request", "browser", "todo", "board", "project_info", "set_soul", "memory", "list_proxies", "vps_run", "session_search", "rag_search", "rag_index", "skill", "delegate_task", "task", "list_roles", "image_generate", "view_image", "speak", "transcribe", "computer", "diagnostics", "ask_user", "schedule", "osint_dns", "osint_dorks", "osint_whois", "osint_ip", "osint_username", "osint_github", "osint_email", "osint_email_full", "osint_breach", "osint_shodan", "osint_reputation", "osint_crypto", "osint_domain", "osint_phone", "osint_scrape", "osint_paste", "osint_footprint", "osint_pivot", "osint_google", "osint_dorks_live", "check_dependencies", "re_info", "re_strings", "re_analyze", "re_decompile", "solve_captcha", "intercept", }, "all": nil, }
Toolsets are named groupings mirroring the platform toolset config.
Functions ¶
func ExpandToolset ¶
ExpandToolset returns the tool names in a named toolset.
func InterceptActivate ¶
func InterceptActivate(ctx context.Context, id string, extra map[string]any) (intercept.Session, error)
InterceptActivate resolves the shared proxy+CA and activates an interceptor by id, auto-starting the proxy if it is down. It is the one path the tool and the HTTP handlers share for "hook a client to the proxy".
func InterceptProxy ¶
InterceptProxy returns the shared proxy, creating it (with a persisted CA) on first use. Exported so the HTTP server can surface the same instance.
func InterceptRegistry ¶
InterceptRegistry returns the shared interceptor registry, seeded once with every available interceptor (browsers, terminal, and the dependency-gated ones). Exported so the HTTP server surfaces the same set.
func NeedsApproval ¶
NeedsApproval reports whether a tool mutates state.
func ToolsetsFor ¶
ToolsetsFor reports which named toolsets include a tool.
func UploadsDir ¶
func UploadsDir() string
UploadsDir is the temporary root for attached files. It lives under the antares home (not the workspace), so uploads never pollute the user's project and can be cleaned per session or by age.
Types ¶
type Approval ¶
type Approval interface {
RequiresApproval() bool
}
Approval reports whether a tool mutates state and should be gated.
type AskFunc ¶
type AskFunc func(ctx context.Context, questions []AskQuestion) (string, error)
AskFunc pauses the turn, asks the questions, and returns the answer text. It unblocks with an error if the run is cancelled.
type AskQuestion ¶
type AskQuestion struct {
Question string `json:"question"`
Header string `json:"header,omitempty"`
Options []string `json:"options,omitempty"`
MultiSelect bool `json:"multiSelect,omitempty"`
}
AskQuestion is one question the ask_user tool puts to the person.
type BackgroundTasks ¶
type BackgroundTasks interface {
Start(req SubAgentRequest) string
Status(id string) (TaskInfo, bool)
List(parent string) []TaskInfo
Stop(id string) bool
// Send continues a finished task with a follow-up, running another turn on
// its session and returning the new reply.
Send(id, message string) (string, error)
}
BackgroundTasks runs sub-agents asynchronously: Start returns a handle immediately and the work continues in the background, to be polled later. It is how one turn dispatches several long workstreams without blocking on each.
type Deps ¶
type Deps struct {
Config *config.Config
Store store.Store
RAG RAGProvider
Sub SubAgent
Skills SkillLibrary
// Tasks runs sub-agents in the background. It may be nil.
Tasks BackgroundTasks
// Shell owns persistent terminal sessions keyed by session id.
Shell *ShellManager
// Checkpoint saves a copy of a file about to be changed. It may be nil,
// in which case nothing is kept and an edit cannot be undone.
Checkpoint func(sessionID, path, tool string)
// RecordResult notes the sha256 of what a tool just wrote to a file, so a
// later rollback can tell session-produced content from an outside edit. Nil
// when checkpoints are off.
RecordResult func(sessionID, path, resultHash string)
// Roles lists the specialist roles available for delegation. It may be nil.
Roles func() []RoleInfo
// Vision describes an image using a vision model. It may be nil.
Vision func(ctx context.Context, data []byte, mime, question string) (string, error)
// Speak synthesises speech from text, returning the audio and its extension.
// It may be nil.
Speak func(ctx context.Context, text, voice string) (audio []byte, ext string, err error)
// Transcribe turns speech audio into text. It may be nil.
Transcribe func(ctx context.Context, filename string, audio []byte) (string, error)
// Board is the Kanban board store. It may be nil.
Board *board.Board
// Findings is the security engagement ledger. It may be nil.
Findings FindingStore
// Intel is the engagement's fact ledger and methodology. It may be nil.
Intel IntelStore
}
Deps bundles the services tools may reach for.
type FindingStore ¶
type FindingStore interface {
Add(sessionID string, f findings.Finding) (findings.Finding, error)
Triage(sessionID, id string, status findings.Status, duplicateOf string) (findings.Finding, bool, error)
List(sessionID string) ([]findings.Finding, error)
}
FindingStore is the subset of the findings store the tools need.
type GoogleAccount ¶
type GoogleAccount struct {
AuthUser int `json:"authuser"`
Email string `json:"email"`
Name string `json:"name"`
}
GoogleAccount is a logged-in Google account resolved from a session cookie. AuthUser is the /u/<N>/ index that selects it in a multi-account session.
func VerifyGoogleCookie ¶
func VerifyGoogleCookie(ctx context.Context, raw string) (accounts []GoogleAccount, err error)
VerifyGoogleCookie checks whether a stored Google cookie is a live session and returns the account(s) it belongs to. It accepts the same input the osint_google tool does (Cookie-Editor JSON or a raw header). The accounts.google.com/ListAccounts endpoint answers to the cookie alone, so it doubles as a "is this cookie still valid?" probe.
type Input ¶
type Input struct {
Args json.RawMessage
CallID string
SessionID string
UserID string
Platform string
Workspace string
// WriteRoots, when non-empty, marks this a project session: file writes are
// confined to these directories (the project folder plus the antares
// workspace), while reads are allowed anywhere on the machine so the agent
// can read and copy from outside. Empty = an ordinary session, where reads
// and writes are both confined to Workspace.
WriteRoots []string
// Emit reports progress; it is never nil.
Emit func(Progress)
// AskUser blocks the current turn to put questions to the person and returns
// their answer as text. Nil where no one can answer (some gateways/cron), in
// which case a blocking tool must fall back to yielding via its result.
AskUser AskFunc
// Deps exposes shared services (store, memory, rag, llm factory, sub-agent).
Deps *Deps
}
Input carries everything a tool needs to run one invocation.
type IntelStore ¶
type IntelStore interface {
Add(sessionID string, in engagement.Intel) (engagement.Intel, bool, error)
State(sessionID string, hasScope, hasReport bool) ([]engagement.PhaseState, error)
List(sessionID string) ([]engagement.Intel, error)
}
IntelStore is the subset of the engagement store the tools need.
type Progress ¶
type Progress struct {
Tool string `json:"tool"`
Message string `json:"message"`
Chunk string `json:"chunk,omitempty"`
Percent int `json:"percent,omitempty"`
}
Progress is an incremental update emitted while a tool runs.
type RAGDoc ¶
type RAGDoc struct {
ID string `json:"id"`
Path string `json:"path"`
Content string `json:"content"`
Meta map[string]any `json:"meta,omitempty"`
}
RAGDoc is one document submitted for indexing.
type RAGProvider ¶
type RAGProvider interface {
Name() string
Search(ctx context.Context, collection, query string, topK int) ([]RAGResult, error)
Index(ctx context.Context, collection string, docs []RAGDoc) (int, error)
Collections(ctx context.Context) ([]string, error)
Delete(ctx context.Context, collection string) error
}
RAGProvider is the native retrieval backend (vectors in the Antares DB).
type RAGResult ¶
type RAGResult struct {
Content string `json:"content"`
Path string `json:"path,omitempty"`
DocID string `json:"doc_id,omitempty"`
Score float64 `json:"score"`
}
RAGResult is one retrieved passage.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds the process-wide tool set.
type Result ¶
type Result struct {
// Content is what the model sees.
Content string `json:"content"`
// Display is an optional richer rendering for the dashboard.
Display string `json:"display,omitempty"`
IsError bool `json:"is_error,omitempty"`
Meta map[string]any `json:"meta,omitempty"`
}
Result is the outcome of a tool invocation.
type RoleInfo ¶
type RoleInfo struct {
Name string
Summary string
Category string
Danger bool
// Subrole is true for a specialist reached only through its master role.
Subrole bool
// Parent names the master role a subrole belongs to.
Parent string
}
RoleInfo is the subset of a role the tools need.
type ShellManager ¶
type ShellManager struct {
// contains filtered or unexported fields
}
ShellManager owns one long-lived shell per session so `cd`, exported variables, and activated virtualenvs survive between tool calls.
func NewShellManager ¶
func NewShellManager(cfg config.Terminal) *ShellManager
NewShellManager builds a manager for the given terminal config.
func (*ShellManager) Active ¶
func (m *ShellManager) Active() int
Active reports how many shells are currently running.
func (*ShellManager) Close ¶
func (m *ShellManager) Close(id string)
Close terminates a session's shell.
func (*ShellManager) CloseAll ¶
func (m *ShellManager) CloseAll()
CloseAll terminates every live shell.
func (*ShellManager) EnableHTTPShim ¶
func (m *ShellManager) EnableHTTPShim(dir, preset, proxy string)
EnableHTTPShim makes new shells route curl/wget through the fingerprinted client. dir is the directory holding the shim scripts.
func (*ShellManager) ReapIdle ¶
func (m *ShellManager) ReapIdle(lifetime time.Duration)
ReapIdle closes shells idle for longer than lifetime.
type SkillInfo ¶
type SkillInfo struct {
Name string `json:"name"`
Description string `json:"description"`
Tags []string `json:"tags"`
Triggers []string `json:"triggers"`
Enabled bool `json:"enabled"`
// Security-library metadata, empty for everyday skills.
CWEIDs []string `json:"cwe_ids,omitempty"`
TechStack []string `json:"tech_stack,omitempty"`
OWASPID string `json:"owasp_id,omitempty"`
ChainsWith []string `json:"chains_with,omitempty"`
}
SkillInfo describes one stored skill.
type SkillLibrary ¶
type SkillLibrary interface {
List() []SkillInfo
Search(query string, limit int) []SkillInfo
// SearchFiltered ranks matches and narrows by security metadata; empty
// filter fields are ignored.
SearchFiltered(query, cwe, tech, category string, limit int) []SkillInfo
// Chains resolves a skill's follow-on techniques (chains_with).
Chains(name string) []SkillInfo
Read(name string) (SkillInfo, string, bool)
Write(name, description, body string, tags []string) error
MarkUsed(name string)
}
SkillLibrary is the subset of the skills manager that tools need.
type SubAgent ¶
type SubAgent func(ctx context.Context, req SubAgentRequest) (string, error)
SubAgent runs a nested agent turn for delegate_task.
type SubAgentRequest ¶
type SubAgentRequest struct {
Prompt string
SystemExtra string
Toolset string
Model string
// Role names a specialist to run this workstream as. It sets the prompt,
// toolset, and model unless those are given explicitly.
Role string
// Isolate runs the sub-agent in its own git worktree, so parallel
// sub-agents editing the same repository do not conflict.
Isolate bool
// Workspace overrides the sub-agent's working directory.
Workspace string
MaxTurns int
ParentID string
OnProgress func(Progress)
}
SubAgentRequest describes a delegated workstream.
type TaskInfo ¶
type TaskInfo struct {
ID string `json:"id"`
Role string `json:"role"`
Task string `json:"task"`
Status string `json:"status"` // running|done|error|stopped
Output string `json:"output"`
Error string `json:"error"`
StartedAt time.Time `json:"started_at"`
EndedAt time.Time `json:"ended_at"`
}
TaskInfo is a snapshot of a background task.
Source Files
¶
- ask.go
- board.go
- browser.go
- captcha.go
- computer.go
- depcheck.go
- deps.go
- diagnostics.go
- document.go
- engagement.go
- file.go
- findings.go
- hackbrowser.go
- hooks.go
- httprequest.go
- imagegen.go
- intercept.go
- knowledge.go
- osint.go
- osint_api.go
- osint_dorkslive.go
- osint_emailfull.go
- osint_more.go
- project.go
- proxies.go
- register.go
- registry.go
- reverse.go
- schedule.go
- search.go
- shell.go
- skill.go
- soul.go
- task.go
- username_sites.go
- vision.go
- voice.go
- vps.go
- web.go