Blueprint & Codeblocks
Minerva isolates custom business logic within Codeblocks. A codeblock is a secure snippet of TypeScript authored by you or AI Commander, stored directly in the Blueprint, and executed dynamically.
The Execution Pipeline
When a codeblock needs to run, Minerva:
- Resolves the codeblock location in the Blueprint
- Generates typed virtual
data.d.tsandexternal.d.tsfiles - Compiles and lints the code
- Executes the result in a fresh QuickJS sandbox
- Validates the return value against strategy rules
Host Functions
The sandbox injects asynchronous host functions via the global query object:
query.listRecords(...)query.getRecord(...)
By default, these run within the requestor scope so RBAC and field redaction are enforced.
Common Codeblock Types
CUSTOM/FORMDOMAIN_VALIDATORIMPORT_TRANSFORM/EXPORT_TRANSFORMAUDIENCE_MATRIXMESSAGE_TEMPLATEWEB_AUTOMATION
CEL Expressions
For simpler logic, Minerva uses CEL rather than full TypeScript. CEL is a good fit for permission conditions, record labels, notification subjects, and lightweight Dynamic UI expressions.
Choosing Between CEL and TypeScript
Use CEL when you need a single expression. Use TypeScript when you need async work, branching, iteration, or a full UI or HTML output.