[workspace]
resolver = "2"
members = [
    # ============================================================
    # protocol/ — Contratos canónicos + routing entre módulos
    # ============================================================
    "crates/protocol/brahman-card",
    "crates/protocol/brahman-card-wit",
    "crates/protocol/brahman-cards",
    "crates/protocol/brahman-handshake",
    "crates/protocol/brahman-broker",
    "crates/protocol/brahman-admin",
    "crates/protocol/brahman-sidecar",
    "crates/protocol/brahman-net",
    "crates/protocol/brahman-dht",
    "crates/protocol/brahman-card-discovery",
    "crates/protocol/brahman-ssh-multiplex",
    "crates/protocol/brahman-auth",
    "crates/protocol/arje-card",

    # ============================================================
    # init/ — PID 1 + encarnación Linux (arje)
    # ============================================================
    "crates/init/arje-zero",
    "crates/init/arje-kernel",
    "crates/init/arje-soma",
    "crates/init/arje-snapshot",
    "crates/init/arje-incarnate",
    "crates/init/arje-absorb",

    # ============================================================
    # runtime/ — Infraestructura de ejecución (bus + cas + wasm + brain)
    # ============================================================
    "crates/runtime/arje-bus",
    "crates/runtime/arje-cas",
    "crates/runtime/arje-wasm",
    "crates/runtime/arje-brain-rules",
    "crates/runtime/arje-brain-cognitive",
    "crates/runtime/arje-brain-audit",
    "crates/runtime/arje-brain",
    "crates/runtime/arje-echo",
    "crates/runtime/sandokan-lifecycle",
    "crates/runtime/sandokan-core",
    "crates/runtime/sandokan-local",
    "crates/runtime/sandokan-daemon",
    "crates/runtime/sandokan-remote",
    "crates/runtime/sandokan",

    # ============================================================
    # compat/ — Shims D-Bus para correr software systemd-aware
    # ============================================================
    "crates/compat/arje-compat-common",
    "crates/compat/arje-policy-provider",
    "crates/compat/arje-logind-compat",
    "crates/compat/arje-hostnamed-compat",
    "crates/compat/arje-timedated-compat",
    "crates/compat/arje-localed-compat",
    "crates/compat/arje-journald-compat",
    "crates/compat/arje-resolved-compat",
    "crates/compat/arje-polkit-compat",
    "crates/compat/arje-machined-compat",
    "crates/compat/arje-tmpfiles-compat",
    "crates/compat/arje-systemd1-compat",
    "crates/compat/arje-notify-compat",
    "crates/compat/arje-binfmt-compat",
    "crates/compat/arje-timer-compat",

    # ============================================================
    # modules/semantic_dht/ (minga) — DHT semántico de código
    # ============================================================
    "crates/modules/semantic_dht/minga-core",
    "crates/modules/semantic_dht/minga-store",
    "crates/modules/semantic_dht/minga-p2p",
    "crates/modules/semantic_dht/minga-vfs",
    "crates/modules/semantic_dht/minga-cli",

    # ============================================================
    # modules/nahual/ — Motor GPUI: libs + widgets (era yahweh)
    # ============================================================
    "crates/modules/nahual/libs/core",
    "crates/modules/nahual/libs/theme",
    "crates/modules/nahual/libs/launcher",
    "crates/modules/nahual/libs/bus",
    "crates/modules/nahual/libs/meta-schema",
    "crates/modules/nahual/libs/meta-runtime",
    "crates/modules/nahual/libs/providers/fs",
    "crates/modules/nahual/libs/providers/sqlite",
    "crates/modules/nahual/widgets/tree",
    "crates/modules/nahual/widgets/container_core",
    "crates/modules/nahual/widgets/splitter",
    "crates/modules/nahual/widgets/tabs",
    "crates/modules/nahual/widgets/tiled",
    "crates/modules/nahual/widgets/text_input",
    "crates/modules/nahual/widgets/meta-form",
    "crates/modules/nahual/widgets/banner",
    "crates/modules/nahual/widgets/card",
    "crates/modules/nahual/widgets/stat-card",
    "crates/modules/nahual/widgets/app-header",
    "crates/modules/nahual/widgets/theme-switcher",

    # ============================================================
    # modules/pineal/ — Data-viz agnóstica con backends (era lapaloma)
    # ============================================================
    "crates/modules/pineal/core",
    "crates/modules/pineal/render",
    "crates/modules/pineal/cartesian",
    "crates/modules/pineal/stream",
    "crates/modules/pineal/mesh",
    "crates/modules/pineal/financial",
    "crates/modules/pineal/polar",
    "crates/modules/pineal/heatmap",
    "crates/modules/pineal/treemap",
    "crates/modules/pineal/flow",
    "crates/modules/pineal/phosphor",
    "crates/modules/pineal/export",
    "crates/modules/pineal/umbrella",

    # ============================================================
    # modules/verbo/ — Provider de embeddings model-agnostic
    # ============================================================
    "crates/modules/verbo/verbo-core",
    "crates/modules/verbo/verbo-mock",
    "crates/modules/verbo/verbo-daemon",

    # ============================================================
    # modules/agorapura/ — Identidad humana federada
    # ============================================================
    "crates/modules/agorapura/agorapura-core",
    "crates/modules/agorapura/agorapura-graph",

    # ============================================================
    # modules/badu/ — Toma de notas con gravedad semántica
    # ============================================================
    "crates/modules/badu/badu-core",
    "crates/modules/badu/badu-gravity",

    # ============================================================
    # modules/takiy/ — Composición musical asistida
    # ============================================================
    "crates/modules/takiy/takiy-core",

    # ============================================================
    # modules/matilda/ — Administración de servidores
    # ============================================================
    "crates/modules/matilda/matilda-core",
    "crates/modules/matilda/matilda-config",
    "crates/modules/matilda/matilda-plan",
    "crates/modules/matilda/matilda-apply",
    "crates/modules/matilda/matilda-ghost",
    "crates/modules/matilda/matilda-linker",
    "crates/modules/matilda/matilda-discover",

    # ============================================================
    # modules/yachay/ — Notebooks computacionales reproducibles
    # ============================================================
    "crates/modules/yachay/yachay-core",

    # ============================================================
    # modules/charka/ — Transpilador COBOL → Rust
    # ============================================================
    "crates/modules/charka/charka-bcd",
    "crates/modules/charka/charka-lexer",
    "crates/modules/charka/charka-parser",
    "crates/modules/charka/charka-ir",
    "crates/modules/charka/charka-runtime",
    "crates/modules/charka/charka-codegen",
    "crates/modules/charka/charka-shadow",

    # ============================================================
    # modules/mirada/ — Compositor Wayland
    # ============================================================
    "crates/modules/mirada/mirada-layout",
    "crates/modules/mirada/mirada-protocol",
    "crates/modules/mirada/mirada-brain",
    "crates/modules/mirada/mirada-link",
    "crates/modules/mirada/mirada-body",

    # ============================================================
    # modules/nakui/ — ERP matemático (categórico)
    # ============================================================
    "crates/modules/nakui/core",

    # ============================================================
    # modules/chasqui/ — Explorador semántico de nómadas (ex-nouser, ex-akasha)
    # ============================================================
    "crates/modules/chasqui/card",
    "crates/modules/chasqui/core",
    "crates/modules/chasqui/nous",
    "crates/modules/chasqui/nous-mock",
    "crates/modules/chasqui/nous-real",

    # ============================================================
    # modules/shuma/ — Runtime de espacios aislados (era shipote)
    # ============================================================
    "crates/modules/shuma/shuma-card",
    "crates/modules/shuma/shuma-protocol",
    "crates/modules/shuma/shuma-discern",
    "crates/modules/shuma/shuma-core",
    "crates/modules/shuma/shuma-intent",
    "crates/modules/shuma/shuma-line",
    "crates/modules/shuma/shuma-sysmon",
    "crates/modules/shuma/shuma-session",
    "crates/modules/shuma/shuma-exec",
    "crates/modules/shuma/shuma-infer",
    "crates/modules/shuma/shuma-shell-render",

    # ============================================================
    # modules/dominium/ — Simulador psicológico de campo medio
    # ============================================================
    "crates/modules/dominium/dominium-core",
    "crates/modules/dominium/dominium-physics",
    "crates/modules/dominium/dominium-iso",
    "crates/modules/dominium/dominium-render-plan",
    "crates/modules/dominium/dominium-canvas-gpui",

    # ============================================================
    # modules/gioser/ — Landing WASM (chacana + 4 elementos)
    # ============================================================
    "crates/modules/gioser/gioser-geom",
    "crates/modules/gioser/gioser-physics",
    "crates/modules/gioser/gioser-palette",
    "crates/modules/gioser/gioser-shaders",
    "crates/modules/gioser/gioser-canvas-web",
    "crates/modules/gioser/gioser-graph-web",

    # ==========================================================
    # modules/fana/ — Writer DAG editor (absorbe pluma)
    # ============================================================
    "crates/modules/fana/fana-core",
    "crates/modules/fana/fana-graph",
    "crates/modules/fana/fana-render-plan",
    "crates/modules/fana/fana-editor-gpui",
    "crates/modules/fana/fana-store",
    "crates/modules/fana/fana-semantic",
    "crates/modules/fana/fana-md",
    "crates/modules/fana/fana-md-reader-web",

    # ============================================================
    # modules/revista/ — Deck horizontal swipe (Flutter PageView)
    # ============================================================
    "crates/modules/revista/revista-core",
    "crates/modules/revista/revista-web",

    # ============================================================
    # modules/barra/ — Taskbar agnóstica estilo Windows
    # ============================================================
    "crates/modules/barra/barra-core",
    "crates/modules/barra/barra-web",

    # ============================================================
####    # modules/cosmobiologia/ — Estudio de astrología profesional
####    # ============================================================
####    "crates/modules/cosmobiologia/cosmobiologia-card",
####    "crates/modules/cosmobiologia/cosmobiologia-model",
####    "crates/modules/cosmobiologia/cosmobiologia-store",
####    "crates/modules/cosmobiologia/cosmobiologia-render",
####    "crates/modules/cosmobiologia/cosmobiologia-corpus",
####    "crates/modules/cosmobiologia/cosmobiologia-engine",
####    "crates/modules/cosmobiologia/cosmobiologia-modules",
####    "crates/modules/cosmobiologia/cosmobiologia-theme",
####    "crates/modules/cosmobiologia/cosmobiologia-canvas",
####    "crates/modules/cosmobiologia/cosmobiologia-tree",
####    "crates/modules/cosmobiologia/cosmobiologia-panel",
####    "crates/modules/cosmobiologia/cosmobiologia-web",

    # ============================================================
    # apps/ — Binarios finales que consumen el protocolo
    # ============================================================
    "crates/apps/brahman-broker-explorer",
    "crates/apps/brahman-demo",
    "crates/apps/sandokan",
    "crates/apps/nahual-shell",
    "crates/apps/nahual-file-explorer",
    "crates/apps/nahual-database-explorer",
    "crates/apps/nahual-text-viewer",
    "crates/apps/nahual-image-viewer",
    "crates/apps/chasqui-explorer",
    "crates/apps/nakui-explorer",
    "crates/apps/nakui-ui",
    "crates/apps/minga-explorer",
    "crates/apps/shuma-daemon",
    "crates/apps/shuma-cli",
    "crates/apps/shuma-gateway",
    "crates/apps/shuma-shell",
    "crates/apps/gioser-web",
    "crates/apps/pineal-demo",
    "crates/apps/pineal-stream-demo",
    "crates/apps/pineal-phosphor-demo",
    "crates/apps/pineal-financial-demo",
####    "crates/apps/cosmobiologia",
####    "crates/apps/cosmobiologia-cli",
####    "crates/apps/cosmobiologia-server",
    "crates/apps/dominium",
    "crates/apps/fana",
    "crates/apps/agorapura",
    "crates/apps/badu",
    "crates/apps/matilda",
    "crates/apps/yachay",
    "crates/apps/mirada",
    "crates/apps/mirada-compositor",
    "crates/apps/mirada-ctl",
    "crates/apps/mirada-launcher",
    "crates/apps/mirada-portal",
    "crates/apps/mirada-greeter",
    "crates/apps/charka",
]

