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