Skip to content
Merged
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
722 changes: 347 additions & 375 deletions Cargo.lock

Large diffs are not rendered by default.

1,189 changes: 670 additions & 519 deletions host/Cargo.lock

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions host/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ resolver = "2"
members = [
"conductora",
"crates/holons_client",
"crates/holochain_receptor",
"crates/recovery_receptor",
"crates/holons_receptor",
"crates/deprecated_holochain_receptor",
#"crates/local_receptors",
"crates/holons_loader_client",
"crates/recovery_receptor",
"crates/shared_types",
"conductora/plugins/tauri-plugin-holochain"
, "crates/map_commands"]

Expand Down Expand Up @@ -42,8 +43,10 @@ url2 = "0.0.6"

# Internal crate paths (optional for IDE support)
holons_client = { path = "crates/holons_client" }
holons_receptor = { path = "crates/holons_receptor" }
holochain_receptor = { path = "crates/holochain_receptor" }
#local_receptors = { path = "crates/local_receptors" }
deprecated_holochain_receptor = { path = "crates/deprecated_holochain_receptor" }
holons_loader_client = { path = "crates/holons_loader_client" }
holons_recovery = { path = "crates/holons_recovery" }
client_shared_types = { path = "crates/shared_types" }
tauri-plugin-holochain = { path = "conductora/plugins/tauri-plugin-holochain" }
recovery_receptor = { path = "crates/recovery_receptor" }
6 changes: 2 additions & 4 deletions host/conductora/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ tracing-subscriber = { version = "0.3", features = ["fmt", "env-filter", "ansi",

#map dependencies
holons_client = { path = "../crates/holons_client" }
holons_receptor = { path = "../crates/holons_receptor" }
#client_shared_types = { path = "../crates/shared_types" } //next PR
#deprecated_holochain_receptor = { path = "../crates/deprecated_holochain_receptor" } // next PR
holochain_receptor = { path = "../crates/holochain_receptor" }
client_shared_types = { path = "../crates/shared_types" }
deprecated_holochain_receptor = { path = "../crates/deprecated_holochain_receptor" }
recovery_receptor = { path = "../crates/recovery_receptor" }
holons_core = { workspace = true }
holons_trust_channel = { path = "../../shared_crates/holons_trust_channel" }
Expand Down
2 changes: 1 addition & 1 deletion host/conductora/src/config/providers/holochain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub struct HolochainConfig {
#[serde(default)]
pub production: bool,
}

//todo: add common functions
impl ProviderConfig for HolochainConfig {}

pub struct HolochainSelector;
Expand Down
2 changes: 1 addition & 1 deletion host/conductora/src/config/storage.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"compression": false,
"encryption": false,
"features": ["recovery"],
"enabled": false
"enabled": true
},
"local_secure": {
"type": "local",
Expand Down
7 changes: 3 additions & 4 deletions host/conductora/src/map_commands/all_spaces.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

use holons_client::shared_types::holon_space::SpaceInfo;
use holons_receptor::ReceptorFactory;
use client_shared_types::{base_receptor::ReceptorType, holon_space::SpaceInfo};
use holons_client::receptor_factory::{ReceptorFactory};
use tauri::{command, State};


Expand All @@ -11,8 +11,7 @@ pub async fn all_spaces (

tracing::debug!("[TAURI COMMAND] 'all_spaces' command invoked");

let spaces = receptor_factory.all_spaces_by_type("holochain")
.await
let spaces = receptor_factory.all_spaces_by_type(&ReceptorType::Holochain).await
.map_err(|e| format!("receptor service error: {:?}", e))?;
Ok(spaces)
}
2 changes: 1 addition & 1 deletion host/conductora/src/map_commands/debug_serde.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use holons_client::shared_types::map_request::MapRequestWire;
use client_shared_types::map_request::MapRequestWire;
use tauri::command;

// Add this temporary command to see the raw JSON
Expand Down
11 changes: 5 additions & 6 deletions host/conductora/src/map_commands/map_request.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

use holons_receptor::factory::ReceptorFactory;
use holons_client::shared_types::map_request::MapRequestWire;
use holons_client::shared_types::map_response::MapResponseWire;
use holons_client::receptor_factory::ReceptorFactory;
use client_shared_types::{base_receptor::ReceptorType, map_request::MapRequestWire};
use client_shared_types::map_response::MapResponseWire;
use tauri::{command, State};
use core_types::HolonError;

Expand All @@ -13,8 +12,8 @@ pub async fn map_request(

tracing::debug!("[TAURI COMMAND] 'map_request' command invoked for space: {:?}", map_request);
// a map_request is currently using "holochain" receptor type only
let receptor = receptor_factory.get_receptor_by_type("holochain");
let context = receptor.transaction_context();
let receptor = receptor_factory.get_default_receptor_by_type(&ReceptorType::Holochain)?;
let context = receptor.transaction_context()?;
let bound_request = map_request.bind(&context)?;

receptor
Expand Down
20 changes: 10 additions & 10 deletions host/conductora/src/map_commands/root_space.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@

use holons_client::shared_types::holon_space::SpaceInfo;
use holons_receptor::ReceptorFactory;
use client_shared_types::holon_space::SpaceInfo;
use holons_client::receptor_factory::ReceptorFactory;
use tauri::{command, State};


#[command]
pub async fn root_space (
receptor_factory: State<'_, ReceptorFactory>,
_receptor_factory: State<'_, ReceptorFactory>,
) -> Result<SpaceInfo, String> {
unimplemented!("This command is currently a placeholder and needs to be implemented to fetch the root space information from the appropriate receptor.");

tracing::debug!("[TAURI COMMAND] 'root_space' command invoked");
let spaces = receptor_factory.all_spaces_by_type("local")
.await
.map_err(|e| format!("receptor service error: {:?}", e))?;
Ok(spaces)
}
//tracing::debug!("[TAURI COMMAND] 'root_space' command invoked");
//let spaces = receptor_factory.all_spaces_by_type(&ReceptorType::Local)
// .await
// .map_err(|e| format!("receptor service error: {:?}", e))?;
//Ok(spaces)
}
2 changes: 1 addition & 1 deletion host/conductora/src/map_commands/serde_test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

use holons_client::shared_types::map_request::MapRequestWire;
use client_shared_types::map_request::MapRequestWire;
use tauri::{command };

#[command]
Expand Down
2 changes: 1 addition & 1 deletion host/conductora/src/map_commands/status.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::runtime::RuntimeState;
use holons_receptor::ReceptorFactory;
use holons_client::receptor_factory::ReceptorFactory;
use tauri::{command, State};

#[command]
Expand Down
48 changes: 43 additions & 5 deletions host/conductora/src/runtime/init_runtime.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
use std::sync::Arc;

use client_shared_types::ReceptorType;
use holons_client::{ClientSession, Receptor, receptor_factory};
use tauri::{AppHandle, Manager};

use crate::runtime::RuntimeState;
use holons_client::init_client_runtime;
use holons_client::{init_client_runtime};
use map_commands::dispatch::{Runtime, RuntimeSession};

/// Stored by providers (e.g. Holochain) and consumed by runtime init.
Expand All @@ -23,15 +25,51 @@ pub fn init_from_state(handle: &AppHandle) -> bool {
};

let space_manager = init_client_runtime(Some(initiator));

let recovery_receptor = get_recovery_receptor_from_factory(handle);

let _client_session = ClientSession::new(space_manager.clone(), recovery_receptor, None);

//TODO: use the client_session

let session = Arc::new(RuntimeSession::new(space_manager));


let runtime = Runtime::new(session);

if let Some(state) = handle.try_state::<RuntimeState>() {
let mut guard = state.write().expect("RuntimeState lock poisoned");
*guard = Some(runtime);
tracing::info!("[RUNTIME] MAP Commands Runtime initialized.");
return true;
match state.write() {
Ok(mut guard) => {
*guard = Some(runtime);
tracing::info!("[RUNTIME] MAP Commands Runtime initialized.");
return true;
}
Err(err) => {
tracing::error!("[RUNTIME] Failed to acquire RuntimeState lock: {}", err);
return false;
}
}
}

false
}

fn get_recovery_receptor_from_factory(handle: &AppHandle) -> Option<Arc<Receptor>> {
handle.try_state::<receptor_factory::ReceptorFactory>()
.and_then(|factory| {
match factory.get_default_receptor_by_type(&ReceptorType::LocalRecovery) {
Ok(receptor) => {
tracing::info!("[RUNTIME] Local recovery receptor found.");
return Some(receptor)
}
Err(err) => {
tracing::warn!(
"[RUNTIME] Local recovery receptor unavailable ({}); recovery features disabled.",
err
);
return None
}
}
});
None
}
2 changes: 1 addition & 1 deletion host/conductora/src/setup/app_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::{
setup_manager::SetupManager,
},
};
use holons_receptor::ReceptorFactory;
use holons_client::receptor_factory::ReceptorFactory;