# renaser — el SO bare-metal SASOS. Vive en el mismo repo pero es su
# PROPIO workspace de Cargo: usa toolchain nightly, target
# `x86_64-unknown-none` y `panic = "abort"`, incompatibles con los
# perfiles globales de este workspace. Cargo lo trata como ajeno; los
# crates compartidos se referencian por `path` cruzando la frontera.
exclude = ["renaser"]

[workspace.package]
version = "0.1.0"
edition = "2021"
rust-version = "1.80"
license = "MIT OR Apache-2.0"
authors = ["Brahman Contributors"]
publish = false
repository = "https://example.invalid/brahman"

[workspace.dependencies]
# === Serialización ===
serde = { version = "1", features = ["derive"] }
serde_json = "1"
serde-big-array = "0.5"
postcard = { version = "1", features = ["use-std"] }
toml = "0.8"
ron = "0.8"
bincode = "1"
base64 = "0.22"

# === Errores ===
thiserror = "2"           # bump uniforme; arje (era 1) puede requerir ajustes menores
anyhow = "1"

# === Async ===
tokio = { version = "1", features = ["full"] }
tokio-util = { version = "0.7", features = ["compat"] }
async-trait = "0.1"
futures = "0.3"

# === Observabilidad ===
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] }

# === Linux primitives (arje) ===
nix = { version = "0.29", features = ["signal", "process", "sched", "mount", "fs", "socket", "net", "user"] }
libc = "0.2"

