Skip to main content

Crate tea_context

Crate tea_context 

Source
Expand description

Deterministic prompt modules, context providers, compilation, and inspection for tea-rs.

This pure context layer performs no filesystem, process, network, provider, executor, clock, or async-runtime work. Trust labels preserve provenance for inspection; they do not claim to prevent prompt injection.

Structs§

CompiledPrompt
Byte-identical compiled system prompt and explainability data.
ConflictClaim
Typed conflict claim attached to one segment.
ConflictKey
Canonical key for mutually exclusive prompt claims.
ContextError
Bounded safe context/compiler failure.
ContextIdentityError
Invalid canonical context selector.
ContextProviderId
Canonical context-provider identity.
ContextRequest
Immutable inputs visible to context providers for one turn snapshot.
PromptBudget
Exact byte and conservative token limits for one compiled prompt.
PromptCompiler
Pure deterministic prompt compiler.
PromptDiagnostic
Bounded deterministic compiler diagnostic without prompt content.
PromptInspectionEntry
Explainable inspection row for one input prompt segment.
PromptModule
Ordered prompt fragments contributed at one authority and priority.
PromptModuleId
Canonical prompt-module identity.
PromptPriority
Bounded priority used only within one authority class.
PromptProvenance
Bounded source attribution retained through compilation.
PromptSegment
One bounded sourced prompt fragment.
PromptSegmentId
Canonical prompt-segment identity.
ProvenanceError
Invalid prompt provenance.
SegmentError
Invalid prompt segment content.
SessionSummaryProvider
Explicit optional session-summary insertion point.
SkillId
Canonical skill metadata identity.
SkillInvocation
Parsed explicit @skill <skill-id> invocation.
SkillMetadata
Bounded declarative skill metadata; it does not execute the skill.
SkillMetadataProvider
Deterministic model-visible active skill metadata provider.
StaticContextProvider
Deterministic provider returning an immutable module snapshot.
ToolHintProvider
Generates guidance from prompt hints on the active tool snapshot.
WorkspaceInstruction
One caller-loaded workspace instruction document.
WorkspaceInstructionProvider
Provider over caller-supplied workspace instruction snapshots.

Enums§

BudgetBehavior
Behavior when a selected segment cannot fit the remaining prompt budget.
CacheScope
Intended reuse scope for prompt caching adapters.
ConflictMode
Whether a selected conflict claim may be replaced by higher precedence.
ContextErrorCode
Stable machine-readable context failure classification.
ModuleError
Prompt module invariant failure.
PromptAuthority
Fixed high-to-low prompt authority.
PromptDiagnosticCode
Stable prompt-compiler diagnostic classification.
SegmentDisposition
Final compiler disposition of one input segment.
SkillError
Invalid skill metadata or invocation.
TrustLevel
Declared origin trust for inspection and downstream policy.

Constants§

MAX_COMPILE_MODULES
Maximum modules accepted by one compilation.
MAX_CONTEXT_TOOLS
Maximum active tools visible to a context snapshot.
MAX_MODULE_SEGMENTS
Maximum segments contributed by one module.
MAX_SEGMENT_BYTES
Maximum UTF-8 bytes in one prompt segment.
MAX_SKILL_DESCRIPTION_BYTES
Maximum UTF-8 bytes in one skill description.
PROMPT_SEPARATOR
Fixed separator between accepted prompt segments.
TRUNCATION_MARKER
Fixed marker appended to deterministically shortened segments.

Traits§

ContextProvider
Object-safe context source evaluated before prompt compilation.

Functions§

estimate_tokens
Deterministic conservative token estimate ceil(utf8_bytes / 3).

Type Aliases§

ContextProviderFuture
Runtime-neutral boxed context-provider future.