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
+76
View File
@@ -0,0 +1,76 @@
package decision
import (
"strings"
)
// Rule maps a condition to a set of actions.
type Rule struct {
Name string
Match MatchFunc
Actions []Action
}
// MatchFunc is a pure predicate over a MessageContext.
type MatchFunc func(ctx MessageContext) bool
// Evaluate runs all rules against the context and returns the matching actions. Pure.
func Evaluate(ctx MessageContext, rules []Rule) []Action {
var actions []Action
for _, rule := range rules {
if rule.Match(ctx) {
actions = append(actions, rule.Actions...)
}
}
return actions
}
// MatchCommand returns a MatchFunc that matches when the command equals cmd.
func MatchCommand(cmd string) MatchFunc {
return func(ctx MessageContext) bool {
return strings.EqualFold(ctx.Command, cmd)
}
}
// MatchPrefix returns a MatchFunc that matches when content starts with prefix.
func MatchPrefix(prefix string) MatchFunc {
return func(ctx MessageContext) bool {
return strings.HasPrefix(ctx.Content, prefix)
}
}
// MatchAny returns a MatchFunc that matches any message.
func MatchAny() MatchFunc {
return func(_ MessageContext) bool { return true }
}
// MatchMinPowerLevel returns a MatchFunc that requires a minimum Matrix power level.
func MatchMinPowerLevel(level int) MatchFunc {
return func(ctx MessageContext) bool {
return ctx.PowerLevel >= level
}
}
// And composes multiple MatchFuncs with logical AND.
func And(fns ...MatchFunc) MatchFunc {
return func(ctx MessageContext) bool {
for _, fn := range fns {
if !fn(ctx) {
return false
}
}
return true
}
}
// Or composes multiple MatchFuncs with logical OR.
func Or(fns ...MatchFunc) MatchFunc {
return func(ctx MessageContext) bool {
for _, fn := range fns {
if fn(ctx) {
return true
}
}
return false
}
}