Skip to content

Commit facce2f

Browse files
Merge pull request #58 from ApiliumCode/dev
Release v0.3.8 — Kitsune P2P Phase 2
2 parents a57e174 + d2f381c commit facce2f

28 files changed

Lines changed: 4402 additions & 23 deletions

File tree

Cargo.lock

Lines changed: 56 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/aingle_ai/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "aingle_ai"
3-
version = "0.3.7"
3+
version = "0.3.8"
44
description = "AI integration layer for AIngle - Titans Memory, Nested Learning, HOPE Agents"
55
license = "Apache-2.0"
66
repository = "https://github.com/ApiliumCode/aingle"

crates/aingle_contracts/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "aingle_contracts"
3-
version = "0.3.7"
3+
version = "0.3.8"
44
description = "Smart Contracts DSL and WASM Runtime for AIngle"
55
license = "Apache-2.0"
66
repository = "https://github.com/ApiliumCode/aingle"

crates/aingle_cortex/Cargo.toml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "aingle_cortex"
3-
version = "0.3.7"
3+
version = "0.3.8"
44
description = "Córtex API - REST/GraphQL/SPARQL interface for AIngle semantic graphs"
55
license = "Apache-2.0"
66
repository = "https://github.com/ApiliumCode/aingle"
@@ -18,6 +18,8 @@ rest = []
1818
graphql = ["dep:async-graphql", "dep:async-graphql-axum"]
1919
sparql = ["dep:spargebra"]
2020
auth = ["dep:jsonwebtoken", "dep:argon2"]
21+
p2p = ["dep:quinn", "dep:rustls", "dep:rcgen", "dep:ed25519-dalek", "dep:hex", "dep:dirs"]
22+
p2p-mdns = ["p2p", "dep:mdns-sd", "dep:if-addrs"]
2123
full = ["rest", "graphql", "sparql", "auth"]
2224

2325
[[bin]]
@@ -84,6 +86,16 @@ reqwest = { version = "0.12", default-features = false, features = ["json", "rus
8486
dashmap = "6.0"
8587
once_cell = "1.4"
8688

89+
# P2P networking (optional)
90+
quinn = { version = "0.11", optional = true }
91+
rustls = { version = "0.23", default-features = false, features = ["ring", "std"], optional = true }
92+
rcgen = { version = "0.13", optional = true }
93+
ed25519-dalek = { version = "2", features = ["rand_core"], optional = true }
94+
hex = { version = "0.4", optional = true }
95+
dirs = { version = "6", optional = true }
96+
mdns-sd = { version = "0.18", optional = true }
97+
if-addrs = { version = "0.13", optional = true }
98+
8799
[dev-dependencies]
88100
tempfile = "3.26"
89101
reqwest = { version = "0.12", features = ["json"] }

crates/aingle_cortex/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ pub mod server;
172172
#[cfg(feature = "sparql")]
173173
pub mod sparql;
174174
pub mod state;
175+
#[cfg(feature = "p2p")]
176+
pub mod p2p;
175177

176178
pub use client::{CortexClientConfig, CortexInternalClient};
177179
pub use error::{Error, Result};

crates/aingle_cortex/src/main.rs

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,40 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
5555
i += 1;
5656
}
5757

58+
// Parse P2P flags (feature-gated at compile time).
59+
#[cfg(feature = "p2p")]
60+
let p2p_config = {
61+
let p2p = aingle_cortex::p2p::config::P2pConfig::from_args(&args);
62+
if let Err(e) = p2p.validate() {
63+
eprintln!("Invalid P2P config: {}", e);
64+
std::process::exit(1);
65+
}
66+
p2p
67+
};
68+
5869
// Create and run server
59-
let server = CortexServer::new(config)?;
70+
#[allow(unused_mut)]
71+
let mut server = CortexServer::new(config)?;
72+
73+
// Start P2P manager if enabled.
74+
#[cfg(feature = "p2p")]
75+
if p2p_config.enabled {
76+
match aingle_cortex::p2p::manager::P2pManager::start(
77+
p2p_config.clone(),
78+
server.state().clone(),
79+
)
80+
.await
81+
{
82+
Ok(manager) => {
83+
// SAFETY: we have exclusive access before serving.
84+
server.state_mut().p2p = Some(manager);
85+
tracing::info!("P2P manager started on port {}", p2p_config.port);
86+
}
87+
Err(e) => {
88+
tracing::error!("P2P manager failed to start: {}", e);
89+
}
90+
}
91+
}
6092

6193
// Set up graceful shutdown
6294
let shutdown_signal = async {
@@ -84,9 +116,17 @@ fn print_help() {
84116
println!(" -V, --version Print version and exit");
85117
println!(" --help Print this help message");
86118
println!();
119+
println!("P2P OPTIONS (requires --features p2p):");
120+
println!(" --p2p Enable P2P triple synchronization");
121+
println!(" --p2p-port <PORT> QUIC listen port (default: 19091)");
122+
println!(" --p2p-seed <SEED> Network isolation seed");
123+
println!(" --p2p-peer <ADDR> Manual peer address (repeatable)");
124+
println!(" --p2p-mdns Enable mDNS discovery");
125+
println!();
87126
println!("ENDPOINTS:");
88127
println!(" REST API: http://<host>:<port>/api/v1/");
89128
println!(" GraphQL: http://<host>:<port>/graphql");
90129
println!(" SPARQL: http://<host>:<port>/sparql");
91130
println!(" Health: http://<host>:<port>/api/v1/health");
131+
println!(" P2P Status: http://<host>:<port>/api/v1/p2p/status");
92132
}

0 commit comments

Comments
 (0)