cel-context 0.1.2

Portable context snapshots for AI agents. Normalize UI, browser, app, log, and external signals into reusable elements and snapshots.
Documentation
# cel-context

Portable context snapshots for AI agents.

`cel-context` gives agents, tools, and runtimes a shared way to describe
software state. Any source can emit `ContextElement`s, and any consumer can read
the resulting `ScreenContext` without depending on a specific browser, desktop,
OCR, accessibility, or monitoring stack.

## What's Included

- `ContextElement` — one UI, app, log, or source-derived fact.
- `ScreenContext` — one snapshot of app/window state and context elements.
- `ContextSource` — source labels such as accessibility, CDP, native API, OCR, vision, merged.
- `ContentRole` — prompt-injection-aware classification.
- `ContextReference` — resilient targeting data that survives ephemeral IDs.
- `ContextContribution` / `ContextMerger` — generic source contribution merge mechanics.

## Out Of Scope

- Capturing live desktop, browser, OCR, vision, or network streams.
- Deciding freshness, anomaly, prioritization, or policy rules over time.
- Dispatching actions back into an app or browser.
- Hosting dashboards, audit timelines, or compliance exports.

Those responsibilities belong in whichever runtime, adapter, or product embeds
the snapshot contract.

## Example

```sh
cargo run -p cel-context --example context_snapshot -- --json
```

The example constructs a snapshot from caller-provided `ContextElement`s. Live
capture belongs in runtime/source crates that emit the same contract shape.

## Minimal Element

```rust
use cel_context::{ContentRole, ContextElement, ContextSource};
use std::collections::HashMap;

let element = ContextElement {
    id: "app:button:submit".into(),
    label: Some("Submit".into()),
    description: None,
    element_type: "button".into(),
    value: None,
    bounds: None,
    state: Default::default(),
    parent_id: None,
    actions: vec!["click".into()],
    confidence: 0.95,
    source: ContextSource::NativeApi,
    content_role: ContentRole::Interactive,
    properties: HashMap::new(),
};
```

## License

Apache-2.0