@orangecharts/wrun-chart-host 0.15.0 → 0.17.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 (202) hide show
  1. package/README.md +2 -0
  2. package/dist/constants/economic.constants.d.ts +2 -0
  3. package/dist/constants/economic.constants.js +2 -0
  4. package/dist/constants/feature-flags.constants.d.ts +13 -5
  5. package/dist/constants/feature-flags.constants.js +76 -35
  6. package/dist/constants/feature-limits.constants.d.ts +72 -4
  7. package/dist/constants/feature-limits.constants.js +104 -24
  8. package/dist/constants/interval.constants.js +5 -0
  9. package/dist/constants/kscript-data-interval-restrictions.constants.d.ts +12 -0
  10. package/dist/constants/kscript-data-interval-restrictions.constants.js +14 -0
  11. package/dist/constants/marketCapabilities.constants.d.ts +9 -0
  12. package/dist/constants/marketCapabilities.constants.js +39 -11
  13. package/dist/constants/typed-indicator-source.leaf.d.ts +7 -0
  14. package/dist/constants/typed-indicator-source.leaf.js +47 -0
  15. package/dist/constants/typed-session-history-venue.leaf.d.ts +7 -0
  16. package/dist/constants/typed-session-history-venue.leaf.js +9 -0
  17. package/dist/constants/typed-width-fold.leaf.d.ts +52 -0
  18. package/dist/constants/typed-width-fold.leaf.js +101 -0
  19. package/dist/constants/typed-width-source.leaf.d.ts +24 -0
  20. package/dist/constants/typed-width-source.leaf.js +126 -0
  21. package/dist/constants/typed-width.leaf.d.ts +57 -0
  22. package/dist/constants/typed-width.leaf.js +78 -0
  23. package/dist/host-env.d.ts +10 -0
  24. package/dist/host-env.js +7 -0
  25. package/dist/host-ports.types.d.ts +23 -17
  26. package/dist/index.d.ts +4 -0
  27. package/dist/index.js +4 -0
  28. package/dist/interfaces/kscript-diagnostics.interface.d.ts +35 -0
  29. package/dist/interfaces/wrun-runtime.interface.d.ts +66 -3
  30. package/dist/interfaces/wrun-runtime.interface.js +11 -0
  31. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +13 -0
  32. package/dist/kscript-data/controls/live-trades-merge.util.js +16 -1
  33. package/dist/market-data/billing.interface.d.ts +12 -45
  34. package/dist/market-data/billing.interface.js +2 -2
  35. package/dist/replay/replayLadder.js +7 -4
  36. package/dist/settings-templates/footprint-rows.d.ts +6 -0
  37. package/dist/settings-templates/footprint-rows.js +6 -0
  38. package/dist/settings-templates/frvp-fields.js +14 -0
  39. package/dist/settings-templates/indicator-fields.js +36 -0
  40. package/dist/settings-templates/tool-tables.generated.js +19 -1
  41. package/dist/utility/chart/__fixtures__/live-bucket-regular-golden.json +1706 -0
  42. package/dist/utility/chart/cache-alignment.util.d.ts +42 -0
  43. package/dist/utility/chart/cache-alignment.util.js +88 -18
  44. package/dist/utility/chart/calendar-interval.util.d.ts +83 -1
  45. package/dist/utility/chart/calendar-interval.util.js +152 -4
  46. package/dist/utility/chart/candle-bar-end.util.d.ts +11 -4
  47. package/dist/utility/chart/candle-bar-end.util.js +17 -6
  48. package/dist/utility/chart/chart-time-domain.util.d.ts +3 -0
  49. package/dist/utility/chart/chart-time-domain.util.js +13 -4
  50. package/dist/utility/chart/feed-interval.util.d.ts +4 -2
  51. package/dist/utility/chart/feed-interval.util.js +5 -2
  52. package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +3 -1
  53. package/dist/utility/chart/fetch-dedupe-policy.util.js +19 -1
  54. package/dist/utility/chart/footprint-display-mode.util.d.ts +2 -0
  55. package/dist/utility/chart/footprint-display-mode.util.js +5 -0
  56. package/dist/utility/chart/governed-lanes-gate.util.d.ts +46 -0
  57. package/dist/utility/chart/governed-lanes-gate.util.js +71 -0
  58. package/dist/utility/chart/governed-lanes-reader-seat.d.ts +14 -0
  59. package/dist/utility/chart/governed-lanes-reader-seat.js +14 -0
  60. package/dist/utility/chart/history-wall.util.d.ts +13 -2
  61. package/dist/utility/chart/history-wall.util.js +11 -4
  62. package/dist/utility/chart/index-mode-admission.util.js +9 -1
  63. package/dist/utility/chart/index-mode.util.d.ts +2 -2
  64. package/dist/utility/chart/index-mode.util.js +12 -6
  65. package/dist/utility/chart/index-otc.leaf.d.ts +37 -0
  66. package/dist/utility/chart/index-otc.leaf.js +68 -0
  67. package/dist/utility/chart/interval-ladder.util.d.ts +5 -2
  68. package/dist/utility/chart/interval-ladder.util.js +44 -4
  69. package/dist/utility/chart/interval-registry.util.d.ts +22 -1
  70. package/dist/utility/chart/interval-registry.util.js +50 -2
  71. package/dist/utility/chart/kscript-data-interval-restriction.leaf.d.ts +32 -4
  72. package/dist/utility/chart/kscript-data-interval-restriction.leaf.js +22 -5
  73. package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +10 -0
  74. package/dist/utility/chart/kscript-drawing-safe-area.util.js +30 -3
  75. package/dist/utility/chart/kscript-legend-entries.util.d.ts +21 -4
  76. package/dist/utility/chart/kscript-legend-entries.util.js +27 -5
  77. package/dist/utility/chart/kscript-main-grid-stages.util.js +74 -24
  78. package/dist/utility/chart/kscript-provenance-keys.util.js +6 -0
  79. package/dist/utility/chart/kscript-row-name.leaf.d.ts +13 -0
  80. package/dist/utility/chart/kscript-row-name.leaf.js +18 -0
  81. package/dist/utility/chart/kscript-venue-policy.util.d.ts +61 -26
  82. package/dist/utility/chart/kscript-venue-policy.util.js +138 -37
  83. package/dist/utility/chart/live-bucket.util.d.ts +29 -4
  84. package/dist/utility/chart/live-bucket.util.js +45 -12
  85. package/dist/utility/chart/market-session-schedule.util.d.ts +19 -0
  86. package/dist/utility/chart/market-session-schedule.util.js +2 -1
  87. package/dist/utility/chart/market-session.util.d.ts +62 -10
  88. package/dist/utility/chart/market-session.util.js +93 -13
  89. package/dist/utility/chart/marketKind.util.d.ts +11 -12
  90. package/dist/utility/chart/marketKind.util.js +45 -13
  91. package/dist/utility/chart/mixed-mode.util.d.ts +18 -0
  92. package/dist/utility/chart/om-target.util.js +6 -4
  93. package/dist/utility/chart/price-precision.util.d.ts +20 -6
  94. package/dist/utility/chart/price-precision.util.js +34 -7
  95. package/dist/utility/chart/profile-frame-window.util.d.ts +15 -0
  96. package/dist/utility/chart/profile-frame-window.util.js +12 -0
  97. package/dist/utility/chart/rth-session.util.d.ts +3 -1
  98. package/dist/utility/chart/rth-session.util.js +3 -1
  99. package/dist/utility/chart/script-source-session.util.d.ts +43 -0
  100. package/dist/utility/chart/script-source-session.util.js +61 -0
  101. package/dist/utility/chart/typed-width-grid.util.d.ts +23 -0
  102. package/dist/utility/chart/typed-width-grid.util.js +203 -0
  103. package/dist/utility/common/transformations.util.d.ts +6 -0
  104. package/dist/utility/common/transformations.util.js +28 -4
  105. package/dist/utility/market-events/market-events.util.js +3 -0
  106. package/dist/utility/number-format.util.d.ts +14 -1
  107. package/dist/utility/number-format.util.js +22 -4
  108. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.d.ts +24 -1
  109. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +115 -0
  110. package/dist/utility/v2/v2-enums.leaf.js +5 -0
  111. package/dist/utility/wrun/sources/row-lanes/dark_pool.d.ts +2 -1
  112. package/dist/utility/wrun/sources/row-lanes/dark_pool.js +4 -3
  113. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +13 -3
  114. package/dist/utility/wrun/wrun-batched-marks.util.js +96 -17
  115. package/dist/utility/wrun/wrun-canvases.util.d.ts +4 -2
  116. package/dist/utility/wrun/wrun-canvases.util.js +7 -12
  117. package/dist/utility/wrun/wrun-cap-notice.util.d.ts +5 -0
  118. package/dist/utility/wrun/wrun-cap-notice.util.js +23 -0
  119. package/dist/utility/wrun/wrun-card-style.util.d.ts +1 -1
  120. package/dist/utility/wrun/wrun-card-style.util.js +2 -2
  121. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +23 -8
  122. package/dist/utility/wrun/wrun-chart-market-facts.util.js +24 -9
  123. package/dist/utility/wrun/wrun-child-overlay-id.util.d.ts +10 -0
  124. package/dist/utility/wrun/wrun-child-overlay-id.util.js +24 -0
  125. package/dist/utility/wrun/wrun-cloud-cme-stamp.util.d.ts +72 -0
  126. package/dist/utility/wrun/wrun-cloud-cme-stamp.util.js +151 -0
  127. package/dist/utility/wrun/wrun-cme-root-specs.util.d.ts +10 -6
  128. package/dist/utility/wrun/wrun-cme-root-specs.util.js +19 -13
  129. package/dist/utility/wrun/wrun-color-facts.util.d.ts +3 -3
  130. package/dist/utility/wrun/wrun-color-facts.util.js +8 -5
  131. package/dist/utility/wrun/wrun-colour-tone.lazy.d.ts +20 -0
  132. package/dist/utility/wrun/wrun-colour-tone.lazy.js +23 -0
  133. package/dist/utility/wrun/wrun-colour-tone.util.d.ts +14 -0
  134. package/dist/utility/wrun/wrun-colour-tone.util.js +119 -0
  135. package/dist/utility/wrun/wrun-dark-pool.util.d.ts +3 -2
  136. package/dist/utility/wrun/wrun-dark-pool.util.js +5 -4
  137. package/dist/utility/wrun/wrun-frames.d.ts +1 -1
  138. package/dist/utility/wrun/wrun-frames.js +2 -2
  139. package/dist/utility/wrun/wrun-handles.util.d.ts +1 -1
  140. package/dist/utility/wrun/wrun-handles.util.js +1 -1
  141. package/dist/utility/wrun/wrun-host.service.d.ts +32 -2
  142. package/dist/utility/wrun/wrun-host.service.js +44 -2
  143. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +20 -0
  144. package/dist/utility/wrun/wrun-hosted-wire-caps.js +85 -2
  145. package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +37 -0
  146. package/dist/utility/wrun/wrun-hosted-wire.util.js +54 -0
  147. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +1 -0
  148. package/dist/utility/wrun/wrun-hud-looks.util.js +6 -11
  149. package/dist/utility/wrun/wrun-integration-route.util.d.ts +24 -0
  150. package/dist/utility/wrun/wrun-integration-route.util.js +19 -0
  151. package/dist/utility/wrun/wrun-live-intake.util.js +17 -1
  152. package/dist/utility/wrun/wrun-live-patch.util.d.ts +6 -1
  153. package/dist/utility/wrun/wrun-live-patch.util.js +10 -4
  154. package/dist/utility/wrun/wrun-live-tick.util.js +64 -5
  155. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +40 -6
  156. package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +2 -2
  157. package/dist/utility/wrun/wrun-market-size-defaults.util.js +10 -8
  158. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +3 -0
  159. package/dist/utility/wrun/wrun-overlay-drivers.util.js +3 -0
  160. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +17 -0
  161. package/dist/utility/wrun/wrun-overlay-run.util.js +318 -55
  162. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +1 -1
  163. package/dist/utility/wrun/wrun-panel-mount.util.js +42 -13
  164. package/dist/utility/wrun/wrun-pin-venues.util.d.ts +3 -2
  165. package/dist/utility/wrun/wrun-pin-venues.util.js +11 -4
  166. package/dist/utility/wrun/wrun-refusal.util.d.ts +4 -0
  167. package/dist/utility/wrun/wrun-refusal.util.js +102 -13
  168. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +5 -3
  169. package/dist/utility/wrun/wrun-registry-errors.util.js +5 -3
  170. package/dist/utility/wrun/wrun-row-source-factory.js +17 -1
  171. package/dist/utility/wrun/wrun-row-source.d.ts +8 -1
  172. package/dist/utility/wrun/wrun-run-health.util.js +1 -1
  173. package/dist/utility/wrun/wrun-sandbox-row-source.d.ts +1 -1
  174. package/dist/utility/wrun/wrun-sandbox-row-source.js +9 -0
  175. package/dist/utility/wrun/wrun-session-composition.util.d.ts +3 -2
  176. package/dist/utility/wrun/wrun-session-composition.util.js +3 -2
  177. package/dist/utility/wrun/wrun-setting-words.util.d.ts +12 -5
  178. package/dist/utility/wrun/wrun-setting-words.util.js +25 -8
  179. package/dist/utility/wrun/wrun-socket-row-source.d.ts +26 -1
  180. package/dist/utility/wrun/wrun-socket-row-source.js +125 -12
  181. package/dist/utility/wrun/wrun-source-rows.util.d.ts +3 -3
  182. package/dist/utility/wrun/wrun-source-rows.util.js +8 -7
  183. package/dist/utility/wrun/wrun-style-words.util.d.ts +31 -9
  184. package/dist/utility/wrun/wrun-style-words.util.js +46 -15
  185. package/dist/utility/wrun/wrun-trades-lane.util.js +2 -1
  186. package/dist/utility/wrun/wrun-trap-replay.util.d.ts +42 -0
  187. package/dist/utility/wrun/wrun-trap-replay.util.js +63 -0
  188. package/dist/utility/wrun/wrun-volume-profile.util.js +6 -5
  189. package/dist/utility/wrun-display-name.util.d.ts +10 -0
  190. package/dist/utility/wrun-display-name.util.js +21 -0
  191. package/dist/utils/replay/replay-buffer-math.d.ts +2 -0
  192. package/dist/utils/replay/replay-buffer-math.js +2 -0
  193. package/dist/workers/constants/socket-slots.d.ts +1 -1
  194. package/dist/workers/utils/time.worker.util.js +2 -2
  195. package/dist/workers/utils/volume-profile.worker.util.d.ts +9 -0
  196. package/dist/workers/utils/volume-profile.worker.util.js +20 -0
  197. package/dist/workers/wrun/wrun-abi-host.d.ts +3 -0
  198. package/dist/workers/wrun/wrun-abi-host.js +82 -5
  199. package/dist/workers/wrun/wrun-engine-handler.js +53 -4
  200. package/dist/workers/wrun/wrun-trap-frames.leaf.d.ts +28 -0
  201. package/dist/workers/wrun/wrun-trap-frames.leaf.js +108 -0
  202. package/package.json +11 -11
