/** * The order path at step 9: what the run's ledger is built from, and what an * applied order call becomes. * * Two things live here rather than in the bar cycle, because neither is about * the cycle. **A ledger is built from the declaration**, whose `product`, * `qtyType` and `qty` are fixed before bar 0 like every other declaration * field, and **an order call becomes intents** at the one step that is allowed * to reach the outside world. * * The ledger module knows nothing about a compiled program, which is what keeps * the fold of a frame free of the shape of the file it came from, so the * reading of the declaration is here, on the engine's side of that door. */ import type { Diagnostic } from '../diagnostics/index.js'; import type { PendingEffect } from './channels.js'; import type { EffectRoute, RoutedEffect } from './host.js'; import type { Instrument } from './host.js'; import type { ResolvedInput } from './inputs.js'; import { Ledger } from './ledger/index.js'; import type { IntentBar } from './ledger/index.js'; import type { CompiledProgram } from './types.js'; export declare function ledgerFor(program: CompiledProgram, inputs: readonly ResolvedInput[], instrument: Instrument | undefined): Ledger; /** What one bar's step 9 did with its order calls. */ export interface AppliedOrders { /** The effects the bar applied, each carrying what it sent. */ readonly effects: readonly RoutedEffect[]; /** Why the bar sent nothing at all, where an order was refused. */ readonly refusal: Diagnostic | undefined; } /** * The effects a bar applied, mapped and then routed. * * An order call becomes intents here and nowhere else, because the ledger is * what mints the id every frame about the order carries back, and a call an * execution threw away never reached this step at all. * * **Mapping the whole bar and routing it are two passes, and that is what keeps * a refused order away from the destination.** A rule like OS7013 is about two * calls at once, so the second call is what refuses the pair, and a loop that * routed each call as it mapped it would already have sent the first. Every * call is therefore mapped before any of them is handed over, and a refusal * anywhere on the bar hands over none of them. * * **Which is why a refusal here discards the bar's rows.** Mapping a call * appends its row, because the calls after it on the same bar are measured * against the rows before them: a cancellation asks whether a tag is working, a * close asks what one tag entered, and pyramiding counts what a position * already holds. So the rows of a bar that is then refused have to be taken * back, or `engine.orders()` reports an order at `placed` that no destination * was ever handed, and a host reconciling after a stopped run sees an order it * never received. The bar's intents and the bar's rows cannot disagree, because * they are made and unmade together. */ export declare function routedEffects(ledger: Ledger, applied: readonly PendingEffect[], at: IntentBar, route: EffectRoute | undefined): AppliedOrders; //# sourceMappingURL=orders.d.ts.map