@orangecharts/wrun-chart-host 0.14.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 (197) 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 +11 -0
  5. package/dist/constants/feature-flags.constants.js +56 -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 +24 -0
  18. package/dist/host-env.js +22 -0
  19. package/dist/host-ports.types.d.ts +11 -0
  20. package/dist/index.d.ts +4 -0
  21. package/dist/index.js +4 -0
  22. package/dist/interfaces/kscript-diagnostics.interface.d.ts +28 -0
  23. package/dist/interfaces/wrun-runtime.interface.d.ts +107 -4
  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/market-data/venues/index.d.ts +2 -2
  30. package/dist/market-data/venues/opra.js +3 -3
  31. package/dist/market-data/venues/stocks.contract.copy.json +3 -2
  32. package/dist/market-data/venues/stocks.d.ts +2 -2
  33. package/dist/market-data/venues/stocks.js +10 -9
  34. package/dist/replay/replayLadder.js +7 -4
  35. package/dist/settings-templates/footprint-rows.d.ts +6 -0
  36. package/dist/settings-templates/footprint-rows.js +6 -0
  37. package/dist/settings-templates/frvp-fields.js +14 -0
  38. package/dist/settings-templates/indicator-fields.js +46 -0
  39. package/dist/settings-templates/tool-tables.generated.js +19 -1
  40. package/dist/utility/chart/__fixtures__/live-bucket-regular-golden.json +1706 -0
  41. package/dist/utility/chart/cache-alignment.util.d.ts +65 -0
  42. package/dist/utility/chart/cache-alignment.util.js +124 -24
  43. package/dist/utility/chart/calendar-interval.util.d.ts +83 -1
  44. package/dist/utility/chart/calendar-interval.util.js +152 -4
  45. package/dist/utility/chart/candle-bar-end.util.d.ts +11 -4
  46. package/dist/utility/chart/candle-bar-end.util.js +17 -6
  47. package/dist/utility/chart/chart-time-domain.util.d.ts +3 -0
  48. package/dist/utility/chart/chart-time-domain.util.js +13 -4
  49. package/dist/utility/chart/feed-interval.util.d.ts +4 -2
  50. package/dist/utility/chart/feed-interval.util.js +5 -2
  51. package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +3 -1
  52. package/dist/utility/chart/fetch-dedupe-policy.util.js +19 -1
  53. package/dist/utility/chart/footprint-band.util.d.ts +21 -5
  54. package/dist/utility/chart/footprint-band.util.js +53 -14
  55. package/dist/utility/chart/footprint-display-mode.util.d.ts +2 -0
  56. package/dist/utility/chart/footprint-display-mode.util.js +5 -0
  57. package/dist/utility/chart/governed-lanes-gate.util.d.ts +46 -0
  58. package/dist/utility/chart/governed-lanes-gate.util.js +71 -0
  59. package/dist/utility/chart/governed-lanes-reader-seat.d.ts +14 -0
  60. package/dist/utility/chart/governed-lanes-reader-seat.js +14 -0
  61. package/dist/utility/chart/history-wall.util.d.ts +13 -2
  62. package/dist/utility/chart/history-wall.util.js +11 -4
  63. package/dist/utility/chart/interval-ladder.util.d.ts +5 -2
  64. package/dist/utility/chart/interval-ladder.util.js +44 -4
  65. package/dist/utility/chart/interval-registry.util.d.ts +22 -1
  66. package/dist/utility/chart/interval-registry.util.js +50 -2
  67. package/dist/utility/chart/kscript-data-interval-restriction.leaf.d.ts +32 -4
  68. package/dist/utility/chart/kscript-data-interval-restriction.leaf.js +22 -5
  69. package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +10 -0
  70. package/dist/utility/chart/kscript-drawing-safe-area.util.js +30 -3
  71. package/dist/utility/chart/kscript-legend-entries.util.d.ts +21 -4
  72. package/dist/utility/chart/kscript-legend-entries.util.js +27 -5
  73. package/dist/utility/chart/kscript-main-grid-stages.util.js +74 -24
  74. package/dist/utility/chart/kscript-row-name.leaf.d.ts +13 -0
  75. package/dist/utility/chart/kscript-row-name.leaf.js +18 -0
  76. package/dist/utility/chart/kscript-venue-policy.util.d.ts +61 -26
  77. package/dist/utility/chart/kscript-venue-policy.util.js +138 -37
  78. package/dist/utility/chart/live-bucket.util.d.ts +29 -4
  79. package/dist/utility/chart/live-bucket.util.js +45 -12
  80. package/dist/utility/chart/market-session.util.d.ts +62 -10
  81. package/dist/utility/chart/market-session.util.js +93 -13
  82. package/dist/utility/chart/marketKind.util.d.ts +1 -7
  83. package/dist/utility/chart/marketKind.util.js +6 -8
  84. package/dist/utility/chart/mixed-mode.util.d.ts +17 -0
  85. package/dist/utility/chart/om-target.util.js +6 -4
  86. package/dist/utility/chart/price-precision.util.d.ts +20 -6
  87. package/dist/utility/chart/price-precision.util.js +34 -7
  88. package/dist/utility/chart/profile-frame-window.util.d.ts +15 -0
  89. package/dist/utility/chart/profile-frame-window.util.js +12 -0
  90. package/dist/utility/chart/rth-session.util.d.ts +3 -1
  91. package/dist/utility/chart/rth-session.util.js +3 -1
  92. package/dist/utility/chart/script-source-session.util.d.ts +43 -0
  93. package/dist/utility/chart/script-source-session.util.js +61 -0
  94. package/dist/utility/chart/typed-width-grid.util.d.ts +23 -0
  95. package/dist/utility/chart/typed-width-grid.util.js +203 -0
  96. package/dist/utility/chart/wrun-run-result.util.d.ts +9 -1
  97. package/dist/utility/chart/wrun-run-result.util.js +8 -2
  98. package/dist/utility/common/transformations.util.d.ts +6 -0
  99. package/dist/utility/common/transformations.util.js +28 -4
  100. package/dist/utility/number-format.util.d.ts +14 -1
  101. package/dist/utility/number-format.util.js +22 -4
  102. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.d.ts +24 -1
  103. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +113 -0
  104. package/dist/utility/v2/v2-enums.leaf.js +3 -0
  105. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +15 -5
  106. package/dist/utility/wrun/wrun-batched-marks.util.js +70 -20
  107. package/dist/utility/wrun/wrun-canvases.util.d.ts +28 -9
  108. package/dist/utility/wrun/wrun-canvases.util.js +99 -39
  109. package/dist/utility/wrun/wrun-cap-notice.util.d.ts +5 -0
  110. package/dist/utility/wrun/wrun-cap-notice.util.js +23 -0
  111. package/dist/utility/wrun/wrun-card-style.util.d.ts +1 -1
  112. package/dist/utility/wrun/wrun-card-style.util.js +2 -2
  113. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +8 -0
  114. package/dist/utility/wrun/wrun-chart-market-facts.util.js +13 -1
  115. package/dist/utility/wrun/wrun-child-overlay-id.util.d.ts +10 -0
  116. package/dist/utility/wrun/wrun-child-overlay-id.util.js +24 -0
  117. package/dist/utility/wrun/wrun-cloud-cme-stamp.util.d.ts +72 -0
  118. package/dist/utility/wrun/wrun-cloud-cme-stamp.util.js +151 -0
  119. package/dist/utility/wrun/wrun-color-facts.util.d.ts +3 -3
  120. package/dist/utility/wrun/wrun-color-facts.util.js +8 -5
  121. package/dist/utility/wrun/wrun-colour-tone.lazy.d.ts +20 -0
  122. package/dist/utility/wrun/wrun-colour-tone.lazy.js +23 -0
  123. package/dist/utility/wrun/wrun-colour-tone.util.d.ts +14 -0
  124. package/dist/utility/wrun/wrun-colour-tone.util.js +119 -0
  125. package/dist/utility/wrun/wrun-dark-pool.util.d.ts +3 -2
  126. package/dist/utility/wrun/wrun-dark-pool.util.js +5 -4
  127. package/dist/utility/wrun/wrun-frames.d.ts +1 -1
  128. package/dist/utility/wrun/wrun-frames.js +2 -2
  129. package/dist/utility/wrun/wrun-handles.util.d.ts +1 -1
  130. package/dist/utility/wrun/wrun-handles.util.js +1 -1
  131. package/dist/utility/wrun/wrun-host.service.d.ts +32 -2
  132. package/dist/utility/wrun/wrun-host.service.js +44 -2
  133. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +20 -0
  134. package/dist/utility/wrun/wrun-hosted-wire-caps.js +85 -2
  135. package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +37 -0
  136. package/dist/utility/wrun/wrun-hosted-wire.util.js +54 -0
  137. package/dist/utility/wrun/wrun-hover.util.d.ts +8 -2
  138. package/dist/utility/wrun/wrun-hover.util.js +24 -13
  139. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +1 -0
  140. package/dist/utility/wrun/wrun-hud-looks.util.js +6 -11
  141. package/dist/utility/wrun/wrun-integration-route.util.d.ts +24 -0
  142. package/dist/utility/wrun/wrun-integration-route.util.js +19 -0
  143. package/dist/utility/wrun/wrun-live-intake.util.js +17 -1
  144. package/dist/utility/wrun/wrun-live-patch.util.d.ts +6 -1
  145. package/dist/utility/wrun/wrun-live-patch.util.js +10 -4
  146. package/dist/utility/wrun/wrun-live-tick.util.js +81 -19
  147. package/dist/utility/wrun/wrun-output-words.util.d.ts +14 -0
  148. package/dist/utility/wrun/wrun-output-words.util.js +51 -0
  149. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +41 -0
  150. package/dist/utility/wrun/wrun-overlay-drivers.util.js +35 -0
  151. package/dist/utility/wrun/wrun-overlay-result.util.d.ts +6 -1
  152. package/dist/utility/wrun/wrun-overlay-result.util.js +2 -0
  153. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +23 -2
  154. package/dist/utility/wrun/wrun-overlay-run.util.js +305 -51
  155. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +10 -2
  156. package/dist/utility/wrun/wrun-panel-mount.util.js +144 -18
  157. package/dist/utility/wrun/wrun-pin-venues.util.js +5 -1
  158. package/dist/utility/wrun/wrun-refusal.util.d.ts +4 -0
  159. package/dist/utility/wrun/wrun-refusal.util.js +102 -13
  160. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +5 -3
  161. package/dist/utility/wrun/wrun-registry-errors.util.js +5 -3
  162. package/dist/utility/wrun/wrun-row-source-factory.js +17 -1
  163. package/dist/utility/wrun/wrun-row-source.d.ts +8 -1
  164. package/dist/utility/wrun/wrun-run-health.util.d.ts +6 -3
  165. package/dist/utility/wrun/wrun-run-health.util.js +5 -2
  166. package/dist/utility/wrun/wrun-sandbox-row-source.d.ts +1 -1
  167. package/dist/utility/wrun/wrun-sandbox-row-source.js +9 -0
  168. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +25 -8
  169. package/dist/utility/wrun/wrun-script-inputs.util.js +145 -45
  170. package/dist/utility/wrun/wrun-setting-words.util.d.ts +12 -5
  171. package/dist/utility/wrun/wrun-setting-words.util.js +25 -8
  172. package/dist/utility/wrun/wrun-socket-row-source.d.ts +26 -1
  173. package/dist/utility/wrun/wrun-socket-row-source.js +125 -12
  174. package/dist/utility/wrun/wrun-source-rows.util.d.ts +3 -3
  175. package/dist/utility/wrun/wrun-source-rows.util.js +8 -7
  176. package/dist/utility/wrun/wrun-style-names.util.d.ts +23 -0
  177. package/dist/utility/wrun/wrun-style-names.util.js +74 -0
  178. package/dist/utility/wrun/wrun-style-words.util.d.ts +31 -9
  179. package/dist/utility/wrun/wrun-style-words.util.js +46 -15
  180. package/dist/utility/wrun/wrun-trades-lane.util.js +2 -1
  181. package/dist/utility/wrun/wrun-trap-replay.util.d.ts +42 -0
  182. package/dist/utility/wrun/wrun-trap-replay.util.js +63 -0
  183. package/dist/utility/wrun/wrun-volume-profile.util.js +6 -5
  184. package/dist/utility/wrun-display-name.util.d.ts +10 -0
  185. package/dist/utility/wrun-display-name.util.js +21 -0
  186. package/dist/utils/replay/replay-buffer-math.d.ts +2 -0
  187. package/dist/utils/replay/replay-buffer-math.js +2 -0
  188. package/dist/workers/constants/socket-slots.d.ts +1 -1
  189. package/dist/workers/utils/time.worker.util.js +2 -2
  190. package/dist/workers/utils/volume-profile.worker.util.d.ts +9 -0
  191. package/dist/workers/utils/volume-profile.worker.util.js +20 -0
  192. package/dist/workers/wrun/wrun-abi-host.d.ts +3 -0
  193. package/dist/workers/wrun/wrun-abi-host.js +82 -5
  194. package/dist/workers/wrun/wrun-engine-handler.js +53 -4
  195. package/dist/workers/wrun/wrun-trap-frames.leaf.d.ts +28 -0
  196. package/dist/workers/wrun/wrun-trap-frames.leaf.js +108 -0
  197. package/package.json +11 -11
