@orangecharts/wrun-chart-host 0.15.0 → 0.16.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 (175) hide show
  1. package/README.md +1 -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 +10 -0
  5. package/dist/constants/feature-flags.constants.js +52 -4
  6. package/dist/constants/feature-limits.constants.d.ts +72 -4
  7. package/dist/constants/feature-limits.constants.js +98 -20
  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/typed-width-fold.leaf.d.ts +50 -0
  12. package/dist/constants/typed-width-fold.leaf.js +99 -0
  13. package/dist/constants/typed-width-source.leaf.d.ts +24 -0
  14. package/dist/constants/typed-width-source.leaf.js +126 -0
  15. package/dist/constants/typed-width.leaf.d.ts +57 -0
  16. package/dist/constants/typed-width.leaf.js +78 -0
  17. package/dist/host-env.d.ts +10 -0
  18. package/dist/host-env.js +7 -0
  19. package/dist/host-ports.types.d.ts +11 -0
  20. package/dist/index.d.ts +3 -0
  21. package/dist/index.js +3 -0
  22. package/dist/interfaces/kscript-diagnostics.interface.d.ts +28 -0
  23. package/dist/interfaces/wrun-runtime.interface.d.ts +63 -3
  24. package/dist/interfaces/wrun-runtime.interface.js +11 -0
  25. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +13 -0
  26. package/dist/kscript-data/controls/live-trades-merge.util.js +16 -1
  27. package/dist/market-data/billing.interface.d.ts +12 -45
  28. package/dist/market-data/billing.interface.js +2 -2
  29. package/dist/replay/replayLadder.js +7 -4
  30. package/dist/settings-templates/footprint-rows.d.ts +6 -0
  31. package/dist/settings-templates/footprint-rows.js +6 -0
  32. package/dist/settings-templates/frvp-fields.js +14 -0
  33. package/dist/settings-templates/indicator-fields.js +31 -0
  34. package/dist/settings-templates/tool-tables.generated.js +19 -1
  35. package/dist/utility/chart/__fixtures__/live-bucket-regular-golden.json +1706 -0
  36. package/dist/utility/chart/cache-alignment.util.d.ts +42 -0
  37. package/dist/utility/chart/cache-alignment.util.js +88 -18
  38. package/dist/utility/chart/calendar-interval.util.d.ts +83 -1
  39. package/dist/utility/chart/calendar-interval.util.js +152 -4
  40. package/dist/utility/chart/candle-bar-end.util.d.ts +11 -4
  41. package/dist/utility/chart/candle-bar-end.util.js +17 -6
  42. package/dist/utility/chart/chart-time-domain.util.d.ts +3 -0
  43. package/dist/utility/chart/chart-time-domain.util.js +13 -4
  44. package/dist/utility/chart/feed-interval.util.d.ts +4 -2
  45. package/dist/utility/chart/feed-interval.util.js +5 -2
  46. package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +3 -1
  47. package/dist/utility/chart/fetch-dedupe-policy.util.js +19 -1
  48. package/dist/utility/chart/footprint-display-mode.util.d.ts +2 -0
  49. package/dist/utility/chart/footprint-display-mode.util.js +5 -0
  50. package/dist/utility/chart/governed-lanes-gate.util.d.ts +46 -0
  51. package/dist/utility/chart/governed-lanes-gate.util.js +71 -0
  52. package/dist/utility/chart/governed-lanes-reader-seat.d.ts +14 -0
  53. package/dist/utility/chart/governed-lanes-reader-seat.js +14 -0
  54. package/dist/utility/chart/history-wall.util.d.ts +13 -2
  55. package/dist/utility/chart/history-wall.util.js +11 -4
  56. package/dist/utility/chart/interval-ladder.util.d.ts +5 -2
  57. package/dist/utility/chart/interval-ladder.util.js +44 -4
  58. package/dist/utility/chart/interval-registry.util.d.ts +22 -1
  59. package/dist/utility/chart/interval-registry.util.js +50 -2
  60. package/dist/utility/chart/kscript-data-interval-restriction.leaf.d.ts +32 -4
  61. package/dist/utility/chart/kscript-data-interval-restriction.leaf.js +22 -5
  62. package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +10 -0
  63. package/dist/utility/chart/kscript-drawing-safe-area.util.js +30 -3
  64. package/dist/utility/chart/kscript-legend-entries.util.d.ts +21 -4
  65. package/dist/utility/chart/kscript-legend-entries.util.js +27 -5
  66. package/dist/utility/chart/kscript-main-grid-stages.util.js +74 -24
  67. package/dist/utility/chart/kscript-row-name.leaf.d.ts +13 -0
  68. package/dist/utility/chart/kscript-row-name.leaf.js +18 -0
  69. package/dist/utility/chart/kscript-venue-policy.util.d.ts +61 -26
  70. package/dist/utility/chart/kscript-venue-policy.util.js +138 -37
  71. package/dist/utility/chart/live-bucket.util.d.ts +29 -4
  72. package/dist/utility/chart/live-bucket.util.js +45 -12
  73. package/dist/utility/chart/market-session.util.d.ts +62 -10
  74. package/dist/utility/chart/market-session.util.js +93 -13
  75. package/dist/utility/chart/marketKind.util.d.ts +1 -7
  76. package/dist/utility/chart/marketKind.util.js +6 -8
  77. package/dist/utility/chart/mixed-mode.util.d.ts +17 -0
  78. package/dist/utility/chart/om-target.util.js +6 -4
  79. package/dist/utility/chart/price-precision.util.d.ts +20 -6
  80. package/dist/utility/chart/price-precision.util.js +34 -7
  81. package/dist/utility/chart/profile-frame-window.util.d.ts +15 -0
  82. package/dist/utility/chart/profile-frame-window.util.js +12 -0
  83. package/dist/utility/chart/rth-session.util.d.ts +3 -1
  84. package/dist/utility/chart/rth-session.util.js +3 -1
  85. package/dist/utility/chart/script-source-session.util.d.ts +43 -0
  86. package/dist/utility/chart/script-source-session.util.js +61 -0
  87. package/dist/utility/chart/typed-width-grid.util.d.ts +23 -0
  88. package/dist/utility/chart/typed-width-grid.util.js +203 -0
  89. package/dist/utility/common/transformations.util.d.ts +6 -0
  90. package/dist/utility/common/transformations.util.js +28 -4
  91. package/dist/utility/number-format.util.d.ts +14 -1
  92. package/dist/utility/number-format.util.js +22 -4
  93. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.d.ts +24 -1
  94. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +113 -0
  95. package/dist/utility/v2/v2-enums.leaf.js +3 -0
  96. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +9 -3
  97. package/dist/utility/wrun/wrun-batched-marks.util.js +65 -17
  98. package/dist/utility/wrun/wrun-canvases.util.d.ts +4 -2
  99. package/dist/utility/wrun/wrun-canvases.util.js +7 -12
  100. package/dist/utility/wrun/wrun-cap-notice.util.d.ts +5 -0
  101. package/dist/utility/wrun/wrun-cap-notice.util.js +23 -0
  102. package/dist/utility/wrun/wrun-card-style.util.d.ts +1 -1
  103. package/dist/utility/wrun/wrun-card-style.util.js +2 -2
  104. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +8 -0
  105. package/dist/utility/wrun/wrun-chart-market-facts.util.js +13 -1
  106. package/dist/utility/wrun/wrun-child-overlay-id.util.d.ts +10 -0
  107. package/dist/utility/wrun/wrun-child-overlay-id.util.js +24 -0
  108. package/dist/utility/wrun/wrun-cloud-cme-stamp.util.d.ts +72 -0
  109. package/dist/utility/wrun/wrun-cloud-cme-stamp.util.js +151 -0
  110. package/dist/utility/wrun/wrun-color-facts.util.d.ts +3 -3
  111. package/dist/utility/wrun/wrun-color-facts.util.js +8 -5
  112. package/dist/utility/wrun/wrun-colour-tone.lazy.d.ts +20 -0
  113. package/dist/utility/wrun/wrun-colour-tone.lazy.js +23 -0
  114. package/dist/utility/wrun/wrun-colour-tone.util.d.ts +14 -0
  115. package/dist/utility/wrun/wrun-colour-tone.util.js +119 -0
  116. package/dist/utility/wrun/wrun-dark-pool.util.d.ts +3 -2
  117. package/dist/utility/wrun/wrun-dark-pool.util.js +5 -4
  118. package/dist/utility/wrun/wrun-frames.d.ts +1 -1
  119. package/dist/utility/wrun/wrun-frames.js +2 -2
  120. package/dist/utility/wrun/wrun-handles.util.d.ts +1 -1
  121. package/dist/utility/wrun/wrun-handles.util.js +1 -1
  122. package/dist/utility/wrun/wrun-host.service.d.ts +32 -2
  123. package/dist/utility/wrun/wrun-host.service.js +44 -2
  124. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +20 -0
  125. package/dist/utility/wrun/wrun-hosted-wire-caps.js +85 -2
  126. package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +37 -0
  127. package/dist/utility/wrun/wrun-hosted-wire.util.js +54 -0
  128. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +1 -0
  129. package/dist/utility/wrun/wrun-hud-looks.util.js +6 -11
  130. package/dist/utility/wrun/wrun-integration-route.util.d.ts +24 -0
  131. package/dist/utility/wrun/wrun-integration-route.util.js +19 -0
  132. package/dist/utility/wrun/wrun-live-intake.util.js +17 -1
  133. package/dist/utility/wrun/wrun-live-patch.util.d.ts +6 -1
  134. package/dist/utility/wrun/wrun-live-patch.util.js +10 -4
  135. package/dist/utility/wrun/wrun-live-tick.util.js +59 -4
  136. package/dist/utility/wrun/wrun-overlay-drivers.util.js +3 -0
  137. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +15 -0
  138. package/dist/utility/wrun/wrun-overlay-run.util.js +274 -47
  139. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +1 -1
  140. package/dist/utility/wrun/wrun-panel-mount.util.js +42 -13
  141. package/dist/utility/wrun/wrun-pin-venues.util.js +5 -1
  142. package/dist/utility/wrun/wrun-refusal.util.d.ts +4 -0
  143. package/dist/utility/wrun/wrun-refusal.util.js +102 -13
  144. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +5 -3
  145. package/dist/utility/wrun/wrun-registry-errors.util.js +5 -3
  146. package/dist/utility/wrun/wrun-row-source-factory.js +17 -1
  147. package/dist/utility/wrun/wrun-row-source.d.ts +8 -1
  148. package/dist/utility/wrun/wrun-sandbox-row-source.d.ts +1 -1
  149. package/dist/utility/wrun/wrun-sandbox-row-source.js +9 -0
  150. package/dist/utility/wrun/wrun-setting-words.util.d.ts +12 -5
  151. package/dist/utility/wrun/wrun-setting-words.util.js +25 -8
  152. package/dist/utility/wrun/wrun-socket-row-source.d.ts +26 -1
  153. package/dist/utility/wrun/wrun-socket-row-source.js +125 -12
  154. package/dist/utility/wrun/wrun-source-rows.util.d.ts +3 -3
  155. package/dist/utility/wrun/wrun-source-rows.util.js +8 -7
  156. package/dist/utility/wrun/wrun-style-words.util.d.ts +31 -9
  157. package/dist/utility/wrun/wrun-style-words.util.js +46 -15
  158. package/dist/utility/wrun/wrun-trades-lane.util.js +2 -1
  159. package/dist/utility/wrun/wrun-trap-replay.util.d.ts +42 -0
  160. package/dist/utility/wrun/wrun-trap-replay.util.js +63 -0
  161. package/dist/utility/wrun/wrun-volume-profile.util.js +6 -5
  162. package/dist/utility/wrun-display-name.util.d.ts +10 -0
  163. package/dist/utility/wrun-display-name.util.js +21 -0
  164. package/dist/utils/replay/replay-buffer-math.d.ts +2 -0
  165. package/dist/utils/replay/replay-buffer-math.js +2 -0
  166. package/dist/workers/constants/socket-slots.d.ts +1 -1
  167. package/dist/workers/utils/time.worker.util.js +2 -2
  168. package/dist/workers/utils/volume-profile.worker.util.d.ts +9 -0
  169. package/dist/workers/utils/volume-profile.worker.util.js +20 -0
  170. package/dist/workers/wrun/wrun-abi-host.d.ts +3 -0
  171. package/dist/workers/wrun/wrun-abi-host.js +82 -5
  172. package/dist/workers/wrun/wrun-engine-handler.js +53 -4
  173. package/dist/workers/wrun/wrun-trap-frames.leaf.d.ts +28 -0
  174. package/dist/workers/wrun/wrun-trap-frames.leaf.js +108 -0
  175. package/package.json +11 -11
