@orangecharts/wrun-chart-host 0.1.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 (198) hide show
  1. package/README.md +72 -0
  2. package/dist/constants/governed-exchanges.constants.d.ts +11 -0
  3. package/dist/constants/governed-exchanges.constants.js +11 -0
  4. package/dist/constants/indicator-sets.constants.d.ts +8 -0
  5. package/dist/constants/indicator-sets.constants.js +8 -0
  6. package/dist/constants/interval.constants.d.ts +34 -0
  7. package/dist/constants/interval.constants.js +121 -0
  8. package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.d.ts +28 -0
  9. package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.js +65 -0
  10. package/dist/constants/tpo-color-schemes.constants.d.ts +30 -0
  11. package/dist/constants/tpo-color-schemes.constants.js +32 -0
  12. package/dist/host-env.d.ts +102 -0
  13. package/dist/host-env.js +26 -0
  14. package/dist/index.d.ts +93 -0
  15. package/dist/index.js +96 -0
  16. package/dist/indicators/controls/tpo-letter.util.d.ts +2 -0
  17. package/dist/indicators/controls/tpo-letter.util.js +13 -0
  18. package/dist/indicators/controls/tpo-session.util.d.ts +99 -0
  19. package/dist/indicators/controls/tpo-session.util.js +389 -0
  20. package/dist/interfaces/kscript-diagnostics.interface.d.ts +64 -0
  21. package/dist/interfaces/kscript-diagnostics.interface.js +1 -0
  22. package/dist/interfaces/om-panel-data.interface.d.ts +103 -0
  23. package/dist/interfaces/om-panel-data.interface.js +7 -0
  24. package/dist/interfaces/wrun-runtime.interface.d.ts +2659 -0
  25. package/dist/interfaces/wrun-runtime.interface.js +55 -0
  26. package/dist/utility/chart/calendar-interval.util.d.ts +24 -0
  27. package/dist/utility/chart/calendar-interval.util.js +81 -0
  28. package/dist/utility/chart/candle-bar-end.util.d.ts +15 -0
  29. package/dist/utility/chart/candle-bar-end.util.js +23 -0
  30. package/dist/utility/chart/cme-realtime.util.d.ts +24 -0
  31. package/dist/utility/chart/cme-realtime.util.js +53 -0
  32. package/dist/utility/chart/interval-ladder.util.d.ts +27 -0
  33. package/dist/utility/chart/interval-ladder.util.js +92 -0
  34. package/dist/utility/chart/kscript-drawing-prep.util.d.ts +40 -0
  35. package/dist/utility/chart/kscript-drawing-prep.util.js +184 -0
  36. package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +95 -0
  37. package/dist/utility/chart/kscript-drawing-safe-area.util.js +805 -0
  38. package/dist/utility/chart/kscript-legend-entries.util.d.ts +166 -0
  39. package/dist/utility/chart/kscript-legend-entries.util.js +538 -0
  40. package/dist/utility/chart/kscript-output-role.util.d.ts +32 -0
  41. package/dist/utility/chart/kscript-output-role.util.js +215 -0
  42. package/dist/utility/chart/kscript-provenance-keys.util.d.ts +22 -0
  43. package/dist/utility/chart/kscript-provenance-keys.util.js +56 -0
  44. package/dist/utility/chart/kscript-run-result-normalize.util.d.ts +53 -0
  45. package/dist/utility/chart/kscript-run-result-normalize.util.js +476 -0
  46. package/dist/utility/chart/kscript-run-result-shape.util.d.ts +14 -0
  47. package/dist/utility/chart/kscript-run-result-shape.util.js +66 -0
  48. package/dist/utility/chart/kscript-titancharts-container.util.d.ts +29 -0
  49. package/dist/utility/chart/kscript-titancharts-container.util.js +151 -0
  50. package/dist/utility/chart/kscript-viewport-overlays.util.d.ts +83 -0
  51. package/dist/utility/chart/kscript-viewport-overlays.util.js +443 -0
  52. package/dist/utility/chart/om-panel-push-style.util.d.ts +78 -0
  53. package/dist/utility/chart/om-panel-push-style.util.js +301 -0
  54. package/dist/utility/chart/om-panel.util.d.ts +166 -0
  55. package/dist/utility/chart/om-panel.util.js +815 -0
  56. package/dist/utility/chart/om-series.util.d.ts +42 -0
  57. package/dist/utility/chart/om-series.util.js +330 -0
  58. package/dist/utility/chart/om-target.util.d.ts +11 -0
  59. package/dist/utility/chart/om-target.util.js +24 -0
  60. package/dist/utility/chart/om-widget.util.d.ts +148 -0
  61. package/dist/utility/chart/om-widget.util.js +413 -0
  62. package/dist/utility/chart/overlay-output-budget.util.d.ts +16 -0
  63. package/dist/utility/chart/overlay-output-budget.util.js +109 -0
  64. package/dist/utility/chart/overlay-paint-flags.util.d.ts +24 -0
  65. package/dist/utility/chart/overlay-paint-flags.util.js +55 -0
  66. package/dist/utility/chart/profile-row-height.util.d.ts +21 -0
  67. package/dist/utility/chart/profile-row-height.util.js +110 -0
  68. package/dist/utility/chart/session-interval.util.d.ts +1 -0
  69. package/dist/utility/chart/session-interval.util.js +35 -0
  70. package/dist/utility/chart/technical-script-legend-value.util.d.ts +18 -0
  71. package/dist/utility/chart/technical-script-legend-value.util.js +53 -0
  72. package/dist/utility/chart/trading-day.util.d.ts +70 -0
  73. package/dist/utility/chart/trading-day.util.js +238 -0
  74. package/dist/utility/chart/wrun-legend-name.util.d.ts +25 -0
  75. package/dist/utility/chart/wrun-legend-name.util.js +87 -0
  76. package/dist/utility/chart/wrun-run-result.util.d.ts +977 -0
  77. package/dist/utility/chart/wrun-run-result.util.js +5179 -0
  78. package/dist/utility/chart/wrun-visibility-chart.util.d.ts +25 -0
  79. package/dist/utility/chart/wrun-visibility-chart.util.js +22 -0
  80. package/dist/utility/indicators/heatmap-sensitivity.util.d.ts +62 -0
  81. package/dist/utility/indicators/heatmap-sensitivity.util.js +82 -0
  82. package/dist/utility/number-format.util.d.ts +68 -0
  83. package/dist/utility/number-format.util.js +188 -0
  84. package/dist/utility/v2/opra-governed.util.d.ts +1 -0
  85. package/dist/utility/v2/opra-governed.util.js +13 -0
  86. package/dist/utility/wrun/wrun-auto-row.util.d.ts +54 -0
  87. package/dist/utility/wrun/wrun-auto-row.util.js +96 -0
  88. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +341 -0
  89. package/dist/utility/wrun/wrun-batched-marks.util.js +938 -0
  90. package/dist/utility/wrun/wrun-batched-readout.util.d.ts +75 -0
  91. package/dist/utility/wrun/wrun-batched-readout.util.js +171 -0
  92. package/dist/utility/wrun/wrun-box-segment.util.d.ts +185 -0
  93. package/dist/utility/wrun/wrun-box-segment.util.js +570 -0
  94. package/dist/utility/wrun/wrun-build-memo.util.d.ts +133 -0
  95. package/dist/utility/wrun/wrun-build-memo.util.js +301 -0
  96. package/dist/utility/wrun/wrun-builtin-twin-ports.util.d.ts +25 -0
  97. package/dist/utility/wrun/wrun-builtin-twin-ports.util.js +75 -0
  98. package/dist/utility/wrun/wrun-builtin-twin.util.d.ts +9 -0
  99. package/dist/utility/wrun/wrun-builtin-twin.util.js +40 -0
  100. package/dist/utility/wrun/wrun-canvas-cache.util.d.ts +28 -0
  101. package/dist/utility/wrun/wrun-canvas-cache.util.js +56 -0
  102. package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +69 -0
  103. package/dist/utility/wrun/wrun-canvas-readout.util.js +53 -0
  104. package/dist/utility/wrun/wrun-canvases.util.d.ts +295 -0
  105. package/dist/utility/wrun/wrun-canvases.util.js +1432 -0
  106. package/dist/utility/wrun/wrun-cap-notice.util.d.ts +77 -0
  107. package/dist/utility/wrun/wrun-cap-notice.util.js +296 -0
  108. package/dist/utility/wrun/wrun-card-style.util.d.ts +154 -0
  109. package/dist/utility/wrun/wrun-card-style.util.js +539 -0
  110. package/dist/utility/wrun/wrun-chart-context.util.d.ts +89 -0
  111. package/dist/utility/wrun/wrun-chart-context.util.js +213 -0
  112. package/dist/utility/wrun/wrun-chart-names.util.d.ts +23 -0
  113. package/dist/utility/wrun/wrun-chart-names.util.js +33 -0
  114. package/dist/utility/wrun/wrun-chart-time.util.d.ts +12 -0
  115. package/dist/utility/wrun/wrun-chart-time.util.js +23 -0
  116. package/dist/utility/wrun/wrun-child-overlay-id.util.d.ts +13 -0
  117. package/dist/utility/wrun/wrun-child-overlay-id.util.js +44 -0
  118. package/dist/utility/wrun/wrun-color-facts.util.d.ts +40 -0
  119. package/dist/utility/wrun/wrun-color-facts.util.js +88 -0
  120. package/dist/utility/wrun/wrun-color-settings.lazy.d.ts +26 -0
  121. package/dist/utility/wrun/wrun-color-settings.lazy.js +9 -0
  122. package/dist/utility/wrun/wrun-color-settings.util.d.ts +351 -0
  123. package/dist/utility/wrun/wrun-color-settings.util.js +1363 -0
  124. package/dist/utility/wrun/wrun-footprint-modes.util.d.ts +23 -0
  125. package/dist/utility/wrun/wrun-footprint-modes.util.js +24 -0
  126. package/dist/utility/wrun/wrun-frames.d.ts +217 -0
  127. package/dist/utility/wrun/wrun-frames.js +1021 -0
  128. package/dist/utility/wrun/wrun-handles.util.d.ts +792 -0
  129. package/dist/utility/wrun/wrun-handles.util.js +2050 -0
  130. package/dist/utility/wrun/wrun-heatmap-cell-budget.util.d.ts +156 -0
  131. package/dist/utility/wrun/wrun-heatmap-cell-budget.util.js +342 -0
  132. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +218 -0
  133. package/dist/utility/wrun/wrun-hosted-wire-caps.js +667 -0
  134. package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +40 -0
  135. package/dist/utility/wrun/wrun-hosted-wire.util.js +27 -0
  136. package/dist/utility/wrun/wrun-hover.util.d.ts +182 -0
  137. package/dist/utility/wrun/wrun-hover.util.js +534 -0
  138. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +246 -0
  139. package/dist/utility/wrun/wrun-hud-looks.util.js +587 -0
  140. package/dist/utility/wrun/wrun-integration-budget.util.d.ts +47 -0
  141. package/dist/utility/wrun/wrun-integration-budget.util.js +122 -0
  142. package/dist/utility/wrun/wrun-latest-snapshot.d.ts +19 -0
  143. package/dist/utility/wrun/wrun-latest-snapshot.js +7 -0
  144. package/dist/utility/wrun/wrun-levels-child.util.d.ts +131 -0
  145. package/dist/utility/wrun/wrun-levels-child.util.js +514 -0
  146. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +75 -0
  147. package/dist/utility/wrun/wrun-lifecycle.contract.js +9 -0
  148. package/dist/utility/wrun/wrun-market-facts.util.d.ts +116 -0
  149. package/dist/utility/wrun/wrun-market-facts.util.js +238 -0
  150. package/dist/utility/wrun/wrun-output-style.util.d.ts +344 -0
  151. package/dist/utility/wrun/wrun-output-style.util.js +1239 -0
  152. package/dist/utility/wrun/wrun-overlay-identity.util.d.ts +84 -0
  153. package/dist/utility/wrun/wrun-overlay-identity.util.js +142 -0
  154. package/dist/utility/wrun/wrun-overlay-result.util.d.ts +120 -0
  155. package/dist/utility/wrun/wrun-overlay-result.util.js +219 -0
  156. package/dist/utility/wrun/wrun-pack.util.d.ts +70 -0
  157. package/dist/utility/wrun/wrun-pack.util.js +301 -0
  158. package/dist/utility/wrun/wrun-pane-format.util.d.ts +180 -0
  159. package/dist/utility/wrun/wrun-pane-format.util.js +299 -0
  160. package/dist/utility/wrun/wrun-panel-style.lazy.d.ts +25 -0
  161. package/dist/utility/wrun/wrun-panel-style.lazy.js +15 -0
  162. package/dist/utility/wrun/wrun-panel-style.util.d.ts +174 -0
  163. package/dist/utility/wrun/wrun-panel-style.util.js +726 -0
  164. package/dist/utility/wrun/wrun-param-values.util.d.ts +69 -0
  165. package/dist/utility/wrun/wrun-param-values.util.js +230 -0
  166. package/dist/utility/wrun/wrun-refusal.util.d.ts +263 -0
  167. package/dist/utility/wrun/wrun-refusal.util.js +1259 -0
  168. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +199 -0
  169. package/dist/utility/wrun/wrun-registry-errors.util.js +257 -0
  170. package/dist/utility/wrun/wrun-render-select.util.d.ts +336 -0
  171. package/dist/utility/wrun/wrun-render-select.util.js +1157 -0
  172. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +434 -0
  173. package/dist/utility/wrun/wrun-script-inputs.util.js +1971 -0
  174. package/dist/utility/wrun/wrun-setting-words.lazy.d.ts +20 -0
  175. package/dist/utility/wrun/wrun-setting-words.lazy.js +9 -0
  176. package/dist/utility/wrun/wrun-setting-words.util.d.ts +79 -0
  177. package/dist/utility/wrun/wrun-setting-words.util.js +176 -0
  178. package/dist/utility/wrun/wrun-socket-row-store.d.ts +98 -0
  179. package/dist/utility/wrun/wrun-socket-row-store.js +417 -0
  180. package/dist/utility/wrun/wrun-style-flags.util.d.ts +18 -0
  181. package/dist/utility/wrun/wrun-style-flags.util.js +21 -0
  182. package/dist/utility/wrun/wrun-style-words.util.d.ts +148 -0
  183. package/dist/utility/wrun/wrun-style-words.util.js +439 -0
  184. package/dist/utility/wrun/wrun-table-look.util.d.ts +125 -0
  185. package/dist/utility/wrun/wrun-table-look.util.js +225 -0
  186. package/dist/utility/wrun/wrun-text-look.util.d.ts +51 -0
  187. package/dist/utility/wrun/wrun-text-look.util.js +227 -0
  188. package/dist/utility/wrun/wrun-text-params.util.d.ts +106 -0
  189. package/dist/utility/wrun/wrun-text-params.util.js +171 -0
  190. package/dist/utility/wrun/wrun-tpo-rows.util.d.ts +71 -0
  191. package/dist/utility/wrun/wrun-tpo-rows.util.js +438 -0
  192. package/dist/utility/wrun/wrun-twin-compute-inputs.util.d.ts +14 -0
  193. package/dist/utility/wrun/wrun-twin-compute-inputs.util.js +58 -0
  194. package/dist/utility/wrun/wrun-visibility-table.d.ts +437 -0
  195. package/dist/utility/wrun/wrun-visibility-table.js +237 -0
  196. package/dist/utility/wrun/wrun-volume-profile.util.d.ts +37 -0
  197. package/dist/utility/wrun/wrun-volume-profile.util.js +278 -0
  198. package/package.json +38 -0
