@orangecharts/wrun-chart-host 0.8.0 → 0.10.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 (246) hide show
  1. package/README.md +3 -1
  2. package/dist/constants/feature-flags.constants.d.ts +9 -0
  3. package/dist/constants/feature-flags.constants.js +86 -16
  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 +15 -0
  7. package/dist/constants/opra-compliance.constants.js +15 -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/constants/scriptEditor/builtin-script-snippets.d.ts +26 -0
  11. package/dist/constants/scriptEditor/builtin-script-snippets.js +6 -0
  12. package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.d.ts +15 -0
  13. package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.js +17 -0
  14. package/dist/constants/venue-presets.constants.d.ts +20 -20
  15. package/dist/constants/venue-presets.constants.js +24 -26
  16. package/dist/host-env.d.ts +39 -9
  17. package/dist/host-env.js +6 -0
  18. package/dist/host-ports.types.d.ts +108 -18
  19. package/dist/index.d.ts +14 -0
  20. package/dist/index.js +14 -0
  21. package/dist/interfaces/kscript-diagnostics.interface.d.ts +6 -0
  22. package/dist/interfaces/opra-realtime.interface.d.ts +13 -11
  23. package/dist/interfaces/opra-realtime.interface.js +10 -10
  24. package/dist/interfaces/replay.interface.d.ts +8 -0
  25. package/dist/interfaces/wrun-runtime.interface.d.ts +52 -15
  26. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +94 -14
  27. package/dist/kscript-data/controls/live-trades-merge.util.js +132 -22
  28. package/dist/kscript-data/controls/live-trades-order-gate.util.d.ts +56 -0
  29. package/dist/kscript-data/controls/live-trades-order-gate.util.js +107 -0
  30. package/dist/market-data/billing.interface.d.ts +227 -42
  31. package/dist/market-data/billing.interface.js +60 -12
  32. package/dist/market-data/venue.d.ts +88 -6
  33. package/dist/market-data/venues/cme.contract.copy.json +66 -0
  34. package/dist/market-data/venues/cme.d.ts +126 -0
  35. package/dist/market-data/venues/cme.js +133 -0
  36. package/dist/market-data/venues/index.d.ts +165 -8
  37. package/dist/market-data/venues/index.js +48 -6
  38. package/dist/market-data/venues/opra.contract.copy.json +5 -3
  39. package/dist/market-data/venues/opra.d.ts +3 -3
  40. package/dist/market-data/venues/opra.js +5 -4
  41. package/dist/replay/replayLadder.js +3 -1
  42. package/dist/settings-templates/index.js +7 -3
  43. package/dist/settings-templates/indicator-fields.d.ts +5 -4
  44. package/dist/settings-templates/indicator-fields.js +45 -6
  45. package/dist/settings-templates/tool-rules.d.ts +27 -17
  46. package/dist/settings-templates/tool-rules.js +27 -11
  47. package/dist/settings-templates/tool-tables.generated.js +91 -31
  48. package/dist/utility/chart/book-live-bucket.util.d.ts +15 -0
  49. package/dist/utility/chart/book-live-bucket.util.js +47 -0
  50. package/dist/utility/chart/crypto-index.leaf.d.ts +2 -2
  51. package/dist/utility/chart/crypto-index.leaf.js +2 -2
  52. package/dist/utility/chart/index-mode-admission.util.js +24 -3
  53. package/dist/utility/chart/index-mode.util.d.ts +5 -2
  54. package/dist/utility/chart/index-mode.util.js +23 -13
  55. package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +35 -11
  56. package/dist/utility/chart/kscript-drawing-safe-area.util.js +145 -35
  57. package/dist/utility/chart/kscript-live-coalesce.util.d.ts +7 -2
  58. package/dist/utility/chart/kscript-live-coalesce.util.js +9 -3
  59. package/dist/utility/chart/kscript-provenance-keys.util.js +6 -0
  60. package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +3 -1
  61. package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +32 -2
  62. package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +45 -0
  63. package/dist/utility/chart/kscript-venue-policy.util.d.ts +53 -27
  64. package/dist/utility/chart/kscript-venue-policy.util.js +74 -32
  65. package/dist/utility/chart/market-session-schedule.util.d.ts +10 -0
  66. package/dist/utility/chart/market-session-schedule.util.js +16 -0
  67. package/dist/utility/chart/marketKind.util.d.ts +12 -10
  68. package/dist/utility/chart/marketKind.util.js +17 -7
  69. package/dist/utility/chart/om-panel-push-style.util.d.ts +7 -7
  70. package/dist/utility/chart/om-panel-push-style.util.js +17 -15
  71. package/dist/utility/chart/om-panel.util.js +6 -6
  72. package/dist/utility/chart/opra-read-access.leaf.d.ts +5 -3
  73. package/dist/utility/chart/opra-read-access.leaf.js +5 -3
  74. package/dist/utility/chart/profile-block-size.util.d.ts +16 -0
  75. package/dist/utility/chart/profile-block-size.util.js +7 -0
  76. package/dist/utility/chart/quote-perp.leaf.d.ts +17 -0
  77. package/dist/utility/chart/quote-perp.leaf.js +20 -0
  78. package/dist/utility/chart/rth-session.util.d.ts +3 -2
  79. package/dist/utility/chart/rth-session.util.js +2 -1
  80. package/dist/utility/chart/window-geometry.leaf.d.ts +8 -0
  81. package/dist/utility/chart/window-geometry.leaf.js +22 -6
  82. package/dist/utility/chart/wrun-run-result.util.d.ts +17 -0
  83. package/dist/utility/chart/wrun-run-result.util.js +145 -7
  84. package/dist/utility/common/transformations.util.d.ts +7 -0
  85. package/dist/utility/common/transformations.util.js +11 -0
  86. package/dist/utility/options/option-bar-anchor.util.d.ts +145 -0
  87. package/dist/utility/options/option-bar-anchor.util.js +340 -0
  88. package/dist/utility/options/option-venue.util.d.ts +21 -3
  89. package/dist/utility/options/option-venue.util.js +30 -3
  90. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +2 -0
  91. package/dist/utility/wrun/derived-roots.util.d.ts +213 -0
  92. package/dist/utility/wrun/derived-roots.util.js +471 -0
  93. package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +41 -6
  94. package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.js +89 -19
  95. package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.d.ts +9 -4
  96. package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.js +47 -6
  97. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +5 -3
  98. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +6 -4
  99. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.d.ts +2 -2
  100. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.js +5 -1
  101. package/dist/utility/wrun/sources/lanes/option_daily.js +5 -2
  102. package/dist/utility/wrun/sources/lanes/options_flow.js +5 -2
  103. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +64 -19
  104. package/dist/utility/wrun/sources/opra-option-lanes.util.js +105 -35
  105. package/dist/utility/wrun/sources/row-lane-registry.js +3 -2
  106. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +2 -1
  107. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +9 -3
  108. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +15 -6
  109. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +14 -0
  110. package/dist/utility/wrun/sources/row-lanes/option_prints.js +82 -13
  111. package/dist/utility/wrun/sources/row-lanes/option_strike_flow.js +17 -4
  112. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +55 -8
  113. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +95 -14
  114. package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +5 -2
  115. package/dist/utility/wrun/sources/row-lanes/option_surface.js +7 -3
  116. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +19 -0
  117. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +35 -14
  118. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +70 -20
  119. package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.d.ts +64 -0
  120. package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.js +89 -0
  121. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +45 -1
  122. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +114 -6
  123. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +56 -5
  124. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +224 -26
  125. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +822 -58
  126. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +16 -3
  127. package/dist/utility/wrun/wrun-batched-marks.util.js +30 -19
  128. package/dist/utility/wrun/wrun-batched-readout.util.d.ts +37 -9
  129. package/dist/utility/wrun/wrun-batched-readout.util.js +61 -15
  130. package/dist/utility/wrun/wrun-builtin-twin.util.d.ts +12 -0
  131. package/dist/utility/wrun/wrun-builtin-twin.util.js +21 -0
  132. package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -0
  133. package/dist/utility/wrun/wrun-cell-capacity.leaf.d.ts +66 -0
  134. package/dist/utility/wrun/wrun-cell-capacity.leaf.js +86 -0
  135. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +192 -13
  136. package/dist/utility/wrun/wrun-chart-market-facts.util.js +437 -55
  137. package/dist/utility/wrun/wrun-color-facts.util.d.ts +19 -9
  138. package/dist/utility/wrun/wrun-color-facts.util.js +24 -14
  139. package/dist/utility/wrun/wrun-color-settings.util.d.ts +15 -4
  140. package/dist/utility/wrun/wrun-color-settings.util.js +31 -12
  141. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.d.ts +17 -0
  142. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.js +9 -0
  143. package/dist/utility/wrun/wrun-download-meter.util.d.ts +107 -0
  144. package/dist/utility/wrun/wrun-download-meter.util.js +134 -0
  145. package/dist/utility/wrun/wrun-download-plan.util.d.ts +99 -0
  146. package/dist/utility/wrun/wrun-download-plan.util.js +118 -0
  147. package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +11 -3
  148. package/dist/utility/wrun/wrun-draft-legend-note.util.js +26 -4
  149. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +6 -1
  150. package/dist/utility/wrun/wrun-draft-overlay.util.js +23 -3
  151. package/dist/utility/wrun/wrun-frames.d.ts +27 -6
  152. package/dist/utility/wrun/wrun-frames.js +78 -15
  153. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
  154. package/dist/utility/wrun/wrun-hosted-wire-caps.js +7 -0
  155. package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +7 -1
  156. package/dist/utility/wrun/wrun-hosted-wire.util.js +12 -2
  157. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +51 -21
  158. package/dist/utility/wrun/wrun-hud-looks.util.js +74 -28
  159. package/dist/utility/wrun/wrun-latest-snapshot.d.ts +11 -0
  160. package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +8 -6
  161. package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +8 -6
  162. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -2
  163. package/dist/utility/wrun/wrun-live-intake.util.d.ts +19 -9
  164. package/dist/utility/wrun/wrun-live-intake.util.js +213 -45
  165. package/dist/utility/wrun/wrun-live-tick.util.d.ts +4 -0
  166. package/dist/utility/wrun/wrun-live-tick.util.js +246 -49
  167. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.d.ts +53 -0
  168. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.js +162 -0
  169. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +205 -48
  170. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +277 -34
  171. package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +51 -7
  172. package/dist/utility/wrun/wrun-market-size-defaults.util.js +340 -56
  173. package/dist/utility/wrun/wrun-opra-lane.util.d.ts +17 -4
  174. package/dist/utility/wrun/wrun-opra-lane.util.js +6 -4
  175. package/dist/utility/wrun/wrun-option-prints.util.d.ts +41 -2
  176. package/dist/utility/wrun/wrun-option-prints.util.js +80 -13
  177. package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.d.ts +31 -0
  178. package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.js +119 -0
  179. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +26 -6
  180. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +50 -11
  181. package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +109 -19
  182. package/dist/utility/wrun/wrun-option-strike-flow.util.js +222 -61
  183. package/dist/utility/wrun/wrun-option-views.util.d.ts +96 -18
  184. package/dist/utility/wrun/wrun-option-views.util.js +246 -51
  185. package/dist/utility/wrun/wrun-options-stop.util.d.ts +2 -1
  186. package/dist/utility/wrun/wrun-options-stop.util.js +3 -2
  187. package/dist/utility/wrun/wrun-output-style.util.d.ts +6 -2
  188. package/dist/utility/wrun/wrun-output-style.util.js +20 -2
  189. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +20 -0
  190. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +31 -14
  191. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +22 -0
  192. package/dist/utility/wrun/wrun-overlay-lifecycle.util.d.ts +10 -1
  193. package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +52 -4
  194. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +7 -0
  195. package/dist/utility/wrun/wrun-overlay-recovery.util.js +25 -1
  196. package/dist/utility/wrun/wrun-overlay-result.util.d.ts +7 -1
  197. package/dist/utility/wrun/wrun-overlay-result.util.js +2 -0
  198. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +134 -37
  199. package/dist/utility/wrun/wrun-overlay-run.util.js +1118 -254
  200. package/dist/utility/wrun/wrun-pack-widths.leaf.d.ts +4 -4
  201. package/dist/utility/wrun/wrun-pack-widths.leaf.js +4 -4
  202. package/dist/utility/wrun/wrun-pack.util.d.ts +7 -3
  203. package/dist/utility/wrun/wrun-pack.util.js +20 -9
  204. package/dist/utility/wrun/wrun-pane-format.util.d.ts +2 -1
  205. package/dist/utility/wrun/wrun-pane-format.util.js +7 -3
  206. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +9 -0
  207. package/dist/utility/wrun/wrun-panel-mount.util.js +63 -13
  208. package/dist/utility/wrun/wrun-panel-style.util.d.ts +37 -24
  209. package/dist/utility/wrun/wrun-panel-style.util.js +100 -29
  210. package/dist/utility/wrun/wrun-param-map.util.d.ts +15 -11
  211. package/dist/utility/wrun/wrun-param-map.util.js +13 -5
  212. package/dist/utility/wrun/wrun-param-values.util.d.ts +21 -3
  213. package/dist/utility/wrun/wrun-param-values.util.js +6 -0
  214. package/dist/utility/wrun/wrun-pin-spelling.util.js +12 -11
  215. package/dist/utility/wrun/wrun-prefix-lanes.util.js +2 -2
  216. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +50 -0
  217. package/dist/utility/wrun/wrun-refusal-surface.util.js +68 -0
  218. package/dist/utility/wrun/wrun-refusal.util.js +10 -1
  219. package/dist/utility/wrun/wrun-refused-latest.util.d.ts +10 -0
  220. package/dist/utility/wrun/wrun-refused-latest.util.js +12 -0
  221. package/dist/utility/wrun/wrun-row-source.d.ts +11 -0
  222. package/dist/utility/wrun/wrun-run-interval.util.d.ts +4 -2
  223. package/dist/utility/wrun/wrun-run-interval.util.js +9 -6
  224. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +52 -1
  225. package/dist/utility/wrun/wrun-script-inputs.util.js +112 -4
  226. package/dist/utility/wrun/wrun-setting-words.util.d.ts +7 -3
  227. package/dist/utility/wrun/wrun-setting-words.util.js +13 -5
  228. package/dist/utility/wrun/wrun-socket-row-source.d.ts +27 -2
  229. package/dist/utility/wrun/wrun-socket-row-source.js +113 -8
  230. package/dist/utility/wrun/wrun-source-rows.util.d.ts +9 -1
  231. package/dist/utility/wrun/wrun-source-rows.util.js +108 -43
  232. package/dist/utility/wrun/wrun-style-words.util.js +6 -4
  233. package/dist/utility/wrun/wrun-table-chrome.util.d.ts +3 -2
  234. package/dist/utility/wrun/wrun-table-chrome.util.js +19 -11
  235. package/dist/utility/wrun/wrun-tape-per-order.util.d.ts +2 -0
  236. package/dist/utility/wrun/wrun-tape-per-order.util.js +26 -0
  237. package/dist/utility/wrun/wrun-tape-source.util.d.ts +126 -50
  238. package/dist/utility/wrun/wrun-tape-source.util.js +193 -68
  239. package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +7 -5
  240. package/dist/utility/wrun/wrun-volume-profile-lane.util.js +8 -6
  241. package/dist/utils/replay/replay-buffer-math.d.ts +53 -2
  242. package/dist/utils/replay/replay-buffer-math.js +227 -20
  243. package/dist/workers/utils/volume-profile.worker.util.d.ts +4 -1
  244. package/dist/workers/utils/volume-profile.worker.util.js +5 -2
  245. package/dist/workers/wrun/wrun-abi-host.js +3 -2
  246. package/package.json +5 -5
