interplane.Get Omega
Read in your language

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

GitHub aien-dev/aien-sovereign-core-mv#87 (code only)

closed derived d5a676fa0de92d54 #87

Imported from GitHub aien-dev/aien-sovereign-core-mv#87 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base 97d24e188522ff3662d609384c986a9f84726547 · Head 0fa4dedd4585e57d34c79bd3010f80794c3bc097

Apply it

git checkout -b patch-d5a676fa0de92d54 97d24e188522ff3662d609384c986a9f84726547
curl -fsSL https://interplane.io/drakestapleton/aien-sovereign-core-mv/patches/d5a676fa0de92d54.patch | git am

Raw patch (mbox) · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/aien-sovereign-core-mv
87
0fa4dedd4585e57d34c79bd3010f80794c3bc097
{"kind":"github-import","owner":"aien-dev","repo":"aien-sovereign-core-mv","number":87,"url":"https://github.com/aien-dev/aien-sovereign-core-mv/pull/87","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:38:10Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/crates/aien-cli/src/client.rs b/crates/aien-cli/src/client.rs
index fbe8cf7b..c5980976 100644
--- a/crates/aien-cli/src/client.rs
+++ b/crates/aien-cli/src/client.rs
@@ -8,6 +8,73 @@ use std::time::Duration;
 pub const DEFAULT_ENDPOINT: &str = "http://127.0.0.1:18006/v1/chat/completions";
 pub const DEFAULT_MODEL: &str = "atlas-lightning-omni";
 
+/// Explicit chat execution path. Native runtime is canonical.
+/// The 18006 HTTP service remains only as a compatibility adapter.
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub enum ChatBackend {
+    NativeRuntime,
+    RemoteAdapter(String),
+}
+
+pub fn resolve_chat_backend() -> ChatBackend {
+    if let Ok(mode) = std::env::var("AIEN_CHAT_BACKEND") {
+        let mode = mode.trim().to_lowercase();
+        if mode == "remote" {
+            let ep = std::env::var("AIEN_MODEL_ENDPOINT")
+                .ok()
+                .filter(|s| !s.trim().is_empty())
+                .unwrap_or_else(|| DEFAULT_ENDPOINT.to_string());
+            return ChatBackend::RemoteAdapter(ep);
+        }
+        if mode == "native" {
+            return ChatBackend::NativeRuntime;
+        }
+    }
+    let sock = aien_runtime::client::AienRuntimeClient::default_socket_path();
+    if sock.exists() {
+        ChatBackend::NativeRuntime
+    } else {
+        ChatBackend::RemoteAdapter(
+            std::env::var("AIEN_MODEL_ENDPOINT")
+                .ok()
+                .filter(|s| !s.trim().is_empty())
+                .unwrap_or_else(|| DEFAULT_ENDPOINT.to_string()),
+        )
+    }
+}
+
+pub fn describe_chat_backend(backend: &ChatBackend) -> String {
+    match backend {
+        ChatBackend::NativeRuntime => "native runtime (canonical)".to_string(),
+        ChatBackend::RemoteAdapter(ep) => format!("remote adapter (compatibility): {}", ep),
+    }
+}
+
+/// Structured per request telemetry. A benchmark or test is only evidence of
+/// the native runtime when path is native_runtime. Adapter traffic must never
+/// be mistaken for native success.
+pub fn emit_chat_telemetry(backend: &ChatBackend, model: &str) {
+    let (path, endpoint) = match backend {
+        ChatBackend::NativeRuntime => ("native_runtime", ""),
+        ChatBackend::RemoteAdapter(ep) => ("remote_adapter", ep.as_str()),
+    };
+    let runtime_socket_present =
+        aien_runtime::client::AienRuntimeClient::default_socket_path().exists();
+    let require_blackwell = std::env::var("AIEN_REQUIRE_BLACKWELL")
+        .map(|v| v.trim() == "1" || v.trim().eq_ignore_ascii_case("true"))
+        .unwrap_or(false);
+    let record = serde_json::json!({
+        "event": "chat_path",
+        "path": path,
+        "backend": describe_chat_backend(backend),
+        "endpoint": endpoint,
+        "model": model,
+        "runtime_socket_present": runtime_socket_present,
+        "require_blackwell": require_blackwell,
+    });
+    eprintln!("{}", record);
+}
+
 pub fn get_system_prompt() -> String {
     let mut p = String::from("You are AIEN. Drake is the operator. This Spark desk is ours.\n");
     p.push_str("You are an autonomous operator-builder running on NVIDIA DGX Spark Grace Blackwell GB10 hardware.\n");
@@ -91,16 +158,23 @@ pub struct ChatClient {
     client: Client,
     endpoint: String,
     model: String,
+    backend: ChatBackend,
 }
 
 impl ChatClient {
     pub fn new(endpoint: Option<String>, model: Option<String>) -> Self {
+        let explicit_endpoint = endpoint.is_some();
         let ep = endpoint
             .or_else(|| std::env::var("AIEN_MODEL_ENDPOINT").ok())
             .unwrap_or_else(|| DEFAULT_ENDPOINT.to_string());
         let md = model
             .or_else(|| std::env::var("AIEN_MODEL_NAME").ok())
             .unwrap_or_else(|| DEFAULT_MODEL.to_string());
+        let backend = if explicit_endpoint {
+            ChatBackend::RemoteAdapter(ep.clone())
+        } else {
+            resolve_chat_backend()
+        };
         let client = Client::builder()
             .connect_timeout(Duration::from_secs(10))
             .read_timeout(Duration::from_secs(120))
@@ -110,6 +184,7 @@ impl ChatClient {
             client,
             endpoint: ep,
             model: md,
+            backend,
         }
     }
 
@@ -128,6 +203,7 @@ impl ChatClient {
         stream_to_stdout: bool,
         max_tokens: usize,
     ) -> Result<String, String> {
+        emit_chat_telemetry(&self.backend, &self.model);
         let payload = json!({
             "model": self.model,
             "messages": messages,