@orangecharts/wrun-chart-host 0.8.0 → 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 (145) hide show
  1. package/README.md +2 -1
  2. package/dist/constants/feature-flags.constants.d.ts +4 -0
  3. package/dist/constants/feature-flags.constants.js +27 -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 +11 -6
  9. package/dist/constants/option-venues.constants.js +5 -2
  10. package/dist/host-env.d.ts +10 -4
  11. package/dist/host-ports.types.d.ts +39 -3
  12. package/dist/index.d.ts +1 -0
  13. package/dist/index.js +1 -0
  14. package/dist/interfaces/opra-realtime.interface.d.ts +13 -11
  15. package/dist/interfaces/opra-realtime.interface.js +10 -10
  16. package/dist/interfaces/wrun-runtime.interface.d.ts +34 -13
  17. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +53 -10
  18. package/dist/kscript-data/controls/live-trades-merge.util.js +81 -16
  19. package/dist/market-data/billing.interface.d.ts +138 -17
  20. package/dist/market-data/billing.interface.js +25 -8
  21. package/dist/market-data/venues/index.d.ts +3 -3
  22. package/dist/market-data/venues/opra.contract.copy.json +5 -3
  23. package/dist/market-data/venues/opra.d.ts +3 -3
  24. package/dist/market-data/venues/opra.js +5 -4
  25. package/dist/replay/replayLadder.js +3 -1
  26. package/dist/utility/chart/crypto-index.leaf.d.ts +2 -2
  27. package/dist/utility/chart/crypto-index.leaf.js +2 -2
  28. package/dist/utility/chart/index-mode-admission.util.js +9 -1
  29. package/dist/utility/chart/index-mode.util.d.ts +5 -2
  30. package/dist/utility/chart/index-mode.util.js +23 -13
  31. package/dist/utility/chart/kscript-venue-policy.util.d.ts +28 -21
  32. package/dist/utility/chart/kscript-venue-policy.util.js +30 -24
  33. package/dist/utility/chart/marketKind.util.d.ts +12 -10
  34. package/dist/utility/chart/marketKind.util.js +17 -7
  35. package/dist/utility/chart/om-panel-push-style.util.d.ts +7 -7
  36. package/dist/utility/chart/om-panel-push-style.util.js +17 -15
  37. package/dist/utility/chart/om-panel.util.js +6 -6
  38. package/dist/utility/chart/profile-block-size.util.d.ts +16 -0
  39. package/dist/utility/chart/profile-block-size.util.js +7 -0
  40. package/dist/utility/chart/quote-perp.leaf.d.ts +17 -0
  41. package/dist/utility/chart/quote-perp.leaf.js +20 -0
  42. package/dist/utility/chart/wrun-run-result.util.d.ts +5 -0
  43. package/dist/utility/chart/wrun-run-result.util.js +4 -1
  44. package/dist/utility/common/transformations.util.d.ts +7 -0
  45. package/dist/utility/common/transformations.util.js +11 -0
  46. package/dist/utility/options/option-venue.util.d.ts +3 -3
  47. package/dist/utility/options/option-venue.util.js +3 -3
  48. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +1 -1
  49. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +2 -2
  50. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.d.ts +2 -2
  51. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.js +5 -1
  52. package/dist/utility/wrun/sources/row-lane-registry.js +3 -2
  53. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +9 -3
  54. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +13 -5
  55. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +11 -0
  56. package/dist/utility/wrun/sources/row-lanes/option_prints.js +63 -9
  57. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +8 -0
  58. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +12 -0
  59. package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +5 -2
  60. package/dist/utility/wrun/sources/row-lanes/option_surface.js +5 -2
  61. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +11 -5
  62. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +31 -10
  63. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +33 -1
  64. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +95 -6
  65. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +25 -5
  66. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +55 -18
  67. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +146 -40
  68. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +16 -3
  69. package/dist/utility/wrun/wrun-batched-marks.util.js +30 -19
  70. package/dist/utility/wrun/wrun-batched-readout.util.d.ts +37 -9
  71. package/dist/utility/wrun/wrun-batched-readout.util.js +61 -15
  72. package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -0
  73. package/dist/utility/wrun/wrun-cell-capacity.leaf.d.ts +66 -0
  74. package/dist/utility/wrun/wrun-cell-capacity.leaf.js +86 -0
  75. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +147 -9
  76. package/dist/utility/wrun/wrun-chart-market-facts.util.js +345 -11
  77. package/dist/utility/wrun/wrun-color-facts.util.d.ts +19 -9
  78. package/dist/utility/wrun/wrun-color-facts.util.js +24 -14
  79. package/dist/utility/wrun/wrun-color-settings.util.d.ts +15 -4
  80. package/dist/utility/wrun/wrun-color-settings.util.js +31 -12
  81. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.d.ts +17 -0
  82. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.js +9 -0
  83. package/dist/utility/wrun/wrun-download-meter.util.d.ts +92 -0
  84. package/dist/utility/wrun/wrun-download-meter.util.js +122 -0
  85. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +6 -1
  86. package/dist/utility/wrun/wrun-draft-overlay.util.js +23 -3
  87. package/dist/utility/wrun/wrun-frames.js +5 -5
  88. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
  89. package/dist/utility/wrun/wrun-hosted-wire-caps.js +7 -0
  90. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +33 -17
  91. package/dist/utility/wrun/wrun-hud-looks.util.js +30 -16
  92. package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +8 -6
  93. package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +8 -6
  94. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -2
  95. package/dist/utility/wrun/wrun-live-intake.util.d.ts +6 -2
  96. package/dist/utility/wrun/wrun-live-intake.util.js +136 -21
  97. package/dist/utility/wrun/wrun-live-tick.util.js +91 -38
  98. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.d.ts +53 -0
  99. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.js +162 -0
  100. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +166 -48
  101. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +216 -33
  102. package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +51 -7
  103. package/dist/utility/wrun/wrun-market-size-defaults.util.js +314 -56
  104. package/dist/utility/wrun/wrun-option-prints.util.d.ts +41 -2
  105. package/dist/utility/wrun/wrun-option-prints.util.js +80 -13
  106. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +3 -0
  107. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +3 -0
  108. package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +23 -0
  109. package/dist/utility/wrun/wrun-option-strike-flow.util.js +55 -0
  110. package/dist/utility/wrun/wrun-option-views.util.d.ts +51 -7
  111. package/dist/utility/wrun/wrun-option-views.util.js +151 -28
  112. package/dist/utility/wrun/wrun-options-stop.util.d.ts +2 -1
  113. package/dist/utility/wrun/wrun-options-stop.util.js +3 -2
  114. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +3 -0
  115. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +31 -14
  116. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +22 -0
  117. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +7 -0
  118. package/dist/utility/wrun/wrun-overlay-recovery.util.js +25 -1
  119. package/dist/utility/wrun/wrun-overlay-result.util.d.ts +7 -1
  120. package/dist/utility/wrun/wrun-overlay-result.util.js +2 -0
  121. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +34 -6
  122. package/dist/utility/wrun/wrun-overlay-run.util.js +416 -171
  123. package/dist/utility/wrun/wrun-pack-widths.leaf.d.ts +4 -4
  124. package/dist/utility/wrun/wrun-pack-widths.leaf.js +4 -4
  125. package/dist/utility/wrun/wrun-pack.util.d.ts +7 -3
  126. package/dist/utility/wrun/wrun-pack.util.js +20 -9
  127. package/dist/utility/wrun/wrun-panel-style.util.d.ts +27 -15
  128. package/dist/utility/wrun/wrun-panel-style.util.js +42 -20
  129. package/dist/utility/wrun/wrun-param-map.util.d.ts +7 -6
  130. package/dist/utility/wrun/wrun-param-map.util.js +8 -5
  131. package/dist/utility/wrun/wrun-param-values.util.d.ts +10 -2
  132. package/dist/utility/wrun/wrun-param-values.util.js +2 -0
  133. package/dist/utility/wrun/wrun-prefix-lanes.util.js +2 -2
  134. package/dist/utility/wrun/wrun-refusal.util.js +10 -1
  135. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +7 -0
  136. package/dist/utility/wrun/wrun-source-rows.util.d.ts +4 -0
  137. package/dist/utility/wrun/wrun-source-rows.util.js +92 -40
  138. package/dist/utility/wrun/wrun-tape-source.util.d.ts +126 -50
  139. package/dist/utility/wrun/wrun-tape-source.util.js +193 -68
  140. package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +7 -5
  141. package/dist/utility/wrun/wrun-volume-profile-lane.util.js +8 -6
  142. package/dist/workers/utils/volume-profile.worker.util.d.ts +4 -1
  143. package/dist/workers/utils/volume-profile.worker.util.js +5 -2
  144. package/dist/workers/wrun/wrun-abi-host.js +3 -2
  145. package/package.json +11 -11
