1#[cfg(target_arch = "wasm32")]
13pub mod tokio {
14 pub use tokio_with_wasm::alias::*;
15}
16
17pub mod ephemeral;
18pub(crate) mod generated;
19pub mod staged_registry;
20pub(crate) mod turn_admission;
21
22#[cfg(feature = "session-compaction")]
23pub mod compactor;
24
25#[cfg(all(feature = "session-store", not(target_arch = "wasm32")))]
26pub mod event_store;
27
28#[cfg(all(feature = "session-store", not(target_arch = "wasm32")))]
29pub mod persistent;
30
31#[cfg(all(feature = "session-store", not(target_arch = "wasm32")))]
32pub mod projector;
33
34pub use ephemeral::{
35 EphemeralSessionService, RuntimeContextAdmissionGuard, SessionAgent, SessionAgentBuilder,
36 SessionSnapshot,
37};
38pub use staged_registry::{AdmissionOutcome, MaterializationStatus, StagedSessionRegistry};
39
40pub const SESSION_LABELS_KEY: &str = "session_labels";
46
47pub type BroadcastEventReceiver =
50 tokio::sync::broadcast::Receiver<meerkat_core::EventEnvelope<meerkat_core::AgentEvent>>;
51
52#[cfg(feature = "session-compaction")]
53pub use compactor::DefaultCompactor;
54
55#[cfg(all(feature = "session-store", not(target_arch = "wasm32")))]
56pub use persistent::{
57 MachineServiceTurnCommitProtocol, MachineSessionArchiveProtocol, PersistentSessionService,
58};
59
60#[cfg(all(feature = "session-store", not(target_arch = "wasm32")))]
62inventory::submit! {
63 meerkat_skills::SkillRegistration {
64 id: "session-management",
65 name: "Session Management",
66 description: "Session persistence, resume patterns, event store replay, compaction tuning",
67 scope: meerkat_core::skills::SkillScope::Builtin,
68 requires_capabilities: &["session_store"],
69 body: include_str!("../skills/session-management/SKILL.md"),
70 extensions: &[],
71 }
72}
73
74#[cfg(all(feature = "session-store", not(target_arch = "wasm32")))]
76inventory::submit! {
77 meerkat_capabilities::CapabilityRegistration {
78 id: meerkat_capabilities::CapabilityId::SessionStore,
79 description: "PersistentSessionService, SessionProjector",
80 scope: meerkat_capabilities::CapabilityScope::Universal,
81 requires_feature: Some("session-store"),
82 prerequisites: &[],
83 status_resolver: None,
84 }
85}
86
87#[cfg(all(feature = "session-compaction", not(target_arch = "wasm32")))]
88inventory::submit! {
89 meerkat_capabilities::CapabilityRegistration {
90 id: meerkat_capabilities::CapabilityId::SessionCompaction,
91 description: "DefaultCompactor: auto-compact at token threshold, LLM summary, history rebuild",
92 scope: meerkat_capabilities::CapabilityScope::Universal,
93 requires_feature: Some("session-compaction"),
94 prerequisites: &[],
95 status_resolver: None,
96 }
97}
98
99pub(crate) fn control_error_into_session_error(
106 err: meerkat_core::service::SessionControlError,
107) -> meerkat_core::service::SessionError {
108 match err {
109 meerkat_core::service::SessionControlError::Session(session_err) => session_err,
110 other => meerkat_core::service::SessionError::Unsupported(other.to_string()),
111 }
112}