Expand description
§wabot-feature-mindset
Rust port of wabot-ts/src/feature/mindset. Provides:
- The
Mindsettrait — what user code implements to describe a bot’s personality and preferred LLM models. MirrorsIMindset. - The
MindsetOperator— the boring runtime that turns aMindset+ a set of tools into a system prompt and a function dispatcher. MirrorsMindsetOperator. MindsetCache— opt-in reuse of a mindset’s description across chats and messages.
Tools themselves live in wabot_feature_tool, shared with the
agent feature; the #[tools] / #[tool] macros in wabot-macros
generate the per-impl-block plumbing that feeds it.
§The shape of a mindset
Mindset::describe returns the whole persona in one call, which
is what makes MindsetCache possible — one await to memoize
rather than five independent ones that could each see different
state:
ⓘ
#[async_trait]
impl Mindset for ElisaMindset {
async fn describe(&self) -> MindsetDescription {
MindsetDescription::new(MindsetIdentity::new("Elisa", "spanish"))
.with_context(self.store.summary().await)
.with_skills("Answer questions about orders.")
}
async fn models(&self) -> MindsetModels {
MindsetModels::new().with(ModelKind::Llm, vec![MindsetModelRef::new("claude-opus-5")])
}
}Re-exports§
pub use agents::mindset_agent_tools_provider;pub use agents::register_mindset_agent_tools_provider;pub use agents::DynMindsetAgentToolsProvider;pub use agents::MindsetAgentBinding;pub use agents::MindsetAgentTools;pub use agents::MindsetAgentToolsProvider;pub use cache::LoadedMindset;pub use cache::MindsetCache;pub use cache::MindsetCacheConfig;
Modules§
- agents
- The seam between mindsets and agents. Port of
wabot-ts/src/feature/mindset/IMindsetAgentToolsProvider.ts. - cache
- Process-global cache of loaded mindset descriptions. Port of
wabot-ts/src/feature/mindset/MindsetCache.ts.
Structs§
- Mindset
Description - Everything a mindset says about itself. Mirrors
IMindsetDescription. - Mindset
Identity - Per-bot identity. Mirrors
IMindsetIdentityin TS. - Mindset
Model Ref - Lightweight model identifier — same fields as
IMindsetModelRef. - Mindset
Models - Models grouped by kind.
Defaultreturns an empty set. - Mindset
Operator - The mindset-driven runtime that
ChatBotconsumes. - Tool
Definition - A tool the model can call: its schema plus a type-erased async
body.
#[tools]emits one of these per method. - Tool
Gate - Which tools are reachable in a given context.
- Tool
Invoker - Turns tool definitions into an LLM schema and dispatches calls.
- Tool
Parameter - One parameter of a tool, as the model sees it.
- Tool
Schema - Provider-neutral tool description shipped to the LLM. Shared by mindsets and agents; the chat adapters know this type.
Enums§
- Model
Kind - Modality of an LLM the mindset can request. Mirrors
IMindsetModelKind. The operator falls back toLlmforVisionLlm/AudioLlmwhen the mindset hasn’t supplied a more specific model — matches the TSMODEL_KIND_FALLBACKtable. - Tool
Error - What a tool invocation can go wrong with.
Traits§
- Mindset
- What user mindsets implement. Mirrors
IMindset: a persona (Mindset::describe) and the models to run it on (Mindset::models).
Functions§
- normalize_
optional_ arguments - Drop optional arguments the model declined to fill in.
- parse_
tool_ arguments - Parse a tool’s JSON arguments into its args struct: normalize the optional ones, deserialize, then validate.
Type Aliases§
- Mindset
Error - Alias of
ToolError. - Mindset
Tool - The tool schema an adapter ships to the model. Alias of
ToolSchema, which mindsets and agents share — same relationshipIMindsetToolhas toIToolSchemain TS. - Mindset
Tool Definition - Alias of
ToolDefinition, what#[tools]emits per method. - Mindset
Tool Parameter - Alias of
ToolParameter. - Tool
Invoke Fn - Deserialize + validate + dispatch + stringify, all inside the closure the macro emits.