1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! Agent event stream — the ACP-aligned observation surface for the
//! agent loop.
//!
//! Every phase of the agent loop emits an `AgentEvent`. The canonical
//! variants map 1:1 onto ACP `SessionUpdate` values; three internal
//! variants (`IterationStart`, `IterationEnd`, `FeedbackInjected`) let
//! pipelines react to loop milestones that don't have a direct ACP
//! counterpart.
//!
//! `iteration_*` event names refer to one model round-trip inside the
//! loop (Harn's "iteration"), not to ACP's outer `prompt_turn`. See
//! `docs/src/concepts/glossary.md` for the canonical vocabulary and
//! `docs/src/concepts/sota-comparison.md` for the ACP mapping.
//!
//! There are two subscription paths, both keyed on session id so two
//! concurrent sessions never cross-talk:
//!
//! 1. **External sinks** (`AgentEventSink` trait) — Rust-side consumers
//! like the harn-cli ACP server. Invoked synchronously by the loop.
//! Stored in a global `OnceLock<RwLock<HashMap<...>>>` here.
//! 2. **Closure subscribers** — `.harn` closures registered via the
//! `agent_subscribe(session_id, callback)` host builtin. These live
//! on the session's `SessionState.subscribers` in
//! `crate::agent_sessions`, because sessions are the single source
//! of truth for session-scoped VM state.
pub use AgentEvent;
pub use reset_wildcard_sinks;
pub use ;
pub use ;
pub use ;
pub use ;