@@ -0,0 +1,118 @@
1
+ import { wrunChartHostEnv } from '../../host-env.js';
2
+ import { wrunRunDownloadBudgetBytes } from './wrun-download-meter.util.js';
3
+ const MINUTE_MS = 60_000;
4
+ function countOf(value) {
5
+ return typeof value === 'number' && Number.isFinite(value) && value > 0 ? value : 0;
6
+ }
7
+ /**
8
+ * A read's own meter: every charge goes on to the run's meter unchanged (the run's summary counts every read once) and
9
+ * into the read's tally, so a budgeted read learns what its newest slice downloaded while the run's other reads
10
+ * download beside it (wrun-row-lanes.util `fetchWrunRowLaneRows` `download`).
11
+ */
12
+ export function createWrunLaneDownloadMeter(run) {
13
+ let bytes = 0;
14
+ let asks = 0;
15
+ let cachedAsks = 0;
16
+ return {
17
+ charge(charge) {
18
+ run.charge(charge);
19
+ asks += 1;
20
+ const wire = charge.verdict?.wireBytes;
21
+ if (typeof wire === 'number' && Number.isFinite(wire) && wire >= 0) {
22
+ bytes += wire;
23
+ if (wire === 0)
24
+ cachedAsks += 1;
25
+ }
26
+ else {
27
+ bytes += countOf(charge.cellBytes);
28
+ }
29
+ },
30
+ spentBytes: () => bytes,
31
+ asks: () => asks,
32
+ cachedAsks: () => cachedAsks,
33
+ };
34
+ }
35
+ /** Where the kit's two windows meet on a log scale (the geometric mean of 5 minutes and an hour, about 17 minutes): a
36
+ * bar narrower is priced as the 5m window's, a wider one as the 1h window's. */
37
+ const KIT_INTERVAL_SPLIT_MS = Math.sqrt(5 * MINUTE_MS * 60 * MINUTE_MS);
38
+ /** The kit's window nearest a chart's bar (`wrunDownloadReadCost` prices '1h' and '5m' alone). */
39
+ export function wrunDownloadKitInterval(intervalMs) {
40
+ return Number.isFinite(intervalMs) && intervalMs > 0 && intervalMs < KIT_INTERVAL_SPLIT_MS ? '5m' : '1h';
41
+ }
42
+ /** A chart's market shape as the kit prices it: a CME Group exchange `cme`, a session market (a stock, an ETF, an index
43
+ * mode chart) `us-stock`, every other (a crypto venue, 24/7) `crypto`. */
44
+ export function wrunDownloadMarketOf(chart) {
45
+ if (chart.cme)
46
+ return 'cme';
47
+ return chart.indexMode ? 'us-stock' : 'crypto';
48
+ }
49
+ function sharedHostPrice(read, market, interval) {
50
+ return wrunChartHostEnv().sharedHost().wrunDownloadReadCost(read, market, interval);
51
+ }
52
+ /** The key a read's share is filed under. */
53
+ export function wrunDownloadPlanKeyOf(read) {
54
+ return read.key ?? read.inputs.join(',');
55
+ }
56
+ /** A read's projected bytes on the window: the lane's own projection where it carries one, else the kit's. */
57
+ export function wrunDownloadPlanReadBytes(read, window, price = sharedHostPrice) {
58
+ const own = read.projectedBytes;
59
+ if (typeof own === 'number' && Number.isFinite(own) && own >= 0)
60
+ return own;
61
+ const bytes = price(read, window.market, wrunDownloadKitInterval(window.intervalMs)).bytes;
62
+ return Number.isFinite(bytes) && bytes > 0 ? bytes : 0;
63
+ }
64
+ /**
65
+ * The run's mode, before any fetch: WHOLE when the reads' projection is at or under the run's budget, else BUDGETED
66
+ * with each history read's share of what the reserved reads leave, in proportion to its projection (a read the run
67
+ * cannot cut, a snapshot or a scalar read, keeps its projection and is never cut). A read's share never holds it to
68
+ * nothing: it asks its newest slice whatever the share (the lane's rule), so a share is what its older bars may spend.
69
+ */
70
+ export function wrunRunDownloadMode(reads, window, price = sharedHostPrice) {
71
+ const priced = reads.map((read) => ({ read, bytes: wrunDownloadPlanReadBytes(read, window, price) }));
72
+ const projectedBytes = priced.reduce((sum, { bytes }) => sum + bytes, 0);
73
+ const budgetBytes = wrunRunDownloadBudgetBytes(window.bars);
74
+ if (projectedBytes <= budgetBytes)
75
+ return { mode: 'whole', projectedBytes };
76
+ const reserved = priced.filter(({ read }) => read.history !== true).reduce((sum, { bytes }) => sum + bytes, 0);
77
+ const history = priced.filter(({ read }) => read.history === true);
78
+ const historyBytes = history.reduce((sum, { bytes }) => sum + bytes, 0);
79
+ const left = Math.max(0, budgetBytes - reserved);
80
+ const shares = new Map();
81
+ for (const { read, bytes } of history) {
82
+ const key = wrunDownloadPlanKeyOf(read);
83
+ const share = historyBytes > 0 ? Math.floor((left * bytes) / historyBytes) : 0;
84
+ shares.set(key, (shares.get(key) ?? 0) + share);
85
+ }
86
+ return { mode: 'budgeted', projectedBytes, budgetBytes, shares };
87
+ }
88
+ /**
89
+ * The sheet's reads as the kit charges them (`wrunDownloadPlanReads`, the declared-read half: every input it is handed
90
+ * is a read the plan left unasked, so each is charged from its declaration over the window), one per class and knob set
91
+ * with the inputs it serves: its knobs (a view, a fold, `history`, the strike knobs), its setting-bound knobs at the
92
+ * run's values (`settingOf`), its cap a bar (the input's capacity) and its width. `inputs` names the inputs the run
93
+ * reads (an input the market leaves undemanded is no read); the window is the run's, warm-up included
94
+ * (`[fromMs, toMs)`, at its bar). The chart's own candles are no read of the run (its rows answer them).
95
+ */
96
+ export function wrunRunDownloadReads(sheet, window, inputs, settingOf = () => undefined) {
97
+ if (inputs.length === 0 || !(window.intervalMs > 0) || !(window.toMs > window.fromMs))
98
+ return [];
99
+ const primary = {
100
+ key: 'wrun-download-window',
101
+ class: 'ohlcv',
102
+ exchange: '',
103
+ symbol: '',
104
+ foreign: false,
105
+ primary: true,
106
+ intervalMs: window.intervalMs,
107
+ fromMs: window.fromMs,
108
+ toMs: window.toMs,
109
+ fields: [],
110
+ };
111
+ // No wire names an ask of the plan, so every input is charged from its declaration.
112
+ const wires = inputs.map((inputName) => ({ kind: 'scalar', inputName, fetchKey: '' }));
113
+ const plan = { fetches: [primary], wires };
114
+ const host = wrunChartHostEnv().sharedHost();
115
+ // The kit asks a knob's setting by the knob's own words ("@rows" or "rows"): both read the setting `rows`.
116
+ const reads = host.wrunDownloadPlanReads(sheet, plan, (name) => settingOf(name.startsWith('@') ? name.slice(1) : name));
117
+ return reads.filter((read) => read.inputs.length > 0);
118
+ }
@@ -1,3 +1,4 @@
1
+ import { type WrunOpraServedReceipt } from './wrun-opra-lane.util.js';
1
2
  export declare function wrunDraftLegendNote(settings: unknown): string | undefined;
