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
66 changes: 56 additions & 10 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion crates/aingle_ai/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aingle_ai"
version = "0.3.7"
version = "0.3.8"
description = "AI integration layer for AIngle - Titans Memory, Nested Learning, HOPE Agents"
license = "Apache-2.0"
repository = "https://github.com/ApiliumCode/aingle"
Expand Down
2 changes: 1 addition & 1 deletion crates/aingle_contracts/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aingle_contracts"
version = "0.3.7"
version = "0.3.8"
description = "Smart Contracts DSL and WASM Runtime for AIngle"
license = "Apache-2.0"
repository = "https://github.com/ApiliumCode/aingle"
Expand Down
14 changes: 13 additions & 1 deletion crates/aingle_cortex/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aingle_cortex"
version = "0.3.7"
version = "0.3.8"
description = "Córtex API - REST/GraphQL/SPARQL interface for AIngle semantic graphs"
license = "Apache-2.0"
repository = "https://github.com/ApiliumCode/aingle"
Expand All @@ -18,6 +18,8 @@ rest = []
graphql = ["dep:async-graphql", "dep:async-graphql-axum"]
sparql = ["dep:spargebra"]
auth = ["dep:jsonwebtoken", "dep:argon2"]
p2p = ["dep:quinn", "dep:rustls", "dep:rcgen", "dep:ed25519-dalek", "dep:hex", "dep:dirs"]
p2p-mdns = ["p2p", "dep:mdns-sd", "dep:if-addrs"]
full = ["rest", "graphql", "sparql", "auth"]

[[bin]]
Expand Down Expand Up @@ -84,6 +86,16 @@ reqwest = { version = "0.12", default-features = false, features = ["json", "rus
dashmap = "6.0"
once_cell = "1.4"

# P2P networking (optional)
quinn = { version = "0.11", optional = true }
rustls = { version = "0.23", default-features = false, features = ["ring", "std"], optional = true }
rcgen = { version = "0.13", optional = true }
ed25519-dalek = { version = "2", features = ["rand_core"], optional = true }
hex = { version = "0.4", optional = true }
dirs = { version = "6", optional = true }
mdns-sd = { version = "0.18", optional = true }
if-addrs = { version = "0.13", optional = true }

[dev-dependencies]
tempfile = "3.26"
reqwest = { version = "0.12", features = ["json"] }
Expand Down
2 changes: 2 additions & 0 deletions crates/aingle_cortex/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ pub mod server;
#[cfg(feature = "sparql")]
pub mod sparql;
pub mod state;
#[cfg(feature = "p2p")]
pub mod p2p;

pub use client::{CortexClientConfig, CortexInternalClient};
pub use error::{Error, Result};
Expand Down
42 changes: 41 additions & 1 deletion crates/aingle_cortex/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,40 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
i += 1;
}

// Parse P2P flags (feature-gated at compile time).
#[cfg(feature = "p2p")]
let p2p_config = {
let p2p = aingle_cortex::p2p::config::P2pConfig::from_args(&args);
if let Err(e) = p2p.validate() {
eprintln!("Invalid P2P config: {}", e);
std::process::exit(1);
}
p2p
};

// Create and run server
let server = CortexServer::new(config)?;
#[allow(unused_mut)]
let mut server = CortexServer::new(config)?;

// Start P2P manager if enabled.
#[cfg(feature = "p2p")]
if p2p_config.enabled {
match aingle_cortex::p2p::manager::P2pManager::start(
p2p_config.clone(),
server.state().clone(),
)
.await
{
Ok(manager) => {
// SAFETY: we have exclusive access before serving.
server.state_mut().p2p = Some(manager);
tracing::info!("P2P manager started on port {}", p2p_config.port);
}
Err(e) => {
tracing::error!("P2P manager failed to start: {}", e);
}
}
}

// Set up graceful shutdown
let shutdown_signal = async {
Expand Down Expand Up @@ -84,9 +116,17 @@ fn print_help() {
println!(" -V, --version Print version and exit");
println!(" --help Print this help message");
println!();
println!("P2P OPTIONS (requires --features p2p):");
println!(" --p2p Enable P2P triple synchronization");
println!(" --p2p-port <PORT> QUIC listen port (default: 19091)");
println!(" --p2p-seed <SEED> Network isolation seed");
println!(" --p2p-peer <ADDR> Manual peer address (repeatable)");
println!(" --p2p-mdns Enable mDNS discovery");
println!();
println!("ENDPOINTS:");
println!(" REST API: http://<host>:<port>/api/v1/");
println!(" GraphQL: http://<host>:<port>/graphql");
println!(" SPARQL: http://<host>:<port>/sparql");
println!(" Health: http://<host>:<port>/api/v1/health");
println!(" P2P Status: http://<host>:<port>/api/v1/p2p/status");
}
Loading
Loading