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