@@ -1,23 +1,53 @@
1
1
  /**
2
- * The run head's market-scaled size defaults (the rule and the table: wrun-market-size-defaults.leaf). A package that
3
- * scales a param (Big Trades' Min size and Whale size) has its record moved to the chart market's defaults at the head
4
- * of every full run, before the tape is resolved, so the run, the settings panel's value, the reset icon and its
5
- * target, and the alert arm all read the one record:
2
+ * The run head's market-scaled size defaults (the rules and the table: wrun-market-size-defaults.leaf). A package that
3
+ * scales a param (Big Trades' Min value and Whale value, 0.5.0's Min size and Whale size) has its record moved to the
4
+ * chart market's defaults at the head of every full run, before the tape is resolved, so the run, the settings panel's
5
+ * value, the reset icon and its target, and the alert arm all read the one record:
6
6
  *
7
- * - The market's defaults are resolved once per mount and market (a page session's switch back to a market reads what
8
- * it read there the first time), so a value never flaps inside a session: the chart's own candles give the daily
9
- * base volume on a coin market whose candles are in base coins (the directory row places the coin, so a cold page
10
- * waits for it once); a market whose facts never yield one (contracts, shares, candles in another unit, a formula
11
- * chart, keyed apart from its market) reads the package's declared defaults, so the record never keeps the last
12
- * coin market's; a size unit not known yet or too few candles resolves nothing (the record stays, the next run asks
13
- * again).
7
+ * - The rules are the family the sheet declares (`wrunMarketScaledRulesOfSheet`: 0.6.0's dollar rule, 0.5.0's coin
8
+ * rule). The market's defaults are resolved once per mount, market and family (a page session's switch back to a
9
+ * market reads what it read there the first time), so a value never flaps inside a session: the chart's own candles
10
+ * give the daily volume, in dollars through the market's dollar unit (`wrunMarketDollarUnit`, the market facts, never
11
+ * a venue list) or in base coins on a coin market whose candles are in base coins (the directory row places the coin
12
+ * and names the quote, so a cold page waits for it once); a market whose facts never yield one (no point value, a
13
+ * quote that is no dollar, a formula chart keyed apart from its market; for the coin rule contracts, shares, candles
14
+ * in another unit) reads the package's declared defaults, so the record never keeps the last market's; a fact not
15
+ * known yet or too few candles resolves nothing (the record stays, the next run asks again).
14
16
  * - A row moves while the user never changed it (the value reads as the row's default, the settings panel's reset
15
17
  * test, `wrunRowValuesEqual` over `wrunRowValue`): its value and its `defaultValue` together. A changed value keeps
16
18
  * both, so it reads as changed on every market after it; its reset goes to the default of the market where it was
17
19
  * changed, and the run head of the save the reset is moves the now unchanged value to this market's.
20
+ * - The carry (C-DOLLAR's saved values): a raw-unit value the user changed on 0.5.0 (Min size, Whale size) rides the
21
+ * record under its old name after the pin move (wrun-twin-pin-move.util WRUN_PIN_CARRY_DOLLAR_CONVERSIONS), and the
22
+ * first head that proves what one STORED unit is worth there prices it once into the dollar param that took its
23
+ * place (raw stored units x the dollars per stored unit, the large-print writer's own price of one off the market's
24
+ * newest TRADE_LARGE print: wrun-chart-market-facts.util `wrunMarketStoredUnitDollars`; held to 3 significant
25
+ * figures, `wrunCarriedDollarValue`). The dollar row marks the carried value (`carriedValue`), so it counts as
26
+ * changed on this market and every one after it, even where it equals the row's default
27
+ * (`wrunMarketScaledRowChanged`), and a carry is pending only while its dollar row holds no mark, so it prices once.
28
+ * On a market that counts contracts (the CME family, `wrunCarryKeepsRawValue`) the old name stays stored, the
29
+ * contract count the version that floors CME in contracts restores exactly; everywhere else it is cleared. A market
30
+ * whose stored unit can never be proven writes no value (the market's dollar default applies) and drops the carry,
31
+ * the ring naming the market (`wrun-market-size-carry-dropped`), except on a market that counts contracts, where the
32
+ * raw value stays under its old name (`wrun-market-size-carry-kept`); one a read can still prove keeps it under its
33
+ * old name for the next run.
18
34
  * - The engine copy takes the patch (titan merges it at once, so the run reads it) and the workspace row its own, with
19
35
  * one reconcile persist (no gesture, no undo entry), the delivered sheet's reconcile's pattern
20
36
  * (wrun-overlay-run.util `reconcileWrunSourceRecord`, which keeps the moved defaults when it rebuilds the rows).
37
+ * - The option family (r11, Big Trades 0.7.0's Size shown as, `contracts-option`): split off the volume rules
38
+ * (`wrunMarketScaledFamilies`) and resolved in the same warm block with its own verdict
39
+ * (`wrunMarketOptionVerdict`, no candles read) and its own memo key (`<market>#options`), so a volume rule that
40
+ * waits on its candles never holds the option back, nor the option the volume rules. Its select row moves while
41
+ * untouched like a number row (value and default together, in the row's own spelling), and the two families'
42
+ * defaults merge into one move patch.
43
+ * - The contracts carry (BT-CME, wrun-market-size-contract-carry.leaf, by param name): on a market that counts
44
+ * contracts, a 0.5.x count still the user's latest word (the dollar row unmarked, or still at its carried mark: S0
45
+ * kept the old name there) moves to Min size or Whale size exactly; else a changed dollar value (0.6.x or 0.7.x, a
46
+ * carried one included) counts `ceil(value / dollars per contract)` at the stored-unit price; the contracts row is
47
+ * marked, the old name cleared, the dollar row back to untouched (the market's dollar default then moves it). It runs
48
+ * before the dollar carry and takes its own raw names, so the dollar carry never prices them; ring
49
+ * `wrun-market-size-contract-carry`. The contracts params themselves follow no market (the package's flat 10 and
50
+ * 100 contracts, Kyle 2026-10-23): no rule of the table names them.
21
51
  *
22
52
  * Advisory: it never fails the run.
23
53
  */
