aien-sovereign-core-mv
AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.
Brought by drakestapleton
aien-sovereign-core-mv / crates / spark-discord-hub / src / main.rs
| 1 | // SPDX-License-Identifier: Apache-2.0 |
| 2 | // Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | |
| 16 | use clap::Parser; |
| 17 | use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt}; |
| 18 | |
| 19 | mod atlas_bot; |
| 20 | mod gateway; |
| 21 | mod gideon_bot; |
| 22 | mod models; |
| 23 | mod vault; |
| 24 | |
| 25 | use gateway::DiscordGatewayHub; |
| 26 | use vault::get_vault_secret; |
| 27 | |
| 28 | #[derive(Parser, Debug)] |
| 29 | #[command( |
| 30 | name = "spark-discord-hub", |
| 31 | about = "Sovereign Native Multi-Bot Discord Hub in Rust" |
| 32 | )] |
| 33 | struct Cli { |
| 34 | #[arg(long)] |
| 35 | token: Option<String>, |
| 36 | } |
| 37 | |
| 38 | #[tokio::main] |
| 39 | async fn main() -> Result<(), Box<dyn std::error::Error>> { |
| 40 | tracing_subscriber::registry() |
| 41 | .with( |
| 42 | tracing_subscriber::EnvFilter::try_from_default_env().unwrap_or_else(|_| "info".into()), |
| 43 | ) |
| 44 | .with(tracing_subscriber::fmt::layer()) |
| 45 | .init(); |
| 46 | |
| 47 | let cli = Cli::parse(); |
| 48 | |
| 49 | tracing::info!("Initializing SparkOS Discord Multi-Bot Hub..."); |
| 50 | |
| 51 | // Dynamic resolution from TPM vault |
| 52 | let token = cli |
| 53 | .token |
| 54 | .or_else(|| get_vault_secret("DISCORD_BOT_TOKEN")) |
| 55 | .or_else(|| get_vault_secret("DISCORD_ATLAS_TOKEN")); |
| 56 | |
| 57 | let token = match token { |
| 58 | Some(t) if !t.is_empty() => t, |
| 59 | _ => { |
| 60 | tracing::error!( |
| 61 | "No Discord bot token found in atlas-vault (DISCORD_BOT_TOKEN). Exiting." |
| 62 | ); |
| 63 | std::process::exit(1); |
| 64 | } |
| 65 | }; |
| 66 | |
| 67 | tracing::info!( |
| 68 | "Discord bot token dynamically resolved from TPM vault. Starting gateway hub..." |
| 69 | ); |
| 70 | |
| 71 | let hub = DiscordGatewayHub::new(token); |
| 72 | hub.run().await?; |
| 73 | |
| 74 | Ok(()) |
| 75 | } |