mirror of
https://github.com/ruvnet/RuView
synced 2026-08-04 19:31:42 +00:00
f49c722764
The Rust port lived two directories deep (rust-port/wifi-densepose-rs/) without any sibling under rust-port/ that warranted the extra level. Move the whole workspace up to v2/ to match v1/ (Python) at the same depth and shorten every cd / build command across the repo. git mv preserves history for all tracked files. 60 files updated for path references (CI workflows, ADRs, docs, scripts, READMEs, internal .claude-flow state). Two manual fixes for relative-cd paths in CLAUDE.md and ADR-043 that became wrong after the depth change (cd ../.. → cd ..). Validated: - cargo check --workspace --no-default-features → clean (after target/ nuke; the gitignored target/ was carried by the OS rename and had hard-coded old paths in build scripts) - cargo test --workspace --no-default-features → 1,539 passed, 0 failed, 8 ignored (same totals as pre-rename) - ESP32-S3 on COM7 → still streaming live CSI (cb #40300, RSSI -64 dBm) After-merge follow-up: contributors should `rm -rf v2/target` once and let cargo regenerate from the new path.
43 lines
1.2 KiB
Rust
43 lines
1.2 KiB
Rust
//! Brain integration — store geospatial context in ruOS brain.
|
|
//!
|
|
//! Brain URL is read from `RUVIEW_BRAIN_URL` env var (default
|
|
//! `http://127.0.0.1:9876`). The resolved URL is logged once on first use.
|
|
|
|
use crate::fuse;
|
|
use crate::types::GeoScene;
|
|
use anyhow::Result;
|
|
use std::sync::OnceLock;
|
|
|
|
const DEFAULT_BRAIN_URL: &str = "http://127.0.0.1:9876";
|
|
|
|
pub(crate) fn brain_url() -> &'static str {
|
|
static BRAIN_URL: OnceLock<String> = OnceLock::new();
|
|
BRAIN_URL.get_or_init(|| {
|
|
let url = std::env::var("RUVIEW_BRAIN_URL")
|
|
.unwrap_or_else(|_| DEFAULT_BRAIN_URL.to_string());
|
|
eprintln!(" wifi-densepose-geo: using brain URL {url}");
|
|
url
|
|
})
|
|
}
|
|
|
|
/// Store geospatial context in the brain.
|
|
pub async fn store_geo_context(scene: &GeoScene) -> Result<u32> {
|
|
let client = reqwest::Client::builder()
|
|
.timeout(std::time::Duration::from_secs(5))
|
|
.build()?;
|
|
|
|
let mut stored = 0u32;
|
|
|
|
// Store location summary
|
|
let summary = fuse::summarize(scene);
|
|
let body = serde_json::json!({
|
|
"category": "spatial-geo",
|
|
"content": summary,
|
|
});
|
|
if client.post(format!("{}/memories", brain_url())).json(&body).send().await.is_ok() {
|
|
stored += 1;
|
|
}
|
|
|
|
Ok(stored)
|
|
}
|