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//! | [`host_call::HostCalls`] | how a call only the host can make reaches it |
43//! | [`host_js::HostFn`] | a function of a JavaScript library the host gives plugin code |
44//! | [`token_counter::TokenCounter`] | how big the context is judged to be |
45//! | [`prompt_registry::PromptRegistry`] | what goes into the system prompt |
46//! | [`prompt_assembler::PromptAssembler`] | how the whole prompt is put together |
47//! | [`prompt_assembly::AssemblyHook`] | a last pass over the assembled prompt |
48//! | [`script::ScriptEngine`] | running the operator's own code at a hook point |
49//! | [`memory_contracts::MemoryStorage`] | where durable memories are kept |
50//! | [`memory_contracts::MemoryRetriever`] | which of them a turn sees |
51//! | [`skill_provider::SkillProvider`] | where a session's skills come from |
52//! | [`instruction_provider::InstructionProvider`] | where standing instructions come from |
53//! | [`instruction_provider::RuleProvider`] | where the rule index comes from |
54//!
55//! [`catalog`] is the whole picture, including the contracts below that this
56//! directory cannot re-export: every extension point as data, with when it
57//! fires, what it may change, how often, and who is allowed to use it.
58//!
59//! The engine's other replaceable contracts live in the crate that owns them
60//! and **cannot be re-exported here** without pointing a dependency edge
61//! downward: `Compactor` (`compaction`), `HistoryStore` (`history`),
62//! `Plugin` (`runtime`), `TelemetryRecorder` (`telemetry`),
63//! `McpClient` (`mcp`), `AnthropicClient` (`model`), `SearchProvider`
64//! (`tools`). Anyone looking for the full map wants the extension-point
65//! index, not this directory.
66
67pub mod backoff;
68pub mod budget_policy;
69pub mod catalog;
70pub mod config_source;
71pub mod credentials;
72pub mod delegate;
73pub mod elicitation;
74pub mod environment;
75pub mod event_sink;
76pub mod exec;
77pub mod health;
78pub mod host_call;
79pub mod host_js;
80pub mod inline_command;
81pub mod instruction_provider;
82pub mod mcp_servers;
83pub mod memory_contracts;
84pub mod model;
85pub mod model_factory;
86pub mod model_interceptor;
87pub mod permission;
88pub mod plugin_call;
89pub mod prompt_assembler;
90pub mod prompt_assembly;
91pub mod prompt_middleware;
92pub mod prompt_registry;
93pub mod recovery_policy;
94pub mod scene;
95pub mod script;
96pub mod skill_catalog;
97pub mod skill_provider;
98pub mod token_counter;
99pub mod tool;
100pub mod tool_dispatch;
101pub mod tool_middleware;
102pub mod tool_result;
103pub mod tool_selector;
104pub mod turn_policy;