refactor(naming): A1 — ente→arje, vista→revista, pluma→fana
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>
This commit is contained in:
+9
-9
@@ -1,6 +1,6 @@
|
||||
# init/ — Init (PID 1) y encarnación Linux
|
||||
|
||||
**Propósito.** `ente-zero` arranca como PID 1 del fractal. Provee el
|
||||
**Propósito.** `arje-zero` arranca como PID 1 del fractal. Provee el
|
||||
bucle primordial (reap + bus + handshake), bootstrap del kernel
|
||||
surface, encarnación de Cards en procesos aislados con namespaces +
|
||||
cgroups, y snapshot/restore del grafo.
|
||||
@@ -9,21 +9,21 @@ cgroups, y snapshot/restore del grafo.
|
||||
|
||||
| crate | tipo | rol |
|
||||
| ---------------- | ------- | ----------------------------------------------------- |
|
||||
| `ente-zero` | binario | PID 1: reap + handshake server + bus dispatcher |
|
||||
| `ente-kernel` | lib | `bootstrap_kernel_surface`, subreaper, SIGCHLD/uevent |
|
||||
| `ente-soma` | lib | Wrapper 44 LOC sobre `ente-incarnate` (compat API) |
|
||||
| `ente-incarnate` | lib | `clone(2) + namespaces + cgroup + rlimits + cpu` |
|
||||
| `ente-snapshot` | lib | `FractalSnapshot` JSON: checkpoint del grafo Cards |
|
||||
| `arje-zero` | binario | PID 1: reap + handshake server + bus dispatcher |
|
||||
| `arje-kernel` | lib | `bootstrap_kernel_surface`, subreaper, SIGCHLD/uevent |
|
||||
| `arje-soma` | lib | Wrapper 44 LOC sobre `arje-incarnate` (compat API) |
|
||||
| `arje-incarnate` | lib | `clone(2) + namespaces + cgroup + rlimits + cpu` |
|
||||
| `arje-snapshot` | lib | `FractalSnapshot` JSON: checkpoint del grafo Cards |
|
||||
|
||||
## Dependencias
|
||||
|
||||
- `ente-kernel` ← `nix`, `libc`, syscalls Linux puras.
|
||||
- `ente-incarnate` reusable: shuma (sandboxes) y supervisores no-PID-1.
|
||||
- `arje-kernel` ← `nix`, `libc`, syscalls Linux puras.
|
||||
- `arje-incarnate` reusable: shuma (sandboxes) y supervisores no-PID-1.
|
||||
- Consume `protocol/` (handshake server, brahman-net opcional).
|
||||
|
||||
## Boot path
|
||||
|
||||
1. Kernel pasa control → `ente-zero` arranca como `/sbin/init`.
|
||||
1. Kernel pasa control → `arje-zero` arranca como `/sbin/init`.
|
||||
2. Levanta sockets: `/run/brahman/bus`, `/run/brahman/handshake`.
|
||||
3. Lee `Card` semilla (`seeds/arje-{minimal,host,prod}.card.json`).
|
||||
4. Para cada `genesis` child Card: `incarnate(card)` → spawn aislado.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "ente-incarnate"
|
||||
name = "arje-incarnate"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
@@ -1,12 +1,12 @@
|
||||
[package]
|
||||
name = "ente-kernel"
|
||||
name = "arje-kernel"
|
||||
version = "0.0.1"
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
publish.workspace = true
|
||||
|
||||
[dependencies]
|
||||
ente-card = { path = "../../protocol/ente-card" }
|
||||
arje-card = { path = "../../protocol/arje-card" }
|
||||
nix = { workspace = true }
|
||||
libc = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
@@ -5,7 +5,7 @@
|
||||
//! continuar sin grafo de dispositivos.
|
||||
|
||||
use anyhow::Context;
|
||||
use ente_card::DeviceClass;
|
||||
use arje_card::DeviceClass;
|
||||
use nix::sys::socket::{bind, socket, AddressFamily, NetlinkAddr, SockFlag, SockProtocol, SockType};
|
||||
use std::collections::HashMap;
|
||||
use std::os::fd::{AsRawFd, OwnedFd};
|
||||
@@ -1,12 +1,12 @@
|
||||
[package]
|
||||
name = "ente-snapshot"
|
||||
name = "arje-snapshot"
|
||||
version = "0.0.1"
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
publish.workspace = true
|
||||
|
||||
[dependencies]
|
||||
ente-card = { path = "../../protocol/ente-card" }
|
||||
arje-card = { path = "../../protocol/arje-card" }
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
ulid = { workspace = true }
|
||||
@@ -9,7 +9,7 @@
|
||||
//! - pending_invokes (en vuelo, se descartan)
|
||||
//! - device presence (uevents reconstruyen el índice)
|
||||
|
||||
use ente_card::EntityCard;
|
||||
use arje_card::EntityCard;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::path::Path;
|
||||
use ulid::Ulid;
|
||||
@@ -0,0 +1,15 @@
|
||||
[package]
|
||||
name = "arje-soma"
|
||||
version = "0.0.1"
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
publish.workspace = true
|
||||
description = "Wrapper histórico sobre arje-incarnate para mantener la API set_bus_sock+incarnate que usa arje-zero. Toda la lógica vive en arje-incarnate."
|
||||
|
||||
[dependencies]
|
||||
arje-card = { path = "../../protocol/arje-card" }
|
||||
arje-bus = { path = "../../runtime/arje-bus" }
|
||||
arje-incarnate = { path = "../arje-incarnate" }
|
||||
nix = { workspace = true }
|
||||
anyhow = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
@@ -1,17 +1,17 @@
|
||||
//! `ente-soma` — wrapper histórico sobre [`ente_incarnate`].
|
||||
//! `ente-soma` — wrapper histórico sobre [`arje_incarnate`].
|
||||
//!
|
||||
//! La rutina de namespacing fue extraída a `ente-incarnate` para que
|
||||
//! shuma, exploradores y cualquier supervisor no-PID-1 puedan reusarla.
|
||||
//! Este crate sobrevive como compat para `ente-zero` y otros que importan
|
||||
//! `ente_soma::{set_bus_sock, incarnate}`.
|
||||
//! `arje_soma::{set_bus_sock, incarnate}`.
|
||||
//!
|
||||
//! Semántica preservada:
|
||||
//! - `BUS_SOCK_PATH` global vía `OnceLock` (init lo setea una vez).
|
||||
//! - `NOTIFY_SOCKET=/run/systemd/notify` se inyecta automáticamente.
|
||||
//! - `strict_caps = false` (errores no-fatales se loguean, encarnación sigue).
|
||||
|
||||
use ente_card::EntityCard;
|
||||
use ente_incarnate::{Incarnator, IncarnatorConfig};
|
||||
use arje_card::EntityCard;
|
||||
use arje_incarnate::{Incarnator, IncarnatorConfig};
|
||||
use nix::unistd::Pid;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::OnceLock;
|
||||
@@ -1,25 +1,25 @@
|
||||
[package]
|
||||
name = "ente-zero"
|
||||
name = "arje-zero"
|
||||
version = "0.0.1"
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
publish.workspace = true
|
||||
|
||||
[[bin]]
|
||||
name = "ente-zero"
|
||||
name = "arje-zero"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
# Lib crates del fractal — orden: contratos → infra → encarnación → orquestación
|
||||
ente-card = { path = "../../protocol/ente-card" }
|
||||
ente-bus = { path = "../../runtime/ente-bus" }
|
||||
ente-cas = { path = "../../runtime/ente-cas" }
|
||||
ente-kernel = { path = "../ente-kernel" }
|
||||
ente-soma = { path = "../ente-soma" }
|
||||
ente-wasm = { path = "../../runtime/ente-wasm" }
|
||||
ente-snapshot = { path = "../ente-snapshot" }
|
||||
ente-brain = { path = "../../runtime/ente-brain" }
|
||||
ente-echo = { path = "../../runtime/ente-echo" } # solo para constantes del demo
|
||||
arje-card = { path = "../../protocol/arje-card" }
|
||||
arje-bus = { path = "../../runtime/arje-bus" }
|
||||
arje-cas = { path = "../../runtime/arje-cas" }
|
||||
arje-kernel = { path = "../arje-kernel" }
|
||||
arje-soma = { path = "../arje-soma" }
|
||||
arje-wasm = { path = "../../runtime/arje-wasm" }
|
||||
arje-snapshot = { path = "../arje-snapshot" }
|
||||
arje-brain = { path = "../../runtime/arje-brain" }
|
||||
arje-echo = { path = "../../runtime/arje-echo" } # solo para constantes del demo
|
||||
|
||||
# Brahman protocol — handshake para módulos brahman conscientes
|
||||
brahman-handshake = { path = "../../protocol/brahman-handshake" }
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Glue entre el bucle primordial y `ente-brain`.
|
||||
//!
|
||||
//! Tres responsabilidades:
|
||||
//! 1. Traducir eventos del grafo (`GraphEvent`) a `ente_brain::EventKind`
|
||||
//! 1. Traducir eventos del grafo (`GraphEvent`) a `arje_brain::EventKind`
|
||||
//! + `SubjectInfo` para el observador y el motor.
|
||||
//! 2. Implementar `ActionSink` para que las Acciones del cerebro tengan
|
||||
//! un canal de salida hacia el grafo (Spawn → SpawnRequest, etc.).
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
use crate::events::GraphEvent;
|
||||
use crate::graph::EnteGraph;
|
||||
use ente_brain::{ActionSink, EventKind as BrainEventKind, SubjectInfo};
|
||||
use ente_card::Capability;
|
||||
use arje_brain::{ActionSink, EventKind as BrainEventKind, SubjectInfo};
|
||||
use arje_card::Capability;
|
||||
use serde::Deserialize;
|
||||
use tokio::sync::mpsc;
|
||||
use tracing::warn;
|
||||
@@ -40,8 +40,8 @@ pub fn graph_event_to_brain<'a>(
|
||||
}
|
||||
GraphEvent::BusRequest { from, request, .. } => {
|
||||
let kind = match request {
|
||||
ente_bus::BusRequest::Announce { .. } => BrainEventKind::BusAnnounce,
|
||||
ente_bus::BusRequest::Invoke { cap, .. } => {
|
||||
arje_bus::BusRequest::Announce { .. } => BrainEventKind::BusAnnounce,
|
||||
arje_bus::BusRequest::Invoke { cap, .. } => {
|
||||
BrainEventKind::BusInvokeOf(cap.clone())
|
||||
}
|
||||
_ => BrainEventKind::BusInvoke,
|
||||
@@ -83,7 +83,7 @@ pub struct GraphSink {
|
||||
impl ActionSink for GraphSink {
|
||||
fn spawn(&self, card_blob: &str) {
|
||||
// El blob es JSON de EntityCard.
|
||||
match serde_json::from_str::<ente_card::EntityCard>(card_blob) {
|
||||
match serde_json::from_str::<arje_card::EntityCard>(card_blob) {
|
||||
Ok(card) => {
|
||||
let evt = GraphEvent::SpawnRequest { card, requester: self.requester };
|
||||
if self.graph_tx.try_send(evt).is_err() {
|
||||
@@ -112,11 +112,11 @@ impl ActionSink for GraphSink {
|
||||
/// Helper para que el grafo exponga la Card de un Ente vivo. Lo añadimos como
|
||||
/// trait extension porque graph::EnteGraph mantiene `incarnated` privado.
|
||||
pub trait GraphCardLookup {
|
||||
fn card_for(&self, id: &Ulid) -> Option<&ente_card::EntityCard>;
|
||||
fn card_for(&self, id: &Ulid) -> Option<&arje_card::EntityCard>;
|
||||
}
|
||||
|
||||
impl GraphCardLookup for EnteGraph {
|
||||
fn card_for(&self, id: &Ulid) -> Option<&ente_card::EntityCard> {
|
||||
fn card_for(&self, id: &Ulid) -> Option<&arje_card::EntityCard> {
|
||||
// Acceso vía método público que añadiremos en graph/mod.rs.
|
||||
self.peek_card(id)
|
||||
}
|
||||
@@ -10,7 +10,7 @@
|
||||
//! escritura de su conexión y lo usa para forwardear.
|
||||
|
||||
use crate::events::GraphEvent;
|
||||
use ente_bus::{read_frame, write_frame, BusMessage, BusPayload, BusResponse, PeerCreds};
|
||||
use arje_bus::{read_frame, write_frame, BusMessage, BusPayload, BusResponse, PeerCreds};
|
||||
use nix::sys::socket::{getsockopt, sockopt::PeerCredentials};
|
||||
use std::path::PathBuf;
|
||||
use tokio::net::{UnixListener, UnixStream};
|
||||
@@ -19,7 +19,7 @@ use tracing::{error, info, trace, warn};
|
||||
use ulid::Ulid;
|
||||
|
||||
pub fn default_socket_path() -> PathBuf {
|
||||
if let Ok(p) = std::env::var(ente_bus::ENV_BUS_SOCK) {
|
||||
if let Ok(p) = std::env::var(arje_bus::ENV_BUS_SOCK) {
|
||||
return p.into();
|
||||
}
|
||||
let runtime = std::env::var("XDG_RUNTIME_DIR")
|
||||
@@ -97,7 +97,7 @@ async fn handle_conn(stream: UnixStream, graph_tx: mpsc::Sender<GraphEvent>) ->
|
||||
};
|
||||
match msg.payload {
|
||||
BusPayload::Request(req) => {
|
||||
let is_announce = matches!(req, ente_bus::BusRequest::Announce { .. });
|
||||
let is_announce = matches!(req, arje_bus::BusRequest::Announce { .. });
|
||||
let (reply_tx, reply_rx) = oneshot::channel();
|
||||
if graph_tx.send(GraphEvent::BusRequest {
|
||||
peer,
|
||||
@@ -8,8 +8,8 @@
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
use ente_bus::{BusMessage, BusRequest, BusResponse, PeerCreds};
|
||||
use ente_card::{Capability, EntityCard};
|
||||
use arje_bus::{BusMessage, BusRequest, BusResponse, PeerCreds};
|
||||
use arje_card::{Capability, EntityCard};
|
||||
use nix::sys::signal::Signal;
|
||||
use tokio::sync::{mpsc, oneshot};
|
||||
use ulid::Ulid;
|
||||
+2
-2
@@ -8,8 +8,8 @@
|
||||
//! - Cleanup en cierre de conexión
|
||||
|
||||
use super::{EnteGraph, SERVER_SEQ_FLAG};
|
||||
use ente_bus::{BusMessage, BusPayload, BusRequest, BusResponse, EnteInfo, PeerCreds};
|
||||
use ente_card::Capability;
|
||||
use arje_bus::{BusMessage, BusPayload, BusRequest, BusResponse, EnteInfo, PeerCreds};
|
||||
use arje_card::Capability;
|
||||
use tokio::sync::{mpsc, oneshot};
|
||||
use tracing::{debug, info, warn};
|
||||
use ulid::Ulid;
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
|
||||
use super::{quota_for_capability, ttl_for_capability, EnteGraph, GrantedCapability};
|
||||
use crate::events::CapabilityGrant;
|
||||
use ente_card::Capability;
|
||||
use arje_card::Capability;
|
||||
use std::time::Instant;
|
||||
use tokio::sync::oneshot;
|
||||
use tracing::debug;
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
|
||||
use super::EnteGraph;
|
||||
use crate::events::GraphEvent;
|
||||
use ente_card::{Capability, DeviceClass};
|
||||
use ente_kernel::{UAction, UEvent};
|
||||
use arje_card::{Capability, DeviceClass};
|
||||
use arje_kernel::{UAction, UEvent};
|
||||
use tokio::sync::mpsc;
|
||||
use tracing::{debug, info, warn};
|
||||
|
||||
+7
-7
@@ -5,8 +5,8 @@
|
||||
|
||||
use super::{EnteGraph, Incarnated};
|
||||
use crate::events::{ExitStatus, GraphEvent};
|
||||
use ente_bus::{BusMessage, BusPayload, BusRequest};
|
||||
use ente_card::{Capability, EntityCard, Payload, Supervision};
|
||||
use arje_bus::{BusMessage, BusPayload, BusRequest};
|
||||
use arje_card::{Capability, EntityCard, Payload, Supervision};
|
||||
use tokio::sync::mpsc;
|
||||
use tracing::{info, warn};
|
||||
use ulid::Ulid;
|
||||
@@ -35,7 +35,7 @@ impl EnteGraph {
|
||||
|
||||
/// Spawn solicitado por un Ente con `Capability::Spawn`. Verifica auth,
|
||||
/// requires del grafo, y delega la encarnación al backend correspondiente
|
||||
/// (`ente_soma` para procesos, `ente_wasm` para Wasm).
|
||||
/// (`arje_soma` para procesos, `arje_wasm` para Wasm).
|
||||
pub async fn authorize_and_spawn(
|
||||
&mut self,
|
||||
mut card: EntityCard,
|
||||
@@ -64,14 +64,14 @@ impl EnteGraph {
|
||||
let pid = match &card.payload {
|
||||
Payload::Virtual => None,
|
||||
Payload::Native { .. } | Payload::Legacy { .. } => {
|
||||
Some(ente_soma::incarnate(&card)?)
|
||||
Some(arje_soma::incarnate(&card)?)
|
||||
}
|
||||
Payload::Wasm { module_sha256, entry } => {
|
||||
// Wasm: hilo dedicado, sin PID. Su muerte se observa por
|
||||
// estado del runtime, no por SIGCHLD.
|
||||
let bytes = ente_cas::resolve(module_sha256)
|
||||
let bytes = arje_cas::resolve(module_sha256)
|
||||
.map_err(|e| anyhow::anyhow!("CAS resolve para {}: {e}", card.label))?;
|
||||
ente_wasm::incarnate_wasm(&card, bytes, entry.clone())?;
|
||||
arje_wasm::incarnate_wasm(&card, bytes, entry.clone())?;
|
||||
None
|
||||
}
|
||||
};
|
||||
@@ -142,7 +142,7 @@ impl EnteGraph {
|
||||
seq,
|
||||
payload: BusPayload::Request(BusRequest::Invoke {
|
||||
cap: Capability::Endpoint {
|
||||
interface: ente_card::InterfaceId([0xde; 16]),
|
||||
interface: arje_card::InterfaceId([0xde; 16]),
|
||||
version: 1,
|
||||
},
|
||||
blob: blob.into_bytes(),
|
||||
@@ -16,8 +16,8 @@ mod lifecycle;
|
||||
mod shutdown;
|
||||
mod topology;
|
||||
|
||||
use ente_bus::{BusMessage, BusResponse};
|
||||
use ente_card::{Capability, EntityCard};
|
||||
use arje_bus::{BusMessage, BusResponse};
|
||||
use arje_card::{Capability, EntityCard};
|
||||
use nix::unistd::Pid;
|
||||
use std::collections::{BTreeMap, BTreeSet, HashMap};
|
||||
use tokio::sync::{mpsc, oneshot};
|
||||
@@ -41,7 +41,7 @@ pub struct EnteGraph {
|
||||
pub(in crate::graph) next_token: u64,
|
||||
pub(in crate::graph) grants: HashMap<u64, GrantedCapability>,
|
||||
/// Dispositivos del kernel presentes (devpath → última UEvent).
|
||||
pub(in crate::graph) devices: HashMap<String, ente_kernel::UEvent>,
|
||||
pub(in crate::graph) devices: HashMap<String, arje_kernel::UEvent>,
|
||||
/// Cards genesis pendientes de instanciar (extraídas de la Semilla).
|
||||
pub(in crate::graph) pending_genesis: Vec<EntityCard>,
|
||||
/// Hijos directos por lineage. parent → [child, ...].
|
||||
@@ -166,14 +166,14 @@ impl EnteGraph {
|
||||
|
||||
/// Captura el estado live como snapshot serializable. Excluye la Semilla
|
||||
/// (será re-sintetizada al restore con su seed_id preservado).
|
||||
pub fn snapshot(&self) -> ente_snapshot::FractalSnapshot {
|
||||
pub fn snapshot(&self) -> arje_snapshot::FractalSnapshot {
|
||||
let entes: Vec<EntityCard> = self.incarnated.iter()
|
||||
.filter(|(id, _)| **id != self.seed.id)
|
||||
.map(|(_, inc)| inc.card.clone())
|
||||
.collect();
|
||||
ente_snapshot::FractalSnapshot {
|
||||
version: ente_snapshot::SNAPSHOT_VERSION,
|
||||
timestamp_ms: ente_snapshot::now_ms(),
|
||||
arje_snapshot::FractalSnapshot {
|
||||
version: arje_snapshot::SNAPSHOT_VERSION,
|
||||
timestamp_ms: arje_snapshot::now_ms(),
|
||||
seed_id: self.seed.id,
|
||||
seed_label: self.seed.label.clone(),
|
||||
entes,
|
||||
@@ -23,8 +23,8 @@ mod keypair_store;
|
||||
mod seed;
|
||||
|
||||
use anyhow::Context;
|
||||
use ente_brain::{BrainState, IntrospectServer};
|
||||
use ente_kernel::{become_child_subreaper, bootstrap_kernel_surface, spawn_sigchld_stream, spawn_uevent_stream};
|
||||
use arje_brain::{BrainState, IntrospectServer};
|
||||
use arje_kernel::{become_child_subreaper, bootstrap_kernel_surface, spawn_sigchld_stream, spawn_uevent_stream};
|
||||
use events::{ExitStatus, GraphEvent, ShutdownReason};
|
||||
use graph::EnteGraph;
|
||||
use nix::errno::Errno;
|
||||
@@ -106,7 +106,7 @@ fn main() -> anyhow::Result<()> {
|
||||
}
|
||||
|
||||
async fn primordial_loop(
|
||||
seed_card: ente_card::EntityCard,
|
||||
seed_card: arje_card::EntityCard,
|
||||
dev_mode: bool,
|
||||
checkpoint_path: Option<PathBuf>,
|
||||
restore_path: Option<PathBuf>,
|
||||
@@ -127,7 +127,7 @@ async fn primordial_loop(
|
||||
Ok(rx) => rx,
|
||||
Err(e) => {
|
||||
warn!(?e, "uevents deshabilitados (probablemente falta CAP_NET_ADMIN)");
|
||||
let (_keep_tx, rx) = mpsc::channel::<ente_kernel::UEvent>(1);
|
||||
let (_keep_tx, rx) = mpsc::channel::<arje_kernel::UEvent>(1);
|
||||
std::mem::forget(_keep_tx);
|
||||
rx
|
||||
}
|
||||
@@ -137,7 +137,7 @@ async fn primordial_loop(
|
||||
// tenga adónde llegar. Su path se inyecta en ENTE_BUS_SOCK por soma.
|
||||
let bus_sock = bus::default_socket_path();
|
||||
let bus_path = bus::spawn_bus(bus_sock, graph_tx.clone())?;
|
||||
ente_soma::set_bus_sock(bus_path.to_string_lossy().into_owned());
|
||||
arje_soma::set_bus_sock(bus_path.to_string_lossy().into_owned());
|
||||
|
||||
// Brahman protocol: handshake socket + broker compartido.
|
||||
//
|
||||
@@ -285,7 +285,7 @@ async fn primordial_loop(
|
||||
// Umbrales relajados para que el demo (pocos eventos) produzca
|
||||
// cristales observables. Con P(b|a) normalizada a [0,1], los
|
||||
// valores típicos en muestras pequeñas son 0.2-0.5.
|
||||
BrainState::with_params(1024, ente_brain::CrystallizationParams {
|
||||
BrainState::with_params(1024, arje_brain::CrystallizationParams {
|
||||
min_support: 2,
|
||||
min_conditional_prob: 0.3,
|
||||
min_pmi: 1.0,
|
||||
@@ -300,13 +300,13 @@ async fn primordial_loop(
|
||||
let mut obs = brain.observer.write().await;
|
||||
// Reemplazar con un observer nuevo que tenga half-life. Estado
|
||||
// anterior (vacío en este punto) descartado.
|
||||
*obs = ente_brain::Observer::new(1024).with_half_life(hl);
|
||||
*obs = arje_brain::Observer::new(1024).with_half_life(hl);
|
||||
info!(hl_secs = hl, "observer con time-decay activo");
|
||||
}
|
||||
if let Some(secs) = autopromote_secs {
|
||||
ente_brain::spawn_autopromote_loop(
|
||||
arje_brain::spawn_autopromote_loop(
|
||||
brain.clone(),
|
||||
ente_brain::AutopromoteParams {
|
||||
arje_brain::AutopromoteParams {
|
||||
interval_secs: secs,
|
||||
threshold: brain.params, // mismo threshold que crystals manuales
|
||||
},
|
||||
@@ -322,7 +322,7 @@ async fn primordial_loop(
|
||||
Ok(snap) => {
|
||||
let total = snap.total;
|
||||
let kinds = snap.marginal.len();
|
||||
let restored = ente_brain::Observer::from_snapshot(snap);
|
||||
let restored = arje_brain::Observer::from_snapshot(snap);
|
||||
*brain.observer.write().await = restored;
|
||||
info!(
|
||||
path = %brain_path.display(),
|
||||
@@ -337,7 +337,7 @@ async fn primordial_loop(
|
||||
// Si --audit-head, configuramos el head pointer y arrancamos auto-flush.
|
||||
if let Some(head_path) = audit_head {
|
||||
// Re-creamos el AuditLog con head pointer.
|
||||
let new_audit = ente_brain::audit::AuditLog::new()
|
||||
let new_audit = arje_brain::audit::AuditLog::new()
|
||||
.with_head_pointer(head_path);
|
||||
*brain.audit.write().await = new_audit;
|
||||
spawn_audit_auto_flush(brain.clone());
|
||||
@@ -345,7 +345,7 @@ async fn primordial_loop(
|
||||
|
||||
// Carga inicial de reglas desde JSON/JSONL si --rules path proporcionado.
|
||||
if let Some(path) = &rules_path {
|
||||
match ente_brain::load_rules_file(path) {
|
||||
match arje_brain::load_rules_file(path) {
|
||||
Ok(rules) => {
|
||||
let mut engine = brain.engine.write().await;
|
||||
for r in rules {
|
||||
@@ -367,7 +367,7 @@ async fn primordial_loop(
|
||||
Ok(addr) => {
|
||||
let s = brain.clone();
|
||||
tokio::spawn(async move {
|
||||
if let Err(e) = ente_brain::serve_metrics(s, addr).await {
|
||||
if let Err(e) = arje_brain::serve_metrics(s, addr).await {
|
||||
warn!(?e, "metrics server cayó");
|
||||
}
|
||||
});
|
||||
@@ -536,14 +536,14 @@ async fn emit_death(
|
||||
fn spawn_echo_smoke_test(bus_path: PathBuf) {
|
||||
tokio::spawn(async move {
|
||||
tokio::time::sleep(Duration::from_millis(300)).await;
|
||||
match ente_bus::BusClient::connect(&bus_path).await {
|
||||
match arje_bus::BusClient::connect(&bus_path).await {
|
||||
Ok(mut client) => {
|
||||
let req = ente_bus::BusRequest::Invoke {
|
||||
cap: ente_echo::echo_capability(),
|
||||
let req = arje_bus::BusRequest::Invoke {
|
||||
cap: arje_echo::echo_capability(),
|
||||
blob: b"hola fractal forwardeado".to_vec(),
|
||||
};
|
||||
match client.call(req).await {
|
||||
Ok(ente_bus::BusResponse::Invoked { result }) => {
|
||||
Ok(arje_bus::BusResponse::Invoked { result }) => {
|
||||
info!(echo = %String::from_utf8_lossy(&result), "Invoke ECHO round-trip OK");
|
||||
}
|
||||
Ok(other) => warn!(?other, "Invoke ECHO respuesta inesperada"),
|
||||
@@ -555,7 +555,7 @@ fn spawn_echo_smoke_test(bus_path: PathBuf) {
|
||||
});
|
||||
}
|
||||
|
||||
fn write_brain_snapshot(path: &std::path::Path, snap: &ente_brain::observer::ObserverSnapshot) -> anyhow::Result<()> {
|
||||
fn write_brain_snapshot(path: &std::path::Path, snap: &arje_brain::observer::ObserverSnapshot) -> anyhow::Result<()> {
|
||||
let bytes = serde_json::to_vec_pretty(snap)?;
|
||||
if let Some(parent) = path.parent() { let _ = std::fs::create_dir_all(parent); }
|
||||
let tmp = path.with_extension("tmp");
|
||||
@@ -564,16 +564,16 @@ fn write_brain_snapshot(path: &std::path::Path, snap: &ente_brain::observer::Obs
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn read_brain_snapshot(path: &std::path::Path) -> anyhow::Result<ente_brain::observer::ObserverSnapshot> {
|
||||
fn read_brain_snapshot(path: &std::path::Path) -> anyhow::Result<arje_brain::observer::ObserverSnapshot> {
|
||||
let bytes = std::fs::read(path)?;
|
||||
let snap: ente_brain::observer::ObserverSnapshot = serde_json::from_slice(&bytes)?;
|
||||
let snap: arje_brain::observer::ObserverSnapshot = serde_json::from_slice(&bytes)?;
|
||||
Ok(snap)
|
||||
}
|
||||
|
||||
fn init_tracing() {
|
||||
use tracing_subscriber::{fmt, EnvFilter};
|
||||
let filter = EnvFilter::try_from_default_env()
|
||||
.unwrap_or_else(|_| EnvFilter::new("ente_zero=debug,info"));
|
||||
.unwrap_or_else(|_| EnvFilter::new("arje_zero=debug,info"));
|
||||
fmt().with_env_filter(filter).with_target(true).init();
|
||||
}
|
||||
|
||||
@@ -625,7 +625,7 @@ async fn feed_brain(
|
||||
evt: &GraphEvent,
|
||||
) {
|
||||
let Some((kind, subj)) = brain_glue::graph_event_to_brain(evt, graph) else { return };
|
||||
let history: Vec<ente_brain::TimedEvent> = {
|
||||
let history: Vec<arje_brain::TimedEvent> = {
|
||||
let mut obs = brain.observer.write().await;
|
||||
obs.record(kind.clone());
|
||||
// Snapshot de los últimos 16 eventos — suficiente para cualquier
|
||||
@@ -637,7 +637,7 @@ async fn feed_brain(
|
||||
engine.dispatch(&kind, &subj, &history)
|
||||
};
|
||||
if !rules.is_empty() {
|
||||
ente_brain::dispatch_actions(&rules, sink).await;
|
||||
arje_brain::dispatch_actions(&rules, sink).await;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
//! todas las capacidades del fractal.
|
||||
|
||||
use anyhow::Context;
|
||||
use ente_card::{
|
||||
use arje_card::{
|
||||
Capability, CardError, CgroupSpec, EntityCard, NamespaceSet, Payload,
|
||||
ResourceLimits, SomaSpec, Supervision, CARD_SCHEMA_VERSION,
|
||||
};
|
||||
@@ -33,7 +33,7 @@ pub fn load(dev_mode: bool, restore: Option<&Path>) -> anyhow::Result<EntityCard
|
||||
}
|
||||
|
||||
fn load_from_snapshot(path: &Path) -> anyhow::Result<EntityCard> {
|
||||
let snap = ente_snapshot::FractalSnapshot::read(path)
|
||||
let snap = arje_snapshot::FractalSnapshot::read(path)
|
||||
.with_context(|| format!("read snapshot {}", path.display()))?;
|
||||
info!(
|
||||
path = %path.display(),
|
||||
@@ -66,7 +66,7 @@ fn load_from_snapshot(path: &Path) -> anyhow::Result<EntityCard> {
|
||||
fn load_or_synthesize(dev_mode: bool) -> anyhow::Result<EntityCard> {
|
||||
// Buscamos primero `.json` (canónico), luego sin extensión por
|
||||
// compatibilidad con instalaciones que dejan el archivo crudo. La puerta
|
||||
// genética se cruza vía `ente_brain::load_card_file` que pasa por
|
||||
// genética se cruza vía `arje_brain::load_card_file` que pasa por
|
||||
// `validate()` extendido.
|
||||
let candidates: &[&str] = if dev_mode {
|
||||
&["seed.card.json", SEED_PATH_DEV]
|
||||
@@ -76,7 +76,7 @@ fn load_or_synthesize(dev_mode: bool) -> anyhow::Result<EntityCard> {
|
||||
for cand in candidates {
|
||||
let path = PathBuf::from(cand);
|
||||
if !path.exists() { continue; }
|
||||
let card = ente_brain::load_card_file(&path)
|
||||
let card = arje_brain::load_card_file(&path)
|
||||
.with_context(|| format!("load {}", path.display()))?;
|
||||
info!(path = %path.display(), "Tarjeta Semilla cargada y validada");
|
||||
return Ok(card);
|
||||
@@ -96,8 +96,8 @@ fn synthesize_dev_seed() -> EntityCard {
|
||||
// Pre-registramos el módulo Wasm demo en el CAS y obtenemos su SHA real.
|
||||
// Si el CAS no es escribible (raro en dev) caemos a un SHA cero — la
|
||||
// resolución fallará y el Wasm no encarnará, pero el resto queda intacto.
|
||||
let demo_wasm_sha = match ente_wasm::demo_module_bytes()
|
||||
.and_then(|b| ente_cas::store(&b))
|
||||
let demo_wasm_sha = match arje_wasm::demo_module_bytes()
|
||||
.and_then(|b| arje_cas::store(&b))
|
||||
{
|
||||
Ok(sha) => sha,
|
||||
Err(e) => {
|
||||
@@ -134,7 +134,7 @@ fn synthesize_dev_seed() -> EntityCard {
|
||||
|
||||
if let Some(card) = optional_native_card(
|
||||
"demo-echo", "target/debug/ente-echo",
|
||||
[ente_echo::echo_capability()].into_iter().collect(),
|
||||
[arje_echo::echo_capability()].into_iter().collect(),
|
||||
restart_supervision(),
|
||||
) {
|
||||
genesis.push(card);
|
||||
@@ -1,15 +0,0 @@
|
||||
[package]
|
||||
name = "ente-soma"
|
||||
version = "0.0.1"
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
publish.workspace = true
|
||||
description = "Wrapper histórico sobre ente-incarnate para mantener la API set_bus_sock+incarnate que usa ente-zero. Toda la lógica vive en ente-incarnate."
|
||||
|
||||
[dependencies]
|
||||
ente-card = { path = "../../protocol/ente-card" }
|
||||
ente-bus = { path = "../../runtime/ente-bus" }
|
||||
ente-incarnate = { path = "../ente-incarnate" }
|
||||
nix = { workspace = true }
|
||||
anyhow = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
Reference in New Issue
Block a user