@orangecharts/wrun-chart-host 0.7.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/README.md +27 -4
  2. package/dist/constants/feature-flags.constants.d.ts +5 -0
  3. package/dist/constants/feature-flags.constants.js +32 -0
  4. package/dist/constants/marketCapabilities.constants.d.ts +14 -9
  5. package/dist/constants/marketCapabilities.constants.js +36 -13
  6. package/dist/constants/opra-compliance.constants.d.ts +14 -0
  7. package/dist/constants/opra-compliance.constants.js +14 -0
  8. package/dist/constants/option-venues.constants.d.ts +29 -6
  9. package/dist/constants/option-venues.constants.js +19 -2
  10. package/dist/constants/venue-presets.constants.d.ts +17 -3
  11. package/dist/constants/venue-presets.constants.js +17 -3
  12. package/dist/host-env.d.ts +34 -4
  13. package/dist/host-env.js +21 -0
  14. package/dist/host-ports.types.d.ts +51 -3
  15. package/dist/index.d.ts +17 -0
  16. package/dist/index.js +17 -0
  17. package/dist/indicators/controls/tpo-session.util.d.ts +40 -11
  18. package/dist/indicators/controls/tpo-session.util.js +138 -14
  19. package/dist/interfaces/opra-realtime.interface.d.ts +13 -11
  20. package/dist/interfaces/opra-realtime.interface.js +10 -10
  21. package/dist/interfaces/option-instrument.interface.d.ts +6 -0
  22. package/dist/interfaces/wrun-runtime.interface.d.ts +34 -13
  23. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +57 -10
  24. package/dist/kscript-data/controls/live-trades-merge.util.js +85 -16
  25. package/dist/market-data/billing.interface.d.ts +138 -17
  26. package/dist/market-data/billing.interface.js +25 -8
  27. package/dist/market-data/venues/index.d.ts +3 -3
  28. package/dist/market-data/venues/opra.contract.copy.json +5 -3
  29. package/dist/market-data/venues/opra.d.ts +3 -3
  30. package/dist/market-data/venues/opra.js +5 -4
  31. package/dist/replay/replayLadder.js +3 -1
  32. package/dist/settings-templates/footprint-rows.d.ts +25 -0
  33. package/dist/settings-templates/footprint-rows.js +127 -0
  34. package/dist/settings-templates/form-rows.d.ts +56 -0
  35. package/dist/settings-templates/form-rows.js +19 -0
  36. package/dist/settings-templates/frvp-fields.js +14 -0
  37. package/dist/settings-templates/index.d.ts +10 -1
  38. package/dist/settings-templates/index.js +11 -2
  39. package/dist/settings-templates/indicator-fields.js +78 -0
  40. package/dist/settings-templates/tool-rules.d.ts +35 -9
  41. package/dist/settings-templates/tool-rules.js +42 -8
  42. package/dist/settings-templates/tool-tables.generated.js +13 -2
  43. package/dist/utility/chart/candle-volume-unit.leaf.d.ts +16 -0
  44. package/dist/utility/chart/candle-volume-unit.leaf.js +61 -0
  45. package/dist/utility/chart/crypto-index.leaf.d.ts +2 -2
  46. package/dist/utility/chart/crypto-index.leaf.js +2 -2
  47. package/dist/utility/chart/footprint-columns.util.d.ts +74 -0
  48. package/dist/utility/chart/footprint-columns.util.js +106 -0
  49. package/dist/utility/chart/footprint-display-mode.util.d.ts +40 -0
  50. package/dist/utility/chart/footprint-display-mode.util.js +62 -0
  51. package/dist/utility/chart/footprint-sierra-look.util.d.ts +2 -0
  52. package/dist/utility/chart/footprint-sierra-look.util.js +37 -0
  53. package/dist/utility/chart/index-mode-admission.util.js +9 -1
  54. package/dist/utility/chart/index-mode.util.d.ts +5 -2
  55. package/dist/utility/chart/index-mode.util.js +23 -13
  56. package/dist/utility/chart/kscript-venue-policy.util.d.ts +28 -21
  57. package/dist/utility/chart/kscript-venue-policy.util.js +34 -26
  58. package/dist/utility/chart/marketKind.util.d.ts +12 -10
  59. package/dist/utility/chart/marketKind.util.js +17 -7
  60. package/dist/utility/chart/om-panel-push-style.util.d.ts +7 -7
  61. package/dist/utility/chart/om-panel-push-style.util.js +17 -15
  62. package/dist/utility/chart/om-panel.util.d.ts +11 -0
  63. package/dist/utility/chart/om-panel.util.js +65 -6
  64. package/dist/utility/chart/profile-block-size.util.d.ts +16 -0
  65. package/dist/utility/chart/profile-block-size.util.js +7 -0
  66. package/dist/utility/chart/quote-perp.leaf.d.ts +17 -0
  67. package/dist/utility/chart/quote-perp.leaf.js +20 -0
  68. package/dist/utility/chart/window-geometry.leaf.d.ts +23 -1
  69. package/dist/utility/chart/window-geometry.leaf.js +78 -6
  70. package/dist/utility/chart/window-owner.leaf.d.ts +13 -0
  71. package/dist/utility/chart/window-owner.leaf.js +5 -0
  72. package/dist/utility/chart/wrun-run-result.util.d.ts +5 -0
  73. package/dist/utility/chart/wrun-run-result.util.js +4 -1
  74. package/dist/utility/common/transformations.util.d.ts +7 -0
  75. package/dist/utility/common/transformations.util.js +11 -0
  76. package/dist/utility/options/cme-options-root.util.d.ts +25 -0
  77. package/dist/utility/options/cme-options-root.util.js +40 -0
  78. package/dist/utility/options/option-book.util.d.ts +27 -0
  79. package/dist/utility/options/option-book.util.js +76 -0
  80. package/dist/utility/options/option-trade-date.util.d.ts +50 -0
  81. package/dist/utility/options/option-trade-date.util.js +120 -0
  82. package/dist/utility/options/option-venue.util.d.ts +3 -3
  83. package/dist/utility/options/option-venue.util.js +3 -3
  84. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +1 -1
  85. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +2 -2
  86. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.d.ts +2 -2
  87. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.js +5 -1
  88. package/dist/utility/wrun/sources/host-grid-landing.d.ts +4 -2
  89. package/dist/utility/wrun/sources/host-grid-landing.js +8 -0
  90. package/dist/utility/wrun/sources/lanes/options_flow.d.ts +40 -4
  91. package/dist/utility/wrun/sources/lanes/options_flow.js +115 -18
  92. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +12 -9
  93. package/dist/utility/wrun/sources/opra-option-lanes.util.js +10 -7
  94. package/dist/utility/wrun/sources/row-lane-registry.js +10 -5
  95. package/dist/utility/wrun/sources/row-lanes/index.js +2 -0
  96. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +3 -2
  97. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +30 -5
  98. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +9 -3
  99. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +13 -5
  100. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +25 -1
  101. package/dist/utility/wrun/sources/row-lanes/option_prints.js +161 -30
  102. package/dist/utility/wrun/sources/row-lanes/option_strike_flow.d.ts +4 -0
  103. package/dist/utility/wrun/sources/row-lanes/option_strike_flow.js +65 -0
  104. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +55 -1
  105. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +83 -2
  106. package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +17 -1
  107. package/dist/utility/wrun/sources/row-lanes/option_surface.js +33 -2
  108. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +7 -1
  109. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +51 -5
  110. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +136 -3
  111. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +42 -0
  112. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +146 -0
  113. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +25 -5
  114. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +111 -20
  115. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +291 -48
  116. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +16 -3
  117. package/dist/utility/wrun/wrun-batched-marks.util.js +30 -19
  118. package/dist/utility/wrun/wrun-batched-readout.util.d.ts +37 -9
  119. package/dist/utility/wrun/wrun-batched-readout.util.js +61 -15
  120. package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -0
  121. package/dist/utility/wrun/wrun-cell-capacity.leaf.d.ts +66 -0
  122. package/dist/utility/wrun/wrun-cell-capacity.leaf.js +86 -0
  123. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +147 -9
  124. package/dist/utility/wrun/wrun-chart-market-facts.util.js +345 -11
  125. package/dist/utility/wrun/wrun-cloud-record.leaf.d.ts +27 -0
  126. package/dist/utility/wrun/wrun-cloud-record.leaf.js +71 -0
  127. package/dist/utility/wrun/wrun-cloud-record.util.d.ts +4 -21
  128. package/dist/utility/wrun/wrun-cloud-record.util.js +5 -65
  129. package/dist/utility/wrun/wrun-color-facts.util.d.ts +19 -9
  130. package/dist/utility/wrun/wrun-color-facts.util.js +24 -14
  131. package/dist/utility/wrun/wrun-color-settings.util.d.ts +22 -9
  132. package/dist/utility/wrun/wrun-color-settings.util.js +57 -23
  133. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.d.ts +17 -0
  134. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.js +9 -0
  135. package/dist/utility/wrun/wrun-download-meter.util.d.ts +92 -0
  136. package/dist/utility/wrun/wrun-download-meter.util.js +122 -0
  137. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +10 -3
  138. package/dist/utility/wrun/wrun-draft-overlay.util.js +63 -6
  139. package/dist/utility/wrun/wrun-frames.js +5 -5
  140. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
  141. package/dist/utility/wrun/wrun-hosted-wire-caps.js +11 -0
  142. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +33 -17
  143. package/dist/utility/wrun/wrun-hud-looks.util.js +30 -16
  144. package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +29 -3
  145. package/dist/utility/wrun/wrun-lane-refusal.leaf.js +33 -3
  146. package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +8 -6
  147. package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +8 -6
  148. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -2
  149. package/dist/utility/wrun/wrun-live-intake.util.d.ts +6 -2
  150. package/dist/utility/wrun/wrun-live-intake.util.js +136 -21
  151. package/dist/utility/wrun/wrun-live-tick.util.d.ts +4 -1
  152. package/dist/utility/wrun/wrun-live-tick.util.js +130 -44
  153. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.d.ts +53 -0
  154. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.js +162 -0
  155. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +224 -0
  156. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +342 -0
  157. package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +88 -0
  158. package/dist/utility/wrun/wrun-market-size-defaults.util.js +471 -0
  159. package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +43 -8
  160. package/dist/utility/wrun/wrun-opra-flow.leaf.js +37 -6
  161. package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +51 -10
  162. package/dist/utility/wrun/wrun-option-contract-flow.util.js +85 -33
  163. package/dist/utility/wrun/wrun-option-prints.util.d.ts +172 -3
  164. package/dist/utility/wrun/wrun-option-prints.util.js +394 -17
  165. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +99 -0
  166. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +218 -0
  167. package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +365 -0
  168. package/dist/utility/wrun/wrun-option-strike-flow.util.js +797 -0
  169. package/dist/utility/wrun/wrun-option-views.util.d.ts +231 -7
  170. package/dist/utility/wrun/wrun-option-views.util.js +643 -23
  171. package/dist/utility/wrun/wrun-options-chain.util.d.ts +6 -4
  172. package/dist/utility/wrun/wrun-options-chain.util.js +8 -5
  173. package/dist/utility/wrun/wrun-options-stop.util.d.ts +2 -1
  174. package/dist/utility/wrun/wrun-options-stop.util.js +3 -2
  175. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +3 -0
  176. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +31 -14
  177. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +22 -0
  178. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +9 -1
  179. package/dist/utility/wrun/wrun-overlay-recovery.util.js +32 -3
  180. package/dist/utility/wrun/wrun-overlay-result.util.d.ts +7 -1
  181. package/dist/utility/wrun/wrun-overlay-result.util.js +2 -0
  182. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +34 -6
  183. package/dist/utility/wrun/wrun-overlay-run.util.js +527 -180
  184. package/dist/utility/wrun/wrun-pack-widths.leaf.d.ts +15 -0
  185. package/dist/utility/wrun/wrun-pack-widths.leaf.js +22 -0
  186. package/dist/utility/wrun/wrun-pack.util.d.ts +13 -8
  187. package/dist/utility/wrun/wrun-pack.util.js +38 -21
  188. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +4 -0
  189. package/dist/utility/wrun/wrun-panel-mount.util.js +62 -22
  190. package/dist/utility/wrun/wrun-panel-style.util.d.ts +41 -14
  191. package/dist/utility/wrun/wrun-panel-style.util.js +86 -26
  192. package/dist/utility/wrun/wrun-param-map.util.d.ts +7 -6
  193. package/dist/utility/wrun/wrun-param-map.util.js +8 -5
  194. package/dist/utility/wrun/wrun-param-values.util.d.ts +10 -2
  195. package/dist/utility/wrun/wrun-param-values.util.js +2 -0
  196. package/dist/utility/wrun/wrun-pin-spelling.util.js +19 -10
  197. package/dist/utility/wrun/wrun-prefix-lanes.util.js +2 -2
  198. package/dist/utility/wrun/wrun-refusal.util.js +17 -2
  199. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +20 -0
  200. package/dist/utility/wrun/wrun-script-inputs.util.js +43 -0
  201. package/dist/utility/wrun/wrun-source-rows.util.d.ts +4 -0
  202. package/dist/utility/wrun/wrun-source-rows.util.js +92 -40
  203. package/dist/utility/wrun/wrun-tape-source.util.d.ts +133 -48
  204. package/dist/utility/wrun/wrun-tape-source.util.js +205 -62
  205. package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +7 -5
  206. package/dist/utility/wrun/wrun-volume-profile-lane.util.js +8 -6
  207. package/dist/workers/utils/volume-profile.worker.util.d.ts +4 -1
  208. package/dist/workers/utils/volume-profile.worker.util.js +5 -2
  209. package/dist/workers/wrun/wrun-abi-host.js +3 -2
  210. package/package.json +11 -11