pub struct AppBuilder;

Expand Down
2 changes: 1 addition & 1 deletion host/conductora/src/setup/common_setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
config::providers::ProviderConfig,
setup::receptor_config_registry::ReceptorConfigRegistry,
};
use holons_client::shared_types::base_receptor::BaseReceptor;
use client_shared_types::base_receptor::BaseReceptor;
use tauri::{AppHandle, Manager};


Expand Down
6 changes: 2 additions & 4 deletions host/conductora/src/setup/providers/holochain/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ use crate::config::providers::holochain::{CellDetail, HolochainConfig};
use crate::config::StorageProvider;
use crate::runtime::RuntimeInitiatorState;
use crate::setup::providers::holochain::plugins::{hc_dev_mode_enabled};
//use client_shared_types::base_receptor::{BaseReceptor, ReceptorType};
use holons_client::shared_types::base_receptor::{BaseReceptor, ReceptorType};
use client_shared_types::base_receptor::{BaseReceptor, ReceptorType};
use holons_trust_channel::TrustChannel;
use tauri::{AppHandle, Manager, Theme};
use holochain_client::{AdminWebsocket, AppWebsocket, AppInfo};
//use deprecated_holochain_receptor::HolochainConductorClient;
use holochain_receptor::HolochainConductorClient;
use deprecated_holochain_receptor::HolochainConductorClient;
use tauri_plugin_holochain::{HolochainExt, AppBundle};
use async_trait::async_trait;
use crate::setup::window_setup::ProviderWindowSetup;
Expand Down
3 changes: 1 addition & 2 deletions host/conductora/src/setup/providers/local/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ use crate::config::providers::ProviderConfig;
use crate::config::providers::local::LocalConfig;
use crate::config::StorageProvider;
use crate::setup::common_setup::{register_receptor, serialize_props};
//use client_shared_types::base_receptor::{BaseReceptor, ReceptorType};
use holons_client::shared_types::base_receptor::{BaseReceptor, ReceptorType};
use client_shared_types::base_receptor::{BaseReceptor, ReceptorType};
use recovery_receptor::{RecoveryStore, TransactionRecoveryStore};
use tauri::{AppHandle, Manager};

