Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions host/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 0 additions & 18 deletions host/conductora/src/map_commands/all_spaces.rs

This file was deleted.

28 changes: 0 additions & 28 deletions host/conductora/src/map_commands/debug_serde.rs

This file was deleted.

102 changes: 0 additions & 102 deletions host/conductora/src/map_commands/map_request.rs

This file was deleted.

8 changes: 0 additions & 8 deletions host/conductora/src/map_commands/mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
pub mod all_spaces;
pub mod root_space;
pub mod serde_test;
pub mod map_request;
pub mod status;
pub mod debug_serde;

pub(crate) use root_space::*;
pub(crate) use all_spaces::*;
pub(crate) use status::*;
pub(crate) use serde_test::*;
pub(crate) use map_request::*;

17 changes: 0 additions & 17 deletions host/conductora/src/map_commands/root_space.rs

This file was deleted.

20 changes: 9 additions & 11 deletions host/conductora/src/map_commands/serde_test.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

use holons_client::shared_types::map_request::MapRequestWire;
use tauri::{command };
use map_commands::wire::MapIpcRequest;
use tauri::command;

#[command]
pub async fn serde_test(
Expand All @@ -21,8 +20,7 @@ pub async fn serde_test(
}
}

//HERE add the type you want to check against in the from_str<>
match serde_json::from_str::<MapRequestWire>(&request_json) {
match serde_json::from_str::<MapIpcRequest>(&request_json) {
Ok(request) => {
tracing::info!("[TEST] Successfully parsed: {:?}", request);
Ok("Parsed successfully".to_string())
Expand Down Expand Up @@ -57,20 +55,20 @@ pub async fn serde_test(
.nth(1)
.and_then(|s| s.split('`').next())
.unwrap_or("unknown");
format!("\n🔍 Missing field: `{}`", field_name)
format!("\nMissing field: `{}`", field_name)
} else if error_string.contains("invalid type") {
format!(
"\n🔍 Type mismatch - check field types match between TypeScript and Rust"
"\nType mismatch - check field types match between TypeScript and Rust"
)
} else {
String::new()
};

let error_msg = format!(
"Parse error at position {} (line {}, column {}):\n\
📋 Error: {}\n\
🏷️ Type: {}{}\n\
📍 Context around column {}:\n{}",
Error: {}\n\
Type: {}{}\n\
Context around column {}:\n{}",
column, line, column, e, classification, path_hint, column, error_snippet
);

Expand All @@ -82,5 +80,5 @@ pub async fn serde_test(
Err(short_error)
}
}

}
15 changes: 3 additions & 12 deletions host/conductora/src/map_commands/status.rs
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@
use crate::runtime::RuntimeState;
use holons_receptor::ReceptorFactory;
use tauri::{command, State};

#[command]
pub async fn is_service_ready(
receptor_factory: State<'_, ReceptorFactory>,
runtime_state: State<'_, RuntimeState>,
) -> Result<bool, String> {
tracing::debug!("[TAURI COMMAND] 'is_service_ready' command invoked");

let receptors_loaded = receptor_factory.are_receptors_loaded();
let runtime_ready = runtime_state
let is_ready = runtime_state
.read()
.map(|guard| guard.is_some())
.unwrap_or(false);

let is_ready = receptors_loaded && runtime_ready;
tracing::debug!(
"Service ready: {} (receptors={}, runtime={})",
is_ready,
receptors_loaded,
runtime_ready,
);
tracing::debug!("Service ready: {}", is_ready);

Ok(is_ready)
}
}
32 changes: 1 addition & 31 deletions host/conductora/src/setup/app_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ use crate::{
app_config::load_storage_config, providers::holochain::holochain_plugin, storage_config::{StorageConfig, StorageProvider}
},
setup::{
holochain_setup::{ConductorClientState, HolochainSetup, HolochainWindowSetup}, local_setup::LocalSetup, window_setup::DefaultWindowSetup},
holochain_setup::{ConductorClientState, HolochainSetup, HolochainWindowSetup}, window_setup::DefaultWindowSetup},
};

use crate::setup::window_setup::ProviderWindowSetup;
use crate::setup::receptor_config_registry::ReceptorConfigRegistry;
use holons_client::init_client_runtime;
use holons_trust_channel::TrustChannel;
use map_commands::dispatch::{Runtime, RuntimeSession};
use holons_receptor::ReceptorFactory;
use tauri::{AppHandle, Manager, Listener};

pub struct AppBuilder;
Expand All @@ -29,16 +27,10 @@ impl AppBuilder {
// Base builder without setup
let base = tauri::Builder::default()
.manage(storage_cfg.clone())
.manage(ReceptorFactory::new())
.manage(ReceptorConfigRegistry::new())
.manage::<ConductorClientState>(RwLock::new(None))
.manage::<runtime::RuntimeState>(RwLock::new(None))
.invoke_handler(tauri::generate_handler![
commands::root_space,
//commands::load_holons,
commands::serde_test,
commands::map_request,
commands::all_spaces,
commands::is_service_ready,
runtime::dispatch_map_command::dispatch_map_command,
]);
Expand Down Expand Up @@ -87,12 +79,6 @@ impl AppBuilder {
tracing::error!("[APP BUILDER] Provider setup failed: {}", e);
}

// Load receptor configs into factory
if let Err(e) = Self::load_receptor_configs(handle).await {
tracing::error!("[APP BUILDER] Failed to load receptor configs: {}", e);
return;
}

// Construct the MAP Commands Runtime (if conductor client is available)
Self::initialize_runtime(handle);

Expand All @@ -105,18 +91,6 @@ impl AppBuilder {
tracing::info!("[APP BUILDER] Setup completed successfully.");
}

/// Load receptor configs from registry into factory
async fn load_receptor_configs(handle: &AppHandle) -> Result<(), Box<dyn std::error::Error>> {
if let Some(registry) = handle.try_state::<ReceptorConfigRegistry>() {
let configs = registry.all();
if let Some(factory) = handle.try_state::<ReceptorFactory>() {
factory.load_from_configs(configs).await?;
tracing::debug!("[APP BUILDER] ReceptorFactory loaded from configs.");
}
}
Ok(())
}

/// Apply provider-specific plugins based on the storage configuration
fn apply_plugins(
mut builder: tauri::Builder<tauri::Wry>,
Expand Down Expand Up @@ -163,10 +137,6 @@ impl AppBuilder {

for (_name, provider) in storage_cfg.get_enabled_providers() {
match provider.provider_type() {
"local" => {
tracing::info!("[APP BUILDER] Running Local storage setup");
LocalSetup::setup(handle.clone(), provider).await?;
}
"holochain" => {
tracing::info!("[APP BUILDER] Running Holochain setup");
HolochainSetup::setup(handle.clone(), provider).await?;
Expand Down
Loading
Loading