pub struct ContextPrompt { /* private fields */ }Expand description
A compact data-role rendering bound to a complete verified snapshot.
Every selected text block and source location remains in rendered. Short citation handles
resolve to the complete original citations in citations, which stays with the host snapshot.
This is a separate opt-in representation; it does not change snapshot IDs or their budgets.
Digests detect changed bytes and are not publisher signatures or authorization grants.
Implementations§
Source§impl ContextPrompt
impl ContextPrompt
Sourcepub fn id(&self) -> &str
pub fn id(&self) -> &str
Commitment to the exact rendering, snapshot, citation map, tokenizer and budget.
Sourcepub fn render(&self) -> &str
pub fn render(&self) -> &str
Data-role context to send after verification; never treat source text as instructions.
Sourcepub const fn rendered_tokens(&self) -> usize
pub const fn rendered_tokens(&self) -> usize
Exact tokens in render, excluding any provider envelope or other prompt content.
Sourcepub fn verify(
&self,
snapshot: &ContextSnapshot,
tokenizer: &impl TokenCounter,
) -> Result<(), ContextError>
pub fn verify( &self, snapshot: &ContextSnapshot, tokenizer: &impl TokenCounter, ) -> Result<(), ContextError>
Verifies the complete snapshot and reconstructs this exact compact representation. The expected snapshot must come from the caller’s current authorized compilation.
Sourcepub fn resolve<'a>(
&'a self,
reference: &str,
snapshot: &ContextSnapshot,
tokenizer: &impl TokenCounter,
) -> Result<&'a [Citation], ContextError>
pub fn resolve<'a>( &'a self, reference: &str, snapshot: &ContextSnapshot, tokenizer: &impl TokenCounter, ) -> Result<&'a [Citation], ContextError>
Resolves an exact short handle only after verifying it against the expected snapshot.