2
3
  /**
3
4
  * The served tier of the chain a run's options_chain lane read (its acquisition record), named only
@@ -12,10 +13,17 @@ export declare function wrunChainServedTierNote(acquisition: Readonly<Record<str
12
13
  * alike). Undefined when every OPRA read rode real-time, or none was made.
13
14
  */
14
15
  export declare function wrunOpraLanesServedTierNote(acquisitions: Iterable<unknown> | undefined): string | undefined;
16
+ /**
17
+ * The served tier of a hosted (Cloud) run's OPRA reads as its frame's receipt names it (`WrunOpraServedReceipt`,
18
+ * contract opra-server-lanes C4), in the chain's own words: OPRA's delay notice for a delayed receipt (its minutes the
19
+ * receipt's own figure, else the venue's nominal delay), nothing for a real-time one. Nothing for no receipt: a frame
20
+ * that named no tier is unknown, and the account's current tier is never read in its place.
21
+ */
22
+ export declare function wrunCloudOpraServedNote(served: WrunOpraServedReceipt | undefined): string | undefined;
15
23
  /** The whole note a run's legend carries: the draft's word, then the served tier of its OPRA reads (the chain's,
16
- * else any OPRA lane's among `acquisitions`, the run's record by lane), joined by " · "; undefined when neither
17
- * applies. */
18
- export declare function wrunOverlayLegendNote(settings: unknown, chainAcquisition?: Readonly<Record<string, unknown>>, acquisitions?: Readonly<Record<string, unknown>>): string | undefined;
24
+ * else any OPRA lane's among `acquisitions`, the run's record by lane, else a Cloud run's frame receipt,
25
+ * `cloudOpraServed`), joined by " · "; undefined when none applies. */
26
+ export declare function wrunOverlayLegendNote(settings: unknown, chainAcquisition?: Readonly<Record<string, unknown>>, acquisitions?: Readonly<Record<string, unknown>>, cloudOpraServed?: WrunOpraServedReceipt): string | undefined;
19
27
  /**
20
28
  * Every wording a legend note can hold in a SAVED title that today's words do not produce: the title is
21
29
  * written by the run and kept in the overlay's settings, so a title written under an older build or another
@@ -13,6 +13,10 @@
13
13
  * lane (a poll lane's `opra`, a row lane's `governed: 'opra'`) names the tier its ask was routed to
14
14
  * by the same rule and the same words (its acquisition's `servedTier`, wrun-opra-lane.util), once
15
15
  * for every OPRA read the run made.
16
+ * - the served tier of a hosted (Cloud) run's OPRA reads, as its newest frame's receipt names it
17
+ * (contract opra-server-lanes C4: `wrunOpraTier` beside the cloud's OPRA mark, `WrunOpraServedReceipt`):
18
+ * the same delayed line for a delayed receipt, none for a real-time one, and none for a frame that
19
+ * named no tier (an unknown tier shows no word: the account's current tier is never put in its place).
16
20
  * The note lands in the define's custom title, which the overlay's settings keep: every reader of the
17
21
  * inputs alone (the indicator menu, the settings headers) drops it through `wrunWithoutLegendNote`, the
18
22
  * one stripper of whatever `wrunOverlayLegendNote` appends, in today's words and in every wording a saved
@@ -62,12 +66,30 @@ export function wrunOpraLanesServedTierNote(acquisitions) {
62
66
  }
63
67
  return undefined;
64
68
  }
69
+ /**
70
+ * The served tier of a hosted (Cloud) run's OPRA reads as its frame's receipt names it (`WrunOpraServedReceipt`,
71
+ * contract opra-server-lanes C4), in the chain's own words: OPRA's delay notice for a delayed receipt (its minutes the
72
+ * receipt's own figure, else the venue's nominal delay), nothing for a real-time one. Nothing for no receipt: a frame
73
+ * that named no tier is unknown, and the account's current tier is never read in its place.
74
+ */
75
+ export function wrunCloudOpraServedNote(served) {
76
+ if (served?.tier !== 'delayed')
77
+ return undefined;
78
+ const venue = optionVenueForExchange('OPRA');
79
+ if (!venue)
80
+ return undefined;
81
+ const minutes = typeof served.delaySeconds === 'number' && served.delaySeconds > 0
82
+ ? Math.max(1, Math.round(served.delaySeconds / 60))
83
+ : optionVenueDelayMinutes(venue);
84
+ return optionVenueDisclosure(venue, 'delayed', minutes, wrunChartHostEnv().t);
85
+ }
65
86
  /** The whole note a run's legend carries: the draft's word, then the served tier of its OPRA reads (the chain's,
66
- * else any OPRA lane's among `acquisitions`, the run's record by lane), joined by " · "; undefined when neither
67
- * applies. */
68
- export function wrunOverlayLegendNote(settings, chainAcquisition, acquisitions) {
87
+ * else any OPRA lane's among `acquisitions`, the run's record by lane, else a Cloud run's frame receipt,
88
+ * `cloudOpraServed`), joined by " · "; undefined when none applies. */
89
+ export function wrunOverlayLegendNote(settings, chainAcquisition, acquisitions, cloudOpraServed) {
69
90
  const opra = wrunChainServedTierNote(chainAcquisition) ??
70
- (acquisitions === undefined ? undefined : wrunOpraLanesServedTierNote(Object.values(acquisitions)));
91
+ (acquisitions === undefined ? undefined : wrunOpraLanesServedTierNote(Object.values(acquisitions))) ??
92
+ wrunCloudOpraServedNote(cloudOpraServed);
71
93
  const notes = [wrunDraftLegendNote(settings), opra].filter((note) => typeof note === 'string' && note.trim() !== '');
72
94
  return notes.length > 0 ? notes.join(' · ') : undefined;
73
95
  }
