Skip to main content

Module tools

Module tools 

Source
Expand description

Tool system — trait, registry, and built-in tool implementations.

All tools implement the Tool trait and are registered in ToolRegistry. Subagents get ToolRegistry::without_subagent() to prevent recursion.

Modules§

activation
SessionToolSet — per-session core + exact activated tools (Task 15, spec §7.1, §4.2).
catalog
ToolCatalog — all locally known capabilities (spec §7.1, Task 14).
discovery
Model-facing discovery and exact-activation builtins (Task 17, spec §4.2, §7.2, §7.3, §7.7): search_tools and activate_tools.
forum
Explicit, project-wide peer notes through the captured host memory binding.
ledger
Task 25 — typed tool-call ledger (spec §8.3).
memory
Model-facing repository memory and explicitly opted-in user notes.
output
Task 26 — bounded tool-output delta channels with an explicit backpressure/coalescing policy (spec §8.4).
prompt_catalog
System-prompt catalog of activatable tools (progressive disclosure).
respond
RespondTool — reply to an event through its original source channel.
send_channel
SendChannelTool — proactively send a message to a specific channel.
shell
Interactive PTY-based shell sessions for agents.
watcher_exit

Structs§

ActivateToolsTool
Model-initiated deterministic exact activation. Every requested id must be an exact known cataloged ToolId; the whole batch validates first (host grant issuance: exact id, current generation/digest, source trust) and applies atomically in stable id order with exactly one session schema-generation advance. Requires host-supplied confirmation authority; a model-authored JSON flag can never substitute for it.
BashIntermediarySnapshot
BashTool
DeferredToolSplit
Result of ToolRegistry::deferred_tool_split.
EditTool
ExtensionTool
FindTool
GrepTool
LsTool
MemoryContextTool
Control the continuous-memory context of the current session (spec §7.2).
PowerShellTool
ReadTool
RespondTool
SearchToolsTool
Bounded, deterministic, descriptor-only capability search over the passive catalog snapshot. Pure and local: no factory invocation, no process start, no network, no schema exposure, no grant.
SecretPromptHandle
UI-only secret prompt plumbing for interactive tools.
SecretPromptQueue
SecretPromptRequest
SendChannelTool
SessionSchemaProjection
Typed projection report for ToolRegistry::session_tools_schema: the projected schema entries PLUS every pinned session member that was dropped fail-closed, with the typed reason. Metadata-only reasons: bounded identities, never schema bytes. Callers can surface dropped for audit/telemetry instead of losing the signal to a log line.
ShellEndTool
ShellSendTool
ShellStartTool
SubagentCollectTool
SubagentDisplayRow
Snapshot row produced by SubagentRegistry::display_rows(). Used by the TUI reconcile path as the registry’s liveness authority. Serde: travels in SessionEventWire::SubagentRows (phase 3).
SubagentHandle
SubagentModelAuthorizeTool
SubagentModelsTool
SubagentRegistry
SubagentResult
SubagentResumeTool
SubagentStartTool
SubagentState
All mutable state shared between the subagent thread and its handle. Collapsed behind a single RwLock so a status poll takes exactly one lock.
SubagentStatusTool
SubagentSteerTool
SubagentTool
ToolCapabilities
Runtime capability handles — shared services a tool may require.
ToolChannels
Streaming channels — carry partial tool output and stream events.
ToolContext
Context passed to tool execution — composition of channels, capabilities, and limits.
ToolLimits
Configuration limits and timeouts.
ToolRegistry
Registry of available tools. Maintains a name→tool map and a cached JSON schema array that gets sent to the API. Thread-safe via Arc<RwLock<ToolRegistry>>.
WatcherExitTool
WriteTool

Enums§

ConcurrencyKey
DroppedSessionMember
Why a pinned session member was dropped from a schema projection.
PromptKind
SubagentStatus
ToolOrigin
Explicit runtime-origin identity of a registered tool implementation.
ToolOutput
Structured tool output. Text is the legacy contract (what execute returns). Blocks carries Anthropic-shaped content blocks destined for tool_result.content, plus a plain-text summary used everywhere a String is expected today: UI preview, after_tool_call hooks, trace ledger byte counts, headless logs, and providers that cannot carry the blocks. INVARIANT: blocks[0] MUST be a {"type":"text"} block whose text == summary (compaction reads blocks[0].text; non-Anthropic translators join only text sub-blocks).

Traits§

Tool
The core trait for all tools. Implement this to add a new tool.

Functions§

bash_intermediary_snapshot
legacy_fresh_runtime
Kill-switch: SYNAPS_SUBAGENT_FRESH_RUNTIME=1 restores the pre-engine-host spawn path (fresh Runtime::new(), fresh HTTP client, registry rebuilt, global broker re-installed with a fresh token cache on every spawn).
resolve_agent_prompt
Resolve an agent name to a system prompt.
spawn_runtime
Build the runtime a subagent runs on. Preferred: EngineHost::worker_runtime() — shares the host credential source and token cache (so NO set_global_broker re-install and NO token-cache eviction per spawn) and takes a clone of the cached worker registry template. Legacy path (no host installed, or kill-switch set): today’s Runtime::new() + rebuilt tools + apply_auth_config, verbatim.