1pub mod auth;
22pub mod background;
23pub mod bring_local;
24pub mod bus;
25pub mod capture;
26pub mod company_bound;
27pub mod computers;
28pub mod config;
29pub mod connect;
30pub mod consent;
31pub mod cpao;
32pub mod delivery;
33pub mod disconnect;
34pub mod docs;
35pub use lean_ctx::core::policy::cloud_floor as effective_floor;
36pub mod effective_policy;
37pub mod error;
38pub mod events;
39pub mod friction;
40pub mod gateway;
41pub mod identity_v2;
42pub mod instance_key;
43pub mod keyset_v3;
44pub mod knowledge;
45pub mod lease;
46pub mod link;
47pub mod local_docs;
48pub mod mapping;
49pub mod metrics;
50pub mod metrics_v2;
51pub mod migrate;
52pub mod models_access;
53pub mod outbox;
54pub mod policy;
55pub mod policy_sessions;
56pub mod queens;
57pub mod receipts;
58pub mod replica;
59pub mod resolution;
60pub mod review;
61pub mod revoked;
62pub mod root_cert;
63pub mod runtime_lease;
64pub mod scheduler;
65pub mod session_ref;
66pub mod state;
67pub mod status;
68pub mod sync;
69pub mod tasks;
70pub mod team_stop;
71pub mod throttle;
72pub mod transport;
73pub mod usage;
74pub use lean_ctx::core::untrusted;
75pub mod vault;
76pub mod vault_address;
77pub mod worker;
78pub mod workers;
79#[cfg(any(test, feature = "test-support"))]
80#[doc(hidden)]
81pub mod x5_guard_support;
82#[cfg(test)]
83mod x5_guard_tests;
84
85pub use config::{CloudConfig, CloudConfigExt};
86pub use error::{CloudError, Revocation, TaskRefusal};
87pub use state::CloudStore;
88
89pub fn register_hooks() {
99 lean_ctx::core::config::managed::register_signed_in_probe(runtime_lease::signed_in);
100 lean_ctx::core::config::cloud::register_off_switches(receipts::apply_off_switches);
104 lean_ctx::core::engine_interface::receipt_sink::register_receipt_sink(
107 |root, receipt_id, invocation, observation, now| {
108 receipts::note_engine_receipt(root, receipt_id, invocation, observation, now);
109 policy_sessions::note_receipt(receipt_id, now);
110 },
111 );
112 runtime_lease::ensure_registered();
113 models_access::ensure_registered();
114 lean_ctx::core::agents::register_announce(bus::presence::request_announce);
115 lean_ctx::core::cloud_signals::register_signal_recorder(
117 lean_ctx::core::cloud_signals::SignalRecorder {
118 recording: metrics_v2::signals::sink_open,
119 record: metrics_v2::signals::record,
120 secrets: metrics_v2::secrets::note,
121 },
122 );
123 lean_ctx::core::knowledge::hooks::register_knowledge_hooks(
124 lean_ctx::core::knowledge::hooks::KnowledgeHooks {
125 record_delivery: metrics::cloud_use::record_delivery,
126 session_ended: |project_root, session_id| {
127 knowledge::draft::on_session_event(
128 project_root,
129 session_id,
130 knowledge::draft::Trigger::SessionEnd,
131 );
132 if let Ok(store) = state::CloudStore::open() {
134 workers::register::on_session_end(&store);
135 }
136 },
137 },
138 );
139}
140
141pub use lean_ctx::core::cloud_gate::{
143 CLOUD_AVAILABLE, CLOUD_TOOLS, NOT_AVAILABLE, PREVIEW_ENV, TOOL_NOT_AVAILABLE, available_for,
144 available_locally, is_loopback,
145};
146
147#[cfg(test)]
148mod availability_tests {
149 #[test]
150 fn the_preview_never_opens_a_real_cloud() {
151 assert!(!super::is_loopback("https://cloud.leanctx.com"));
153 assert!(!super::is_loopback("https://127.0.0.1.example.com"));
154 assert!(super::is_loopback("http://127.0.0.1:4100"));
155 assert!(super::is_loopback("http://[::1]:4100"));
156 assert!(super::is_loopback("http://localhost"));
157 assert_eq!(
158 super::available_for("https://cloud.leanctx.com"),
159 super::CLOUD_AVAILABLE
160 );
161 }
162}