@@ -0,0 +1,50 @@
1
+ /** The coarsest stored candle size (seconds) that divides `seconds`; NaN when none does. */
2
+ export declare function storedBarSecondsDividing(seconds: number): number;
3
+ /**
4
+ * The stored interval label a typed width is built from: 4m to 18m '1m'; 20m, 40m and 80m '5m'; 90m '15m'; 3h '1h';
5
+ * the day widths '1d'; the week widths '1w'. Undefined for any other label.
6
+ */
7
+ export declare function storedDivisorLabel(label: unknown): string | undefined;
8
+ /**
9
+ * The stored size (seconds) a typed width reads volume-profile rows at, or undefined when the label is not a typed
10
+ * width or the cap refuses it (`isTypedWidthProfileFoldAllowed`).
11
+ */
12
+ export declare function typedWidthProfileSourceSeconds(label: unknown): number | undefined;
13
+ /**
14
+ * The row interval (ms) a per-candle profile read asks for on a chart of `chartMs`: a typed width's stored size, and
15
+ * any other length unchanged. It maps every typed width, capped or not: the indicator verdict decides whether the read
16
+ * happens at all.
17
+ */
18
+ export declare function profileRowMsForChart(chartMs: number): number;
19
+ /** True when a chart bar of `lengthMs` is a typed width (the footprint workers hold the chart length, not its label). */
20
+ export declare function isTypedWidthLengthMs(lengthMs: number): boolean;
21
+ /**
22
+ * The closed end of a typed read, in ms: the end of a window that closed before the server's now. The gateway's range
23
+ * includes its end (`bucket <= to`), so a closed window ending at T brings back the stored row AT T. On a typed width
24
+ * that row opens the NEXT typed bar, and the fold would turn it into a bar stamped T holding 1 of its k rows (a short
25
+ * sum, the first value instead of the last, the mean of one row). The next (newer) window starts at T and owns that bar
26
+ * whole, so the bar is dropped (`keepBarsBeforeClosedEnd`).
27
+ *
28
+ * `tf` is the chart's interval: a label (the line workers' `payload.tf`) or the bar length in ms (the footprint
29
+ * workers' `chartTfMs`). Both forms go through the one rule below.
30
+ *
31
+ * Undefined (nothing to drop) for:
32
+ * - an interval that is not a typed width, so regular intervals keep every row the wire sends;
33
+ * - a floating window (`fromSec` 0, the gateway's "latest period"), whose end moves with the server clock;
34
+ * - a window with no end (`periodSec` undefined);
35
+ * - a window that reaches the server's now (end at or after `nowSec`), which keeps its forming bar.
36
+ *
37
+ * `fromSec` and `periodSec` are the window as asked; flooring the start (`typedWindowSec`) does not move the end, so
38
+ * either the floored or the unfloored window gives the same answer. `nowSec` is the server's now (`serverNowMs()` in the
39
+ * caller), passed in so this helper stays pure.
40
+ */
41
+ export declare function typedClosedEndMs(fromSec: number, periodSec: number | undefined, tf: string | number, nowSec: number): number | undefined;
42
+ /**
43
+ * The folded bars that start before a closed end (`typedClosedEndMs`), in the bars' own unit (`unit`, default
44
+ * `'ms'`; `closedEndMs` is always in ms). A bar's time is its first element unless `timeOf` reads it. With no closed end
45
+ * (a regular label, a floating window, a window that reaches now) it returns the SAME array, untouched.
46
+ *
47
+ * Apply it where the folded rows are final for the request: after the fold, and before anything that reads one bar to
48
+ * shape the next (`transformData`, a forward-fill, a resident merge) or posts the rows.
49
+ */
50
+ export declare function keepBarsBeforeClosedEnd<T>(bars: T[], closedEndMs: number | undefined, unit?: 's' | 'ms', timeOf?: (bar: T) => number): T[];
@@ -0,0 +1,99 @@
1
+ /**
2
+ * How a typed width (typed-width.leaf) reads an indicator the gateway does not serve at CUSTOM: the app asks for rows at
3
+ * the stored candle size the width is built from and folds them into the chart's bars itself. This leaf names that
4
+ * stored size. The cap on the widths that may fold volume-profile rows is `isTypedWidthProfileFoldAllowed`
5
+ * (typed-width.leaf). Dependency-free and off the boot path: workers and lazily loaded modules import it.
6
+ *
7
+ * It is also the one home of the closed-end rule (`typedClosedEndMs`, `keepBarsBeforeClosedEnd`) that every typed
8
+ * fold applies, the line workers (through typed-width-fold.worker.util) and the footprint workers alike.
9
+ */
10
+ import { isTypedWidth, isTypedWidthProfileFoldAllowed, STORED_BAR_SECONDS, TYPED_WIDTH_LABELS, TYPED_WIDTH_SECONDS, typedWidthSeconds, } from './typed-width.leaf.js';
11
+ /** The interval label of each stored candle size, by its length in seconds. */
12
+ const STORED_LABEL_BY_SECONDS = {
13
+ 60: '1m',
14
+ 300: '5m',
15
+ 900: '15m',
16
+ 3600: '1h',
17
+ 14400: '4h',
18
+ 86400: '1d',
19
+ 604800: '1w',
20
+ };
21
+ /** The coarsest stored candle size (seconds) that divides `seconds`; NaN when none does. */
22
+ export function storedBarSecondsDividing(seconds) {
23
+ let stored = NaN;
24
+ for (const size of STORED_BAR_SECONDS)
25
+ if (seconds % size === 0)
26
+ stored = size;
27
+ return stored;
28
+ }
29
+ /**
30
+ * The stored interval label a typed width is built from: 4m to 18m '1m'; 20m, 40m and 80m '5m'; 90m '15m'; 3h '1h';
31
+ * the day widths '1d'; the week widths '1w'. Undefined for any other label.
32
+ */
33
+ export function storedDivisorLabel(label) {
34
+ const seconds = typedWidthSeconds(label);
35
+ return seconds === undefined ? undefined : STORED_LABEL_BY_SECONDS[storedBarSecondsDividing(seconds)];
36
+ }
37
+ /**
38
+ * The stored size (seconds) a typed width reads volume-profile rows at, or undefined when the label is not a typed
39
+ * width or the cap refuses it (`isTypedWidthProfileFoldAllowed`).
40
+ */
41
+ export function typedWidthProfileSourceSeconds(label) {
42
+ if (!isTypedWidthProfileFoldAllowed(label))
43
+ return undefined;
44
+ return storedBarSecondsDividing(typedWidthSeconds(label));
45
+ }
46
+ /**
47
+ * The row interval (ms) a per-candle profile read asks for on a chart of `chartMs`: a typed width's stored size, and
48
+ * any other length unchanged. It maps every typed width, capped or not: the indicator verdict decides whether the read
49
+ * happens at all.
50
+ */
51
+ export function profileRowMsForChart(chartMs) {
52
+ return isTypedWidthLengthMs(chartMs) ? storedBarSecondsDividing(chartMs / 1000) * 1000 : chartMs;
53
+ }
54
+ /** True when a chart bar of `lengthMs` is a typed width (the footprint workers hold the chart length, not its label). */
55
+ export function isTypedWidthLengthMs(lengthMs) {
56
+ const seconds = lengthMs / 1000;
57
+ return TYPED_WIDTH_LABELS.some((label) => TYPED_WIDTH_SECONDS[label] === seconds);
58
+ }
59
+ /**
60
+ * The closed end of a typed read, in ms: the end of a window that closed before the server's now. The gateway's range
61
+ * includes its end (`bucket <= to`), so a closed window ending at T brings back the stored row AT T. On a typed width
62
+ * that row opens the NEXT typed bar, and the fold would turn it into a bar stamped T holding 1 of its k rows (a short
63
+ * sum, the first value instead of the last, the mean of one row). The next (newer) window starts at T and owns that bar
64
+ * whole, so the bar is dropped (`keepBarsBeforeClosedEnd`).
65
+ *
66
+ * `tf` is the chart's interval: a label (the line workers' `payload.tf`) or the bar length in ms (the footprint
67
+ * workers' `chartTfMs`). Both forms go through the one rule below.
68
+ *
69
+ * Undefined (nothing to drop) for:
70
+ * - an interval that is not a typed width, so regular intervals keep every row the wire sends;
71
+ * - a floating window (`fromSec` 0, the gateway's "latest period"), whose end moves with the server clock;
72
+ * - a window with no end (`periodSec` undefined);
73
+ * - a window that reaches the server's now (end at or after `nowSec`), which keeps its forming bar.
74
+ *
75
+ * `fromSec` and `periodSec` are the window as asked; flooring the start (`typedWindowSec`) does not move the end, so
76
+ * either the floored or the unfloored window gives the same answer. `nowSec` is the server's now (`serverNowMs()` in the
77
+ * caller), passed in so this helper stays pure.
78
+ */
79
+ export function typedClosedEndMs(fromSec, periodSec, tf, nowSec) {
80
+ const typed = typeof tf === 'number' ? isTypedWidthLengthMs(tf) : isTypedWidth(tf);
81
+ if (!typed || !(fromSec > 0) || periodSec === undefined)
82
+ return undefined;
83
+ const endSec = fromSec + periodSec;
84
+ return endSec < nowSec ? endSec * 1000 : undefined;
85
+ }
86
+ /**
87
+ * The folded bars that start before a closed end (`typedClosedEndMs`), in the bars' own unit (`unit`, default
88
+ * `'ms'`; `closedEndMs` is always in ms). A bar's time is its first element unless `timeOf` reads it. With no closed end
89
+ * (a regular label, a floating window, a window that reaches now) it returns the SAME array, untouched.
90
+ *
91
+ * Apply it where the folded rows are final for the request: after the fold, and before anything that reads one bar to
92
+ * shape the next (`transformData`, a forward-fill, a resident merge) or posts the rows.
93
+ */
94
+ export function keepBarsBeforeClosedEnd(bars, closedEndMs, unit = 'ms', timeOf = (bar) => bar[0]) {
95
+ if (closedEndMs === undefined)
96
+ return bars;
97
+ const end = unit === 's' ? closedEndMs / 1000 : closedEndMs;
98
+ return bars.filter((bar) => timeOf(bar) < end);
99
+ }
@@ -0,0 +1,24 @@
1
+ import type { LiveBucketVenue } from '../utility/chart/live-bucket.util.js';
2
+ import { type TypedGridKind } from '../utility/chart/typed-width-grid.util.js';
3
+ /** The served interval a custom size folds from, and the most of its rows one custom bar holds. */
4
+ export interface TypedWidthSource {
5
+ label: string;
6
+ rowsPerBar: number;
7
+ }
8
+ /** The most source rows one app-built custom bar may read. */
9
+ export declare const TYPED_SOURCE_MAX_ROWS = 20;
10
+ /** The candidate source intervals of a custom size, best first (deepest history, then fewest rows). */
11
+ export declare function typedWidthSourceCandidates(label: string): readonly string[];
12
+ /** The candidates of a custom size on one grid: the table less the ones whose bars straddle a custom edge there. */
13
+ export declare function typedWidthSourceCandidatesOn(label: string, kind: TypedGridKind): readonly string[];
14
+ /**
15
+ * The most rows of `sourceLabel` one bar of the custom size `label` holds on a grid: the width over the source length
16
+ * under a day; N for N days from 1d and for N weeks from 1w; for N weeks from 1d, 7N on the UTC grid (every day
17
+ * trades) and 5N on a session grid (a week holds five trade dates). NaN for a pair the table does not name.
18
+ */
19
+ export declare function typedSourceRowsPerBar(label: string, sourceLabel: string, kind: TypedGridKind): number;
20
+ /**
21
+ * The source of the custom size `label` on the chart's market: the first candidate the chart serves (`servable`)
22
+ * that needs at most TYPED_SOURCE_MAX_ROWS rows a bar. Null when the market has no interval to build it from.
23
+ */
24
+ export declare function typedWidthSource(label: string, venue: LiveBucketVenue | null | undefined, servable: (label: string) => boolean): TypedWidthSource | null;
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Which served interval a custom size is built from in the app, and how many of its rows one custom bar can hold.
3
+ *
4
+ * The candidates are data, best first: the deepest history on the server, then the fewest rows a bar (the server keeps
5
+ * 15,000 bars of most sizes, 25,000 at 1h and 50,000 at 30m, so 90m reaches further from 30m than from anything
6
+ * finer). A candidate is kept on a grid only when none of its bars straddles a custom bar's edge there; the spec
7
+ * (tests/constants/typed-width-source.leaf.spec.ts) walks every candidate against the grid functions over a summer, a
8
+ * winter and both clock-change weeks, and the drops below are what that walk found. Nothing is scanned at run time.
9
+ *
10
+ * LAZY: loaded the first time a chart goes on a custom size the app builds. No eager module may import this file
11
+ * (tests/perf/typed-width-rules-lazy-closure.spec.ts).
12
+ */
13
+ import { typedWidthSeconds } from './typed-width.leaf.js';
14
+ import { typedGridKind } from '../utility/chart/typed-width-grid.util.js';
15
+ /** The most source rows one app-built custom bar may read. */
16
+ export const TYPED_SOURCE_MAX_ROWS = 20;
17
+ const MINUTE_S = 60;
18
+ const DAY_S = 86_400;
19
+ const WEEK_S = 604_800;
20
+ /** The served lengths a candidate can name, in seconds. */
21
+ const SOURCE_SECONDS = {
22
+ '1m': MINUTE_S,
23
+ '2m': 2 * MINUTE_S,
24
+ '3m': 3 * MINUTE_S,
25
+ '5m': 5 * MINUTE_S,
26
+ '10m': 10 * MINUTE_S,
27
+ '15m': 15 * MINUTE_S,
28
+ '30m': 30 * MINUTE_S,
29
+ '1h': 60 * MINUTE_S,
30
+ '1d': DAY_S,
31
+ '1w': WEEK_S,
32
+ };
33
+ /** The candidates of each custom size under a day, best first. */
34
+ const INTRADAY_CANDIDATES = {
35
+ '4m': ['2m', '1m'],
36
+ '6m': ['3m', '2m', '1m'],
37
+ '8m': ['2m', '1m'],
38
+ '9m': ['3m', '1m'],
39
+ '12m': ['3m', '2m', '1m'],
40
+ '16m': ['2m', '1m'],
41
+ '18m': ['3m', '2m', '1m'],
42
+ '20m': ['10m', '5m', '1m'],
43
+ '40m': ['10m', '5m'],
44
+ '80m': ['10m', '5m'],
45
+ '90m': ['30m', '15m', '5m'],
46
+ '3h': ['1h', '30m', '15m'],
47
+ };
48
+ const DAY_CANDIDATES = ['1d'];
49
+ const WEEK_CANDIDATES = ['1w', '1d'];
50
+ /**
51
+ * The candidates a grid cannot take, by custom size: their bars straddle a custom bar's edge there.
52
+ * - CME regular hours: the gateway keeps a regular-hours bucket of 30m or less whole by its start, so the 2m bucket
53
+ * at 16:14, the 10m one at 16:10 and the 30m one at 16:00 New York run past the 16:15 close that ends a custom bar
54
+ * (ES; the NYMEX 14:30 close sits on all three grids, but one table serves every CME product).
55
+ * - US stocks in regular hours and US options: an option's 1h bars sit on the UTC hour (the 09:00 New York bar holds
56
+ * the 09:30 open), where a regular-hours stock's sit on the 09:30 anchor; both grids take the same row, so 3h reads
57
+ * 30m on each (the stock's drop is held, not refuted: the spec names it). An option prints nothing after its 16:15 close, so a source bar that opens before it (the 16:10 10m
58
+ * bar) holds only rows of the session's short last bar.
59
+ */
60
+ const STRADDLING = {
61
+ 'cme-regular': {
62
+ '4m': ['2m'],
63
+ '6m': ['2m'],
64
+ '8m': ['2m'],
65
+ '12m': ['2m'],
66
+ '16m': ['2m'],
67
+ '18m': ['2m'],
68
+ '20m': ['10m'],
69
+ '40m': ['10m'],
70
+ '80m': ['10m'],
71
+ '90m': ['30m'],
72
+ '3h': ['30m'],
73
+ },
74
+ 'equity-regular': {
75
+ '3h': ['1h'],
76
+ },
77
+ options: {
78
+ '3h': ['1h'],
79
+ },
80
+ };
81
+ /** The candidate source intervals of a custom size, best first (deepest history, then fewest rows). */
82
+ export function typedWidthSourceCandidates(label) {
83
+ const seconds = typedWidthSeconds(label);
84
+ if (seconds === undefined)
85
+ return [];
86
+ if (seconds < DAY_S)
87
+ return INTRADAY_CANDIDATES[label] ?? [];
88
+ return seconds % WEEK_S === 0 ? WEEK_CANDIDATES : DAY_CANDIDATES;
89
+ }
90
+ /** The candidates of a custom size on one grid: the table less the ones whose bars straddle a custom edge there. */
91
+ export function typedWidthSourceCandidatesOn(label, kind) {
92
+ const dropped = STRADDLING[kind]?.[label];
93
+ const candidates = typedWidthSourceCandidates(label);
94
+ return dropped ? candidates.filter((candidate) => !dropped.includes(candidate)) : candidates;
95
+ }
96
+ /**
97
+ * The most rows of `sourceLabel` one bar of the custom size `label` holds on a grid: the width over the source length
98
+ * under a day; N for N days from 1d and for N weeks from 1w; for N weeks from 1d, 7N on the UTC grid (every day
99
+ * trades) and 5N on a session grid (a week holds five trade dates). NaN for a pair the table does not name.
100
+ */
101
+ export function typedSourceRowsPerBar(label, sourceLabel, kind) {
102
+ const seconds = typedWidthSeconds(label);
103
+ const sourceSeconds = SOURCE_SECONDS[sourceLabel];
104
+ if (seconds === undefined || sourceSeconds === undefined)
105
+ return Number.NaN;
106
+ if (seconds < DAY_S || sourceSeconds !== DAY_S || seconds % WEEK_S !== 0)
107
+ return seconds / sourceSeconds;
108
+ const weeks = seconds / WEEK_S;
109
+ return kind === 'utc' ? 7 * weeks : 5 * weeks;
110
+ }
111
+ /**
112
+ * The source of the custom size `label` on the chart's market: the first candidate the chart serves (`servable`)
113
+ * that needs at most TYPED_SOURCE_MAX_ROWS rows a bar. Null when the market has no interval to build it from.
114
+ */
115
+ export function typedWidthSource(label, venue, servable) {
116
+ const seconds = typedWidthSeconds(label);
117
+ if (seconds === undefined)
118
+ return null;
119
+ const kind = typedGridKind(seconds * 1000, venue);
120
+ for (const candidate of typedWidthSourceCandidatesOn(label, kind)) {
121
+ const rowsPerBar = typedSourceRowsPerBar(label, candidate, kind);
122
+ if (rowsPerBar <= TYPED_SOURCE_MAX_ROWS && servable(candidate) === true)
123
+ return { label: candidate, rowsPerBar };
124
+ }
125
+ return null;
126
+ }
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Typed widths: candle widths a person types that sit on no ladder rung. Under a day each is a whole divisor of a UTC
3
+ * day, so its bars lie on the plain epoch grid; from a day up each is whole days (2 to 20 days, 2 to 20 weeks), and
4
+ * its bars count from Monday 2000-01-03 (calendar-interval.util `fixedGridFloorMs`). The gateway serves one as the wire
5
+ * interval CUSTOM plus `barSeconds`, built from the coarsest stored candle size that divides it, and refuses a width
6
+ * that reads more than `TYPED_WIDTH_MAX_STORED_BARS` stored candles per bar. Dependency-free: workers and leaf modules
7
+ * import it.
8
+ */
9
+ type DayCount = 2 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20;
10
+ type WeekCount = 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20;
11
+ declare const INTRADAY_TYPED_WIDTH_SECONDS: {
12
+ readonly '4m': 240;
13
+ readonly '6m': 360;
14
+ readonly '8m': 480;
15
+ readonly '9m': 540;
16
+ readonly '12m': 720;
17
+ readonly '16m': 960;
18
+ readonly '18m': 1080;
19
+ readonly '20m': 1200;
20
+ readonly '40m': 2400;
21
+ readonly '80m': 4800;
22
+ readonly '90m': 5400;
23
+ readonly '3h': 10800;
24
+ };
25
+ export type TypedWidth = keyof typeof INTRADAY_TYPED_WIDTH_SECONDS | `${DayCount}d` | `${WeekCount}w`;
26
+ /**
27
+ * The typed widths and their lengths in seconds: the 12 under a day shortest first, then the day and week sizes by
28
+ * count (2d 2w 3w 4d 4w ...). One label per length: 7 days is the `1w` rung, 14 days `2w`, 3 days the `3d` rung. No
29
+ * reader relies on the order. Every one reads at most 20 stored candles a bar.
30
+ */
31
+ export declare const TYPED_WIDTH_SECONDS: Readonly<Record<TypedWidth, number>>;
32
+ export declare const TYPED_WIDTH_LABELS: readonly TypedWidth[];
33
+ /** The candle sizes the gateway stores (1m 5m 15m 1h 4h 1d 1w), in seconds, shortest first. */
34
+ export declare const STORED_BAR_SECONDS: readonly number[];
35
+ /** The gateway's limit: a typed width reads at most this many stored candles for one bar. */
36
+ export declare const TYPED_WIDTH_MAX_STORED_BARS = 20;
37
+ /** Stored candles one bar of `seconds` reads: the width over the coarsest stored size that divides it (NaN for none). */
38
+ export declare function storedBarsPerTypedWidth(seconds: number): number;
39
+ export declare const CUSTOM_WIRE_INTERVAL = 26;
40
+ export declare const CUSTOM_WIRE_INTERVAL_NAME = "CUSTOM";
41
+ export declare function isTypedWidth(label: unknown): label is TypedWidth;
42
+ /** The bar length a typed width asks the gateway for (`barSeconds`), undefined for any other label. */
43
+ export declare function typedWidthSeconds(label: unknown): number | undefined;
44
+ /**
45
+ * The most stored candles a typed width may fold into one bar of volume-profile rows (the range profiles, and
46
+ * footprints where they fold).
47
+ */
48
+ export declare const TYPED_WIDTH_PROFILE_FOLD_MAX_STORED_BARS = 8;
49
+ /**
50
+ * Whether a typed width may fold volume-profile rows (footprints, the range profiles), which the app reads at the
51
+ * stored size and adds up itself (typed-width-fold.leaf): at most 8 stored candles a bar, and among the day widths
52
+ * only 2d, since a stored daily profile row weighs about 30 one-minute rows. That is 4m 6m 8m 20m 40m 90m 3h, 2d and
53
+ * 2w to 8w. False for every other label. The one cap rule: the indicator verdict reads it, and the chart-type door
54
+ * does for a chart type that folds rows.
55
+ */
56
+ export declare function isTypedWidthProfileFoldAllowed(label: unknown): boolean;
57
+ export {};
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Typed widths: candle widths a person types that sit on no ladder rung. Under a day each is a whole divisor of a UTC
3
+ * day, so its bars lie on the plain epoch grid; from a day up each is whole days (2 to 20 days, 2 to 20 weeks), and
4
+ * its bars count from Monday 2000-01-03 (calendar-interval.util `fixedGridFloorMs`). The gateway serves one as the wire
5
+ * interval CUSTOM plus `barSeconds`, built from the coarsest stored candle size that divides it, and refuses a width
6
+ * that reads more than `TYPED_WIDTH_MAX_STORED_BARS` stored candles per bar. Dependency-free: workers and leaf modules
7
+ * import it.
8
+ */
9
+ const INTRADAY_TYPED_WIDTH_SECONDS = {
10
+ '4m': 240,
11
+ '6m': 360,
12
+ '8m': 480,
13
+ '9m': 540,
14
+ '12m': 720,
15
+ '16m': 960,
16
+ '18m': 1080,
17
+ '20m': 1200,
18
+ '40m': 2400,
19
+ '80m': 4800,
20
+ '90m': 5400,
21
+ '3h': 10800,
22
+ };
23
+ /**
24
+ * The typed widths and their lengths in seconds: the 12 under a day shortest first, then the day and week sizes by
25
+ * count (2d 2w 3w 4d 4w ...). One label per length: 7 days is the `1w` rung, 14 days `2w`, 3 days the `3d` rung. No
26
+ * reader relies on the order. Every one reads at most 20 stored candles a bar.
27
+ */
28
+ export const TYPED_WIDTH_SECONDS = { ...INTRADAY_TYPED_WIDTH_SECONDS };
29
+ for (let n = 2; n < 21; n++) {
30
+ const rows = TYPED_WIDTH_SECONDS;
31
+ if (n % 7 && n !== 3)
32
+ rows[n + 'd'] = n * 86_400;
33
+ rows[n + 'w'] = n * 604_800;
34
+ }
35
+ export const TYPED_WIDTH_LABELS = Object.keys(TYPED_WIDTH_SECONDS);
36
+ /** The candle sizes the gateway stores (1m 5m 15m 1h 4h 1d 1w), in seconds, shortest first. */
37
+ export const STORED_BAR_SECONDS = [60, 300, 900, 3600, 14400, 86400, 604800];
38
+ /** The gateway's limit: a typed width reads at most this many stored candles for one bar. */
39
+ export const TYPED_WIDTH_MAX_STORED_BARS = 20;
40
+ /** Stored candles one bar of `seconds` reads: the width over the coarsest stored size that divides it (NaN for none). */
41
+ export function storedBarsPerTypedWidth(seconds) {
42
+ let stored = NaN;
43
+ for (const size of STORED_BAR_SECONDS)
44
+ if (seconds % size === 0)
45
+ stored = size;
46
+ return seconds / stored;
47
+ }
48
+ // The shared pb-common package and its parity-pinned enum leaf stop at HALF_YEAR (25): CUSTOM is 26 on the gateway.
49
+ export const CUSTOM_WIRE_INTERVAL = 26;
50
+ export const CUSTOM_WIRE_INTERVAL_NAME = 'CUSTOM';
51
+ const hasOwn = (record, key) => Object.prototype.hasOwnProperty.call(record, key);
52
+ export function isTypedWidth(label) {
53
+ return typeof label === 'string' && hasOwn(TYPED_WIDTH_SECONDS, label);
54
+ }
55
+ /** The bar length a typed width asks the gateway for (`barSeconds`), undefined for any other label. */
56
+ export function typedWidthSeconds(label) {
57
+ return isTypedWidth(label) ? TYPED_WIDTH_SECONDS[label] : undefined;
58
+ }
59
+ /**
60
+ * The most stored candles a typed width may fold into one bar of volume-profile rows (the range profiles, and
61
+ * footprints where they fold).
62
+ */
63
+ export const TYPED_WIDTH_PROFILE_FOLD_MAX_STORED_BARS = 8;
64
+ /**
65
+ * Whether a typed width may fold volume-profile rows (footprints, the range profiles), which the app reads at the
66
+ * stored size and adds up itself (typed-width-fold.leaf): at most 8 stored candles a bar, and among the day widths
67
+ * only 2d, since a stored daily profile row weighs about 30 one-minute rows. That is 4m 6m 8m 20m 40m 90m 3h, 2d and
68
+ * 2w to 8w. False for every other label. The one cap rule: the indicator verdict reads it, and the chart-type door
69
+ * does for a chart type that folds rows.
70
+ */
71
+ export function isTypedWidthProfileFoldAllowed(label) {
72
+ const seconds = typedWidthSeconds(label);
73
+ if (seconds === undefined)
74
+ return false;
75
+ const bars = storedBarsPerTypedWidth(seconds);
76
+ return (bars <= TYPED_WIDTH_PROFILE_FOLD_MAX_STORED_BARS &&
77
+ (seconds % 86_400 !== 0 || seconds % 604_800 === 0 || bars === 2));
78
+ }
@@ -196,6 +196,15 @@ export interface WrunChartHostEnv {
196
196
  * draws). Absent: no read point composes anything, exactly as before the member (the sandbox worker and the phone
197
197
  * app never set it). wrun-session-composition.util is its one reader. */
