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:
@@ -0,0 +1,91 @@
|
||||
# Template: agent.go
|
||||
|
||||
Plantilla para `agents/<agent-id>/agent.go`. Adaptar segun el tipo de agente.
|
||||
|
||||
## Regla de package name
|
||||
|
||||
El nombre del package se deriva del agent-id:
|
||||
- Eliminar guiones
|
||||
- Eliminar sufijo `_bot` si existe
|
||||
- Ejemplos:
|
||||
- `monitor-bot` → `package monitor`
|
||||
- `asistente-2` → `package asistente2`
|
||||
- `deploy-agent` → `package deployagent`
|
||||
- `my-bot` → `package my`
|
||||
|
||||
## Agente con LLM (estandar)
|
||||
|
||||
Regla basica: DM o mencion → LLM.
|
||||
|
||||
```go
|
||||
package <pkgname>
|
||||
|
||||
import "github.com/enmanuel/agents/pkg/decision"
|
||||
|
||||
// Rules returns the decision rules for the <agent-id> agent.
|
||||
func Rules() []decision.Rule {
|
||||
return []decision.Rule{
|
||||
{
|
||||
Name: "llm-all",
|
||||
Match: func(ctx decision.MessageContext) bool {
|
||||
return ctx.IsDirectMsg || ctx.IsMention
|
||||
},
|
||||
Actions: []decision.Action{{
|
||||
Kind: decision.ActionKindLLM,
|
||||
LLM: &decision.LLMAction{},
|
||||
}},
|
||||
},
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Robot (solo comandos, sin LLM)
|
||||
|
||||
Sin reglas — solo responde a comandos `!xxx`.
|
||||
|
||||
```go
|
||||
package <pkgname>
|
||||
|
||||
import "github.com/enmanuel/agents/pkg/decision"
|
||||
|
||||
// Rules returns no rules — this robot only responds to commands.
|
||||
func Rules() []decision.Rule {
|
||||
return nil
|
||||
}
|
||||
```
|
||||
|
||||
## Reglas avanzadas (solo si el usuario lo pide)
|
||||
|
||||
### Respuesta estatica a DMs
|
||||
|
||||
```go
|
||||
{
|
||||
Name: "dm-greeting",
|
||||
Match: func(ctx decision.MessageContext) bool {
|
||||
return ctx.IsDirectMsg
|
||||
},
|
||||
Actions: []decision.Action{{
|
||||
Kind: decision.ActionKindReply,
|
||||
Reply: &decision.ReplyAction{Content: "Hola, soy <nombre>. Usa !help para ver mis comandos."},
|
||||
}},
|
||||
},
|
||||
```
|
||||
|
||||
### Composicion con And/Or
|
||||
|
||||
```go
|
||||
{
|
||||
Name: "admin-llm",
|
||||
Match: decision.And(
|
||||
func(ctx decision.MessageContext) bool { return ctx.IsDirectMsg },
|
||||
func(ctx decision.MessageContext) bool { return ctx.PowerLevel >= 50 },
|
||||
),
|
||||
Actions: []decision.Action{{Kind: decision.ActionKindLLM, LLM: &decision.LLMAction{}}},
|
||||
},
|
||||
```
|
||||
|
||||
## Reglas estrictas
|
||||
|
||||
- **PURO**: solo imports de `pkg/decision`, cero I/O
|
||||
- **No usar reglas para comandos** — los comandos se gestionan via `RegisterCommand`
|
||||
- ActionKind disponibles: `ActionKindReply`, `ActionKindLLM`
|
||||
Reference in New Issue
Block a user