Description
The Dotabase Behavior Automation Engine runs 39 built-in behaviors over row, schema, and event lifecycle hooks according to each Dotabase's bindings.
At dispatch time the engine resolves enabled definitions, parses each binding with the behavior's configuration schema, and invokes the matching hook with tenant-scoped services. Every behavior returns a typed envelope of property changes, events, deferrals, or no-op outcomes. Execution is isolated per definition, so one failed enrichment is recorded without preventing unrelated deterministic or notification work from running.
Selling Points
- Isolates failures so one automation cannot break the rest.
- Defers cleanly when optional AI or provider seams are absent.
- Supports configuration and development-time runtime registration.
- Gives all built-ins one lifecycle, cost, event, and result discipline.
- Lets each Dotabase opt into automation without owning a job framework.
User Story
As a database owner, I enable enrichment and governance workflows per Dotabase without building a custom job system. I select shipped behaviors, add their typed bindings, and choose the lifecycle moments that matter for my data. Row or schema activity reaches the engine, which runs each eligible definition independently and returns bounded effects to the authoritative service layer. I walk away with observable automation whose failures and provider deferrals do not compromise the original write.
Extension Surface
Extensible: definitions can be registered at composition boot, while production distribution of persisted third-party behavior code remains deferred.
packages/dotabases/src/behaviors/registry.ts contains the frozen built-in roster and a guarded runtime overlay for non-colliding registrations. packages/dotabases/src/behaviors/types.ts is the developer contract for hooks, contexts, configuration, and results. Extensions must be registered by trusted composition code; persisted customer-authored executables are not loaded.
Capabilities & Limits
- Capability: Executes the scoped workflow described above through the cited live implementation paths.
- Capability: Preserves typed validation and applicable tenant, schema, lifecycle, or service boundaries.
- Limit: Six hooks and typed result envelopes constrain behavior effects. Runtime registrations are process-local. The engine supports row, schema, and event-driven work, per-binding configuration, optional provider seams, failure isolation, and deterministic ordering over the registry. It cannot turn an arbitrary script stored in a row into production code, and it does not guarantee an optional provider will be available. Durable writes and external notifications remain owned by injected services and consumers.
Implementation Map
packages/dotabases/src/behaviors/engine.tspackages/dotabases/src/behaviors/registry.tspackages/dotabases/src/behaviors/types.ts