@@ -25,8 +55,9 @@ import { wrunChartHostEnv } from '../../host-env.js';
25
55
  import { candleVolumeIsBaseCoins } from '../chart/candle-volume-unit.leaf.js';
26
56
  import { normalizeTransformations, selfTransformationToken } from '../common/transformations.util.js';
27
57
  import { wrunChartIntervalMsOf } from './wrun-chart-context.util.js';
28
- import { warmWrunMarketFacts, wrunChartSizeUnit } from './wrun-chart-market-facts.util.js';
29
- import { isWrunMarketScaledRow, wrunMarketDefaultWithinRow, wrunMarketScaledParamsOf, wrunMarketSizeVerdict, } from './wrun-market-size-defaults.leaf.js';
58
+ import { warmWrunMarketDollarFacts, warmWrunMarketStoredUnit, wrunChartSizeUnit, wrunMarketDollarUnit, wrunMarketStoredUnitDollars, } from './wrun-chart-market-facts.util.js';
59
+ import { isWrunMarketScaledRow, wrunCarriedDollarValue, wrunCarryKeepsRawValue, wrunMarketDefaultWithinRow, wrunMarketOptionVerdict, wrunMarketScaledFamilies, wrunMarketScaledParamsOf, wrunMarketScaledRulesOfSheet, wrunMarketSizeVerdict, } from './wrun-market-size-defaults.leaf.js';
60
+ import { WRUN_CONTRACT_CARRY_PENDING, wrunContractCarryPatch, wrunContractCarrySettles, wrunPendingContractCarries, } from './wrun-market-size-contract-carry.leaf.js';
30
61
  import { wrunChartMarketIdentity } from './wrun-overlay-drivers.util.js';
31
62
  import { wrunRegistryRefOf } from './wrun-overlay-identity.util.js';
32
63
  import { wrunRowValue, wrunRowValuesEqual, wrunValuesEqual, } from './wrun-script-inputs.util.js';
@@ -34,16 +65,36 @@ import { wrunChartCandleRows } from './wrun-source-rows.util.js';
34
65
  function isRecord(value) {
35
66
  return value !== null && typeof value === 'object' && !Array.isArray(value);
36
67
  }
68
+ /** A record with a patch merged over it (a carry's), the record itself as an object when there is none. */
69
+ function withPatch(settings, patch) {
70
+ return { ...(isRecord(settings) ? settings : {}), ...(patch ?? {}) };
71
+ }
72
+ /**
73
+ * Whether a market-scaled row holds a value the user chose (the market defaults never move it): a value off its row's
74
+ * default (the settings panel's reset test, `wrunRowValuesEqual` over `wrunRowValue`), or the value a carry priced into
75
+ * it (`carriedValue`, C-DOLLAR), which counts as chosen even where it equals the row's default: a 0.5.0 Min size of
76
+ * 5,000 Binance delivery contracts of $100 carries $500,000, the sheet's default, and must not follow the next market's
77
+ * default. Pure.
78
+ */
79
+ export function wrunMarketScaledRowChanged(record, row) {
80
+ const value = wrunRowValue(record, row);
81
+ if (!wrunRowValuesEqual(row, value, row.defaultValue))
82
+ return true;
83
+ return typeof row.carriedValue === 'number' && wrunRowValuesEqual(row, value, row.carriedValue);
84
+ }
37
85
  /**
38
86
  * The patch that moves a record (`settings`: its `scriptInputs` rows and each value flat under its row's name) to a
39
- * market's `defaults`: every scaled row whose value reads as its default (never changed) takes the market's default
40
- * (held to the row's bounds), value and `defaultValue` together. A changed value keeps both: the changed mark is the
41
- * value against its own row's default, so a default moved under a kept value would read the value as never changed on
42
- * the first market whose default equals it, and the next market would move it (SOL 200, then ETH whose default is
43
- * 200, then SOL reset it to 1000). Its reset goes to the default of the market where the user changed it, a save
44
- * whose run head then moves the unchanged value on. Undefined when the record already reads the defaults. Pure.
87
+ * market's `defaults`: every scaled row whose value the user never chose (`wrunMarketScaledRowChanged`) takes the
88
+ * market's default (held to the row's bounds, a select's as the option it names), value and `defaultValue` together.
89
+ * `rules` are the rules the defaults were read by: a select row moves under an option rule only (without them, number
90
+ * rows only, the volume families' kind). A changed value keeps both: the
91
+ * changed mark is the value against its own row's default, so a default moved under a kept value would read the value
92
+ * as never changed on the first market whose default equals it, and the next market would move it (SOL 200, then ETH
93
+ * whose default is 200, then SOL reset it to 1000). Its reset goes to the default of the market where the user changed
94
+ * it, a save whose run head then moves the unchanged value on. A carried value (`carriedValue`) is a changed one too,
95
+ * whatever its row's default. Undefined when the record already reads the defaults. Pure.
45
96
  */
