Skip to main content

base/interface/
mod.rs

1//! Injectable contracts — the traits a host implements to replace part of the
2//! engine.
3//!
4//! The entry requirement is narrow on purpose: **every module here defines at
5//! least one trait the engine holds as a `dyn` object.** Data types,
6//! configuration and the shared data live at the crate root instead
7//! (`base::event`, `base::prompt`, `base::memory`, `base::permission`);
8//! the settings file model is the `settings` crate's.
9//!
10//! # What is reachable from here, and what is not
11//!
12//! This crate depends on no other crate of this workspace — that is what keeps
13//! it at the bottom of the graph. So this directory can only host contracts defined in
14//! `base` itself:
15//!
16//! | Contract | Replaces |
17//! |---|---|
18//! | [`model::Model`] | the LLM backend / wire protocol |
19//! | [`model_factory::ModelFactory`] | how a protocol is built from config |
20//! | [`model_interceptor::ModelInterceptor`] | the request out, the message back |
21//! | [`credentials::CredentialSource`] | where a provider's API key comes from |
22//! | [`config_source::ConfigSource`] | where the settings layers come from |
23//! | [`tool::Tool`] / [`tool::ToolRegistry`] | a tool, or the whole tool set |
24//! | [`tool_middleware::ToolMiddleware`] | a ring around every tool call |
25//! | [`tool_result::ToolResultTransformer`] | what a result may look like |
26//! | [`scene::SceneSpec`] | system prompt, tool surface, budgets |
27//! | [`turn_policy::TurnPolicy`] | when a turn has gone on long enough |
28//! | [`recovery_policy::RecoveryPolicy`] | what to do when a call goes wrong |
29//! | [`budget_policy::BudgetPolicy`] | what a turn may spend and how much it may carry |
30//! | [`environment::Environment`] | kept time and kept identifiers |
31//! | [`exec::Process`] | where a program runs |
32//! | [`exec::FileSystem`] | where a tool's files are |
33//! | [`exec::Network`] | every request that leaves the process |
34//! | [`exec::Sandbox`] | how a process is constrained |
35//! | [`backoff::BackoffPolicy`] | whether a failed request is sent again, and when |
36//! | [`permission::PermissionPolicy`] | whether a tool call runs |
37//! | [`permission::PermissionGrants`] | the allows handed out during a session |
38//! | [`delegate::Delegator`] | how sub-agents are launched |
39//! | [`event_sink::EventSink`] | where the engine's events go |
40//! | [`health::HealthCheck`] | whether a subsystem is working |
41//! | [`elicitation::Elicitation`] | how the engine asks a person something |
42//! | [`hooks::Hooks`] / [`hooks::HooksFactory`] | the session's lifecycle hooks |
43//! | [`host_call::HostCalls`] | how a call only the host can make reaches it |
44//! | [`host_js::HostFn`] | a function of a JavaScript library the host gives plugin code |
45//! | [`token_counter::TokenCounter`] | how big the context is judged to be |
46//! | [`prompt_registry::PromptRegistry`] | what goes into the system prompt |
47//! | [`prompt_assembler::PromptAssembler`] | how the whole prompt is put together |
48//! | [`prompt_assembly::AssemblyHook`] | a last pass over the assembled prompt |
49//! | [`script::ScriptEngine`] | running the operator's own code at a hook point |
50//! | [`memory_contracts::MemoryStorage`] | where durable memories are kept |
51//! | [`memory_contracts::DurableStore`] | the session's memory as a turn uses it |
52//! | [`memory_contracts::MemoryRetriever`] | which of them a turn sees |
53//! | [`skill_provider::SkillProvider`] | where a session's skills come from |
54//! | [`instruction_provider::InstructionProvider`] | where standing instructions come from |
55//! | [`instruction_provider::RuleProvider`] | where the rule index comes from |
56//!
57//! [`catalog`] is the whole picture, including the contracts below that this
58//! directory cannot re-export: every extension point as data, with when it
59//! fires, what it may change, how often, and who is allowed to use it.
60//!
61//! The engine's other replaceable contracts live in the crate that owns them
62//! and **cannot be re-exported here** without pointing a dependency edge
63//! downward: `Compactor` (`compaction`), `HistoryStore` (`history`),
64//! `Plugin` (`runtime`), `TelemetryRecorder` (`telemetry`),
65//! `McpClient` (`mcp`), `AnthropicClient` (`model`), `SearchProvider`
66//! (`tools`). Anyone looking for the full map wants the extension-point
67//! index, not this directory.
68
69pub mod backoff;
70pub mod budget_policy;
71pub mod catalog;
72pub mod config_source;
73pub mod credentials;
74pub mod delegate;
75pub mod elicitation;
76pub mod environment;
77pub mod event_sink;
78pub mod exec;
79pub mod health;
80pub mod hooks;
81pub mod host_call;
82pub mod host_js;
83pub mod inline_command;
84pub mod instruction_provider;
85pub mod mcp_servers;
86pub mod memory_contracts;
87pub mod model;
88pub mod model_factory;
89pub mod model_interceptor;
90pub mod permission;
91pub mod plugin_call;
92pub mod prompt_assembler;
93pub mod prompt_assembly;
94pub mod prompt_middleware;
95pub mod prompt_registry;
96pub mod recovery_policy;
97pub mod scene;
98pub mod script;
99pub mod skill_catalog;
100pub mod skill_provider;
101pub mod token_counter;
102pub mod tool;
103pub mod tool_dispatch;
104pub mod tool_middleware;
105pub mod tool_result;
106pub mod tool_selector;
107pub mod turn_policy;