Skip to main content

lash_core/session_model/
context.rs

1//! Context-preparation vocabulary shared between the runtime and the
2//! plugin host. The concrete strategy (rolling history, overflow
3//! recovery, `/compact`) lives in
4//! [`crate::plugin_builtin::rolling_history`] and is dispatched through
5//! the [`TurnContextTransform`](crate::plugin::TurnContextTransform) and
6//! [`HistoryRewriter`](crate::plugin::HistoryRewriter) plugin capability
7//! surfaces.
8
9use std::sync::Arc;
10
11use crate::ToolProvider;
12use crate::plugin::PromptContribution;
13
14/// Output of the per-turn context transform pipeline — the messages,
15/// prompt contributions, and tool providers the runtime hands to the
16/// LLM call.
17#[derive(Clone)]
18pub struct PreparedContext {
19    pub messages: crate::MessageSequence,
20    pub prompt_contributions: Vec<PromptContribution>,
21    pub tool_providers: Vec<Arc<dyn ToolProvider>>,
22    pub include_base_tools: bool,
23}
24
25impl Default for PreparedContext {
26    fn default() -> Self {
27        Self {
28            messages: crate::MessageSequence::default(),
29            prompt_contributions: Vec::new(),
30            tool_providers: Vec::new(),
31            include_base_tools: true,
32        }
33    }
34}