Expand Down
3 changes: 1 addition & 2 deletions host/conductora/src/setup/receptor_config_registry.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//use client_shared_types::base_receptor::{BaseReceptor};//, ReceptorType};
use holons_client::shared_types::base_receptor::{BaseReceptor};
use client_shared_types::base_receptor::{BaseReceptor};//, ReceptorType};
use std::sync::Mutex;

/// Registry for collecting `ReceptorConfig` entries from different setup modules
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "holochain_receptor"
name = "deprecated_holochain_receptor"
version = "0.1.0"
edition = "2021"
#edition = "2024"
Expand All @@ -8,6 +8,8 @@ edition = "2021"
tracing = "0.1"
serde_bytes = "*"
async-trait = "0.1"
futures-executor = "0.3"
tokio = { version = "1", features = ["rt", "rt-multi-thread"] }

#holochain dependencies
holochain_client = { version = "0.7.1" }
Expand All @@ -16,9 +18,12 @@ holochain_types = "0.5"
#map dependencies
holons_core = { path = "../../../shared_crates/holons_core" }
holons_boundary = { path = "../../../shared_crates/holons_boundary" }
holons_client = { path = "../holons_client" }
#holons_client = { path = "../holons_client" }
client_shared_types = { path = "../shared_types" }
integrity_core_types = { path = "../../../shared_crates/type_system/integrity_core_types" }
holons_trust_channel = { path = "../../../shared_crates/holons_trust_channel" }
holons_loader_client = { path = "../holons_loader_client" }
core_types = { path = "../../../shared_crates/type_system/core_types" }
base_types = { path = "../../../shared_crates/type_system/base_types" }
type_names = { path = "../../../shared_crates/type_system/type_names" }
holon_dance_builders = { path = "../../../shared_crates/holon_dance_builders" }
47 changes: 47 additions & 0 deletions host/crates/deprecated_holochain_receptor/src/client_context.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
use crate::client_shared_objects::ClientHolonService;

use holons_core::core_shared_objects::space_manager::HolonSpaceManager;
use holons_core::core_shared_objects::transactions::TransactionContext;
use holons_core::core_shared_objects::ServiceRoutingPolicy;

use holons_core::dances::DanceInitiator;
use holons_core::reference_layer::HolonServiceApi;

use std::sync::Arc;

/// Initializes a new client-side context with a fresh `HolonSpaceManager` and
/// an implicit default transaction.
///
/// This function sets up:
/// - A default `HolonServiceApi` implementation (`ClientHolonService`).
/// - A space manager configured with client-specific routing policies.
/// - An implicit transaction opened via the per-space `TransactionManager`.
/// - Injects the optional `DanceInitiator` for conductor calls.
///
/// # Returns
/// * An `Arc<TransactionContext>` backed by a `TransactionContext`.
pub fn init_client_context(initiator: Option<Arc<dyn DanceInitiator>>) -> Arc<TransactionContext> {
let space_manager = init_client_runtime(initiator);

// Open the default transaction for this space.
// TransactionContext becomes the sole execution root and owns the space.
space_manager
.get_transaction_manager()
.open_new_transaction(Arc::clone(&space_manager))
.expect("failed to open default client transaction")
}

/// Initializes a new client-side `HolonSpaceManager` without opening a transaction.
///
/// Same construction as `init_client_context()` but returns the space manager
/// directly, leaving transaction lifecycle to the caller (e.g., `RuntimeSession`).
pub fn init_client_runtime(initiator: Option<Arc<dyn DanceInitiator>>) -> Arc<HolonSpaceManager> {
let holon_service: Arc<dyn HolonServiceApi> = Arc::new(ClientHolonService);

Arc::new(HolonSpaceManager::new_with_managers(
initiator,
holon_service,
None,
ServiceRoutingPolicy::Combined,
))
}
Loading
Loading