# === IDs / Hash / Crypto ===
ulid = { version = "1", features = ["serde"] }
uuid = { version = "1", features = ["v4"] }
sha2 = "0.10"
blake3 = "1.5"
ed25519-dalek = "2"
aes-gcm = "0.10"
argon2 = "0.5"
rand = "0.8"

# === WASM (arje) ===
# wasmi 1.0: unifica la versión con renaser (su kernel ya corre 1.0), para
# que el ABI WASM del host sea idéntico en Linux y en bare-metal.
wasmi = "1.0"
wat = "1"

# === Storage / DB ===
sled = "0.34"
rusqlite = { version = "0.31", features = ["bundled", "blob"] }

# === P2P (minga) ===
libp2p = { version = "0.56", features = ["tokio", "tcp", "noise", "yamux", "macros", "kad", "identify"] }
libp2p-stream = "=0.4.0-alpha"
libp2p-allow-block-list = "0.6"

# === SSH (brahman-ssh-multiplex, sandokan RemoteEngine, matilda) ===
russh = "0.54"

# === Math determinista cross-platform (dominium) ===
libm = "0.2"

# === Code parsing (minga) ===
tree-sitter = "0.24"
tree-sitter-rust = "0.23"
tree-sitter-python = "0.23"
tree-sitter-typescript = "0.23"
tree-sitter-javascript = "0.23"
tree-sitter-go = "0.23"

