@orangecharts/wrun-chart-host 0.7.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/README.md +27 -4
  2. package/dist/constants/feature-flags.constants.d.ts +5 -0
  3. package/dist/constants/feature-flags.constants.js +32 -0
  4. package/dist/constants/marketCapabilities.constants.d.ts +14 -9
  5. package/dist/constants/marketCapabilities.constants.js +36 -13
  6. package/dist/constants/opra-compliance.constants.d.ts +14 -0
  7. package/dist/constants/opra-compliance.constants.js +14 -0
  8. package/dist/constants/option-venues.constants.d.ts +29 -6
  9. package/dist/constants/option-venues.constants.js +19 -2
  10. package/dist/constants/venue-presets.constants.d.ts +17 -3
  11. package/dist/constants/venue-presets.constants.js +17 -3
  12. package/dist/host-env.d.ts +34 -4
  13. package/dist/host-env.js +21 -0
  14. package/dist/host-ports.types.d.ts +51 -3
  15. package/dist/index.d.ts +17 -0
  16. package/dist/index.js +17 -0
  17. package/dist/indicators/controls/tpo-session.util.d.ts +40 -11
  18. package/dist/indicators/controls/tpo-session.util.js +138 -14
  19. package/dist/interfaces/opra-realtime.interface.d.ts +13 -11
  20. package/dist/interfaces/opra-realtime.interface.js +10 -10
  21. package/dist/interfaces/option-instrument.interface.d.ts +6 -0
  22. package/dist/interfaces/wrun-runtime.interface.d.ts +34 -13
  23. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +57 -10
  24. package/dist/kscript-data/controls/live-trades-merge.util.js +85 -16
  25. package/dist/market-data/billing.interface.d.ts +138 -17
  26. package/dist/market-data/billing.interface.js +25 -8
  27. package/dist/market-data/venues/index.d.ts +3 -3
  28. package/dist/market-data/venues/opra.contract.copy.json +5 -3
  29. package/dist/market-data/venues/opra.d.ts +3 -3
  30. package/dist/market-data/venues/opra.js +5 -4
  31. package/dist/replay/replayLadder.js +3 -1
  32. package/dist/settings-templates/footprint-rows.d.ts +25 -0
  33. package/dist/settings-templates/footprint-rows.js +127 -0
  34. package/dist/settings-templates/form-rows.d.ts +56 -0
  35. package/dist/settings-templates/form-rows.js +19 -0
  36. package/dist/settings-templates/frvp-fields.js +14 -0
  37. package/dist/settings-templates/index.d.ts +10 -1
  38. package/dist/settings-templates/index.js +11 -2
  39. package/dist/settings-templates/indicator-fields.js +78 -0
  40. package/dist/settings-templates/tool-rules.d.ts +35 -9
  41. package/dist/settings-templates/tool-rules.js +42 -8
  42. package/dist/settings-templates/tool-tables.generated.js +13 -2
  43. package/dist/utility/chart/candle-volume-unit.leaf.d.ts +16 -0
  44. package/dist/utility/chart/candle-volume-unit.leaf.js +61 -0
  45. package/dist/utility/chart/crypto-index.leaf.d.ts +2 -2
  46. package/dist/utility/chart/crypto-index.leaf.js +2 -2
  47. package/dist/utility/chart/footprint-columns.util.d.ts +74 -0
  48. package/dist/utility/chart/footprint-columns.util.js +106 -0
  49. package/dist/utility/chart/footprint-display-mode.util.d.ts +40 -0
  50. package/dist/utility/chart/footprint-display-mode.util.js +62 -0
  51. package/dist/utility/chart/footprint-sierra-look.util.d.ts +2 -0
  52. package/dist/utility/chart/footprint-sierra-look.util.js +37 -0
  53. package/dist/utility/chart/index-mode-admission.util.js +9 -1
  54. package/dist/utility/chart/index-mode.util.d.ts +5 -2
  55. package/dist/utility/chart/index-mode.util.js +23 -13
  56. package/dist/utility/chart/kscript-venue-policy.util.d.ts +28 -21
  57. package/dist/utility/chart/kscript-venue-policy.util.js +34 -26
  58. package/dist/utility/chart/marketKind.util.d.ts +12 -10
  59. package/dist/utility/chart/marketKind.util.js +17 -7
  60. package/dist/utility/chart/om-panel-push-style.util.d.ts +7 -7
  61. package/dist/utility/chart/om-panel-push-style.util.js +17 -15
  62. package/dist/utility/chart/om-panel.util.d.ts +11 -0
  63. package/dist/utility/chart/om-panel.util.js +65 -6
  64. package/dist/utility/chart/profile-block-size.util.d.ts +16 -0
  65. package/dist/utility/chart/profile-block-size.util.js +7 -0
  66. package/dist/utility/chart/quote-perp.leaf.d.ts +17 -0
  67. package/dist/utility/chart/quote-perp.leaf.js +20 -0
  68. package/dist/utility/chart/window-geometry.leaf.d.ts +23 -1
  69. package/dist/utility/chart/window-geometry.leaf.js +78 -6
  70. package/dist/utility/chart/window-owner.leaf.d.ts +13 -0
  71. package/dist/utility/chart/window-owner.leaf.js +5 -0
  72. package/dist/utility/chart/wrun-run-result.util.d.ts +5 -0
  73. package/dist/utility/chart/wrun-run-result.util.js +4 -1
  74. package/dist/utility/common/transformations.util.d.ts +7 -0
  75. package/dist/utility/common/transformations.util.js +11 -0
  76. package/dist/utility/options/cme-options-root.util.d.ts +25 -0
  77. package/dist/utility/options/cme-options-root.util.js +40 -0
  78. package/dist/utility/options/option-book.util.d.ts +27 -0
  79. package/dist/utility/options/option-book.util.js +76 -0
  80. package/dist/utility/options/option-trade-date.util.d.ts +50 -0
  81. package/dist/utility/options/option-trade-date.util.js +120 -0
  82. package/dist/utility/options/option-venue.util.d.ts +3 -3
  83. package/dist/utility/options/option-venue.util.js +3 -3
  84. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +1 -1
  85. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +2 -2
  86. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.d.ts +2 -2
  87. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.js +5 -1
  88. package/dist/utility/wrun/sources/host-grid-landing.d.ts +4 -2
  89. package/dist/utility/wrun/sources/host-grid-landing.js +8 -0
  90. package/dist/utility/wrun/sources/lanes/options_flow.d.ts +40 -4
  91. package/dist/utility/wrun/sources/lanes/options_flow.js +115 -18
  92. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +12 -9
  93. package/dist/utility/wrun/sources/opra-option-lanes.util.js +10 -7
  94. package/dist/utility/wrun/sources/row-lane-registry.js +10 -5
  95. package/dist/utility/wrun/sources/row-lanes/index.js +2 -0
  96. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +3 -2
  97. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +30 -5
  98. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +9 -3
  99. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +13 -5
  100. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +25 -1
  101. package/dist/utility/wrun/sources/row-lanes/option_prints.js +161 -30
  102. package/dist/utility/wrun/sources/row-lanes/option_strike_flow.d.ts +4 -0
  103. package/dist/utility/wrun/sources/row-lanes/option_strike_flow.js +65 -0
  104. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +55 -1
  105. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +83 -2
  106. package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +17 -1
  107. package/dist/utility/wrun/sources/row-lanes/option_surface.js +33 -2
  108. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +7 -1
  109. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +51 -5
  110. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +136 -3
  111. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +42 -0
  112. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +146 -0
  113. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +25 -5
  114. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +111 -20
  115. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +291 -48
  116. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +16 -3
  117. package/dist/utility/wrun/wrun-batched-marks.util.js +30 -19
  118. package/dist/utility/wrun/wrun-batched-readout.util.d.ts +37 -9
  119. package/dist/utility/wrun/wrun-batched-readout.util.js +61 -15
  120. package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -0
  121. package/dist/utility/wrun/wrun-cell-capacity.leaf.d.ts +66 -0
  122. package/dist/utility/wrun/wrun-cell-capacity.leaf.js +86 -0
  123. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +147 -9
  124. package/dist/utility/wrun/wrun-chart-market-facts.util.js +345 -11
  125. package/dist/utility/wrun/wrun-cloud-record.leaf.d.ts +27 -0
  126. package/dist/utility/wrun/wrun-cloud-record.leaf.js +71 -0
  127. package/dist/utility/wrun/wrun-cloud-record.util.d.ts +4 -21
  128. package/dist/utility/wrun/wrun-cloud-record.util.js +5 -65
  129. package/dist/utility/wrun/wrun-color-facts.util.d.ts +19 -9
  130. package/dist/utility/wrun/wrun-color-facts.util.js +24 -14
  131. package/dist/utility/wrun/wrun-color-settings.util.d.ts +22 -9
  132. package/dist/utility/wrun/wrun-color-settings.util.js +57 -23
  133. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.d.ts +17 -0
  134. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.js +9 -0
  135. package/dist/utility/wrun/wrun-download-meter.util.d.ts +92 -0
  136. package/dist/utility/wrun/wrun-download-meter.util.js +122 -0
  137. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +10 -3
  138. package/dist/utility/wrun/wrun-draft-overlay.util.js +63 -6
  139. package/dist/utility/wrun/wrun-frames.js +5 -5
  140. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
  141. package/dist/utility/wrun/wrun-hosted-wire-caps.js +11 -0
  142. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +33 -17
  143. package/dist/utility/wrun/wrun-hud-looks.util.js +30 -16
  144. package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +29 -3
  145. package/dist/utility/wrun/wrun-lane-refusal.leaf.js +33 -3
  146. package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +8 -6
  147. package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +8 -6
  148. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -2
  149. package/dist/utility/wrun/wrun-live-intake.util.d.ts +6 -2
  150. package/dist/utility/wrun/wrun-live-intake.util.js +136 -21
  151. package/dist/utility/wrun/wrun-live-tick.util.d.ts +4 -1
  152. package/dist/utility/wrun/wrun-live-tick.util.js +130 -44
  153. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.d.ts +53 -0
  154. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.js +162 -0
  155. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +224 -0
  156. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +342 -0
  157. package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +88 -0
  158. package/dist/utility/wrun/wrun-market-size-defaults.util.js +471 -0
  159. package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +43 -8
  160. package/dist/utility/wrun/wrun-opra-flow.leaf.js +37 -6
  161. package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +51 -10
  162. package/dist/utility/wrun/wrun-option-contract-flow.util.js +85 -33
  163. package/dist/utility/wrun/wrun-option-prints.util.d.ts +172 -3
  164. package/dist/utility/wrun/wrun-option-prints.util.js +394 -17
  165. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +99 -0
  166. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +218 -0
  167. package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +365 -0
  168. package/dist/utility/wrun/wrun-option-strike-flow.util.js +797 -0
  169. package/dist/utility/wrun/wrun-option-views.util.d.ts +231 -7
  170. package/dist/utility/wrun/wrun-option-views.util.js +643 -23
  171. package/dist/utility/wrun/wrun-options-chain.util.d.ts +6 -4
  172. package/dist/utility/wrun/wrun-options-chain.util.js +8 -5
  173. package/dist/utility/wrun/wrun-options-stop.util.d.ts +2 -1
  174. package/dist/utility/wrun/wrun-options-stop.util.js +3 -2
  175. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +3 -0
  176. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +31 -14
  177. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +22 -0
  178. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +9 -1
  179. package/dist/utility/wrun/wrun-overlay-recovery.util.js +32 -3
  180. package/dist/utility/wrun/wrun-overlay-result.util.d.ts +7 -1
  181. package/dist/utility/wrun/wrun-overlay-result.util.js +2 -0
  182. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +34 -6
  183. package/dist/utility/wrun/wrun-overlay-run.util.js +527 -180
  184. package/dist/utility/wrun/wrun-pack-widths.leaf.d.ts +15 -0
  185. package/dist/utility/wrun/wrun-pack-widths.leaf.js +22 -0
  186. package/dist/utility/wrun/wrun-pack.util.d.ts +13 -8
  187. package/dist/utility/wrun/wrun-pack.util.js +38 -21
  188. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +4 -0
  189. package/dist/utility/wrun/wrun-panel-mount.util.js +62 -22
  190. package/dist/utility/wrun/wrun-panel-style.util.d.ts +41 -14
  191. package/dist/utility/wrun/wrun-panel-style.util.js +86 -26
  192. package/dist/utility/wrun/wrun-param-map.util.d.ts +7 -6
  193. package/dist/utility/wrun/wrun-param-map.util.js +8 -5
  194. package/dist/utility/wrun/wrun-param-values.util.d.ts +10 -2
  195. package/dist/utility/wrun/wrun-param-values.util.js +2 -0
  196. package/dist/utility/wrun/wrun-pin-spelling.util.js +19 -10
  197. package/dist/utility/wrun/wrun-prefix-lanes.util.js +2 -2
  198. package/dist/utility/wrun/wrun-refusal.util.js +17 -2
  199. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +20 -0
  200. package/dist/utility/wrun/wrun-script-inputs.util.js +43 -0
  201. package/dist/utility/wrun/wrun-source-rows.util.d.ts +4 -0
  202. package/dist/utility/wrun/wrun-source-rows.util.js +92 -40
  203. package/dist/utility/wrun/wrun-tape-source.util.d.ts +133 -48
  204. package/dist/utility/wrun/wrun-tape-source.util.js +205 -62
  205. package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +7 -5
  206. package/dist/utility/wrun/wrun-volume-profile-lane.util.js +8 -6
  207. package/dist/workers/utils/volume-profile.worker.util.d.ts +4 -1
  208. package/dist/workers/utils/volume-profile.worker.util.js +5 -2
  209. package/dist/workers/wrun/wrun-abi-host.js +3 -2
  210. package/package.json +11 -11
