pub struct ContextSummarizationView<'a> {Show 26 fields
pub messages: &'a mut Vec<Message>,
pub deferred_db_hide_ids: &'a mut Vec<i64>,
pub deferred_db_summaries: &'a mut Vec<String>,
pub cached_prompt_tokens: &'a mut u64,
pub context_manager: &'a mut ContextManager,
pub server_compaction_active: bool,
pub token_counter: Arc<TokenCounter>,
pub summarization_deps: SummarizationDeps,
pub task_supervisor: Arc<TaskSupervisor>,
pub memory: Option<Arc<SemanticMemory>>,
pub conversation_id: Option<ConversationId>,
pub tool_call_cutoff: usize,
pub subgoal_registry: &'a mut SubgoalRegistry,
pub pending_task_goal: &'a mut Option<BlockingHandle<Option<String>>>,
pub pending_subgoal: &'a mut Option<BlockingHandle<Option<SubgoalExtractionResult>>>,
pub current_task_goal: &'a mut Option<String>,
pub task_goal_user_msg_hash: &'a mut Option<u64>,
pub subgoal_user_msg_hash: &'a mut Option<u64>,
pub status_tx: Option<UnboundedSender<String>>,
pub scrub: fn(&str) -> Cow<'_, str>,
pub compression_guidelines: Option<String>,
pub probe: Option<&'a mut dyn CompactionProbeCallback>,
pub archive: Option<&'a dyn ToolOutputArchive>,
pub persistence: Option<&'a dyn CompactionPersistence>,
pub metrics: Option<&'a dyn MetricsCallback>,
pub typed_pages: Option<Arc<TypedPagesState>>,
}Expand description
Borrow-lens over all fields needed for compaction and summarization operations.
Every field maps to a specific sub-field of Agent<C> and uses a type from a
crate below zeph-core in the dependency graph. Constructed in zeph-core using
one literal struct expression; the borrow checker verifies disjointness.
The view covers: message history mutation, deferred summary queues, context-manager compaction state, provider handles for LLM calls, memory persistence for flushing, subgoal registry for context-compression strategies, and background task handles for non-blocking goal/subgoal extraction.
Fields§
§messages: &'a mut Vec<Message>Full conversation history. Mutated by pruning, compaction, and deferred summary application.
deferred_db_hide_ids: &'a mut Vec<i64>SQLite row IDs to be soft-deleted after deferred summaries are applied.
deferred_db_summaries: &'a mut Vec<String>Summary strings paired with the hide IDs above — flushed to SQLite as a batch.
cached_prompt_tokens: &'a mut u64Running token count for the current prompt window. Updated after every mutation that changes message content.
context_manager: &'a mut ContextManagerFull context manager — contains compaction state, thresholds, strategy config.
server_compaction_active: boolWhether server-side compaction is currently active (skip client compaction when true, unless context has grown past the safety fallback threshold).
token_counter: Arc<TokenCounter>Token counter used for budget calculations and prompt recomputation.
summarization_deps: SummarizationDepsPre-built summarization deps (provider + timeout + token_counter + callbacks).
Built by the zeph-core shim from build_summarization_deps() before constructing
the view, so the view does not need to hold a raw DebugDumper reference.
task_supervisor: Arc<TaskSupervisor>Background task supervisor for spawning non-blocking goal/subgoal extractions.
memory: Option<Arc<SemanticMemory>>Semantic memory store — used to flush deferred summaries and store session digests.
conversation_id: Option<ConversationId>Conversation ID for all SQLite/Qdrant persistence calls.
tool_call_cutoff: usizeMaximum unsummarized tool-call pairs before forced deferred summarization kicks in.
subgoal_registry: &'a mut SubgoalRegistryIn-memory registry of all subgoals in the current session.
pending_task_goal: &'a mut Option<BlockingHandle<Option<String>>>Handle to the background task-goal extraction spawned last turn.
pending_subgoal: &'a mut Option<BlockingHandle<Option<SubgoalExtractionResult>>>Handle to the background subgoal extraction spawned last turn.
current_task_goal: &'a mut Option<String>Cached task goal for TaskAware/MIG pruning. None before first extraction.
task_goal_user_msg_hash: &'a mut Option<u64>Hash of the last user message when current_task_goal was populated.
Used to detect when a new extraction is needed.
subgoal_user_msg_hash: &'a mut Option<u64>Hash of the last user message when subgoal extraction was scheduled.
status_tx: Option<UnboundedSender<String>>TUI / channel status sender for spinner messages. None when TUI is disabled.
scrub: fn(&str) -> Cow<'_, str>Function pointer for scrubbing credentials from summary text.
Set to crate::redact::scrub_content by the zeph-core shim when
redact_credentials = true, or to a no-op identity function otherwise.
compression_guidelines: Option<String>Compression guidelines text loaded from SQLite by the zeph-core shim.
None when the feature is disabled or the caller does not load guidelines.
The service passes the contained string (or "") to summarize_with_llm. Closes #3528.
Set via ContextSummarizationView::with_compression_guidelines. Both the reactive
(compact_context) and proactive (maybe_proactive_compress) paths populate this field.
probe: Option<&'a mut dyn CompactionProbeCallback>Optional probe-validation callback. When Some, the service invokes it after LLM
summarization and before draining/reinsert. See CompactionProbeCallback for the
full implementor contract.
archive: Option<&'a dyn ToolOutputArchive>Optional pre-summary archive hook (Memex #2432). The service calls archive(to_compact)
BEFORE summarization and appends the returned reference list as a postfix AFTER the
LLM call so the LLM cannot destroy the [archived:UUID] markers.
persistence: Option<&'a dyn CompactionPersistence>Optional persistence completion callback. The service calls after_compaction once
the in-memory drain+reinsert is finalized. The optional Qdrant future returned by the
callback is bubbled back through CompactionOutcome::Compacted::qdrant_future.
metrics: Option<&'a dyn MetricsCallback>Metrics sink for compaction-related counter increments. Used for
compaction_hard_count, tool_output_prunes, and the four probe-outcome counters.
Closes #3527.
typed_pages: Option<Arc<TypedPagesState>>Shared typed-page state for invariant-aware compaction (#3630).
None when [memory.compression.typed_pages] enabled = false.
Populated by CompactionAdapters::populate in zeph-core.
Implementations§
Source§impl ContextSummarizationView<'_>
impl ContextSummarizationView<'_>
Sourcepub fn with_compression_guidelines(self, guidelines: Option<String>) -> Self
pub fn with_compression_guidelines(self, guidelines: Option<String>) -> Self
Set the compression guidelines text.
Call this on the view returned by Agent::summarization_view() before passing it to
ContextService::compact_context. Using a builder method keeps construction uniform
and avoids direct field mutation.
Auto Trait Implementations§
impl<'a> !Freeze for ContextSummarizationView<'a>
impl<'a> !RefUnwindSafe for ContextSummarizationView<'a>
impl<'a> Send for ContextSummarizationView<'a>
impl<'a> !Sync for ContextSummarizationView<'a>
impl<'a> Unpin for ContextSummarizationView<'a>
impl<'a> UnsafeUnpin for ContextSummarizationView<'a>
impl<'a> !UnwindSafe for ContextSummarizationView<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request