@@ -6,22 +6,30 @@
6
6
  * gate, `cme-user-scripts` (cme-user-scripts-gate.util): while it is open (the
7
7
  * flag lit AND the viewer entitled to CME data), a user run the browser
8
8
  * executes reads CME like a first-party one (`isCmeUserScriptRun`, ONE
9
- * decision for the display wall, the data wall and the engine policy), the
10
- * browser lane only: never a hosted (Cloud) run or a protected script, and
11
- * never read server-side (kscript-backend denies CME to every user run
12
- * whatever the gate says). The OPRA licence (US equity and index options) covers
9
+ * decision for the display wall, the data wall and the engine policy). While
10
+ * the `cme-lanes` flag is dark that is the browser lane only (never a hosted
11
+ * (Cloud) run or a protected script) and kscript-backend denies CME to every
12
+ * user run; the owner reversed that on 2026-11-11: lit, the server lanes are
13
+ * admitted too and judge a user run's CME reads on their own. The OPRA licence (US equity and index options) covers
13
14
  * user-authored scripting too, in the browser and on OpenMarket's servers
14
15
  * (Kyle 2026-10-27, the signed set), behind the `opra-user-scripts` flag:
15
16
  * while it is lit, a user run the browser executes reads OPRA like a
16
17
  * first-party one (`isOpraUserScriptRun`, the same three doors). The US stocks
17
18
  * tape is open to user-authored indicators too, in the browser and on the
18
- * cloud lane (Kyle 2026-10-29), on the tapes STOCKS_TAPE_SCRIPTING_VENUES
19
+ * cloud lane (Kyle 2026-10-29), and to protected scripts while `stocks-lanes`
20
+ * is lit (reversed 2026-11-11), on the tapes STOCKS_TAPE_SCRIPTING_VENUES
19
21
  * lists, the one compliance switch (`isStocksTapeReadableKScriptRun`): every
20
22
  * tape since Kyle 2026-11-06; a tape it leaves out would stay first-party
21
23
  * only. Each plane reads its own gate alone: no plane's decision
22
24
  * opens another. The data tier belongs to the viewer, never to the script: the
23
25
  * browser lane reads through the viewer's own gate sockets. This module is the
24
26
  * single decider for every plane.