@@ -1,14 +1,35 @@
1
1
  import { kScriptSourceAnswerRows } from '../../chart/kscript-source-answer-budget.leaf.js';
2
2
  import { wrunRowLaneByKey, wrunRowLaneOfClass, wrunRowLanes } from './row-lane-registry.js';
3
- import { assertWrunLaneChainPlaneReadable, stableJson, wrunChainLaneStop, wrunChartOpraPlane, wrunHostGridAsksWithinHorizon, wrunLaneNoChainRefusal, wrunOpraPlaneStopDetail, wrunPollLaneChainAsk, wrunPollLaneChainExchange, wrunPollLaneChainGovernedExchange, wrunPollLaneChainPlane, wrunUnservedLaneInput, } from './wrun-poll-lanes.util.js';
3
+ import { assertWrunLaneChainPlaneReadable, stableJson, wrunChainLaneStop, wrunChartOpraPlane, wrunHostGridAsksWithinHorizon, wrunLaneNoChainRefusal, wrunOpraPlaneStopDetail, wrunPollLaneChainAsk, wrunPollLaneChainExchange, wrunPollLaneChainGovernedExchange, wrunPollLaneChainPlane, resolveWrunOptionSettingKnobs, wrunUnservedLaneInput, } from './wrun-poll-lanes.util.js';
4
4
  import { WRUN_ROW_LANE_ID_PREFIX, } from './wrun-row-lane.types.js';
