_No description in Cargo.toml._
| Tier | infrastructure |
| Role | unclassified (baselined) |
| Path | crates/infrastructure/agent |
| Edition | 2021 |
| Targets | infrastructure_agent |
| Public items | 170 across 17 modules |
| Tests | 134 |
What it is for
infrastructure-agent — headless, embeddable agent engine (Agent Engine epic, sprints 1.0 / 1.0.1).
This crate opens with the shared vocabulary both engine paths speak (sprint 1.0.1 T-1.0.1a-1, Gate 1.5 Q1/Q4-C):
EngineEvent— the canonical, backend-blind event enum. Everything a
front-end or middleware sees is one of these; wire formats never leak.
Engine— the trait both the loop engine (we run the tool loop) and
the delegate engine (an external CLI runs its own loop) implement.
StubEngine— a scripted engine for TDD of everything downstream.
Capabilities
browser_tool (other)
browser_read — read a page through the operator's OWN browser.
| Item |
|---|
fn get_content_command(url_match : & str, timeout_secs : u64) -> serde_json::Value |
fn navigate_command(url : & str, timeout_secs : u64) -> serde_json::Value |
fn search_url(provider : & str, query : & str) -> Result <String, String> |
fn focus_command(url_match : & str, timeout_secs : u64) -> serde_json::Value |
fn commands_for(url_match : & str, timeout_secs : u64, follow : bool) -> Vec <serde_json::Value> |
fn parse_response(body : & serde_json::Value) -> Result <String, String> |
BridgeConfig
browser_read — read a page through the operator's OWN browser.
| Item |
|---|
pub struct BridgeConfig |
BridgeConfig :: fn local(api_key : impl Into <String>) -> Self |
BridgeConfig :: fn following(mut self, follow : bool) -> Self |
BrowserRead
browser_read — read a page through the operator's OWN browser.
| Item |
|---|
pub struct BrowserRead |
BrowserRead :: fn new(cfg : BridgeConfig) -> Result <Self, String> |
BrowserRead :: fn spec(& self) -> ToolSpec |
BrowserRead :: async fn call(& self, args : & serde_json::Value) -> Result <String, String> |
FindFiles
Built-in filesystem operations (T-1.0.3).
| Item |
|---|
pub struct FindFiles |
FindFiles :: fn new(guard : PathGuardSet, limits : FsLimits) -> Self |
FindFiles :: fn spec(& self) -> ToolSpec |
FindFiles :: async fn call(& self, args : & serde_json::Value) -> Result <String, String> |
FsLimits
Built-in filesystem operations (T-1.0.3).
| Item |
|---|
pub struct FsLimits |
FsLimits :: fn default() -> Self |
fn read_only_registry(guard : PathGuardSet, limits : FsLimits) -> crate::tools::ToolRegistry |
Grep
Built-in filesystem operations (T-1.0.3).
| Item |
|---|
pub struct Grep |
Grep :: fn new(guard : PathGuardSet, limits : FsLimits) -> Self |
Grep :: fn spec(& self) -> ToolSpec |
Grep :: async fn call(& self, args : & serde_json::Value) -> Result <String, String> |
ListDir
Built-in filesystem operations (T-1.0.3).
| Item |
|---|
pub struct ListDir |
ListDir :: fn new(guard : PathGuardSet, limits : FsLimits) -> Self |
ListDir :: fn spec(& self) -> ToolSpec |
ListDir :: async fn call(& self, args : & serde_json::Value) -> Result <String, String> |
ReadFile
Built-in filesystem operations (T-1.0.3).
| Item |
|---|
pub struct ReadFile |
ReadFile :: fn new(guard : PathGuardSet, limits : FsLimits) -> Self |
ReadFile :: fn spec(& self) -> ToolSpec |
ReadFile :: async fn call(& self, args : & serde_json::Value) -> Result <String, String> |
capability_tool (other)
find_capability — "does this already exist?" as a lookup (Gate 0.5).
| Item |
|---|
fn parse_manifest(text : & str) -> Option <(String, String)> |
Capability
find_capability — "does this already exist?" as a lookup (Gate 0.5).
| Item |
|---|
pub struct Capability |
fn search(crates : & Capability, query : & str, max : usize) -> Vec <Capability> |
FindCapability
find_capability — "does this already exist?" as a lookup (Gate 0.5).
| Item |
|---|
pub struct FindCapability |
FindCapability :: fn new(guard : & PathGuard, max_results : usize) -> Self |
FindCapability :: fn known(& self) -> usize |
FindCapability :: fn spec(& self) -> ToolSpec |
FindCapability :: async fn call(& self, args : & serde_json::Value) -> Result <String, String> |
commands (other)
Slash-command registry (sprint 1.0.1 follow-on).
| Item |
|---|
fn interpret(line : & str, commands : & Commands) -> Invocation |
Command
Slash-command registry (sprint 1.0.1 follow-on).
| Item |
|---|
pub const MAX_COMMAND_BYTES: u64 |
pub struct Command |
Commands
Slash-command registry (sprint 1.0.1 follow-on).
| Item |
|---|
pub struct Commands |
Commands :: fn load(dirs : & PathBuf) -> Self |
Commands :: fn get(& self, name : & str) -> Option <& Command> |
Commands :: fn names(& self) -> Vec <& str> |
Commands :: fn is_empty(& self) -> bool |
Commands :: fn names_in(& self, scope : Scope) -> Vec <& str> |
Commands :: fn families(& self) -> BTreeMap <& str, Vec <& Command>> |
Commands :: fn default_dirs(home : Option <& Path>, cwd : & Path) -> Vec <PathBuf> |
Invocation
Slash-command registry (sprint 1.0.1 follow-on).
| Item |
|---|
pub enum Invocation |
Scope
Slash-command registry (sprint 1.0.1 follow-on).
| Item |
|---|
pub enum Scope |
fn declared_scope(body : & str) -> Option <Scope> |
ClaudeCliConfig
ClaudeCliDelegate — the stream-json session driver (T-1.0.1a-3).
| Item |
|---|
pub struct ClaudeCliConfig |
ClaudeCliConfig :: fn for_binary(bin : impl Into <PathBuf>, extra : Vec <String>, max_input_bytes : usize, max_line_bytes : usize, read_timeout : Duration,) -> Self |
ClaudeCliDelegate
ClaudeCliDelegate — the stream-json session driver (T-1.0.1a-3).
| Item |
|---|
pub struct ClaudeCliDelegate |
ClaudeCliDelegate :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result |
ClaudeCliDelegate :: fn spawn(cfg : ClaudeCliConfig, sink : Arc <dyn TraceSink>) -> Result <Self, EngineError> |
ClaudeCliDelegate :: async fn send_user(& mut self, text : String) -> Result <(), EngineError> |
ClaudeCliDelegate :: async fn send_user_with(& mut self, text : String, attachments : Vec <crate::engine::Attachment>,) -> Result <(), EngineError> |
ClaudeCliDelegate :: async fn next_event(& mut self) -> Result <Option <EngineEvent>, EngineError> |
ClaudeCliDelegate :: async fn respond_permission(& mut self, id : & str, _allow : bool) -> Result <(), EngineError> |
DlpInputGuard
Ready-made pipeline plug-ins (sprint 1.0.1 follow-on).
| Item |
|---|
pub struct DlpInputGuard |
DlpInputGuard :: fn new(on_finding : OnFinding) -> Self |
DlpInputGuard :: fn with_denylist(mut self, terms : Vec <String>) -> Self |
DlpInputGuard :: async fn check(& self, text : & str) -> GuardDecision |
DlpOutputRoute
Ready-made pipeline plug-ins (sprint 1.0.1 follow-on).
| Item |
|---|
pub struct DlpOutputRoute |
DlpOutputRoute :: fn new() -> Self |
DlpOutputRoute :: fn with_denylist(mut self, terms : Vec <String>) -> Self |
DlpOutputRoute :: fn default() -> Self |
DlpOutputRoute :: async fn route(& self, event : EngineEvent) -> RouteDecision |
OnFinding
Ready-made pipeline plug-ins (sprint 1.0.1 follow-on).
| Item |
|---|
pub enum OnFinding |
Screened
Ready-made pipeline plug-ins (sprint 1.0.1 follow-on).
| Item |
|---|
pub struct Screened |
Screened :: fn is_clean(& self) -> bool |
fn screen_text(text : & str, denylist : & String) -> Screened |
ContextHintGuard
Context hints: keyword-triggered additions to an operator message.
| Item |
|---|
pub struct ContextHintGuard |
ContextHintGuard :: fn new() -> Self |
ContextHintGuard :: fn with_rule(mut self, rule : HintRule) -> Self |
ContextHintGuard :: async fn check(& self, text : & str) -> GuardDecision |
HintRule
Context hints: keyword-triggered additions to an operator message.
| Item |
|---|
pub struct HintRule |
HintRule :: fn new(keywords : & & str, source : Box <dyn HintSource>) -> Self |
HintRule :: fn directive(verbs : & & str, nouns : & & str, window : usize, source : Box <dyn HintSource>,) -> Self |
HintSource
Context hints: keyword-triggered additions to an operator message.
| Item |
|---|
pub trait HintSource |
Trigger
Context hints: keyword-triggered additions to an operator message.
| Item |
|---|
pub enum Trigger |
Trigger :: fn matches(& self, lowered : & str) -> bool |
ImageScreen
Screen images BEFORE they leave the machine (operator request, 2026-08-06).
| Item |
|---|
pub struct ImageScreen |
ImageScreen :: fn new(engine : std::sync::Arc <dyn OcrEngine>) -> Self |
ImageScreen :: fn with_denylist(mut self, terms : Vec <String>) -> Self |
ImageScreen :: fn block_low_confidence(mut self, block : bool) -> Self |
ImageScreen :: async fn inspect(& self, bytes : & u8, media_type : MediaType, width : u32, height : u32,) -> ImageVerdict |
ImageVerdict
Screen images BEFORE they leave the machine (operator request, 2026-08-06).
| Item |
|---|
pub enum ImageVerdict |
ImageVerdict :: fn is_clean(& self) -> bool |
LoopEngine
LoopEngine — WE run the tool loop (T-1.0.2, sprint 1.0).
| Item |
|---|
pub struct LoopEngine |
LoopEngine :: fn new(provider : Arc <dyn AiProvider>, tools : ToolRegistry, limits : LoopLimits, system_prompt : Option <String>, model : Option <String>,) -> Self |
LoopEngine :: async fn send_user(& mut self, text : String) -> Result <(), EngineError> |
LoopEngine :: async fn next_event(& mut self) -> Result <Option <EngineEvent>, EngineError> |
LoopEngine :: async fn respond_permission(& mut self, id : & str, _allow : bool) -> Result <(), EngineError> |
LoopLimits
LoopEngine — WE run the tool loop (T-1.0.2, sprint 1.0).
| Item |
|---|
pub struct LoopLimits |
EventRoute
The middleware pipeline (sprint 1.0.1 US-1.0.1b).
| Item |
|---|
pub trait EventRoute |
GuardDecision
The middleware pipeline (sprint 1.0.1 US-1.0.1b).
| Item |
|---|
pub enum GuardDecision |
InputGuard
The middleware pipeline (sprint 1.0.1 US-1.0.1b).
| Item |
|---|
pub trait InputGuard |
Pipeline
The middleware pipeline (sprint 1.0.1 US-1.0.1b).
| Item |
|---|
pub struct Pipeline |
Pipeline :: fn new() -> Self |
Pipeline :: fn with_guard(mut self, guard : Box <dyn InputGuard>) -> Self |
Pipeline :: fn with_route(mut self, route : Box <dyn EventRoute>) -> Self |
Pipeline :: fn attach <E : Engine>(self : & Arc <Self>, engine : E) -> PipelinedEngine <E> |
Pipeline :: fn inputs_guarded(& self) -> u64 |
Pipeline :: fn events_traversed(& self) -> u64 |
Pipeline :: fn default() -> Self |
PipelinedEngine
The middleware pipeline (sprint 1.0.1 US-1.0.1b).
| Item |
|---|
pub struct PipelinedEngine<E> |
PipelinedEngine<E>
The middleware pipeline (sprint 1.0.1 US-1.0.1b).
| Item |
|---|
PipelinedEngine<E> :: fn shares_pipeline_with <O>(& self, other : & PipelinedEngine <O>) -> bool |
PipelinedEngine<E> :: async fn send_user_reporting(& mut self, text : String) -> Result <SendOutcome, EngineError> |
PipelinedEngine<E> :: async fn send_user(& mut self, text : String) -> Result <(), EngineError> |
PipelinedEngine<E> :: async fn send_user_with(& mut self, text : String, attachments : Vec <crate::engine::Attachment>,) -> Result <(), EngineError> |
PipelinedEngine<E> :: async fn next_event(& mut self) -> Result <Option <EngineEvent>, EngineError> |
PipelinedEngine<E> :: async fn respond_permission(& mut self, id : & str, allow : bool) -> Result <(), EngineError> |
RouteDecision
The middleware pipeline (sprint 1.0.1 US-1.0.1b).
| Item |
|---|
pub enum RouteDecision |
SendOutcome
The middleware pipeline (sprint 1.0.1 US-1.0.1b).
| Item |
|---|
pub struct SendOutcome |
net_tools (other)
Network tools for the LOCAL engine (operator, 2026-08-06).
| Item |
|---|
fn parse_results(html : & str, max : usize) -> Vec <String> |
fn readable_text(html : & str) -> String |
FetchLimits
Network tools for the LOCAL engine (operator, 2026-08-06).
| Item |
|---|
pub struct FetchLimits |
FetchLimits :: fn default() -> Self |
FetchUrl
Network tools for the LOCAL engine (operator, 2026-08-06).
| Item |
|---|
pub struct FetchUrl |
FetchUrl :: fn new(limits : FetchLimits) -> Result <Self, String> |
FetchUrl :: fn spec(& self) -> ToolSpec |
FetchUrl :: async fn call(& self, args : & serde_json::Value) -> Result <String, String> |
WebSearch
Network tools for the LOCAL engine (operator, 2026-08-06).
| Item |
|---|
pub struct WebSearch |
WebSearch :: fn new(limits : FetchLimits, max_results : usize) -> Result <Self, String> |
WebSearch :: fn spec(& self) -> ToolSpec |
WebSearch :: async fn call(& self, args : & serde_json::Value) -> Result <String, String> |
reasoning (other)
Reasoning traces never cross a model boundary (operator, 2026-08-06).
| Item |
|---|
fn strip_reasoning(text : & str) -> String |
fn has_reasoning(text : & str) -> bool |
ReasoningStripGuard
Reasoning traces never cross a model boundary (operator, 2026-08-06).
| Item |
|---|
pub struct ReasoningStripGuard |
ReasoningStripGuard :: async fn check(& self, text : & str) -> GuardDecision |
Segment
Reasoning traces never cross a model boundary (operator, 2026-08-06).
| Item |
|---|
pub enum Segment |
fn split_reasoning(text : & str) -> Vec <Segment> |
Decision
Retention policy for recorded turns.
| Item |
|---|
pub struct Decision |
Decision :: fn may_store(& self) -> bool |
Match
Retention policy for recorded turns.
| Item |
|---|
pub enum Match |
PolicyConfig
Retention policy for recorded turns.
| Item |
|---|
pub struct PolicyConfig |
PolicyConfig :: fn starting_point(venting_terms : Vec <String>) -> Self |
Retention
Retention policy for recorded turns.
| Item |
|---|
pub enum Retention |
RetentionPolicy
Retention policy for recorded turns.
| Item |
|---|
pub struct RetentionPolicy |
RetentionPolicy :: fn deny_by_default() -> Self |
RetentionPolicy :: fn with_default(default : Retention) -> Self |
RetentionPolicy :: fn default_route(mut self, route : Route) -> Self |
RetentionPolicy :: fn with_rule(mut self, rule : Rule) -> Self |
RetentionPolicy :: fn decide(& self, text : & str, findings : & String) -> Decision |
RetentionPolicy :: fn from_config(cfg : & PolicyConfig) -> Self |
Route
Retention policy for recorded turns.
| Item |
|---|
pub enum Route |
Rule
Retention policy for recorded turns.
| Item |
|---|
pub struct Rule |
Rule :: fn new(matcher : Match, retention : Retention, reason : impl Into <String>) -> Self |
Rule :: fn routed(mut self, route : Route) -> Self |
RuleConfig
Retention policy for recorded turns.
| Item |
|---|
pub struct RuleConfig |
StubEngine
Scripted engine for TDD of middleware, front-ends, and the shared test
| Item |
|---|
pub struct StubEngine |
StubEngine :: fn new(turns : Vec <Vec <EngineEvent>>) -> Self |
StubEngine :: async fn send_user(& mut self, _text : String) -> Result <(), EngineError> |
StubEngine :: async fn next_event(& mut self) -> Result <Option <EngineEvent>, EngineError> |
StubEngine :: async fn respond_permission(& mut self, id : & str, _allow : bool) -> Result <(), EngineError> |
Tool
The tool registry the loop engine dispatches through (T-1.0.2).
| Item |
|---|
pub trait Tool |
ToolRegistry
The tool registry the loop engine dispatches through (T-1.0.2).
| Item |
|---|
pub struct ToolRegistry |
ToolRegistry :: fn new() -> Self |
ToolRegistry :: fn with(mut self, tool : Box <dyn Tool>) -> Self |
ToolRegistry :: fn specs(& self) -> Vec <ToolSpec> |
ToolRegistry :: fn get(& self, name : & str) -> Option <& dyn Tool> |
ToolRegistry :: fn is_empty(& self) -> bool |
NoopTrace
The trace sink (Gate 1.5 Q4-C, adopted R2).
| Item |
|---|
pub struct NoopTrace |
NoopTrace :: fn record_raw(& self, _line : & u8) |
TraceSink
The trace sink (Gate 1.5 Q4-C, adopted R2).
| Item |
|---|
pub trait TraceSink |
How to use it
No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.
Module structure
infrastructure_agent
browser_toolbuiltin_toolscapability_toolcommandsdelegatedelegate::claude_cliguardshintsimage_screenloop_enginemiddlewarenet_toolsreasoningretentionstubtoolstrace
flowchart TD n_infrastructure_agent["infrastructure_agent"] n_infrastructure_agent --> n_browser_tool["browser_tool"] n_infrastructure_agent --> n_builtin_tools["builtin_tools"] n_infrastructure_agent --> n_capability_tool["capability_tool"] n_infrastructure_agent --> n_commands["commands"] n_infrastructure_agent --> n_delegate["delegate"] n_delegate --> n_delegate__claude_cli["claude_cli"] n_infrastructure_agent --> n_guards["guards"] n_infrastructure_agent --> n_hints["hints"] n_infrastructure_agent --> n_image_screen["image_screen"] n_infrastructure_agent --> n_loop_engine["loop_engine"] n_infrastructure_agent --> n_middleware["middleware"] n_infrastructure_agent --> n_net_tools["net_tools"] n_infrastructure_agent --> n_reasoning["reasoning"] n_infrastructure_agent --> n_retention["retention"] n_infrastructure_agent --> n_stub["stub"] n_infrastructure_agent --> n_tools["tools"] n_infrastructure_agent --> n_trace["trace"]
Public surface
`browser_tool`
| Item | What it is |
|---|---|
pub struct BridgeConfig | Where the bridge lives and what one read may cost. |
BridgeConfig :: fn local(api_key : impl Into <String>) -> Self | The conventional local bridge. |
BridgeConfig :: fn following(mut self, follow : bool) -> Self | Watch mode: focus each tab as it is read. |
pub struct BrowserRead | Reads the text of a tab the operator already has open. |
BrowserRead :: fn new(cfg : BridgeConfig) -> Result <Self, String> | — |
fn get_content_command(url_match : & str, timeout_secs : u64) -> serde_json::Value | The command envelope the extension expects. |
fn navigate_command(url : & str, timeout_secs : u64) -> serde_json::Value | Point a tab at a URL |
fn search_url(provider : & str, query : & str) -> Result <String, String> | Search URL for a provider |
fn focus_command(url_match : & str, timeout_secs : u64) -> serde_json::Value | Bring a tab to the front |
fn commands_for(url_match : & str, timeout_secs : u64, follow : bool) -> Vec <serde_json::Value> | The commands one read sends, in order |
fn parse_response(body : & serde_json::Value) -> Result <String, String> | Pull page text out of the bridge's response envelope |
BrowserRead :: fn spec(& self) -> ToolSpec | — |
BrowserRead :: async fn call(& self, args : & serde_json::Value) -> Result <String, String> | — |
`builtin_tools`
| Item | What it is |
|---|---|
pub struct FsLimits | Shared limits |
FsLimits :: fn default() -> Self | — |
pub struct ListDir | list_dir — immediate entries of one directory. |
ListDir :: fn new(guard : PathGuardSet, limits : FsLimits) -> Self | — |
ListDir :: fn spec(& self) -> ToolSpec | — |
ListDir :: async fn call(& self, args : & serde_json::Value) -> Result <String, String> | — |
pub struct FindFiles | find_files — names matching a substring, anywhere under a path. |
FindFiles :: fn new(guard : PathGuardSet, limits : FsLimits) -> Self | — |
FindFiles :: fn spec(& self) -> ToolSpec | — |
FindFiles :: async fn call(& self, args : & serde_json::Value) -> Result <String, String> | — |
pub struct ReadFile | read_file — file contents, byte-capped without splitting a codepoint. |
ReadFile :: fn new(guard : PathGuardSet, limits : FsLimits) -> Self | — |
ReadFile :: fn spec(& self) -> ToolSpec | — |
ReadFile :: async fn call(& self, args : & serde_json::Value) -> Result <String, String> | — |
pub struct Grep | grep — lines containing a substring, as path:line: text. |
Grep :: fn new(guard : PathGuardSet, limits : FsLimits) -> Self | — |
Grep :: fn spec(& self) -> ToolSpec | — |
Grep :: async fn call(& self, args : & serde_json::Value) -> Result <String, String> | — |
fn read_only_registry(guard : PathGuardSet, limits : FsLimits) -> crate::tools::ToolRegistry | Every read-only operation, registered. |
`capability_tool`
| Item | What it is |
|---|---|
pub struct Capability | One thing the workspace already has. |
fn parse_manifest(text : & str) -> Option <(String, String)> | Parse name and description out of a Cargo.toml |
fn search(crates : & Capability, query : & str, max : usize) -> Vec <Capability> | Search loaded crates for a query, best first. |
pub struct FindCapability | The tool |
FindCapability :: fn new(guard : & PathGuard, max_results : usize) -> Self | Walk crates/**/Cargo.toml under the guard's root. |
FindCapability :: fn known(& self) -> usize | — |
FindCapability :: fn spec(& self) -> ToolSpec | — |
FindCapability :: async fn call(& self, args : & serde_json::Value) -> Result <String, String> | — |
`commands`
| Item | What it is |
|---|---|
pub const MAX_COMMAND_BYTES: u64 | Cap on one command file |
pub enum Scope | Where a command's turn is allowed to go |
fn declared_scope(body : & str) -> Option <Scope> | Read a declared scope from the head of a command file |
pub struct Command | One loaded command: its invocation name and the prompt text it expands to. |
pub struct Commands | Commands discovered across one or more directories, later directories winning on a name clash (project overrides user). |
Commands :: fn load(dirs : & PathBuf) -> Self | Load every *.md in each directory, in order |
Commands :: fn get(& self, name : & str) -> Option <& Command> | — |
Commands :: fn names(& self) -> Vec <& str> | — |
Commands :: fn is_empty(& self) -> bool | — |
Commands :: fn names_in(& self, scope : Scope) -> Vec <& str> | Names carrying the given scope, sorted. |
Commands :: fn families(& self) -> BTreeMap <& str, Vec <& Command>> | Commands grouped by the prefix before their first - — the family the operator already writes them in (search-*, role-*, legal-*) |
Commands :: fn default_dirs(home : Option <& Path>, cwd : & Path) -> Vec <PathBuf> | The conventional locations: the user's home commands, then the project's (project wins). |
pub enum Invocation | What a typed line means. |
fn interpret(line : & str, commands : & Commands) -> Invocation | Parse a typed line |
`delegate::claude_cli`
| Item | What it is |
|---|---|
pub struct ClaudeCliConfig | Session configuration |
pub struct ClaudeCliDelegate | A live headless session |
ClaudeCliDelegate :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result | — |
ClaudeCliConfig :: fn for_binary(bin : impl Into <PathBuf>, extra : Vec <String>, max_input_bytes : usize, max_line_bytes : usize, read_timeout : Duration,) -> Self | Standard headless-session vector for a real claude binary |
ClaudeCliDelegate :: fn spawn(cfg : ClaudeCliConfig, sink : Arc <dyn TraceSink>) -> Result <Self, EngineError> | Spawn the child and open the session. |
ClaudeCliDelegate :: async fn send_user(& mut self, text : String) -> Result <(), EngineError> | — |
ClaudeCliDelegate :: async fn send_user_with(& mut self, text : String, attachments : Vec <crate::engine::Attachment>,) -> Result <(), EngineError> | — |
ClaudeCliDelegate :: async fn next_event(& mut self) -> Result <Option <EngineEvent>, EngineError> | — |
ClaudeCliDelegate :: async fn respond_permission(& mut self, id : & str, _allow : bool) -> Result <(), EngineError> | — |
`guards`
| Item | What it is |
|---|---|
pub enum OnFinding | What to do when an outbound operator message carries sensitive values. |
pub struct Screened | What a screen found, without deciding what to do about it |
Screened :: fn is_clean(& self) -> bool | — |
fn screen_text(text : & str, denylist : & String) -> Screened | Detect and redact in one pass, returning both so the caller can choose. |
pub struct DlpInputGuard | Screens operator input before it leaves the machine |
DlpInputGuard :: fn new(on_finding : OnFinding) -> Self | — |
DlpInputGuard :: fn with_denylist(mut self, terms : Vec <String>) -> Self | Caller-supplied denylist terms (project code names, client names). |
DlpInputGuard :: async fn check(& self, text : & str) -> GuardDecision | — |
pub struct DlpOutputRoute | Redacts sensitive values in engine output before it is rendered — the return path of the same screen (a tool may read a secret out of a file). |
DlpOutputRoute :: fn new() -> Self | — |
DlpOutputRoute :: fn with_denylist(mut self, terms : Vec <String>) -> Self | — |
DlpOutputRoute :: fn default() -> Self | — |
DlpOutputRoute :: async fn route(& self, event : EngineEvent) -> RouteDecision | — |
`hints`
| Item | What it is |
|---|---|
pub trait HintSource | Resolves a hint at send time (may do I/O — e.g |
pub enum Trigger | How a rule decides a message is ASKING for the hint. |
Trigger :: fn matches(& self, lowered : & str) -> bool | — |
pub struct HintRule | One trigger and what it contributes. |
HintRule :: fn new(keywords : & & str, source : Box <dyn HintSource>) -> Self | Keyword rule (blunt). |
HintRule :: fn directive(verbs : & & str, nouns : & & str, window : usize, source : Box <dyn HintSource>,) -> Self | Directive rule: a verb shortly before a noun. |
pub struct ContextHintGuard | Appends resolved context for any rule whose keywords appear. |
ContextHintGuard :: fn new() -> Self | — |
ContextHintGuard :: fn with_rule(mut self, rule : HintRule) -> Self | — |
ContextHintGuard :: async fn check(& self, text : & str) -> GuardDecision | — |
`image_screen`
| Item | What it is |
|---|---|
pub enum ImageVerdict | What the local screen concluded about one image. |
ImageVerdict :: fn is_clean(& self) -> bool | The only verdict that may be attached without operator override. |
pub struct ImageScreen | Local OCR + DLP screen for image attachments. |
ImageScreen :: fn new(engine : std::sync::Arc <dyn OcrEngine>) -> Self | — |
ImageScreen :: fn with_denylist(mut self, terms : Vec <String>) -> Self | — |
ImageScreen :: fn block_low_confidence(mut self, block : bool) -> Self | — |
ImageScreen :: async fn inspect(& self, bytes : & u8, media_type : MediaType, width : u32, height : u32,) -> ImageVerdict | OCR bytes, then screen the recognized text. |
`loop_engine`
| Item | What it is |
|---|---|
pub struct LoopLimits | Loop limits |
pub struct LoopEngine | An engine that runs the tool loop locally over an AiProvider. |
LoopEngine :: fn new(provider : Arc <dyn AiProvider>, tools : ToolRegistry, limits : LoopLimits, system_prompt : Option <String>, model : Option <String>,) -> Self | — |
LoopEngine :: async fn send_user(& mut self, text : String) -> Result <(), EngineError> | — |
LoopEngine :: async fn next_event(& mut self) -> Result <Option <EngineEvent>, EngineError> | — |
LoopEngine :: async fn respond_permission(& mut self, id : & str, _allow : bool) -> Result <(), EngineError> | — |
`middleware`
| Item | What it is |
|---|---|
pub enum GuardDecision | What an InputGuard decided about an operator message. |
pub trait InputGuard | Inspect/rewrite/deny operator input before it reaches any engine. |
pub enum RouteDecision | What an EventRoute decided about an engine event. |
pub trait EventRoute | Transform, side-route, or suppress every engine event before render. |
pub struct Pipeline | Ordered guard + route chains with traversal instrumentation. |
Pipeline :: fn new() -> Self | — |
Pipeline :: fn with_guard(mut self, guard : Box <dyn InputGuard>) -> Self | — |
Pipeline :: fn with_route(mut self, route : Box <dyn EventRoute>) -> Self | — |
Pipeline :: fn attach <E : Engine>(self : & Arc <Self>, engine : E) -> PipelinedEngine <E> | Wrap engine so every input and event traverses THIS pipeline. |
Pipeline :: fn inputs_guarded(& self) -> u64 | How many operator messages the guard chain has processed. |
Pipeline :: fn events_traversed(& self) -> u64 | How many engine events the route chain has processed. |
Pipeline :: fn default() -> Self | — |
pub struct PipelinedEngine<E> | An engine whose I/O flows through a shared Pipeline. |
pub struct SendOutcome | What the guard chain did to an operator message, for front-ends that show the operator what was actually sent (a silent rewrite is a lie of omission). |
PipelinedEngine<E> :: fn shares_pipeline_with <O>(& self, other : & PipelinedEngine <O>) -> bool | Construction-level identity check for the shared-pipeline AC. |
PipelinedEngine<E> :: async fn send_user_reporting(& mut self, text : String) -> Result <SendOutcome, EngineError> | Like Engine::send_user, but reports what the guards did so the caller can show it |
PipelinedEngine<E> :: async fn send_user(& mut self, text : String) -> Result <(), EngineError> | — |
PipelinedEngine<E> :: async fn send_user_with(& mut self, text : String, attachments : Vec <crate::engine::Attachment>,) -> Result <(), EngineError> | — |
PipelinedEngine<E> :: async fn next_event(& mut self) -> Result <Option <EngineEvent>, EngineError> | — |
PipelinedEngine<E> :: async fn respond_permission(& mut self, id : & str, allow : bool) -> Result <(), EngineError> | — |
`net_tools`
| Item | What it is |
|---|---|
pub struct FetchLimits | Caps for one fetch |
FetchLimits :: fn default() -> Self | — |
pub struct FetchUrl | fetch_url — retrieve a page and hand back its readable text. |
FetchUrl :: fn new(limits : FetchLimits) -> Result <Self, String> | Build with the hardened egress client (no allowlist relaxation: this is the public-internet client, and loopback stays refused). |
FetchUrl :: fn spec(& self) -> ToolSpec | — |
FetchUrl :: async fn call(& self, args : & serde_json::Value) -> Result <String, String> | — |
pub struct WebSearch | web_search — DuckDuckGo's HTML endpoint |
WebSearch :: fn new(limits : FetchLimits, max_results : usize) -> Result <Self, String> | — |
WebSearch :: fn spec(& self) -> ToolSpec | — |
WebSearch :: async fn call(& self, args : & serde_json::Value) -> Result <String, String> | — |
fn parse_results(html : & str, max : usize) -> Vec <String> | Pull title — url lines out of a DuckDuckGo HTML result page. |
fn readable_text(html : & str) -> String | Strip markup down to readable text |
`reasoning`
| Item | What it is |
|---|---|
fn strip_reasoning(text : & str) -> String | Remove every reasoning block |
fn has_reasoning(text : & str) -> bool | True when the text carries any reasoning block. |
pub enum Segment | A piece of a model's output, labelled by what it is. |
fn split_reasoning(text : & str) -> Vec <Segment> | Split output into thinking and answer, in order, so a front-end can style them differently instead of showing one undifferentiated wall. |
pub struct ReasoningStripGuard | Strips reasoning from anything on its way to an engine |
ReasoningStripGuard :: async fn check(& self, text : & str) -> GuardDecision | — |
`retention`
| Item | What it is |
|---|---|
pub enum Retention | How long a turn may be kept. |
pub enum Match | What a rule looks at. |
pub enum Route | Which engine should answer this turn. |
pub struct Rule | One rule: what to look for, where it should go, and how long it may be kept |
Rule :: fn new(matcher : Match, retention : Retention, reason : impl Into <String>) -> Self | — |
Rule :: fn routed(mut self, route : Route) -> Self | Send matches to a specific engine. |
pub struct Decision | What the policy decided, and which rule decided it |
Decision :: fn may_store(& self) -> bool | True when the turn may be written at all. |
pub struct RetentionPolicy | Ordered rules plus the default for anything unmatched. |
RetentionPolicy :: fn deny_by_default() -> Self | A policy that keeps nothing unless a rule says otherwise. |
RetentionPolicy :: fn with_default(default : Retention) -> Self | — |
RetentionPolicy :: fn default_route(mut self, route : Route) -> Self | — |
RetentionPolicy :: fn with_rule(mut self, rule : Rule) -> Self | — |
RetentionPolicy :: fn decide(& self, text : & str, findings : & String) -> Decision | First matching rule wins; otherwise the stated defaults. |
RetentionPolicy :: fn from_config(cfg : & PolicyConfig) -> Self | Build from a config document — every term and threshold comes from the operator's file, not from this crate |
pub struct PolicyConfig | The configurable shape: what a config file deserializes into |
pub struct RuleConfig | — |
PolicyConfig :: fn starting_point(venting_terms : Vec <String>) -> Self | The starting shape an operator's config would express: nothing sensitive is recorded, venting and chatter go to the local model and are not kept, everything else is work and goes remote |
`stub`
| Item | What it is |
|---|---|
pub struct StubEngine | An Engine that replays pre-scripted turns and enforces the full contract (turn discipline, permission gating, session end). |
StubEngine :: fn new(turns : Vec <Vec <EngineEvent>>) -> Self | — |
StubEngine :: async fn send_user(& mut self, _text : String) -> Result <(), EngineError> | — |
StubEngine :: async fn next_event(& mut self) -> Result <Option <EngineEvent>, EngineError> | — |
StubEngine :: async fn respond_permission(& mut self, id : & str, _allow : bool) -> Result <(), EngineError> | — |
`tools`
| Item | What it is |
|---|---|
pub trait Tool | A tool the model may call. |
pub struct ToolRegistry | Name-addressed set of tools. |
ToolRegistry :: fn new() -> Self | — |
ToolRegistry :: fn with(mut self, tool : Box <dyn Tool>) -> Self | — |
ToolRegistry :: fn specs(& self) -> Vec <ToolSpec> | Specs for every registered tool, in stable name order. |
ToolRegistry :: fn get(& self, name : & str) -> Option <& dyn Tool> | — |
ToolRegistry :: fn is_empty(& self) -> bool | — |
`trace`
| Item | What it is |
|---|---|
pub trait TraceSink | Receives raw wire lines for replay/drift forensics |
pub struct NoopTrace | The default sink: drops everything (zero cost when tracing is off). |
NoopTrace :: fn record_raw(& self, _line : & u8) | — |
Re-exports. Exported here, defined elsewhere.
| Export | Defined in |
|---|---|
{Attachment,Engine,EngineError,EngineEvent,ToolOutcome} | engine::{Attachment,Engine,EngineError,EngineEvent,ToolOutcome} |
{ClaudeCliConfig,ClaudeCliDelegate} | claude_cli::{ClaudeCliConfig,ClaudeCliDelegate} |
{Commands,Invocation} | commands::{Commands,Invocation} |
{ContextHintGuard,HintRule,HintSource} | hints::{ContextHintGuard,HintRule,HintSource} |
{EventRoute,GuardDecision,InputGuard,Pipeline,PipelinedEngine,RouteDecision,SendOutcome,} | middleware::{EventRoute,GuardDecision,InputGuard,Pipeline,PipelinedEngine,RouteDecision,SendOutcome,} |
{FinishReason,ToolCall} | infrastructure_ai::{FinishReason,ToolCall} |
{LoopEngine,LoopLimits} | loop_engine::{LoopEngine,LoopLimits} |
{NoopTrace,TraceSink} | trace::{NoopTrace,TraceSink} |
{Tool,ToolRegistry} | tools::{Tool,ToolRegistry} |
{split_reasoning,strip_reasoning,ReasoningStripGuard,Segment} | reasoning::{split_reasoning,strip_reasoning,ReasoningStripGuard,Segment} |
Boundary
Reaches into foundation.
Shares tier infrastructure with 82 other crates: infrastructure-acquire, infrastructure-adapters-google-calendar, infrastructure-adapters-google-gmail, infrastructure-adapters-google-places, infrastructure-adapters-google-trends, infrastructure-adapters-shodan, infrastructure-adapters-yelp, infrastructure-ai, … (82 total).
_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._
Where it sits
| Tier (ontology) | infrastructure |
| Architectural role (taxonomy) | unclassified (baselined) |
| Location | crates/infrastructure/agent |
| Vocabulary in force (lexicon) | current |
Tier flow. Which tiers this crate's own edges cross.
flowchart LR n_infrastructure["infrastructure"] --> n_foundation["foundation"]
Dependencies
Runtime, in this workspace.
| Crate | Tier | Optional | Only on |
|---|---|---|---|
| `foundation-bounded-io` | foundation | yes | always |
| `infrastructure-ai` | infrastructure | no | always |
| `infrastructure-dlp-detect` | infrastructure | yes | always |
| `infrastructure-fetcher` | infrastructure | yes | always |
| `infrastructure-ocr-engine` | infrastructure | yes | always |
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
async-trait | ^0.1 | — | no | always |
reqwest | ^0.12 | json | yes | always |
serde | ^1 | derive | no | always |
serde_json | ^1 | — | no | always |
thiserror | ^2 | — | no | always |
tokio | ^1 | full | yes | always |
url | ^2 | — | yes | always |
Development, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
tokio | ^1 | full | no | always |
Build. None.
Depended on by. 3 workspace crates.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR n_application_conversation["application-conversation"] -->|uses| SELF n_tools_corpus["tools-corpus"] -->|uses| SELF n_tools_imp["tools-imp"] -->|uses| SELF SELF["infrastructure-agent"] SELF -->|runtime| n_foundation_bounded_io["foundation-bounded-io"] SELF -->|runtime| n_infrastructure_ai["infrastructure-ai"] SELF -->|runtime| n_infrastructure_dlp_detect["infrastructure-dlp-detect"] SELF -->|runtime| n_infrastructure_fetcher["infrastructure-fetcher"] SELF -->|runtime| n_infrastructure_ocr_engine["infrastructure-ocr-engine"] classDef self fill:#1f883d,stroke:#1f883d,color:#fff; class SELF self;
Feature flags
| Feature | Enables | On by default |
|---|---|---|
browser-tool | net-tools, dep:reqwest | no |
claude-cli | dep:tokio, dep:foundation-bounded-io | no |
default | — | yes |
dlp | dep:infrastructure-dlp-detect | no |
fs-tools | dep:foundation-bounded-io | no |
image-screen | dlp, dep:infrastructure-ocr-engine | no |
net-tools | dep:infrastructure-fetcher, dep:url, dep:foundation-bounded-io | no |
flowchart LR n_browser_tool["browser-tool"] --> n_net_tools["net-tools"] n_browser_tool["browser-tool"] --> n_dep_reqwest["dep:reqwest"] n_claude_cli["claude-cli"] --> n_dep_tokio["dep:tokio"] n_claude_cli["claude-cli"] --> n_dep_foundation_bounded_io["dep:foundation-bounded-io"] n_default["default"] n_dlp["dlp"] --> n_dep_infrastructure_dlp_detect["dep:infrastructure-dlp-detect"] n_fs_tools["fs-tools"] --> n_dep_foundation_bounded_io["dep:foundation-bounded-io"] n_image_screen["image-screen"] --> n_dlp["dlp"] n_image_screen["image-screen"] --> n_dep_infrastructure_ocr_engine["dep:infrastructure-ocr-engine"] n_net_tools["net-tools"] --> n_dep_infrastructure_fetcher["dep:infrastructure-fetcher"] n_net_tools["net-tools"] --> n_dep_url["dep:url"] n_net_tools["net-tools"] --> n_dep_foundation_bounded_io["dep:foundation-bounded-io"]
Targets
| Kind | Name | Source |
|---|---|---|
| lib | infrastructure_agent | `src/lib.rs` |
Error model
No public error type was detected: no public item declares a type named *Error, and no public signature returns one.
Operational characteristics
| Property | Evidence |
|---|---|
| async public surface | yes |
| async runtime | yes |
| database access | none detected |
| network I/O | yes |
| unsafe code | none detected |
| environment variables | none detected |
No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.
Configuration
No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.
Related capabilities
3 workspace crates depend on this one: application-conversation, tools-corpus, tools-imp.
Verification
| Kind | Count |
|---|---|
| Unit tests | 134 |
| Integration tests | 0 |
| Examples | 0 |
| Doctests | 0 |
Evidence by module. How often each public module is named by something executable.
| Module | Tests | Examples | Consumers |
|---|---|---|---|
browser_tool | 8 | 0 | 2 |
builtin_tools | 6 | 0 | 2 |
capability_tool | 4 | 0 | 5 |
commands | 7 | 0 | 8 |
delegate::claude_cli | 2 | 0 | 3 |
guards | 5 | 0 | 4 |
hints | 4 | 0 | 1 |
image_screen | 2 | 0 | 2 |
loop_engine | 2 | 0 | 2 |
middleware | 7 | 0 | 5 |
net_tools | 5 | 0 | 3 |
reasoning | 5 | 0 | 5 |
retention | 8 | 0 | 5 |
stub | 1 | 0 | 0 |
tools | 2 | 0 | 2 |
trace | 2 | 0 | 1 |
What the tests establish, by name:
a_bridge_failure_surfaces_its_reason_rather_than_empty_text—src/browser_tool.rsa_search_without_a_tab_or_a_query_is_refused—src/browser_tool.rsa_successful_envelope_with_no_text_is_an_error_not_an_empty_answer—src/browser_tool.rsan_empty_url_match_is_refused_before_touching_the_bridge—src/browser_tool.rseach_provider_gets_its_own_search_url_and_the_query_is_encoded—src/browser_tool.rsfollowing_is_off_unless_asked_for—src/browser_tool.rsnavigating_precedes_reading—src/browser_tool.rspage_text_is_read_from_any_of_the_shapes_seen_in_the_wild—src/browser_tool.rsthe_client_is_allowlisted_to_the_bridge_alone—src/browser_tool.rsthe_command_envelope_matches_what_the_extension_expects—src/browser_tool.rswatch_mode_focuses_first_and_reading_alone_never_steals_focus—src/browser_tool.rsevery_operation_refuses_to_leave_the_sandbox—src/builtin_tools.rsfind_files_matches_names_recursively—src/builtin_tools.rsgrep_finds_content_with_path_and_line—src/builtin_tools.rslist_dir_lists_entries_and_marks_directories—src/builtin_tools.rsmissing_required_arguments_are_errors_not_panics—src/builtin_tools.rsread_file_returns_contents_and_marks_truncation—src/builtin_tools.rsresults_are_capped—src/builtin_tools.rsthe_registry_exposes_every_operation—src/builtin_tools.rsa_connective_word_must_not_drag_in_unrelated_crates—src/capability_tool.rsa_description_match_outranks_a_name_match—src/capability_tool.rsa_manifest_without_a_description_still_yields_its_name—src/capability_tool.rsa_partial_match_still_finds_the_crate—src/capability_tool.rsmanifests_parse_name_and_description—src/capability_tool.rsno_match_is_empty_not_a_wrong_answer—src/capability_tool.rsresults_are_capped—src/capability_tool.rsshort_noise_words_do_not_match_everything—src/capability_tool.rsthe_operators_words_find_the_crate_that_ships_it—src/capability_tool.rsthe_tool_answers_over_a_real_directory_tree—src/capability_tool.rsa_command_can_declare_scope_in_a_comment_marker—src/commands.rs- _… 104 more_
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 96 | 170 |
Public modules with a //! block | 17 | 17 |
pie showData
title Public items with rustdoc
"Documented" : 96
"No rustdoc detected" : 74
Metrics
| Metric | Value |
|---|---|
| Rust source files | 19 |
| Source lines | 5448 |
| Code lines | 4412 |
| Public API items | 170 |
| Public modules | 17 |
| Tests | 134 |
| Examples | 0 |
| Cargo features | 7 |
| Direct runtime dependencies | 12 |
| Workspace reverse dependencies | 3 |
pie showData
title Public API by kind
"constant" : 1
"enum" : 11
"function" : 17
"method" : 100
"struct" : 36
"trait" : 5
pie showData
title Rust source composition
"Code" : 4412
"Blank or comment" : 1036
Generation
Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.