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,37 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"database/sql/driver"
|
||||
|
||||
moderncsqlite "modernc.org/sqlite"
|
||||
)
|
||||
|
||||
func init() {
|
||||
// mautrix dbutil opens sqlite as "sqlite3"; register the pure-Go driver
|
||||
// under that name. We add a connection hook that sets WAL mode and a
|
||||
// busy timeout on every connection to prevent SQLITE_BUSY crashes during
|
||||
// concurrent writes (crypto store sync + memory store).
|
||||
d := &moderncsqlite.Driver{}
|
||||
d.RegisterConnectionHook(sqlitePragmaHook)
|
||||
sql.Register("sqlite3", d)
|
||||
}
|
||||
|
||||
// sqlitePragmaHook sets WAL journal mode and a 5-second busy timeout on
|
||||
// every new SQLite connection. This prevents SQLITE_BUSY errors when
|
||||
// multiple goroutines write concurrently (e.g. mautrix crypto sync +
|
||||
// memory/knowledge stores).
|
||||
func sqlitePragmaHook(conn moderncsqlite.ExecQuerierContext, _ string) error {
|
||||
ctx := context.Background()
|
||||
pragmas := []string{
|
||||
"PRAGMA journal_mode=WAL",
|
||||
"PRAGMA busy_timeout=5000",
|
||||
}
|
||||
for _, p := range pragmas {
|
||||
if _, err := conn.ExecContext(ctx, p, []driver.NamedValue{}); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user