5
5
  import { assertWrunOpraLaneReadable } from '../wrun-opra-lane.util.js';
6
+ import { wrunSheetCellBlockTuples } from '../wrun-cell-capacity.leaf.js';
7
+ import { WRUN_OPTION_FLOW_TODAY_FIELD, wrunOptionFlowTodayFromOf } from '../wrun-option-contract-flow.util.js';
8
+ import { wrunOptionInputTupleWidth, wrunOptionKitBarHasRows, wrunOptionLaneCarriesNext, wrunOptionLaneFirstPaintBudget, wrunOptionLaneTupleWidth, } from '../wrun-option-views.util.js';
6
9
  import { wrunPartialMarkerTuple, wrunPresentIsPartial, wrunTuplesMarkedPartial } from '../wrun-present-bits.util.js';
7
10
  import { wrunCellRowsWithPartialBars, wrunHostBarSpanOf, wrunHostGridAsks, wrunHostGridFallbackAsks, wrunLandCellRowsOnHostBars, } from '../wrun-tier-grid.util.js';
8
11
  /**
9
- * The static plan: every input whose class a row lane serves, in declaration order, with its lane. Refused by
10
- * name: a scalar input (a row lane serves cell blocks) and a celled one with no `max_cells` (the bound its blocks
11
- * are packed under). Empty when the sheet reads no row-lane class.
12
+ * A row lane at the width an input's words or an instance's facets make its block (wrun-option-views.util
13
+ * `wrunOptionInputTupleWidth`, `wrunOptionLaneTupleWidth`): the lane itself at its class's tuple width; at any other
14
+ * width a VIEW BLOCK (a page view fold's rows, the strike kit fold's: column 0 each row's layout, the widest layout's
15
+ * fields after it), read as the SDK's adapter reads one (kit `wrunCellBlockIsViewRows`, `kscriptViewRows`): every row
16
+ * of the width whole, a member that is no finite number NaN (`finiteColumns: []`), and no `present` mask
17
+ * (`presentMask: false`), so nothing reads or writes bit 14 in its last column, a fold's field or padding. Under the
18
+ * class tuple's rules Top Contracts' totals row (ending with `put_change`) marked every other row of the block partial
19
+ * at a change of 20,000 (bit 14 set), and was dropped whole on a block its knobs keep empty (no strike: `low_strike`
20
+ * and `high_strike` NaN).
21
+ */
22
+ function wrunRowLaneAtWidth(lane, width) {
23
+ return width === lane.width ? lane : { ...lane, width, finiteColumns: [], presentMask: false };
24
+ }
25
+ /**
26
+ * The static plan: every input whose class a row lane serves, in declaration order, with its lane and its module's
27
+ * bound (`capacity`, `wrunSheetCellBlockTuples`). Refused by name: a scalar input (a row lane serves cell blocks), a
28
+ * celled one with no `max_cells` (the bound its blocks are packed under) and a capacity no build writes
29
+ * (`wrun_cell_capacity_invalid`). Empty when the sheet reads no row-lane class. The lane's width follows the input's
30
+ * own words (wrun-option-views.util `wrunOptionInputTupleWidth`, the SDK's one rule: a page view fold's view block,
31
+ * the strike kit fold's 14-value rows), so the row builder reads and hands on the block each input's words make; a
32
+ * block of another width than its class's is read as it is (`wrunRowLaneAtWidth`).
12
33
  */
13
34
  export function planWrunRowLaneInputs(metadata) {
14
35
  const planned = [];
@@ -29,7 +50,15 @@ export function planWrunRowLaneInputs(metadata) {
29
50
  if (typeof maxCells !== 'number' || !Number.isInteger(maxCells) || maxCells < 1) {
30
51
  throw new Error(`WRUN ${metadata.id}: input '${input.name}' (${source.source}) declares no max_cells: a celled input names the most tuples a bar may hold`);
31
52
  }
32
- planned.push({ inputIndex: input.index, inputName: input.name, source, lane, maxCells });
53
+ const width = wrunOptionInputTupleWidth(source, lane.width);
54
+ planned.push({
55
+ inputIndex: input.index,
56
+ inputName: input.name,
57
+ source,
58
+ lane: wrunRowLaneAtWidth(lane, width),
59
+ maxCells,
60
+ capacity: wrunSheetCellBlockTuples(metadata, input),
61
+ });
33
62
  }
34
63
  return planned;
35
64
  }
@@ -80,7 +109,9 @@ function wrunRowLaneUnserved(lane, plane, indexMode, run, ctx) {
80
109
  * reason (`opraPlaneStop`: the `opra` flag dark, an index chart) says that reason instead (`options-stopped`, the
81
110
  * note and the refusal alike);
82
111
  * 3. the lane's identity, once per lane (the first admitted input's context names a refusal), then the input's
83
- * facets (awaited, in declaration order); the instance is the identity and the facets together. A lane with
112
+ * facets (awaited, in declaration order), each knob naming a setting first read as the setting's current value
113
+ * (`resolveWrunOptionSettingKnobs` over `run.paramValues`), the context carrying the plan's facts beside the chart
114
+ * (`WrunRowLanePlanFacts`); the instance is the identity and the facets together. A lane with
84
115
  * `acquisitions: 'one'` refuses a second input whose acquisition differs (one fetch, one live fold per package). A