27
+ * The governed-lanes cutover (governed-lanes-gate.util `governedLanesOpen`, one flag per plane: `cme-lanes`,
28
+ * `opra-lanes`, `stocks-lanes`) widens each plane's own decision to the server lanes: while a plane's flag is lit, a
29
+ * hosted (Cloud) run and a protected script qualify there like a browser run (CME still behind its whole gate, the
30
+ * flag, sign-in and the CME data terms); while it is dark (the default) every answer is the one above. One lane stays
31
+ * out whatever its flag says: OPRA's cloud lane, which reads the chain of a US stock or ETF chart alone
32
+ * (`isOpraCloudChainRun`) and has no path on an OPRA contract chart (Kyle 2026-11-14).
25
33
  * Every run door (add, mount, protected fetch, cache paint, alerts arm,
26
34
  * editor Run), the per-payload data guard in titan-charts dataFetch, and the
27
35
  * engine policy descriptor consult it; nothing else may re-derive provenance
@@ -30,11 +38,11 @@
30
38
  * Browser-safe AND worker-safe: zero Vue / store / i18n imports. The
31
39
  * store-reading overlay form lives in kscript-venue-policy.store.util.ts.
32
40
  */
33
- import { CME_GOVERNED_EXCHANGES } from '../../interfaces/cme-realtime.interface.js';
41
+ import { CME_BUNDLE_EXCHANGES, CME_GOVERNED_EXCHANGES } from '../../interfaces/cme-realtime.interface.js';
34
42
  import { OPRA_GOVERNED_EXCHANGES } from '../../interfaces/opra-realtime.interface.js';
35
43
  import { STOCKS_GOVERNED_EXCHANGES, STOCKS_TAPE_SCRIPTING_VENUES } from '../../interfaces/stocks-realtime.interface.js';
36
44
  import { isCmeFuturesPolicyActive } from './marketKind.util.js';
37
- import { isOpraGoverned, isStocksTapeGoverned, walledVenueOf } from '../v2/gate-plane.util.js';
45
+ import { gateProviderForExchange, isOpraGoverned, isStocksTapeGoverned, walledVenueOf } from '../v2/gate-plane.util.js';
38
46
  import { stocksTapeVenueLabel } from '../v2/stocks-governed.util.js';
39
47
  import { isConvertedScriptId } from '../../constants/scriptEditor/converted-script-id.leaf.js';
40
48
  import { isTempScriptId } from '../scriptEditor/temp-script-id.util.js';
@@ -49,6 +57,8 @@ import { wrunAppLayerOf } from '../wrun/wrun-app-layer.leaf.js';
49
57
  import { isOpraUserScriptsFlagOn } from './opra-user-scripts-gate.util.js';
50
58
  // Dependency-free too: the flag store and the web's CME entitlement hand their live readers to it.
51
59
  import { isCmeUserScriptsFlagOn, isCmeUserScriptsGateOpen } from './cme-user-scripts-gate.util.js';
60
+ // Dependency-free too: the flag store hands the governed-lanes cutover flags' live reader to it.
61
+ import { governedLanesOpen } from './governed-lanes-gate.util.js';
52
62
  // Leaf module (no imports): the row source a record runs on (a Cloud record rides the socket source).
53
63
  import { wrunRowSourceKindOf } from '../wrun/wrun-overlay-identity.util.js';
54
64
  // Near-leaf (the identity leaf only): the migration on read of a record persisted before lane parity wave 3. The
@@ -184,7 +194,9 @@ export function isFirstPartyKScriptRun(settings) {
184
194
  * Indicator draft the viewer wrote, a community document or package, anything unrecognized, run in this browser) or
185
195
  * the hosted Cloud lane's (`cloud`: the record on the socket row source, `wrunRowSourceKindOf`, read through the
186
196
  * migration on read, `wrunCloudRecordOf`, so the wave-3 record, `wrunRunTarget: 'cloud'` with no `wrunRef`, and a
187
- * record persisted before wave 3, `wrunRef`, alike). Undefined for a first-party run and for a protected script (the engine lane has no actor path). The record is
197
+ * record persisted before wave 3, `wrunRef`, alike), or kscript-backend's (`protected`: a protected script). Undefined
198
+ * for a first-party run alone. A plane admits `cloud` and `protected` only while its lanes flag is lit
199
+ * (`userRunLaneAdmitted`). The record is
188
200
  * read through that migration before the protected flag: a record persisted before wave 3 still carries the wave-2
189
201
  * hosted mount's keys (`isProtectedScript: true` beside `wrunRef`, wrun-cloud-row-compat.util) until its adoption, and
190
202
  * the migration takes the flag off, so it reads as the Cloud record it is, never a protected script. Both planes read
@@ -196,17 +208,44 @@ function userRunLane(settings) {
196
208
  return undefined;
197
209
  const record = wrunCloudRecordOf(settings) ?? settings;
198
210
  if (record.isProtectedScript === true)
199
- return undefined;
211
+ return 'protected';
200
212
  return wrunRowSourceKindOf(record) === 'socket' ? 'cloud' : 'browser';
201
213
  }
202
214
  /**
203
- * A user run the browser executes (`userRunLane` `browser`): neither a hosted Cloud run nor a protected script,
204
- * which run on a server lane that reads governed data through its own gate identity (UW-PARITY H3), so a browser flag
205
- * never opens a plane to them. The runs the `opra-user-scripts` flag opens the OPRA plane to (`isOpraUserScriptRun`);
215
+ * The server lane a user run reads a governed plane on: `cloud` (the hosted record) or `protected` (a protected
216
+ * script kscript-backend runs), else undefined (a browser user run, a first-party run, no settings). The lanes the
217
+ * governed-lanes cutover flags open and close; the lifecycle and the re-judgments read it to stop or wall exactly the
218
+ * studies a darkened lanes flag no longer admits, never a browser study.
219
+ */
220
+ export function userRunServerLaneOf(settings) {
221
+ const lane = userRunLane(settings);
222
+ return lane === 'cloud' || lane === 'protected' ? lane : undefined;
223
+ }
224
+ /**
225
+ * Whether a plane admits a user run's lane: the browser lane always (each plane's own flag or gate still decides), the
226
+ * server lanes (`cloud`, `protected`) only while the plane's governed-lanes cutover flag is lit (`governedLanesOpen`).
227
+ * The OPRA plane never admits the `cloud` lane here, lit or dark: the cloud reads the OPRA chain of a US stock or ETF
228
+ * chart alone (`isOpraCloudChainRun`, its own decision) and refuses every Cloud run on an OPRA contract chart
229
+ * (`wrun_opra_lane_refused`), so the plane decision keeps it walled before anything is sent (Kyle 2026-11-14).
230
+ * A first-party run has no user lane and is never admitted here (its planes read it as first party instead).
231
+ */
232
+ function userRunLaneAdmitted(settings, plane) {
233
+ const lane = userRunLane(settings);
234
+ if (lane === 'browser')
235
+ return true;
236
+ if (lane === 'cloud' && plane === 'opra')
237
+ return false;
238
+ return lane !== undefined && governedLanesOpen(plane);
239
+ }
240
+ /**
241
+ * A user run the browser executes (`userRunLane` `browser`): while the `opra-lanes` flag is dark, neither a hosted
242
+ * Cloud run nor a protected script, which run on a server lane that reads governed data through its own gate identity
243
+ * (UW-PARITY H3), so a browser flag never opens a plane to them; while it is lit, a protected script too, and never a
244
+ * hosted Cloud run, which has no path on an OPRA contract chart (`userRunLaneAdmitted`). The runs the `opra-user-scripts` flag opens the OPRA plane to (`isOpraUserScriptRun`);
206
245
  * read without the flag where a door must know a decision waits on it (the flag's hydration).
207
246
  */
208
247
  export function isOpraUserScriptCandidate(settings) {
209
- return userRunLane(settings) === 'browser';
248
+ return userRunLaneAdmitted(settings, 'opra');
210
249
  }
