pub struct ContextPackage {
pub package_id: String,
pub node_id: String,
pub restriction_map: RestrictionMap,
pub included_files: HashMap<String, String>,
pub structural_digests: Vec<StructuralDigest>,
pub summary_digests: Vec<SummaryDigest>,
pub total_bytes: usize,
pub budget_exceeded: bool,
pub created_at: i64,
}Expand description
PSP-5 Phase 3: Reproducible context package for node execution
A context package is the complete, bounded input assembled for a node’s LLM prompt. It records exactly what was included so the same context can be reconstructed from the ledger and repository state.
Fields§
§package_id: StringUnique package identifier
node_id: StringThe node this context was assembled for
restriction_map: RestrictionMapThe restriction map used
included_files: HashMap<String, String>Raw file contents included (path → content)
structural_digests: Vec<StructuralDigest>Structural digests included in this package
summary_digests: Vec<SummaryDigest>Summary digests included in this package
total_bytes: usizeTotal byte size of the assembled context
budget_exceeded: boolWhether budget was exceeded and content was trimmed
created_at: i64Timestamp of assembly
Implementations§
Source§impl ContextPackage
impl ContextPackage
Sourcepub fn new(node_id: impl Into<String>) -> ContextPackage
pub fn new(node_id: impl Into<String>) -> ContextPackage
Create a new empty context package for a node
Sourcepub fn add_file(&mut self, path: &str, content: String) -> bool
pub fn add_file(&mut self, path: &str, content: String) -> bool
Add a file to the context package, respecting budget
Sourcepub fn add_structural_digest(&mut self, digest: StructuralDigest)
pub fn add_structural_digest(&mut self, digest: StructuralDigest)
Add a structural digest (always fits, they’re small)
Sourcepub fn add_summary_digest(&mut self, digest: SummaryDigest)
pub fn add_summary_digest(&mut self, digest: SummaryDigest)
Add a summary digest
Sourcepub fn provenance(&self) -> ContextProvenance
pub fn provenance(&self) -> ContextProvenance
Get the provenance record for this package
Trait Implementations§
Source§impl Clone for ContextPackage
impl Clone for ContextPackage
Source§fn clone(&self) -> ContextPackage
fn clone(&self) -> ContextPackage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ContextPackage
impl Debug for ContextPackage
Source§impl Default for ContextPackage
impl Default for ContextPackage
Source§fn default() -> ContextPackage
fn default() -> ContextPackage
Source§impl<'de> Deserialize<'de> for ContextPackage
impl<'de> Deserialize<'de> for ContextPackage
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ContextPackage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ContextPackage, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for ContextPackage
impl Serialize for ContextPackage
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for ContextPackage
impl RefUnwindSafe for ContextPackage
impl Send for ContextPackage
impl Sync for ContextPackage
impl Unpin for ContextPackage
impl UnsafeUnpin for ContextPackage
impl UnwindSafe for ContextPackage
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more