# === FS notify ===
notify = "6.1"

# === FUSE (minga-vfs) ===
# default-features = false: prescinde de pkg-config/libfuse-dev en build.
# El montaje pasa a ser Rust puro (vía el helper `fusermount3` en runtime).
fuser = { version = "0.15", default-features = false }

# === CLI / auth (minga) ===
clap = { version = "4", features = ["derive"] }
rpassword = "7"

# === PAM (brahman-auth) ===
pam = "0.8"

# === D-Bus (arje compat) ===
zbus = { version = "4", default-features = false, features = ["tokio"] }

# === Tests ===
tempfile = "3"

# === GPUI (nahual) ===
gpui = "0.2"

# === Filesystem helpers ===
directories = "5"

# === WASM web (gioser) ===
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
js-sys = "0.3"
web-sys = "0.3"
glam = "0.30"

# === Markdown (pluma) ===
pulldown-cmark = { version = "0.12", default-features = false, features = ["html"] }

# ============================================================
# Intra-workspace deps de nahual (referenciadas por workspace = true)
# ============================================================
nahual-core = { path = "crates/modules/nahual/libs/core" }
nahual-theme = { path = "crates/modules/nahual/libs/theme" }
nahual-bus = { path = "crates/modules/nahual/libs/bus" }
nahual-provider-fs = { path = "crates/modules/nahual/libs/providers/fs" }
nahual-provider-sqlite = { path = "crates/modules/nahual/libs/providers/sqlite" }
nahual-widget-tree = { path = "crates/modules/nahual/widgets/tree" }
nahual-widget-container-core = { path = "crates/modules/nahual/widgets/container_core" }
nahual-widget-splitter = { path = "crates/modules/nahual/widgets/splitter" }
nahual-widget-tabs = { path = "crates/modules/nahual/widgets/tabs" }
nahual-widget-tiled = { path = "crates/modules/nahual/widgets/tiled" }
nahual-widget-text-input = { path = "crates/modules/nahual/widgets/text_input" }
nahual-file-explorer = { path = "crates/apps/nahual-file-explorer" }
nahual-database-explorer = { path = "crates/apps/nahual-database-explorer" }
nahual-text-viewer = { path = "crates/apps/nahual-text-viewer" }
nahual-image-viewer = { path = "crates/apps/nahual-image-viewer" }