211
250
  /**
212
251
  * Whether a hosted (Cloud) user run's lane reads the OPRA chain of a US stock or ETF chart (contract
@@ -224,9 +263,10 @@ export const OPRA_CLOUD_CONTRACT_CHART_WALL_KEY = 'indicators.opra.cloudOnContra
224
263
  /**
225
264
  * The words every door that refuses a user run on an OPRA contract chart shows (the add toast, Door A; the chip, Door
226
265
  * H), picked by the run's lane and never by the flag: a hosted (Cloud) record has no path on a contract chart whatever
227
- * the `opra-user-scripts` flag says (its own sentence); a run the browser executes is refused there only while the
228
- * flag is dark, and a protected script always (the user-script sentence). It names words only: whether the door opens
229
- * is the walls' decision (`isKScriptDisplayBlockedOnExchange`, `isOpraReadableKScriptRun`).
266
+ * the `opra-user-scripts` and `opra-lanes` flags say (its own sentence, lit or dark); a run the browser executes is
267
+ * refused there only while the flag is dark, and a protected script while `opra-lanes` is dark (the user-script
268
+ * sentence). It names words only: whether the door opens is the walls' decision (`isKScriptDisplayBlockedOnExchange`,
269
+ * `isOpraReadableKScriptRun`).
230
270
  */
