ADR 011: PanelProvider y plugins host¶
Estado¶
Aceptado — 2026-06
Contexto¶
ADR 004 introdujo multi-panel con hook register_panels() en plugins de negocio. Eso mezclaba identidad del panel (path, auth, branding) con módulos de dominio y obligaba a un plugin monolítico (shells) para varios panels.
Cortex necesita el mismo orden de boot: host primero, negocio después.
Decisión¶
- Contratos en
core(PanelConfiguration,PanelBrand,PanelTheme) yframework/cortex_framework/panel(PanelBuilder,PanelProvider). - Entry point
cortex.panelsseparado decortex.plugins. Cada plugin host exportaconfigure_panel(builder). - Orden de carga en
load_plugins(): load_panel_hosts()→PanelRegistry+ módulohomestub- plugins de negocio (
cortex.plugins) →register_dashboards/register_forms validate_panels()- Cuatro hosts fijan namespace y shell (portal B2C futuro: host aparte, sin colisión con el módulo
clients):
| Panel | Plugin host | API namespace |
|---|---|---|
| Operación | plugins/panel | operations |
| Entrenador | plugins/trainer | trainer |
| Contabilidad | plugins/accounting | accounting |
| Control | plugins/control | control |
Nota: El módulo de negocio clientes (
plugins/clients, API/api/v1/clients/) no es un panel host; registra recursos enoperations/admin. Un portal self-service para el cliente final, si se necesita, será un host con id distinto (p. ej.customer-portal).
- Negocio contable en
plugins/ledger(cortex.plugins), montado sobrepanel_id=accountingcon API/api/v1/ledger/. register_panelsen negocio queda deprecado (warning); solo hosts y legacyreference/samples.GET /api/v1/panels/{id}incluye bloqueconfiguration(brand, theme, defaultRoute) para el shell React.
Leyenda: Orden de boot: hosts → plugins → validación. Actores: entry points, registries, loader. Estado: Implementado.
flowchart TB
EP[cortex.panels + cortex.plugins]
LH[load_panel_hosts configure_panel]
LP[load_plugins register_resources]
VP[validate_panels]
EP --> LH --> LP --> VP Conceptos del panel host¶
| Concepto | Cortex |
|---|---|
| Id del panel | builder.id() |
| Ruta base UI | builder.path() |
| Autenticación | builder.auth(scopes=...) |
| Marca | builder.brand() |
| Módulos de negocio | plugins vía register_resources / register_dashboards |
| Ruta por defecto | builder.default_route() |
Consecuencias¶
plugins/shellseliminado; UI migrada a hosts.CORTEX_ENABLED_PANELScontrola hosts;CORTEX_ENABLED_PLUGINSincluye hosts (para workspace) y negocio.- Frontend (
PanelShell) leeconfigurationde la API en lugar de valores hardcodeados.
Referencias¶
- ADR 004 — multi-panel
- Plan PanelProvider (2026-06)