DECCF · Cash Flow Modeler and Calculator

Packs

Packs group reusable declarations, calculations, and account metadata. The repository's available packs are under domainpacks/.

Build a pack

definePack takes a short lowercase name, a semantic version, and a synchronous extract function. The function receives a frozen model and a frozen api of core factories, then returns declaration maps. extractPacks sorts packs by name and version and adds their declarations without replacing existing keys. This extracts declarations from the pack's higher-level domain abstraction into the model.

Declare, validate, and read required inputs explicitly from the model context. Namespaced keys reduce collisions. If packs claim the same declaration key, extraction fails with DECCF_PACK_CONFLICT.

Determinism

A pack should produce the same declarations for the same model. The core checks this by calling extract twice with the same frozen context and comparing a canonical representation. It raises DECCF_NON_DETERMINISTIC_PACK if the declarations differ.

Pack code must not use the clock, randomness, network, or external I/O APIs. The core checks source code for common ambient APIs and inspects functions in pack declarations. Packs must be synchronous. Declaration maps and published result ordering are stable; flow distributor step order is preserved because it sets priority.

JavaScript functions can capture values outside their parameter list. Packs execute as trusted programs in the same process. Keep extract pure: build declarations from frozen inputs, do not read global state, write externally, or add results that depend on call order.

Versioning

A pack's version is part of its extraction input and should change whenever its generated model behavior changes. The model and sorted declarations provide a review surface for its output. Keep pack-specific validation and calculation rules in the pack.