Skip to main content

Crate cel_context

Crate cel_context 

Source
Expand description

Portable Context Snapshot API

Normalizes arbitrary streams into ContextElements and merges them into a point-in-time ContextSnapshot an agent can consume.

Re-exports§

pub use events::CelEvent;
pub use watchdog::ContextWatchdog;

Modules§

events
CEL event types for the watchdog system.
watchdog
Context Watchdog — detects changes between context snapshots.

Structs§

AudioState
Generic audio output state.
Bounds
Screen-space rectangle in pixel coordinates.
BoundsRegion
Coarse spatial region for resilient element targeting. Uses normalized coordinates (0.0-1.0) so references survive resolution changes.
ClipboardState
Generic clipboard state.
ConfidenceThresholds
Confidence thresholds for agent behavior.
ConnectionEvent
A raw TCP/UDP connection observed by any source.
ContextContribution
Generic source contribution accepted by ContextMerger.
ContextElement
A single UI element in the unified context model.
ContextMerger
Generic merger for already-normalized context contributions.
ContextReference
A resilient, multi-signal reference to a UI element. Unlike element IDs (which are ephemeral per snapshot), references survive across context snapshots by combining multiple identifying signals.
ContextSnapshot
A point-in-time context snapshot built from normalized stream facts.
ElementState
UI element state flags.
FocusedContext
High-fidelity context for a single element — the “zoom in” view.
HttpEvent
A real HTTP request/response observed by CDP, proxy, or another source.
PowerState
Generic battery / power state.
RecentFile
Generic recent file state.
RunningApp
Generic running app state.
StreamStatus
High-level status for streams that contributed to a context snapshot.
TranscriptEntry
A single transcribed speech segment from the audio capture layer. Source-agnostic: may come from the microphone or system loopback.
WindowState
Generic visible-window state.

Enums§

ConfidenceBehavior
What behavior the agent should exhibit given a confidence score.
ContentRole
Content role classification for prompt injection defense.
ContextSource
The source that provided a context element.

Functions§

aria_role_to_cel_type
Convert a WAI-ARIA / DOM role into CEL’s normalized element type strings.
assign_default_actions
build_from_external
classify_content_role
Classify an element’s content role based on its type and properties.
is_actionable_type
resolve_reference
Resolve a reference against a screen context snapshot. Returns the best-matching element if its score exceeds the threshold.
score_element_confidence