feat: import agents_and_robots platform as unibots (Matrix-out, unibus transport)

Reemplaza el scaffold del echobot por la plataforma completa de bots traida
desde ~/DataProyects/Github/agents_and_robots tras la operacion Matrix-out:
los bots ya no hablan por Matrix sino por el bus unibus (modelo todo-rooms +
E2E via shell/transportunibus sobre github.com/enmanuel/unibus/pkg/client).

- go.mod: replace de unibus -> ../unibus y de fn-registry -> ../../../.. (paths
  relativos reajustados a la nueva ubicacion dentro de fn_registry).
- app.md: bump a 0.2.0, descripcion + arquitectura + comandos + gotchas reales.
- modulo Go conservado como github.com/enmanuel/agents (sin reescribir imports).

agents_and_robots queda archivado como museo de la era Matrix.
This commit is contained in:
agent
2026-06-07 11:50:13 +02:00
parent bb5b0e09b1
commit fc644ecd6e
308 changed files with 38829 additions and 474 deletions
+52
View File
@@ -0,0 +1,52 @@
# Plan: Herramientas para los bots
## Objetivo
Permitir que los bots ejecuten herramientas reales (funciones Go) como respuesta a
decisiones del LLM — patrón function calling / tool use.
## Estado: COMPLETADO
---
## Diseño
### Capa pura (`pkg/tools/`)
- Definir `ToolSpec` con nombre, descripción y esquema JSON de parámetros
- Definir `ToolCallAction` en `pkg/decision/` — acción pura que contiene
`ToolName string` y `Args map[string]any`
- El motor de reglas puede emitir `ToolCallAction` como cualquier otra acción
### Capa shell (`shell/tools/`)
- `Executor` que mapea nombre → función Go real
- Ejecuta la herramienta y devuelve `ToolResult{Output string, Err error}`
- El Runner de `shell/effects/` llama al Executor cuando recibe `ToolCallAction`
### Integración LLM
- `shell/llm/anthropic.go` y `openai.go` ya soportan tool_use / function_calling
- Mapear `[]ToolSpec` al formato nativo de cada proveedor
- Parsear la respuesta del LLM para extraer llamadas a herramientas
### Herramientas iniciales a implementar
| Herramienta | Descripción | Shell |
|-----------------|-------------------------------------|-------------------|
| `http_get` | GET a una URL, devuelve body | `shell/tools/` |
| `http_post` | POST JSON a una URL | `shell/tools/` |
| `ssh_command` | Ejecutar comando remoto por SSH | `shell/ssh/` |
| `read_file` | Leer archivo local | `shell/tools/` |
| `matrix_send` | Enviar mensaje a una sala Matrix | `shell/matrix/` |
---
## Archivos a crear/modificar
- `pkg/tools/spec.go` — ToolSpec, ToolResult
- `pkg/decision/actions.go` — añadir ToolCallAction
- `shell/tools/executor.go` — registro y ejecución de herramientas
- `shell/effects/runner.go` — manejar ToolCallAction
- `shell/llm/anthropic.go` — emitir tools en el request, parsear tool_use blocks
- `shell/llm/openai.go` — idem para function_calling
- `agents/<id>/agent.go` — registrar herramientas por agente
## Notas
- Las herramientas se declaran en `pkg/` (pure spec) pero se implementan en `shell/`
- Un agente solo tiene acceso a las herramientas declaradas en su config
- Respetar `security.allowed_tools` del config YAML