@@ -5,7 +5,7 @@ export declare const FEED_BAR_INTERVALS_S: readonly [60, 300, 900, 1800, 3600, 1
5
5
  export declare const FEED_POLL_FLOOR_S = 10;
6
6
  /** Bars of history a first read reaches back when the chart's candles have not landed yet. */
7
7
  export declare const FEED_DEFAULT_LOOKBACK_BARS = 1000;
8
- export type FeedPlot = 'line' | 'candles';
8
+ export type FeedPlot = 'line' | 'bars' | 'candles';
9
9
  export type FeedRequest = {
10
10
  kind: 'rows';
11
11
  } | {
@@ -22,6 +22,8 @@ export declare function feedPollPeriodMs(cadenceS: number): number;
22
22
  /**
23
23
  * The UTC bucket a timestamp falls in, seconds: the relay's regroup, `floor(ts / interval_s)`,
24
24
  * except that weeks start Monday 00:00 UTC as the relay's (and the chart's weekly candles) do.
25
+ * The relay owns this grid: `interval_s` is always one of `FEED_BAR_INTERVALS_S` (1w at most),
26
+ * so a typed day or week chart regroups on the relay's 1d or 1w and never on its own grid.
25
27
  */
26
28
  export declare function feedBucketStartSec(tsSec: number, intervalS: number): number;
27
29
  /** An exact-interval feed on a chart of another interval: it draws nothing there. */
@@ -36,7 +38,7 @@ export declare function chooseFeedPlan(cadenceS: number, chartIntervalMs: number
36
38
  export declare function feedCadenceHintApplies(cadenceS: number, chartIntervalMs: number, exactInterval?: boolean | null): boolean;
37
39
  /** A span of seconds as a chart interval label: `1m`, `15m`, `1h`, `4h`, `1d`, `1w`; whole seconds otherwise. */
38
40
  export declare function feedIntervalLabel(seconds: number): string;
39
- /** The chart interval a cadence switches to (a label the chart's interval list holds), or null. */
41
+ /** The chart interval a cadence switches to (a fixed rung with its wire interval: never a typed width), or null. */
40
42
  export declare function feedChartIntervalFor(cadenceS: number): string | null;
41
43
  /** The chart's own interval as a label (`1m`, `4h`, `1d`), from its milliseconds. */
42
44
  export declare function feedChartIntervalLabel(chartIntervalMs: number): string;
@@ -33,6 +33,7 @@
33
33
  * reading folds into a bar only for a value combining by `last`.
34
34
  */
35
35
  import { Intervals } from '../../constants/interval.constants.js';
36
+ import { lookupGrpcInterval } from './interval-registry.util.js';
36
37
  /** C2: the intervals the relay regroups bars on, ascending. */
37
38
  export const FEED_BAR_INTERVALS_S = [60, 300, 900, 1_800, 3_600, 14_400, 86_400, 604_800];
38
39
  /** C4 poll: never more often than this. */
@@ -76,6 +77,8 @@ const FIRST_MONDAY_S = 4 * 86_400;
76
77
  /**
77
78
  * The UTC bucket a timestamp falls in, seconds: the relay's regroup, `floor(ts / interval_s)`,
78
79
  * except that weeks start Monday 00:00 UTC as the relay's (and the chart's weekly candles) do.
80
+ * The relay owns this grid: `interval_s` is always one of `FEED_BAR_INTERVALS_S` (1w at most),
81
+ * so a typed day or week chart regroups on the relay's 1d or 1w and never on its own grid.
79
82
  */
80
83
  export function feedBucketStartSec(tsSec, intervalS) {
81
84
  if (intervalS > 0 && intervalS % WEEK_S === 0) {
@@ -113,13 +116,13 @@ export function feedIntervalLabel(seconds) {
113
116
  return `${span / 60}m`;
114
117
  return `${span}s`;
115
118
  }
116
- /** The chart interval a cadence switches to (a label the chart's interval list holds), or null. */
119
+ /** The chart interval a cadence switches to (a fixed rung with its wire interval: never a typed width), or null. */
117
120
  export function feedChartIntervalFor(cadenceS) {
118
121
  if (!(cadenceS > 0))
119
122
  return null;
120
123
  const label = feedIntervalLabel(cadenceS);
121
124
  const units = Intervals.map_unit;
122
- return units[label] === cadenceS * 1_000 ? label : null;
125
+ return units[label] === cadenceS * 1_000 && lookupGrpcInterval(label) !== undefined ? label : null;
123
126
  }
124
127
  /** The chart's own interval as a label (`1m`, `4h`, `1d`), from its milliseconds. */
125
128
  export function feedChartIntervalLabel(chartIntervalMs) {
@@ -101,10 +101,12 @@ export interface FetchDedupeIntent {
101
101
  isTapeSvpSeed?: boolean;
102
102
  /** The Footprint panel's own lane (footprint-panel-lane.service.ts): snapshot windows into the panel's store. */
103
103
  isFootprintPanel?: boolean;
104
+ /** The footprint pieces lane (footprint-row-pieces-lane.service.ts): piece reads into the engine's side table. */
105
+ isFootprintRowPieces?: boolean;
104
106
  /** A split-family child whose span IS the parent's registered pre-split span (the owner span). */
105
107
  isSplitFamilyOwnerChild?: boolean;
106
108
  }
107
- export type FetchDedupePolicyName = 'MAIN_COALESCE' | 'MAIN_POLL_BYPASS' | 'MAIN_HISTORICAL_BYPASS' | 'MAIN_RETRY_BYPASS' | 'IND_SKIP_DUPLICATE' | 'IND_REPAIR_REFRESH' | 'IND_LAZY_PAGE' | 'IND_POLL_BYPASS' | 'HEATMAP_CACHE_ONLY_BYPASS' | 'IND_RETRY_BYPASS' | 'IND_SPLIT_FAMILY_OWNER_CHILD' | 'IND_REPLAY_LANE_BYPASS' | 'IND_SEAM_TOPUP' | 'KSCRIPT_SOURCE_DEDUPE' | 'DOM_REPLAY_WINDOW' | 'TAPE_SVP_SEED' | 'FOOTPRINT_PANEL';
109
+ export type FetchDedupePolicyName = 'MAIN_COALESCE' | 'MAIN_POLL_BYPASS' | 'MAIN_HISTORICAL_BYPASS' | 'MAIN_RETRY_BYPASS' | 'IND_SKIP_DUPLICATE' | 'IND_REPAIR_REFRESH' | 'IND_LAZY_PAGE' | 'IND_POLL_BYPASS' | 'HEATMAP_CACHE_ONLY_BYPASS' | 'IND_RETRY_BYPASS' | 'IND_SPLIT_FAMILY_OWNER_CHILD' | 'IND_REPLAY_LANE_BYPASS' | 'IND_SEAM_TOPUP' | 'KSCRIPT_SOURCE_DEDUPE' | 'DOM_REPLAY_WINDOW' | 'TAPE_SVP_SEED' | 'FOOTPRINT_PANEL' | 'FOOTPRINT_ROW_PIECES';
108
110
  export interface FetchDedupePolicy {
109
111
  name: FetchDedupePolicyName;
110
112
  onPendingTwin: 'await' | 'skip' | 'ignore';
@@ -317,6 +317,21 @@ const POLICIES = {
317
317
  'laundered completion never records an empty; the known-empty and doomed-range guard classes never gate it ' +
318
318
  'because the lane owns emptiness itself.',
319
319
  },
320
+ FOOTPRINT_ROW_PIECES: {
321
+ name: 'FOOTPRINT_ROW_PIECES',
322
+ onPendingTwin: 'ignore',
323
+ onRecentCompletion: 'ignore',
324
+ registersPending: false,
325
+ onDeliveredAnswer: 'send',
326
+ why: 'Footprint pieces lane fetches (footprint-row-pieces-lane.service.ts, FOOTPRINT-ROW-SPLIT) run only the ' +
327
+ '"Split rows by" piece reads (a finer interval, or one read per listing) under a fresh synthetic ovId per ' +
328
+ "request and deliver side table entries into the engine's pieces table, never an overlay's rows, so like the " +
329
+ 'footprint panel lane they neither consult nor write the production ledger. Duplicate control is the lane: ' +
330
+ 'one read at a time per overlay, a queue of merged candle ranges (tail, visible, rest), a 20 s tail tick, and ' +
331
+ 'a generation that drops every answer for a superseded split, market, row setting or mount; idle with no ' +
332
+ 'split. Every request reads its transport outcome, so a laundered completion never commits an empty, and the ' +
333
+ 'known-empty and doomed-range guard classes never gate it because the lane owns its served range itself.',
334
+ },
320
335
  };
321
336
  /** Branch precedence mirrors the historical guard-site code order exactly. */
322
337
  export function resolveFetchDedupePolicy(intent) {
@@ -340,6 +355,8 @@ export function resolveFetchDedupePolicy(intent) {
340
355
  return POLICIES.TAPE_SVP_SEED;
341
356
  if (intent.isFootprintPanel)
342
357
  return POLICIES.FOOTPRINT_PANEL;
358
+ if (intent.isFootprintRowPieces)
359
+ return POLICIES.FOOTPRINT_ROW_PIECES;
343
360
  if (intent.isPolling)
344
361
  return POLICIES.IND_POLL_BYPASS;
345
362
  if (intent.heatmapCacheOnly)
@@ -439,7 +456,7 @@ export function isEngineQueueHoldEnabled(readExplicitlyOff) {
439
456
  * to: a hedge or blank-boot retry exists to escape a possibly wedged twin
440
457
  * (MAIN_RETRY_BYPASS, IND_RETRY_BYPASS), a historical-mode fetch replaces
441
458
  * the dataset under explicit identity stamps, and the replay, DOM-replay,
442
- * tape-seed, footprint-panel and cache-only lanes deliver through collectors
459
+ * tape-seed, footprint-panel, footprint-pieces and cache-only lanes deliver through collectors
443
460
  * that never paint the chart. Everything else (coalesce, polls, repair, split
444
461
  * children, the seam top-up, engine sources) may share one wire request
445
462
  * across panes.
@@ -453,6 +470,7 @@ const UNSHAREABLE_FETCH_DEDUPE_POLICIES = new Set([
453
470
  'DOM_REPLAY_WINDOW',
454
471
  'TAPE_SVP_SEED',
455
472
  'FOOTPRINT_PANEL',
473
+ 'FOOTPRINT_ROW_PIECES',
456
474
  ]);
457
475
  export function isShareableFetchDedupePolicy(policy) {
458
476
  const name = typeof policy === 'string' ? policy : policy.name;
@@ -24,6 +24,7 @@ type DisplayModeModel = {
24
24
  barWidth?: unknown;
25
25
  stickToLeft?: unknown;
26
26
  clusterCellMetric?: unknown;
27
+ rowSplit?: unknown;
27
28
  };
28
29
  /**
29
30
  * The display mode a form shows for a model, as the Volume Footprint dialog reads it: a cell-grid mode as it is, and the
@@ -35,6 +36,7 @@ export declare function footprintDisplayModeShown(model: DisplayModeModel): stri
35
36
  * The model on `displayMode`, as both footprint dialogs write a display mode pick: the legacy delta flag only for the
36
37
  * stacked delta mode, the bar width of the mode's family, the cells anchored left, and on a cell grid the cluster cell
37
38
  * metric's default (the columns layout is one of titan's cluster-grid family: its bid x ask column reads the metric).
39
+ * A mode other than Total sets a saved Split rows by (`rowSplit`) back to none, as web's dialogs do.
38
40
  */
39
41
  export declare function withFootprintDisplayMode<T extends DisplayModeModel>(model: T, displayMode: string): T;
40
42
  export {};
@@ -45,6 +45,7 @@ export function footprintDisplayModeShown(model) {
45
45
  * The model on `displayMode`, as both footprint dialogs write a display mode pick: the legacy delta flag only for the
46
46
  * stacked delta mode, the bar width of the mode's family, the cells anchored left, and on a cell grid the cluster cell
47
47
  * metric's default (the columns layout is one of titan's cluster-grid family: its bid x ask column reads the metric).
48
+ * A mode other than Total sets a saved Split rows by (`rowSplit`) back to none, as web's dialogs do.
48
49
  */
49
50
  export function withFootprintDisplayMode(model, displayMode) {
50
51
  const cellGrid = isClusterGridProfileDisplayMode(displayMode) || displayMode === FOOTPRINT_COLUMNS_DISPLAY_MODE;
@@ -58,5 +59,9 @@ export function withFootprintDisplayMode(model, displayMode) {
58
59
  };
59
60
  if (cellGrid && !next.clusterCellMetric)
60
61
  next.clusterCellMetric = 'delta';
62
+ // Split rows by draws under Total alone: any other mode sets a saved split back to none, so a workspace shared with
63
+ // web never holds a split under another mode. The row itself is web-only for now (footprint-rows.ts).
64
+ if (displayMode !== 'stacked-bar' && model.rowSplit !== undefined)
65
+ next.rowSplit = 'none';
61
66
  return next;
62
67
  }
@@ -0,0 +1,46 @@
1
+ /**
2
+ * The governed-lanes cutover switch as the venue policy reads it (kscript-venue-policy.util, the one decider of the
3
+ * governed walls). One runtime flag per licensed plane (`cme-lanes`, `opra-lanes`, `stocks-lanes`); while a plane's
4
+ * flag is lit, that plane opens to the server lanes too: the hosted (Cloud) runs, the protected scripts, strategy
5
+ * testing and every alert kind. While it is dark (the default), the plane reads exactly as it did before the cutover.
6
+ *
7
+ * Store-free on purpose, the shape of the `cme-user-scripts` gate leaf (cme-user-scripts-gate.util): the venue policy
8
+ * stays worker-safe, so the main thread hands it a reader instead. Its one import is the fallback reader's seat
9
+ * (governed-lanes-reader-seat, itself dependency-free), which the flags store fills with its override-aware `isOn`
10
+ * when it is evaluated, so the dev and internal `kiyo.flag-overrides` lens reaches the walls exactly as it reaches
11
+ * every surface reading `isOn`. A published reader (a spec's, or a host that hands one) answers over the seat's.
12
+ *
13
+ * Fail closed everywhere: no reader (a worker, a spec without a store), a reader that throws, a reader that answers
14
+ * anything but `true`, an unloaded or guest map (the store's `isOn` reads those false) and a plane this module does
15
+ * not name all read dark. The flags never open a lane on their own: each plane's own decision still holds (the CME
16
+ * plane keeps the `cme-user-scripts` gate: the flag, sign-in and the CME data terms).
17
+ */
18
+ /** A licensed plane the cutover opens to the server lanes. */
19
+ export type GovernedLanePlane = 'cme' | 'opra' | 'stocks';
20
+ /** Every governed lane plane, in the order the planes shipped. */
21
+ export declare const GOVERNED_LANE_PLANES: readonly GovernedLanePlane[];
22
+ /** Reads one plane's lanes flag: `true` only when that plane's cutover flag is lit. */
23
+ export type GovernedLanesFlagReader = (plane: GovernedLanePlane) => boolean;
24
+ /** A reader that answers over the fallback seat's (a spec's, or a host that hands one); null unpublishes. */
25
+ export declare function publishGovernedLanesFlags(next: GovernedLanesFlagReader | null): void;
26
+ /** Fill or empty the fallback reader's seat (the flags store fills it itself, by the seat's own module). */
27
+ export declare function setGovernedLanesFlagsFallback(next: GovernedLanesFlagReader | null): void;
28
+ /** The token a server-lane CME run captures before it asks (frozen: a holder cannot move it forward). */
29
+ export declare function captureCmeLanesFence(): {
30
+ fence: number;
31
+ };
32
+ /** Move the fence on: every server-lane CME run captured before is no longer current. Returns the new fence. */
33
+ export declare function bumpCmeLanesFence(): number;
34
+ /** The fence now (specs and the debug ring read it). */
35
+ export declare function cmeLanesFenceNow(): number;
36
+ /** Whether a captured fence token is current; a missing or malformed token is not. */
37
+ export declare function isCmeLanesFenceCurrent(token: {
38
+ fence: number;
39
+ } | null | undefined): boolean;
40
+ /** Whether a value names a governed lane plane. */
41
+ export declare function isGovernedLanePlane(plane: unknown): plane is GovernedLanePlane;
42
+ /**
43
+ * True only when the plane's cutover flag is lit. Fails closed: no reader published, flags not loaded, guest map, or
44
+ * an unknown plane all read false. Worker-safe.
45
+ */
46
+ export declare function governedLanesOpen(plane: GovernedLanePlane): boolean;
@@ -0,0 +1,71 @@
1
+ /**
2
+ * The governed-lanes cutover switch as the venue policy reads it (kscript-venue-policy.util, the one decider of the
3
+ * governed walls). One runtime flag per licensed plane (`cme-lanes`, `opra-lanes`, `stocks-lanes`); while a plane's
4
+ * flag is lit, that plane opens to the server lanes too: the hosted (Cloud) runs, the protected scripts, strategy
5
+ * testing and every alert kind. While it is dark (the default), the plane reads exactly as it did before the cutover.
6
+ *
7
+ * Store-free on purpose, the shape of the `cme-user-scripts` gate leaf (cme-user-scripts-gate.util): the venue policy
8
+ * stays worker-safe, so the main thread hands it a reader instead. Its one import is the fallback reader's seat
9
+ * (governed-lanes-reader-seat, itself dependency-free), which the flags store fills with its override-aware `isOn`
10
+ * when it is evaluated, so the dev and internal `kiyo.flag-overrides` lens reaches the walls exactly as it reaches
11
+ * every surface reading `isOn`. A published reader (a spec's, or a host that hands one) answers over the seat's.
12
+ *
13
+ * Fail closed everywhere: no reader (a worker, a spec without a store), a reader that throws, a reader that answers
14
+ * anything but `true`, an unloaded or guest map (the store's `isOn` reads those false) and a plane this module does
15
+ * not name all read dark. The flags never open a lane on their own: each plane's own decision still holds (the CME
16
+ * plane keeps the `cme-user-scripts` gate: the flag, sign-in and the CME data terms).
17
+ */
18
+ import { governedLanesFallbackSeat } from './governed-lanes-reader-seat.js';
19
+ /** Every governed lane plane, in the order the planes shipped. */
20
+ export const GOVERNED_LANE_PLANES = Object.freeze(['cme', 'opra', 'stocks']);
21
+ let published = null;
22
+ /** A reader that answers over the fallback seat's (a spec's, or a host that hands one); null unpublishes. */
23
+ export function publishGovernedLanesFlags(next) {
24
+ published = next;
25
+ }
26
+ /** Fill or empty the fallback reader's seat (the flags store fills it itself, by the seat's own module). */
27
+ export function setGovernedLanesFlagsFallback(next) {
28
+ governedLanesFallbackSeat.reader = next;
29
+ }
30
+ // ── The CME lanes fence (2026-11-11) ────────────────────────────────────────────────────────────────────────────────
31
+ //
32
+ // A server-lane user run reading CME (a Cloud record or a protected script on a CME chart, or whose effective sheet pins
33
+ // a CME market) captures this fence at its head; the `cme-lanes` flag going dark moves it (the CME user-study lifecycle,
34
+ // `bumpCmeLanesFence`). Apart from the CME authorisation epoch on purpose: a lanes move must drop an in-flight
35
+ // server-lane CME answer (even one no stamp shows yet) and never a browser run's, which the flag does not govern.
36
+ let cmeLanesFence = 0;
37
+ /** The token a server-lane CME run captures before it asks (frozen: a holder cannot move it forward). */
38
+ export function captureCmeLanesFence() {
39
+ return Object.freeze({ fence: cmeLanesFence });
40
+ }
41
+ /** Move the fence on: every server-lane CME run captured before is no longer current. Returns the new fence. */
42
+ export function bumpCmeLanesFence() {
43
+ cmeLanesFence += 1;
44
+ return cmeLanesFence;
45
+ }
46
+ /** The fence now (specs and the debug ring read it). */
47
+ export function cmeLanesFenceNow() {
48
+ return cmeLanesFence;
49
+ }
50
+ /** Whether a captured fence token is current; a missing or malformed token is not. */
51
+ export function isCmeLanesFenceCurrent(token) {
52
+ return typeof token?.fence === 'number' && token.fence === cmeLanesFence;
53
+ }
54
+ /** Whether a value names a governed lane plane. */
55
+ export function isGovernedLanePlane(plane) {
56
+ return plane === 'cme' || plane === 'opra' || plane === 'stocks';
57
+ }
58
+ /**
59
+ * True only when the plane's cutover flag is lit. Fails closed: no reader published, flags not loaded, guest map, or
60
+ * an unknown plane all read false. Worker-safe.
61
+ */
62
+ export function governedLanesOpen(plane) {
63
+ if (!isGovernedLanePlane(plane))
64
+ return false;
65
+ try {
66
+ return (published ?? governedLanesFallbackSeat.reader)?.(plane) === true;
67
+ }
68
+ catch {
69
+ return false;
70
+ }
71
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The seat of the governed-lanes fallback reader: governed-lanes-gate.util reads it and the flags store fills it. It
3
+ * is alone in its own module because the store ships in the boot entry, which has no bytes to spare
4
+ * (entry-size-guard): the store imports this seat, never the gate.
5
+ *
6
+ * The store fills it when it is evaluated, never later. A surface that read the gate before a reader sat here would
7
+ * have tracked nothing reactive, and would never see a lanes flag land.
8
+ *
9
+ * Dependency-free (zero imports), so the gate stays worker-safe: in a worker nothing fills the seat and every lane
10
+ * reads dark.
11
+ */
12
+ export declare const governedLanesFallbackSeat: {
13
+ reader: ((plane: 'cme' | 'opra' | 'stocks') => boolean) | null;
14
+ };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The seat of the governed-lanes fallback reader: governed-lanes-gate.util reads it and the flags store fills it. It
3
+ * is alone in its own module because the store ships in the boot entry, which has no bytes to spare
4
+ * (entry-size-guard): the store imports this seat, never the gate.
5
+ *
6
+ * The store fills it when it is evaluated, never later. A surface that read the gate before a reader sat here would
7
+ * have tracked nothing reactive, and would never see a lanes flag land.
8
+ *
9
+ * Dependency-free (zero imports), so the gate stays worker-safe: in a worker nothing fills the seat and every lane
10
+ * reads dark.
11
+ */
12
+ export const governedLanesFallbackSeat = {
13
+ reader: null,
14
+ };
@@ -33,9 +33,15 @@ export type HistoryWallKind = 'plan-wall' | 'data-start';
33
33
  * maps it with `grpcIntervalOf(interval)`
34
34
  * (workers/indicators/controls/ohlcv.worker.ts): the twelve native labels and
35
35
  * the custom ones go out as themselves ('3M' as QUARTER, '3m' as
36
- * THREE_MINUTES), and any other label ('5s' to '30s', '1mm') falls back to
36
+ * THREE_MINUTES), a typed width (4m to 3h, 2d to 20w) goes out as CUSTOM with
37
+ * its own bar length, which the gateway counts the wall in (its own bars), so
38
+ * it answers as itself; any other label ('5s' to '30s', '1mm') falls back to
37
39
  * AggregationInterval.MINUTE. The gateway measures the wall in that interval,
38
40
  * so the chart label would put the wall far too deep.
41
+ *
42
+ * A custom size the app builds asks its SOURCE instead (18m from 3m), which this store-free package cannot know: a
43
+ * web caller with a chart passes the app's `gatewayWallInterval(interval, chart)` (retention-validation.util) here,
44
+ * never the chart's label (tests/structure/history-wall-readers.spec.ts).
39
45
  */
40
46
  export declare function gatewayRequestIntervalFor(chartInterval: string): string;
41
47
  /** How far back the tier's gateway window reaches at this chart interval, in ms. */
@@ -52,9 +58,14 @@ export interface HistoryWallInput {
52
58
  sessionBound: boolean;
53
59
  /** The wire omits tradeless buckets (mayServeLegitimatelySparseHistory): the first trade can land after the wall. */
54
60
  sparseHistory: boolean;
61
+ /**
62
+ * A custom size the app builds from the interval asked: its bar length. The fold keeps whole bars only, so the
63
+ * oldest one opens up to one such bar past the wall. Absent for every chart the gateway answers at its own label.
64
+ */
65
+ foldedBarMs?: number;
55
66
  }
56
67
  /** `plan-wall` iff the edge sits at (or behind) the viewer's tier wall, within slack. */
57
- export declare function classifyHistoryWall({ edgeMs, requestIntervalMs, tierMaxBars, nowMs, sessionBound, sparseHistory, }: HistoryWallInput): HistoryWallKind;
68
+ export declare function classifyHistoryWall({ edgeMs, requestIntervalMs, tierMaxBars, nowMs, sessionBound, sparseHistory, foldedBarMs, }: HistoryWallInput): HistoryWallKind;
58
69
  export type HistoryReachUnit = 'hours' | 'days' | 'months' | 'years';
59
70
  /**
60
71
  * A reach in the words the plan copy uses: hours under a day, days under 60
@@ -21,6 +21,7 @@
21
21
  */
22
22
  import { Intervals } from '../../constants/interval.constants.js';
23
23
  import { lookupGrpcInterval } from './interval-registry.util.js';
24
+ import { isTypedWidth } from '../../constants/typed-width.leaf.js';
24
25
  import { gatewayTierMaxBars } from '../../constants/feature-limits.constants.js';
25
26
  const HOUR_MS = 3_600_000;
26
27
  const DAY_MS = 86_400_000;
@@ -51,12 +52,18 @@ const GAP_SLACK_MAX_REACH_SHARE = 0.25;
51
52
  * maps it with `grpcIntervalOf(interval)`
52
53
  * (workers/indicators/controls/ohlcv.worker.ts): the twelve native labels and
53
54
  * the custom ones go out as themselves ('3M' as QUARTER, '3m' as
54
- * THREE_MINUTES), and any other label ('5s' to '30s', '1mm') falls back to
55
+ * THREE_MINUTES), a typed width (4m to 3h, 2d to 20w) goes out as CUSTOM with
56
+ * its own bar length, which the gateway counts the wall in (its own bars), so
57
+ * it answers as itself; any other label ('5s' to '30s', '1mm') falls back to
55
58
  * AggregationInterval.MINUTE. The gateway measures the wall in that interval,
56
59
  * so the chart label would put the wall far too deep.
60
+ *
61
+ * A custom size the app builds asks its SOURCE instead (18m from 3m), which this store-free package cannot know: a
62
+ * web caller with a chart passes the app's `gatewayWallInterval(interval, chart)` (retention-validation.util) here,
63
+ * never the chart's label (tests/structure/history-wall-readers.spec.ts).
57
64
  */
58
65
  export function gatewayRequestIntervalFor(chartInterval) {
59
- return lookupGrpcInterval(chartInterval) !== undefined ? chartInterval : '1m';
66
+ return lookupGrpcInterval(chartInterval) !== undefined || isTypedWidth(chartInterval) ? chartInterval : '1m';
60
67
  }
61
68
  /** How far back the tier's gateway window reaches at this chart interval, in ms. */
62
69
  export function historyReachMs(tier, chartInterval) {
@@ -64,10 +71,10 @@ export function historyReachMs(tier, chartInterval) {
64
71
  return gatewayTierMaxBars(tier, requestInterval) * Intervals.map_unit[requestInterval];
65
72
  }
66
73
  /** `plan-wall` iff the edge sits at (or behind) the viewer's tier wall, within slack. */
67
- export function classifyHistoryWall({ edgeMs, requestIntervalMs, tierMaxBars, nowMs, sessionBound, sparseHistory, }) {
74
+ export function classifyHistoryWall({ edgeMs, requestIntervalMs, tierMaxBars, nowMs, sessionBound, sparseHistory, foldedBarMs = 0, }) {
68
75
  const reachMs = tierMaxBars * requestIntervalMs;
69
76
  const gapSlackMs = Math.min((sessionBound ? SESSION_GAP_SLACK_MS : 0) + (sparseHistory ? NO_TRADE_GAP_SLACK_MS : 0), reachMs * GAP_SLACK_MAX_REACH_SHARE);
70
- const slackMs = PLAN_WALL_SLACK_BARS * requestIntervalMs + PLAN_WALL_DRIFT_MS + gapSlackMs;
77
+ const slackMs = PLAN_WALL_SLACK_BARS * requestIntervalMs + foldedBarMs + PLAN_WALL_DRIFT_MS + gapSlackMs;
71
78
  return edgeMs <= nowMs - reachMs + slackMs ? 'plan-wall' : 'data-start';
72
79
  }
73
80
  /**
@@ -24,12 +24,15 @@
24
24
  * other lane at all; a quote-priced perpetual market (Variational, also period-fetched) serves its
25
25
  * quote candles, funding and open interest, and no trade, volume, book, profile or options lane; a
26
26
  * consolidated tape serves its trades alone (candles, sided volume, the profile, the size flow, the large
27
- * prints) and no book, open interest, liquidations, funding or options summary;
27
+ * prints) and no book, open interest, liquidations, funding or options summary; the index and yield venue
28
+ * (index-mode, price only) serves its value candles alone: the index-mode admission lets buy/sell volume
29
+ * through, and the venue prints no trade, volume or side behind its points;
28
30
  * - the coin table: the option-summary lanes (implied volatility, skew) hold a series for the
29
31
  * coins `WRUN_OPTION_SUMMARY_COINS` lists (BTC and ETH) and no other.
30
32
  * The dispatcher's own admission (`isKScriptTypeServedOnIndexMode`) stays as it is.
31
33
  */
32
34
  import { checkIsCryptoIndex } from './crypto-index.leaf.js';
35
+ import { checkIsIndexOtc } from './index-otc.leaf.js';
33
36
  import { checkIsQuotePerp } from './quote-perp.leaf.js';
34
37
  import { checkIsIndexMode } from './index-mode.util.js';
35
38
  import { checkIsForexOrCommodity, getMarketKind } from './marketKind.util.js';
@@ -61,6 +64,8 @@ const STOCK_TAPE_SERVED_TYPES = new Set([
61
64
  ]);
62
65
  /** The one lane fetch type a crypto index market serves (the market-kind table): its value candles. */
63
66
  const CRYPTO_INDEX_SERVED_TYPES = new Set(['ohlcv']);
67
+ /** The one lane fetch type the index and yield venue serves (the market-kind table): its value candles. */
68
+ const INDEX_OTC_SERVED_TYPES = new Set(['ohlcv']);
64
69
  /** The lane fetch types a quote-priced perpetual market serves (the market-kind table): its quote candles and the
65
70
  * two perpetual series the gateway serves beside them. */
66
71
  const QUOTE_PERP_SERVED_TYPES = new Set(['ohlcv', 'funding_rate', 'open_interest']);
@@ -95,6 +100,9 @@ export function wrunLaneServiceOnMarket({ type, exchange, coin, nativeRows, }) {
95
100
  if (!QUOTE_PERP_SERVED_TYPES.has(type) && checkIsQuotePerp(exchange)) {
96
101
  return { served: false, reason: 'market-kind' };
97
102
  }
103
+ if (!INDEX_OTC_SERVED_TYPES.has(type) && checkIsIndexOtc(exchange)) {
104
+ return { served: false, reason: 'market-kind' };
105
+ }
98
106
  if (!STOCK_TAPE_SERVED_TYPES.has(type) && isStocksTapeGoverned(exchange)) {
99
107
  return { served: false, reason: 'market-kind' };
100
108
  }
@@ -1,7 +1,7 @@
1
1
  export declare const POLYGON_EXCHANGES: readonly ["NYSE", "NASDAQ", "CBOE"];
2
2
  export declare const PREDICTION_MARKET_EXCHANGES: readonly ["POLYMARKET", "HYPERLIQUID_HIP4"];
3
3
  export declare const PYTH_EXCHANGES: never[];
4
- export declare const INDEX_VENUE_EXCHANGES: readonly ["POLYGON_INDICES"];
4
+ export declare const INDEX_VENUE_EXCHANGES: readonly ["INDICES_OTC"];
5
5
  export declare const TRADFI_EXCHANGES: readonly [...never[], "NYSE", "NASDAQ", "CBOE"];
6
6
  export declare const DEX_EXCHANGES: readonly ["UNISWAP_V2", "UNISWAP_V3", "UNISWAP_V4", "SUSHISWAP_V2", "SUSHISWAP_V3", "SHIBASWAP", "PANCAKESWAP_V2", "PANCAKESWAP_V3", "FRAXSWAP", "SOLIDLY", "SOLIDLY_V3"];
7
7
  export type PMSignalMarketType = 'crypto' | 'tradfi' | 'commodity';
@@ -52,7 +52,7 @@ export declare function checkIsEligiblePMSignalTicker(normalizedTicker: string):
52
52
  * CBOT/NYMEX/COMEX-vs-CME behavioral split (see marketKind.util.ts).
53
53
  */
54
54
  export declare function checkIsIndexMode(exchange: string | undefined): boolean;
55
- /** An index venue (`INDEX_VENUE_EXCHANGES`): a quote series on the US session grid. */
55
+ /** An index venue (`INDEX_VENUE_EXCHANGES`): quote series in many time zones, no US session grid. */
56
56
  export declare function checkIsIndexVenue(exchange: string | undefined): boolean;
57
57
  /**
58
58
  * Exchanges that print quotes instead of trades: value-only candles with no
@@ -1,6 +1,7 @@
1
1
  import { formatDisplayToExchange } from '../exchange-normalization.util.js';
2
2
  import { checkIsCryptoIndex } from './crypto-index.leaf.js';
3
3
  import { checkIsQuotePerp } from './quote-perp.leaf.js';
4
+ import { INDEX_OTC_EXCHANGES } from './index-otc.leaf.js';
4
5
  import { PREDICTION_MARKET_EXCHANGE_NAMES } from './prediction-identity.util.js';
5
6
  // ============================================================================
6
7
  // EXCHANGE CONSTANTS
@@ -21,11 +22,12 @@ export const PREDICTION_MARKET_EXCHANGES = [...PREDICTION_MARKET_EXCHANGE_NAMES]
21
22
  export const PYTH_EXCHANGES = []; //['PYTH_NETWORK'] as const;
22
23
  const FOREX_EXCHANGES = ['FX_OTC'];
23
24
  const COMMODITY_EXCHANGES = ['CBOT', 'ICE', 'NYMEX', 'LBMA', 'PLATTS', 'COMEX', 'LME'];
24
- // Index venues: Polygon's index series (SPX, NDX, VIX, DJI ...), quote series on the US session
25
- // grid served as TICKER_AGG candles (OHLC from the index values, volume 0), like forex. The
26
- // gateway holds them out of the directory today; the wrun pin policy names them unserved until
27
- // it lists them (wrun-pin-venues.util), and this is the venue set that policy reads.
28
- export const INDEX_VENUE_EXCHANGES = ['POLYGON_INDICES'];
25
+ // Index venues: the index and yield venue (index-otc.leaf owns the name), quote series for 22
26
+ // instruments (stock indices, the dollar and volatility indices, US Treasury yields) across many
27
+ // time zones, served as TICKER_AGG candles (OHLC from the quoted values, no volume) from 1m up,
28
+ // like forex. No US session grid applies: each instrument keeps its own market's hours. This set
29
+ // gives the venue index mode, the 1s block and the TICKER data type.
30
+ export const INDEX_VENUE_EXCHANGES = [...INDEX_OTC_EXCHANGES];
29
31
  export const TRADFI_EXCHANGES = [...PYTH_EXCHANGES, ...POLYGON_EXCHANGES];
30
32
  export const DEX_EXCHANGES = [
31
33
  'UNISWAP_V2',
@@ -314,7 +316,7 @@ export function checkIsIndexMode(exchange) {
314
316
  return true;
315
317
  return checkIsExchangeInSet(exchange, INDEX_MODE_EXCHANGES_SET);
316
318
  }
317
- /** An index venue (`INDEX_VENUE_EXCHANGES`): a quote series on the US session grid. */
319
+ /** An index venue (`INDEX_VENUE_EXCHANGES`): quote series in many time zones, no US session grid. */
318
320
  export function checkIsIndexVenue(exchange) {
319
321
  return checkIsExchangeInSet(exchange, INDEX_VENUE_EXCHANGES_SET);
320
322
  }
@@ -365,6 +367,10 @@ export function getMarketType(exchange) {
365
367
  return 'options';
366
368
  if (checkIsPolygon(actual))
367
369
  return 'equities';
370
+ // The index and yield venue (stock indices, the dollar index, VIX, Treasury yields): the bucket an index ETF
371
+ // reads, as the gateway files an index (ASSET_CLASS_INDEX) with stocks, never the crypto default.
372
+ if (INDEX_OTC_EXCHANGES.includes(actual.toUpperCase()))
373
+ return 'equities';
368
374
  if (checkIsForex(actual))
369
375
  return 'forex';
370
376
  // Kyle-approved flip (2026-07-28): governed venues file as 'futures' while
@@ -0,0 +1,37 @@
1
+ /**
2
+ * The index and yield venue: 22 licensed instruments (stock indices, the dollar index, a volatility index and four US
3
+ * Treasury yields) under one exchange. The backend prints each as raw TICKER points and serves its candles as
4
+ * TICKER_AGG (open/high/low/close, no volume), from 1m up; no trades, volume or book exist behind them. The backend
5
+ * owner fixed the name and the number (`INDICES_OTC`, 182, pb-common 12.86.0).
6
+ *
7
+ * A leaf on purpose, with no imports, like quote-perp.leaf: the market-kind table (`marketKind.util`) and the ticker
8
+ * hub (`index-mode.util`) both read it, and web code asks `checkIsIndexOtc` here, never through those two modules,
9
+ * which over a hundred specs mock with partial factories. The symbol set and the unit live here too: the icon
10
+ * resolver and the price text read them on the boot path, so a second leaf would join the boot closure anyway.
11
+ */
12
+ export declare const INDEX_OTC_EXCHANGES: readonly ["INDICES_OTC"];
13
+ /**
14
+ * The index and yield venue (`INDEX_OTC_EXCHANGES`), the `'marketIndex'` market kind. Case-insensitive like the kind
15
+ * table, and a foreign shape (a persisted object, a number) is no venue, never a throw.
16
+ */
17
+ export declare function checkIsIndexOtc(exchange: string | undefined | null): boolean;
18
+ /**
19
+ * The words of the refusal a read of the venue gets while its release flag is off for the session
20
+ * (workers/series/unreleased-venues builds it; the main fetch reads it to ask again once the flag is on).
21
+ */
22
+ export declare const INDEX_OTC_UNRELEASED_REFUSAL = "is not released for this session";
23
+ /**
24
+ * Our own names for the 22 instruments. The vendor's tickers and the index owners' names never reach the UI; display
25
+ * names come from the backend directory.
26
+ */
27
+ export declare const INDEX_OTC_SYMBOLS: readonly ["US500", "US100", "US30", "US2000", "UK100", "DE40", "EU50", "FR40", "IT40", "ES35", "NL30", "CH20", "JP225", "HK50", "AU200", "IN50", "DXY", "VIX", "US02Y", "US05Y", "US10Y", "US30Y"];
28
+ /** The US Treasury yields: their values are percent, every other instrument is points with no currency sign. */
29
+ export declare const INDEX_OTC_PERCENT_SYMBOLS: readonly ["US02Y", "US05Y", "US10Y", "US30Y"];
30
+ export type IndexOtcUnit = 'points' | 'percent';
31
+ /** One of our 22 instrument names (`INDEX_OTC_SYMBOLS`). Case-insensitive; a foreign shape is false. */
32
+ export declare function isIndexOtcSymbol(symbol: string | undefined | null): boolean;
33
+ /**
34
+ * The unit an instrument's value is in. Case-insensitive; anything that is not a yield reads `'points'`, so an
35
+ * unknown symbol never gains a percent sign.
36
+ */
37
+ export declare function indexOtcUnit(symbol: string | undefined | null): IndexOtcUnit;
@@ -0,0 +1,68 @@
1
+ /**
2
+ * The index and yield venue: 22 licensed instruments (stock indices, the dollar index, a volatility index and four US
3
+ * Treasury yields) under one exchange. The backend prints each as raw TICKER points and serves its candles as
4
+ * TICKER_AGG (open/high/low/close, no volume), from 1m up; no trades, volume or book exist behind them. The backend
5
+ * owner fixed the name and the number (`INDICES_OTC`, 182, pb-common 12.86.0).
6
+ *
7
+ * A leaf on purpose, with no imports, like quote-perp.leaf: the market-kind table (`marketKind.util`) and the ticker
8
+ * hub (`index-mode.util`) both read it, and web code asks `checkIsIndexOtc` here, never through those two modules,
9
+ * which over a hundred specs mock with partial factories. The symbol set and the unit live here too: the icon
10
+ * resolver and the price text read them on the boot path, so a second leaf would join the boot closure anyway.
11
+ */
12
+ export const INDEX_OTC_EXCHANGES = ['INDICES_OTC'];
13
+ const INDEX_OTC_EXCHANGES_SET = new Set(INDEX_OTC_EXCHANGES);
14
+ /**
15
+ * The index and yield venue (`INDEX_OTC_EXCHANGES`), the `'marketIndex'` market kind. Case-insensitive like the kind
16
+ * table, and a foreign shape (a persisted object, a number) is no venue, never a throw.
17
+ */
18
+ export function checkIsIndexOtc(exchange) {
19
+ return typeof exchange === 'string' && INDEX_OTC_EXCHANGES_SET.has(exchange.toUpperCase());
20
+ }
21
+ /**
22
+ * The words of the refusal a read of the venue gets while its release flag is off for the session
23
+ * (workers/series/unreleased-venues builds it; the main fetch reads it to ask again once the flag is on).
24
+ */
25
+ export const INDEX_OTC_UNRELEASED_REFUSAL = 'is not released for this session';
26
+ /**
27
+ * Our own names for the 22 instruments. The vendor's tickers and the index owners' names never reach the UI; display
28
+ * names come from the backend directory.
29
+ */
30
+ export const INDEX_OTC_SYMBOLS = [
31
+ 'US500',
32
+ 'US100',
33
+ 'US30',
34
+ 'US2000',
35
+ 'UK100',
36
+ 'DE40',
37
+ 'EU50',
38
+ 'FR40',
39
+ 'IT40',
40
+ 'ES35',
41
+ 'NL30',
42
+ 'CH20',
43
+ 'JP225',
44
+ 'HK50',
45
+ 'AU200',
46
+ 'IN50',
47
+ 'DXY',
48
+ 'VIX',
49
+ 'US02Y',
50
+ 'US05Y',
51
+ 'US10Y',
52
+ 'US30Y',
53
+ ];
54
+ /** The US Treasury yields: their values are percent, every other instrument is points with no currency sign. */
55
+ export const INDEX_OTC_PERCENT_SYMBOLS = ['US02Y', 'US05Y', 'US10Y', 'US30Y'];
56
+ const INDEX_OTC_SYMBOLS_SET = new Set(INDEX_OTC_SYMBOLS);
57
+ const INDEX_OTC_PERCENT_SYMBOLS_SET = new Set(INDEX_OTC_PERCENT_SYMBOLS);
58
+ /** One of our 22 instrument names (`INDEX_OTC_SYMBOLS`). Case-insensitive; a foreign shape is false. */
59
+ export function isIndexOtcSymbol(symbol) {
60
+ return typeof symbol === 'string' && INDEX_OTC_SYMBOLS_SET.has(symbol.toUpperCase());
61
+ }
62
+ /**
63
+ * The unit an instrument's value is in. Case-insensitive; anything that is not a yield reads `'points'`, so an
64
+ * unknown symbol never gains a percent sign.
65
+ */
66
+ export function indexOtcUnit(symbol) {
67
+ return typeof symbol === 'string' && INDEX_OTC_PERCENT_SYMBOLS_SET.has(symbol.toUpperCase()) ? 'percent' : 'points';
68
+ }
@@ -8,8 +8,10 @@ declare const EXTENDED_INTERVAL_LABELS: readonly ["5s", "15s", "30s", "6M"];
8
8
  export type ExtendedInterval = (typeof EXTENDED_INTERVAL_LABELS)[number];
9
9
  export declare const EXTENDED_INTERVALS: readonly ExtendedInterval[];
10
10
  export declare function isExtendedInterval(label: unknown): label is ExtendedInterval;
11
- /** Every label the resolver knows, in the wire map's order: the classic ladder, the presets, the extended rungs. */
11
+ /** Every label the resolver knows, in the wire map's order: the classic ladder, the presets, the extended rungs, the
12
+ * typed widths (wire CUSTOM plus their length, typed-width.leaf). */
12
13
  export declare const RESOLVED_INTERVAL_LABELS: readonly string[];
14
+ export declare const LENGTH_TABLE_INTERVAL_LABELS: readonly string[];
13
15
  export declare function intervalLabelForMs(ms: unknown): string | undefined;
14
16
  export declare function intervalMs(label: unknown): number | undefined;
15
17
  /**
@@ -17,7 +19,8 @@ export declare function intervalMs(label: unknown): number | undefined;
17
19
  * (profile rows, footprint bars, heatmap depth, restrictions...) list only
18
20
  * the classic ladder, so a preset or an extended rung takes the largest
19
21
  * classic label that is no longer than it (5s 15s 30s -> 1s, 3m -> 1m,
20
- * 10m -> 5m, 45m -> 30m, 6h -> 4h, 12h -> 4h, 3d -> 1d, 6M -> 3M). A classic
22
+ * 10m -> 5m, 45m -> 30m, 6h -> 4h, 12h -> 4h, 3d -> 1d, 6M -> 3M, typed 20m -> 15m, 3h -> 1h, 2d to 6d -> 1d,
23
+ * 8d and up and every week size -> 1w). A classic
21
24
  * or unknown label comes back unchanged. Never use this for a wire interval:
22
25
  * a chart must not be served another interval's bars.
23
26
  */