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 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 more