@@ -249,6 +249,14 @@ export interface WrunMainCandleRequestIdentity {
249
249
  /** The chart's instrument category (an option contract's is OPTION). */
250
250
  category?: number;
251
251
  }
252
+ /** The identity a chart's mounted main rows were loaded for, the fields the package reads (web: ohlcv-cache.types.ts
253
+ * `MainDataRequestIdentity`; one way, web's carries the pool, session and adjustment fields too). */
254
+ export interface WrunLoadedMainIdentity {
255
+ readonly exchange: string | null;
256
+ readonly symbol: string | null;
257
+ readonly interval: string | null;
258
+ readonly transformations: string | null;
259
+ }
252
260
  /** A lazy-load check's target range (web: utility/chart/viewport-pan-tracking.util.ts `LazyLoadTargetRange`). */
253
261
  export interface WrunLazyLoadTargetRange {
254
262
  startTs: number;
@@ -261,6 +269,10 @@ export interface WrunLazyLoadTargetRange {
261
269
  export interface WrunDataFetchingModule {
262
270
  runChartLazyLoadCheck(chartIndex: number, expectedTc?: WrunChartHandle, reason?: string, targetRange?: WrunLazyLoadTargetRange, trigger?: string): void;
263
271
  isMainCandleFetchInFlight(chartIndex: number): boolean;
272
+ /** The identity the chart's mounted main rows were loaded for (web: `loadedMainIdentityOf`, the loaded-main identity
273
+ * stamp every commit, cache paint and restore writes), or null before any stamp. A switch repoints the metadata
274
+ * before the incoming market's rows mount, so a read that infers a market fact from the rows asks it first. */
275
+ loadedMainIdentityOf(chartIndex: number): WrunLoadedMainIdentity | null;
264
276
  buildMainCandleBasePayload(identity: WrunMainCandleRequestIdentity): object;
265
277
  resolveMainCandleSidedRequest(input: {
266
278
  transformations: string;
@@ -316,6 +328,10 @@ export interface WrunStreamCompletionInfo {
316
328
  nativeProfileBlockSize?: number;
317
329
  frvpFetchMeta?: WrunFrvpFetchMeta;
318
330
  serverTookMs?: number;
331
+ /** What the worker's FETCH_DATA downloaded (the owner's totals: every subscriber of a shared request hears them). */
332
+ wireBytes?: number;
333
+ wireFrames?: number;
334
+ wirePoints?: number;
319
335
  }
320
336
  /** The options a main candle fetch passes (web: sentry.interface.ts `V2StreamHandlers` and `V2FetchOptions`,
321
337
  * v2.service.ts `V2SharedFetchOptions`): the handlers in method syntax, so a handler that names web's completion type
@@ -352,6 +368,14 @@ export interface WrunV2ServiceModule {
352
368
  fetchData(indicator: string, payload: never, chartIndex: number, options: WrunMainCandleFetchOptions): Promise<void>;
353
369
  warmGateReaderFor(exchange: string): void;
354
370
  warmGateReaderOnIntent(exchange: string, surface: WrunGateReaderIntentSurface): Promise<WrunGateReaderIntentWarm>;
371
+ /** CHANGED (next release, optional): one series read answered whole (web: v2.service `sendSeriesOneShot`, the
372
+ * worker's `readSeries` over the app's series descriptor, a typed `never` here as `fetchData`'s payload is: the
373
+ * descriptor is the app's). Read by the C-DOLLAR stored unit (wrun-chart-market-facts.util
374
+ * `warmWrunMarketStoredUnit`: a market's newest TRADE_LARGE print, a v2-only read); a host that binds none proves no
375
+ * stored unit, so a raw floor's carry is dropped there by name. */
376
+ sendSeriesOneShot?(descriptor: never, options?: {
377
+ timeoutMs?: number;
378
+ }): Promise<readonly unknown[]>;
355
379
  };
356
380
  }
357
381
  /** A markets request as the app hands it to the worker (web: workers/messages/indicator-v2.messages.ts
@@ -390,6 +414,14 @@ export interface WrunMetadataServiceModule {
390
414
  getBlockSizes(params: WrunBlockSizesParams, options?: {
391
415
  readCache?: boolean;
392
416
  }): Promise<number[]>;
417
+ /** CHANGED (next release, optional): one market's instrument registry record (StreamRegistryMetadatas: its
418
+ * `contractMultiplier`, `inverse`, `pointValue` and `normalizedSymbol` among the fields), null when the registry
419
+ * holds none. Read by the C-DOLLAR trade units (wrun-chart-market-facts.util `warmWrunMarketTradeUnits`, fresh); a
420
+ * host that binds none reads no registry units, so a dollar tape on a CME contract and the carry of a raw floor
421
+ * prove nothing there. web: metadata.service `getSymbolMetadata`. */
422
+ getSymbolMetadata?(exchange: string, symbol: string, options?: {
423
+ fresh?: boolean;
424
+ }): Promise<Record<string, unknown> | null>;
393
425
  };
394
426
  }
395
427
  /** The gate planes an option chain lists on (workers/constants/socket-slots.ts `GateProvider`) and a crypto option
@@ -844,14 +876,28 @@ export interface WrunPackEnsureResult {
844
876
  /** The chart a plot gate notice belongs to, why a plot kind cannot draw, and one plot kind the gate refused
845
877
  * (utility/wrun/wrun-plot-gate.types.ts, moved in phase 1b). */
846
878
  export type { WrunPlotGateChart, WrunPlotGateCause, WrunPlotGateRefusal } from './utility/wrun/wrun-plot-gate.types.js';
879
+ /** The download meter a source fetch charges, and the summary a run hands the add's attempt
880
+ * (utility/wrun/wrun-download-meter.util.ts). */
881
+ import type { WrunDownloadMeterPort, WrunDownloadSummary } from './utility/wrun/wrun-download-meter.util.js';
882
+ export type { WrunDownloadMeterPort, WrunDownloadSummary };
847
883
  /** A source fetch's wire verdict (web: instances/titan-charts.ts `KScriptSourceFetchVerdict`). */
848
884
  export interface WrunSourceFetchVerdict {
849
885
  complete: boolean;
850
886
  servedEmpty: boolean;
851
887
  source: 'wire' | 'row-cache' | 'replay-cache' | 'composed' | 'main-rows' | 'resident-split';
888
+ /** Wire bytes, frames and points this acquisition downloaded for the asker: the owner of a wire request; 0 for a
889
+ * follower and every cache. Set on the verdict a download charge carries (`WrunDownloadCharge`); absent where the
890
+ * host has no stamp, and the meter then charges the answer's cell bytes. */
891
+ wireBytes?: number;
892
+ wireFrames?: number;
893
+ wirePoints?: number;
852
894
  }
853
895
  /** A source fetch's options (web: the options of instances/titan-charts.ts `dataFetch`). */
854
896
  export interface WrunSourceFetchOptions {
897
+ /** The download meter the call charges (wrun-download-meter.util): the run's own, or the live session's. Required,
898
+ * so a call site that asks the wire without counting what it downloads does not typecheck. The web port hands it to
899
+ * dataFetch beside the options, never inside them. */
900
+ meter: WrunDownloadMeterPort;
855
901
  preferPackedOrderbookWorker?: boolean;
856
902
  latestAnchorBars?: number;
857
903
  retryAttempt?: number;
@@ -1091,14 +1137,16 @@ export type WrunAttemptStageMs = Partial<Record<'queueMs' | 'resolveMs' | 'downl
1091
1137
  /** The closed failure vocabulary analytics receives (web: wrun-attempt-envelope.util.ts `WrunAttemptFailureReason`). */
1092
1138
  export type WrunAttemptFailureReason = 'refused' | 'source-unavailable' | 'no-bars' | 'chart-gone' | 'compute-error' | 'integration-error' | 'timeout' | 'cancelled' | 'other';
1093
1139
  /** A failed attempt's outcome: its reason and, when the rejection carries a refusal record, the record's class (web:
1094
- * wrun-attempt-envelope.util.ts `WrunAttemptFailure`). */
1140
+ * wrun-attempt-envelope.util.ts `WrunAttemptFailure`). Never `cancelled`: the host names every cancel's drop. */
1095
1141
  export type WrunAttemptFailure = {
1096
- reason: WrunAttemptFailureReason;
1142
+ reason: Exclude<WrunAttemptFailureReason, 'cancelled'>;
1097
1143
  refusal?: WrunRefusalClass;
1098
1144
  };
1099
- /** How an attempt settled (web: `settleWrunAttempt`'s outcome). */
1145
+ /** How an attempt settled (web: `settleWrunAttempt`'s outcome). `firstSlice`: the result drew a row lane's
1146
+ * first-paint slice alone, its older bars still loading (the time is the time to the first result). */
1100
1147
  export type WrunAttemptOutcome = {
1101
1148
  ok: true;
1149
+ firstSlice?: true;
1102
1150
  } | ({
1103
1151
  ok: false;
1104
1152
  } & (WrunAttemptFailure | {
package/dist/index.d.ts CHANGED
@@ -52,6 +52,8 @@ export * from './market-data/venue-governed.util.js';
52
52
  export * from './market-data/venues/index.js';
53
53
  export * from './market-data/venues/opra.js';
54
54
  export * from './replay/replayIndicatorRows.js';
55
+ export * from './settings-templates/footprint-rows.js';
56
+ export * from './settings-templates/form-rows.js';
55
57
  export * from './settings-templates/frvp-fields.js';
56
58
  export * from './settings-templates/index.js';
57
59
  export * from './settings-templates/indicator-fields.js';
@@ -63,6 +65,7 @@ export * from './utility/chart/builtin-identity.util.js';
63
65
  export * from './utility/chart/cache-alignment.util.js';
64
66
  export * from './utility/chart/calendar-interval.util.js';
65
67
  export * from './utility/chart/candle-bar-end.util.js';
68
+ export * from './utility/chart/candle-volume-unit.leaf.js';
66
69
  export * from './utility/chart/chart-data-fetch-generation.util.js';
67
70
  export * from './utility/chart/chart-load-phase.util.js';
68
71
  export * from './utility/chart/chart-mount-epoch.util.js';
@@ -79,6 +82,9 @@ export * from './utility/chart/feed-interval.util.js';
79
82
  export * from './utility/chart/fetch-dedupe-policy.util.js';
80
83
  export * from './utility/chart/footprint-band.util.js';
81
84
  export * from './utility/chart/footprint-cell-identity.util.js';
85
+ export * from './utility/chart/footprint-columns.util.js';
86
+ export * from './utility/chart/footprint-display-mode.util.js';
87
+ export * from './utility/chart/footprint-sierra-look.util.js';
82
88
  export * from './utility/chart/footprint-tick-grid.util.js';
83
89
  export * from './utility/chart/formula-calendar.util.js';
84
90
  export * from './utility/chart/gesture-timing.leaf.js';
@@ -184,7 +190,10 @@ export * from './utility/intl-locale.util.js';
184
190
  export * from './utility/market-events/earnings-scope.util.js';
185
191
  export * from './utility/market-events/zoned-clock.util.js';
186
192
  export * from './utility/number-format.util.js';
193
+ export * from './utility/options/cme-options-root.util.js';
194
+ export * from './utility/options/option-book.util.js';
187
195
  export * from './utility/options/option-symbol.util.js';
196
+ export * from './utility/options/option-trade-date.util.js';
188
197
  export * from './utility/options/option-trade-units.util.js';
189
198
  export * from './utility/options/option-venue-disclosure.util.js';
190
199
  export * from './utility/options/option-venue.util.js';
@@ -219,6 +228,7 @@ export * from './utility/wrun/sources/row-lanes/index.js';
219
228
  export * from './utility/wrun/sources/row-lanes/option_contract_flow.js';
220
229
  export * from './utility/wrun/sources/wrun-poll-lane.types.js';
221
230
  export * from './utility/wrun/sources/wrun-poll-lanes.util.js';
231
+ export * from './utility/wrun/sources/wrun-row-lane-first-paint.util.js';
222
232
  export * from './utility/wrun/sources/wrun-row-lane.types.js';
223
233
  export * from './utility/wrun/sources/wrun-row-lanes.util.js';
224
234
  export * from './utility/wrun/wrun-alert-outputs.registry.js';
@@ -243,6 +253,7 @@ export * from './utility/wrun/wrun-chart-names.util.js';
243
253
  export * from './utility/wrun/wrun-chart-time.util.js';
244
254
  export * from './utility/wrun/wrun-child-overlay-id.util.js';
245
255
  export * from './utility/wrun/wrun-cloud-opra-stamp.util.js';
256
+ export * from './utility/wrun/wrun-cloud-record.leaf.js';
246
257
  export * from './utility/wrun/wrun-cloud-record.util.js';
247
258
  export * from './utility/wrun/wrun-coin-lane-live.util.js';
248
259
  export * from './utility/wrun/wrun-color-facts.util.js';
@@ -252,6 +263,7 @@ export * from './utility/wrun/wrun-daily-lane.util.js';
252
263
  export * from './utility/wrun/wrun-deadline.util.js';
253
264
  export * from './utility/wrun/wrun-debug-output.util.js';
254
265
  export * from './utility/wrun/wrun-declared-warmup.util.js';
266
+ export * from './utility/wrun/wrun-download-meter.util.js';
255
267
  export * from './utility/wrun/wrun-draft-legend-note.util.js';
256
268
  export * from './utility/wrun/wrun-draft-overlay.util.js';
257
269
  export * from './utility/wrun/wrun-draw-skipped.leaf.js';
@@ -293,6 +305,8 @@ export * from './utility/wrun/wrun-live-patch.util.js';
293
305
  export * from './utility/wrun/wrun-live-tick.util.js';
294
306
  export * from './utility/wrun/wrun-loading-owner.util.js';
295
307
  export * from './utility/wrun/wrun-market-facts.util.js';
308
+ export * from './utility/wrun/wrun-market-size-defaults.leaf.js';
309
+ export * from './utility/wrun/wrun-market-size-defaults.util.js';
296
310
  export * from './utility/wrun/wrun-memory-clamp.util.js';
297
311
  export * from './utility/wrun/wrun-odds-template-market.util.js';
298
312
  export * from './utility/wrun/wrun-official-scope.leaf.js';
@@ -303,6 +317,8 @@ export * from './utility/wrun/wrun-opra-stats.leaf.js';
303
317
  export * from './utility/wrun/wrun-option-contract-flow.util.js';
304
318
  export * from './utility/wrun/wrun-option-knobs.util.js';
305
319
  export * from './utility/wrun/wrun-option-prints.util.js';
320
+ export * from './utility/wrun/wrun-option-strike-flow-lane.util.js';
321
+ export * from './utility/wrun/wrun-option-strike-flow.util.js';
306
322
  export * from './utility/wrun/wrun-option-summary-lane.util.js';
307
323
  export * from './utility/wrun/wrun-option-views.util.js';
308
324
  export * from './utility/wrun/wrun-options-stop.util.js';
@@ -312,6 +328,7 @@ export * from './utility/wrun/wrun-overlay-lifecycle.util.js';
312
328
  export * from './utility/wrun/wrun-overlay-metadata.util.js';
313
329
  export * from './utility/wrun/wrun-overlay-recovery.util.js';
314
330
  export * from './utility/wrun/wrun-overlay-result.util.js';
331
+ export * from './utility/wrun/wrun-pack-widths.leaf.js';
315
332
  export * from './utility/wrun/wrun-pack.util.js';
316
333
  export * from './utility/wrun/wrun-panel-mount.lazy.js';
317
334
  export * from './utility/wrun/wrun-panel-style.lazy.js';
package/dist/index.js CHANGED
@@ -55,6 +55,8 @@ export * from './market-data/venue-governed.util.js';
55
55
  export * from './market-data/venues/index.js';
56
56
  export * from './market-data/venues/opra.js';
57
57
  export * from './replay/replayIndicatorRows.js';
58
+ export * from './settings-templates/footprint-rows.js';
59
+ export * from './settings-templates/form-rows.js';
58
60
  export * from './settings-templates/frvp-fields.js';
59
61
  export * from './settings-templates/index.js';
60
62
  export * from './settings-templates/indicator-fields.js';
@@ -66,6 +68,7 @@ export * from './utility/chart/builtin-identity.util.js';
66
68
  export * from './utility/chart/cache-alignment.util.js';
67
69
  export * from './utility/chart/calendar-interval.util.js';
68
70
  export * from './utility/chart/candle-bar-end.util.js';
71
+ export * from './utility/chart/candle-volume-unit.leaf.js';
69
72
  export * from './utility/chart/chart-data-fetch-generation.util.js';
70
73
  export * from './utility/chart/chart-load-phase.util.js';
71
74
  export * from './utility/chart/chart-mount-epoch.util.js';
@@ -82,6 +85,9 @@ export * from './utility/chart/feed-interval.util.js';
82
85
  export * from './utility/chart/fetch-dedupe-policy.util.js';
83
86
  export * from './utility/chart/footprint-band.util.js';
84
87
  export * from './utility/chart/footprint-cell-identity.util.js';
88
+ export * from './utility/chart/footprint-columns.util.js';
89
+ export * from './utility/chart/footprint-display-mode.util.js';
90
+ export * from './utility/chart/footprint-sierra-look.util.js';
85
91
  export * from './utility/chart/footprint-tick-grid.util.js';
86
92
  export * from './utility/chart/formula-calendar.util.js';
87
93
  export * from './utility/chart/gesture-timing.leaf.js';
@@ -187,7 +193,10 @@ export * from './utility/intl-locale.util.js';
187
193
  export * from './utility/market-events/earnings-scope.util.js';
188
194
  export * from './utility/market-events/zoned-clock.util.js';
189
195
  export * from './utility/number-format.util.js';
196
+ export * from './utility/options/cme-options-root.util.js';
197
+ export * from './utility/options/option-book.util.js';
190
198
  export * from './utility/options/option-symbol.util.js';
199
+ export * from './utility/options/option-trade-date.util.js';
191
200
  export * from './utility/options/option-trade-units.util.js';
192
201
  export * from './utility/options/option-venue-disclosure.util.js';
193
202
  export * from './utility/options/option-venue.util.js';
@@ -222,6 +231,7 @@ export * from './utility/wrun/sources/row-lanes/index.js';
222
231
  export * from './utility/wrun/sources/row-lanes/option_contract_flow.js';
223
232
  export * from './utility/wrun/sources/wrun-poll-lane.types.js';
224
233
  export * from './utility/wrun/sources/wrun-poll-lanes.util.js';
234
+ export * from './utility/wrun/sources/wrun-row-lane-first-paint.util.js';
225
235
  export * from './utility/wrun/sources/wrun-row-lane.types.js';
226
236
  export * from './utility/wrun/sources/wrun-row-lanes.util.js';
227
237
  export * from './utility/wrun/wrun-alert-outputs.registry.js';
@@ -246,6 +256,7 @@ export * from './utility/wrun/wrun-chart-names.util.js';
246
256
  export * from './utility/wrun/wrun-chart-time.util.js';
247
257
  export * from './utility/wrun/wrun-child-overlay-id.util.js';
248
258
  export * from './utility/wrun/wrun-cloud-opra-stamp.util.js';
259
+ export * from './utility/wrun/wrun-cloud-record.leaf.js';
249
260
  export * from './utility/wrun/wrun-cloud-record.util.js';
250
261
  export * from './utility/wrun/wrun-coin-lane-live.util.js';
251
262
  export * from './utility/wrun/wrun-color-facts.util.js';
@@ -255,6 +266,7 @@ export * from './utility/wrun/wrun-daily-lane.util.js';
255
266
  export * from './utility/wrun/wrun-deadline.util.js';
256
267
  export * from './utility/wrun/wrun-debug-output.util.js';
257
268
  export * from './utility/wrun/wrun-declared-warmup.util.js';
269
+ export * from './utility/wrun/wrun-download-meter.util.js';
258
270
  export * from './utility/wrun/wrun-draft-legend-note.util.js';
259
271
  export * from './utility/wrun/wrun-draft-overlay.util.js';
260
272
  export * from './utility/wrun/wrun-draw-skipped.leaf.js';
@@ -296,6 +308,8 @@ export * from './utility/wrun/wrun-live-patch.util.js';
296
308
  export * from './utility/wrun/wrun-live-tick.util.js';
297
309
  export * from './utility/wrun/wrun-loading-owner.util.js';
298
310
  export * from './utility/wrun/wrun-market-facts.util.js';
311
+ export * from './utility/wrun/wrun-market-size-defaults.leaf.js';
312
+ export * from './utility/wrun/wrun-market-size-defaults.util.js';
299
313
  export * from './utility/wrun/wrun-memory-clamp.util.js';
300
314
  export * from './utility/wrun/wrun-odds-template-market.util.js';
301
315
  export * from './utility/wrun/wrun-official-scope.leaf.js';
@@ -306,6 +320,8 @@ export * from './utility/wrun/wrun-opra-stats.leaf.js';
306
320
  export * from './utility/wrun/wrun-option-contract-flow.util.js';
307
321
  export * from './utility/wrun/wrun-option-knobs.util.js';
308
322
  export * from './utility/wrun/wrun-option-prints.util.js';
323
+ export * from './utility/wrun/wrun-option-strike-flow-lane.util.js';
324
+ export * from './utility/wrun/wrun-option-strike-flow.util.js';
309
325
  export * from './utility/wrun/wrun-option-summary-lane.util.js';
310
326
  export * from './utility/wrun/wrun-option-views.util.js';
311
327
  export * from './utility/wrun/wrun-options-stop.util.js';
@@ -315,6 +331,7 @@ export * from './utility/wrun/wrun-overlay-lifecycle.util.js';
315
331
  export * from './utility/wrun/wrun-overlay-metadata.util.js';
316
332
  export * from './utility/wrun/wrun-overlay-recovery.util.js';
317
333
  export * from './utility/wrun/wrun-overlay-result.util.js';
334
+ export * from './utility/wrun/wrun-pack-widths.leaf.js';
318
335
  export * from './utility/wrun/wrun-pack.util.js';
319
336
  export * from './utility/wrun/wrun-panel-mount.lazy.js';
320
337
  export * from './utility/wrun/wrun-panel-style.lazy.js';
@@ -36,18 +36,37 @@ export declare function containsTpoWindowTime(timestamp: number, window: TpoSess
36
36
  export declare function getTpoSessionStart(timestamp: number, sessionType: string, customTimeRange?: TpoTimeRange): number;
37
37
  export declare function getNextTpoSessionStart(timestamp: number, sessionType: string, customTimeRange?: TpoTimeRange): number;
38
38
  export declare function generateTpoLetters(blockIds: number[], _sessionType: string, _tpoBlockSizeMinutes: number): string[];
39
+ /**
40
+ * A custom session's place in the trading day: the day session (regular
41
+ * hours) or the evening session (electronic hours outside them). The
42
+ * day/evening preset writes it; a session the user drew has none and reads as
43
+ * 'custom' on its rows.
44
+ */
45
+ export type TpoSessionRole = 'day' | 'evening';
46
+ /**
47
+ * The clock a custom-session set is written in: UTC, or New York wall time
48
+ * ('ET', daylight saving included). The gateway's custom-time-range path
49
+ * serves only these two (tsdb-gateway tpo_agg.go sessionCustomTimeRange
50
+ * degrades every other zone to plain UTC days), so Chicago is not offered.
51
+ */
52
+ export type TpoCustomSessionsTimezone = 'UTC' | 'ET';
39
53
  export interface TpoCustomSessionSegment {
40
54
  label: string;
41
- /** 'HH:MM' in UTC. */
55
+ /** 'HH:MM' on the set's clock (UTC unless the set names New York). */
42
56
  start: string;
43
- /** 'HH:MM' in UTC; '00:00' (or '24:00') as an end means midnight. An end
44
- * earlier than the start wraps past midnight into the next day. */
57
+ /** 'HH:MM' on the set's clock; '00:00' (or '24:00') as an end means
58
+ * midnight. An end earlier than the start wraps past midnight into the
59
+ * next day. */
45
60
  end: string;
46
61
  color: string;
62
+ /** Day or evening session (the day/evening preset); absent on a user session. */
63
+ role?: TpoSessionRole;
47
64
  }
48
65
  export interface TpoCustomSessionsSettings {
49
66
  enabled?: boolean;
50
67
  segments?: TpoCustomSessionSegment[];
68
+ /** Absent reads UTC: every set saved before the New York clock. */
69
+ timezone?: TpoCustomSessionsTimezone;
51
70
  }
52
71
  /** Editable starting template (Asia / London / New York / Close, UTC) — a
53
72
  * default for the editor, never a hard-coded behavior. */
@@ -58,11 +77,15 @@ interface NormalizedTpoSegment extends TpoCustomSessionSegment {
58
77
  * wraps past midnight ('22:00'-'11:00' is 1320..2100). */
59
78
  endMinute: number;
60
79
  index: number;
80
+ /** The set's clock (one per set) and its IANA zone. */
81
+ timezone: TpoCustomSessionsTimezone;
82
+ zone: string;
61
83
  }
62
84
  /** Validate + order user segments; null when the set is unusable (bad times,
63
85
  * zero-length, or overlapping segments). Gaps between segments are allowed,
64
- * and one segment may wrap past midnight. */
65
- export declare function normalizeTpoCustomSessionSegments(value: unknown): NormalizedTpoSegment[] | null;
86
+ * and one segment may wrap past midnight. `timezone` is the set's clock
87
+ * (absent: UTC); validation reads wall-clock minutes on either clock. */
88
+ export declare function normalizeTpoCustomSessionSegments(value: unknown, timezone?: unknown): NormalizedTpoSegment[] | null;
66
89
  export declare function resolveTpoCustomSessionsSetting(settings: {
67
90
  sessionType?: unknown;
68
91
  customSessions?: TpoCustomSessionsSettings;
@@ -70,12 +93,17 @@ export declare function resolveTpoCustomSessionsSetting(settings: {
70
93
  /**
71
94
  * Fetch-alignment range for an active custom-session set, or undefined to keep
72
95
  * plain UTC-day alignment. The fetch window must be cut where no session is
73
- * open, or its edge returns a session fragment: that instant is UTC midnight
74
- * until a segment wraps past it, then it is the wrapped session's end.
96
+ * open, or its edge returns a session fragment: that instant is the set's
97
+ * midnight (UTC: the plain-day path; New York: a New York midnight cycle)
98
+ * until a segment wraps past it, then it is the wrapped session's end, on the
99
+ * set's clock.
75
100
  */
76
101
  export declare function resolveTpoCustomSessionsAlignmentRange(segments: readonly NormalizedTpoSegment[]): TpoTimeRange | undefined;
77
102
  /** Data-affecting projection of the custom-session config (colors excluded):
78
- * used for cache keys and refetch triggers. Empty string when inactive. */
103
+ * used for cache keys and refetch triggers. Empty string when inactive. A
104
+ * UTC set without roles (every set saved before the New York clock) keys
105
+ * exactly as it always did, so its cached sessions stay warm; the clock and
106
+ * the roles join the key only where they are set (both change the rows). */
79
107
  export declare function tpoCustomSessionsDataKey(settings: {
80
108
  sessionType?: unknown;
81
109
  customSessions?: TpoCustomSessionsSettings;
@@ -87,11 +115,12 @@ export interface TpoCustomSessionWindow {
87
115
  label: string;
88
116
  color: string;
89
117
  }
90
- /** The segment window containing `timestamp` (unix seconds, UTC), or null when
91
- * the timestamp falls in a gap between segments. */
118
+ /** The segment window containing `timestamp` (unix seconds), or null when
119
+ * the timestamp falls in a gap between segments. Segments read on their
120
+ * set's clock: UTC days, or New York days for a New York set. */
92
121
  export declare function getTpoCustomSessionWindow(timestamp: number, segments: readonly NormalizedTpoSegment[]): TpoCustomSessionWindow | null;
93
122
  /** The next segment start strictly after `timestamp` (same day or the first
94
- * segment of the next day). */
123
+ * segment of the next day), on the set's clock. */
95
124
  export declare function getNextTpoCustomSessionStart(timestamp: number, segments: readonly NormalizedTpoSegment[]): number;
96
125
  /** Flat 4-stop ramps (one per segment) for titan's periodPalettes, so a
97
126
  * period's paletteIndex — the segment index — colors the whole profile. */
@@ -2,7 +2,7 @@ import dayjs from 'dayjs';
2
2
  import isoWeek from 'dayjs/plugin/isoWeek.js';
3
3
  import timezone from 'dayjs/plugin/timezone.js';
4
4
  import utc from 'dayjs/plugin/utc.js';
5
- import { zoneWallMsAt } from '../../utility/chart/ny-calendar.util.js';
5
+ import { zoneWallMsAt, zoneWallToUtcMs } from '../../utility/chart/ny-calendar.util.js';
6
6
  import { getTradingDayAnchor, getTradingDayTpoTimeRange } from '../../utility/chart/trading-day.util.js';
7
7
  dayjs.extend(utc);
8
8
  dayjs.extend(isoWeek);
@@ -295,12 +295,22 @@ function parseTpoSegmentEndToMinutes(value) {
295
295
  return undefined;
296
296
  return minutes === 0 ? MINUTES_PER_DAY : minutes;
297
297
  }
298
+ /** A set's clock from its stored value: New York ('ET' or the IANA name), else UTC. */
299
+ function tpoCustomSessionsTimezoneOf(value) {
300
+ return value === 'ET' || value === 'America/New_York' ? 'ET' : 'UTC';
301
+ }
302
+ function tpoSessionRoleOf(value) {
303
+ return value === 'day' || value === 'evening' ? value : undefined;
304
+ }
298
305
  /** Validate + order user segments; null when the set is unusable (bad times,
299
306
  * zero-length, or overlapping segments). Gaps between segments are allowed,
300
- * and one segment may wrap past midnight. */
301
- export function normalizeTpoCustomSessionSegments(value) {
307
+ * and one segment may wrap past midnight. `timezone` is the set's clock
308
+ * (absent: UTC); validation reads wall-clock minutes on either clock. */
309
+ export function normalizeTpoCustomSessionSegments(value, timezone) {
302
310
  if (!Array.isArray(value) || value.length === 0)
303
311
  return null;
312
+ const clock = tpoCustomSessionsTimezoneOf(timezone);
313
+ const zone = timezoneName(clock);
304
314
  const parsed = [];
305
315
  for (const raw of value) {
306
316
  if (!raw || typeof raw !== 'object')
@@ -313,14 +323,18 @@ export function normalizeTpoCustomSessionSegments(value) {
313
323
  if (clockEndMinute === startMinute)
314
324
  return null;
315
325
  const endMinute = clockEndMinute < startMinute ? clockEndMinute + MINUTES_PER_DAY : clockEndMinute;
326
+ const role = tpoSessionRoleOf(segment.role);
316
327
  parsed.push({
317
328
  label: String(segment.label ?? '').trim() || `Session ${parsed.length + 1}`,
318
329
  start: String(segment.start),
319
330
  end: String(segment.end),
320
331
  color: String(segment.color ?? '').trim() || '#4f8cff',
332
+ ...(role ? { role } : {}),
321
333
  startMinute,
322
334
  endMinute,
323
335
  index: 0,
336
+ timezone: clock,
337
+ zone,
324
338
  });
325
339
  }
326
340
  parsed.sort((a, b) => a.startMinute - b.startMinute);
@@ -344,29 +358,39 @@ export function resolveTpoCustomSessionsSetting(settings) {
344
358
  // Segments repeat on a 24h cycle; Weekly/Monthly sessions keep the plain path.
345
359
  if ((settings?.sessionType ?? 'Daily') !== 'Daily')
346
360
  return null;
347
- return normalizeTpoCustomSessionSegments(config.segments);
361
+ return normalizeTpoCustomSessionSegments(config.segments, config.timezone);
348
362
  }
349
363
  /**
350
364
  * Fetch-alignment range for an active custom-session set, or undefined to keep
351
365
  * plain UTC-day alignment. The fetch window must be cut where no session is
352
- * open, or its edge returns a session fragment: that instant is UTC midnight
353
- * until a segment wraps past it, then it is the wrapped session's end.
366
+ * open, or its edge returns a session fragment: that instant is the set's
367
+ * midnight (UTC: the plain-day path; New York: a New York midnight cycle)
368
+ * until a segment wraps past it, then it is the wrapped session's end, on the
369
+ * set's clock.
354
370
  */
355
371
  export function resolveTpoCustomSessionsAlignmentRange(segments) {
356
372
  const last = segments[segments.length - 1];
357
- if (!last || last.endMinute <= MINUTES_PER_DAY)
373
+ if (!last)
358
374
  return undefined;
375
+ const timezone = last.timezone ?? 'UTC';
359
376
  // start === end is resolveTpoTimeRangeWindow's full-session shape: a 24h
360
- // cycle anchored at that wall time.
361
- return { start_time: last.end, end_time: last.end, timezone: 'UTC' };
377
+ // cycle anchored at that wall time (DST-exact on the New York clock).
378
+ if (last.endMinute <= MINUTES_PER_DAY) {
379
+ return timezone === 'ET' ? { start_time: '00:00', end_time: '00:00', timezone } : undefined;
380
+ }
381
+ return { start_time: last.end, end_time: last.end, timezone };
362
382
  }
363
383
  /** Data-affecting projection of the custom-session config (colors excluded):
364
- * used for cache keys and refetch triggers. Empty string when inactive. */
384
+ * used for cache keys and refetch triggers. Empty string when inactive. A
385
+ * UTC set without roles (every set saved before the New York clock) keys
386
+ * exactly as it always did, so its cached sessions stay warm; the clock and
387
+ * the roles join the key only where they are set (both change the rows). */
365
388
  export function tpoCustomSessionsDataKey(settings) {
366
389
  const segments = resolveTpoCustomSessionsSetting(settings);
367
390
  if (!segments)
368
391
  return '';
369
- return JSON.stringify(segments.map(({ label, start, end }) => [label, start, end]));
392
+ const key = JSON.stringify(segments.map(({ label, start, end, role }) => (role ? [label, start, end, role] : [label, start, end])));
393
+ return segments[0].timezone === 'ET' ? `ET:${key}` : key;
370
394
  }
371
395
  function toTpoCustomSessionWindow(segment, startDaySec) {
372
396
  return {
@@ -377,9 +401,92 @@ function toTpoCustomSessionWindow(segment, startDaySec) {
377
401
  color: segment.color,
378
402
  };
379
403
  }
380
- /** The segment window containing `timestamp` (unix seconds, UTC), or null when
381
- * the timestamp falls in a gap between segments. */
404
+ const MS_PER_MINUTE = 60_000;
405
+ /** `zone`'s wall clock at `ms` as a UTC-shaped epoch; the instant itself where the zone clock serves none. */
406
+ function zoneWallMsOr(zone, ms) {
407
+ let wallMs;
408
+ try {
409
+ wallMs = zoneWallMsAt(zone, ms);
410
+ }
411
+ catch {
412
+ wallMs = Number.NaN;
413
+ }
414
+ return Number.isNaN(wallMs) ? ms : wallMs;
415
+ }
416
+ /**
417
+ * The instant (unix seconds) `zone`'s wall clock reads `wallMs`; the wall reading itself where the clock serves none.
418
+ * A wall time the clock skips (the spring-forward hour) opens at the first instant reading at or after it, the change
419
+ * itself: the solver settles a skipped time on an instant reading earlier, and a session start read that way would
420
+ * open before the instant asked from (a walk over starts would stall on it).
421
+ */
422
+ function zoneWallInstantSec(zone, wallMs) {
423
+ let ms;
424
+ try {
425
+ ms = zoneWallToUtcMs(zone, wallMs);
426
+ }
427
+ catch {
428
+ ms = Number.NaN;
429
+ }
430
+ if (Number.isNaN(ms))
431
+ return Math.floor(wallMs / 1000);
432
+ const readMs = zoneWallMsOr(zone, ms);
433
+ return Math.floor((readMs === wallMs ? ms : firstInstantReadingAtLeast(zone, wallMs, ms, readMs)) / 1000);
434
+ }
435
+ /**
436
+ * The first whole second whose `zone` wall reading is at least `wallMs`, for a skipped wall time: `ms` (reading
437
+ * `readMs`) sits on one side of the skipped span and the instant one span away on the other, so a bisection between
438
+ * them lands on the change. `ms` itself when the far side reads no later (no skipped span after all).
439
+ */
440
+ function firstInstantReadingAtLeast(zone, wallMs, ms, readMs) {
441
+ let low = readMs < wallMs ? ms : ms - (readMs - wallMs);
442
+ let high = readMs < wallMs ? ms + (wallMs - readMs) : ms;
443
+ if (!(zoneWallMsOr(zone, high) >= wallMs) || zoneWallMsOr(zone, low) >= wallMs)
444
+ return ms;
445
+ for (let step = 0; step < 64 && high - low > 1000; step += 1) {
446
+ const mid = low + Math.floor((high - low) / 2000) * 1000;
447
+ if (zoneWallMsOr(zone, mid) >= wallMs)
448
+ high = mid;
449
+ else
450
+ low = mid;
451
+ }
452
+ return high;
453
+ }
454
+ function zonedTpoCustomSessionWindow(segment, dayWallMs, zone) {
455
+ return {
456
+ startSec: zoneWallInstantSec(zone, dayWallMs + segment.startMinute * MS_PER_MINUTE),
457
+ endSec: zoneWallInstantSec(zone, dayWallMs + segment.endMinute * MS_PER_MINUTE),
458
+ index: segment.index,
459
+ label: segment.label,
460
+ color: segment.color,
461
+ };
462
+ }
463
+ /** A New York set's day: its segments are wall-clock minutes on the New York
464
+ * date, each edge converted on its own date, so a session keeps its wall
465
+ * hours across daylight saving (the 23 and 25 hour days included). */
466
+ function newYorkTpoCustomSessionDay(timestamp, segments) {
467
+ const zone = segments[0].zone || timezoneName('ET');
468
+ const wallMs = zoneWallMsOr(zone, timestamp * 1000);
469
+ const dayWallMs = Math.floor(wallMs / DAY_MS) * DAY_MS;
470
+ return { zone, dayWallMs, minuteOfDay: (wallMs - dayWallMs) / MS_PER_MINUTE };
471
+ }
472
+ /** The segment window containing `timestamp` (unix seconds), or null when
473
+ * the timestamp falls in a gap between segments. Segments read on their
474
+ * set's clock: UTC days, or New York days for a New York set. */
382
475
  export function getTpoCustomSessionWindow(timestamp, segments) {
476
+ if (segments[0]?.timezone === 'ET') {
477
+ const { zone, dayWallMs, minuteOfDay: wallMinute } = newYorkTpoCustomSessionDay(timestamp, segments);
478
+ const minuteOfDay = Math.floor(wallMinute);
479
+ const last = segments[segments.length - 1];
480
+ if (minuteOfDay < last.endMinute - MINUTES_PER_DAY) {
481
+ return zonedTpoCustomSessionWindow(last, dayWallMs - DAY_MS, zone);
482
+ }
483
+ for (const segment of segments) {
484
+ if (minuteOfDay >= segment.startMinute && minuteOfDay < segment.endMinute) {
485
+ return zonedTpoCustomSessionWindow(segment, dayWallMs, zone);
486
+ }
487
+ }
488
+ return null;
489
+ }
383
490
  const dayStart = dayjs.unix(timestamp).utc().startOf('day').unix();
384
491
  const minuteOfDay = Math.floor((timestamp - dayStart) / 60);
385
492
  // The post-midnight tail of the wrapping segment (always the last one)
@@ -396,8 +503,25 @@ export function getTpoCustomSessionWindow(timestamp, segments) {
396
503
  return null;
397
504
  }
398
505
  /** The next segment start strictly after `timestamp` (same day or the first
399
- * segment of the next day). */
506
+ * segment of the next day), on the set's clock. */
400
507
  export function getNextTpoCustomSessionStart(timestamp, segments) {
508
+ if (segments[0]?.timezone === 'ET') {
509
+ // Starts in wall order (today's later ones, then each next day's); the first instant strictly after `timestamp`
510
+ // wins. A start the clock repeats (the fall-back hour) opens once, on its first pass, so from the second pass it
511
+ // lies behind `timestamp` and is passed over: every step moves forward, and no walk over the starts stalls.
512
+ const { zone, dayWallMs, minuteOfDay } = newYorkTpoCustomSessionDay(timestamp, segments);
513
+ for (let day = 0; day <= 2; day += 1) {
514
+ for (const segment of segments) {
515
+ if (day === 0 && segment.startMinute <= minuteOfDay)
516
+ continue;
517
+ const startSec = zoneWallInstantSec(zone, dayWallMs + day * DAY_MS + segment.startMinute * MS_PER_MINUTE);
518
+ if (startSec > timestamp)
519
+ return startSec;
520
+ }
521
+ }
522
+ // Unreachable while the zone clock serves (the next day's first start lies a day ahead); still a step forward.
523
+ return Math.floor(timestamp) + SECONDS_PER_DAY;
524
+ }
401
525
  const dayStart = dayjs.unix(timestamp).utc().startOf('day').unix();
402
526
  const minuteOfDay = (timestamp - dayStart) / 60;
403
527
  for (const segment of segments) {