46
- export function wrunMarketSizeSettingsPatch(settings, defaults) {
97
+ export function wrunMarketSizeSettingsPatch(settings, defaults, rules) {
47
98
  const record = isRecord(settings) ? settings : {};
48
99
  if (!Array.isArray(record.scriptInputs))
49
100
  return undefined;
@@ -53,12 +104,12 @@ export function wrunMarketSizeSettingsPatch(settings, defaults) {
53
104
  if (!isRecord(held) || typeof held.name !== 'string' || !Object.hasOwn(defaults, held.name))
54
105
  return held;
55
106
  const row = held;
56
- if (!isWrunMarketScaledRow(row))
107
+ if (!isWrunMarketScaledRow(row, rules?.[row.name]))
57
108
  return held;
58
109
  const target = wrunMarketDefaultWithinRow(row, defaults[row.name]);
59
110
  if (target === undefined)
60
111
  return held;
61
- if (!wrunRowValuesEqual(row, wrunRowValue(record, row), row.defaultValue))
112
+ if (wrunMarketScaledRowChanged(record, row))
62
113
  return held;
63
114
  if (!wrunValuesEqual(record[row.name], target))
64
115
  patch[row.name] = target;
@@ -71,8 +122,86 @@ export function wrunMarketSizeSettingsPatch(settings, defaults) {
71
122
  patch.scriptInputs = scriptInputs;
72
123
  return Object.keys(patch).length > 0 ? patch : undefined;
73
124
  }
125
+ /** Whether a record's dollar row `name` holds a carried mark (`carriedValue`: a carry already priced into it). */
126
+ function wrunRowHoldsCarriedMark(record, name) {
127
+ const rows = Array.isArray(record.scriptInputs) ? record.scriptInputs : [];
128
+ return rows.some((row) => isRecord(row) && row.name === name && typeof row.carriedValue === 'number' && Number.isFinite(row.carriedValue));
129
+ }
130
+ /** The carries a record holds for the scaled rules its sheet declares: a rule's `carriesFrom` name held flat on the
131
+ * record with a finite positive value while the sheet no longer declares it (the pin move left it there), and while
132
+ * the dollar row holds no carried mark: a carry prices once, so a raw value kept under its old name (a market that
133
+ * counts contracts, `wrunCarryKeepsRawValue`) never prices again, after a reload, a market switch or a reset alike
134
+ * (a reset writes values, never the rows, so the mark stays). */
135
+ export function wrunPendingDollarCarries(settings, rules, sheetParams) {
136
+ const record = isRecord(settings) ? settings : {};
137
+ const pending = [];
138
+ for (const [to, rule] of Object.entries(rules)) {
139
+ if (rule.kind === 'daily-volume' || rule.carriesFrom === undefined)
140
+ continue;
141
+ const from = rule.carriesFrom;
142
+ if (sheetParams.has(from) || !Object.hasOwn(record, from) || wrunRowHoldsCarriedMark(record, to))
143
+ continue;
144
+ const raw = record[from];
145
+ if (typeof raw === 'number' && Number.isFinite(raw) && raw > 0)
146
+ pending.push({ to, from, raw });
147
+ }
148
+ return pending;
149
+ }
150
+ /**
151
+ * The patch that prices a record's pending carries once (C-DOLLAR's saved values): each carry's raw value in STORED
152
+ * units x the dollars one stored unit is worth at the market's price (`stored`, wrun-chart-market-facts.util
153
+ * `wrunMarketStoredUnitDollars`), held to 3 significant figures (`wrunCarriedDollarValue`) and to the dollar row's
154
+ * bounds, written flat under the dollar param, and the dollar row marked with it (`carriedValue`: a changed value
155
+ * whatever its row's default, `wrunMarketScaledRowChanged`; its row's default stays). The old name is cleared, except
156
+ * on a market that counts contracts (`sizeUnit`, `wrunCarryKeepsRawValue`), where it stays stored: the version that
157
+ * floors such a market in contracts restores the count exactly, and the mark keeps it from pricing twice (so a carry
158
+ * that keeps its old name and finds no dollar row to mark writes nothing yet). A stored unit that can never be proven
159
+ * (`unproven`, not transient: no large print of the market in the table's week, a quote that is no dollar, a CME
160
+ * contract with no point value) writes no value (the market's dollar default applies) and clears the old name, except
161
+ * on a market that counts contracts; a transient one writes nothing (the next run asks again). `sizeUnit` is required
162
+ * of every caller (undefined where the market's is not known: the old name is cleared), so the engine copy and the
163
+ * workspace row are always carried by one rule. Undefined when nothing moves. Pure.
164
+ */
165
+ export function wrunDollarCarryPatch(settings, pending, stored, sizeUnit) {
166
+ if (pending.length === 0 || stored === undefined)
167
+ return undefined;
168
+ const record = isRecord(settings) ? settings : {};
169
+ const rows = Array.isArray(record.scriptInputs) ? record.scriptInputs : [];
170
+ const keepsRawValue = wrunCarryKeepsRawValue(sizeUnit);
171
+ const patch = {};
172
+ const carried = new Map();
173
+ for (const carry of pending) {
174
+ if (stored.kind === 'unproven') {
175
+ if (!stored.transient && !keepsRawValue)
176
+ patch[carry.from] = undefined;
177
+ continue;
178
+ }
179
+ const priced = wrunCarriedDollarValue(carry.raw, stored.perUnit);
180
+ if (priced === undefined)
181
+ continue;
182
+ const row = rows.find((candidate) => isRecord(candidate) && candidate.name === carry.to);
183
+ // A kept raw value prices once only under its row's mark: no row to mark, no carry yet.
184
+ if (row === undefined && keepsRawValue)
185
+ continue;
186
+ const value = row === undefined ? priced : wrunMarketDefaultWithinRow(row, priced);
187
+ // A dollar row holds a number (a sheet that retyped it carries nothing).
188
+ if (typeof value !== 'number')
189
+ continue;
190
+ patch[carry.to] = value;
191
+ if (!keepsRawValue)
192
+ patch[carry.from] = undefined;
193
+ carried.set(carry.to, value);
194
+ }
195
+ if (carried.size > 0 && rows.length > 0) {
196
+ patch.scriptInputs = rows.map((row) => isRecord(row) && typeof row.name === 'string' && carried.has(row.name)
197
+ ? { ...row, carriedValue: carried.get(row.name) }
198
+ : row);
199
+ }
200
+ return Object.keys(patch).length > 0 ? patch : undefined;
201
+ }
74
202
  /** Each mount's resolved defaults, by market (`exchange|symbol`, and a formula chart's formula after it: its candles
75
- * are no market's, so it reads the package's defaults where its market reads its own): the engine meta is the mount. */
203
+ * are no market's, so it reads the package's defaults where its market reads its own) and the scaled params the sheet
204
+ * declares (a version that moves families reads its own): the engine meta is the mount. */
76
205
  const wrunMarketSizeDefaultsByMount = new WeakMap();
77
206
  /** The scaled params' defaults a sheet declares (the package's own: a `package` verdict's). */
78
207
  function wrunDeclaredDefaults(sheet, names) {
@@ -86,6 +215,14 @@ function wrunDeclaredDefaults(sheet, names) {
86
215
  return defaults;
87
216
  }
88
217
  const WRUN_MARKET_SIZE_UNPROVEN = Object.freeze({ kind: 'skip', reason: 'unproven' });
218
+ /** The facts of a head that could not prove its reads the keyed market's: every declared family skips, nothing to
219
+ * price a carry with. */
220
+ function wrunMarketSizeUnprovenFacts(families) {
221
+ return {
222
+ ...(families.volume !== undefined ? { verdict: WRUN_MARKET_SIZE_UNPROVEN } : {}),
223
+ ...(families.options !== undefined ? { optionVerdict: WRUN_MARKET_SIZE_UNPROVEN } : {}),
224
+ };
225
+ }
89
226
  /**
90
227
  * Move an overlay's record to its chart market's scaled defaults (above), at the head of a full run, before the
91
228
  * lanes read the settings. Resolves once the engine copy reads the defaults (the persist is the routing's own); a
@@ -101,9 +238,13 @@ const WRUN_MARKET_SIZE_UNPROVEN = Object.freeze({ kind: 'skip', reason: 'unprove
101
238
  */
102
239
  export async function reconcileWrunMarketSizeDefaults(args) {
103
240
  const { chartIndex, indicatorId, tc, meta, sheet, market, isCurrent } = args;
104
- const rules = wrunMarketScaledParamsOf(wrunRegistryRefOf(meta.settings)?.package);
241
+ const sheetParams = new Set((sheet.params ?? []).map((param) => param.name));
242
+ const packageName = wrunRegistryRefOf(meta.settings)?.package;
243
+ const rules = wrunMarketScaledRulesOfSheet(wrunMarketScaledParamsOf(packageName), sheetParams);
105
244
  if (rules === undefined)
106
245
  return;
246
+ // The volume rules and the option rules resolve apart: each its own verdict, memo key and ring line.
247
+ const families = wrunMarketScaledFamilies(rules);
107
248
  const keyed = () => isCurrent() && wrunChartMarketIdentity(market.read()) === market.identity;
108
249
  try {
109
250
  if (!keyed())
@@ -115,21 +256,38 @@ export async function reconcileWrunMarketSizeDefaults(args) {
115
256
  return;
116
257
  const transformations = typeof chartMetadata?.transformations === 'string' ? chartMetadata.transformations : '';
117
258
  const formula = wrunChartFormulaOf(exchange, symbol, transformations);
118
- const key = formula === undefined ? `${exchange}|${symbol}` : `${exchange}|${symbol}|${formula}`;
259
+ const family = families.volume === undefined ? undefined : Object.keys(families.volume).sort().join(',');
260
+ const marketKey = formula === undefined ? `${exchange}|${symbol}` : `${exchange}|${symbol}|${formula}`;
261
+ const volumeKey = family === undefined ? undefined : `${marketKey}#${family}`;
262
+ const optionKey = families.options === undefined ? undefined : `${marketKey}#options`;
119
263
  let resolved = wrunMarketSizeDefaultsByMount.get(meta);
120
- let defaults = resolved?.get(key);
121
- if (defaults === undefined) {
122
- // A crypto market's coin unit is the directory row's (its asset class): asked once per market for the session,
123
- // never rejects; a contracts market answers from its own facts and waits on nothing. The data loading module
124
- // says whose candles the chart holds; a host that cannot load it proves nothing.
125
- const [, dataFetching] = await Promise.all([
126
- warmWrunMarketFacts(chartMetadata),
264
+ let volumeDefaults = volumeKey === undefined ? undefined : resolved?.get(volumeKey);
265
+ let optionDefaults = optionKey === undefined ? undefined : resolved?.get(optionKey);
266
+ const volumeOwed = volumeKey !== undefined && volumeDefaults === undefined;
267
+ const optionsOwed = optionKey !== undefined && optionDefaults === undefined;
268
+ // The contracts carry (BT-CME, wrun-market-size-contract-carry.leaf): on a market that counts contracts (its size
269
+ // unit never waits on a read) a saved count or a changed dollar value moves into the contracts params of a sheet
270
+ // declaring them, by name. The raw counts it takes are its own: the dollar carry never prices one of them.
271
+ const chartSizeUnit = wrunChartSizeUnit(chartMetadata);
272
+ const contractPending = wrunPendingContractCarries(meta.settings, packageName, sheetParams, chartSizeUnit);
273
+ const pending = wrunPendingDollarCarries(meta.settings, rules, sheetParams).filter((carry) => !contractPending.some((entry) => entry.raw === carry.from));
274
+ const pricesContracts = contractPending.some((entry) => entry.from === 'dollars');
275
+ let headFacts;
276
+ if (volumeOwed || optionsOwed || pending.length > 0 || contractPending.length > 0) {
277
+ // A crypto market's coin unit and quote are the directory row's (its asset class, its quote), a CME contract's
278
+ // point value the instrument registry's, and only with a raw floor to carry or a dollar value to count in
279
+ // contracts, what one stored unit is worth (the large-print writer's own rows): each asked once per market for
280
+ // the session, never rejects. The data loading module says whose candles the chart holds; a host that cannot
281
+ // load it proves nothing.
282
+ const [, , dataFetching] = await Promise.all([
283
+ warmWrunMarketDollarFacts(chartMetadata),
284
+ pending.length > 0 || pricesContracts ? warmWrunMarketStoredUnit(chartMetadata) : undefined,
127
285
  Promise.resolve()
128
286
  .then(() => wrunChartHostEnv().chart.loadDataFetching())
129
287
  .catch(() => undefined),
130
288
  ]);
131
- const verdict = keyed()
132
- ? wrunMarketSizeVerdictNow(rules, {
289
+ headFacts = keyed()
290
+ ? wrunMarketSizeFactsNow(families, {
133
291
  tc,
134
292
  chartMetadata: market.read() ?? undefined,
135
293
  identity: market.identity,
@@ -138,31 +296,98 @@ export async function reconcileWrunMarketSizeDefaults(args) {
138
296
  exchange,
139
297
  symbol,
140
298
  })
141
- : WRUN_MARKET_SIZE_UNPROVEN;
299
+ : wrunMarketSizeUnprovenFacts(families);
300
+ }
301
+ /** Keep one family's resolution: its ring line, and its defaults unless it skipped (a fact that can still change,
302
+ * or one not proven the keyed market's: nothing kept, nothing moves, the next run asks again). */
303
+ const resolve = (key, verdict, familyRules, event, familyName) => {
142
304
  if (wrunChartHostEnv().diagnostics.debugEnabled()) {
143
- wrunChartHostEnv().diagnostics.debug('wrun-market-size-defaults', {
305
+ wrunChartHostEnv().diagnostics.debug(event, {
144
306
  chartIndex,
145
307
  indicatorId,
146
- market: key,
308
+ market: marketKey,
309
+ family: familyName,
147
310
  verdict: verdict.kind,
148
311
  ...(verdict.kind !== 'market' ? { reason: verdict.reason } : {}),
149
312
  ...(verdict.kind === 'market' ? { defaults: verdict.defaults } : {}),
150
313
  });
151
314
  }
152
- // A fact that can still change (a unit not known yet, too few candles) or that could not be proven the keyed
153
- // market's: nothing kept, nothing moves, the next run asks again.
154
315
  if (verdict.kind === 'skip')
155
- return;
156
- defaults = verdict.kind === 'market' ? verdict.defaults : wrunDeclaredDefaults(sheet, Object.keys(rules));
316
+ return undefined;
317
+ const kept = verdict.kind === 'market' ? verdict.defaults : wrunDeclaredDefaults(sheet, Object.keys(familyRules ?? {}));
157
318
  if (resolved === undefined) {
158
319
  resolved = new Map();
159
320
  wrunMarketSizeDefaultsByMount.set(meta, resolved);
160
321
  }
161
- resolved.set(key, defaults);
322
+ resolved.set(key, kept);
323
+ return kept;
324
+ };
325
+ if (volumeOwed && volumeKey !== undefined && family !== undefined && headFacts?.verdict !== undefined) {
326
+ volumeDefaults = resolve(volumeKey, headFacts.verdict, families.volume, 'wrun-market-size-defaults', family);
327
+ }
328
+ if (optionsOwed && optionKey !== undefined && headFacts?.optionVerdict !== undefined) {
329
+ optionDefaults = resolve(optionKey, headFacts.optionVerdict, families.options, 'wrun-market-size-option-defaults', 'options');
162
330
  }
163
331
  if (!keyed())
164
332
  return;
165
- const enginePatch = wrunMarketSizeSettingsPatch(meta.settings, defaults);
333
+ // The carries first (each value a marked changed one, `carriedValue`, so the move below keeps it): the contracts
334
+ // carry, then the dollar carry over what it left; then the market's defaults, both families' in one patch.
335
+ const storedUnit = headFacts?.storedUnit;
336
+ const sizeUnit = headFacts?.sizeUnit;
337
+ const defaults = volumeDefaults === undefined && optionDefaults === undefined
338
+ ? undefined
339
+ : { ...(volumeDefaults ?? {}), ...(optionDefaults ?? {}) };
340
+ // What one contract is worth: the large-print writer's own price of one stored unit (a CME contract).
341
+ const perContract = storedUnit?.kind === 'dollars' ? storedUnit.perUnit : undefined;
342
+ const contractCarry = wrunContractCarryPatch(meta.settings, contractPending, perContract);
343
+ if (contractCarry !== undefined && wrunChartHostEnv().diagnostics.debugEnabled()) {
344
+ wrunChartHostEnv().diagnostics.debug('wrun-market-size-contract-carry', {
345
+ chartIndex,
346
+ indicatorId,
347
+ market: marketKey,
348
+ carried: contractPending.map((entry) => ({ to: entry.to, from: entry.from })),
349
+ patch: contractCarry,
350
+ });
351
+ }
352
+ // A migration's stamp settles on the version's first head on any market (review of !10790, finding A): cleared
353
+ // beside the carries it ran, so a later switch to a market that counts contracts never converts a dollar value.
354
+ const settled = wrunContractCarrySettles(meta.settings, packageName, sheetParams, chartSizeUnit, contractPending, perContract)
355
+ ? { [WRUN_CONTRACT_CARRY_PENDING]: undefined }
356
+ : undefined;
357
+ if (settled !== undefined && wrunChartHostEnv().diagnostics.debugEnabled()) {
358
+ wrunChartHostEnv().diagnostics.debug('wrun-market-size-contract-carry-settled', {
359
+ chartIndex,
360
+ indicatorId,
361
+ market: marketKey,
362
+ carried: contractCarry !== undefined,
363
+ });
364
+ }
365
+ const carry = wrunDollarCarryPatch(withPatch(meta.settings, contractCarry), pending, storedUnit, sizeUnit);
366
+ const unpriced = pending.length > 0 && storedUnit?.kind === 'unproven' && !storedUnit.transient ? storedUnit : undefined;
367
+ if (wrunChartHostEnv().diagnostics.debugEnabled() && (carry !== undefined || unpriced !== undefined)) {
368
+ // A carry the market can never price is dropped by name (the market's dollar default applies), or kept by name
369
+ // on a market that counts contracts: the ring says which market and why, so a user's Min size is never silent.
370
+ const event = unpriced === undefined
371
+ ? 'wrun-market-size-carry'
372
+ : wrunCarryKeepsRawValue(sizeUnit)
373
+ ? 'wrun-market-size-carry-kept'
374
+ : 'wrun-market-size-carry-dropped';
375
+ wrunChartHostEnv().diagnostics.debug(event, {
376
+ chartIndex,
377
+ indicatorId,
378
+ market: marketKey,
379
+ carried: Object.fromEntries(pending.map((entry) => [entry.from, entry.raw])),
380
+ ...(unpriced !== undefined ? { reason: unpriced.reason } : { patch: carry }),
381
+ });
382
+ }
383
+ const settingsOf = (settings) => ({
384
+ ...withPatch(settings, contractCarry),
385
+ ...(carry ?? {}),
386
+ });
387
+ const movePatch = defaults === undefined ? undefined : wrunMarketSizeSettingsPatch(settingsOf(meta.settings), defaults, rules);
388
+ const enginePatch = settled === undefined && contractCarry === undefined && carry === undefined && movePatch === undefined
389
+ ? undefined
390
+ : { ...(settled ?? {}), ...(contractCarry ?? {}), ...(carry ?? {}), ...(movePatch ?? {}) };
166
391
  if (enginePatch === undefined)
167
392
  return;
168
393
  const chart = tc;
@@ -175,10 +400,18 @@ export async function reconcileWrunMarketSizeDefaults(args) {
175
400
  return;
176
401
  const document = resolveChart(chartIndex);
177
402
  const row = [...(document?.onchart ?? []), ...(document?.offchart ?? [])].find((candidate) => candidate?.id === indicatorId);
178
- const rowPatch = row === undefined ? undefined : wrunMarketSizeSettingsPatch(row.settings, defaults);
179
- if (row === undefined || rowPatch === undefined)
403
+ if (row === undefined)
404
+ return;
405
+ const rowContractCarry = contractCarry === undefined ? undefined : wrunContractCarryPatch(row.settings, contractPending, perContract);
406
+ const rowCarry = carry === undefined
407
+ ? undefined
408
+ : wrunDollarCarryPatch(withPatch(row.settings, rowContractCarry), pending, storedUnit, sizeUnit);
409
+ const rowSettings = { ...withPatch(row.settings, rowContractCarry), ...(rowCarry ?? {}) };
410
+ const rowMove = defaults === undefined ? undefined : wrunMarketSizeSettingsPatch(rowSettings, defaults, rules);
411
+ if (settled === undefined && rowContractCarry === undefined && rowCarry === undefined && rowMove === undefined) {
180
412
  return;
181
- row.settings = { ...(row.settings ?? {}), ...rowPatch };
413
+ }
414
+ row.settings = { ...rowSettings, ...(rowMove ?? {}), ...(settled ?? {}) };
182
415
  persistChart(chartIndex, 'reconcile');
183
416
  }
184
417
  catch (error) {
@@ -194,20 +427,45 @@ function wrunChartFormulaOf(exchange, symbol, transformations) {
194
427
  : formula;
195
428
  }
196
429
  /**
197
- * The verdict of the keyed market's facts, read in the caller's task once the chart is proven on that market: the
198
- * size unit once the directory placed it, the venue's candle volume unit (`ownCandles`: a formula chart's candles are
199
- * no market's), and the chart's own candles while they were loaded for the keyed market (`loaded`, the loaded-main
200
- * identity, names its `identity`). Candles loaded for another market are never read: the verdict that would read them
201
- * reads `unproven` (the candles not yet the market's own, never its own too few).
430
+ * The facts of the keyed market, read in the caller's task once the chart is proven on that market: the size unit once
431
+ * the directory placed it, the venue's candle volume unit (`ownCandles`: a formula chart's candles are no market's),
432
+ * the market's dollar unit (the market facts, `wrunMarketDollarUnit`), and the chart's own candles while they were
433
+ * loaded for the keyed market (`loaded`, the loaded-main identity, names its `identity`). Candles loaded for another
434
+ * market are never read: the volume verdict that would read them reads `unproven` (the candles not yet the market's
435
+ * own, never its own too few), and no carry prices with them. The option verdict reads no candles, so it stands then.
202
436
  */
203
- function wrunMarketSizeVerdictNow(rules, facts) {
437
+ function wrunMarketSizeFactsNow(families, facts) {
204
438
  const rowsOwn = facts.loaded !== null && wrunChartMarketIdentity(facts.loaded) === facts.identity;
205
- const verdict = wrunMarketSizeVerdict(rules, {
439
+ const rows = rowsOwn && families.volume !== undefined
440
+ ? wrunChartCandleRows(facts.tc)
441
+ : [];
442
+ // A formula chart's candles are no market's: its dollar volume is no market's either, so the dollar rule reads the
443
+ // package's defaults there (`candle-unit`, as the coin rule does), and a pending carry waits for a run on the
444
+ // market's own candles (a formula's close is no price of the market's prints).
445
+ const dollarUnit = facts.ownCandles
446
+ ? wrunMarketDollarUnit(facts.chartMetadata)
447
+ : { kind: 'unproven', reason: 'quote', transient: true };
448
+ const sizeFacts = {
206
449
  sizeUnit: wrunChartSizeUnit(facts.chartMetadata),
207
450
  candleVolumeInCoins: facts.ownCandles && candleVolumeIsBaseCoins(facts.exchange, facts.symbol),
208
- rows: rowsOwn ? wrunChartCandleRows(facts.tc) : [],
451
+ ...(facts.ownCandles ? { dollarUnit } : {}),
452
+ rows,
209
453
  intervalMs: wrunChartIntervalMsOf(facts.chartMetadata?.interval),
210
- });
454
+ };
455
+ const optionVerdict = families.options === undefined ? undefined : wrunMarketOptionVerdict(families.options, sizeFacts);
456
+ const options = optionVerdict === undefined ? {} : { optionVerdict };
457
+ if (families.volume === undefined)
458
+ return options;
459
+ const verdict = wrunMarketSizeVerdict(families.volume, sizeFacts);
211
460
  // Only the verdict that reads the candles meets the rows held back, and no rows read as too few candles.
212
- return !rowsOwn && verdict.kind === 'skip' && verdict.reason === 'cover' ? WRUN_MARKET_SIZE_UNPROVEN : verdict;
461
+ if (!rowsOwn && verdict.kind === 'skip' && verdict.reason === 'cover') {
462
+ return { verdict: WRUN_MARKET_SIZE_UNPROVEN, ...options };
463
+ }
464
+ // What a carried raw floor's stored unit is worth here: the large-print writer's own price of one (a formula chart
465
+ // is no market's: its carry waits for a run on the market's own chart), and the size unit that says whether the
466
+ // carry keeps the raw value under its old name.
467
+ const storedUnit = facts.ownCandles
468
+ ? wrunMarketStoredUnitDollars(facts.chartMetadata)
469
+ : { kind: 'unproven', reason: 'quote', transient: true };
470
+ return { verdict, ...options, storedUnit, sizeUnit: sizeFacts.sizeUnit };
213
471
  }
@@ -286,8 +286,9 @@ export declare function isWrunOptionPrintMarker(tuple: ArrayLike<number>): boole
286
286
  * answers. The live fold applies it after every drain, so a live bar never outgrows the cut its history was read under
287
287
  * (Flow Tape's day bar held the newest 3,000 prints from history, then every live print of the day on top, past its
288
288
  * `max_cells`). A bar the cut empties keeps its row, empty or, when it was partial, the marker; a marker is no print.
289
- * No newest cut, or `overflow: "largest"` (each bar's largest prints are the projection's, and the newest cut changes no
290
- * bar it draws): the rows as they are (copied).
289
+ * No newest cut, or `overflow: "largest"` (the projection makes the cut there, each bar's largest unioned with the
290
+ * window's newest over every print the rows hold, `wrunLargestOrNewestOptionPrints`, again on every run): the rows as
291
+ * they are (copied).
291
292
  */
292
293
  export declare function wrunNewestOptionPrintRows(rows: ReadonlyArray<ReadonlyArray<unknown>>, acquisition: Pick<WrunOptionPrintsAcquisition, 'newest' | 'newestTailMs' | 'overflow'>): unknown[][];
293
294
  /**
@@ -311,4 +312,42 @@ export declare function forEachWrunOptionPrintTuple(row: ReadonlyArray<unknown>,
311
312
  * the bar as partial. A bar within its bound is returned as it is.
312
313
  */
313
314
  export declare function wrunLargestPremiumPrints(tuples: ReadonlyArray<ReadonlyArray<number>>, maxCells: number): ReadonlyArray<ReadonlyArray<number>>;
315
+ /**
316
+ * Where the window's newest cut ends under `overflow: "largest"` (the union, the SDK's frozen contract): the window's
317
+ * `newest` newest prints ranked by time, then print key, newest first, exactly `newest` of them (a print's time its
318
+ * bar's open plus its offset; the gateway keeps every print sharing the last one's millisecond, the key cuts them here),
319
+ * read as the last of them: its time, its key and its bar's open. A print is inside the cut when its time, then its
320
+ * key, is at or after the bound's.
321
+ */
322
+ export interface WrunNewestOptionPrintBound {
323
+ atMs: number;
324
+ key: number;
325
+ barOpenMs: number;
326
+ }
327
+ /**
328
+ * The bound of the window's newest cut over every bar an instance holds (`WrunNewestOptionPrintBound`), or undefined
329
+ * when they hold fewer than `newest` prints (every print is inside the cut). A partial bar's marker is no print. The
330
+ * bound is the same over the gateway's union answer, today's whole download and either one merged with live prints: each
331
+ * holds the window's `newest` newest prints whole.
332
+ */
333
+ export declare function wrunNewestOptionPrintBound(bars: ReadonlyArray<{
334
+ readonly openMs: number;
335
+ readonly tuples: ReadonlyArray<ReadonlyArray<number>>;
336
+ }>, newest: number): WrunNewestOptionPrintBound | undefined;
337
+ /**
338
+ * One bar's prints under `overflow: "largest"` beside the window's newest cut (the union, the SDK's frozen contract):
339
+ * its `maxCells` largest (`wrunLargestPremiumPrints`' order) and every print inside the cut (`bound`, from
340
+ * `wrunNewestOptionPrintBound`), each once, in the order given. So a block holds at most `maxCells` plus the cut's
341
+ * count, the read's capacity for the input (wrun-cell-capacity.leaf `wrunCellReadCapacity`), which a module holds whole
342
+ * only when its sheet's `capacity` does (`wrunCellBlockTuples`).
343
+ *
344
+ * Bit 14 on the first kept print, by a rule every answer reads alike (the gateway's union answer, today's whole
345
+ * download, either one merged with live prints), so the cells never depend on the path: a bar older than the bar
346
+ * holding the bound, past `maxCells` prints (none of its prints is newest: its largest alone, as without the cut); and
347
+ * the bar holding the bound, past `maxCells` prints, even when nothing it holds is left out (the gateway answers its
348
+ * largest and its prints inside the cut, so whether an older and smaller print was left out cannot be told there). A bar
349
+ * newer than that one holds only prints inside the cut, and with no bound (fewer than `newest` prints in the window)
350
+ * every bar holds every print, unmarked.
351
+ */
352
+ export declare function wrunLargestOrNewestOptionPrints(tuples: ReadonlyArray<ReadonlyArray<number>>, barOpenMs: number, maxCells: number, bound: WrunNewestOptionPrintBound | undefined): ReadonlyArray<ReadonlyArray<number>>;
314
353
  export {};