feat(infra): auto-commit con 86 cambios

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-26 19:38:15 +02:00
parent 34c27876e0
commit 621e8895c9
85 changed files with 11840 additions and 92 deletions
+2
View File
@@ -41,6 +41,8 @@ Indice de grupos de capacidades del registry. Cada grupo agrupa >=3 funciones qu
| [agents](agents.md) | 3 | Orquestar agentes Claude headless en git worktrees: launch, cleanup, DoD evidence schema audit |
| [backends](backends.md) | — | Stacks backend (Go net/http+SQLite default, MCP, mautrix, bubbletea, httpx, docker-compose): decision tree + esqueleto canonico + funciones del registry a componer |
| [kanban](kanban.md) | 5 | Parser/writer/scanner/watcher de dev/issues/ y dev/flows/: base del backend kanban_cpp v2 |
| [wireguard](wireguard.md) | 7 | Instalar, configurar, operar y monitorizar mesh WireGuard hub-and-spoke: keygen, hub setup, peer add/revoke, status JSON |
| [matrix-mas](matrix-mas.md) | 5 | Migración Synapse→MAS: habilitar MSC3861, verificar login flows, parche .well-known, registro clientes OAuth2, syn2mas |
## Como anadir grupo
+82
View File
@@ -0,0 +1,82 @@
# wireguard — Capability Group
Instalar, configurar, operar y monitorizar un mesh WireGuard hub-and-spoke desde Go y Bash.
## Funciones
| ID | Firma corta | Que hace |
|---|---|---|
| `wg_install_bash_infra` | `wg_install() -> json` | Instala wireguard-tools en Linux (debian/ubuntu/fedora/arch). Idempotente. |
| `wg_keygen_go_infra` | `WGKeygen(withPSK bool) (WGKeys, error)` | Genera par de claves Curve25519 (privada+publica+opcional PSK). |
| `wg_hub_setup_bash_infra` | `wg_hub_setup(private_key, subnet_cidr, listen_port) -> json` | Configura el host como hub: crea wg0.conf, abre firewall, habilita ip_forward, arranca wg-quick@wg0. Idempotente. |
| `wg_client_install_bash_infra` | `wg_client_install(config_path_or_stdin, [iface]) -> json` | Device-side: instala wg0.conf, habilita wg-quick, verifica handshake con hub. |
| `wg_peer_remove_go_infra` | `WGPeerRemove(deviceID, configPath string) (WGPeerRemoveResult, error)` | Quita peer del hub por device_id, syncconf en caliente. Idempotente. |
| `wg_peer_revoke_go_infra` | `WGPeerRevoke(deviceID, operator, reason, configPath, auditDBPath string) (WGPeerRevokeAudit, error)` | Kill switch: revoca peer permanentemente con audit log hash-chained. |
| `wg_status_bash_infra` | `wg_status([interface_name]) -> json` | Parsea `wg show <iface> dump` a JSON con peers, handshake age, status (online/stale/never), bytes rx/tx, device_id. |
## Ejemplo canonico — setup completo de un nodo nuevo
```bash
# 1. Instalar wg en el hub (si no esta instalado)
source bash/functions/infra/wg_install.sh
wg_install | jq .version
# 2. Generar claves para el hub
# (via Go — requiere wg binary)
./fn run wg_keygen_go_infra
# 3. Configurar hub
source bash/functions/infra/wg_hub_setup.sh
wg_hub_setup "$HUB_PRIVATE_KEY" "10.42.0.0/24" 51820 | jq .
# 4. Instalar config en cliente (acepta stdin para pipes)
source bash/functions/infra/wg_client_install.sh
wg_client_install /path/to/wg0.conf | jq .handshake_ok
# 5. Ver estado del mesh
source bash/functions/infra/wg_status.sh
wg_status wg0 | jq .peers[].status
```
## Ejemplo canonico — monitorizar mesh (dashboard / agents_dashboard Mesh panel)
```bash
source bash/functions/infra/wg_status.sh
# Peers online
wg_status | jq '[.peers[] | select(.status=="online")] | length'
# Tabla compacta: device_id, status, ago
wg_status | jq -r '.peers[] | [.device_id, .status, (.latest_handshake_ago_s|tostring)+"s"] | @tsv'
# Testing sin sudo (WG_FAKE_DUMP + WG_FAKE_CONF)
WG_FAKE_DUMP=fixtures/dump.tsv WG_FAKE_CONF=fixtures/wg0.conf wg_status wg0 | jq .
```
## Ejemplo canonico — revocar peer comprometido
```bash
# Quitar peer de wg0.conf (sin audit log)
./fn run wg_peer_remove_go_infra -- --device-id pc-comprometido --config /etc/wireguard/wg0.conf
# Kill switch con audit log inviolable
./fn run wg_peer_revoke_go_infra -- \
--device-id pc-comprometido \
--operator lucas \
--reason "dispositivo perdido" \
--config /etc/wireguard/wg0.conf \
--audit-db /var/lib/wg/audit.db
```
## Fronteras
- **No cubre**: gestión de DNS WireGuard, split-tunnel avanzado, integración con cloud providers (AWS VPC, Tailscale).
- **No cubre**: rotación automática de claves (cron + wg_keygen + wg_hub_setup es la composición manual).
- **No cubre**: UI web para el mesh — `wg_status` provee el JSON que consume `agents_dashboard`.
- `nordvpn_set_protocol_bash_infra` usa WireGuard internamente (NordLynx) pero no pertenece a este grupo — opera NordVPN, no un mesh propio.
## Prerequisitos
- `wireguard-tools` instalado en el host (usar `wg_install_bash_infra`).
- `wg show` requiere `CAP_NET_ADMIN` / root. Para tests: `WG_FAKE_DUMP` + `WG_FAKE_CONF`.
- Comentarios `# DeviceID:<id>` antes de cada `[Peer]` en `/etc/wireguard/wg0.conf` para resolver `device_id` en `wg_status`.
+22
View File
@@ -0,0 +1,22 @@
# Issues — fn_registry / agent-wsl-lucas
## [ISSUE-001] Agentes no pueden enviar fotos/capturas de pantalla
**Fecha:** 2026-05-25
**Reportado por:** @egutierrez
**Severidad:** Media
### Descripción
Los agentes (agent-wsl-lucas y similares) no tienen acceso a las tools `screenshot` y `browser.screenshot` en su entorno de ejecución. Tampoco existe mecanismo de file transfer directo desde el agente al chat Matrix.
### Impacto
No es posible capturar y enviar imágenes de pantalla desde el agente al operador directamente en el room.
### Workaround actual
Ejecutar `scrot`, `import` (ImageMagick) u otra herramienta via `exec` para guardar la captura en un path local (`/tmp/` o `~/`), y que el operador acceda al archivo manualmente.
### Requisitos para solución
- Habilitar tool `screenshot` en el manifest del device_agent (`wsl-lucas.yaml`), o
- Implementar mecanismo de upload/transfer de archivos binarios desde el agente al room Matrix.
### Estado
Abierto