@parmana/runtime is the composition layer between policy, storage, and crypto. packages/api depends on it directly and on almost nothing else at this level — see Packages Overview for the full call chain from an HTTP request down to this package.
Entry points
packages/runtime/src/index.ts exports, among others:
ExecutionTrustApplication— the top-level orchestrator.execute()runs accept → execute → verify → generate receipt → return the trust record, in that order, as four sequentialawaits (not a single pipeline object).RuntimeFactory—RuntimeFactory.create(transactions, trustRecords, policyRepository)wires up all four application services (BusinessTransactionService,ExecutionService,VerificationService,ReceiptService) and aRuntime, and returns a readyExecutionTrustApplication. This is exactly whatpackages/api/src/application.tscalls.RuntimeBuilder— builder used internally byRuntimeFactoryto assemble aRuntimefrom a list ofRuntimeComponents plus aPolicyRepository.Runtime— a thin façade overRuntimeEngine; its ownexecute()persists the resulting trust record viaExecutionTrustRecordRepository.create().
What’s actually in the pipeline
RuntimeFactory.create only adds two components to the RuntimeBuilder:
RuntimeEngine (constructed inside RuntimeBuilder.build) additionally composes PolicyRouter, PolicyEngine (both from policy), DecisionBuilder, ExecutionGate, ExecutionBuilder, and ExecutionTrustPipeline — the latter only assembles the final ExecutionTrustRecord from whatever’s already in its RuntimeContext (transaction, execution, optional override/verification/receipt); it contains no business rules of its own.
Application services
packages/runtime/src/services/:
| Service | Responsibility |
|---|---|
BusinessTransactionService | Accepts and persists a new BusinessTransaction. |
ExecutionService | Creates, completes, and fails Execution artifacts — does not evaluate policy or build Decisions itself. |
VerificationService | Calls VerificationCrypto.verify() from crypto and persists a Verification. |
ReceiptService | Requires the latest Verification to be VERIFIED, then calls ReceiptCrypto to build and persist a Receipt. |
ExecutionTrustApplication methods, which call these services directly.
Related
Execution Lifecycle
The domain-level version of this flow.
Runtime Pipeline
Component-level detail, including the gap above.
Runtime Architecture
How this package fits the broader system.
api
The only consumer of
RuntimeFactory.