# ============================================================
# Intra-workspace deps de pineal (módulo de gráficos)
# ============================================================
pineal-core = { path = "crates/modules/pineal/core" }
pineal-render = { path = "crates/modules/pineal/render" }
pineal-cartesian = { path = "crates/modules/pineal/cartesian" }
pineal-stream = { path = "crates/modules/pineal/stream" }
pineal-mesh = { path = "crates/modules/pineal/mesh" }
pineal-financial = { path = "crates/modules/pineal/financial" }
pineal-polar = { path = "crates/modules/pineal/polar" }
pineal-heatmap = { path = "crates/modules/pineal/heatmap" }
pineal-treemap = { path = "crates/modules/pineal/treemap" }
pineal-flow = { path = "crates/modules/pineal/flow" }
pineal-phosphor = { path = "crates/modules/pineal/phosphor" }
pineal-export = { path = "crates/modules/pineal/export" }
pineal = { path = "crates/modules/pineal/umbrella" }

[profile.release]
lto = "thin"
codegen-units = 1
strip = "symbols"
panic = "abort"

[profile.dev]
opt-level = 0
# `line-tables-only` mantiene stack traces con archivo:línea correctos
# pero descarta el resto de symbols. Reduce target/ ~40% sin sacrificar
# debugging real para nuestro flujo (no usamos gdb sobre estos crates).
debug = "line-tables-only"
split-debuginfo = "unpacked"
incremental = true
# Más codegen-units = más paralelismo + builds incrementales más chicas
# (cada cambio re-compila menos). Default es 256 en dev pero lo
# anclamos para evitar regresiones.
codegen-units = 256

# Override puntual para deps grandes que NO debuggeamos: gpui, ort,
# fastembed, tokenizers, image. Subir opt-level acá hace que sus libs
# pesen menos en target/ (símbolos descartados durante la build).
[profile.dev.package."*"]
opt-level = 0
debug = "line-tables-only"

[profile.dev.package.gpui]
opt-level = 1
debug = false

[profile.dev.package.ort]
opt-level = 1
debug = false

[profile.dev.package.fastembed]
opt-level = 1
debug = false

[profile.dev.package.tokenizers]
opt-level = 1
debug = false

[profile.dev.package.image]
opt-level = 1
debug = false
