Skip to content

Function: registerDrizzleTurnStorage()

Makaio Framework


Makaio Framework / services-core / registerDrizzleTurnStorage

registerDrizzleTurnStorage(bus, db, _ctx): () => void

Defined in: ../../../packages/services/core/src/session/turns/drizzle-handler.ts:61

Register Drizzle-based turn storage handlers.

Manages turn lifecycle in SQLite/libSQL via Drizzle ORM.

CONCURRENCY INVARIANT: All handlers must use single-statement operations only. Storage handlers share a single DB connection. Fire-and-forget bus events (e.g., agent.added) race with sequential RPC handlers (e.g., turn.create). db.transaction() holds write locks across await boundaries, causing SQLITE_BUSY deadlocks on the same connection. Single statements serialize automatically via SQLite’s busy_timeout + WAL mode.

IMakaioBus

The bus instance to register handlers on

MakaioDatabase

The Drizzle database instance

ExtensionContext

Extension context (unused; reserved for future use)

Cleanup function to unsubscribe all handlers

() => void