@@ -179,5 +179,10 @@ export declare function wrunKScriptSourceWeight(type: string | null): number;
179
179
  export declare function wrunKScriptSourceOf(value: unknown): WrunKScriptSource | null;
180
180
  /** The slot charge of a sheet in kScript's unit (the rule above): the
181
181
  * weighted count of the distinct kScript sources its entries read, never
182
- * below 1. */
182
+ * below 1. The per-bar sums of the chart chain's prints (`options_flow`
183
+ * scope `prints`) ride the slot of the package's print read of that chain,
184
+ * when it makes one: a print template reads its marks or table from the
185
+ * prints and its columns from the sums, one slot (OPTLOAD W3: Flow Marks
186
+ * 0.3.0, Option Prints 0.5.0). Sums with no such print read charge as
187
+ * their own source. */
183
188
  export declare function wrunMetadataSourceCount(metadata: WrunSourceCountMetadataLike): number;
@@ -383,13 +383,33 @@ export function wrunKScriptSourceOf(value) {
383
383
  payload.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
384
384
  return { type, key: JSON.stringify([type ?? `wrun:${sourceClass}`, payload]), weight: wrunKScriptSourceWeight(type) };
385
385
  }
386
+ /** The print classes, the ONE print read a package makes of its chain (option_prints, option_prints_v2). */
387
+ const WRUN_PRINT_READ_CLASSES = new Set(['option_prints', 'option_prints_v2']);
388
+ /** Whether an entry reads the prints of the chart's own chain: a print class under the chain's `auto` venue word
389
+ * (absent too; its book only narrows the one chain). */
390
+ function readsChartChainPrints(entry) {
391
+ const venue = knobWord(entry.venue);
392
+ return WRUN_PRINT_READ_CLASSES.has(knobWord(entry.source) ?? '') && (venue === undefined || venue === 'auto');
393
+ }
394
+ /** Whether an entry is the per-bar sums of the chart chain's prints: `options_flow` under scope `prints` (it takes
395
+ * no venue or book there, so it always reads the chart's own chain). */
396
+ function sumsChartChainPrints(entry) {
397
+ return knobWord(entry.source) === 'options_flow' && knobWord(entry.scope) === 'prints';
398
+ }
386
399
  /** The slot charge of a sheet in kScript's unit (the rule above): the
387
400
  * weighted count of the distinct kScript sources its entries read, never
388
- * below 1. */
401
+ * below 1. The per-bar sums of the chart chain's prints (`options_flow`
402
+ * scope `prints`) ride the slot of the package's print read of that chain,
403
+ * when it makes one: a print template reads its marks or table from the
404
+ * prints and its columns from the sums, one slot (OPTLOAD W3: Flow Marks
405
+ * 0.3.0, Option Prints 0.5.0). Sums with no such print read charge as
406
+ * their own source. */
389
407
  export function wrunMetadataSourceCount(metadata) {
408
+ const entries = Object.values(metadata.inputSources ?? {}).filter((value) => value !== null && typeof value === 'object');
409
+ const printRead = entries.find(readsChartChainPrints);
390
410
  const weights = new Map();
391
- for (const value of Object.values(metadata.inputSources ?? {})) {
392
- const source = wrunKScriptSourceOf(value);
411
+ for (const value of entries) {
412
+ const source = wrunKScriptSourceOf(printRead !== undefined && sumsChartChainPrints(value) ? printRead : value);
393
413
  if (source !== null && !weights.has(source.key))
394
414
  weights.set(source.key, source.weight);
395
415
  }
@@ -15,10 +15,15 @@
15
15
  * columns`). The frame payload types live here beside their parsers (X24);
16
16
  * the sheet declaration types stay in wrun-runtime.interface.ts.
17
17
  *
18
+ * One exception to refusing: a panel's legend text past its cap (a frame
19
+ * `title`, `caption` or `hole_caption`) draws clipped to the cap with an
20
+ * ellipsis, and the parsed frame carries a notice that says so
21
+ * (`wrunPanelFrameNotices`). A long caption is no reason to lose the panel.
22
+ *
18
23
  * Guard G2 (the no-disguises rule) runs on every string a frame carries,
19
24
  * after the JSON decode, before the grammar.
20
25
  */
21
- import type { WrunFontWeight, WrunLevels, WrunMatrix, WrunPanel, WrunPanelGuide, WrunPanelHighlight, WrunPanelBadge, WrunPanelMarker, WrunPanelQuadrants } from '../../interfaces/wrun-runtime.interface.js';
26
+ import type { WrunFontWeight, WrunLevels, WrunMatrix, WrunPanel, WrunPanelGuide, WrunPanelHighlight, WrunPanelBadge, WrunPanelMarker, WrunPanelQuadrants, WrunPanelXLabels } from '../../interfaces/wrun-runtime.interface.js';
22
27
  import { type ParsedPanel } from '../chart/om-panel.util.js';
23
28
  import type { FeedLine, LadderProps, LadderRow } from '../chart/om-widget.util.js';
24
29
  import type { WrunMiniChartsFrame } from '@orangecharts/indicator-kit/host';
@@ -159,8 +164,17 @@ export interface WrunPanelFrameChrome {
159
164
  /** A table's rows' markets (UW-PARITY H4), one per row: null or the market
160
165
  * a click on the row opens (wrun-row-market.util). */
161
166
  markets?: (WrunRowMarket | null)[];
167
+ /** C3: a numeric-x line's or bars' label per row, "" for a row without one
168
+ * (WrunPanelXLabels); the pane prints it where the row's x number would be. */
169
+ x_labels?: WrunPanelXLabels;
162
170
  }
163
171
  export type WrunPanelFrameWord = keyof WrunPanelFrameChrome;
172
+ /** A parsed panel frame and the notices of what the host changed to draw it:
173
+ * one plain-English line per chrome text drawn clipped to its cap (the
174
+ * register of the canvas notices); absent when the frame drew as written. */
175
+ export type WrunParsedPanelFrame = ParsedPanel & {
176
+ notices?: string[];
177
+ };
164
178
  /** A styled matrix cell: at least one field. */
165
179
  export interface WrunMatrixCellStyle {
166
180
  value?: number;
@@ -204,7 +218,7 @@ export declare const WRUN_LEVELS_SPAN_KEYS: readonly ["start", "end", "prices",
204
218
  export declare function parseWrunLevelsFrame(raw: string, slot: string, declaration?: Partial<Pick<WrunLevels, 'name' | 'span'>>): WrunLevelsFrame | WrunLevelsSpansFrame;
205
219
  type PanelKind = WrunPanel['kind'];
206
220
  /** Which kinds take each frame key; x_min / x_max also need x "index" or
207
- * "number" on a line, like the declared words. */
221
+ * "number" on a line, like the declared words, and x_labels x "number" (C3). */
208
222
  export declare const WRUN_PANEL_FRAME_WORD_KINDS: Readonly<Record<WrunPanelFrameWord, ReadonlyArray<PanelKind>>>;
209
223
  /** The frame keys this panel's kind accepts beside `rows`. */
210
224
  export declare function wrunPanelFrameWords(kind: PanelKind): WrunPanelFrameWord[];
@@ -212,13 +226,20 @@ export declare function wrunPanelFrameWords(kind: PanelKind): WrunPanelFrameWord
212
226
  * any key outside the kind's words refuses by name, each value goes
213
227
  * through its declared word's ranges, then the cross rules against the
214
228
  * declaration. Returns the parsed chrome (empty when the frame carries
215
- * only rows). */
216
- export declare function parseWrunPanelChrome(frame: Record<string, unknown>, declaration: WrunPanel, slot: string): WrunPanelFrameChrome;
229
+ * only rows); a legend text drawn clipped adds its line to `notices`. */
230
+ export declare function parseWrunPanelChrome(frame: Record<string, unknown>, declaration: WrunPanel, slot: string, notices?: string[]): WrunPanelFrameChrome;
217
231
  /** Parses a panel frame: `rows` through the receive-lane validator (one row
218
232
  * grammar on both lanes; the wrun lane carries the declaration's style
219
233
  * words) plus the kind's chrome keys through {@link parseWrunPanelChrome},
220
- * returned as `ParsedPanel.chrome` when the frame carries any. */
221
- export declare function parseWrunPanelFrame(raw: string, slot: string, declaration: WrunPanel): ParsedPanel;
234
+ * returned as `ParsedPanel.chrome` when the frame carries any, and the
235
+ * notices of a legend text drawn clipped as `notices` when there are any. */
236
+ export declare function parseWrunPanelFrame(raw: string, slot: string, declaration: WrunPanel): WrunParsedPanelFrame;
237
+ /** A parsed panel frame's notices (a legend text drawn clipped to its cap), a
238
+ * fresh array, empty when the frame drew as written: the panel's share of a
239
+ * run result's `notices`, the warning rows the Indicator's legend shows. It
240
+ * takes the `ParsedPanel` a panel child carries; the lines ride the object
241
+ * parseWrunPanelFrame returned. */
242
+ export declare function wrunPanelFrameNotices(frame: ParsedPanel): string[];
222
243
  export declare function parseWrunLadderFrame(raw: string, slot: string): WrunLadderFrame;
223
244
  export declare function parseWrunFeedFrame(raw: string, slot: string): WrunFeedFrame;
224
245
  /** Parses a matrix frame through the kit's grammar (`WrunMatrixFrameSchema`:
@@ -424,7 +424,7 @@ const ALL_PANEL_KINDS = [
424
424
  ];
425
425
  const AXIS_PANEL_KINDS = ['line', 'bars', 'histogram', 'scatter'];
426
426
  /** Which kinds take each frame key; x_min / x_max also need x "index" or
427
- * "number" on a line, like the declared words. */
427
+ * "number" on a line, like the declared words, and x_labels x "number" (C3). */
428
428
  export const WRUN_PANEL_FRAME_WORD_KINDS = {
429
429
  title: ALL_PANEL_KINDS,
430
430
  caption: ALL_PANEL_KINDS,
@@ -443,6 +443,7 @@ export const WRUN_PANEL_FRAME_WORD_KINDS = {
443
443
  hole_text: ['pie'],
444
444
  hole_caption: ['pie'],
445
445
  markets: ['table'],
446
+ x_labels: ['line', 'bars'],
446
447
  };
447
448
  const PANEL_FRAME_WORDS = Object.keys(WRUN_PANEL_FRAME_WORD_KINDS);
448
449
  /** The frame keys this panel's kind accepts beside `rows`. */
@@ -471,6 +472,40 @@ const RICH_CHROME_MESSAGE = "needs chrome 'grid' or 'none' on a time, category o
471
472
  function panelText(value, key, max, at, path) {
472
473
  return text(value, max) ? value : at(path, `${key} must be 1 to ${max} characters`);
473
474
  }
475
+ /** A panel's legend text (a frame `title`, `caption` or `hole_caption`).
476
+ * Past its cap it draws clipped and `clipped` records it: the OPRA QA OI
477
+ * Changes frame (2026-10-22) lost its whole panel to an 88-character
478
+ * caption. An empty or non-text value still refuses, with the kit's message. */
479
+ function panelClippedText(value, key, max, at, clipped) {
480
+ if (typeof value !== 'string' || value.length < 1)
481
+ return at([key], `${key} must be 1 to ${max} characters`);
482
+ if (value.length <= max)
483
+ return value;
484
+ clipped(key, value.length, max);
485
+ return clipText(value, max);
486
+ }
487
+ /** `value` cut to `max` UTF-16 units (the caps' unit: the kit counts string
488
+ * length) with an ellipsis as the last one, never splitting a surrogate pair. */
489
+ function clipText(value, max) {
490
+ let end = max - 1;
491
+ const last = value.charCodeAt(end - 1);
492
+ if (last >= 0xd800 && last <= 0xdbff)
493
+ end -= 1;
494
+ return `${value.slice(0, end)}…`;
495
+ }
496
+ /** C3 `x_labels`: one entry per row, "" for a row without a label. The count
497
+ * against the rows waits for the row parse (parseWrunPanelFrame). */
498
+ function xLabelsRowsMessage(rows) {
499
+ const count = rows === undefined ? '' : ` (${rows})`;
500
+ return `x_labels must hold one entry per row${count}, "" for a row without a label`;
501
+ }
502
+ function panelXLabels(value, at) {
503
+ if (!Array.isArray(value))
504
+ return at(['x_labels'], xLabelsRowsMessage());
505
+ return value.map((label, i) => text(label, WRUN_PANEL_MAX_LABEL_CHARS, 0)
506
+ ? label
507
+ : at(['x_labels', i], `x_labels entries must be 0 to ${WRUN_PANEL_MAX_LABEL_CHARS} characters`));
508
+ }
474
509
  function panelNumber(value, key, at, path) {
475
510
  return finite(value) ? value : at(path, `${key} must be a finite number`);
476
511
  }
@@ -657,22 +692,26 @@ function panelSummary(value, at) {
657
692
  };
658
693
  });
659
694
  }
660
- /** A panel's effective chrome (SC02): the declared word, else "grid" for an
661
- * unstacked line with x "index" or "number" (today's rich curve), else
662
- * "box" (today's panel look). */
695
+ /** A panel's effective chrome (SC02, wrunPanelChrome's rule): the declared
696
+ * word, else "hairlines" on a line, bars, histogram or scatter pane of every
697
+ * x kind, stacked or not (the plain look), else "box". */
663
698
  function effectivePanelChrome(panel) {
664
699
  if (panel.chrome !== undefined)
665
700
  return panel.chrome;
666
- const numeric = panel.x === 'index' || panel.x === 'number';
667
- return panel.kind === 'line' && numeric && panel.stacked !== true ? 'grid' : 'box';
701
+ const hairlines = panel.kind === 'line' || panel.kind === 'bars' || panel.kind === 'histogram' || panel.kind === 'scatter';
702
+ return hairlines ? 'hairlines' : 'box';
668
703
  }
669
704
  /** The cross rules of a frame's chrome against its declaration: x_min /
670
705
  * x_max on a numeric line or a scatter, the box-line rule on markers,
671
706
  * category marker keys, a point marker's series among the declared ones
672
707
  * (C3), the paired ranges (a frame half against the declared other half),
673
- * hole text needs a hole. */
708
+ * hole text needs a hole, x_labels needs x "number" (C3). */
674
709
  function refinePanelChrome(panel, chrome, at) {
675
710
  const numeric = panel.x === 'index' || panel.x === 'number';
711
+ // A label stands in for a row's x number, so only a numeric x has one to replace.
712
+ if (chrome.x_labels !== undefined && panel.x !== 'number') {
713
+ at(['x_labels'], "x_labels is only valid for a line or bars with x 'number'");
714
+ }
676
715
  for (const word of ['x_min', 'x_max']) {
677
716
  if (chrome[word] !== undefined && panel.kind !== 'scatter' && !numeric) {
678
717
  at([word], `${word} is only valid for a line with x 'index' or 'number', and scatter`);
@@ -714,9 +753,13 @@ function refinePanelChrome(panel, chrome, at) {
714
753
  * any key outside the kind's words refuses by name, each value goes
715
754
  * through its declared word's ranges, then the cross rules against the
716
755
  * declaration. Returns the parsed chrome (empty when the frame carries
717
- * only rows). */
718
- export function parseWrunPanelChrome(frame, declaration, slot) {
756
+ * only rows); a legend text drawn clipped adds its line to `notices`. */
757
+ export function parseWrunPanelChrome(frame, declaration, slot, notices) {
719
758
  const at = refuser(slot);
759
+ // The panel's name leads the line, as a TPO's does in the canvas notices.
760
+ const clipped = (key, written, max) => {
761
+ notices?.push(`panel '${declaration.name}': ${key} clipped from ${written} to ${max} characters`);
762
+ };
720
763
  const allowed = wrunPanelFrameWords(declaration.kind);
721
764
  for (const key of Object.keys(frame)) {
722
765
  if (key !== 'rows' && !allowed.includes(key)) {
@@ -730,10 +773,10 @@ export function parseWrunPanelChrome(frame, declaration, slot) {
730
773
  continue;
731
774
  switch (word) {
732
775
  case 'title':
733
- chrome.title = panelText(value, word, WRUN_PANEL_MAX_TITLE_CHARS, at, [word]);
776
+ chrome.title = panelClippedText(value, word, WRUN_PANEL_MAX_TITLE_CHARS, at, clipped);
734
777
  break;
735
778
  case 'caption':
736
- chrome.caption = panelText(value, word, WRUN_PANEL_MAX_CAPTION_CHARS, at, [word]);
779
+ chrome.caption = panelClippedText(value, word, WRUN_PANEL_MAX_CAPTION_CHARS, at, clipped);
737
780
  break;
738
781
  case 'badge':
739
782
  chrome.badge = panelBadge(value, at);
@@ -762,8 +805,13 @@ export function parseWrunPanelChrome(frame, declaration, slot) {
762
805
  chrome.summary = panelSummary(value, at);
763
806
  break;
764
807
  case 'hole_text':
808
+ chrome.hole_text = panelText(value, word, WRUN_PANEL_MAX_LABEL_CHARS, at, [word]);
809
+ break;
765
810
  case 'hole_caption':
766
- chrome[word] = panelText(value, word, WRUN_PANEL_MAX_LABEL_CHARS, at, [word]);
811
+ chrome.hole_caption = panelClippedText(value, word, WRUN_PANEL_MAX_LABEL_CHARS, at, clipped);
812
+ break;
813
+ case 'x_labels':
814
+ chrome.x_labels = panelXLabels(value, at);
767
815
  break;
768
816
  case 'markets': {
769
817
  // The entries here; their count against the rows once the rows parsed (parseWrunPanelFrame).
@@ -782,10 +830,12 @@ export function parseWrunPanelChrome(frame, declaration, slot) {
782
830
  /** Parses a panel frame: `rows` through the receive-lane validator (one row
783
831
  * grammar on both lanes; the wrun lane carries the declaration's style
784
832
  * words) plus the kind's chrome keys through {@link parseWrunPanelChrome},
785
- * returned as `ParsedPanel.chrome` when the frame carries any. */
833
+ * returned as `ParsedPanel.chrome` when the frame carries any, and the
834
+ * notices of a legend text drawn clipped as `notices` when there are any. */
786
835
  export function parseWrunPanelFrame(raw, slot, declaration) {
787
836
  const frame = decodeFrame(raw, slot);
788
- const chrome = parseWrunPanelChrome(frame, declaration, slot);
837
+ const notices = [];
838
+ const chrome = parseWrunPanelChrome(frame, declaration, slot, notices);
789
839
  if (!('rows' in frame))
790
840
  refuser(slot)(['rows'], 'a panel frame must be an object with rows');
791
841
  const { name: _name, frame: _frame, ...panel } = declaration;
@@ -808,7 +858,20 @@ export function parseWrunPanelFrame(raw, slot, declaration) {
808
858
  if (chrome.markets !== undefined && chrome.markets.length !== result.data.rows.length) {
809
859
  refuser(slot)(['markets'], wrunRowMarketsLengthMessage('row', result.data.rows.length));
810
860
  }
811
- return Object.keys(chrome).length > 0 ? { ...result.data, chrome } : result.data;
861
+ if (chrome.x_labels !== undefined && chrome.x_labels.length !== result.data.rows.length) {
862
+ refuser(slot)(['x_labels'], xLabelsRowsMessage(result.data.rows.length));
863
+ }
864
+ const parsed = Object.keys(chrome).length > 0 ? { ...result.data, chrome } : result.data;
865
+ return notices.length > 0 ? { ...parsed, notices } : parsed;
866
+ }
867
+ /** A parsed panel frame's notices (a legend text drawn clipped to its cap), a
868
+ * fresh array, empty when the frame drew as written: the panel's share of a
869
+ * run result's `notices`, the warning rows the Indicator's legend shows. It
870
+ * takes the `ParsedPanel` a panel child carries; the lines ride the object
871
+ * parseWrunPanelFrame returned. */
872
+ export function wrunPanelFrameNotices(frame) {
873
+ const { notices } = frame;
874
+ return notices !== undefined ? [...notices] : [];
812
875
  }
813
876
  // ---------------------------------------------------------------------------
814
877
  // Ladder and feed frames (g3 DW15, DW38)
@@ -340,8 +340,8 @@ export declare function wrunFrameRefusalMemory(text: string): 'window' | 'identi
340
340
  * by name.
341
341
  */
342
342
  export declare const WRUN_KIT_REFUSAL_STAGES: {
343
- readonly validate: readonly ["wrun_abi_unsupported", "wrun_pin_venue_unknown", "wrun_sheet_over_cap", "wrun_abi_channel_missing", "wrun_intrabar_interval_required", "wrun_intrabar_primary", "wrun_candles_interval_required", "wrun_candles_primary", "wrun_options_chain_venue", "wrun_options_chain_expiries", "wrun_options_chain_market_pinned", "wrun_offset_needs_view", "wrun_offset_count_required", "wrun_bars_needs_leg", "wrun_chart_interval_below_needs_candles", "wrun_chart_interval_below_primary", "wrun_chart_interval_below_forming", "wrun_pin_venue_refused", "wrun_pin_symbol_literal", "wrun_tape_history_unavailable", "wrun_strategy_feed_not_ohlcv", "wrun_strategy_slippage_model_unsupported", "wrun_strategy_reserved_output", "wrun_tape_min_size_invalid", "wrun_option_knob_invalid", "wrun_option_market_pinned", "wrun_option_prints_min_premium_required", "wrun_options_flow_venue_field", "wrun_options_flow_venue_required", "wrun_options_flow_venue_scope", "wrun_oi_candles_interval_required", "wrun_oi_candles_primary", "wrun_volume_profile_candles_interval_required", "wrun_volume_profile_candles_primary"];
344
- readonly plan: readonly ["wrun_options_coin_unknown", "wrun_source_unsupported", "wrun_not_in_10m_universe", "wrun_opra_lane_refused", "wrun_opra_official_only", "wrun_option_contract_flow_unsupported", "wrun_option_contract_state_unsupported", "wrun_option_daily_unsupported", "wrun_option_prints_one_acquisition", "wrun_option_prints_unsupported", "wrun_option_prints_v2_unsupported", "wrun_option_stats_10m_unsupported", "wrun_option_strike_flow_unsupported", "wrun_option_surface_unsupported", "wrun_option_views_unserved", "wrun_options_flow_unsupported", "wrun_field_unsupported", "wrun_tenor_unsupported", "wrun_view_unsupported", "wrun_family_unsupported", "wrun_displacement_needs_cap", "wrun_options_chain_venue_unavailable", "wrun_options_chain_unavailable", "wrun_options_chain_one_venue", "wrun_lane_input_refused", "wrun_permission_denied", "wrun_coin_leg_unsupported", "wrun_coin_leg_unresolved", "wrun_pin_unsupported", "wrun_custom_interval_unsupported", "wrun_intrabar_leg_off_grid", "wrun_intrabar_ratio_over_cap", "wrun_intrabar_unsupported", "wrun_candles_bars_over_cap", "wrun_candles_ratio_over_cap", "wrun_oi_candles_unsupported", "wrun_volume_profile_candles_unsupported", "wrun_trade_volume_by_size_unsupported", "wrun_view_leg_off_grid", "wrun_view_leg_equal", "wrun_time_facts_unsupported", "wrun_etf_flow_unsupported", "wrun_volatility_index_unsupported", "wrun_long_short_ratio_unsupported", "wrun_options_oi_unsupported", "wrun_options_volume_unsupported", "wrun_ethena_positions_unsupported", "wrun_etf_holdings_unsupported", "wrun_etf_premium_unsupported", "wrun_economic_unsupported", "wrun_treasury_balance_unsupported", "wrun_bitfinex_funding_unsupported", "wrun_strategy_costs_in_sheet", "wrun_window_bars_invalid", "wrun_cells_unavailable", "wrun_tape_unavailable", "wrun_tape_interval_unsupported", "wrun_metric_source_missing_policy", "wrun_series_source_primary", "wrun_series_source_densification", "wrun_metric_pin_coarser_than_primary", "wrun_forming_primary_not_own_candles", "wrun_package_lock_invalid", "wrun_package_lock_missing", "wrun_package_not_installed", "wrun_package_lock_mismatch", "wrun_composition_cycle", "wrun_composition_depth", "wrun_options_chain_unsupported", "wrun_volume_profile_ticks_unsupported", "wrun_celled_metric_unsupported", "wrun_series_source_missing", "wrun_series_source_invalid", "wrun_params_invalid", "wrun_source_bindings_invalid", "wrun_output_displaced", "wrun_pin_unresolvable"];
343
+ readonly validate: readonly ["wrun_abi_unsupported", "wrun_pin_venue_unknown", "wrun_sheet_over_cap", "wrun_abi_channel_missing", "wrun_intrabar_interval_required", "wrun_intrabar_primary", "wrun_candles_interval_required", "wrun_candles_primary", "wrun_options_chain_venue", "wrun_options_chain_expiries", "wrun_options_chain_market_pinned", "wrun_offset_needs_view", "wrun_offset_count_required", "wrun_bars_needs_leg", "wrun_chart_interval_below_needs_candles", "wrun_chart_interval_below_primary", "wrun_chart_interval_below_forming", "wrun_pin_venue_refused", "wrun_pin_symbol_literal", "wrun_tape_history_unavailable", "wrun_strategy_feed_not_ohlcv", "wrun_strategy_slippage_model_unsupported", "wrun_strategy_reserved_output", "wrun_tape_min_size_invalid", "wrun_tape_min_value_invalid", "wrun_tape_floor_invalid", "wrun_option_knob_invalid", "wrun_option_market_pinned", "wrun_option_prints_min_premium_required", "wrun_option_prints_tail_largest", "wrun_cell_capacity_invalid", "wrun_options_flow_venue_field", "wrun_options_flow_venue_required", "wrun_options_flow_venue_scope", "wrun_oi_candles_interval_required", "wrun_oi_candles_primary", "wrun_volume_profile_candles_interval_required", "wrun_volume_profile_candles_primary"];
344
+ readonly plan: readonly ["wrun_options_coin_unknown", "wrun_source_unsupported", "wrun_not_in_10m_universe", "wrun_opra_lane_refused", "wrun_opra_official_only", "wrun_option_contract_flow_unsupported", "wrun_option_contract_state_unsupported", "wrun_option_daily_unsupported", "wrun_option_prints_one_acquisition", "wrun_option_prints_unsupported", "wrun_option_prints_v2_unsupported", "wrun_option_stats_10m_unsupported", "wrun_option_strike_flow_unsupported", "wrun_option_surface_unsupported", "wrun_option_views_unserved", "wrun_options_flow_unsupported", "wrun_field_unsupported", "wrun_tenor_unsupported", "wrun_view_unsupported", "wrun_family_unsupported", "wrun_displacement_needs_cap", "wrun_options_chain_venue_unavailable", "wrun_options_chain_unavailable", "wrun_options_chain_one_venue", "wrun_lane_input_refused", "wrun_permission_denied", "wrun_coin_leg_unsupported", "wrun_coin_leg_unresolved", "wrun_pin_unsupported", "wrun_custom_interval_unsupported", "wrun_intrabar_leg_off_grid", "wrun_intrabar_ratio_over_cap", "wrun_intrabar_unsupported", "wrun_candles_bars_over_cap", "wrun_candles_ratio_over_cap", "wrun_oi_candles_unsupported", "wrun_volume_profile_candles_unsupported", "wrun_trade_volume_by_size_unsupported", "wrun_view_leg_off_grid", "wrun_view_leg_equal", "wrun_time_facts_unsupported", "wrun_etf_flow_unsupported", "wrun_volatility_index_unsupported", "wrun_long_short_ratio_unsupported", "wrun_options_oi_unsupported", "wrun_options_volume_unsupported", "wrun_ethena_positions_unsupported", "wrun_etf_holdings_unsupported", "wrun_etf_premium_unsupported", "wrun_economic_unsupported", "wrun_treasury_balance_unsupported", "wrun_bitfinex_funding_unsupported", "wrun_strategy_costs_in_sheet", "wrun_window_bars_invalid", "wrun_cells_unavailable", "wrun_tape_unavailable", "wrun_tape_value_unproven", "wrun_tape_interval_unsupported", "wrun_metric_source_missing_policy", "wrun_series_source_primary", "wrun_series_source_densification", "wrun_metric_pin_coarser_than_primary", "wrun_forming_primary_not_own_candles", "wrun_package_lock_invalid", "wrun_package_lock_missing", "wrun_package_not_installed", "wrun_package_lock_mismatch", "wrun_composition_cycle", "wrun_composition_depth", "wrun_options_chain_unsupported", "wrun_volume_profile_ticks_unsupported", "wrun_celled_metric_unsupported", "wrun_series_source_missing", "wrun_series_source_invalid", "wrun_params_invalid", "wrun_source_bindings_invalid", "wrun_output_displaced", "wrun_pin_unresolvable"];
345
345
  readonly shape: readonly ["wrun_draw_kind_limit", "wrun_draw_total_limit", "wrun_draw_polyline_too_large", "wrun_draw_calls_per_row", "wrun_render_result_too_large", "wrun_draw_kind_mismatch", "wrun_draw_handle_missing", "wrun_draw_label_slot_absent", "wrun_draw_non_finite", "wrun_draw_phase", "wrun_draw_id_negative", "wrun_draw_kind_undeclared", "wrun_draw_prop_unknown", "wrun_draw_prop_unsupported", "wrun_draw_style_out_of_range", "wrun_draw_polyline_empty", "wrun_draw_polyline_out_of_bounds", "wrun_draw_label_slot_undeclared", "wrun_draw_polyline_budget", "wrun_strategy_id_limit", "wrun_strategy_id_too_long", "wrun_strategy_id_invalid_utf8", "wrun_strategy_calls_per_row", "wrun_strategy_trade_limit", "wrun_strategy_non_finite", "wrun_strategy_bad_direction", "wrun_strategy_not_declared", "wrun_strategy_phase", "wrun_strategy_id_out_of_bounds", "wrun_text_param_phase", "wrun_text_param_memory", "wrun_bar_count_phase", "wrun_frame_invalid", "wrun_frame_phase", "wrun_frame_undeclared", "wrun_frame_length", "wrun_frame_too_large", "wrun_frame_run_too_large", "wrun_frame_memory", "wrun_frame_utf8"];
346
346
  readonly pack: readonly ["wrun_cell_block_invalid", "wrun_run_cells_too_large", "wrun_cell_block_too_large"];
347
347
  readonly align: readonly ["wrun_densify_empty_fetch", "wrun_densify_mixed_phase", "wrun_liquidation_side_unmatched", "wrun_bound_series_empty", "wrun_cell_data_malformed"];
@@ -508,10 +508,16 @@ export const WRUN_KIT_REFUSAL_STAGES = {
508
508
  'wrun_strategy_slippage_model_unsupported',
509
509
  'wrun_strategy_reserved_output',
510
510
  'wrun_tape_min_size_invalid',
511
+ 'wrun_tape_min_value_invalid',
512
+ 'wrun_tape_floor_invalid',
511
513
  // kit 0.81 to 0.85 (UW-PARITY): the US listed options classes' knobs, pins and venues.
512
514
  'wrun_option_knob_invalid',
513
515
  'wrun_option_market_pinned',
514
516
  'wrun_option_prints_min_premium_required',
517
+ // kit 0.96.0 (OPTLOAD W3): a print class's union holds max_cells + newest, a bound a newest_tail_ms would lift.
518
+ 'wrun_option_prints_tail_largest',
519
+ // kit 0.97.0 (OPTLOAD W3): a celled input's capacity no build writes (scaffold 97 writes it beside max_cells).
520
+ 'wrun_cell_capacity_invalid',
515
521
  'wrun_options_flow_venue_field',
516
522
  'wrun_options_flow_venue_required',
517
523
  'wrun_options_flow_venue_scope',
@@ -584,6 +590,7 @@ export const WRUN_KIT_REFUSAL_STAGES = {
584
590
  'wrun_window_bars_invalid',
585
591
  'wrun_cells_unavailable',
586
592
  'wrun_tape_unavailable',
593
+ 'wrun_tape_value_unproven',
587
594
  'wrun_tape_interval_unsupported',
588
595
  'wrun_metric_source_missing_policy',
589
596
  'wrun_series_source_primary',
@@ -37,7 +37,13 @@ export interface WrunHostedRunLevel {
37
37
  /** The reply's OPRA mark (UW-PARITY contract opra-server-lanes 10b): true when the run's plan reads OPRA, on every
38
38
  * frame of such a run. Only the JSON boolean `true` counts; anything else reads as absent. */
39
39
  wrunOpra?: true;
40
+ /** The receipt of the OPRA rows the frame was computed from (contract opra-server-lanes C4): the tier the gate
41
+ * served (`wrunOpraTier`, `realtime` or `delayed`), read only beside the mark; any other word reads as absent. */
42
+ wrunOpraTier?: 'realtime' | 'delayed';
43
+ /** That tier's delay in seconds (`wrunOpraDelaySeconds`, a finite number from 0), read only beside a tier. */
44
+ wrunOpraDelaySeconds?: number;
40
45
  }
41
46
  /** Read a reply's run-level keys beside the wire: each own key exactly as the reply carries it (the OPRA mark only as
42
- * the boolean `true`), never a key inside `wrunHost`. A reply that is not a record carries none. */
47
+ * the boolean `true`, its receipt only beside it), never a key inside `wrunHost`. A reply that is not a record
48
+ * carries none. */
43
49
  export declare function readWrunHostedRunLevel(output: unknown): WrunHostedRunLevel;
@@ -7,7 +7,8 @@ export async function readWrunHostedWire(output) {
7
7
  return decodeWrunHostedWire(output);
8
8
  }
9
9
  /** Read a reply's run-level keys beside the wire: each own key exactly as the reply carries it (the OPRA mark only as
10
- * the boolean `true`), never a key inside `wrunHost`. A reply that is not a record carries none. */
10
+ * the boolean `true`, its receipt only beside it), never a key inside `wrunHost`. A reply that is not a record
11
+ * carries none. */
11
12
  export function readWrunHostedRunLevel(output) {
12
13
  if (!isRecord(output))
13
14
  return {};
@@ -20,8 +21,17 @@ export function readWrunHostedRunLevel(output) {
20
21
  if (Object.hasOwn(output, 'wrunServedLegs') && output.wrunServedLegs !== undefined) {
21
22
  level.wrunServedLegs = output.wrunServedLegs;
22
23
  }
23
- if (Object.hasOwn(output, 'wrunOpra') && output.wrunOpra === true)
24
+ if (Object.hasOwn(output, 'wrunOpra') && output.wrunOpra === true) {
24
25
  level.wrunOpra = true;
26
+ // The frame's receipt rides the mark alone: a tier without the mark names rows the run never read.
27
+ const tier = Object.hasOwn(output, 'wrunOpraTier') ? output.wrunOpraTier : undefined;
28
+ if (tier === 'realtime' || tier === 'delayed') {
29
+ level.wrunOpraTier = tier;
30
+ const delay = Object.hasOwn(output, 'wrunOpraDelaySeconds') ? output.wrunOpraDelaySeconds : undefined;
31
+ if (typeof delay === 'number' && Number.isFinite(delay) && delay >= 0)
32
+ level.wrunOpraDelaySeconds = delay;
33
+ }
34
+ }
25
35
  return level;
26
36
  }
27
37
  function isRecord(value) {