Coordination
Compute
Workflow step that evaluates Blue Expression Objects (BEX): deterministic programs written as Blue data. Compute is for logic that should live inside the document instead of host code. A Compute step can read a Blue document view, host-provided bindings, constants, variables, prior workflow results, the triggering event, and the current contract; then it can compute structured Blue-compatible data such as booleans, numbers, strings, objects, lists, patch changesets, event payloads, validation results, and policy decisions. BEX is not JavaScript, WASM, a network runtime, an LLM extension point, or a contract processor. It has no ambient time, randomness, filesystem, network, database, asynchronous execution, or hidden mutable state in the core language. Host capabilities are available only through explicitly registered `$intrinsic` processors identified by BlueId. A BEX program does not mutate the document or perform external actions. It computes a deterministic result; the host decides how to use that result, and document mutation still requires Update Document or processor patch semantics. A BEX program is a Blue object tree. An object with exactly one key beginning with `$` is an operator. Objects with ordinary keys are literal Blue-compatible objects whose children are evaluated recursively. Lists and scalar values are literals unless nested inside an operator body. Because BEX programs are Blue data, they participate in the same content identity and BlueId model as the documents that carry them. BEX supports data access operators (`$document`, `$binding`, `$event`, `$steps`, `$currentContract`, `$var`, `$const`, `$get`), type helpers (`$unwrap`, `$is`, `$kind`, `$isKind`, `$text`, `$integer`, `$number`, `$boolean`, `$object`, `$list`), string and pointer operators (`$concat`, `$join`, `$split`, `$startsWith`, `$sliceAfter`, `$pointerJoin`), logic and comparison (`$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$and`, `$or`, `$not`, `$truthy`, `$empty`, `$isEmpty`, `$exists`, `$coalesce`, `$default`), numeric operators (`$add`, `$subtract`, `$multiply`, `$divide`), object/list operators (`$keys`, `$entries`, `$size`, `$listGet`, `$listConcat`, `$merge`, `$objectSet`, `$pointerGet`, `$pointerSet`, `$map`, `$filter`, `$flatMap`, `$reduce`, `$some`, `$find`, `$findEntry`, `$includes`, `$hasKey`, `$objectFromEntries`), conditionals (`$choose`), functions (`$call`), host extensions (`$intrinsic`), literal/null/empty constructors (`$literal`, `$null`, `$emptyObject`, `$emptyList`), result helpers (`$changeset`, `$events`, `$resultValue`), and deterministic failure/early-return helpers (`$returnIf`, `$fail`, `$failIf`). BEX statements include `$let`, `$set`, `$if`, `$forEach`, `$appendChange`, `$appendChanges`, `$appendEvent`, `$appendEvents`, `$call`, `$return`, `$returnIf`, `$fail`, and `$failIf`. `$let` may bind one variable or a `vars` block. Without `order`, multi-bind variables are parallel and read the old frame. With `order`, bindings are sequential and later bindings may read earlier ones. `$forEach` iterates lists in item order and objects in sorted key order; it may bind item, key, and index variables. `$document` reads the canonical document view by default and may explicitly read the resolved view when the host exposes one. In a Blue Contracts workflow, BEX should read from the frozen processing snapshot or frozen working document. If a prior Update Document step has previewed patches in the same sequential workflow, later Compute steps should observe those previewed changes through the working document while the actual processor commit remains buffered. This preserves read-your-writes behavior without materializing the whole document. BEX function arguments can declare Blue patterns. Patterns are static Blue data, not BEX expressions. Runtime values are checked with Blue's node/type matcher. BEX does not have a separate nominal type enum; it uses Blue patterns, BlueIds, and Blue language matching. Name containers such as `functions`, `constants`, `args`, and `$call.args` must not use Blue reserved keys or invalid reserved names as user-defined identifiers. Evaluation is deterministic and gas-metered. BEX gas charges expression/value construction work: compilation, operator evaluation, reads, conversions, loops, collection operations, patch construction, event construction, intrinsic calls, and output conversion. Blue Contracts separately charges actual patch application, Document Update cascades, emitted-event routing, checkpoints, lifecycle, termination, and processor state changes. BEX gas therefore accounts for computing result data, not for committing that data to the document.
9oGn8V6FSVcJYhRfuHRShfWjiHBUqzxVi9StGtHZNfev:Coordination/Sequential Workflow Step8DSFoWG9MqRSUhStqoPLrwVQiYByRh18NWbDEarN8MKF:8DSFoWG9MqRSUhStqoPLrwVQiYByRh18NWbDEarN8MKFGX7CFUmSDrE2MzptunLCCdZwnuwwrenRQqEnHL4x3uoC:GX7CFUmSDrE2MzptunLCCdZwnuwwrenRQqEnHL4x3uoCEfkz9D1ARMM7rU43w3rDNVqat1naS6qXKCqP4eHin3yG:Efkz9D1ARMM7rU43w3rDNVqat1naS6qXKCqP4eHin3yGAwvXD961fmnmqcSQhjMA7r15HpVh39cefb6ZTyUz2Fm2:AwvXD961fmnmqcSQhjMA7r15HpVh39cefb6ZTyUz2Fm2E2LM6qgzWG9ttagq2xTmiZkgYEAgkYedFCmU9v7NnVEq:E2LM6qgzWG9ttagq2xTmiZkgYEAgkYedFCmU9v7NnVEq