198
198
  session?: WrunHostSession;
199
+ /** Optional, read wherever a chart surface names a line of a built-in's port (`wrunHostBuiltinLineWords` is its one
200
+ * reader, through utility/wrun/wrun-output-words.util `wrunOutputWords`). The words built-in `builtIn` names its
201
+ * line `label` by, in the viewer's language, or undefined when `label` is no line that built-in names. `label` is
202
+ * the output's sheet label as published: a proven twin's sheet keeps its kScript original's contract label there
203
+ * (MACD's `macdLine`, Bollinger Bands' `Lower Band`), the anchor its alerts match the line by, so the sheet cannot
204
+ * reword it. Absent, a blank answer or a call that throws: the line reads its sheet's words (wrunLegendName),
205
+ * exactly as before the member. web: the built-in's alert-contract output words (`builtinOutputI18nKey` through the
206
+ * i18n plugin), bound by the run binder. The sandbox worker and the phone app never set it. */
207
+ builtinLineWords?: (builtIn: string, label: string) => string | undefined;
199
208
  }
200
209
  /** A lane the host's session may compose: the tape (fill groups), the sided trades lane in contracts (`trades`) and
201
210
  * the same lane in US dollars (`trades_usd`). */
@@ -301,6 +310,12 @@ export interface WrunHostChart {
301
310
  /** 0.5.0, panel-mount binder. web: scheduleKScriptLiveChartPaint(chartIndex, tc, getLatestTc, opts)
302
311
  * (utility/chart/kscript-chart-paint.util.ts:106; web's live-paint wait map stays the owner, D-2c). */
303
312
  scheduleLivePaint(chartIndex: number, tc: WrunChartHandle, getLatestTc?: () => WrunChartHandle | null | undefined, options?: WrunChartPaintOptions): WrunChartPaintMode;
313
+ /** Optional, panel-mount binder. Run `run` (synchronous) with the host's history recording held off: the engine
314
+ * deletes the drawings on a pane the panel mount removes, one delete event each, and a host whose undo store records
315
+ * an engine delete as a step must not record those (Discord #138: one step per drawing, none of which could land).
316
+ * web: withoutUndoSteps(run) (store/undo-step-hold.ts). Absent: the call runs plainly (`wrunHostWithoutUndoSteps`
317
+ * is its one reader); the sandbox worker and the phone app never set it. */
318
+ withoutUndoSteps?<T>(run: () => T): T;
304
319
  /** 0.5.0, run. web: decideLocalKScriptLiveRefreshGate(args) (utility/chart/kscript-live-refresh-pace.util.ts:112;
305
320
  * kScript's gate maps stay web, D-2c). */
306
321
  decideLiveRefreshGate(args: {
@@ -625,6 +640,15 @@ export declare function wrunHostTapePerOrder(): boolean;
625
640
  * (`WrunChartHostEnv.carryWithBuild`): false for a host that never set the member, and before the realm's entry set
626
641
  * the env. Read at every run, never at module load. */
627
642
  export declare function wrunHostCarryWithBuild(): boolean;
643
+ /** The words built-in `builtIn` names its line `label` by (`WrunChartHostEnv.builtinLineWords`), or undefined: an env
644
+ * not set yet, a host without the member, an answer that holds no words, or a call that throws (the line keeps its
645
+ * sheet's words). Read when a surface names a line, never at module load; utility/wrun/wrun-output-words.util
646
+ * `wrunOutputWords` is its one reader. */
647
+ export declare function wrunHostBuiltinLineWords(builtIn: string, label: string): string | undefined;
648
+ /** Run `run` (synchronous) with the host's history recording held off (`WrunHostChart.withoutUndoSteps`): a host that
649
+ * never set the member, or a realm whose env is not set, runs it plainly. Read at the call, never at module load;
650
+ * wrun-panel-mount.util `removeChild` is its one reader. */
651
+ export declare function wrunHostWithoutUndoSteps<T>(run: () => T): T;
628
652
  /** The error a host's `sharedHost()` throws before its load. */
629
653
  export declare function wrunChartHostUnloadedError(): Error;
630
654
  /** The shared host now, or its load: `undefined` once the env's `sharedHost()` answers, else the env's
package/dist/host-env.js CHANGED
@@ -47,6 +47,28 @@ export function wrunHostTapePerOrder() {
47
47
  export function wrunHostCarryWithBuild() {
48
48
  return hasWrunChartHostEnv() && wrunChartHostEnv().carryWithBuild === true;
49
49
  }
50
+ /** The words built-in `builtIn` names its line `label` by (`WrunChartHostEnv.builtinLineWords`), or undefined: an env
51
+ * not set yet, a host without the member, an answer that holds no words, or a call that throws (the line keeps its
52
+ * sheet's words). Read when a surface names a line, never at module load; utility/wrun/wrun-output-words.util
53
+ * `wrunOutputWords` is its one reader. */
54
+ export function wrunHostBuiltinLineWords(builtIn, label) {
55
+ if (!hasWrunChartHostEnv())
56
+ return undefined;
57
+ try {
58
+ const words = wrunChartHostEnv().builtinLineWords?.(builtIn, label);
59
+ return typeof words === 'string' && words.trim() !== '' ? words : undefined;
60
+ }
61
+ catch {
62
+ return undefined;
63
+ }
64
+ }
65
+ /** Run `run` (synchronous) with the host's history recording held off (`WrunHostChart.withoutUndoSteps`): a host that
66
+ * never set the member, or a realm whose env is not set, runs it plainly. Read at the call, never at module load;
67
+ * wrun-panel-mount.util `removeChild` is its one reader. */
68
+ export function wrunHostWithoutUndoSteps(run) {
69
+ const chart = hasWrunChartHostEnv() ? wrunChartHostEnv().chart : undefined;
70
+ return typeof chart?.withoutUndoSteps === 'function' ? chart.withoutUndoSteps(run) : run();
71
+ }
50
72
  /** The error a host's `sharedHost()` throws before its load. */
51
73
  export function wrunChartHostUnloadedError() {
52
74
  return new Error('wrun_chart_host_unloaded');
@@ -865,6 +865,8 @@ export interface WrunIntegrateOptions {
865
865
  preserveMountedRowsOutsideWindow?: WrunPartialReplayWindow | null;
866
866
  suppressDrawings?: boolean;
867
867
  deferDrawingsToReplayLane?: boolean;
868
+ /** The result does not speak for the overlay's drawings: the mounted set and its record stay as they are. */
869
+ keepMountedDrawings?: boolean;
868
870
  postApply?: (runResult: unknown, sideEffects: WrunIntegrationSideEffects) => void;
869
871
  }
870
872
  /** The adapter's full integration answer (web: `SafeKScriptTitanChartsIntegrationResult`). */
@@ -896,6 +898,8 @@ export interface WrunRefreshRowsOptions {
896
898
  runInterval?: WrunOverlayRunInterval | null;
897
899
  suppressDrawings?: boolean;
898
900
  deferDrawingsToReplayLane?: boolean;
901
+ /** The result does not speak for the overlay's drawings: the mounted set and its record stay as they are. */
902
+ keepMountedDrawings?: boolean;
899
903
  ignoreUnmountedOutputKeys?: ReadonlySet<string>;
900
904
  mergeMountedRows?: boolean;
901
905
  liveTail?: WrunLiveTailWindow;
@@ -1288,6 +1292,13 @@ export interface WrunFailureShow {
1288
1292
  code: string;
1289
1293
  chip: string;
1290
1294
  };
1295
+ /** The source door's facts of a source it refused: the interval it judged, and the source's machine name the door
1296
+ * bounded (`unknown` for a name the build does not own). The builder (wrun-failure-shown.util) sends them only
1297
+ * when the interval is a typed width. */
1298
+ refused?: {
1299
+ interval?: unknown;
1300
+ source?: unknown;
1301
+ };
1291
1302
  }
1292
1303
  /** Loader view of the editor shell store: its open tabs (web: store/editor-shell.ts `useEditorShellStore`). */
1293
1304
  export interface WrunEditorShellModule {
package/dist/index.d.ts CHANGED
@@ -23,6 +23,8 @@ export * from './constants/scriptEditor/execution.constants.js';
23
23
  export * from './constants/scriptEditor/technicalIndicatorScriptKeys.constants.js';
24
24
  export * from './constants/stocks-compliance.constants.js';
25
25
  export * from './constants/tpo-color-schemes.constants.js';
26
+ export * from './constants/typed-width-fold.leaf.js';
27
+ export * from './constants/typed-width.leaf.js';
26
28
  export * from './constants/venue-presets.constants.js';
27
29
  export * from './constants/wrun-prefix-safe.constants.js';
28
30
  export * from './enums/chart.enum.js';
@@ -125,6 +127,7 @@ export * from './utility/chart/kscript-mounted-plot-set.leaf.js';
125
127
  export * from './utility/chart/kscript-output-role.util.js';
126
128
  export * from './utility/chart/kscript-perf-tracker.util.js';
127
129
  export * from './utility/chart/kscript-provenance-keys.util.js';
130
+ export * from './utility/chart/kscript-row-name.leaf.js';
128
131
  export * from './utility/chart/kscript-run-interval-projection.util.js';
129
132
  export * from './utility/chart/kscript-run-result-equality.util.js';
130
133
  export * from './utility/chart/kscript-run-result-normalize.util.js';
@@ -355,6 +358,7 @@ export * from './utility/wrun/wrun-option-views.util.js';
355
358
  export * from './utility/wrun/wrun-options-flow-underlying.leaf.js';
356
359
  export * from './utility/wrun/wrun-options-stop.util.js';
357
360
  export * from './utility/wrun/wrun-output-style.util.js';
361
+ export * from './utility/wrun/wrun-output-words.util.js';
358
362
  export * from './utility/wrun/wrun-overlay-drivers.util.js';
359
363
  export * from './utility/wrun/wrun-overlay-lifecycle.util.js';
360
364
  export * from './utility/wrun/wrun-overlay-metadata.util.js';
package/dist/index.js CHANGED
@@ -26,6 +26,8 @@ export * from './constants/scriptEditor/execution.constants.js';
26
26
  export * from './constants/scriptEditor/technicalIndicatorScriptKeys.constants.js';
27
27
  export * from './constants/stocks-compliance.constants.js';
28
28
  export * from './constants/tpo-color-schemes.constants.js';
29
+ export * from './constants/typed-width-fold.leaf.js';
30
+ export * from './constants/typed-width.leaf.js';
29
31
  export * from './constants/venue-presets.constants.js';
30
32
  export * from './constants/wrun-prefix-safe.constants.js';
31
33
  export * from './enums/chart.enum.js';
@@ -129,6 +131,7 @@ export * from './utility/chart/kscript-mounted-plot-set.leaf.js';
129
131
  export * from './utility/chart/kscript-output-role.util.js';
130
132
  export * from './utility/chart/kscript-perf-tracker.util.js';
131
133
  export * from './utility/chart/kscript-provenance-keys.util.js';
134
+ export * from './utility/chart/kscript-row-name.leaf.js';
132
135
  export * from './utility/chart/kscript-run-interval-projection.util.js';
133
136
  export * from './utility/chart/kscript-run-result-equality.util.js';
134
137
  export * from './utility/chart/kscript-run-result-normalize.util.js';
@@ -359,6 +362,7 @@ export * from './utility/wrun/wrun-option-views.util.js';
359
362
  export * from './utility/wrun/wrun-options-flow-underlying.leaf.js';
360
363
  export * from './utility/wrun/wrun-options-stop.util.js';
361
364
  export * from './utility/wrun/wrun-output-style.util.js';
365
+ export * from './utility/wrun/wrun-output-words.util.js';
362
366
  export * from './utility/wrun/wrun-overlay-drivers.util.js';
363
367
  export * from './utility/wrun/wrun-overlay-lifecycle.util.js';
364
368
  export * from './utility/wrun/wrun-overlay-metadata.util.js';
@@ -1,3 +1,4 @@
1
+ import type { WrunTrapKind, WrunTrapPhase } from './wrun-runtime.interface.js';
1
2
  export type RuntimeDiagnosticStage = 'resolve' | 'fetch' | 'compute' | 'render' | 'boundary';
2
3
  export type RuntimeDiagnosticSeverity = 'error' | 'warning' | 'info';
3
4
  export interface RuntimeDiagnostic {
@@ -34,6 +35,33 @@ export interface RuntimeDiagnostic {
34
35
  */
35
36
  cme?: true;
36
37
  }
38
+ /** What failed, decided from the trap record (never from the text): a std-lib check the host names
39
+ * (`index-out-of-range`, `key-not-found`, `array-empty`), the engine's `unreachable`, any other abort
40
+ * (`abort`: a throw, the author's abort()), any other engine trap (`native`), or a host refusal (`host`). */
41
+ export type WrunTrapReason = 'index-out-of-range' | 'key-not-found' | 'array-empty' | 'unreachable' | 'abort' | 'native' | 'host';
42
+ /** `details.trap` of a browser-run trap row (WRUN_ABORT, WRUN_UNREACHABLE_TRAP and the other run failure rows). */
43
+ export interface WrunTrapRowDetails {
44
+ kind: WrunTrapKind;
45
+ phase: WrunTrapPhase;
46
+ reason: WrunTrapReason;
47
+ /** The failing bar's epoch-ms timestamp; absent before bar processing starts. */
48
+ barTs?: number;
49
+ /** The library position the abort named (`~lib/array.ts:114:42`) when it is not the author's file. */
50
+ libSite?: string;
51
+ /** The replay seed's token (a sandbox full run or live start): the editor's trap replay takes the seed by it. */
52
+ token?: string;
53
+ /** Set once the editor's replay enriched the row (never replayed again): `full` (line, and function unless the
54
+ * source inlines), `names` (function names, no offsets: no line). */
55
+ replay?: 'full' | 'names';
56
+ /** The function the trap stopped in, as written in src/indicator.ts (absent when the attribution is uncertain). */
57
+ fn?: string;
58
+ /** The first mapped line of `fn` in src/indicator.ts (names only: where its one mark goes). */
59
+ fnLine?: number;
60
+ /** The caller's function and the line and column of its call. */
61
+ caller?: string;
62
+ callerLine?: number;
63
+ callerColumn?: number;
64
+ }
37
65
  /** `details` of a FE_KSCRIPT_PERF_SLOW row: what the chip and the compact card show. */
38
66
  export interface KScriptPerfSlowDetails {
39
67
  cost: 'render' | 'apply' | 'both';