85
116
  * chart with no option chain (an identity or facets refusal seeded `no-options` / `chain`, `wrunLaneNoChainRefusal`:
86
117
  * a LINK perp, a forex pair) does not serve the feed either: the same one rule, its note naming the feed with the
@@ -97,7 +128,10 @@ export async function planWrunRowLanes(metadata, chart, run) {
97
128
  const cryptoVenue = chart.isCryptoVenueExchange?.(chart.exchange);
98
129
  // The chart's OPRA plane facts, read once, as the poll lanes' planner reads them (`wrunChartOpraPlane`).
99
130
  const plane = wrunChartOpraPlane(chart.exchange, chart);
100
- for (const planned of planWrunRowLaneInputs(metadata)) {
131
+ const params = metadata.params ?? [];
132
+ const plannedInputs = planWrunRowLaneInputs(metadata);
133
+ const laneMaxCells = wrunRowLaneMaxCellsByClass(plannedInputs);
134
+ for (const planned of plannedInputs) {
101
135
  if (planned.source.undemanded === true)
102
136
  continue;
103
137
  const { lane } = planned;
@@ -113,6 +147,10 @@ export async function planWrunRowLanes(metadata, chart, run) {
113
147
  cryptoVenue,
114
148
  official: run?.official === true,
115
149
  opraUserScripts: run?.opraUserScripts === true,
150
+ maxCells: planned.maxCells,
151
+ laneMaxCells: laneMaxCells.get(lane.sourceClass),
152
+ params,
153
+ ...(run?.paramValues !== undefined ? { paramValues: run.paramValues } : {}),
116
154
  };
117
155
  const unserved = {
118
156
  inputName: planned.inputName,
@@ -137,7 +175,9 @@ export async function planWrunRowLanes(metadata, chart, run) {
137
175
  identity = definedFields(await lane.identity?.(ctx));
138
176
  identities.set(lane.laneKey, identity);
139
177
  }
140
- extras = { ...identity, ...definedFields(await lane.facets?.(planned.source, ctx)) };
178
+ // A knob naming a setting reads its current value first: a settings change re-plans and re-asks.
179
+ const source = resolveWrunOptionSettingKnobs(ctx, planned.source, params, run?.paramValues);
180
+ extras = { ...identity, ...definedFields(await lane.facets?.(source, ctx)) };
141
181
  }
142
182
  catch (error) {
143
183
  // A chart with no option chain does not serve the feed (`wrunLaneNoChainRefusal`): the same one rule.
@@ -167,6 +207,14 @@ export async function planWrunRowLanes(metadata, chart, run) {
167
207
  }
168
208
  return { lanes: [...instances.values()], missingFeeds: [...missing.values()] };
169
209
  }
210
+ /** The most `max_cells` among a sheet's planned inputs of each row-lane class (`WrunRowLanePlanFacts.laneMaxCells`). */
211
+ function wrunRowLaneMaxCellsByClass(planned) {
212
+ const most = new Map();
213
+ for (const { lane, maxCells } of planned) {
214
+ most.set(lane.sourceClass, Math.max(most.get(lane.sourceClass) ?? 0, maxCells));
215
+ }
216
+ return most;
217
+ }
170
218
  function definedFields(fields) {
171
219
  const out = {};
172
220
  for (const [key, value] of Object.entries(fields ?? {}))
@@ -253,18 +301,37 @@ export const WRUN_ROW_LANE_TIER_FIELD = 'tier';
253
301
  * extras), cut to its horizon and its row budget, each answer landed on the host bars (`wrunLandCellRowsOnHostBars`,
254
302
  * the lane's own `fold` when it has one), a snapshot's bar its tier answered nothing for asked again one tier coarser
255
303
  * where one fits and retains it when the lane's `coarserWhenEmpty` says so of the acquisition (D12), and the bars no
256
- * tier retains (or the budget left out) marked partial (bit 14, a marker tuple when empty); a `latest` lane asked
257
- * once over `fallback`, its rows as they come. A flow sums every bucket inside its bar, so its plan reads the window's
258
- * bar grid as its session grid (wrun-tier-grid.util `wrunCmeSessionBarSpan`): a CME session bar of a day or longer
259
- * is fit, budgeted and asked over its Globex session, from the 17:00 Chicago open before its 00:00Z stamp, never from
260
- * a UTC day bucket; a snapshot keeps its stamps (D12's settlement DAY rows). `ask` is the caller's fetch (the full
261
- * run's, a reconcile's). Ascending, one row per host bar.
304
+ * tier retains (or the budget left out) marked partial (bit 14, a marker tuple when empty; never on an instance its
305
+ * facets widen, whose rows carry no mask: `wrunRowLaneAtWidth`); a `latest` lane asked once over `fallback`, its rows
306
+ * as they come. A flow sums every bucket inside its bar, so its plan reads the window's bar grid as its session grid
307
+ * (wrun-tier-grid.util `wrunCmeSessionBarSpan`): a CME session bar of a day or longer is fit, budgeted and asked over
308
+ * its Globex session, from the 17:00 Chicago open before its 00:00Z stamp, never from a UTC day bucket; a snapshot
309
+ * keeps its stamps (D12's settlement DAY rows). `ask` is the caller's fetch (the full run's, a reconcile's).
310
+ * Ascending, one row per host bar.
311
+ *
312
+ * A row-budget lane's first-paint slice is cut on a trade date's first bar wherever the chart reads trade dates
313
+ * (`window.tradeDateOf`), on every run, so it holds whole sessions and every run asks the same windows.
314
+ * `opts.onFirstSlice` (a full run's first paint): every ask still leaves at once and the promise still answers the
315
+ * whole window, but the slice's own answer is handed over first, once, if it lands with rows while an older ask is
316
+ * still out a macrotask later: the slice's rows, every older bar the projection reads rows for read partial
317
+ * (wrun-row-lane-first-paint.util `wrunRowLaneFirstSliceHeldBars`), and the slice's first bar. Never when no cut falls
318
+ * on a session's first bar (a session longer than the slice: the plain split, asked as today), for a block with no
319
+ * `present` mask (it cannot read a bar as partial), a kit fold carrying the next bar (its pages ask one at a time), or
320
+ * a snapshot whose empty bars ask a coarser tier (that pass would ask the slice's bars again).
262
321
  */
263
- export async function fetchWrunRowLaneRows(lane, extras, window, fallback, ask) {
322
+ export async function fetchWrunRowLaneRows(lane, extras, window, fallback, ask, opts = {}) {
264
323
  const landing = lane.landing;
265
- if (landing.kind === 'latest')
266
- return (await ask(extras, fallback.fromTs, fallback.toTs)).map((row) => [...row]);
324
+ // The instance's rows are its facets' (a strike kit fold's 14-value rows), read as plain tuples once landed; at
325
+ // another width than the class's they carry no `present` mask (`wrunRowLaneAtWidth`).
326
+ const sized = wrunRowLaneAtWidth(lane, wrunOptionLaneTupleWidth(lane.sourceClass, extras, lane.width));
327
+ const width = sized.width;
328
+ if (landing.kind === 'latest') {
329
+ return (await ask(extras, fallback.fromTs, fallback.toTs)).map((row) => wrunRowLanePlainRow(row, width));
330
+ }
267
331
  const sessionGrid = landing.kind === 'flow' ? window.barGrid : undefined;
332
+ // What the row budget and the first-paint slice project the window's bars under: the instance's payload with
333
+ // `history` "today" dated off the window's newest bar as each ask's K control dates it (`wrunRowLaneBudgetAcquisition`).
334
+ const budgetAcquisition = await wrunRowLaneBudgetAcquisition(lane, extras, window);
268
335
  const { asks, partialBars } = wrunRowLaneAsksWithinRowBudget(wrunRowLaneAsksWithinHorizon(wrunHostGridAsks({
269
336
  tiers: landing.tiers,
270
337
  barOpens: window.barOpens,
@@ -272,19 +339,96 @@ export async function fetchWrunRowLaneRows(lane, extras, window, fallback, ask)
272
339
  nowMs: window.nowMs,
273
340
  choice: landing.tierChoice,
274
341
  sessionGrid,
275
- }), window, lane.horizon?.(extras, window.nowMs), sessionGrid), window, lane.rowBudget, extras, sessionGrid);
342
+ }), window, lane.horizon?.(extras, window.nowMs), sessionGrid), window, lane.rowBudget, budgetAcquisition, sessionGrid);
343
+ // A row-budget lane's newest bars are asked first and on their own (wrun-row-lane-first-paint.util, off the boot path),
344
+ // and so are an instance's whose facets ask a per-bar word of the gateway (OPTLOAD G5: a surface pick, the strike kit
345
+ // fold), sized by the rows its answer holds; every other instance asks as the tier rule made it.
346
+ const sliceBudget = lane.rowBudget ?? wrunOptionLaneFirstPaintBudget(lane.sourceClass, extras, lane.width);
347
+ const firstPaint = sliceBudget === undefined ? undefined : await import('./wrun-row-lane-first-paint.util.js');
348
+ // The slice is cut on a trade date's first bar wherever the chart reads trade dates (`window.tradeDateOf`), so it
349
+ // holds whole sessions, on every run alike: a first paint asks the windows a later run asks (one cache entry each).
350
+ const split = firstPaint === undefined || sliceBudget === undefined
351
+ ? undefined
352
+ : firstPaint.wrunRowLaneFirstPaintSplit(asks, window, sliceBudget, budgetAcquisition, sessionGrid, window.tradeDateOf);
353
+ const ordered = split === undefined ? asks : [...split.first, ...split.older];
354
+ // The bars the slice's early answer holds back (`opts.onFirstSlice`), or undefined when it has none.
355
+ const coarserPass = landing.kind === 'snapshot' && landing.tiers !== undefined && landing.coarserWhenEmpty?.(extras) === true;
356
+ const heldBack = opts.onFirstSlice === undefined ||
357
+ firstPaint === undefined ||
358
+ split === undefined ||
359
+ sliceBudget === undefined ||
360
+ sized.presentMask === false ||
361
+ coarserPass ||
362
+ wrunOptionLaneCarriesNext(lane.sourceClass, extras)
363
+ ? undefined
364
+ : firstPaint.wrunRowLaneFirstSliceHeldBars(split, window, sliceBudget, budgetAcquisition, sessionGrid);
276
365
  const fold = landing.fold;
277
- const askAndLand = async (gridAsk) => {
366
+ // `askToMs` reads past the ask's own end (a kit fold's seam, below); only the ask's own bars ever land.
367
+ const askAndLand = async (gridAsk, askToMs = gridAsk.toMs) => {
278
368
  const askExtras = gridAsk.tier === undefined ? extras : { ...extras, [WRUN_ROW_LANE_TIER_FIELD]: gridAsk.tier.key };
279
369
  // Rows stamped at or past the ask's end belong to a bar the plan did not ask (a skipped newest bar): never land
280
370
  // them, whatever the control answered.
281
- const rows = (await ask(askExtras, gridAsk.fromMs, gridAsk.toMs)).filter((row) => Number(row[0]) < gridAsk.toMs);
282
- return wrunLandCellRowsOnHostBars(rows, landing.kind, { intervalMs: window.intervalMs, barGrid: window.barGrid, tierMs: gridAsk.tier?.ms, nowMs: window.nowMs }, fold === undefined ? undefined : (group) => fold(group, askExtras));
371
+ const rows = (await ask(askExtras, gridAsk.fromMs, askToMs)).filter((row) => Number(row[0]) < gridAsk.toMs);
372
+ return wrunLandCellRowsOnHostBars(rows, landing.kind, { intervalMs: window.intervalMs, barGrid: window.barGrid, tierMs: gridAsk.tier?.ms, nowMs: window.nowMs }, fold === undefined ? undefined : (group) => fold(group, askExtras)).map((row) => wrunRowLanePlainRow(row, width));
283
373
  };
284
374
  const byBar = new Map();
285
- for (const landed of await Promise.all(asks.map(askAndLand))) {
286
- for (const row of landed)
287
- byBar.set(Number(row[0]), row);
375
+ const landAll = (gridAsks) => Promise.all(gridAsks.map((gridAsk) => askAndLand(gridAsk)));
376
+ if (heldBack !== undefined && split !== undefined && opts.onFirstSlice !== undefined) {
377
+ // Every ask leaves at once, as below; the slice's answer is handed over first while an older ask is still out.
378
+ const onFirstSlice = opts.onFirstSlice;
379
+ // The slice's first bar: the first bar the cut keeps (every bar before it is held).
380
+ const cutMs = split.sliceFromMs ?? Number.POSITIVE_INFINITY;
381
+ const sliceFromTs = window.barOpens.find((stampMs) => wrunHostBarSpanOf(stampMs, window.intervalMs, sessionGrid).fromMs >= cutMs);
382
+ const firstLanded = landAll(split.first);
383
+ const olderLanded = landAll(split.older);
384
+ let olderSettled = false;
385
+ void olderLanded.then(() => {
386
+ olderSettled = true;
387
+ }, () => {
388
+ olderSettled = true;
389
+ });
390
+ void firstLanded
391
+ .then(async (answers) => {
392
+ // One macrotask before the handover is judged: older asks that answered in the same turn (a cache) settle
393
+ // first, so a window already whole never draws half of itself and a rung to adopt the rest.
394
+ await new Promise((resolve) => setTimeout(resolve, 0));
395
+ if (olderSettled || sliceFromTs === undefined)
396
+ return;
397
+ const held = new Set(heldBack);
398
+ const slice = new Map();
399
+ for (const landed of answers) {
400
+ for (const row of landed)
401
+ if (!held.has(Number(row[0])))
402
+ slice.set(Number(row[0]), row);
403
+ }
404
+ if (slice.size === 0)
405
+ return;
406
+ const rows = [...slice.entries()].sort((a, b) => a[0] - b[0]).map(([, row]) => row);
407
+ onFirstSlice(wrunCellRowsWithPartialBars(rows, [...new Set([...partialBars, ...heldBack])], width), sliceFromTs);
408
+ }, () => undefined)
409
+ // A failed handover only costs the early picture: the whole answer still comes.
410
+ .catch(() => undefined);
411
+ const [firstAnswers, olderAnswers] = await Promise.all([firstLanded, olderLanded]);
412
+ for (const landed of [...firstAnswers, ...olderAnswers]) {
413
+ for (const row of landed)
414
+ byBar.set(Number(row[0]), row);
415
+ }
416
+ }
417
+ else if (!wrunOptionLaneCarriesNext(lane.sourceClass, extras)) {
418
+ for (const landed of await landAll(ordered)) {
419
+ for (const row of landed)
420
+ byBar.set(Number(row[0]), row);
421
+ }
422
+ }
423
+ else {
424
+ // A kit fold carrying the next bar's strikes (OPTLOAD G5): its carry stops at the read's window, so the asks run
425
+ // newest first, one at a time, each older one read through the newer answer's first bar with rows and landing its
426
+ // own bars alone; a seam between two pages then reads as one read would.
427
+ for (const gridAsk of ordered) {
428
+ for (const row of await askAndLand(gridAsk, wrunRowLaneSeamEndMs(gridAsk, byBar, window.intervalMs))) {
429
+ byBar.set(Number(row[0]), row);
430
+ }
431
+ }
288
432
  }
289
433
  // D12: a snapshot's bar its tier answered nothing for reads the next coarser tier that fits and retains it, for an
290
434
  // acquisition its lane says so of (`coarserWhenEmpty`: a CME surface's daily bar whose 5m tier holds no session
@@ -301,7 +445,7 @@ export async function fetchWrunRowLaneRows(lane, extras, window, fallback, ask)
301
445
  });
302
446
  if (fallback.length === 0)
303
447
  break;
304
- for (const landed of await Promise.all(fallback.map(askAndLand))) {
448
+ for (const landed of await Promise.all(fallback.map((gridAsk) => askAndLand(gridAsk)))) {
305
449
  for (const row of landed)
306
450
  if (!byBar.has(Number(row[0])))
307
451
  byBar.set(Number(row[0]), row);
@@ -310,8 +454,48 @@ export async function fetchWrunRowLaneRows(lane, extras, window, fallback, ask)
310
454
  }
311
455
  }
312
456
  const landed = [...byBar.entries()].sort((a, b) => a[0] - b[0]).map(([, row]) => row);
313
- // A class with no `present` mask marks nothing: a partial bar asked nothing and reads an empty block.
314
- return lane.presentMask === false ? landed : wrunCellRowsWithPartialBars(landed, partialBars, lane.width);
457
+ // A block with no `present` mask (its class's, or an instance's its facets widen) marks nothing: a partial bar asked
458
+ // nothing and reads an empty block.
459
+ return sized.presentMask === false ? landed : wrunCellRowsWithPartialBars(landed, partialBars, width);
460
+ }
461
+ /**
462
+ * Where a kit fold page carrying the next bar's strikes is read to (the paging seam, OPTLOAD G5): through the end of the
463
+ * first bar at or after the page's end that a newer page already landed with rows (`wrunOptionKitBarHasRows`), so the
464
+ * page's last bar carries what that bar draws; the page's own end when no newer bar has rows (the newest page, a window
465
+ * whose newer bars answered nothing).
466
+ */
467
+ function wrunRowLaneSeamEndMs(gridAsk, landed, intervalMs) {
468
+ let next;
469
+ for (const [open, row] of landed) {
470
+ if (open < gridAsk.toMs || !wrunOptionKitBarHasRows(row.slice(1)))
471
+ continue;
472
+ if (next === undefined || open < next)
473
+ next = open;
474
+ }
475
+ return next === undefined ? gridAsk.toMs : Math.max(gridAsk.toMs, wrunHostBarSpanOf(next, intervalMs).toMs);
476
+ }
477
+ /**
478
+ * A landed row with every packed block (a Float64Array a worker handed the page by transfer, `count x width` values back
479
+ * to back: OPTLOAD G5 O6) split into plain tuples of `width` values, every other cell as it is; a new array. The one
480
+ * point a lane's rows enter its buffer, so every reader of them reads arrays: the partial marks (which keep array
481
+ * tuples), the live reconcile's comparison of a re-asked bar (a typed block compares by identity, so an unchanged bar
482
+ * would read revised on every poll and reseed the session), the row builder. A block that is no whole number of tuples
483
+ * stays as it is (`exactTuples` skips it).
484
+ */
485
+ export function wrunRowLanePlainRow(row, width) {
486
+ const out = [row[0]];
487
+ for (let at = 1; at < row.length; at += 1) {
488
+ const cell = row[at];
489
+ if (cell instanceof Float64Array && width > 0 && cell.length % width === 0) {
490
+ for (let offset = 0; offset < cell.length; offset += width) {
491
+ out.push(Array.from(cell.subarray(offset, offset + width)));
492
+ }
493
+ }
494
+ else {
495
+ out.push(cell);
496
+ }
497
+ }
498
+ return out;
315
499
  }
316
500
  /**
317
501
  * A host-grid ask plan cut to a lane's horizon for one acquisition (`WrunRowLaneHorizon`): every window bar that
@@ -323,6 +507,35 @@ export async function fetchWrunRowLaneRows(lane, extras, window, fallback, ask)
323
507
  export function wrunRowLaneAsksWithinHorizon(plan, window, horizon, sessionGrid) {
324
508
  return wrunHostGridAsksWithinHorizon(plan, window, horizon, sessionGrid);
325
509
  }
510
+ /**
511
+ * The acquisition a row lane's budget projects the window's bars under (`wrunRowLaneAsksWithinRowBudget` and the
512
+ * first-paint slice, both from `fetchWrunRowLaneRows`): the instance's payload, and for a chain instance under the flow
513
+ * lanes' `history` "today" the first instant of today named off the window's NEWEST bar exactly as each ask's K control
514
+ * names it (option-flow-bars.util `optionFlowTodayFields`: the trade date of the chart's newest bar on the chain's venue
515
+ * clock, option-trade-date.util `optionTodayStartMsByClock`, under `WRUN_OPTION_FLOW_TODAY_FIELD`), so the projection
516
+ * (wrun-option-contract-flow.util `wrunOptionFlowBarBeforeToday`) budgets exactly the bars the worker reads. The payload
517
+ * names no today (the control adds it per ask, off the chart): projected without it, every bar before today was
518
+ * projected in full though it reads nothing, and once the budget filled the older bars were cut and marked partial. The
519
+ * window's newest bar is the chart's on a full run and a reconcile, and never newer than it on a clamped window, so this
520
+ * today is never later than the worker's: a bar the worker reads is never projected at nothing. The trade-date rules
521
+ * load only for such an instance (they stay off the boot path).
522
+ */
523
+ export async function wrunRowLaneBudgetAcquisition(lane, extras, window) {
524
+ if (extras.history !== 'today' || lane.chain === undefined || wrunOptionFlowTodayFromOf(extras) !== undefined) {
525
+ return extras;
526
+ }
527
+ const newest = window.barOpens[window.barOpens.length - 1];
528
+ if (newest === undefined || !Number.isFinite(newest))
529
+ return extras;
530
+ const { optionTodayStartMsByClock, optionTradeDateClockOf } = await import('../../options/option-trade-date.util.js');
531
+ const clock = optionTradeDateClockOf({
532
+ exchange: wrunRowLaneChainExchange(lane, extras),
533
+ coin: typeof extras.coin === 'string' ? extras.coin : '',
534
+ });
535
+ // The K control's newest bar: its stamp, one interval long (option-flow-bars.util `optionFlowNewestBarOf`).
536
+ const todayFromMs = optionTodayStartMsByClock(clock, { openMs: newest, endMs: newest + window.intervalMs });
537
+ return Number.isFinite(todayFromMs) ? { ...extras, [WRUN_OPTION_FLOW_TODAY_FIELD]: todayFromMs } : extras;
538
+ }
326
539
  /** A row budget's cap in rows: the source answer budget (kscript-source-answer-budget.leaf) in rows of the lane's
327
540
  * answered width. One number for every lane, the row cache and the worker's cap; a lane never picks its own. */
328
541
  export function wrunRowLaneMaxRows(budget) {
@@ -446,23 +659,37 @@ function wrunCellMember(member) {
446
659
  /** A row's tuples as the host's exact adapter reads them: arrays of exactly `width` numbers, finite in every column
447
660
  * (the kit's rule for an exact class: any other tuple is dropped whole), or, for a lane naming its `finiteColumns`,
448
661
  * finite in those columns while any other column that is not a finite number reads NaN (om's adapter for such a
449
- * class: a null, a missing member or an infinity is NaN, never 0). */
662
+ * class: a null, a missing member or an infinity is NaN, never 0; a view block names none, so every row of its width
663
+ * is read, `wrunRowLaneAtWidth`). A packed block (a Float64Array of `count x width` values, a worker's transfer)
664
+ * reads as its tuples back to back, each under the same rule; a block that is no whole number of tuples is skipped
665
+ * like any cell of another shape. */
450
666
  function exactTuples(row, lane) {
451
667
  const { width, finiteColumns } = lane;
452
668
  const tuples = [];
453
- for (let at = 1; at < row.length; at += 1) {
454
- const cell = row[at];
455
- if (!Array.isArray(cell) || cell.length !== width)
456
- continue;
669
+ const take = (cell) => {
457
670
  if (finiteColumns === undefined) {
458
671
  const tuple = cell.map(Number);
459
672
  if (tuple.every((value) => Number.isFinite(value)))
460
673
  tuples.push(tuple);
461
- continue;
674
+ return;
462
675
  }
463
676
  const tuple = cell.map(wrunCellMember);
464
677
  if (finiteColumns.every((column) => Number.isFinite(tuple[column])))
465
678
  tuples.push(tuple);
679
+ };
680
+ for (let at = 1; at < row.length; at += 1) {
681
+ const cell = row[at];
682
+ if (cell instanceof Float64Array) {
683
+ if (width < 1 || cell.length % width !== 0)
684
+ continue;
685
+ for (let offset = 0; offset < cell.length; offset += width) {
686
+ take(Array.from(cell.subarray(offset, offset + width)));
687
+ }
688
+ continue;
689
+ }
690
+ if (!Array.isArray(cell) || cell.length !== width)
691
+ continue;
692
+ take(cell);
466
693
  }
467
694
  return tuples;
468
695
  }
@@ -471,10 +698,11 @@ function exactTuples(row, lane) {
471
698
  * (bit 14 of the `present` mask, the last column): when any of the bar's tuples says partial (a bar no fitting tier
472
699
  * retains, or the marker tuple of one that holds none), every tuple the projection keeps or rebuilds carries bit 14,
473
700
  * and a block the projection empties reads the marker tuple, so a package never reads missing history as a quiet bar.
474
- * A class with no `present` mask (`presentMask: false`) is projected as it is: its last column is a value.
701
+ * A block with no `present` mask (`presentMask: false`: its class's, or a view block's, `wrunRowLaneAtWidth`) is
702
+ * projected as it is: its last column is a value.
475
703
  */
476
- function wrunProjectedBlock(lane, tuples, input) {
477
- const projected = lane.cells ? lane.cells(tuples, input) : tuples;
704
+ function wrunProjectedBlock(lane, tuples, input, bar) {
705
+ const projected = lane.cells ? lane.cells(tuples, input, bar) : tuples;
478
706
  if (lane.presentMask === false)
479
707
  return projected;
480
708
  if (!tuples.some((tuple) => wrunPresentIsPartial(tuple[tuple.length - 1])))
@@ -488,27 +716,42 @@ function wrunProjectedBlock(lane, tuples, input) {
488
716
  * bar the lane holds no row for reads a present EMPTY block). A PARTIAL bar stays partial through the projection
489
717
  * (`wrunProjectedBlock`). A `latest` lane's newest row lands on the LIVE row alone (`liveTs`, the chart's last row;
490
718
  * the options chain's rule) whatever its stamp, every other row reading an empty block. `afterTs` (a tail build's
491
- * carry) keeps the rows stamped after it, except a `latest` lane's newest.
719
+ * carry) keeps the rows stamped after it, except a `latest` lane's newest. An input reading a window-level pass
720
+ * (`cellsWindow`) reads every row the lane holds first, whatever `afterTs` keeps, and each bar's projection reads the
721
+ * answer.
492
722
  */
493
723
  export function wrunRowLaneCellRows(lane, rows, input, opts = {}) {
494
- const project = (tuples) => wrunProjectedBlock(lane, tuples, input).flatMap((tuple) => [...tuple]);
724
+ // The input's window-level pass, if it reads one: every held bar's exact tuples, read once, then each bar's
725
+ // projection reads its answer.
726
+ const windowPass = lane.cellsWindow?.(input);
727
+ const bars = windowPass === undefined
728
+ ? undefined
729
+ : rows.map((row) => ({ openMs: Number(row[0]), tuples: exactTuples(row, lane) }));
730
+ const window = windowPass === undefined || bars === undefined
731
+ ? undefined
732
+ : windowPass(bars.filter((bar) => Number.isFinite(bar.openMs)));
733
+ const project = (at) => {
734
+ const tuples = bars?.[at].tuples ?? exactTuples(rows[at], lane);
735
+ const bar = bars === undefined ? undefined : { openMs: Number(rows[at][0]), window };
736
+ return wrunProjectedBlock(lane, tuples, input, bar).flatMap((tuple) => [...tuple]);
737
+ };
495
738
  if (lane.landing.kind === 'latest') {
496
739
  if (opts.liveTs === undefined || !Number.isFinite(opts.liveTs))
497
740
  return [];
498
- let newest;
499
- for (const row of rows) {
741
+ let newest = -1;
742
+ rows.forEach((row, at) => {
500
743
  const ts = Number(row[0]);
501
- if (Number.isFinite(ts) && (newest === undefined || ts > Number(newest[0])))
502
- newest = row;
503
- }
504
- return newest === undefined ? [] : [{ ts: opts.liveTs, cells: project(exactTuples(newest, lane)) }];
744
+ if (Number.isFinite(ts) && (newest < 0 || ts > Number(rows[newest][0])))
745
+ newest = at;
746
+ });
747
+ return newest < 0 ? [] : [{ ts: opts.liveTs, cells: project(newest) }];
505
748
  }
506
749
  const out = [];
507
- for (const row of rows) {
750
+ rows.forEach((row, at) => {
508
751
  const ts = Number(row[0]);
509
752
  if (!Number.isFinite(ts) || (opts.afterTs !== undefined && ts <= opts.afterTs))
510
- continue;
511
- out.push({ ts, cells: project(exactTuples(row, lane)) });
512
- }
753
+ return;
754
+ out.push({ ts, cells: project(at) });
755
+ });
513
756
  return out;
514
757
  }
@@ -51,13 +51,19 @@
51
51
  * it keeps the hover text (the mount door's, and the mount's re-registration after a pass that
52
52
  * failed part way); the boot-path hover inspector calls it through the thin registry and never
53
53
  * imports this module.
54
+ * - The caption's and the hover's number words (r11, Big Trades 0.7.0 "Size shown as"): THE one format list,
55
+ * WRUN_BATCHED_NUMBER_FORMATS (wrun-batched-readout.util), which the gate's vocabulary and the engine settings read
56
+ * here. `usd` prints dollars, `units` a mark's quantity in the market's own unit: its dollar value over the record's
57
+ * price times the market's dollar unit, which every build hands in (`valuePerUnit`, the run's
58
+ * `wrunMarketDollarUnit`) and a marks child carries on its settings (the engine's caption) and its readout (the
59
+ * hover). Where no unit is proven the engine is handed `usd` in place of `units`, never a wrong number.
54
60
  */
55
61
  import type { WrunBatchedMarksKind, WrunBatchedSection, WrunIndicatorMetadata, WrunOutputRow } from '../../interfaces/wrun-runtime.interface.js';
56
62
  import { type WrunCellsCapSummary } from './wrun-cap-notice.util.js';
57
63
  import { type WrunCanvasReadout } from './wrun-canvas-readout.util.js';
58
64
  import { wrunCanvasMergeLive } from './wrun-canvases.util.js';
59
65
  import { type WrunColorTheme } from './wrun-style-words.util.js';
60
- export { decodeWrunMarkMeta, decodeWrunSpanMeta, formatWrunBatchedNumber, wrunBatchedReadoutText, WRUN_MARK_META_MAX_OFFSET_MS, type WrunBatchedNumberFormat, type WrunMarkMeta, type WrunSpanMeta, } from './wrun-batched-readout.util.js';
66
+ export { decodeWrunMarkMeta, decodeWrunSpanMeta, formatWrunBatchedNumber, isWrunBatchedNumberFormat, WRUN_BATCHED_NUMBER_FORMATS, wrunBatchedReadoutText, wrunMarkQtyInUnits, WRUN_MARK_META_MAX_OFFSET_MS, type WrunBatchedNumberFormat, type WrunMarkMeta, type WrunSpanMeta, } from './wrun-batched-readout.util.js';
61
67
  export type { WrunBatchedHoverRecord } from './wrun-canvas-readout.util.js';
62
68
  /** The three kinds, in mount order: each a sheet key, a child id kind and the engine plot type. */
63
69
  export declare const WRUN_BATCHED_MARKS_KINDS: ReadonlyArray<WrunBatchedMarksKind>;
@@ -194,14 +200,21 @@ export interface WrunBatchedChildOverlay {
194
200
  export declare function wrunBatchedLayoutVerdict(kind: WrunBatchedMarksKind, section: Record<string, unknown>): string | null;
195
201
  /** The engine settings of a section's child: the geometry (`slots`, `stride`; `first_output` stays
196
202
  * here, the child rows start at field 0), the look of its kind, and `hoverReadout` when a tooltip is
197
- * declared (the engine registers its drawn records for hover then). Colours stay as declared. */
198
- export declare function wrunBatchedSettingsOf(spec: WrunBatchedSectionSpec): Record<string, unknown>;
203
+ * declared (the engine registers its drawn records for hover then). Colours stay as declared. A marks
204
+ * child also carries the market's dollar unit (`valuePerUnit`) when the build hands a proven one; spans
205
+ * and rays never do (their records hold no quantity). */
206
+ export declare function wrunBatchedSettingsOf(spec: WrunBatchedSectionSpec, context?: Pick<WrunBatchedChildrenOptions, 'valuePerUnit'>): Record<string, unknown>;
199
207
  /** What a build of the batched children takes beside the sheet and the rows. */
200
208
  export interface WrunBatchedChildrenOptions {
201
209
  /** A live tick's changed tail: the timestamp the tick re-evaluated from (the previous forming bar's,
202
210
  * the session's watermark). Each child is built from the parent rows at or after it only (walked
203
211
  * back from the newest), charges nothing and is marked `tailOnly`. */
204
212
  tailFromTs?: number;
213
+ /** The chart market's dollar unit (US dollars per price unit and size unit: the run's `wrunMarketDollarUnit`,
214
+ * handed in beside its size unit by every result build): a marks child's caption (`settings.valuePerUnit`, the
215
+ * engine's `units`) and hover (`readout.valuePerUnit`) divide a record's dollar value by it. Absent, or no number
216
+ * above zero: none is proven, and `units` prints dollars. A tail takes the one its full build took. */
217
+ valuePerUnit?: number;
205
218
  }
206
219
  /**
207
220
  * One child per batched section the Style rows leave visible, in mount order. A full build charges