Skip to main content

lash_core/session_model/
context.rs

1//! Context-preparation vocabulary shared between the runtime and the
2//! plugin host. Rolling strategies are dispatched through the
3//! [`TurnContextTransform`](crate::plugin::TurnContextTransform) prompt-view
4//! hook. Durable compaction is an explicit Agent Frame transition, not a
5//! rewrite of this prepared context.
6
7use std::sync::Arc;
8
9use crate::ToolProvider;
10use crate::plugin::PromptContribution;
11
12/// Output of the per-turn context transform pipeline — the messages,
13/// prompt contributions, and tool providers the runtime hands to the
14/// LLM call.
15#[derive(Clone)]
16pub struct PreparedContext {
17    pub messages: crate::MessageSequence,
18    pub prompt_contributions: Vec<PromptContribution>,
19    pub tool_providers: Vec<Arc<dyn ToolProvider>>,
20    pub include_base_tools: bool,
21}
22
23impl Default for PreparedContext {
24    fn default() -> Self {
25        Self {
26            messages: crate::MessageSequence::default(),
27            prompt_contributions: Vec::new(),
28            tool_providers: Vec::new(),
29            include_base_tools: true,
30        }
31    }
32}