@@ -0,0 +1,341 @@
1
+ /**
2
+ * Batched marks (WRUN-BATCHED-MARKS-PLAN, the frontend side): a wrun indicator's `marks`, `spans`
3
+ * and `rays` sections, each N records a bar riding plain data-only outputs, mounted as ROW-BACKED
4
+ * child overlays (`<parent>::marks:<name>`, `::spans:<name>`, `::rays:<name>`), like the grid
5
+ * heatmap child (docs/features/kscript/wrun/wrun-batched-marks.md).
6
+ *
7
+ * - Sections (`readWrunBatchedSections`): read by INDEX, never by name. A section's outputs start at
8
+ * `first_output` and run `slots * stride` contiguous declared outputs, every one data-only (plot
9
+ * ""), owned by no other section, inside the 256 a sheet declares; a section that breaks any of it
10
+ * refuses the run by name ("WRUN <id>: marks 'trades': ..."), like every malformed sheet section.
11
+ * - The timed layout (WRUN-MARKS-CONTRACT F2): a spans or rays section at `stride: 5`
12
+ * holds `[top|y1, bottom|y2, startTs, endTs, meta]` a slot, the record running between two
13
+ * timestamps the script knows (exact on the chart's grid, where a bar count is not). The script
14
+ * writes epoch SECONDS; the row copy (`wrunBatchedRowsOf`) converts them to milliseconds, the
15
+ * engine's unit, exactly once: no other seam converts a time.
16
+ * - The gate (`wrunBatchedLayoutVerdict`, round-1 finding 17): before anything paints, each section's
17
+ * declaration is checked against the vocabulary this chart reads (cached per declaration): a stride
18
+ * it does not know (marks 3, spans and rays 4 or 5), a key it does not know, or an option value it
19
+ * does not know under a known key refuses THAT section's child by name ("Needs a newer chart",
20
+ * the engine gate's row, wrun-panel-mount.util), never the Indicator; the chart's own `visible`
21
+ * and the legacy `shape` are admitted. The row copy checks each filled slot's meta too (an empty
22
+ * slot's is never read): a meta packing a field past the ones this chart decodes refuses the child
23
+ * the same way.
24
+ * - Rows (`wrunBatchedRowsOf`): one child row per parent row, `[ts, ...fields]`, width `1 + slots *
25
+ * stride`, a field that is not finite NaN (a NaN price is an empty slot), a non-ready row all NaN.
26
+ * An all-NaN row still carries its timestamp: on a live tick it clears the bar's records. A row is
27
+ * keyed by its own (anchor) time everywhere a seam cuts rows (the budget, the window landing, the
28
+ * live tail, the replay cut): a timed record that starts before the window's first bar is kept.
29
+ * - The cell budget (WRUN_BATCHED_MARKS_CELL_BUDGET, 2,000,000): ONE budget per Indicator bounding the
30
+ * CHILD copies of its batched children, every kind, retained history and live appends alike, the
31
+ * heatmap budget's shape (wrun-heatmap-cell-budget.util). A cell is one scalar and a kept bar costs
32
+ * its child row and nothing else (`wrunBatchedBarCells`, 1 + slots x stride, empty slots included:
33
+ * 97 for Big Trades 0.4.0). Two things are NOT charged: the parent run's section columns (they are
34
+ * the run's result rows, which the worker's run-cells guard WRUN_MAX_RUN_CELLS bounds before its
35
+ * buffer, and trimming a child cannot release them), and the replacement overlap of a full replace
36
+ * (the old copy goes at the swap: a replace keeps the hard allowance, as a heatmap's hand-off does).
37
+ * This deviates from the plan's round-2 fold 4, which charged both (a program decision of the review
38
+ * round: charging them cut every rerun of a 7-day 1m chart to 6,896 bars and saved no memory). A
39
+ * full build charges BEFORE any copy: the sections' demands are water-filled over the cap and each
40
+ * builds its newest bars that fit (`wrunBatchedMarksChildren`); the mount then charges the live
41
+ * appends with hysteresis (cut back to 95% of the allowance), the window landings and the replay
42
+ * cuts (the ledger below), oldest bars first, and the Indicator's one "Cells capped" row reports the
43
+ * child cells against the cap (wrun-cap-notice.util, shared with the heatmaps).
44
+ * - Look and hover: the child's settings carry the section's look as the sheet (painted by the
45
+ * settings seam) holds it, in the param-native units of round-2 fold 1, colours as words or packed
46
+ * numbers until the mount door resolves them against the theme (`wrunBatchedChildConfig`); a look
47
+ * key the section leaves out takes the kit's default (`LOOK_DEFAULTS`: a published sheet carries
48
+ * every key, an older or hand-written one draws with the defaults instead of refusing); a
49
+ * section with a `tooltip` carries its readout on the child itself, with the template's text
50
+ * (wrun-batched-readout.util, re-exported here) as the readout's `text`, so every registration of
51
+ * it keeps the hover text (the mount door's, and the mount's re-registration after a pass that
52
+ * failed part way); the boot-path hover inspector calls it through the thin registry and never
53
+ * imports this module.
54
+ */
55
+ import type { WrunBatchedMarksKind, WrunBatchedSection, WrunIndicatorMetadata, WrunOutputRow } from '../../interfaces/wrun-runtime.interface.js';
56
+ import { type WrunCellsCapSummary } from './wrun-cap-notice.util.js';
57
+ import { type WrunCanvasReadout } from './wrun-canvas-readout.util.js';
58
+ import { wrunCanvasMergeLive } from './wrun-canvases.util.js';
59
+ import { type WrunColorTheme } from './wrun-style-words.util.js';
60
+ export { decodeWrunMarkMeta, decodeWrunSpanMeta, formatWrunBatchedNumber, wrunBatchedReadoutText, WRUN_MARK_META_MAX_OFFSET_MS, type WrunBatchedNumberFormat, type WrunMarkMeta, type WrunSpanMeta, } from './wrun-batched-readout.util.js';
61
+ export type { WrunBatchedHoverRecord } from './wrun-canvas-readout.util.js';
62
+ /** The three kinds, in mount order: each a sheet key, a child id kind and the engine plot type. */
63
+ export declare const WRUN_BATCHED_MARKS_KINDS: ReadonlyArray<WrunBatchedMarksKind>;
64
+ /** The fields of one record, per kind: marks `[price, qty, meta]`, spans `[top, bottom, length,
65
+ * meta]`, rays `[y1, y2, length, meta]`. */
66
+ export declare const WRUN_BATCHED_STRIDE: Readonly<Record<WrunBatchedMarksKind, number>>;
67
+ /** One slot's fields in output order, per kind (the kit's WRUN_BATCHED_FIELDS). */
68
+ export declare const WRUN_BATCHED_FIELDS: Readonly<Record<WrunBatchedMarksKind, readonly string[]>>;
69
+ /** The kinds that also take the timed layout (the kit's WRUN_BATCHED_TIMED_KINDS). */
70
+ export declare const WRUN_BATCHED_TIMED_KINDS: ReadonlyArray<'spans' | 'rays'>;
71
+ /** The stride of a timed section: the sheet says `stride: 5` (the kit's WRUN_BATCHED_TIMED_STRIDE). */
72
+ export declare const WRUN_BATCHED_TIMED_STRIDE = 5;
73
+ /** A timed slot's fields in output order (the kit's WRUN_BATCHED_TIMED_FIELDS): start and end are
74
+ * epoch seconds in the outputs and milliseconds in the child rows (the row copy converts them). */
75
+ export declare const WRUN_BATCHED_TIMED_FIELDS: Readonly<Record<'spans' | 'rays', readonly string[]>>;
76
+ /** Whether a section of `kind` at `stride` takes the timed layout: spans or rays at stride 5. */
77
+ export declare function isWrunBatchedTimedLayout(kind: WrunBatchedMarksKind, stride: unknown): boolean;
78
+ /** One slot's fields for a section of `kind` at `stride` (the kit's `wrunBatchedSectionFields`): the
79
+ * timed fields at stride 5 on spans and rays, WRUN_BATCHED_FIELDS otherwise. */
80
+ export declare function wrunBatchedSectionFields(kind: WrunBatchedMarksKind, stride: unknown): readonly string[];
81
+ /** The records a section holds a bar at most. */
82
+ export declare const WRUN_BATCHED_MAX_SLOTS = 64;
83
+ /** The outputs a sheet declares at most (the ABI's 256 a row): a section ends inside them. */
84
+ export declare const WRUN_BATCHED_MAX_OUTPUTS = 256;
85
+ /** A hover template's longest text. */
86
+ export declare const WRUN_BATCHED_TOOLTIP_MAX_CHARS = 200;
87
+ export declare function isWrunBatchedMarksKind(kind: unknown): kind is WrunBatchedMarksKind;
88
+ /** A batched child's id: `<overlayId>::<kind>:<name>`. */
89
+ export declare function wrunBatchedChildId(overlayId: string, kind: WrunBatchedMarksKind, name: string): string;
90
+ /** One section as the chart reads it: its geometry and the declaration (the painted sheet's). */
91
+ export interface WrunBatchedSectionSpec {
92
+ kind: WrunBatchedMarksKind;
93
+ name: string;
94
+ slots: number;
95
+ /** The index of its first output; the record of slot `i` reads outputs `firstOutput + stride * i`
96
+ * through `+ stride - 1`. */
97
+ firstOutput: number;
98
+ stride: number;
99
+ declaration: WrunBatchedSection;
100
+ /** Why this chart cannot draw the section (its declaration names a layout newer than this build:
101
+ * a stride, a key or an option value the gate does not know), absent when it can. Its child is
102
+ * refused by name ("Needs a newer chart") and the rest of the Indicator runs; the geometry above
103
+ * is then a placeholder (the section's outputs are never read). */
104
+ newer?: string;
105
+ }
106
+ /** The sheet slice the sections are read from. */
107
+ export type WrunBatchedSheet = Pick<WrunIndicatorMetadata, 'id' | 'outputs'> & Partial<Pick<WrunIndicatorMetadata, 'marks' | 'spans' | 'rays'>>;
108
+ /** The cells one kept bar of a section costs: its child row, the timestamp and every field of every
109
+ * slot (`1 + slots * stride`), and nothing else (the parent run's columns and a replace's old copy
110
+ * are not charged; the header says why). Empty slots count: the row is as wide as the section. */
111
+ export declare function wrunBatchedBarCells(spec: Pick<WrunBatchedSectionSpec, 'slots' | 'stride'>): number;
112
+ /**
113
+ * The sheet's batched sections in mount order (marks, spans, rays; each list in its order),
114
+ * validated against the sheet's outputs BY INDEX: `slots` a whole number from 1 to 64, `stride` one
115
+ * the gate admits (marks 3; spans and rays 4, or 5 for the timed layout), `first_output` a whole
116
+ * number, and outputs `first_output` through `first_output + slots * stride - 1` declared,
117
+ * contiguous, data-only (plot ""), inside the 256 a sheet declares and owned by no other section; a
118
+ * unique name; declared colours the kind takes (left out, the kit's default colours draw); a tooltip
119
+ * of at most 200 characters. Anything else refuses the run by name (thrown). A section whose
120
+ * declaration names a layout newer than this chart (`wrunBatchedLayoutVerdict`: a stride, a key or an
121
+ * option value it does not know) refuses nothing here: it is read with its reason (`newer`), its
122
+ * outputs unread, and its child alone is refused at the mount. A section the Style row switched off
123
+ * is read too (a malformed section refuses on every run, drawn or not).
124
+ */
125
+ export declare function readWrunBatchedSections(sheet: WrunBatchedSheet): WrunBatchedSectionSpec[];
126
+ /** True when the sheet declares any batched section (a non-empty list of any kind). */
127
+ export declare function wrunSheetHasBatchedMarks(sheet: Partial<Record<WrunBatchedMarksKind, unknown>> | undefined): boolean;
128
+ /** What a row copy found among the records it copied (`wrunBatchedRowsOf`, asked by the build). */
129
+ export interface WrunBatchedRowsAudit {
130
+ /** The first filled slot whose meta packs a field this chart does not decode (a newer writer's):
131
+ * the child's refusal, "Needs a newer chart". An empty slot's meta is never read. */
132
+ newer?: string;
133
+ }
134
+ /**
135
+ * The child rows of a section from the parent's rows `fromIndex` onward, by index: `[ts, ...fields]`,
136
+ * width `1 + slots * stride`, a field that is not finite NaN, a non-ready row all NaN (it still
137
+ * carries its timestamp). A row with no finite timestamp has no place and is skipped. A timed
138
+ * section's start and end (stride 5) are copied from epoch seconds to epoch ms here, once: the child
139
+ * rows, everything that cuts them and the engine read milliseconds. With an `audit`, each filled
140
+ * slot's meta is checked in the same pass (`WrunBatchedRowsAudit`).
141
+ */
142
+ export declare function wrunBatchedRowsOf(spec: Pick<WrunBatchedSectionSpec, 'kind' | 'slots' | 'stride' | 'firstOutput'>, outputRows: ReadonlyArray<WrunOutputRow>, fromIndex?: number, audit?: WrunBatchedRowsAudit): number[][];
143
+ /** The index of the first parent row at or after `fromTs`, walked back from the newest row (rows are
144
+ * in timestamp order), so a tick's tail costs its own rows and never the history. */
145
+ export declare function wrunBatchedTailStart(outputRows: ReadonlyArray<{
146
+ ts: number;
147
+ }>, fromTs: number): number;
148
+ /** What a full build charged a section (the cell budget, before any copy was built). */
149
+ export interface WrunBatchedBuildBudget {
150
+ /** Cells and bars every row of the run asks for. */
151
+ demand: number;
152
+ demandBars: number;
153
+ /** The section's water-filled share of the cap over this run's sections. */
154
+ share: number;
155
+ /** Cells and bars the build kept: the newest bars under the share. */
156
+ cells: number;
157
+ bars: number;
158
+ }
159
+ /** A batched child of the indicator (the run result's child union): its rows, the engine settings
160
+ * with the colours unresolved, its readout, and what the build charged. */
161
+ export interface WrunBatchedChildOverlay {
162
+ kind: WrunBatchedMarksKind;
163
+ name: string;
164
+ /** `[ts, ...fields]` per bar, width `1 + slots * stride`. */
165
+ data: number[][];
166
+ settings: Record<string, unknown>;
167
+ readout?: WrunCanvasReadout;
168
+ /** A live tick's changed tail (`tailFromTs`): every row the tick re-evaluated, which the mount
169
+ * merges row by row into the mounted child and never mounts or swaps in. */
170
+ tailOnly?: true;
171
+ /** A full build's charge; absent on a tail. */
172
+ budget?: WrunBatchedBuildBudget;
173
+ /** Why this chart cannot draw the child (a layout newer than this build: its section's declaration,
174
+ * or a record's meta), absent when it can: the mount refuses it by name ("Needs a newer chart", the
175
+ * engine gate's row), never mounts it, and the Indicator's other children run; `data` is empty. */
176
+ newer?: string;
177
+ }
178
+ /**
179
+ * Why this chart cannot draw a section of `kind` (the gate, round-1 finding 17), null when it can: a
180
+ * stride it does not know (marks 3; spans and rays 4, or 5 for the timed layout), a key it does not
181
+ * know, or an option value it does not know under a known key, nested keys included (`size`, `text`,
182
+ * `border`). The section's child is refused by name ("Needs a newer chart") and the Indicator's other
183
+ * children run: the next layout change is caught here as the timed one would have been. The reason is
184
+ * diagnostic text (the notice row's details), never copy. Read once per section (cached).
185
+ *
186
+ * The declaration the package wrote is judged BEFORE the look the settings paint on it (WRUN-MARKS-
187
+ * CONTRACT F2, finding 4): the builders read the painted sheet, and a saved Style row writes only values
188
+ * this chart reads, so judging the painted copy alone would let a setting hide a declaration this chart
189
+ * cannot draw (a saved `line_style: 'solid'` over a declared `'wavy'`). A painted section reaches its
190
+ * declaration through the painter (`wrunPaintedDeclarationOf`), whose verdict is cached on the
191
+ * declaration itself, so a pan or a tick that paints it again judges it once; the painted copy is judged
192
+ * after it (a param bound through `style_targets` may paint a value this chart does not read).
193
+ */
194
+ export declare function wrunBatchedLayoutVerdict(kind: WrunBatchedMarksKind, section: Record<string, unknown>): string | null;
195
+ /** The engine settings of a section's child: the geometry (`slots`, `stride`; `first_output` stays
196
+ * here, the child rows start at field 0), the look of its kind, and `hoverReadout` when a tooltip is
197
+ * declared (the engine registers its drawn records for hover then). Colours stay as declared. */
198
+ export declare function wrunBatchedSettingsOf(spec: WrunBatchedSectionSpec): Record<string, unknown>;
199
+ /** What a build of the batched children takes beside the sheet and the rows. */
200
+ export interface WrunBatchedChildrenOptions {
201
+ /** A live tick's changed tail: the timestamp the tick re-evaluated from (the previous forming bar's,
202
+ * the session's watermark). Each child is built from the parent rows at or after it only (walked
203
+ * back from the newest), charges nothing and is marked `tailOnly`. */
204
+ tailFromTs?: number;
205
+ }
206
+ /**
207
+ * One child per batched section the Style rows leave visible, in mount order. A full build charges
208
+ * the cell budget before any copy: every section's demand (its bars times its bar cells) is
209
+ * water-filled over WRUN_BATCHED_MARKS_CELL_BUDGET and each section builds only its newest bars that
210
+ * fit its share (the child carries the charge in `budget`), cut by each row's own (anchor) time: a
211
+ * timed record kept with its bar may start long before it. A tail build (`tailFromTs`) builds every
212
+ * row the tick re-evaluated and nothing older. A section the gate refused (`newer`) builds a refused
213
+ * child and asks no share; a record whose meta the copy cannot decode refuses its child the same way,
214
+ * and its share goes back to the cap: the shares are water-filled again over the children still drawn,
215
+ * each copying the older bars its grown share reaches (audited as the rest were), until no copy refuses
216
+ * another child (WRUN-MARKS-CONTRACT F2, finding 6).
217
+ */
218
+ export declare function wrunBatchedMarksChildren(sheet: WrunBatchedSheet, outputRows: ReadonlyArray<WrunOutputRow>, options?: WrunBatchedChildrenOptions): WrunBatchedChildOverlay[];
219
+ /** A section colour as the engine draws it: a colour word resolved against the theme; a packed
220
+ * number decoded (a packed theme token through its word, the existing packed-colour decode for the
221
+ * rest); undefined when it is neither. */
222
+ export declare function resolveWrunBatchedColor(value: unknown, theme: WrunColorTheme): string | undefined;
223
+ export interface WrunBatchedChildConfig {
224
+ id: string;
225
+ plot: WrunBatchedMarksKind;
226
+ type: 'onchart';
227
+ settings: Record<string, unknown>;
228
+ /** The live merge (titan `mergeLiveDataPoint`): a row replaces the bar it names, a newer one
229
+ * appends. */
230
+ mergeLiveDataPoint: typeof wrunCanvasMergeLive;
231
+ tailOnly?: true;
232
+ }
233
+ /**
234
+ * The engine config of a batched child at its mount (and every retranslate): the id, the plot (the
235
+ * kind), the settings with every colour resolved against the chart's theme, the live merge. A child
236
+ * with a readout registers it for the hover inspector as the child carries it (its template's text
237
+ * as `text`); one without forgets any it had. A timed readout first takes the display offset its
238
+ * `{{start}}` and `{{end}}` print in (`timeOffsetMs`: the chart's display timezone, none on daily and
239
+ * longer bars), stamped on the child's own readout so every registration of it keeps it; a timezone
240
+ * switch retranslates, which stamps it again.
241
+ */
242
+ export declare function wrunBatchedChildConfig(child: WrunBatchedChildOverlay, ctx: {
243
+ overlayId: string;
244
+ theme: WrunColorTheme;
245
+ timeOffsetMs?: number;
246
+ }): WrunBatchedChildConfig;
247
+ /** A batched child's geometry read off its settings (the mount's budget and the window landing). */
248
+ export declare function wrunBatchedGeometryOf(settings: Record<string, unknown>): {
249
+ slots: number;
250
+ stride: number;
251
+ };
252
+ /** The chart the ledger reads its mounted children from (any engine instance). */
253
+ export interface WrunBatchedBudgetChart {
254
+ metadata: ReadonlyArray<{
255
+ id: string;
256
+ }>;
257
+ }
258
+ /** Which children the Indicator holds: the mount's own records when the seam knows them (a child
259
+ * about to be installed is one), else the chart's overlays. */
260
+ export type WrunBatchedMountedReader = (childId: string) => boolean;
261
+ /** What one mounted batched child holds and last asked for, in cells (bar cells each). */
262
+ export interface WrunBatchedChildCells {
263
+ demand: number;
264
+ demandBars: number;
265
+ mounted: number;
266
+ mountedBars: number;
267
+ }
268
+ /** The geometry a seam charges a child's rows by: the cells of one kept bar (its child row). */
269
+ export interface WrunBatchedCharge {
270
+ barCells: number;
271
+ }
272
+ /** A child's charge from its engine settings (`slots`, `stride`). */
273
+ export declare function wrunBatchedChargeOf(settings: Record<string, unknown>): WrunBatchedCharge;
274
+ /**
275
+ * The rows a seam hands a batched child in full (the first install, a full run's replace): the build
276
+ * already kept the newest bars under the section's share of the cap (`built`, charged over every
277
+ * section of the run, which replaces them all), else the child's water-filled share beside its
278
+ * siblings' last demands applies. A replace keeps the hard allowance, like a heatmap's hand-off: the
279
+ * old copy it replaces is released at the swap and never charged. Past the allowance the oldest bars
280
+ * are dropped. Returns the rows to hand the engine (`rows` itself when they fit).
281
+ */
282
+ export declare function budgetWrunBatchedRows(tc: WrunBatchedBudgetChart, overlayId: string, childId: string, rows: ReadonlyArray<unknown>, charge: WrunBatchedCharge, options: {
283
+ built?: WrunBatchedBuildBudget;
284
+ isMounted?: WrunBatchedMountedReader;
285
+ }): ReadonlyArray<unknown>;
286
+ /**
287
+ * After a live merge into a mounted batched child (the changed tail replaced and appended), or a
288
+ * rebuild from the rows it held: its retained rows counted again, the merge's growth joining its
289
+ * demand, and past its allowance the oldest bars dropped down to the watermark (95%, so the bars
290
+ * after it land in place; the newest bar never goes while it fits). Returns the shorter rows for the
291
+ * seam to hand the engine, or null when the retained rows fit.
292
+ */
293
+ export declare function budgetWrunBatchedRetained(tc: WrunBatchedBudgetChart, overlayId: string, childId: string, retained: ReadonlyArray<unknown>, charge: WrunBatchedCharge, isMounted?: WrunBatchedMountedReader): ReadonlyArray<unknown> | null;
294
+ /** A history-window landing's budget (a pan-back page or a prefix run landed inside its window),
295
+ * planned apart from its ledger write so a prepared landing writes only when it commits. */
296
+ export interface WrunBatchedMergePlan {
297
+ readonly overlayId: string;
298
+ readonly childId: string;
299
+ readonly charge: WrunBatchedCharge;
300
+ /** The merged rows the plan cut. */
301
+ readonly merged: ReadonlyArray<unknown>;
302
+ /** The rows to hand the engine: the newest bars whole (`merged` itself when they fit). */
303
+ readonly rows: ReadonlyArray<unknown>;
304
+ readonly cells: Readonly<WrunBatchedChildCells>;
305
+ /** The ledger entries the plan read, by identity. */
306
+ readonly basis: ReadonlyMap<string, WrunBatchedChildCells>;
307
+ }
308
+ /**
309
+ * The budget of a history-window merge, writing nothing: the merged rows start from the rows the
310
+ * child holds (which its allowance already cut), so the demand carries what the earlier rows asked
311
+ * for, the merge's growth joining it; the rows are cut to the hard allowance, oldest first (the
312
+ * mounted rows a pass row replaces go at the swap and are not charged, as on a run's replace).
313
+ */
314
+ export declare function planWrunBatchedMerged(tc: WrunBatchedBudgetChart, overlayId: string, childId: string, merged: ReadonlyArray<unknown>, charge: WrunBatchedCharge, isMounted?: WrunBatchedMountedReader): WrunBatchedMergePlan;
315
+ /** The plan as the ledger stands now: `plan` itself while no seam wrote an entry it read, else the
316
+ * same merged rows planned again. */
317
+ export declare function currentWrunBatchedPlan(tc: WrunBatchedBudgetChart, plan: WrunBatchedMergePlan, isMounted?: WrunBatchedMountedReader): WrunBatchedMergePlan;
318
+ /** The ledger write of a plan whose rows the engine was just handed. */
319
+ export declare function commitWrunBatchedPlan(tc: WrunBatchedBudgetChart, plan: WrunBatchedMergePlan, isMounted?: WrunBatchedMountedReader): void;
320
+ /** The Indicator's other batched children now over their share (a sibling just mounted or asked for
321
+ * more): the seam trims each through `budgetWrunBatchedRetained`. */
322
+ export declare function wrunBatchedChildrenOverShare(tc: WrunBatchedBudgetChart, overlayId: string, except: string, isMounted?: WrunBatchedMountedReader): string[];
323
+ /** After a live append grew one child: while the Indicator's mounted cells pass the cap, the siblings
324
+ * now over their share; under the cap nothing is named (one sum per tick). */
325
+ export declare function wrunBatchedSiblingsToRebalance(tc: WrunBatchedBudgetChart, overlayId: string, grown: string, isMounted?: WrunBatchedMountedReader): string[];
326
+ /**
327
+ * A replay cut (wrun-replay-rows.util): the child now holds `rows`, which the replay means it to hold,
328
+ * so its demand is them too (a cut is no cap). Written synchronously with the cut.
329
+ */
330
+ export declare function noteWrunBatchedRowsCut(tc: WrunBatchedBudgetChart, overlayId: string, childId: string, rows: ReadonlyArray<unknown>, charge: WrunBatchedCharge): void;
331
+ /** A child that left the chart takes its entry with it. */
332
+ export declare function forgetWrunBatchedCells(tc: WrunBatchedBudgetChart, overlayId: string, childId: string): void;
333
+ /** An Indicator's ledger as it stood, entries by identity: what a landing transaction puts back. */
334
+ export type WrunBatchedLedgerSnapshot = ReadonlyMap<string, WrunBatchedChildCells> | null;
335
+ export declare function snapshotWrunBatchedLedger(tc: WrunBatchedBudgetChart, overlayId: string): WrunBatchedLedgerSnapshot;
336
+ export declare function restoreWrunBatchedLedger(tc: WrunBatchedBudgetChart, overlayId: string, snapshot: WrunBatchedLedgerSnapshot): void;
337
+ /** The Indicator's batched cells as the notice reads them: the mounted total, and the capped summary
338
+ * while a child holds fewer cells than it asked for. */
339
+ export declare function wrunBatchedCellSummary(tc: WrunBatchedBudgetChart, overlayId: string): WrunCellsCapSummary;
340
+ /** The trim watermark the live seams cut a retained child back to (the heatmap budget's). */
341
+ export declare const WRUN_BATCHED_TRIM_WATERMARK = 0.95;