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
+77
View File
@@ -0,0 +1,77 @@
package logger
import (
"context"
"encoding/json"
"log/slog"
"os"
"path/filepath"
"testing"
)
func TestNewAgentLogger_WritesJSONL(t *testing.T) {
dir := t.TempDir()
l, cleanup, err := NewAgentLogger(LoggerConfig{
BaseDir: dir,
AgentID: "test-bot",
Level: slog.LevelDebug,
})
if err != nil {
t.Fatal(err)
}
defer cleanup()
l.Info("hello world", FieldAction, "greet", FieldReason, "testing")
// Force flush by closing.
cleanup()
files, _ := os.ReadDir(filepath.Join(dir, "test-bot"))
if len(files) == 0 {
t.Fatal("expected at least one log file")
}
data, err := os.ReadFile(filepath.Join(dir, "test-bot", files[0].Name()))
if err != nil {
t.Fatal(err)
}
var m map[string]any
if err := json.Unmarshal(data, &m); err != nil {
t.Fatalf("log line is not valid JSON: %s", data)
}
if m["msg"] != "hello world" {
t.Errorf("msg = %v, want hello world", m["msg"])
}
if m[FieldAgentID] != "test-bot" {
t.Errorf("agent_id = %v, want test-bot", m[FieldAgentID])
}
if m[FieldAction] != "greet" {
t.Errorf("action = %v, want greet", m[FieldAction])
}
}
func TestNewAgentLogger_Stdout(t *testing.T) {
l, cleanup, err := NewAgentLogger(LoggerConfig{
BaseDir: "stdout",
AgentID: "dev-bot",
})
if err != nil {
t.Fatal(err)
}
defer cleanup()
// Just verify it doesn't panic.
l.Info("stdout test")
}
func TestTraceIDContext(t *testing.T) {
ctx := context.Background()
if got := TraceIDFromCtx(ctx); got != "" {
t.Errorf("empty ctx should return empty trace, got %q", got)
}
ctx = WithTraceID(ctx, "abc-123")
if got := TraceIDFromCtx(ctx); got != "abc-123" {
t.Errorf("trace = %q, want abc-123", got)
}
}