b83d40a833
Rename batch de la Fase A del PLAN_MACRO: - 25 crates ente-* → arje-* (protocol/init/runtime/compat). El linaje arje (init Linux) queda con prefijo coherente. - vista → revista (revista-core + revista-web). - pluma → fana (fana-md + fana-md-reader-web). fana absorbe el linaje markdown de pluma; será el writer DAG editor (prioridad alta). Cambios: - git mv de 29 crate dirs + 2 SDDs - package/lib/bin names + path refs + imports .rs reescritos - workspace Cargo.toml + comentarios de sección - SDDs de init/runtime/compat/protocol actualizados a arje- - SDD de revista + SDD de fana (reescrito: writer DAG editor) - docs/STATUS.md, ROADMAP.md, PLAN_MACRO.md, arje-boot.md, arje-replace-systemd.md actualizados - docs/changelog/akasha.md → chasqui.md scripts/rename-fase-a.py idempotente (--dry-run soportado). cargo check --workspace verde. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
47 lines
1.7 KiB
Rust
47 lines
1.7 KiB
Rust
//! ente-echo: Ente proveedor mínimo. Anuncia Capability::Endpoint(ECHO) y
|
|
//! responde a invokes echando el blob recibido. Vehículo para validar el
|
|
//! forwarding bus → proveedor → bus → originator.
|
|
|
|
use arje_bus::{BusResponse, BusServer, InvokeHandler};
|
|
use arje_card::Capability;
|
|
use arje_echo::{echo_capability, ECHO_IFACE, ECHO_VERSION};
|
|
use tracing::{info, warn};
|
|
use tracing_subscriber::EnvFilter;
|
|
|
|
struct EchoHandler;
|
|
|
|
impl InvokeHandler for EchoHandler {
|
|
fn handle(&mut self, cap: Capability, blob: Vec<u8>) -> BusResponse {
|
|
match cap {
|
|
Capability::Endpoint { interface, version }
|
|
if interface == ECHO_IFACE && version == ECHO_VERSION =>
|
|
{
|
|
let preview = String::from_utf8_lossy(&blob).into_owned();
|
|
info!(text = %preview, len = blob.len(), "echo invoke");
|
|
BusResponse::Invoked { result: blob }
|
|
}
|
|
other => {
|
|
warn!(?other, "ente-echo: capacidad no soportada");
|
|
BusResponse::Error("ente-echo solo maneja ECHO_IFACE".into())
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#[tokio::main(flavor = "current_thread")]
|
|
async fn main() -> anyhow::Result<()> {
|
|
let filter = EnvFilter::try_from_default_env()
|
|
.unwrap_or_else(|_| EnvFilter::new("arje_echo=info"));
|
|
tracing_subscriber::fmt().with_env_filter(filter).with_target(true).init();
|
|
|
|
info!("ente-echo arrancando");
|
|
let mut server = BusServer::from_env().await?;
|
|
server.announce(vec![echo_capability()]).await?;
|
|
info!("Announce OK, sirviendo invokes");
|
|
|
|
if let Err(e) = server.serve(EchoHandler).await {
|
|
warn!(?e, "serve terminó");
|
|
}
|
|
Ok(())
|
|
}
|