Skip to main content

pv_harness/
lib.rs

1//! The Agent Harness: the drop-in inline proxy wrapping agent → LLM traffic.
2//!
3//! Hot path (per request): validate identity → check token quota → sanitize →
4//! compress → dispatch a copy to the async workers (non-blocking `try_send`,
5//! bounded channels) → forward upstream → stream chunks back. Workers do the
6//! heavy work: embeddings, loop delta, OCSF emission, bridge publish, ATIF
7//! appends. Receipts are signed once, at session close, asynchronously.
8//!
9//! Silent-error posture: every dropped worker message increments
10//! `pv_events_dropped_total`; audited chat/tool work reserves worker capacity
11//! before quotas mutate, so ATIF-bearing jobs are admission-gated (fail
12//! closed), never dropped mid-flight; client aborts still finalize sessions;
13//! worker panics are supervised and counted.
14
15pub mod authz;
16pub mod authzen;
17pub mod backend;
18pub mod config;
19pub mod content;
20pub mod dashboard;
21pub mod http_serve;
22pub(crate) mod inflight;
23pub(crate) mod journal;
24pub(crate) mod mcp;
25pub mod mcp_client;
26#[cfg(feature = "otel")]
27pub mod otel_content;
28pub mod pipeline;
29pub mod policy_push;
30pub(crate) mod provider;
31pub mod reconciler;
32pub(crate) mod recovery;
33pub mod revocation;
34pub mod routes;
35pub mod session;
36pub(crate) mod spool;
37pub(crate) mod token_routes;
38pub mod worker;
39pub mod workload;
40
41#[cfg(feature = "service-binding")]
42pub mod service_binding;
43
44pub use config::HarnessConfig;
45pub use journal::key_from_signer as control_key_from_signer;
46pub use pipeline::AppState;
47pub use routes::build_router;
48
49/// Internal-only re-exports for coverage-guided fuzzing. Not part of
50/// the stable API; do not depend on these outside `fuzz/`. The
51/// `#[doc(hidden)]` attribute keeps rustdoc from listing them.
52#[doc(hidden)]
53pub mod fuzz {
54    pub use crate::routes::__fuzz_parse_provider_chunk as parse_provider_chunk;
55    pub use crate::routes::__fuzz_sse_frame_end as sse_frame_end;
56}