231
271
  export function opraContractChartWallKey(settings) {
232
272
  return userRunLane(settings) === 'cloud' ? OPRA_CLOUD_CONTRACT_CHART_WALL_KEY : OPRA_USER_SCRIPT_WALL_KEY;
@@ -240,9 +280,9 @@ export function opraContractChartWallKey(settings) {
240
280
  * licence covers user-authored scripting (Kyle 2026-10-27). The tier follows the viewer, never the run: the browser
241
281
  * lane reads through the viewer's own gate sockets (the gate's tier frame for the session picks the real-time or the
242
282
  * delayed socket), so the same script reads real-time rows for a paying viewer and delayed rows for every other one.
243
- * A hosted (Cloud) record and a protected script stay out of this decision: a Cloud run on an OPRA contract chart has
244
- * no server path yet (the cloud lane reads the chain of a US stock or ETF chart only), and a protected script has no
245
- * actor path on the engine lane. The flag is read first: while it is dark (the default) no record is read at all.
283
+ * A hosted (Cloud) record stays out of this decision whatever the `opra-lanes` flag says: a Cloud run on an OPRA
284
+ * contract chart has no server path (the cloud lane reads the chain of a US stock or ETF chart only). A protected
285
+ * script stays out while `opra-lanes` is dark. The flag is read first: while it is dark (the default) no record is read at all.
246
286
  */
247
287
  export function isOpraUserScriptRun(settings) {
248
288
  return isOpraUserScriptsFlagOn() && isOpraUserScriptCandidate(settings);
@@ -255,24 +295,29 @@ export function isOpraReadableKScriptRun(settings) {
255
295
  /**
256
296
  * Whether a run may read a US stocks tape open to user scripting (`STOCKS_TAPE_SCRIPTING_VENUES`): every first-party
257
297
  * run, a user run the browser executes and a hosted (Cloud) user run (`userRunLane`), the lanes Kyle opened on
258
- * 2026-10-29, like OPRA since its launch and on the cloud lane too. A protected script keeps its lane's rule: the
259
- * engine lane has no actor path, so a user's protected script stays refused as on every gate plane. The tier is the
260
- * gate's per socket (delayed 905 s for everyone today), never the script's, and no alert reads the tape whatever this
261
- * answers (opra-alert-door.util `stocks-closed`). A tape the list leaves out never reads this: it stays first-party
262
- * only.
298
+ * 2026-10-29, like OPRA since its launch and on the cloud lane too. While the `stocks-lanes` flag is dark a user's
299
+ * protected script stays refused, and no alert reads the tape whatever this answers (opra-alert-door.util
300
+ * `stocks-closed`); the owner reversed both on 2026-11-11: lit, a protected script reads the tape too. The tier is the
301
+ * gate's per socket (delayed 905 s for everyone today), never the script's. A tape the list leaves out never reads
302
+ * this: it stays first-party only.
263
303
  */
264
304
  export function isStocksTapeReadableKScriptRun(settings) {
265
- return isFirstPartyKScriptRun(settings) || userRunLane(settings) !== undefined;
305
+ if (isFirstPartyKScriptRun(settings))
306
+ return true;
307
+ const lane = userRunLane(settings);
308
+ // A protected script reads the tape only while the `stocks-lanes` cutover flag is lit.
309
+ return lane === 'browser' || lane === 'cloud' || (lane === 'protected' && governedLanesOpen('stocks'));
266
310
  }
267
311
  /**
268
312
  * A user run the browser executes (`userRunLane` `browser`, the OPRA plane's candidate too): the runs the
269
- * `cme-user-scripts` gate opens the CME plane to (`isCmeUserScriptRun`). A hosted (Cloud) record and a protected script
270
- * never qualify, whatever the gate says: CME chart studies run in the browser alone, and the server
271
- * lanes deny CME to every user run. Read without the gate where a door must know a decision waits on it (the flag's
272
- * hydration, the lifecycle that stops a running study).
313
+ * `cme-user-scripts` gate opens the CME plane to (`isCmeUserScriptRun`). While the `cme-lanes` cutover flag is dark, a
314
+ * hosted (Cloud) record and a protected script never qualify, whatever the gate says: CME chart studies run in the
315
+ * browser alone, and the server lanes deny CME to every user run. While it is lit, they qualify too
316
+ * (`userRunLaneAdmitted`), still behind the whole gate. Read without the gate where a door must know a decision waits
317
+ * on it (the flag's hydration, the lifecycle that stops a running study).
273
318
  */
274
319
  export function isCmeUserScriptCandidate(settings) {
275
- return userRunLane(settings) === 'browser';
320
+ return userRunLaneAdmitted(settings, 'cme');
276
321
  }
277
322
  /**
278
323
  * Whether the CME plane is open to this user run. The ONE decision every CME door reads, directly or through the walls
@@ -294,7 +339,10 @@ export function isCmeReadableKScriptRun(settings) {
294
339
  }
295
340
  /** A CME chart study: a user run the gate opened the CME plane to, on a CME chart (the run head's `cmeStudyChain`). */
296
341
  export function isCmeChartStudyRun(settings, chartExchange) {
297
- return payloadTouchesCmeVenue(chartExchange) && isCmeUserScriptRun(settings);
342
+ return (payloadTouchesCmeVenue(chartExchange) &&
343
+ isCmeUserScriptRun(settings) &&
344
+ // A server-lane run on a venue the cutover never opens (GLOBEX) is no study: the wall refuses it.
345
+ !(payloadTouches(chartExchange, isCmeLanesExcludedVenue) && userRunServerLaneOf(settings) !== undefined));
298
346
  }
299
347
  /** The words a door shows a user run the CME wall refuses (web locale keys, `cmeUserScriptWallKey`), and the
300
348
  * lifecycle's words for a study a closing gate stopped in place, its source kept (`CME_STUDY_STOPPED_KEY`: the
@@ -308,18 +356,20 @@ export const CME_STUDIES_OFF_KEY = 'indicators.cme.studiesOff';
308
356
  * The words every door that refuses a user run on CME shows (the add toast, Door A; the chip, Door H; the editor's
309
357
  * Run), picked by the run's lane like `opraContractChartWallKey`. While the flag is dark every lane reads today's words
310
358
  * (`CME_USER_SCRIPT_WALL_KEY`): the feature does not exist for that viewer, so no door names a browser lane it cannot
311
- * offer. Under a lit flag a hosted (Cloud) record or a protected script has no CME path (`CME_CLOUD_WALL_KEY`: CME chart
312
- * studies run in the browser), and a run the browser executes is refused only for the viewer's
313
- * entitlement (`CME_ENTITLEMENT_REQUIRED_KEY`: the CME data terms). A first-party run is never refused on CME and reads
359
+ * offer. Under a lit flag, while `cme-lanes` is dark, a hosted (Cloud) record or a protected script has no CME path
360
+ * (`CME_CLOUD_WALL_KEY`; reversed 2026-11-11: with `cme-lanes` lit it reads the terms words like a browser run), and a
361
+ * run the browser executes is refused only for the viewer's entitlement (`CME_ENTITLEMENT_REQUIRED_KEY`: the CME data terms). A first-party run is never refused on CME and reads
314
362
  * today's words. Words only: whether the door opens is the walls' decision
315
363
  * (`isKScriptDisplayBlockedOnExchange`, `isCmeReadableKScriptRun`).
316
364
  */
317
365
  export function cmeUserScriptWallKey(settings) {
318
366
  if (!isCmeUserScriptsFlagOn())
319
367
  return CME_USER_SCRIPT_WALL_KEY;
320
- const lane = userRunLane(settings);
321
- if (lane === 'browser')
368
+ // A candidate is refused for the viewer's entitlement alone: the browser lane, and under a lit `cme-lanes` flag the
369
+ // server lanes too.
370
+ if (isCmeUserScriptCandidate(settings))
322
371
  return CME_ENTITLEMENT_REQUIRED_KEY;
372
+ const lane = userRunLane(settings);
323
373
  return lane === 'cloud' || !isFirstPartyKScriptRun(settings) ? CME_CLOUD_WALL_KEY : CME_USER_SCRIPT_WALL_KEY;
324
374
  }
325
375
  /** `cmeUserScriptWallKey`'s lane rule in the pin row's words: derived from it, so the two never drift. */
@@ -333,7 +383,13 @@ export function cmePinRefusalVariant(settings) {
333
383
  export const STOCKS_USER_SCRIPT_WALL_KEY = 'indicators.stocks.userScriptNotSupported';
334
384
  /** The wall's words per plane (a `Record`: a plane without its own words is a type error); CME's lane rule stays CME's. */
335
385
  const VENUE_WALL_WORDS = {
336
- cme: (_exchange, settings) => ({ key: cmeUserScriptWallKey(settings), params: {} }),
386
+ // A server-lane run on a venue the cutover never opens (GLOBEX) reads the server lanes' words, never the terms'.
387
+ cme: (exchange, settings) => ({
388
+ key: isCmeUserScriptsFlagOn() && isCmeLanesExcludedVenue(exchange) && userRunServerLaneOf(settings) !== undefined
389
+ ? CME_CLOUD_WALL_KEY
390
+ : cmeUserScriptWallKey(settings),
391
+ params: {},
392
+ }),
337
393
  opra: (_exchange, settings) => ({ key: opraContractChartWallKey(settings), params: {} }),
338
394
  stocks: (exchange) => ({ key: STOCKS_USER_SCRIPT_WALL_KEY, params: { venue: stocksTapeVenueLabel(exchange) } }),
339
395
  };
@@ -389,6 +445,47 @@ export function payloadTouchesClosedStocksTapeVenue(exchange) {
389
445
  export function payloadTouchesGovernedVenue(exchange) {
390
446
  return (payloadTouchesCmeVenue(exchange) || payloadTouchesOpraVenue(exchange) || payloadTouchesStocksTapeVenue(exchange));
391
447
  }
448
+ // The governed plane one exchange code belongs to ('cme' | 'opra' | 'stocks', or null: a listing venue's plain code,
449
+ // NASDAQ, is none) is the gate plane's own answer, `gateProviderForExchange`, by the per-plane predicates the
450
+ // payloadTouches* helpers read. Re-exported here, never redefined, so the venue doors read it beside the decisions.
451
+ // Not gate-plane.util's `governedPlaneOf`: that one routes a whole request (every member on one plane) and answers the
452
+ // plane's descriptor.
453
+ export { gateProviderForExchange };
454
+ /** The CME-family codes the `cme-lanes` cutover opens: the purchasable DCMs alone (CME_BUNDLE_EXCHANGES). */
455
+ const CME_LANES_VENUES = new Set(CME_BUNDLE_EXCHANGES);
456
+ /**
457
+ * A CME-family code the `cme-lanes` cutover never opens (2026-11-11): the GLOBEX metadata alias. The server keeps it
458
+ * price-only and off every server lane, so whatever the flag says it reads as a dark plane here: the alert door admits a
459
+ * raw price alert alone, every server-lane answer stays closed, and a browser lane keeps today's answer.
460
+ */
461
+ function isCmeLanesExcludedVenue(code) {
462
+ return gateProviderForExchange(code) === 'cme' && !CME_LANES_VENUES.has(code.toUpperCase());
463
+ }
464
+ /**
465
+ * True iff the payload touches at least one governed plane whose lanes flag is dark (`governedLanesOpen`), or a CME
466
+ * venue the cutover never opens (GLOBEX, `isCmeLanesExcludedVenue`). The same argument shape and BLOCKING semantics as
467
+ * the payloadTouches* helpers (a string, or the array form with .some()): any closed plane blocks. Ungoverned exchanges
468
+ * read false.
469
+ */
470
+ export function governedLanesClosedOn(exchange) {
471
+ return payloadTouches(exchange, (code) => {
472
+ const plane = gateProviderForExchange(code);
473
+ return plane !== null && (!governedLanesOpen(plane) || isCmeLanesExcludedVenue(code));
474
+ });
475
+ }
476
+ /**
477
+ * Whether the CME plane's server lanes are open (`cme-lanes` lit, on the venues it opens): the decider's answer for a
478
+ * door that asks about a CME read off a CME chart (a sheet's CME pin), never the raw switch.
479
+ */
480
+ export function cmeServerLanesOpen() {
481
+ return !governedLanesClosedOn('CME');
482
+ }
483
+ /** True iff the exchange is CME-governed and the 'cme' lanes flag is dark (or the venue is one the cutover never
484
+ * opens, GLOBEX). This is the whole strategy rule on CME after this program. */
485
+ export function isCmeStrategyClosed(exchange) {
486
+ return (gateProviderForExchange(exchange) === 'cme' &&
487
+ (!governedLanesOpen('cme') || isCmeLanesExcludedVenue(String(exchange))));
488
+ }
392
489
  /**
393
490
  * DATA-wall door predicate: user-authored run targeting a governed venue.
394
491
  * Still the right check for the data-plane guards (the data-fetching funnel,
@@ -408,6 +505,10 @@ export function payloadTouchesGovernedVenue(exchange) {
408
505
  export function isUserKScriptBlockedOnExchange(exchange, settings) {
409
506
  if (payloadTouchesCmeVenue(exchange) && !isCmeReadableKScriptRun(settings))
410
507
  return true;
508
+ // A CME venue the `cme-lanes` cutover never opens (GLOBEX, 2026-11-11) stays closed to every server-lane user run
509
+ // whatever the flag says; a browser run keeps today's answer above.
510
+ if (payloadTouches(exchange, isCmeLanesExcludedVenue) && userRunServerLaneOf(settings) !== undefined)
511
+ return true;
411
512
  // The US stocks tape (Kyle 2026-10-29): user-authored indicators read the tapes STOCKS_TAPE_SCRIPTING_VENUES lists,
412
513
  // in the browser and on the cloud lane (every tape since Kyle 2026-11-06); a tape it leaves out would stay
413
514
  // first-party only. A mixed payload is judged per leg (.some): one closed tape refuses it.
@@ -25,7 +25,12 @@
25
25
  * 5. a session-lattice venue on its own lattice (session-lattice.util: the CME
26
26
  * family from 2m to 12h, 1d, 3d; forex from 4h up), the profile the
27
27
  * gateway rolls that venue up on;
28
- * 6. everything else: the UTC floor.
28
+ * 6. everything else: the UTC floor (for a typed day or week length, the
29
+ * fixed grid from Monday 2000-01-03: calendar-interval.util).
30
+ * A custom width under a day (typed-width.leaf) is never bucket exact: on a CME regular-hours chart it rides 3, on a
31
+ * regular-session stock 4, on CME full session, forex, an extended-hours stock and a US option the lazy session grid
32
+ * through `typedSessionGrid` (null while the slot is empty), and everywhere else 6. A walk over the length table sets
33
+ * `lengthRow` on the venue and reads such a width as any other length (the session feed's reach).
29
34
  * Null means the frame has no bucket (off-session under 3 or 4): the chart
30
35
  * holds no bar there, so drop it. At 30m and finer the session grids share
31
36
  * the UTC floor's lattice, never its bars: a regular-session chart holds none
@@ -38,6 +43,12 @@ export interface LiveBucketVenue {
38
43
  sessionType?: unknown;
39
44
  /** A formula chart's expression: its legs, not `exchange`, decide the lattice. */
40
45
  transformations?: unknown;
46
+ /**
47
+ * Set by a walk over the length table (the session feed's reach, session-fill-window), never by a chart: the width
48
+ * is read as a row of that table, not as a custom size. 4m and 3h are rows no session chart could sit on before
49
+ * custom sizes, and the walk keeps the answers it had there, so no other interval's reach moves.
50
+ */
51
+ lengthRow?: boolean;
41
52
  }
42
53
  /**
43
54
  * A chart's bar-grid identity as a worker reads it (plain, cloneable fields only): the venue a worker
@@ -49,6 +60,16 @@ export declare function liveBucketVenueOf(metadata: {
49
60
  sessionType?: unknown;
50
61
  transformations?: unknown;
51
62
  } | null | undefined): LiveBucketVenue;
63
+ /**
64
+ * The session grid of a custom size (typed-width-grid.util `typedBarStartMs`), set once per realm by the lazy file
65
+ * that builds such a chart's candles (the page: typed-fold-ask.util; the data worker: its fold kit). Empty until
66
+ * then, and a grid that asks it answers null: the frame has no bucket, never another grid's.
67
+ */
68
+ export declare const typedSessionGrid: {
69
+ startMs?: (tsMs: number, widthMs: number, venue: LiveBucketVenue) => number | null;
70
+ };
71
+ /** Whether the live bucket at `intervalMs` depends on the venue, so a writer must pass it (a custom width always does). */
72
+ export declare function liveBucketReadsVenue(intervalMs: number): boolean;
52
73
  /**
53
74
  * The session lattice the series' history rides (session-lattice.util, the
54
75
  * profile the gateway rolls its venue up on): its formula's timeline legs,
@@ -88,9 +109,13 @@ export declare function liveBucketStartMs(tsMs: number, intervalMs: number, venu
88
109
  */
89
110
  export declare function liveBucketBarsAreLabels(intervalMs: number, venue?: LiveBucketVenue | null): boolean;
90
111
  /**
91
- * Whether the venue's bars at `intervalMs` open on the UTC interval lattice (the UTC floor, `findMonday`, a session's 30m
92
- * and finer floor). False on a session lattice, where bars follow the trading calendar: anchored at the session's open
93
- * (a stock or a chart-RTH product from 45m to 12h, a session-lattice venue) or labels (`liveBucketBarsAreLabels`).
112
+ * Whether the venue's bars at `intervalMs` open on one fixed lattice of the interval, every bar one length after the
113
+ * last with one phase: the UTC floor, `findMonday`, a session's 30m and finer floor, and a typed day or week length's
114
+ * grid from Monday 2000-01-03 (`fixedGridFloorMs`), which is fixed but not epoch-aligned. Its one reader
115
+ * (wrun-source-rows `wrunChartRowsOffIntervalGrid`) counts phases of the interval, which a fixed lattice of any
116
+ * origin passes with one. False on a session lattice, where bars follow the trading calendar: anchored at the
117
+ * session's open (a stock or a chart-RTH product from 45m to 12h, a session-lattice venue) or labels
118
+ * (`liveBucketBarsAreLabels`).
94
119
  */
95
120
  export declare function liveBucketBarsOnUtcLattice(intervalMs: number, venue?: LiveBucketVenue | null): boolean;
96
121
  /**
@@ -25,7 +25,12 @@
25
25
  * 5. a session-lattice venue on its own lattice (session-lattice.util: the CME
26
26
  * family from 2m to 12h, 1d, 3d; forex from 4h up), the profile the
27
27
  * gateway rolls that venue up on;
28
- * 6. everything else: the UTC floor.
28
+ * 6. everything else: the UTC floor (for a typed day or week length, the
29
+ * fixed grid from Monday 2000-01-03: calendar-interval.util).
30
+ * A custom width under a day (typed-width.leaf) is never bucket exact: on a CME regular-hours chart it rides 3, on a
31
+ * regular-session stock 4, on CME full session, forex, an extended-hours stock and a US option the lazy session grid
32
+ * through `typedSessionGrid` (null while the slot is empty), and everywhere else 6. A walk over the length table sets
33
+ * `lengthRow` on the venue and reads such a width as any other length (the session feed's reach).
29
34
  * Null means the frame has no bucket (off-session under 3 or 4): the chart
30
35
  * holds no bar there, so drop it. At 30m and finer the session grids share
31
36
  * the UTC floor's lattice, never its bars: a regular-session chart holds none
@@ -34,9 +39,9 @@
34
39
  import { findMonday, TimeIntervalConstant } from './titan-constants.pin.js';
35
40
  import { CME_SESSION_LATTICE, isSessionLatticeIntervalMs, sessionLatticeBarEndMs, sessionLatticeBarOpenMs, sessionLatticeBucketMs, sessionLatticeOf, } from './session-lattice.util.js';
36
41
  import { Intervals } from '../../constants/interval.constants.js';
37
- import { calendarBarStartMs, calendarMonthsOfMs } from './calendar-interval.util.js';
42
+ import { calendarBarStartMs, calendarMonthsOfMs, fixedGridFloorMs } from './calendar-interval.util.js';
38
43
  import { formulaCalendarPlan, formulaLegExchange } from './formula-calendar.util.js';
39
- import { checkIsEconomic } from './marketKind.util.js';
44
+ import { checkIsEconomic, checkIsPolygon, getMarketKind } from './marketKind.util.js';
40
45
  import { extractTokensFromTransformations, parsedTransformations } from '../common/transformations.util.js';
41
46
  import { isGovernedFuturesSymbolOpenAt } from './market-session-schedule.util.js';
42
47
  import { chartRegularSessionKind, isWithinMarketRegularWindow, marketAnchoredBucketStartMs, } from './market-session.util.js';
@@ -57,6 +62,22 @@ export function liveBucketVenueOf(metadata) {
57
62
  ...(typeof metadata?.transformations === 'string' && { transformations: metadata.transformations }),
58
63
  };
59
64
  }
65
+ /**
66
+ * The session grid of a custom size (typed-width-grid.util `typedBarStartMs`), set once per realm by the lazy file
67
+ * that builds such a chart's candles (the page: typed-fold-ask.util; the data worker: its fold kit). Empty until
68
+ * then, and a grid that asks it answers null: the frame has no bucket, never another grid's.
69
+ */
70
+ export const typedSessionGrid = {};
71
+ /**
72
+ * The twelve custom widths under a day, in ms: typed-width.leaf's labels under a day, written out in minutes because
73
+ * importing the leaf here costs boot bytes (the pre-candle budget). Never a bucket-exact width on a session grid.
74
+ * tests/utility/chart/live-bucket.util.typed-session.spec.ts fails when this list and the leaf differ.
75
+ */
76
+ const TYPED_INTRADAY_MS = new Set([4, 6, 8, 9, 12, 16, 18, 20, 40, 80, 90, 180].map((minutes) => minutes * 60_000));
77
+ /** Whether the live bucket at `intervalMs` depends on the venue, so a writer must pass it (a custom width always does). */
78
+ export function liveBucketReadsVenue(intervalMs) {
79
+ return !isRthBucketExactIntervalMs(intervalMs) || TYPED_INTRADAY_MS.has(intervalMs);
80
+ }
60
81
  /** A formula's lattice: a profile, null for a formula off every lattice, undefined for a plain expression. */
61
82
  const formulaLatticeByExpression = new Map();
62
83
  const FORMULA_CACHE_MAX = 256;
@@ -115,7 +136,7 @@ export function plainBucketStartMs(tsMs, intervalMs) {
115
136
  const months = calendarMonthsOfMs(intervalMs);
116
137
  if (months !== null)
117
138
  return calendarBarStartMs(tsMs, months);
118
- return intervalMs === TimeIntervalConstant.week ? findMonday(tsMs) : tsMs - (tsMs % intervalMs);
139
+ return intervalMs === TimeIntervalConstant.week ? findMonday(tsMs) : fixedGridFloorMs(tsMs, intervalMs);
119
140
  }
120
141
  /** The venue's lattice at an interval the gateway rolls it up on, else null. */
121
142
  function venueLatticeAt(intervalMs, venue) {
@@ -161,8 +182,9 @@ function liveBucketGrid(intervalMs, venue) {
161
182
  return 'utc-floor';
162
183
  // The 30m bucket-exact widths share the UTC floor's lattice, not its bars: a session-gated chart holds a
163
184
  // bar there only inside its session, so the grid asks the session every time (a lattice that coincides is
164
- // no off-session drop).
165
- const exact = isRthBucketExactIntervalMs(intervalMs);
185
+ // no off-session drop). A custom width under a day counts from the session open instead, so it is never exact.
186
+ const typed = !venue.lengthRow && TYPED_INTRADAY_MS.has(intervalMs);
187
+ const exact = !typed && isRthBucketExactIntervalMs(intervalMs);
166
188
  // The equities grids below also serve a stock's daily-and-longer bars, which the intraday chart kind never names.
167
189
  if (chartRegularSessionKind(venue.exchange, venue.symbol, venue.sessionType, intervalMs) === 'cme') {
168
190
  return exact ? 'rth-floor' : 'rth-anchored';
@@ -170,17 +192,22 @@ function liveBucketGrid(intervalMs, venue) {
170
192
  if (isEquityRegularSessionGated(venue.exchange, venue.sessionType, intervalMs)) {
171
193
  if (exact)
172
194
  return 'equity-floor';
173
- if (isFootprintRthFoldTfMs(intervalMs))
195
+ if (typed || isFootprintRthFoldTfMs(intervalMs))
174
196
  return 'equity-anchored';
175
197
  if (intervalMs === THREE_DAYS_MS)
176
198
  return 'equity-session-group';
177
199
  }
200
+ // A custom width on the other session markets the app builds it on (typed-width-grid.util `typedGridKind`: CME full
201
+ // session, forex, a stock with extended hours on, a US option) rides the lazy grid through the slot.
202
+ const ex = venue.exchange;
203
+ if (typed && (sessionLatticeOf(ex) || checkIsPolygon(ex) || getMarketKind(ex) === 'options'))
204
+ return 'typed-session';
178
205
  if (!exact && venueLatticeAt(intervalMs, venue) !== null)
179
206
  return 'session-lattice';
180
207
  return 'utc-floor';
181
208
  }
182
- /** The UTC floor of `tsMs`, the 30m bucket-exact grids' lattice. */
183
- const utcFloorMs = (tsMs, intervalMs) => tsMs - (tsMs % intervalMs);
209
+ /** The UTC floor of `tsMs`, the 30m bucket-exact grids' lattice; a typed day or week length's anchored floor. */
210
+ const utcFloorMs = (tsMs, intervalMs) => fixedGridFloorMs(tsMs, intervalMs);
184
211
  /** A chart-RTH bucket starting at `startMs` exists only while the product trades by its schedule (an RTH window
185
212
  * is a wall-clock filter with bounds on every calendar day; ES holds no Saturday bar, an always-on root does). */
186
213
  function rthBucketOrNull(symbol, startMs) {
@@ -212,6 +239,8 @@ function bucketStartOnGrid(grid, tsMs, intervalMs, venue) {
212
239
  }
213
240
  case 'equity-session-group':
214
241
  return usEquitySessionGridBucketStartMs(tsMs);
242
+ case 'typed-session':
243
+ return typedSessionGrid.startMs?.(tsMs, intervalMs, venue) ?? null;
215
244
  default:
216
245
  return utcFloorMs(tsMs, intervalMs);
217
246
  }
@@ -231,9 +260,13 @@ export function liveBucketBarsAreLabels(intervalMs, venue) {
231
260
  return grid === 'equity-session-group' || (grid === 'session-lattice' && intervalMs >= ONE_DAY_MS);
232
261
  }
233
262
  /**
234
- * Whether the venue's bars at `intervalMs` open on the UTC interval lattice (the UTC floor, `findMonday`, a session's 30m
235
- * and finer floor). False on a session lattice, where bars follow the trading calendar: anchored at the session's open
236
- * (a stock or a chart-RTH product from 45m to 12h, a session-lattice venue) or labels (`liveBucketBarsAreLabels`).
263
+ * Whether the venue's bars at `intervalMs` open on one fixed lattice of the interval, every bar one length after the
264
+ * last with one phase: the UTC floor, `findMonday`, a session's 30m and finer floor, and a typed day or week length's
265
+ * grid from Monday 2000-01-03 (`fixedGridFloorMs`), which is fixed but not epoch-aligned. Its one reader
266
+ * (wrun-source-rows `wrunChartRowsOffIntervalGrid`) counts phases of the interval, which a fixed lattice of any
267
+ * origin passes with one. False on a session lattice, where bars follow the trading calendar: anchored at the
268
+ * session's open (a stock or a chart-RTH product from 45m to 12h, a session-lattice venue) or labels
269
+ * (`liveBucketBarsAreLabels`).
237
270
  */
238
271
  export function liveBucketBarsOnUtcLattice(intervalMs, venue) {
239
272
  const grid = liveBucketGrid(intervalMs, venue);
@@ -27,6 +27,54 @@
27
27
  */
28
28
  import { type RthWindow, type SessionDayWindow } from './rth-session.util.js';
29
29
  export type MarketSessionKind = 'cme' | 'us-equity';
30
+ /**
31
+ * The day-and-longer widths whose US stock tape order flow (VOLUME_PROFILE_AGG) the gateway serves under the regular
32
+ * session, by label: its tradfi profile family reads DAY, WEEK and the calendar widths per trading session, and refuses
33
+ * THREE_DAYS (tsdb-gateway volume_profile_tradfi.go `tradfiVPProfile`). Every day-plus label the app offers has a row
34
+ * (tests/utility/chart/order-flow-session.interval-rule.spec.ts).
35
+ */
36
+ export declare const US_EQUITY_DAY_PLUS_REGULAR_ORDER_FLOW: Readonly<Record<string, boolean>>;
37
+ /** Whether a US stock's order flow can be read under the regular session at `tfMs` (milliseconds): every intraday width, and the day-plus rows the gateway serves. */
38
+ export declare function isUsEquityRegularOrderFlowIntervalMs(tfMs: unknown): boolean;
39
+ /** A day or longer bar starts at midnight, outside every session, so its key cannot judge a trade: a session filter there reads each trade's own instant. */
40
+ export declare function sessionFilterJudgesTradeInstant(tfMs: unknown): boolean;
41
+ /** The fields of an order-flow read that pick the gateway reader: its market and its unit (`currency`, 'USD' or coins). */
42
+ export interface OrderFlowReadLike {
43
+ exchange?: unknown;
44
+ symbol?: unknown;
45
+ currency?: unknown;
46
+ }
47
+ /**
48
+ * Whether the gateway reads this stock order flow per trading session at `tfMs` (a day-plus chart width or span rung),
49
+ * so a REGULAR read keeps its midnight-stamped rows. tsdb-gateway `tradfiVPProfile` serves only a stock tape
50
+ * (kiyotaka-go venue `ProfileFor`), at DAY, WEEK and the calendar widths (`US_EQUITY_DAY_PLUS_REGULAR_ORDER_FLOW`), and
51
+ * excludes a USD-normalized read, a coin sum and a custom time range; no session-active VP read sends the last two.
52
+ * Anywhere else the fallback keeps a REGULAR bucket by its start, so every day row would be dropped.
53
+ */
54
+ export declare function readsUsEquitySessionPerTradingDay(read: OrderFlowReadLike | null | undefined, tfMs: unknown): boolean;
55
+ /** Whether a stock order-flow read at `readTfMs` can be held to the regular session: by bucket start below a day, else per trading session. */
56
+ export declare function isUsEquityRegularOrderFlowRead(read: OrderFlowReadLike | null | undefined, readTfMs: unknown): boolean;
57
+ /**
58
+ * The wire width of a session-filtered order-flow read at `tfMs` (the chart width, or a fixed or developing profile's
59
+ * span rung) on a chart of `chartTfMs` (the read's own width when it is the chart's): the width itself where the
60
+ * gateway reads it per trading session AND the chart is day-plus, else the at-most-15m effective width (rth-session.util
61
+ * `rthEffectiveFetchTfMs`, on whose grid the opens and closes sit). A day row is stamped at midnight, so on an intraday
62
+ * chart it would lose a box's intraday edges: there a rung reads exactly as before the day-plus rule. The one width
63
+ * every fetch, row grid, live fold and cache identity of a session-active profile reads, so they cannot disagree.
64
+ */
65
+ export declare function regularSessionReadTfMs(tfMs: number, read: OrderFlowReadLike | null | undefined, chartTfMs?: unknown): number;
66
+ /**
67
+ * Whether an overlay that reads at its own width `readTfMs` (a fixed or developing profile's span rung, or its live
68
+ * fold grid) is session-active on a chart of `chartTfMs`. Below a day the chart decides, exactly as before the day-plus
69
+ * rule; from a day up the read itself must be holdable to the regular session (`isUsEquityRegularOrderFlowRead`): an
70
+ * intraday read, or a per-session one.
71
+ */
72
+ export declare function isMarketSessionReadActive(settings: Parameters<typeof isMarketSessionHoursActive>[0], chartTfMs: unknown, chartRegularKind: MarketSessionKind | null, readTfMs: unknown): boolean;
73
+ /** A span-rung profile's whole session read (FRVP, DSP): whether it is session-active, and the width its rows are read, gridded and folded at. */
74
+ export declare function rungSessionRead(settings: Parameters<typeof isMarketSessionHoursActive>[0], chartTfMs: number, chartRegularKind: MarketSessionKind | null, rungMs: number): {
75
+ active: boolean;
76
+ readTfMs: number;
77
+ };
30
78
  /**
31
79
  * A US stock market: a Polygon listing code (marketKind.util `checkIsPolygon`: POLYGON, US_STOCKS, NYSE, NASDAQ,
32
80
  * CBOE) or a stocks tape code (stocks-governed.util `isStocksTapeGoverned`: NYSE_TAPE, NYSE_ARCA_TAPE,
@@ -46,13 +94,14 @@ export declare function marketSessionKind(exchange: unknown, symbol: unknown): M
46
94
  export declare function marketRegularWindow(exchange: unknown, symbol: unknown): Readonly<RthWindow> | null;
47
95
  export declare function marketHasRegularWindow(exchange: unknown, symbol: unknown): boolean;
48
96
  /**
49
- * The regular session THIS chart draws at `chartTfMs` (milliseconds), for overlay purposes; intraday only:
50
- * 'cme' exactly when rth-session.util `isChartRthActive(exchange, symbol, sessionType, chartTfMs)`.
97
+ * The regular session THIS chart draws at `chartTfMs` (milliseconds), for overlay purposes:
98
+ * 'cme' exactly when rth-session.util `isChartRthActive(exchange, symbol, sessionType, chartTfMs)` (intraday).
51
99
  * 'us-equity' when the candles' own gate holds, us-equities-session.util
52
- * `isEquityRegularSessionGated(exchange, sessionType, chartTfMs)` (a Polygon listing whose word is not
53
- * an active 'extended'), at an intraday `chartTfMs`. A chart opened on a tape venue (NASDAQ_TAPE) has
54
- * no candle session handling, so it answers null, as it rides today.
55
- * null otherwise: an ETH or extended chart, a daily or longer interval, a label instead of milliseconds.
100
+ * `isEquityRegularSessionGated(exchange, sessionType, chartTfMs)` (the candle fetch's REGULAR: a Polygon
101
+ * listing whose word is not an active 'extended', and every daily and longer bar), at a width its order
102
+ * flow can follow (`isUsEquityRegularOrderFlowIntervalMs`: 3D cannot). A chart opened on a tape venue
103
+ * (NASDAQ_TAPE) has no candle session handling, so it answers null, as it rides today.
104
+ * null otherwise: an ETH or extended intraday chart, a CME daily chart, 3D, a label instead of milliseconds.
56
105
  */
57
106
  export declare function chartRegularSessionKind(exchange: unknown, symbol: unknown, sessionType: unknown, chartTfMs: unknown): MarketSessionKind | null;
58
107
  /**
@@ -71,16 +120,19 @@ export declare function chartRegularKindFromCacheBag(bag: Readonly<Record<string
71
120
  * CME exactly rth-session.util `isRthSessionHoursActive(settings, chartTfMs, chartRegularKind === 'cme')`:
72
121
  * an explicit 'rth' stays active on any chart (a stock, crypto or ETH chart included), 'eth' never
73
122
  * is, and the 'chart' default follows a CME RTH chart only.
74
- * US stock active exactly while the chart draws the US equities regular session at an intraday `chartTfMs`.
75
- * Stock overlays always follow the chart: their session row is hidden, so a persisted 'rth' or 'eth'
76
- * carried over from a futures chart is ignored.
123
+ * US stock active exactly while the chart draws the US equities regular session and the overlay's read can be held
124
+ * to it (`isUsEquityRegularOrderFlowRead` at `readTfMs`: any intraday read; from a day up only a stock
125
+ * tape in coins, read per trading session; a USD or listing-code read at 1D keeps all hours, as 3D does).
126
+ * Stock overlays always follow the chart:
127
+ * their session row is hidden, so a persisted 'rth' or 'eth' carried over from a futures chart is ignored.
77
128
  * any other never active (no window to filter on).
78
129
  */
79
130
  export declare function isMarketSessionHoursActive(settings: {
80
131
  sessionHours?: unknown;
81
132
  symbol?: unknown;
82
133
  exchange?: unknown;
83
- } | null | undefined, chartTfMs: unknown, chartRegularKind: MarketSessionKind | null): boolean;
134
+ currency?: unknown;
135
+ } | null | undefined, chartTfMs: unknown, chartRegularKind: MarketSessionKind | null, readTfMs?: unknown): boolean;
84
136
  /**
85
137
  * `isWithinRthWindow`: whether `tsMs` sits in the market's `[open, close)` session. Fails OPEN with no window (a
86
138
  * market without a regular session keeps every row), false for a non-finite instant on a market with one.