@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,2659 @@
1
+ /**
2
+ * Browser WRUN runtime wire types: the packed request/response protocol
3
+ * between the main-thread host (`wrun-host.service.ts`) and the sandbox
4
+ * worker (`wrun-engine.worker.ts`), plus the parsed package metadata sheet.
5
+ *
6
+ * The protocol mirrors the om daemon's packed worker transport
7
+ * (openmarket docs/WRUN2_ABI.md, "Row transport and the packed worker
8
+ * protocol") so a package behaves identically under both hosts:
9
+ * - Request: `ts` (Float64Array), `argCounts` (Int32Array, each row's
10
+ * ORIGINAL argument count), `values` (Float64Array, row-major at a fixed
11
+ * stride), `cellIndexes` (declared celled slots), `cellLens`/`cellOffsets`
12
+ * (Int32Array, row-major over the celled slots, length -1 = missing
13
+ * block), `cells` (every block laid end to end), and `stringMaxBytes`
14
+ * when string slots are declared.
15
+ * - Response: `ready` (Uint8Array) + `outputs` (Float64Array, row-major at
16
+ * the output count), plus the packed string table when slots are declared.
17
+ * - Every buffer is transferred, never structured-cloned; the compiled
18
+ * `WebAssembly.Module` itself IS structured-cloned (browser spec allows
19
+ * sharing compiled modules across agents in one cluster).
20
+ */
21
+ import type { WrunHandleDefaultsByKind, WrunHandleKind, WrunHandleRecord, WrunLabelPosition, WrunTextStyle } from '../utility/wrun/wrun-handles.util.js';
22
+ import type { WrunParamHostFill, WrunWarmupWindow } from '@orangecharts/indicator-kit';
23
+ import type { CardAnchor } from '../utility/chart/om-widget.util.js';
24
+ import type { ParsedPanel } from '../utility/chart/om-panel.util.js';
25
+ import type { WrunMiniChartsDrawing } from '@orangecharts/indicator-kit/host';
26
+ /** ABI capabilities accumulate: wrun-2 adds strings and cells, wrun-3
27
+ * adds drawings and strategy, wrun-4 adds run-level frame snapshots,
28
+ * wrun-5 adds the text channel (a typed text setting's UTF-8 bytes, read
29
+ * in init(); openmarket docs/WRUN5_ABI.md), and wrun-6 adds the row count
30
+ * (`wrun_bar_count`, the bars the run holds; openmarket docs/WRUN6_ABI.md). */
31
+ export type WrunAbiVersion = 'wrun-1' | 'wrun-2' | 'wrun-3' | 'wrun-4' | 'wrun-5' | 'wrun-6';
32
+ export declare function abiAtLeast(abi: WrunAbiVersion, floor: WrunAbiVersion): boolean;
33
+ /** One packed block of input rows (the row-level half of a run request).
34
+ * A full run request carries exactly one; a live session's tick messages
35
+ * carry additional blocks for the new/revised forming-bar rows. */
36
+ export interface WrunPackedRowsBlock {
37
+ rowCount: number;
38
+ /** Row-major stride of `values` (the widest row's argument count). */
39
+ stride: number;
40
+ ts: Float64Array;
41
+ argCounts: Int32Array;
42
+ values: Float64Array;
43
+ /** Input indexes declared `cellType: "array"`, in declaration order.
44
+ * `cellLens`/`cellOffsets` are row-major over these columns. */
45
+ cellIndexes: Int32Array;
46
+ cellLens: Int32Array;
47
+ cellOffsets: Int32Array;
48
+ cells: Float64Array;
49
+ }
50
+ export interface WrunPackedRunRequest extends WrunPackedRowsBlock {
51
+ id: number;
52
+ abi: WrunAbiVersion;
53
+ /** 'live' arms same-bar snapshot/restore replay; 'historical' drives each
54
+ * row exactly once. */
55
+ mode: 'historical' | 'live';
56
+ module: WebAssembly.Module;
57
+ outputCount: number;
58
+ /** init()'s positional argument block (declared params, in order). */
59
+ initArgs: number[];
60
+ /** One max_bytes cap per declared string slot; absent = no slots. */
61
+ stringMaxBytes?: Int32Array;
62
+ /** wrun-4: one byte cap per declared run-level frame slot. */
63
+ frameMaxBytes?: Int32Array;
64
+ /** wrun-3: the sheet's declared handle kinds with every default filled (a
65
+ * draw call of an undeclared kind refuses by name). Absent under wrun-1
66
+ * and wrun-2, whose import object never links the draw channel. */
67
+ handleDefaults?: WrunHandleDefaultsByKind;
68
+ /** wrun-5: the typed text settings' UTF-8 bytes keyed by init slot (the
69
+ * param's index in `metadata.params`), already plain text and within the
70
+ * param's `max_bytes` (wrun-text-params.util). Absent = no text params;
71
+ * a text param with no entry reads as "" at the module. */
72
+ textParams?: Readonly<Record<number, Uint8Array>>;
73
+ }
74
+ /** Full run that also OPENS (or replaces) a live session under sessionKey. */
75
+ export interface WrunLiveStartRequest extends WrunPackedRunRequest {
76
+ kind: 'live-start';
77
+ sessionKey: string;
78
+ /** The live context generation opening this session. The worker keeps the
79
+ * newest epoch per session key: a live-start whose epoch is no longer the
80
+ * newest when its instantiation settles (a newer start or a live-end
81
+ * arrived meanwhile) computes its block but installs no session, so a
82
+ * torn-down overlay's pending start can never resurrect a session. Absent
83
+ * on legacy callers: installs unconditionally after the live-end fence. */
84
+ epoch?: number;
85
+ }
86
+ /** Per-block live counters the ABI host answers on a live-mode block (the
87
+ * rig's restore/snapshot accounting reads these, never inferred). */
88
+ export interface WrunLiveBlockStats {
89
+ /** Forming-bar restores this block performed (replays and close-confirms). */
90
+ restored: number;
91
+ /** Forming-bar snapshots this block took. */
92
+ snapshotted: number;
93
+ /** The guest's exported memory size (bytes copied per snapshot/restore). */
94
+ memoryBytes: number;
95
+ /** Wall time of the block's evaluation inside the executor. */
96
+ evalMs: number;
97
+ /** Rows the block carried. */
98
+ rows: number;
99
+ /** Run-level string bytes after the block: part of the forming-bar
100
+ * snapshot, so it does not grow across same-bar replays. */
101
+ stringBytes: number;
102
+ }
103
+ /** A live rows block was refused BEFORE any evaluation because its rows run
104
+ * backwards relative to the session watermark (or each other). The guest
105
+ * state is untouched: the session stays valid, so the worker answers a
106
+ * coded error without dropping it, and only genuine evaluation throws
107
+ * poison the session. Shared by the worker (thrown by the ABI host) and the
108
+ * main-thread host (rejected from a `code: 'live-order'` response). */
109
+ export declare class WrunLiveOrderError extends Error {
110
+ constructor(message: string);
111
+ }
112
+ /** Incremental tick: evaluate one rows block on an open session. Rows must be
113
+ * monotonically >= the session's last evaluated timestamp; an equal
114
+ * timestamp replays the forming bar via snapshot/restore. */
115
+ export interface WrunLiveRowsRequest extends WrunPackedRowsBlock {
116
+ kind: 'live-rows';
117
+ id: number;
118
+ sessionKey: string;
119
+ }
120
+ /** Dispose one live session (idempotent: unknown keys answer ok). */
121
+ export interface WrunLiveEndRequest {
122
+ kind: 'live-end';
123
+ id: number;
124
+ sessionKey: string;
125
+ /** The live context generation whose session this end retires: the session that epoch installed and a start of
126
+ * that epoch (or an older one) still instantiating, never a newer generation's session or start under the key (a
127
+ * run cleaning up after itself while another owner holds the key). Absent: whatever the key holds, every start
128
+ * pending across it fenced out (the teardown). */
129
+ epoch?: number;
130
+ }
131
+ /** Everything the sandbox worker accepts. A bare WrunPackedRunRequest (no
132
+ * `kind`) stays the classic one-shot run. */
133
+ export type WrunWorkerRequest = WrunPackedRunRequest | WrunLiveStartRequest | WrunLiveRowsRequest | WrunLiveEndRequest;
134
+ interface WrunPackedRunStrings {
135
+ lens: Int32Array;
136
+ offsets: Int32Array;
137
+ bytes: Uint8Array;
138
+ }
139
+ export interface WrunPackedRunOutput {
140
+ ready: Uint8Array;
141
+ outputs: Float64Array;
142
+ strings?: WrunPackedRunStrings;
143
+ frames?: (string | undefined)[];
144
+ }
145
+ export type WrunWorkerResponse = {
146
+ id: number;
147
+ ok: true;
148
+ ready: Uint8Array;
149
+ outputs: Float64Array;
150
+ stringLens?: Int32Array;
151
+ stringOffsets?: Int32Array;
152
+ stringBytes?: Uint8Array;
153
+ /** wrun-3 only: the handle ledger's FULL live set after the block
154
+ * (wire records in creation order); replace semantics per response. */
155
+ handles?: WrunHandleRecord[];
156
+ /** Run-level snapshots in declaration order; never part of a row. */
157
+ frames?: (string | undefined)[];
158
+ /** Live-mode blocks only: the block's restore/snapshot accounting. */
159
+ live?: WrunLiveBlockStats;
160
+ } | {
161
+ id: number;
162
+ ok: false;
163
+ error: string;
164
+ /** live-rows only: the named session is not open in this worker (never
165
+ * started, disposed, or lost to a worker respawn). The caller rebuilds
166
+ * via a fresh live-start instead of treating this as a compute error. */
167
+ sessionLost?: true;
168
+ /** live-rows only: the block was refused before evaluation because its
169
+ * rows run backwards (WrunLiveOrderError); the session survives, and
170
+ * the caller reseeds it from its buffers (the worker and the context
171
+ * disagree on the watermark) instead of retrying the same block. */
172
+ code?: 'live-order';
173
+ };
174
+ /** One unpacked result row: `outputs` is null on a non-ready row; `strings`
175
+ * entries are undefined for ABSENT slots and '' for present-empty writes. */
176
+ export interface WrunOutputRow {
177
+ ts: number;
178
+ outputs: number[] | null;
179
+ strings?: (string | undefined)[];
180
+ }
181
+ /** The live block's restore/snapshot accounting rides beside the rows it
182
+ * belongs to (like the handle set and the strategy output), keeping each
183
+ * transported row byte-compatible. Kept with the wire types so every
184
+ * reader (the host's unpack, the run pass, the tick) shares one registry
185
+ * whatever else a spec mocks. */
186
+ export declare function attachWrunLive(rows: ReadonlyArray<WrunOutputRow>, live: WrunLiveBlockStats): void;
187
+ export declare function wrunLiveOf(rows: ReadonlyArray<WrunOutputRow>): WrunLiveBlockStats | undefined;
188
+ /** The settings dialog control a param declares (frozen sheet contract):
189
+ * 'number' (the default), 'int' (whole steps), 'boolean' (the toggle, 0/1
190
+ * at the module), 'select' (a labelled choice among numeric values),
191
+ * 'color' (a colour row; the module receives the packed colour), 'time'
192
+ * (a chart-pickable instant; the module receives epoch seconds), 'price'
193
+ * (a chart-pickable level), 'multi' (a labelled multi-choice; the module
194
+ * receives the bitmask), 'symbol' (a market picker; the module receives
195
+ * 0, the browser host applies the pick to the bound inputs) or 'text' (a
196
+ * typed text field, wrun-5; the module's init slot receives the UTF-8 byte
197
+ * count and the words ride the text channel). */
198
+ export type WrunParamType = 'number' | 'int' | 'boolean' | 'select' | 'color' | 'time' | 'price' | 'multi' | 'symbol' | 'text';
199
+ /** The host-applied param kinds (`WrunMetadataParam.host`): the value is an
200
+ * ordinary numeric init arg on every host (the index; 0 for a symbol) and
201
+ * the BROWSER host additionally rewrites the bound inputs' pins from it
202
+ * (`field_param` / `interval_param` / `symbol_param` on the input). */
203
+ export type WrunParamHost = 'source' | 'interval' | 'symbol';
204
+ /** The host-filled param kinds (`WrunMetadataParam.host_fill`), the kit's own
205
+ * type: numbers the host writes from the chart at run time, hidden from the
206
+ * dialog (0 = unavailable). The market words (`tick_size`, `price_precision`)
207
+ * read the chart market; the chart words read the chart itself:
208
+ * `interval_sec` the bar interval in seconds, `bg_color` / `fg_color` the
209
+ * effective background and text colour as the kit's packed
210
+ * `(r<<24)|(g<<16)|(b<<8)|a` signed i32 (white = -1), and `up_color` /
211
+ * `down_color` / `grid_color` (WRUN-STYLE TH-candle-colors) the chart's
212
+ * bullish, bearish and grid colours packed the same way. The market facts
213
+ * (`kind`, `point_value`, `zone`, `quote_is_usd`, WRUN-GAPS-1005) are codes
214
+ * of the chart's own market (wrun-chart-market-facts.util). */
215
+ export type { WrunParamHostFill };
216
+ /** An om style binding (the om param schema's `style`): the param is a
217
+ * style-only knob that never reaches init() (its slot holds a 0
218
+ * placeholder, the om runtime's own rule) and sets one property of a
219
+ * rendered output on the chart. `color` and `lineStyle` knobs default to a
220
+ * string, `width` and `opacity` to a number. */
221
+ export interface WrunParamStyleBinding {
222
+ output: string;
223
+ property: 'color' | 'width' | 'opacity' | 'lineStyle';
224
+ }
225
+ /**
226
+ * One sheet location a setting paints (frozen sheet contract, round 6
227
+ * colours, round 7 widths and line styles). `path` walks the final
228
+ * metadata.json from the root: a string on an object is a key, a string on
229
+ * an array is the element whose `name` equals it (outputs, renderers), a
230
+ * number on an array is an index (ranges, fills, colour ladders). The
231
+ * location holds what the package bakes at the param's default: a colour
232
+ * string, a number, or a select's `style_values[default]`.
233
+ *
234
+ * On a colour param, `alpha` is the alpha INSIDE the colour string at that
235
+ * location (a kScript `opacity(c, 20)` baked as rgba(..., 0.2) carries 0.2);
236
+ * absent = the plain input colour. It REPLACES the picked colour's own alpha, never
237
+ * multiplies it: the kScript engine's opacity(c, pct) (and transparency())
238
+ * rebuild the colour as rgba(c.r, c.g, c.b, pct / 100) whatever alpha `c`
239
+ * carries, so a translucent pick paints at the location's alpha, and a
240
+ * location without `alpha` paints the pick exactly as picked. A sibling key
241
+ * that makes the location translucent (an output's or a box's `opacity`)
242
+ * keeps applying on top of the written colour, as it does on the baked
243
+ * literal.
244
+ */
245
+ export interface WrunStyleTarget {
246
+ path: Array<string | number>;
247
+ alpha?: number;
248
+ /** A colour param's target only (om `unset_at_default`): while the pick is
249
+ * the param's declared default colour the paint seam REMOVES the key, so
250
+ * the surface's own colour shows (a stats row reads its strip theme's
251
+ * colour, the Bar Statistics template eliding a colour left at its
252
+ * input's default); a picked colour paints as on any target. */
253
+ unset_at_default?: boolean;
254
+ }
255
+ /** The kit's spelling of a style target (frozen sheet contract, plan 1.3):
256
+ * what a string reference on an output writes (`{ color: "@fast" }`,
257
+ * `{ line_style: "@style" }`), the output by name and the property it
258
+ * binds, in the om binding's word (`lineStyle`) or the sheet's key
259
+ * (`line_style`). It stands for the location `['outputs', output, key]`;
260
+ * the paint seam normalizes it to a WrunStyleTarget. */
261
+ export interface WrunStyleOutputTarget {
262
+ output: string;
263
+ property: WrunParamStyleBinding['property'] | 'line_style';
264
+ alpha?: number;
265
+ unset_at_default?: boolean;
266
+ }
267
+ export interface WrunMetadataParam {
268
+ name: string;
269
+ /** A number for every compute param (a `type: 'color'` param's default is
270
+ * the packed colour, see wrun-colour-params.util.ts); a string only on an
271
+ * om `style` knob bound to a colour or a line style. */
272
+ default?: number | string;
273
+ min?: number;
274
+ max?: number;
275
+ description?: string;
276
+ /** The om schema's numeric option values (a select's values). */
277
+ options?: number[];
278
+ /** Settings-dialog keys (frozen sheet contract, registry-validated: the
279
+ * om param schema is non-strict and the registry serves the sheet as
280
+ * published). `label` is the row label (the kScript input label; absent
281
+ * = the description, else the name), `type` the control, `step` the
282
+ * number field's step, `group` the dialog group ("Tab/Section" nests a
283
+ * section), `option_labels` a select's labels, parallel to `options` or,
284
+ * without `options`, to the integers min..max. See
285
+ * utility/wrun/wrun-script-inputs.util.ts. */
286
+ label?: string;
287
+ type?: WrunParamType;
288
+ step?: number;
289
+ group?: string;
290
+ option_labels?: string[];
291
+ /** The om style binding: a style-only knob (see WrunParamStyleBinding). */
292
+ style?: WrunParamStyleBinding;
293
+ /** A kScript `color[]` input's name on each of its N consecutive colour
294
+ * params (member i = element i): the dialog renders them as ONE
295
+ * colour-array row named by this key. */
296
+ color_array?: string;
297
+ /** Every sheet location a colour param, a number / int / select param
298
+ * (round 7: a width, a line style) or a style knob sets. A non-colour
299
+ * target carries no `alpha`: the run writes the param's current number, or
300
+ * `style_values[value]` for a select that declares them. On a style knob
301
+ * the list replaces the implicit binding target. */
302
+ style_targets?: Array<WrunStyleTarget | WrunStyleOutputTarget>;
303
+ /** A select's painted value per option value (round 7, e.g. ["solid",
304
+ * "dashed", "dotted"] for a line-style select whose values are 0..2): what
305
+ * its `style_targets` receive instead of the number. */
306
+ style_values?: string[];
307
+ /** The row's helper text (a hint glyph with a tooltip). */
308
+ hint?: string;
309
+ /** Inputs sharing a `row` string render side by side. */
310
+ row?: string;
311
+ /** A param NAME: the row dims (or hides, with `hide`) while that toggle is off. */
312
+ when?: string;
313
+ hide?: boolean;
314
+ /** Render the number as a slider. */
315
+ slider?: boolean;
316
+ /** The edit commits only after a confirmation. */
317
+ confirm?: boolean;
318
+ /** Never rendered (host-filled params, and anything the author hides). */
319
+ hidden?: boolean;
320
+ /** The size units of the markets where the dialog shows the row (kit
321
+ * 0.69.0, WrunVisibleBy); absent = every market. A composite's members
322
+ * carry their setting's. */
323
+ visible_by?: WrunVisibleBy;
324
+ /** `unit: ["price", "ticks", ...]` on a value param: the author's unit
325
+ * words; the extractor adds the `<name>_unit` select (`unit_for`). */
326
+ unit?: string[];
327
+ unit_default?: string;
328
+ /** On the `<name>_unit` select: the value param it qualifies. */
329
+ unit_for?: string;
330
+ /** `param.range`: the two members carry the composite name and their end. */
331
+ range?: string;
332
+ range_end?: 'lo' | 'hi';
333
+ /** `param.list`: each slot carries the composite name and its index; the
334
+ * count param carries `list_end: 'count'`. */
335
+ list?: string;
336
+ list_index?: number;
337
+ list_end?: 'count';
338
+ /** `param.session`: start / end (minutes from midnight) and the tz select. */
339
+ session?: string;
340
+ session_end?: 'start' | 'end' | 'tz';
341
+ /** A host-applied param (see WrunParamHost); `symbol_default` is the
342
+ * `EXCHANGE:SYMBOL` a symbol param starts on. */
343
+ host?: WrunParamHost;
344
+ symbol_default?: string;
345
+ /** `param.text` / `param.text_area` (wrun-5, the sheet's `type: "text"`):
346
+ * the declared words (absent = ""), the UTF-8 byte cap the dialog and
347
+ * every host enforce (256 when absent, 4096 at most) and whether the
348
+ * field takes several lines (newlines survive; on a one-line field they
349
+ * become spaces). The param's `default` is 0: its init slot carries the
350
+ * byte count the host wrote. */
351
+ text_default?: string;
352
+ max_bytes?: number;
353
+ multiline?: boolean;
354
+ /** A host-filled param (see WrunParamHostFill); `host_fill_for` names
355
+ * the param it serves (a unit-bearing price reads the tick size). */
356
+ host_fill?: WrunParamHostFill;
357
+ host_fill_for?: string;
358
+ /** `param.multi`: the option count (the bitmask width). */
359
+ multi_bits?: number;
360
+ }
361
+ /** `visible_by` on a typed setting or an output (kit 0.69.0, scaffold 69):
362
+ * the `market.size_unit()` codes (0 units, 1 coins, 2 shares, 3 contracts)
363
+ * of the markets where its row shows. Elsewhere the settings dialog leaves
364
+ * the setting out (its value still reaches init()) and the chart mounts
365
+ * nothing for the output (no plot, legend entry, Style row or stats row
366
+ * drawn from it); the module still computes every output
367
+ * (wrunRowVisibleHere). */
368
+ export interface WrunVisibleBy {
369
+ size_unit: number[];
370
+ }
371
+ /** One entry of a sheet's `layout` (frozen sheet contract, plan 1.2):
372
+ * recorded in source order together with every param declaration. */
373
+ export type WrunLayoutEntry = {
374
+ kind: 'page';
375
+ title: string;
376
+ } | {
377
+ kind: 'section';
378
+ title: string;
379
+ toggle?: string;
380
+ collapsed?: boolean;
381
+ when?: string;
382
+ } | {
383
+ kind: 'divider';
384
+ } | {
385
+ kind: 'note';
386
+ text: string;
387
+ } | {
388
+ kind: 'param';
389
+ name: string;
390
+ };
391
+ /** One preset (frozen sheet contract, plan 1.2): values as declared (a bool
392
+ * stays a bool, a choice its label string, a colour a string, a number a
393
+ * number); the FE normalizes each to the declaration's UI storage type
394
+ * (normalizePresetValues) before applying the patch. */
395
+ export interface WrunPreset {
396
+ name: string;
397
+ values: Record<string, number | boolean | string>;
398
+ }
399
+ /** A colour word (conventions 2): `#rrggbb`, `#rrggbbaa` (alpha in the last
400
+ * byte) or one of the seven theme tokens `theme.up`, `theme.down`,
401
+ * `theme.text`, `theme.muted`, `theme.bg`, `theme.grid`, `theme.accent`. A
402
+ * token rides the sheet unresolved and resolves at paint time
403
+ * (wrun-style-words.util.ts resolveWrunColorWord); the `/aa` wire form never
404
+ * appears on a sheet. */
405
+ export type WrunColorWord = string;
406
+ /** `font_family` (D2/D11): four system stacks; the app maps a word to CSS
407
+ * through WRUN_FONT_FAMILY_CSS before titan sees it. */
408
+ export type WrunFontFamily = 'ui' | 'mono' | 'serif' | 'rounded';
409
+ /** `font_weight`: CSS 400 / 500 / 700. */
410
+ export type WrunFontWeight = 'normal' | 'medium' | 'bold';
411
+ export type WrunTextAlign = 'left' | 'center' | 'right';
412
+ export type WrunValign = 'top' | 'middle' | 'bottom';
413
+ /** `line_style`, `border_style`, `grid_style`. */
414
+ export type WrunLineStyleWord = 'solid' | 'dashed' | 'dotted';
415
+ export type WrunGradientDirection = 'vertical' | 'horizontal';
416
+ /** `format`, the one number-format word (conventions 8): the eight legacy
417
+ * words plus `usd` (compact with a $ sign, $1.2M) and `auto` (6 significant
418
+ * digits with thousands separators). formatWrunNumber holds the rules. */
419
+ export type WrunValueFormat = 'price' | '%' | 'si' | 'int' | '0' | '0.0' | '0.00' | '0.000' | 'usd' | 'auto';
420
+ /** Card rows and the card headline also keep `pct` (value x 100, 2 decimals). */
421
+ export type WrunCardValueFormat = WrunValueFormat | 'pct';
422
+ /** The number-format companions a surface declares beside `format`
423
+ * (conventions 8): `decimals` (0..8) overrides the word's digits, `signed`
424
+ * forces a + on positives, `unit` (at most 8 chars) prints after the value.
425
+ * The kit refuses decimals, signed or unit without format on every new
426
+ * surface; an output's `unit` without format keeps its legacy meaning. */
427
+ export interface WrunValueFormatKeys {
428
+ format?: WrunValueFormat;
429
+ decimals?: number;
430
+ signed?: boolean;
431
+ unit?: string;
432
+ }
433
+ /** The drawing a HUD tile picks (g3 addendum LK04), per kind: a gauge draws
434
+ * arc | ring | dial | ticks | bar | blocks | text, a spark line | area | dots
435
+ * | bars | text, a meter bar | split | blocks | segments | scale | text, a
436
+ * pill capsule | dot | led | text. Absent = the look's default, else today's. */
437
+ export type WrunGaugeDraw = 'arc' | 'ring' | 'dial' | 'ticks' | 'bar' | 'blocks' | 'text';
438
+ export type WrunSparkDraw = 'line' | 'area' | 'dots' | 'bars' | 'text';
439
+ export type WrunMeterDraw = 'bar' | 'split' | 'blocks' | 'segments' | 'scale' | 'text';
440
+ export type WrunPillDraw = 'capsule' | 'dot' | 'led' | 'text';
441
+ export type WrunBlockDraw = WrunGaugeDraw | WrunSparkDraw | WrunMeterDraw | WrunPillDraw;
442
+ /** One ring of a `rings` tile (LK07): a share of its own min..max, outermost
443
+ * first; `color` defaults to the HUD accent at a decreasing strength. */
444
+ export interface WrunBlockRing {
445
+ label: string;
446
+ output: string;
447
+ min: number;
448
+ max: number;
449
+ color?: WrunColorWord;
450
+ }
451
+ /** One tile / block of the presentation vocabulary (frozen sheet contract,
452
+ * plan 1.4): a HUD tile, a hover block. The WRUN-STYLE keys (DW13 tile
453
+ * colours, the g3 addendum looks) are all opt-in. */
454
+ export interface WrunHoverBlock {
455
+ kind: 'value' | 'spark' | 'gauge' | 'pill' | 'rows' | 'meter' | 'chips' | 'rings';
456
+ label?: string;
457
+ output?: string;
458
+ slot?: string;
459
+ /** A WrunValueFormat word (`usd` and `auto` included). */
460
+ format?: string;
461
+ delta?: string;
462
+ min?: number;
463
+ max?: number;
464
+ marks?: number[];
465
+ bars?: number;
466
+ /** The tile's ink (DW13): `color`, or the `color_by` + `colors` ladder,
467
+ * never both; declarable on value, spark, gauge, meter, pill and rows. */
468
+ color?: WrunColorWord;
469
+ color_by?: string;
470
+ colors?: WrunColorWord[];
471
+ rows?: Array<[string, string] | [string, string, string]>;
472
+ tooltip?: string;
473
+ hint?: string;
474
+ /** The drawing choice of a gauge, spark, meter or pill tile (LK04). */
475
+ draw?: WrunBlockDraw;
476
+ /** value and pill tiles (LK05): a headline tile spans every column at
477
+ * `font_size` (default 22) with a hairline under it; one per card. */
478
+ headline?: boolean;
479
+ /** value and pill tiles (LK05): px, integer 6..64. */
480
+ font_size?: number;
481
+ /** spark, meter and rings tiles (LK05): px, integer 16..120. */
482
+ height?: number;
483
+ /** rows tiles (LK06): a dotted leader between key and value. */
484
+ leader?: 'none' | 'dots';
485
+ /** rings tiles (LK07): 1..3 concentric rings. */
486
+ rings?: WrunBlockRing[];
487
+ }
488
+ /** The freeze's name for a tile / block entry (WRUN-STYLE 3.5.4). */
489
+ export type WrunBlock = WrunHoverBlock;
490
+ /** One `presentation.legend` entry (plan 1.4): a legend word or a formatted
491
+ * value, coloured statically or by a ladder. */
492
+ export interface WrunLegendEntry {
493
+ name: string;
494
+ text?: string;
495
+ value?: string;
496
+ format?: string;
497
+ color?: string;
498
+ color_by?: string;
499
+ colors?: string[];
500
+ }
501
+ /** `look` on `render.hud` (g3 addendum LK01): a preset standing for one row
502
+ * of the frozen look table; any word declared beside it wins. */
503
+ export type WrunHudLook = 'default' | 'glass' | 'stage' | 'signal' | 'terminal' | 'broadsheet' | 'chart_desk' | 'dial' | 'grid' | 'cockpit' | 'phosphor' | 'classic';
504
+ /** `title_case` / `label_case` on `render.hud` (LK06); values never change case. */
505
+ export type WrunTextCase = 'none' | 'upper' | 'lower' | 'small_caps';
506
+ /** The HUD's box (LK08). The sheet word is `chrome` (X16: `frame` is the
507
+ * data channel's word). */
508
+ export type WrunHudChrome = 'card' | 'none' | 'brackets' | 'rules' | 'tag' | 'title_bar' | 'window' | 'cover';
509
+ /** One `presentation.hud` entry (plan 1.4): an FE-drawn card at one of the
510
+ * nine anchors. Every WRUN-STYLE key (g3 DW06 DW20 DW22, the addendum
511
+ * looks) is opt-in; absent keeps today's card. */
512
+ export interface WrunHud {
513
+ name: string;
514
+ position: string;
515
+ title?: string;
516
+ columns?: 1 | 2;
517
+ tiles: WrunHoverBlock[];
518
+ /** DW22: px, integer 80..1200 (default 300, 180 at one column). */
519
+ width?: number;
520
+ /** DW22: [x, y] px, each integer -4096..4096, inward from the anchored edges. */
521
+ offset?: [number, number];
522
+ /** DW22: order within one anchor (lower sits nearer the anchor). */
523
+ z?: number;
524
+ background_color?: WrunColorWord;
525
+ background_opacity?: number;
526
+ background_gradient?: WrunColorWord[];
527
+ gradient_direction?: WrunGradientDirection;
528
+ border_color?: WrunColorWord;
529
+ border_width?: number;
530
+ border_style?: WrunLineStyleWord;
531
+ /** px, 0..32 (D1: `corner_radius` on every surface). */
532
+ corner_radius?: number;
533
+ padding?: number;
534
+ shadow?: boolean;
535
+ opacity?: number;
536
+ text_color?: WrunColorWord;
537
+ title_text_color?: WrunColorWord;
538
+ font_family?: WrunFontFamily;
539
+ /** DW06: a top-left card clears the legend stack. */
540
+ safe_area?: boolean;
541
+ /** DW20: shown on phones (pointer-free tiles). */
542
+ mobile?: boolean;
543
+ look?: WrunHudLook;
544
+ /** LK03: the accent inking every gauge, meter fill, spark and headline that
545
+ * declares no colour (default `theme.accent`), or a ladder over an output
546
+ * (`accent_color_by` + `accent_colors`, exclusive with `accent_color`). */
547
+ accent_color?: WrunColorWord;
548
+ accent_color_by?: string;
549
+ accent_colors?: WrunColorWord[];
550
+ title_case?: WrunTextCase;
551
+ label_case?: WrunTextCase;
552
+ chrome?: WrunHudChrome;
553
+ /** LK08: static 1 px lines every 3 px. */
554
+ texture?: 'none' | 'scanlines';
555
+ /** LK08: px, 0..8, a static text halo in the text colour. */
556
+ text_glow?: number;
557
+ }
558
+ /** The freeze's name for a `presentation.hud` entry (WRUN-STYLE 3.5.4). */
559
+ export type WrunHudEntry = WrunHud;
560
+ /** Scalar and celled input source declarations. The browser lane serves the
561
+ * classes the chart already polls; `wrun-source-rows.util.ts` maps each to
562
+ * chart rows. The celled `intrabar` class (`{ source: 'intrabar',
563
+ * interval }` on a `cellType: 'array'` input) serves a market's CLOSED
564
+ * finer bars as `[offset_ms, open, high, low, close, volume]` cells onto
565
+ * each chart row; it declares `interval`, an optional market pin (`symbol`
566
+ * and `exchange` together) and the input's `max_cells` only. The celled
567
+ * `candles` class (`{ source: 'candles', interval, bars? }`) serves a leg's
568
+ * CLOSED candles as a stream of the same tuples (offset_ms negative for
569
+ * history): the backlog on the first delivered row, then the candles that
570
+ * closed since; any interval word (the eight intervals and the chart's
571
+ * custom timeframes), finer than, equal to or coarser than the chart, on the
572
+ * chart's market or a pinned one. */
573
+ export interface WrunInputSource {
574
+ source: string;
575
+ field?: string;
576
+ /** Trade-flow facet: 'BUY' | 'SELL' on `trades` volume inputs. */
577
+ side?: string;
578
+ /** Option-summary facet: the om tenor enum on `implied_volatility` and
579
+ * `skew` inputs, required there. The browser lane serves ONE_W, ONE_M,
580
+ * TWO_M, THREE_M and SIX_M (the five the gateway holds) and asks exactly
581
+ * the declared ones; ONE_D, THREE_D and ONE_Y refuse by name
582
+ * (wrun-option-summary-lane.util). */
583
+ tenor?: string;
584
+ /** `skew` only: the delta the skew is quoted at, one of the kit's
585
+ * WRUN_SKEW_DELTAS (5, 15, 25, 35; absent reads 25). The browser lane
586
+ * fetches one K_SKEW ask per distinct delta and refuses any other value
587
+ * by name before the fetch (wrun-option-summary-lane.util). */
588
+ delta?: number;
589
+ /** ETF-flow facet: the fund an `etf_flow` input reads, an ETF ticker (`IBIT`, `ETHA`, ...)
590
+ * or `all` for the sum over the chart coin's funds; required there
591
+ * (wrun-etf-flow-lane.util). */
592
+ fund?: string;
593
+ /** What an absent observation reads as. Scalar inputs: `carry` (the
594
+ * default), `nan` or `zero`. `empty` is the celled word (frozen authoring
595
+ * contract C1.2), honoured on `volume_profile` inputs: when the lane
596
+ * answers empty, is declined or the market has no profile, every bar
597
+ * reads an EMPTY block (0 cells) and the run continues; the lane holds
598
+ * the run (the honest-picture rule) unless EVERY reader declares it (a
599
+ * scalar word on a celled input reads no fill:
600
+ * `wrunInputReadsFillOverEmptyLane`). On any celled input it also
601
+ * forgives size (C1.2b): a bar whose block has more cells than the
602
+ * input's `max_cells` reads an EMPTY block on that bar alone instead of
603
+ * refusing the run (`packWrunRows`); a block is still never truncated. */
604
+ missing?: 'carry' | 'nan' | 'zero' | 'empty';
605
+ block_size?: number;
606
+ max_depth?: number;
607
+ /** `tape` only (the C1 facets, `wrun-tape-source.util.ts`): the smallest
608
+ * print size served, a number literal or the name of a declared numeric
609
+ * param (resolved from the run's current values), and the history seeded
610
+ * from TRADE_LARGE ("0" = the live edge only, else `^\d+(s|m|h|d)$` at
611
+ * most 30 days). */
612
+ min_size?: number | string;
613
+ history?: string;
614
+ /** `volume_profile` only: the lane the input reads, the kScript
615
+ * volume_profile source's `ticksPerBar` (price ticks per bucket, an
616
+ * integer; normalizeTicksPerBar floors and clamps it to 1..500) and
617
+ * `currency` ("USD" quotes the volumes in dollars, anything else in
618
+ * coins). Declared, they ride the K_VOLUME_PROFILE lane's payload, so the
619
+ * history buckets, the live fold's lattice and the live leg's quote follow
620
+ * them; neither declared keeps the chart's own lane (one tick, coins).
621
+ * Two inputs declaring different lanes refuse by name
622
+ * (wrun-volume-profile-lane.util). `currency` also rides `trades` inputs
623
+ * (frozen authoring contract C1.4): "USD" reads the buy_sell_volume lane
624
+ * asked for dollar volumes, the kScript buy_sell_volume(currency="USD")
625
+ * request; absent or "Coin" reads the coin lane; each quote a package
626
+ * reads is its own lane (wrun-trades-lane.util). On either lane "Auto"
627
+ * (kit 0.69.0) follows the chart's market: the run resolves it before
628
+ * any reader sees the sheet (wrunSheetWithLaneCurrencies), "Coin" on a
629
+ * market whose size unit is contracts and "USD" on every other market,
630
+ * and a hosted run's cloud resolves it from `wrunFacts.hostFills`
631
+ * (wrunHostedLaneFills). `ticks_per_bar` may also
632
+ * be the in-source reference verbatim, `"@<int param>"` (C1.3, the second
633
+ * spelling below). */
634
+ ticks_per_bar?: number | string;
635
+ currency?: string;
636
+ /** `volume_profile` only (frozen authoring contract C1.3, the in-source
637
+ * `ticks_per_bar: "@<int param>"`): the int param whose CURRENT value is
638
+ * the lane's ticks per bucket, beside the param's default in
639
+ * `ticks_per_bar` (what every host without settings reads), the
640
+ * `interval_param` spelling. A sheet may instead carry the reference
641
+ * verbatim in `ticks_per_bar`; both read the same. The browser host
642
+ * writes the param's current value into `ticks_per_bar` in the paint seam
643
+ * (`wrunSheetWithSettings`), so the lane request, the live fold and a
644
+ * settings change (a refetch save, a new K_VOLUME_PROFILE identity) all
645
+ * follow it, exactly like `interval_param` / `symbol_param`; a reference
646
+ * naming no declared param refuses by name before any fetch
647
+ * (wrun-volume-profile-lane.util). */
648
+ ticks_per_bar_param?: string;
649
+ /** `options_chain` (celled) only: the chain family the live row carries
650
+ * (`auto` default: the chart's own market when it is an options venue,
651
+ * else the coin's Deribit chain; `deribit`; `cme`; `binance`, `okx`,
652
+ * `bybit`, `bullish` and `derive`, the plain crypto venues behind the
653
+ * `crypto-options` flag, each reading the coin's chain there when the
654
+ * venue lists it) and the expiries it keeps (`all` default or
655
+ * `nearest:N`). The run lane decides the venue against the chart before
656
+ * any fetch and refuses by name; the row builder applies `expiries` per
657
+ * input (`wrun-options-chain.util.ts`). */
658
+ venue?: string;
659
+ expiries?: string;
660
+ /** A market pin (either part may be absent: it resolves to the chart's
661
+ * own). The browser lane serves a market pin on a secondary `ohlcv`
662
+ * input: with a coarser `interval` it is a foreign PERIOD leg (the
663
+ * confirmed and is_new_period views read that market's leg-interval
664
+ * candles) and, for a `forming` view, a foreign GRID leg (that market's
665
+ * rows at the chart interval, tick-merged from its candle feed); without
666
+ * an interval (or with the chart's own) it is the grid leg read row for
667
+ * row. An `odds` input pins its Polymarket market by `symbol` alone (the
668
+ * condition id, `0x` + 64 hex; `exchange` is implicit and refuses by
669
+ * name), primary included: the leg's market is POLYMARKET/<id
670
+ * lower-cased>. A market pin on any other class, on a celled input or on
671
+ * the primary input refuses by name before any fetch
672
+ * (`planWrunPinnedLegs`). */
673
+ symbol?: string;
674
+ exchange?: string;
675
+ /** A bindable input (an odds input whose market arrives per use through
676
+ * `sourceBindings`, never a pinned symbol). The browser lane resolves no
677
+ * bindings: the chart has no market picker yet, so a bindable odds input
678
+ * refuses by name before any fetch (`wrun_odds_binding_unsupported`) and
679
+ * an odds input is served only with its `symbol` pinned; the pin
680
+ * classifier also reads it so a `forming` view refuses by name when the
681
+ * primary input is bindable. */
682
+ binding?: 'required' | 'optional';
683
+ /** Odds inputs only: the outcome the probability is read for. Absent =
684
+ * `YES` (the wire close, 0..1); `NO` reads `1 - close` for observed and
685
+ * carried values (close only; a `nan` or `zero` fill stays as filled).
686
+ * Anything else refuses by name (`wrun_odds_outcome`). */
687
+ outcome?: 'YES' | 'NO';
688
+ /** Feed input interval pin (the package schema allows one), as the schema
689
+ * enum (`FOUR_HOURS`, or a custom timeframe's wire word, `TWO_HOURS`) or
690
+ * the short spelling (`4h`, `2h`). The browser lane
691
+ * honors an `ohlcv` pin COARSER than the chart on the chart's own market
692
+ * or on a pinned one, and an `odds` pin coarser than the chart on its
693
+ * Polymarket market (`confirmed` / `is_new_period` views only): the leg
694
+ * is fetched at its own interval and aligned as-of candle close
695
+ * (`wrun-source-rows.util.ts`); a `funding` or `oi`
696
+ * pin coarser than the chart buckets the lane's own rows by the clock
697
+ * (no extra fetch); an equal pin reads the chart's own rows; a finer
698
+ * pin, a pin on any other class (trades, liquidations, the option
699
+ * summaries, cells, `time`) and a pin on the primary input refuse by
700
+ * name before any fetch (`planWrunPinnedLegs`). */
701
+ interval?: string;
702
+ /** A leg's explicit fetch depth in its own candles (1..5000), counted back
703
+ * from the leg bucket holding now: an interval-pinned feed leg or a
704
+ * `candles` stream only, never the primary input (refused by name
705
+ * elsewhere, `wrun_bars_needs_leg`). It only deepens the automatic
706
+ * pre-roll (`wrunLegFetchStart` in the shared host's leg core): on a scalar
707
+ * view it lengthens a sparse leg's carry reach, on `candles` it sets the
708
+ * backlog. The chart's typed-feed legs bucket the lane over the chart
709
+ * window, so `bars` there reads like a host that ignores it (only less
710
+ * history). */
711
+ bars?: number;
712
+ /** `candles` only, sheet-only (the kit strips it before the module compiles, like `currency`): the
713
+ * interval word (`HOUR`) below which the chart reads this lane. On a chart whose interval span is
714
+ * known and at least the word's (wrunLaneGatedOff) the lane is gated off: the run's sheet on that
715
+ * chart marks the input `undemanded` (wrunSheetWithLaneGate), so nothing plans, fetches, subscribes,
716
+ * wall-checks or diagnoses it and it reads a present EMPTY block on every row. An unknown chart
717
+ * interval gates nothing. */
718
+ chart_interval_below?: string;
719
+ /** View `offset` only, and required there: the leg candles back from the
720
+ * confirmed one (1..500); a count without the view, or the view without
721
+ * a count, refuses by name (`wrun_offset_needs_view`,
722
+ * `wrun_offset_count_required`). */
723
+ offset?: number;
724
+ /** The view of an interval-pinned input (the G4 contract, one text on
725
+ * every host): absent = `confirmed` (an ohlcv leg: the latest leg candle
726
+ * that has CLOSED by the earlier of the row's own close and now, carried
727
+ * forward; a typed feed: the feed's last observation inside the latest
728
+ * closed bucket), `forming` (an ohlcv leg: the running aggregate of the
729
+ * row's own leg bucket, from the primary rows on the chart's market or
730
+ * from the leg market's chart-interval rows; a typed feed: the last
731
+ * observation inside the row's own bucket), `is_new_period` (1.0 on a
732
+ * delivered row whose held confirmed candle, or held closed bucket,
733
+ * differs from the one held on the previously delivered row, the first
734
+ * delivered row reading 1 when any is held, else 0.0), `offset` (the leg
735
+ * candle, or a typed feed's closed bucket, the cursor held `offset`
736
+ * before its current one; NaN, 0 under missing "zero", until that many
737
+ * plus one are held; never gates readiness). A `candles` input takes
738
+ * `forming` (the leg's live candle on the live row) or `forming_open`
739
+ * (on every row the open of the leg candle holding it) instead. */
740
+ view?: WrunInputView;
741
+ /** Typed-inputs bindings (frozen sheet contract, plan 1.1): the host
742
+ * params this input follows. `field_param` names the `<name>_field`
743
+ * select of a `param.source`, `interval_param` a `param.timeframe`,
744
+ * `symbol_param` a `param.symbol`; the pins above hold each param's
745
+ * default and the browser host rewrites them from the setting. */
746
+ field_param?: string;
747
+ interval_param?: string;
748
+ symbol_param?: string;
749
+ /** The size units (`market.size_unit()` codes: 0 units, 1 coins, 2 shares, 3 contracts) of the
750
+ * markets where the run reads this input (kit 0.72.0), the shape of an output's `visible_by`;
751
+ * absent = every market. On any other market the run's sheet marks it `undemanded`. */
752
+ needed_by?: {
753
+ size_unit: number[];
754
+ };
755
+ /** A secondary `trades` input only (kit 0.77.0, sheet-only), beside `exchange` and never beside
756
+ * `symbol`: "coin", the venue's primary market for the chart's coin. The run resolves every
757
+ * venue a coin leg names before anything reads the sheet (wrunSheetWithCoinLegs, the native
758
+ * venue resolver): a resolved leg becomes a literal pin (`follow` dropped, `symbol` written), a
759
+ * venue that lists no market for the coin leaves the input `undemanded`, reading its fill. */
760
+ follow?: 'coin';
761
+ /** A secondary scalar feed input only (kit 0.77.0, sheet-only): the boolean or multi param the
762
+ * lane is read under (`when_bit`, a multi's option bit, 0 for its first option). While the
763
+ * setting is off the run's sheet marks the input `undemanded` (wrunSheetWithSettings): no
764
+ * fetch, and the input reads its fill. The module reads the setting itself. */
765
+ when?: string;
766
+ when_bit?: number;
767
+ /** A `trades` input only (kit 0.77.0, sheet-only): the select param whose picked option's label
768
+ * ("USD" or "Coin") is the lane's unit; `currency` carries the default's label. The browser
769
+ * writes the pick into `currency` in the paint seam (wrunSheetWithSettings). */
770
+ currency_param?: string;
771
+ /** Host-only, never on a published sheet: the run's sheet on the chart's market marks an input whose
772
+ * `needed_by` leaves out the market's size unit (wrunSheetWithLaneDemand), or a `candles` lane its
773
+ * `chart_interval_below` gates off on the chart's interval (wrunSheetWithLaneGate). Its lane is not
774
+ * demanded: no fetch, no live channel, no fold, no reconcile (wrunSourceLane answers none for it),
775
+ * and the row builder reads its fill on every bar without ever holding the run; a gated `candles`
776
+ * input plans no leg and reads a present EMPTY block on every row. */
777
+ undemanded?: true;
778
+ }
779
+ /** The four views of a pinned coarser input (`WrunInputSource.view`), and `forming_open`, a
780
+ * view of the `candles` class alone (every scalar input refuses it by name). */
781
+ export type WrunInputView = 'confirmed' | 'forming' | 'is_new_period' | 'offset' | 'forming_open';
782
+ /** An output's display offset in bars as a function of a param (frozen sheet
783
+ * contract C2, FE-only): round(scale * <the run's value of `param`, else its
784
+ * declared default> + offset), clamped to -500..500. `scale` defaults to 1,
785
+ * `offset` to 0. A static `displacement_bars` cannot follow a setting with a
786
+ * transform (the Ichimoku Chikou rides -(D - 1) of the Displacement D). */
787
+ export interface WrunDisplacementBarsBy {
788
+ param: string;
789
+ scale?: number;
790
+ offset?: number;
791
+ }
792
+ interface WrunMetadataInput {
793
+ index: number;
794
+ name: string;
795
+ source?: string;
796
+ description?: string;
797
+ cellType?: 'array';
798
+ max_cells?: number;
799
+ }
800
+ export interface WrunMetadataOutput {
801
+ index: number;
802
+ name: string;
803
+ /** Display label (the kScript plot(label=...) column): what the legend,
804
+ * alert pickers and price-axis menu call the output. Absent, the sheet
805
+ * name reads as words. */
806
+ label?: string;
807
+ description?: string;
808
+ plot?: string;
809
+ panel?: string;
810
+ /** ABI output styling (docs/WRUN2_ABI.md metadata additions): static
811
+ * color/width/opacity/line_style, a per-bar `color_by` ladder indexing
812
+ * `colors`, a per-bar `width_by` ladder indexing `widths`, and the
813
+ * declared display offset. */
814
+ color?: string;
815
+ colors?: string[];
816
+ width?: number;
817
+ opacity?: number;
818
+ line_style?: string;
819
+ color_by?: string;
820
+ /** Packed per-bar colour (frozen sheet contract), in place of `color_by`:
821
+ * names a declared output whose per-bar value IS the colour, packed as
822
+ * ((r * 256 + g) * 256 + b) * 1024 + round(alpha * 1000); a value that
823
+ * does not decode falls back to the static colour. Taken by line and bar
824
+ * outputs, the first output of a candle group and a barcolor output. */
825
+ color_packed_by?: string;
826
+ /** Per-bar width ladder: names a declared (typically data-only) output
827
+ * whose per-bar value indexes `widths`, riding the same styled-row
828
+ * channel as `color_by` (the kScript widths table + per-bar width index
829
+ * column). Requires `widths` (the om schema refuses either half alone). On
830
+ * a plot 'shape' output the ladder sizes each mark, the engine's
831
+ * plotShape(width=...) per record. */
832
+ width_by?: string;
833
+ /** With `width_by`: the ladder's width table, 1..10 numbers 0.5..20 px. */
834
+ widths?: number[];
835
+ /** Per-run stroke width (frozen sheet contract, FE-only, not a ladder): a
836
+ * declared output whose value on the last ready row, finite and >= 0, is
837
+ * the line or bar's `width` (0 = no stroke, the kScript plotLine(width=0)
838
+ * the om schema refuses as a static width); else the static `width`. */
839
+ stroke_width_by?: string;
840
+ shape_where?: string;
841
+ displacement_bars?: number;
842
+ /** Param-driven display offset (frozen sheet contract C2, FE-only): see
843
+ * WrunDisplacementBarsBy. Overrides `displacement_bars` whenever the
844
+ * named param resolves to a finite number. */
845
+ displacement_bars_by?: WrunDisplacementBarsBy;
846
+ /** Line outputs only (frozen sheet contract, FE-only): 1 or true bends the line into the
847
+ * engine's smoothed spline, the kScript plotLine(smooth=true); absent, 0 or false keeps
848
+ * straight segments. A Smooth param drives it through a `style_targets` path to here. */
849
+ smooth?: boolean | number;
850
+ inset?: WrunInset;
851
+ /** Bar/histogram outputs only (frozen sheet contract): the value the bars
852
+ * are drawn from, the kScript plotBar(value=[v, base]) second value;
853
+ * absent draws from zero. */
854
+ base?: number;
855
+ /** Data-only outputs (plot "") only (frozen sheet contract): tint the main
856
+ * chart candles like kScript barcolor(), the per-bar value indexing
857
+ * `colors` (floor; NaN or out of range = no tint). Requires `colors`,
858
+ * unless `color_packed_by` names the per-bar packed tint. */
859
+ barcolor?: boolean;
860
+ /** With plot 'shape' (frozen sheet contract): the marker glyph in the
861
+ * render.shape vocabulary (circle, triangle, square, diamond, cross,
862
+ * arrowup, ...), default circle; `shape_where` gates the bars. */
863
+ shape?: string;
864
+ /** With plot 'shape' (frozen sheet contract): the kScript
865
+ * plotShape(fill=true) filled glyph. */
866
+ fill?: boolean;
867
+ /** With plot 'shape' (frozen sheet contract): the kScript
868
+ * plotShape(location=...) placement, the engine's own vocabulary or the
869
+ * kit's snake_case words (OT07); absent = on the value. */
870
+ location?: WrunSheetMarkerLocation;
871
+ /** The kScript plot(showPriceDisplay=...) kwarg (frozen sheet contract,
872
+ * read only under the sheet's `price_display: "per_output"`): false drops
873
+ * the output's price-axis tag, true forces one. Absent = the chart's
874
+ * default for the output's kind (every value plot tagged, marks never),
875
+ * exactly like a kScript plot that passes none. For a candle group the
876
+ * first output carries it. */
877
+ show_price_display?: boolean;
878
+ /** The per-run form of `show_price_display` (frozen sheet contract, same
879
+ * gate), the kScript showPriceDisplay=<input>: names a declared output
880
+ * whose value on the last ready row decides, nonzero = true, zero =
881
+ * false; NaN falls back to `show_price_display`. */
882
+ show_price_display_by?: string;
883
+ /** "guide" (frozen sheet contract, on a line output, read only under the
884
+ * sheet's `price_display: "per_output"`): the output stands for a kScript
885
+ * hline() and mounts as the engine's hline wire (one constant value, the
886
+ * guide lineage: never a pane parent, tagged like the hline unless
887
+ * `show_price_display` says otherwise, in the pane autoscale like an
888
+ * hline), so the legend lists it no more than the hline it replaces. */
889
+ role?: 'guide';
890
+ /** true (frozen sheet contract, on a line, bar or shape output or a candle
891
+ * group's first output): the output stands for a kScript plot call inside
892
+ * an `if` and mounts only when the run gave it a value (a finite value; a
893
+ * mark; a candle with all four values finite); a run that never did leaves
894
+ * it out entirely (no legend entry, no axis tag, a sheet fill on it
895
+ * dropped too), like the plot call that never ran. It only filters: an
896
+ * output that does mount keeps its declaration place, under
897
+ * `mount_order: "first_value"` too. */
898
+ omit_if_empty?: boolean;
899
+ /** The legend / HUD number format, a WrunValueFormat word: "price" | "%" |
900
+ * "si" | "int" | "0" | "0.0" | "0.00" | "0.000" | "usd" | "auto". */
901
+ format?: string;
902
+ /** false: no legend entry (drawn all the same). */
903
+ legend?: boolean;
904
+ /** false: mounted hidden (the Style page's Visible row starts off). */
905
+ visible?: boolean;
906
+ /** The size units of the markets where the output mounts at all (kit
907
+ * 0.69.0, WrunVisibleBy); absent = every market. */
908
+ visible_by?: WrunVisibleBy;
909
+ price_line?: boolean;
910
+ axis_label?: boolean;
911
+ /** A template ({{value}}, {{label}}, {{name:format}}) shown on hover. */
912
+ tooltip?: string;
913
+ /** Hover blocks (win over `tooltip`). */
914
+ hover?: WrunHoverBlock[];
915
+ /** An output name whose ladder labels become chips. */
916
+ badges?: string;
917
+ hint?: string;
918
+ /** Glow in px (an engine pass-through); OT16 takes it on line, area, bar,
919
+ * histogram, candle-first, shape and scatter outputs. */
920
+ glow?: number;
921
+ /** Histogram corner radius in px (engine pass-through). */
922
+ corner?: number;
923
+ /** OT01: the axis tag also carries the indicator's name (and this output's
924
+ * label when several outputs are tagged). */
925
+ axis_name?: boolean;
926
+ /** Area outputs (OT02, OT31): the fill's own colour, its alpha multiplier
927
+ * (default 0.4 flat, 1 on gradient stops; OT35 also fades a filled mark's
928
+ * interior with it), 2..8 top-to-bottom gradient stops laid over
929
+ * `gradient_mode`, or a per-bar fill ladder (`fill_color_by` +
930
+ * `fill_colors`, or `fill_color_packed_by`). */
931
+ fill_color?: WrunColorWord;
932
+ fill_opacity?: number;
933
+ fill_gradient?: WrunColorWord[];
934
+ gradient_mode?: 'pane' | 'fill' | 'line';
935
+ fill_color_by?: string;
936
+ fill_colors?: WrunColorWord[];
937
+ fill_color_packed_by?: string;
938
+ /** OT04: paint order inside the pane, integer -10..10 (absent = the
939
+ * engine's layer). */
940
+ z?: number;
941
+ /** OT08 / OT24: the declared pane this output draws in (a `panes[]` name,
942
+ * or "lower" for the default lower pane). */
943
+ pane?: string;
944
+ /** Guide outputs (OT10, `role: "guide"`): the label's place on the line
945
+ * (absent = no label), the pill look and the label font size (px, 6..64). */
946
+ align?: WrunTextAlign;
947
+ pill_style?: 'filled' | 'outlined';
948
+ font_size?: number;
949
+ /** OT11: horizontal-then-vertical segments on a line output. */
950
+ step?: boolean;
951
+ /** OT13: the stroke shaded by height, 2..8 stops from the pane top down. */
952
+ gradient?: WrunColorWord[];
953
+ /** OT14: a two-tone line split at a level or by slope; `up_color` and
954
+ * `down_color` are required with `split`; `split_fill` shades from the
955
+ * line down to `split_base` (default `split_level`, default 0). */
956
+ split?: 'level' | 'slope';
957
+ up_color?: WrunColorWord;
958
+ down_color?: WrunColorWord;
959
+ split_level?: number;
960
+ split_fill?: boolean;
961
+ split_base?: number;
962
+ /** A candle group's first output (OT17): the candle look, the border and
963
+ * wick colours ([both] or [up, down]) and the border width 0..10. */
964
+ candle_style?: 'candle' | 'hollow' | 'ohlc' | 'high_low';
965
+ border_colors?: WrunColorWord[];
966
+ wick_colors?: WrunColorWord[];
967
+ border_width?: number;
968
+ /** OT32: the format companions (WrunValueFormatKeys); `decimals` and
969
+ * `signed` need `format`, a `unit` without format keeps its legacy
970
+ * meaning (accepted, unprinted, unbounded). */
971
+ decimals?: number;
972
+ signed?: boolean;
973
+ unit?: string;
974
+ /** Bar and histogram outputs (OT34): each column's alpha follows |value|
975
+ * within the visible range. */
976
+ grading?: 'linear' | 'square';
977
+ /** Shape outputs with `shape: "char"` (OT35): the one character drawn and
978
+ * its font word. */
979
+ char?: string;
980
+ font_family?: WrunFontFamily;
981
+ /** Bar and histogram outputs (OT38): outputs sharing a stack name stack in
982
+ * declaration order (positives above 0, negatives below). */
983
+ stack?: string;
984
+ /** PT-heatmap: the `out.grid` name this data-only output belongs to (one of
985
+ * 2..128 contiguous `<grid>_<row>` outputs). */
986
+ grid?: string;
987
+ }
988
+ /** kScript plotShape(location=...) (titan reads the same field): 'absolute'
989
+ * (on the value, the default), 'aboveBar' / 'belowBar' (offset above the
990
+ * bar's high or below its low on the price pane), 'top' / 'bottom' (the
991
+ * pane's edge). */
992
+ export type WrunMarkerLocation = 'absolute' | 'aboveBar' | 'belowBar' | 'top' | 'bottom';
993
+ /** The sheet spelling of a mark placement (OT07, D5): the engine words plus
994
+ * the kit's snake_case `above_bar` / `below_bar`, which the run-result
995
+ * adapter maps to the engine's (`wrunMarkerLocation`). */
996
+ export type WrunSheetMarkerLocation = WrunMarkerLocation | 'above_bar' | 'below_bar';
997
+ interface WrunInset {
998
+ dock: 'top' | 'bottom';
999
+ height_px?: number;
1000
+ shape?: 'histogram' | 'area' | 'line';
1001
+ }
1002
+ export interface WrunFrameSlot {
1003
+ name: string;
1004
+ max_bytes?: number;
1005
+ }
1006
+ /** One stacked segment of a docked level (g2 DL-stacked): the frame's
1007
+ * `series` arrays feed them in this order. */
1008
+ export interface WrunLevelsSeries {
1009
+ name: string;
1010
+ color: WrunColorWord;
1011
+ }
1012
+ /** One `levels[]` entry (`plot.levels`, g2 and g6 DL-time-anchored): a
1013
+ * docked profile fed by a frame. Today's six keys stay first; every key
1014
+ * after them is opt-in and absent keeps today's drawing. */
1015
+ export interface WrunLevels {
1016
+ name: string;
1017
+ frame: string;
1018
+ dock: 'left' | 'right';
1019
+ width_frac?: number;
1020
+ poc?: boolean;
1021
+ labels?: boolean;
1022
+ /** A colour word (DL-alpha: `#rrggbbaa` and theme tokens included). */
1023
+ color?: WrunColorWord;
1024
+ /** DL-lower-pane: dock on the indicator's lower pane. */
1025
+ panel?: WrunRendererPanel;
1026
+ /** DL-behind-candles (D4). */
1027
+ behind_candles?: boolean;
1028
+ /** DL-alpha: the row fill alpha, 0..1 (default 0.65). */
1029
+ opacity?: number;
1030
+ /** DL-two-sided: bars grow from the dock edge or from a centre line. */
1031
+ baseline?: 'edge' | 'center';
1032
+ /** DL-stacked: 1..8 named segments with unique names. */
1033
+ series?: WrunLevelsSeries[];
1034
+ /** DL-even-grid: the price step of an even grid (> 0). */
1035
+ step?: number;
1036
+ /** DL-thickness: row thickness in px, integer 2..40. */
1037
+ thickness_px?: number;
1038
+ /** DL-scale: a pixel width (integer 16..600) over `width_frac`, and the
1039
+ * scale denominator: own, shared across the sheet's levels, or fixed at
1040
+ * `scale_max` (required then; the frame may carry it too). */
1041
+ width_px?: number;
1042
+ scale?: 'own' | 'shared' | 'fixed';
1043
+ scale_max?: number;
1044
+ /** DL-columns: `[x, 0]`, x integer 0..4096 px inward; `beside` names
1045
+ * another declared level this one sits next to. */
1046
+ offset?: [number, number];
1047
+ beside?: string;
1048
+ /** DL-value-format (conventions 8, WrunValueFormatKeys). */
1049
+ format?: WrunValueFormat;
1050
+ decimals?: number;
1051
+ signed?: boolean;
1052
+ unit?: string;
1053
+ /** DL-label-style: the row label ink, size (px, 6..64), weight, family and
1054
+ * placement. */
1055
+ text_color?: WrunColorWord;
1056
+ font_size?: number;
1057
+ font_weight?: WrunFontWeight;
1058
+ font_family?: WrunFontFamily;
1059
+ label_place?: 'outside' | 'inside' | 'axis';
1060
+ /** DL-hover: a hover card per row (a switch; the frame's `tooltips` fill it). */
1061
+ hover?: boolean;
1062
+ /** DL-poc: the POC row's ink, width (1..10 px), dash, reach and tag. */
1063
+ poc_color?: WrunColorWord;
1064
+ poc_width?: number;
1065
+ poc_line_style?: WrunLineStyleWord;
1066
+ poc_extend?: 'dock' | 'pane';
1067
+ poc_label?: boolean;
1068
+ /** DL-value-area (the frame's `value_area` names the span): rows outside
1069
+ * it fade to `outside_opacity`; the edges take a colour, width (0..10 px,
1070
+ * 0 = no edge lines), dash and tags. */
1071
+ outside_opacity?: number;
1072
+ value_area_color?: WrunColorWord;
1073
+ value_area_width?: number;
1074
+ value_area_line_style?: WrunLineStyleWord;
1075
+ value_area_labels?: boolean;
1076
+ /** DL-gradient: 2..8 stops across each bar (default direction horizontal
1077
+ * here). */
1078
+ gradient?: WrunColorWord[];
1079
+ gradient_direction?: WrunGradientDirection;
1080
+ /** DL-borders: row outlines and the outline shape. */
1081
+ border_color?: WrunColorWord;
1082
+ border_width?: number;
1083
+ border_style?: WrunLineStyleWord;
1084
+ shape?: 'bars' | 'outline';
1085
+ /** DL-time-anchored: `time` draws each frame span inside its own time range
1086
+ * (the frame then carries `spans`); `pane` keeps the edge dock. */
1087
+ span?: 'pane' | 'time';
1088
+ }
1089
+ /** `stroke_fade` on a line panel (g1 SC03): the stroke fades toward the
1090
+ * edges away from `pivot` (an x value or "spot"). */
1091
+ export interface WrunPanelStrokeFade {
1092
+ pivot: number | 'spot';
1093
+ edge_opacity?: number;
1094
+ left_color?: WrunColorWord;
1095
+ right_color?: WrunColorWord;
1096
+ }
1097
+ /** One marker on a line panel (g1 SC04): a vertical marker at x, or with
1098
+ * `valign: "point"` a callout pinned at (x, y), or at x on a declared series
1099
+ * (C3). A frame may carry the list too (it replaces the declared one for
1100
+ * that run). */
1101
+ export interface WrunPanelMarker {
1102
+ x: number | string;
1103
+ label?: string;
1104
+ color?: WrunColorWord;
1105
+ badge?: boolean;
1106
+ wash?: boolean;
1107
+ valign?: 'top' | 'middle' | 'point';
1108
+ /** With valign "point" only: the value the label is pinned at. */
1109
+ y?: number;
1110
+ /** With valign "point" only: the declared series (by name) whose value at
1111
+ * x anchors the label; default the first series. */
1112
+ series?: string;
1113
+ show_value?: boolean;
1114
+ line_style?: WrunLineStyleWord;
1115
+ width?: number;
1116
+ }
1117
+ /** The badge chip on a panel's title row (C2): line, bars, histogram and
1118
+ * scatter; also a frame field (the frame's replaces the declared one for
1119
+ * that run). `color` defaults to theme.accent, `text_color` to the ink the
1120
+ * fill's luminance picks. */
1121
+ export interface WrunPanelBadge {
1122
+ text: string;
1123
+ color?: WrunColorWord;
1124
+ text_color?: WrunColorWord;
1125
+ }
1126
+ /** One reference line on a scatter panel (g1 SC20); also a frame field. */
1127
+ export interface WrunPanelGuide {
1128
+ axis: 'x' | 'y';
1129
+ value: number;
1130
+ label?: string;
1131
+ color?: WrunColorWord;
1132
+ line_style?: WrunLineStyleWord;
1133
+ width?: number;
1134
+ }
1135
+ /** Quadrant shading on a scatter panel (g1 SC20): colours and labels in the
1136
+ * order top right, top left, bottom left, bottom right; also a frame field. */
1137
+ export interface WrunPanelQuadrants {
1138
+ x: number;
1139
+ y: number;
1140
+ colors: [WrunColorWord, WrunColorWord, WrunColorWord, WrunColorWord];
1141
+ labels?: [string, string, string, string];
1142
+ }
1143
+ /** A heatmap panel's highlighted row and/or column (g1 SC18), at least one;
1144
+ * also a frame field. */
1145
+ export interface WrunPanelHighlight {
1146
+ row?: string;
1147
+ col?: string;
1148
+ }
1149
+ /** The per-series style words of a panel (`panels[i].series[j]`, g1 SC24
1150
+ * SC25 SC29 SC30 SC35 SC40): line series take fill, style, smooth, points,
1151
+ * labels, width and line_style; table series take align and the column
1152
+ * format; `legend` applies to line and bars series. */
1153
+ export interface WrunPanelSeriesStyle {
1154
+ fill?: boolean;
1155
+ fill_color?: WrunColorWord;
1156
+ style?: 'line' | 'bars' | 'step';
1157
+ smooth?: boolean;
1158
+ points?: boolean;
1159
+ labels?: boolean;
1160
+ width?: number;
1161
+ line_style?: WrunLineStyleWord;
1162
+ legend?: boolean;
1163
+ align?: WrunTextAlign;
1164
+ format?: WrunValueFormat;
1165
+ decimals?: number;
1166
+ signed?: boolean;
1167
+ unit?: string;
1168
+ }
1169
+ /** One panel series: the collab panel's `{ name, color }` plus the g1 style
1170
+ * words (`color` takes a colour word, SC16). */
1171
+ export type WrunPanelSeries = NonNullable<ParsedPanel['panel']['series']>[number] & WrunPanelSeriesStyle;
1172
+ /** The panel-level style words (`panels[i]`, g1 section 2 and g6
1173
+ * MX-side-panel), each scoped to the kinds its contract row names (the
1174
+ * kit's `WRUN_PANEL_WORD_KINDS` refuses the rest by name); absent keeps
1175
+ * today's drawing. Frame fields of the same name override per run. */
1176
+ export interface WrunPanelStyle {
1177
+ /** SC09: 0.05..0.9 of the chart height. */
1178
+ height_frac?: number;
1179
+ /** SC10: a maximize button; `stats_row` adds the line pane's stats row. */
1180
+ maximize?: boolean;
1181
+ stats_row?: boolean;
1182
+ /** SC27: the pane font (default `ui`, Inter). */
1183
+ font_family?: WrunFontFamily;
1184
+ /** SC07: hover readouts (default true). */
1185
+ hover_card?: boolean;
1186
+ /** SC23 SC02 SC37: the pane frame (pie: box or none). */
1187
+ chrome?: 'box' | 'grid' | 'none';
1188
+ format?: WrunValueFormat;
1189
+ decimals?: number;
1190
+ signed?: boolean;
1191
+ unit?: string;
1192
+ x_format?: WrunValueFormat;
1193
+ x_decimals?: number;
1194
+ x_unit?: string;
1195
+ x_title?: string;
1196
+ y_title?: string;
1197
+ x_min?: number;
1198
+ x_max?: number;
1199
+ y_min?: number;
1200
+ y_max?: number;
1201
+ y_zero?: boolean;
1202
+ legend_style?: 'none' | 'title' | 'pane' | 'chips';
1203
+ legend_latest?: boolean;
1204
+ /** The title-row badge chip (C2) on line, bars, histogram and scatter. */
1205
+ badge?: WrunPanelBadge;
1206
+ positive_color?: WrunColorWord;
1207
+ negative_color?: WrunColorWord;
1208
+ smooth?: boolean;
1209
+ points?: boolean;
1210
+ glow?: boolean;
1211
+ animate?: boolean;
1212
+ fill_mode?: 'flat' | 'signed';
1213
+ fill_positive_color?: WrunColorWord;
1214
+ fill_negative_color?: WrunColorWord;
1215
+ fill_fade?: boolean;
1216
+ stroke_fade?: WrunPanelStrokeFade;
1217
+ /** 0..8 markers. */
1218
+ markers?: WrunPanelMarker[];
1219
+ /** Bars and histogram: the bar's share of its category slot, 0.2..1 (the
1220
+ * engine's `barWidthFrac`, default 0.72). The app validates it on both
1221
+ * lanes (the kit does not know it yet). */
1222
+ bar_width?: number;
1223
+ /** Bars and histogram: the corner radius of the bar's data end, integer
1224
+ * 0..12 px (the engine's `barRadius`, default 0). Validated like
1225
+ * `bar_width`. */
1226
+ bar_radius?: number;
1227
+ color_mode?: 'series' | 'sign';
1228
+ /** histogram: the bars; scatter: the default point colour. */
1229
+ color?: WrunColorWord;
1230
+ /** 0..8 guides. */
1231
+ guides?: WrunPanelGuide[];
1232
+ quadrants?: WrunPanelQuadrants;
1233
+ trails?: boolean;
1234
+ trail_width?: number;
1235
+ trail_fade?: boolean;
1236
+ label_overlap?: 'hide' | 'leader' | 'show';
1237
+ hole_total?: boolean;
1238
+ hole_caption?: string;
1239
+ slice_gap?: number;
1240
+ border_color?: WrunColorWord;
1241
+ border_width?: number;
1242
+ scale?: 'palette' | 'signed';
1243
+ palette?: WrunColorWord[];
1244
+ min?: number;
1245
+ max?: number;
1246
+ highlight?: WrunPanelHighlight;
1247
+ row_title?: string;
1248
+ col_title?: string;
1249
+ columns?: number;
1250
+ accent?: 'auto' | 'neutral';
1251
+ position?: WrunLabelPosition;
1252
+ offset?: [number, number];
1253
+ width?: number;
1254
+ column_widths?: number[];
1255
+ cell_padding?: number;
1256
+ font_size?: number;
1257
+ font_weight?: WrunFontWeight;
1258
+ align?: WrunTextAlign;
1259
+ valign?: WrunValign;
1260
+ text_color?: WrunColorWord;
1261
+ header_text_color?: WrunColorWord;
1262
+ background_color?: WrunColorWord;
1263
+ background_opacity?: number;
1264
+ background_gradient?: WrunColorWord[];
1265
+ gradient_direction?: WrunGradientDirection;
1266
+ header_background_color?: WrunColorWord;
1267
+ border_style?: WrunLineStyleWord;
1268
+ grid_color?: WrunColorWord;
1269
+ grid_width?: number;
1270
+ grid_style?: WrunLineStyleWord;
1271
+ grid_lines?: 'all' | 'rows' | 'cols' | 'none';
1272
+ header_column?: boolean;
1273
+ /** integer 160..480 px (default 280). */
1274
+ width_px?: number;
1275
+ /** integer 80..800 px (default an equal share of the strip). */
1276
+ height_px?: number;
1277
+ }
1278
+ /** One `panels[]` entry (`panel.<kind>`): the collab panel shape minus its
1279
+ * payload id, the g1 style words, the sheet name and the frame slot it
1280
+ * reads; `series` entries carry the per-series words. */
1281
+ export type WrunPanel = Omit<ParsedPanel['panel'], 'id' | 'series'> & WrunPanelStyle & {
1282
+ name: string;
1283
+ frame: string;
1284
+ series?: WrunPanelSeries[];
1285
+ };
1286
+ interface WrunStringSlot {
1287
+ index: number;
1288
+ name: string;
1289
+ max_bytes: number;
1290
+ }
1291
+ /** A renderer's chart side (frozen sheet contract): 'overlay' on an
1292
+ * offchart package mounts the renderer on the price pane (the kScript
1293
+ * forceOnChart channel), 'lower' the package's own pane. */
1294
+ export type WrunRendererPanel = 'overlay' | 'lower';
1295
+ /** The look keys past the om SDK's own (frozen sheet contract) ride the
1296
+ * declaration verbatim: the om schema keeps renderer objects non-strict, so
1297
+ * they publish and reach the chart, each snake_case key mapping to the
1298
+ * engine payload field of the same name. */
1299
+ export type WrunRenderer = ({
1300
+ kind: 'inset';
1301
+ name: string;
1302
+ output: string;
1303
+ color?: string;
1304
+ } & WrunInset)
1305
+ /** `style: 'price_label'` (wrun-3) draws the row's text as a price tag at
1306
+ * y (the engine's plotPriceLabel) instead of plain text. `color_by` +
1307
+ * `colors` color each record through a numeric output's value on its own
1308
+ * row (floor; NaN = the static `color`). `x_align`/`y_align` are
1309
+ * plotText's xAlign/yAlign; `label_type`, `label_position` and
1310
+ * `background_color` are plotPriceLabel's type, position and
1311
+ * backgroundColor; `background_color_by` + `background_colors` pick the
1312
+ * background per record the same way (NaN = the static
1313
+ * `background_color`). `tooltip_from` (price_label only) names another
1314
+ * text renderer whose record on the same row is this record's
1315
+ * plotPriceLabel `tooltip`; that source renderer never mounts itself.
1316
+ * `color_packed_by` (in place of `color_by`) reads each record's colour
1317
+ * packed from the named output (see WrunMetadataOutput.color_packed_by).
1318
+ * `size_by` names a declared output whose value on the record's own row
1319
+ * is the record's size in px (finite and > 0, else the static `size`),
1320
+ * the plotText / plotPriceLabel(size=...) a size select drives. On the
1321
+ * price-label path only: `background_color_packed_by` (in place of
1322
+ * `background_color_by`) reads each record's background packed from the
1323
+ * named output, and the static `font_weight` / `opacity` are
1324
+ * plotPriceLabel's fontWeight / opacity, clamped like the engine. */
1325
+ | {
1326
+ kind: 'text';
1327
+ name: string;
1328
+ y: string;
1329
+ text: string;
1330
+ color?: string;
1331
+ size?: number;
1332
+ size_by?: string;
1333
+ /** The look: the accepted text style words of wrun-handles.util (g4
1334
+ * DW26 widens that list to the eight WrunTextLook words). */
1335
+ style?: WrunTextStyle;
1336
+ color_by?: string;
1337
+ colors?: string[];
1338
+ color_packed_by?: string;
1339
+ x_align?: string;
1340
+ y_align?: string;
1341
+ label_type?: string;
1342
+ label_position?: string;
1343
+ background_color?: string;
1344
+ background_color_by?: string;
1345
+ background_colors?: string[];
1346
+ background_color_packed_by?: string;
1347
+ /** A number is plotPriceLabel's static fontWeight through the engine's
1348
+ * clamp (price labels only, readWrunPriceLabelLook); a word is the
1349
+ * DW08 font word on every text (wrunTextLookPayload). */
1350
+ font_weight?: number | WrunFontWeight;
1351
+ opacity?: number;
1352
+ tooltip_from?: string;
1353
+ panel?: WrunRendererPanel;
1354
+ align?: WrunTextAlign;
1355
+ valign?: WrunValign;
1356
+ border_color?: WrunColorWord;
1357
+ corner_radius?: number;
1358
+ font_family?: WrunFontFamily;
1359
+ emblem_shape?: WrunEmblemShape;
1360
+ emblem_color?: WrunColorWord;
1361
+ }
1362
+ /** A label sits at an (x, y) point, or (wrun-3) in a chart corner named by
1363
+ * `position`, where x/y become an optional anchor point. `size_by` sizes
1364
+ * it from the named output on the label's selected row, like text. g4
1365
+ * DW26 / DW27 add the look keys and, on a corner label, a px `offset`
1366
+ * nudge ([x, y], each -200..200) in place of the point. */
1367
+ | {
1368
+ kind: 'label';
1369
+ name: string;
1370
+ x?: string;
1371
+ y?: string;
1372
+ text: string;
1373
+ color?: string;
1374
+ size?: number;
1375
+ size_by?: string;
1376
+ position?: WrunLabelPosition;
1377
+ style?: WrunTextLook;
1378
+ offset?: [number, number];
1379
+ align?: WrunTextAlign;
1380
+ valign?: WrunValign;
1381
+ background_color?: WrunColorWord;
1382
+ border_color?: WrunColorWord;
1383
+ corner_radius?: number;
1384
+ /** px, 0..64 (default 4). */
1385
+ padding?: number;
1386
+ font_weight?: WrunFontWeight;
1387
+ font_family?: WrunFontFamily;
1388
+ emblem_shape?: WrunEmblemShape;
1389
+ emblem_color?: WrunColorWord;
1390
+ }
1391
+ /** The styling keys are plotTable's payload fields in snake_case; absent
1392
+ * = the engine defaults. The `*_by` ladders read a declared output's
1393
+ * value on the selected snapshot's row: `header_background_color_by` +
1394
+ * `header_background_colors`, `border_color_by` + `border_colors` and
1395
+ * `position_by` + `positions` (the `position` words) index their table
1396
+ * (floor), `font_size_by`'s value IS the font size (finite and > 0); a
1397
+ * non-finite value keeps the static key. `header_background_color_packed_by`
1398
+ * and `border_color_packed_by` (in place of their `*_color_by` ladders) read
1399
+ * the colour packed from the named output at that row. `cell_styles` turns
1400
+ * the named cell slots into the engine's object cells.
1401
+ *
1402
+ * The styled-table surface (kit scaffold 37, the capability round) adds,
1403
+ * all optional and every one mapped to the engine's camelCase key of the
1404
+ * same name: an `offset` nudge, `width` and `column_widths` (0 = measured),
1405
+ * `header_rows` (over `header_row`), `font_weight`, `align` and `valign`,
1406
+ * `background_opacity`, `background_gradient` + `gradient_direction`, the
1407
+ * frame's `border_style` and `corner_radius` apart from the inner grid
1408
+ * (`grid_color`, `grid_width`, `grid_style`, `grid_lines`), and the ladder triplet
1409
+ * (`<key>_by` + `<key>s`, or `<key>_packed_by`) on every colour key
1410
+ * (`text_color`, `header_text_color`, `background_color`, `grid_color`
1411
+ * beside the two the frozen contract already had). The words are the
1412
+ * kit's `WRUN_TABLE_*` lists (`wrun-table-look.util.ts`), refused by name
1413
+ * otherwise. */
1414
+ | {
1415
+ kind: 'table';
1416
+ name: string;
1417
+ rows: number;
1418
+ cols: number;
1419
+ position?: string;
1420
+ cells: string[];
1421
+ header_row?: boolean;
1422
+ header_column?: boolean;
1423
+ text_color?: string;
1424
+ header_text_color?: string;
1425
+ background_color?: string;
1426
+ header_background_color?: string;
1427
+ border_color?: string;
1428
+ border_width?: number;
1429
+ font_size?: number;
1430
+ cell_padding?: number;
1431
+ font_family?: string;
1432
+ header_background_color_by?: string;
1433
+ header_background_colors?: string[];
1434
+ header_background_color_packed_by?: string;
1435
+ border_color_by?: string;
1436
+ border_colors?: string[];
1437
+ border_color_packed_by?: string;
1438
+ position_by?: string;
1439
+ positions?: string[];
1440
+ font_size_by?: string;
1441
+ /** The painted row count (frozen authoring contract C1.6): a declared
1442
+ * (data-only) output whose value on the table snapshot's row, floored
1443
+ * and clamped to 0..`rows`, is how many leading grid rows mount; the
1444
+ * later rows are not painted (the kScript plotTable data array built
1445
+ * shorter on that bar). Absent or a non-finite value paints every row;
1446
+ * 0 mounts no table. */
1447
+ rows_by?: string;
1448
+ /** Keyed by cell slot name (an entry of `cells`). */
1449
+ cell_styles?: Record<string, WrunTableCellStyle>;
1450
+ /** A px nudge from the anchor, [x, y], each within +-200. */
1451
+ offset?: number[];
1452
+ /** The table's px width (absent = measured). */
1453
+ width?: number;
1454
+ /** One px width per column (`cols` entries); 0 = measured. */
1455
+ column_widths?: number[];
1456
+ /** How many leading rows are header rows (0..rows); replaces `header_row`. */
1457
+ header_rows?: number;
1458
+ text_color_by?: string;
1459
+ text_colors?: string[];
1460
+ text_color_packed_by?: string;
1461
+ header_text_color_by?: string;
1462
+ header_text_colors?: string[];
1463
+ header_text_color_packed_by?: string;
1464
+ background_color_by?: string;
1465
+ background_colors?: string[];
1466
+ background_color_packed_by?: string;
1467
+ /** 0..1 alpha of every background fill without a cell opacity of its own. */
1468
+ background_opacity?: number;
1469
+ /** 2..8 colour stops across the whole surface. */
1470
+ background_gradient?: string[];
1471
+ /** `vertical` (default) or `horizontal`; shared with the cell gradients. */
1472
+ gradient_direction?: string;
1473
+ /** The frame: `solid`, `dashed` or `dotted`, and its px corner radius (0..32). */
1474
+ border_style?: string;
1475
+ corner_radius?: number;
1476
+ /** The lines between cells, apart from the frame. */
1477
+ grid_color?: string;
1478
+ grid_color_by?: string;
1479
+ grid_colors?: string[];
1480
+ grid_color_packed_by?: string;
1481
+ grid_width?: number;
1482
+ grid_style?: string;
1483
+ /** `all` (default), `rows`, `cols` or `none`. */
1484
+ grid_lines?: string;
1485
+ /** `normal` or `bold`. */
1486
+ font_weight?: string;
1487
+ /** Default horizontal (`left`, `center`, `right`) and vertical (`top`,
1488
+ * `middle`, `bottom`) alignment of every cell without its own. */
1489
+ align?: string;
1490
+ valign?: string;
1491
+ }
1492
+ /** `fill: true` is the plotShape(fill=true) filled glyph. `width_by` names
1493
+ * a declared output whose value on the record's own row IS the mark
1494
+ * width (finite and > 0, else the static `width`), the
1495
+ * plotShape(width=...) a size select drives. `color_by` (scaffold 21)
1496
+ * names a declared output whose per-bar value indexes `colors`, the
1497
+ * bgcolor rule on a mark (floor; a finite out-of-range index clamps to
1498
+ * entry 0; a non-finite value draws NO mark, the static `color` never
1499
+ * substitutes); both halves or neither. `color_packed_by` (in place of
1500
+ * `color_by`) names a declared output whose value on the mark's row IS
1501
+ * its colour, packed (a value that does not decode draws the static
1502
+ * `color`, else no mark). `glow` is the plotShape(glow=...) output glow
1503
+ * (true, or px through the engine's clamp; false or 0 = none). */
1504
+ | {
1505
+ kind: 'shape';
1506
+ name: string;
1507
+ shape: string;
1508
+ output: string;
1509
+ where?: string;
1510
+ color?: string;
1511
+ color_by?: string;
1512
+ colors?: string[];
1513
+ color_packed_by?: string;
1514
+ width?: number;
1515
+ width_by?: string;
1516
+ fill?: boolean;
1517
+ /** A glow around the mark: px >= 0 (OT16), or the plotShape boolean
1518
+ * (true = the engine's default glow, false = none). */
1519
+ glow?: boolean | number;
1520
+ panel?: WrunRendererPanel;
1521
+ /** The plotShape(location=...) placement (see
1522
+ * WrunMetadataOutput.location; D5 words); absent = on the value. */
1523
+ location?: WrunSheetMarkerLocation;
1524
+ /** The plotShape(showPriceDisplay=...) kwarg (see
1525
+ * WrunMetadataOutput.show_price_display, read only under
1526
+ * `price_display: "per_output"`); absent = no tag. */
1527
+ show_price_display?: boolean;
1528
+ /** Per-run `show_price_display` (see
1529
+ * WrunMetadataOutput.show_price_display_by). */
1530
+ show_price_display_by?: string;
1531
+ /** With `shape: "char"`: the one character drawn and its font word. */
1532
+ char?: string;
1533
+ font_family?: WrunFontFamily;
1534
+ /** 0..1, fades a filled mark's interior (the colour's own alpha stays). */
1535
+ fill_opacity?: number;
1536
+ /** A hover template ({{name}}, {{name:format}}, {{label}}, {{value}}). */
1537
+ tooltip?: string;
1538
+ }
1539
+ /** `color` (static) or `colors` ride the plotStatRow colors table
1540
+ * ([primary, secondary]: diverging rows read [bull, bear], magnitude rows
1541
+ * the first); `colors` + `color_by` is a per-bar ladder, `color_packed_by`
1542
+ * a packed per-bar colour. */
1543
+ | {
1544
+ kind: 'stats_row';
1545
+ name: string;
1546
+ output: string;
1547
+ title?: string;
1548
+ format?: string;
1549
+ polarity?: string;
1550
+ color?: string;
1551
+ colors?: string[];
1552
+ color_by?: string;
1553
+ color_packed_by?: string;
1554
+ /** g3 DW39: integer 1..3 (default 2); 1 keeps its text longest as the
1555
+ * bars narrow. */
1556
+ priority?: number;
1557
+ /** Whether the row draws (scaffold 42; absent = true). false selects
1558
+ * nothing at all, the way a kScript script that runs plotStatRow only
1559
+ * under a switch draws no row while it is off. A switch param paints
1560
+ * it through `style_targets` ({ path: ["renderers", <name>,
1561
+ * "visible"] }); the sheet holds the key it paints. */
1562
+ visible?: boolean;
1563
+ }
1564
+ /** Per-bar background tint: one record per ready row whose `where` gate is
1565
+ * finite and nonzero. `color_by` names a declared output whose per-bar
1566
+ * value indexes `colors` (floor; out of range clamps to 0; a non-finite
1567
+ * rung emits NO record); `color_packed_by` names one whose value IS the
1568
+ * packed colour (a value that does not decode paints the static `color`,
1569
+ * else no record); without either the static `color` paints every gated
1570
+ * bar. */
1571
+ | {
1572
+ kind: 'bgcolor';
1573
+ name: string;
1574
+ where: string;
1575
+ color?: string;
1576
+ color_by?: string;
1577
+ colors?: string[];
1578
+ color_packed_by?: string;
1579
+ panel?: WrunRendererPanel;
1580
+ /** g5 OT38: with a width (px, 0.5..10) each gated bar draws a vertical
1581
+ * line instead of a band; `line_style` needs `width`. */
1582
+ width?: number;
1583
+ line_style?: WrunLineStyleWord;
1584
+ }
1585
+ /** Per-bar candle tint (scaffold 20): the bgcolor shape exactly, the tint
1586
+ * landing on the bar's own candle (body and wick) instead of the
1587
+ * background; bars with no record keep the chart's candle colors. Alpha
1588
+ * rides in the color string (no opacity knob). */
1589
+ | {
1590
+ kind: 'barcolor';
1591
+ name: string;
1592
+ where: string;
1593
+ color?: string;
1594
+ color_by?: string;
1595
+ colors?: string[];
1596
+ };
1597
+ /** One styled table cell (frozen sheet contract), the engine's plotTable
1598
+ * object cell `{ value, color, textColor, align, colspan }`: `color` is the
1599
+ * cell background, `text_color` its text; `color_by` + `colors` and
1600
+ * `text_color_by` + `text_colors` pick them through a declared output's
1601
+ * value on the table snapshot's row (floor; a non-finite value falls back
1602
+ * to the static key, else the key is omitted). `colspan` k (an integer >= 1)
1603
+ * spans the next k - 1 cells of the grid row, which do not mount.
1604
+ *
1605
+ * The styled-table surface (scaffold 37) adds `rowspan` (the cells below
1606
+ * do not mount either; both spans stay inside the grid at every grid cell
1607
+ * the slot occupies, and a cell under another span never spans itself),
1608
+ * the packed ladders (`color_packed_by`, `text_color_packed_by`, in place
1609
+ * of the indexed ones), `valign`, `font_size` (px, > 0), `font_weight`
1610
+ * (`normal`, `bold`), `opacity` (0..1, this cell's background alpha) and
1611
+ * `gradient` (2..8 stops across the cell) with its own
1612
+ * `gradient_direction`.
1613
+ *
1614
+ * `tooltip` (frozen authoring contract C1.6) names a declared string slot:
1615
+ * the cell's hover text is that slot's text on the table snapshot's row,
1616
+ * the kScript object cell's `tooltip` (after `align`, the engine's key
1617
+ * order); an unwritten slot there leaves the cell without one. */
1618
+ export interface WrunTableCellStyle {
1619
+ align?: string;
1620
+ tooltip?: string;
1621
+ colspan?: number;
1622
+ color?: string;
1623
+ text_color?: string;
1624
+ color_by?: string;
1625
+ colors?: string[];
1626
+ text_color_by?: string;
1627
+ text_colors?: string[];
1628
+ rowspan?: number;
1629
+ color_packed_by?: string;
1630
+ text_color_packed_by?: string;
1631
+ valign?: string;
1632
+ font_size?: number;
1633
+ font_weight?: string;
1634
+ opacity?: number;
1635
+ gradient?: string[];
1636
+ gradient_direction?: string;
1637
+ }
1638
+ /** Look defaults for wrun-3 handle records (frozen sheet contract): a
1639
+ * label's `sticky_right` / `font_weight` and a line's `sticky_right` ride
1640
+ * the record props as the engine's label.new / line.new `stickyRight` and
1641
+ * `fontWeight` wherever a record does not carry the prop itself. */
1642
+ export interface WrunHandleLookDefaults {
1643
+ label?: {
1644
+ sticky_right?: boolean;
1645
+ font_weight?: number;
1646
+ };
1647
+ line?: {
1648
+ sticky_right?: boolean;
1649
+ };
1650
+ }
1651
+ /** The look of a label box (g4 DW07): `box` is today's rounded box, `plain`
1652
+ * bare text, `knockout` a box filled with the chart background, `emblem` a
1653
+ * leading mark and the text. */
1654
+ export type WrunLabelLook = 'box' | 'plain' | 'knockout' | 'emblem' | 'pill' | 'badge' | 'callout';
1655
+ /** `style` on `render.text` / `render.label` (g4 DW26): the label looks plus
1656
+ * the price tag. */
1657
+ export type WrunTextLook = WrunLabelLook | 'price_label';
1658
+ /** `emblem_shape` (DW07, DW29). */
1659
+ export type WrunEmblemShape = 'dot' | 'square' | 'diamond' | 'triangle_up' | 'triangle_down';
1660
+ /** `arrow` on lines and polylines (DW18). */
1661
+ export type WrunDrawingArrow = 'none' | 'start' | 'end' | 'both';
1662
+ /** `extend` on boxes and lines (DW31; handles.line had it). */
1663
+ export type WrunDrawingExtend = 'none' | 'left' | 'right' | 'both';
1664
+ /** The keys g4 (and g3 DW06) add to `handles.line` and `drawings[kind=line]`. */
1665
+ export interface WrunLineHandleStyle {
1666
+ arrow?: WrunDrawingArrow;
1667
+ /** Glow blur in px, 0..32; `glow_color` defaults to the stroke colour. */
1668
+ glow?: number;
1669
+ glow_color?: WrunColorWord;
1670
+ /** DW17: the line and its tag stick beside the price axis. */
1671
+ sticky_right?: boolean;
1672
+ /** DW16: the endpoint price on the price axis. */
1673
+ axis_label?: 'none' | 'price';
1674
+ opacity?: number;
1675
+ /** DW06: keep clear of the chart chrome. */
1676
+ safe_area?: boolean;
1677
+ }
1678
+ /** The keys g4 (and g3 DW06) add to `handles.box` and `drawings[kind=box]`. */
1679
+ export interface WrunBoxHandleStyle {
1680
+ border_style?: WrunLineStyleWord;
1681
+ /** px, 0..32 (D1). */
1682
+ corner_radius?: number;
1683
+ extend?: WrunDrawingExtend;
1684
+ /** DW29: the ellipse inscribed in the box. */
1685
+ shape?: 'rect' | 'ellipse';
1686
+ /** DW34: 2..8 stops; `gradient_direction` needs `gradient`. */
1687
+ gradient?: WrunColorWord[];
1688
+ gradient_direction?: WrunGradientDirection;
1689
+ glow?: number;
1690
+ glow_color?: WrunColorWord;
1691
+ /** Box text (DW31, DW08): ink, size (px, integer 6..64), weight, family,
1692
+ * alignment inside the box and padding (px, 0..64). */
1693
+ text_color?: WrunColorWord;
1694
+ font_size?: number;
1695
+ font_weight?: WrunFontWeight;
1696
+ font_family?: WrunFontFamily;
1697
+ align?: WrunTextAlign;
1698
+ valign?: WrunValign;
1699
+ padding?: number;
1700
+ safe_area?: boolean;
1701
+ }
1702
+ /** The keys g4 (and g3 DW06) add to `handles.label` and `drawings[kind=label]`. */
1703
+ export interface WrunLabelHandleStyle {
1704
+ style?: WrunLabelLook;
1705
+ background_color?: WrunColorWord;
1706
+ border_color?: WrunColorWord;
1707
+ /** 0..10 (default 1). */
1708
+ border_width?: number;
1709
+ /** px, 0..32 (D1). */
1710
+ corner_radius?: number;
1711
+ /** DW08: default `bold` (today's 700). */
1712
+ font_weight?: WrunFontWeight;
1713
+ font_family?: WrunFontFamily;
1714
+ /** DW33: vertical placement, padding (px, 0..64), wrap width (px,
1715
+ * 0..2000, 0 = no wrap) and rotation (degrees, -90..90). */
1716
+ valign?: WrunValign;
1717
+ padding?: number;
1718
+ max_width?: number;
1719
+ angle?: number;
1720
+ glow?: number;
1721
+ glow_color?: WrunColorWord;
1722
+ emblem_shape?: WrunEmblemShape;
1723
+ emblem_color?: WrunColorWord;
1724
+ sticky_right?: boolean;
1725
+ /** DW16: the label's price or its text on the price axis. */
1726
+ axis_label?: 'none' | 'price' | 'text';
1727
+ opacity?: number;
1728
+ safe_area?: boolean;
1729
+ }
1730
+ /** The keys g4 (and g3 DW06) add to `handles.polyline` and `drawings[kind=polyline]`. */
1731
+ export interface WrunPolylineHandleStyle {
1732
+ opacity?: number;
1733
+ /** DW30: the polygon fill (default none); `closed` closes the path. */
1734
+ fill_color?: WrunColorWord;
1735
+ closed?: boolean;
1736
+ smooth?: boolean;
1737
+ arrow?: WrunDrawingArrow;
1738
+ glow?: number;
1739
+ glow_color?: WrunColorWord;
1740
+ safe_area?: boolean;
1741
+ }
1742
+ /** The g4 style key set of each handle kind. */
1743
+ export interface WrunHandleStyleByKind {
1744
+ line: WrunLineHandleStyle;
1745
+ box: WrunBoxHandleStyle;
1746
+ label: WrunLabelHandleStyle;
1747
+ polyline: WrunPolylineHandleStyle;
1748
+ }
1749
+ /** The g4 style keys of one handle kind (`WrunHandleStyle<'box'>`), or of
1750
+ * any kind when unparameterized. */
1751
+ export type WrunHandleStyle<K extends WrunHandleKind = WrunHandleKind> = WrunHandleStyleByKind[K];
1752
+ /** `chrome` on a card, feed or meter (DW04): `plain` stands for show_state
1753
+ * false, stripe false, border_width 0, title_text_color `theme.muted` and
1754
+ * controls `hover`; any of those declared beside it wins. */
1755
+ export type WrunWidgetChrome = 'state' | 'plain';
1756
+ /** When a widget paints its hide / collapse glyphs (DW04). */
1757
+ export type WrunWidgetControls = 'always' | 'hover' | 'none';
1758
+ /** A feed line's time column (DW38). */
1759
+ export type WrunFeedTimeFormat = 'HH:mm:ss' | 'HH:mm' | 'MM-dd HH:mm' | 'none';
1760
+ /** The surface and type words shared by `draw.card`, `draw.feed` and
1761
+ * `draw.meter` (g3 DW04 DW05 DW06 DW11 DW25), all opt-in: absent keeps
1762
+ * today's look, except that a card always paints an opaque surface and
1763
+ * shows state chrome only with `state_by` (wrun-card-style.util). */
1764
+ export interface WrunWidgetStyle {
1765
+ chrome?: WrunWidgetChrome;
1766
+ /** The 3 px state stripe (default true; false on a card without
1767
+ * `state_by` that names no `accent_color` or `state_colors`). */
1768
+ stripe?: boolean;
1769
+ controls?: WrunWidgetControls;
1770
+ /** The state ink (default per state; exclusive with a card's `state_colors`). */
1771
+ accent_color?: WrunColorWord;
1772
+ title_text_color?: WrunColorWord;
1773
+ /** px, integer 6..64 (default `font_size`). */
1774
+ title_font_size?: number;
1775
+ title_font_weight?: WrunFontWeight;
1776
+ /** The surface (a card that declares neither this nor `background_gradient`
1777
+ * paints `theme.bg`, opaque, so candles never draw through it; a feed or a
1778
+ * meter keeps the engine's faint wash). */
1779
+ background_color?: WrunColorWord;
1780
+ background_opacity?: number;
1781
+ background_gradient?: WrunColorWord[];
1782
+ gradient_direction?: WrunGradientDirection;
1783
+ /** The frame ink (default the state ink; `theme.grid` on a card without
1784
+ * `state_by` that names no `accent_color` or `state_colors`). */
1785
+ border_color?: WrunColorWord;
1786
+ border_width?: number;
1787
+ border_style?: WrunLineStyleWord;
1788
+ /** px, 0..32 (D1; default 6). */
1789
+ corner_radius?: number;
1790
+ /** px, 0..24 (default 6). */
1791
+ padding?: number;
1792
+ /** px, integer 80..1200 (default measured, under today's 40% cap). */
1793
+ width?: number;
1794
+ opacity?: number;
1795
+ /** px, integer 6..64 (default 12). */
1796
+ font_size?: number;
1797
+ font_family?: WrunFontFamily;
1798
+ font_weight?: WrunFontWeight;
1799
+ text_color?: WrunColorWord;
1800
+ label_text_color?: WrunColorWord;
1801
+ /** DW05: paint over every handle and user drawing, under the legend. */
1802
+ above_drawings?: boolean;
1803
+ /** DW06: keep clear of the legend, the action bar and the axis tags. */
1804
+ safe_area?: boolean;
1805
+ /** DW25: paint in the indicator's lower pane. */
1806
+ panel?: WrunRendererPanel;
1807
+ }
1808
+ /** The card headline band (DW01): exactly one of `output` (a declared
1809
+ * output) or `text` (a declared string slot), formatted like a row value
1810
+ * (DW23), 24 px bold left-aligned in the text ink unless declared. */
1811
+ export interface WrunCardHeadline {
1812
+ output?: string;
1813
+ text?: string;
1814
+ format?: WrunCardValueFormat;
1815
+ decimals?: number;
1816
+ signed?: boolean;
1817
+ unit?: string;
1818
+ color?: WrunColorWord | {
1819
+ color_by: string;
1820
+ colors: WrunColorWord[];
1821
+ };
1822
+ font_size?: number;
1823
+ font_weight?: WrunFontWeight;
1824
+ align?: WrunTextAlign;
1825
+ }
1826
+ /** A card row's value: a literal (up to 64 chars), a declared output with
1827
+ * its number format (DW23: every WrunValueFormat word plus `pct`, with the
1828
+ * decimals / signed / unit companions; absent = today's 6 significant
1829
+ * digits), or a declared string slot. */
1830
+ export type WrunCardValue = string | number | boolean | {
1831
+ output: string;
1832
+ format?: WrunCardValueFormat;
1833
+ decimals?: number;
1834
+ signed?: boolean;
1835
+ unit?: string;
1836
+ } | {
1837
+ text: string;
1838
+ };
1839
+ interface WrunCardRow {
1840
+ label: string;
1841
+ value?: WrunCardValue;
1842
+ color?: WrunColorWord | {
1843
+ color_by: string;
1844
+ colors: WrunColorWord[];
1845
+ };
1846
+ countdown_to?: {
1847
+ output: string;
1848
+ };
1849
+ clock?: true;
1850
+ spark?: {
1851
+ output: string;
1852
+ window: number;
1853
+ };
1854
+ }
1855
+ export interface WrunCardDrawing extends WrunWidgetStyle {
1856
+ kind: 'card';
1857
+ name: string;
1858
+ /** 1..40 chars, or up to 80 with `{{templates}}` (DW14). */
1859
+ title: string;
1860
+ anchor?: CardAnchor;
1861
+ /** [x, y] px, each integer -4096..4096 (DW24). */
1862
+ offset?: [number, number];
1863
+ z?: number;
1864
+ /** The output whose value (0 ok, 1 armed, 2 fired, 3 error) is the card's
1865
+ * state. Without it the card has no state: no state word, no state stripe
1866
+ * and a neutral frame. */
1867
+ state_by?: string;
1868
+ /** 1..12 rows, or 0..12 beside a headline. */
1869
+ rows: WrunCardRow[];
1870
+ headline?: WrunCardHeadline;
1871
+ /** DW01: the hairline under the headline (default true when a headline and
1872
+ * a row exist). */
1873
+ rule?: boolean;
1874
+ rule_color?: WrunColorWord;
1875
+ /** DW04: the state text (default true when the card declares `state_by`,
1876
+ * false without it) and the four state inks in the order ok, armed, fired,
1877
+ * error (exclusive with `accent_color`). */
1878
+ show_state?: boolean;
1879
+ state_colors?: [WrunColorWord, WrunColorWord, WrunColorWord, WrunColorWord];
1880
+ }
1881
+ export type WrunDrawing =
1882
+ /** A docked ladder over a frame; g3 DW15 DW38 DW25 add the title, the
1883
+ * width (0.02..0.5 of the pane), an `[x, 0]` offset (x 0..4096 px), the
1884
+ * row ink and format words, and the pane. */
1885
+ ({
1886
+ kind: 'ladder';
1887
+ name: string;
1888
+ frame: string;
1889
+ side: 'left' | 'right';
1890
+ divider?: {
1891
+ label: string;
1892
+ price: number;
1893
+ };
1894
+ title?: string;
1895
+ width_frac?: number;
1896
+ offset?: [number, number];
1897
+ opacity?: number;
1898
+ color?: WrunColorWord;
1899
+ labels?: boolean;
1900
+ text_color?: WrunColorWord;
1901
+ font_size?: number;
1902
+ font_family?: WrunFontFamily;
1903
+ font_weight?: WrunFontWeight;
1904
+ divider_color?: WrunColorWord;
1905
+ panel?: WrunRendererPanel;
1906
+ } & WrunValueFormatKeys) | ({
1907
+ kind: 'feed';
1908
+ name: string;
1909
+ frame: string;
1910
+ anchor?: CardAnchor;
1911
+ offset?: [number, number];
1912
+ z?: number;
1913
+ /** DW15: 1..40 chars (default the name; a frame `title` overrides). */
1914
+ title?: string;
1915
+ time_format?: WrunFeedTimeFormat;
1916
+ } & WrunWidgetStyle) | ({
1917
+ kind: 'meter';
1918
+ name: string;
1919
+ label: string;
1920
+ fraction: {
1921
+ output: string;
1922
+ };
1923
+ /** 2..5 colour words. */
1924
+ ramp: WrunColorWord[];
1925
+ text?: {
1926
+ slot: string;
1927
+ } | string;
1928
+ anchor?: CardAnchor;
1929
+ offset?: [number, number];
1930
+ z?: number;
1931
+ /** DW15: 1..40 chars, with `{{templates}}` up to 80 (DW14). */
1932
+ title?: string;
1933
+ /** DW38: px, integer 2..40 (default 12). */
1934
+ bar_height?: number;
1935
+ track_color?: WrunColorWord;
1936
+ } & WrunWidgetStyle) | ({
1937
+ kind: 'line';
1938
+ name: string;
1939
+ x1: string;
1940
+ y1: string;
1941
+ x2: string;
1942
+ y2: string;
1943
+ color?: string;
1944
+ width?: number;
1945
+ line_style?: string;
1946
+ extend?: WrunDrawingExtend;
1947
+ /** DW32: a hover template ({{name}}, {{name:format}}, {{label}}, {{value}}). */
1948
+ tooltip?: string;
1949
+ } & WrunLineHandleStyle)
1950
+ /** DW19: `color` is the FILL at `opacity` (default 0.2) and the border
1951
+ * when `border_color` is absent (default "#38bdf8"). */
1952
+ | ({
1953
+ kind: 'box';
1954
+ name: string;
1955
+ left: string;
1956
+ top: string;
1957
+ right: string;
1958
+ bottom: string;
1959
+ color?: string;
1960
+ width?: number;
1961
+ line_style?: string;
1962
+ border_color?: WrunColorWord;
1963
+ opacity?: number;
1964
+ border_width?: number;
1965
+ /** DW31: a declared string slot drawn inside the box. */
1966
+ text?: string;
1967
+ tooltip?: string;
1968
+ } & WrunBoxHandleStyle) | ({
1969
+ kind: 'polyline';
1970
+ name: string;
1971
+ points: Array<{
1972
+ x: string;
1973
+ y: string;
1974
+ }>;
1975
+ color?: string;
1976
+ width?: number;
1977
+ line_style?: string;
1978
+ tooltip?: string;
1979
+ } & WrunPolylineHandleStyle) | ({
1980
+ kind: 'label';
1981
+ name: string;
1982
+ x: string;
1983
+ y: string;
1984
+ text: string;
1985
+ color?: string;
1986
+ size?: number;
1987
+ align?: WrunTextAlign;
1988
+ tooltip?: string;
1989
+ } & WrunLabelHandleStyle) | WrunCardDrawing
1990
+ /** The mini-chart grid (`draw.minicharts`): a frame of titled candle
1991
+ * panels drawn through the chart's mini-chart grid overlay, its look the
1992
+ * om sheet's own snake_case options (the shared host's types spell them). */
1993
+ | WrunMiniChartsDrawing;
1994
+ /** Sheet-declared band between two declared numeric outputs: a true band
1995
+ * (edge lines styled by `edge_width`/`edge_line_style` plus a tinted
1996
+ * interior). `color` is a static tint; `colors` without `color_by` is the
1997
+ * band renderer's sign palette ([0] above the reference, [1] below);
1998
+ * `color_by` + `colors` is a per-bar ladder exactly like fills, and
1999
+ * `color_packed_by` a packed per-bar colour (see
2000
+ * WrunMetadataOutput.color_packed_by). `gradient` shades the interior with a
2001
+ * vertical gradient instead of the flat tint (the kScript plotLine
2002
+ * `fillGradient` kwarg); the color keys then keep styling the edge lines. */
2003
+ export interface WrunSheetRange {
2004
+ upper: string;
2005
+ lower: string;
2006
+ color?: string;
2007
+ colors?: string[];
2008
+ color_by?: string;
2009
+ color_packed_by?: string;
2010
+ edge_width?: number;
2011
+ /** Per-run edge width (frozen sheet contract, FE-only): like an output's
2012
+ * `stroke_width_by`, 0 = no edge lines; else the static `edge_width`. */
2013
+ edge_width_by?: string;
2014
+ edge_line_style?: string;
2015
+ smooth?: boolean;
2016
+ /** The interior's vertical gradient: 2 to 8 CSS color strings listed
2017
+ * from the top of the span to the bottom, evenly spaced stops. */
2018
+ gradient?: string[];
2019
+ /** The vertical span the stops are laid over: 'pane' (the pane height,
2020
+ * the default), 'fill' (the band's own vertical bounding box) or 'line'
2021
+ * (per column from `upper` down to `lower`). Never present without
2022
+ * `gradient`. */
2023
+ gradient_mode?: 'pane' | 'fill' | 'line';
2024
+ /** false (frozen sheet contract) = the engine's UNFILLED two-value
2025
+ * plotLine(value=[upper, lower]): the two edge lines and no interior.
2026
+ * Default true, a band. */
2027
+ fill?: boolean;
2028
+ /** The two-value plotLine's showPriceDisplay kwarg (frozen sheet
2029
+ * contract, see WrunMetadataOutput.show_price_display, read only under
2030
+ * `price_display: "per_output"`). Absent = tagged like the
2031
+ * plotLine(value=[upper, lower]) it mounts as; a range ported from a
2032
+ * kScript fillBetween (which never tags) declares false. */
2033
+ show_price_display?: boolean;
2034
+ /** Per-run `show_price_display` (see
2035
+ * WrunMetadataOutput.show_price_display_by). */
2036
+ show_price_display_by?: string;
2037
+ /** true (frozen sheet contract): the range stands for a kScript
2038
+ * fillBetween / two-value plotLine inside an `if`; a run where no ready
2039
+ * row carried both `upper` and `lower` finite (the span never drew; a
2040
+ * shared edge alone does not count) leaves it out entirely (see
2041
+ * WrunMetadataOutput.omit_if_empty). It only filters: a range that mounts
2042
+ * keeps its place, under `mount_order: "first_value"` right after its
2043
+ * later-declared edge output. */
2044
+ omit_if_empty?: boolean;
2045
+ /** false (frozen sheet contract, FE-only): the range stands for a kScript
2046
+ * fillBetween, which the engine emits as a 'fillBetween' output the
2047
+ * legend never lists; the band still paints and tags exactly as before,
2048
+ * only legend membership (and the derived overlay palette) drops it.
2049
+ * Absent or true = listed, like the two-value plotLine(fill=true) it
2050
+ * mounts as. */
2051
+ legend?: boolean;
2052
+ /** g5 OT21: the band's legend row name (default the upper edge's label). */
2053
+ label?: string;
2054
+ /** g5 OT04: paint order inside the pane, integer -10..10. */
2055
+ z?: number;
2056
+ }
2057
+ /** Sheet-declared shaded band between two RENDERED outputs (`fills`, the
2058
+ * kit's WrunFill; g5 OT03 gives it the `fill(a, b, {...})` declaration):
2059
+ * the interior only, no edge lines (a `range` draws edges). `color`
2060
+ * defaults to the first side's base color; `opacity` (0..1) to the engine's
2061
+ * fillBetween default (0.25 declared). `color_by` + `colors` is a per-bar
2062
+ * ladder, `color_packed_by` a packed per-bar colour (never beside
2063
+ * `color_by`); `z` the paint order (OT04). `opacity_by` (scaffold 42) names
2064
+ * a declared output whose value on each row is that row's opacity, in every
2065
+ * colour mode (wrunFillRowOpacity). A side that `omit_if_empty` left out of
2066
+ * a run (no value on any ready row) drops the fill on that run, the kScript
2067
+ * fillBetween inside the `if` that never ran; any other undrawn side refuses
2068
+ * by name. `behind_candles` (scaffold 53) paints the interior under the
2069
+ * candles on the price pane (the engine's pre-candle pass); the two edge
2070
+ * outputs stay above, and `z` still orders it among other behind fills. */
2071
+ export interface WrunSheetFill {
2072
+ between: [string, string];
2073
+ color?: string;
2074
+ opacity?: number;
2075
+ color_by?: string;
2076
+ colors?: WrunColorWord[];
2077
+ color_packed_by?: string;
2078
+ z?: number;
2079
+ opacity_by?: string;
2080
+ behind_candles?: boolean;
2081
+ }
2082
+ /** One entry of the sheet's `boxes` array (`box(...)`, the per-bar box over
2083
+ * two outputs). The sheet carries the array beside the kit-typed fields
2084
+ * (wrun-box-segment.util.ts `WrunBoxSegmentSheet`), where `readWrunBoxSpecs`
2085
+ * reads the pre-round keys with defaults and refuses a bad field by name.
2086
+ * g2 PT-box-ladder adds the per-bar fill and border ladders (`<key>_by` +
2087
+ * `<key>s`, or `<key>_packed_by`), g5 OT37 the border dash and OT04 the
2088
+ * paint order. */
2089
+ export interface WrunSheetBox {
2090
+ name: string;
2091
+ top: string;
2092
+ bottom: string;
2093
+ x_from?: string | number;
2094
+ x_to?: string | number;
2095
+ when?: string;
2096
+ panel?: string;
2097
+ color?: string;
2098
+ border_color?: string;
2099
+ opacity?: number;
2100
+ border_width?: number;
2101
+ border_style?: WrunLineStyleWord;
2102
+ z?: number;
2103
+ color_by?: string;
2104
+ colors?: WrunColorWord[];
2105
+ color_packed_by?: string;
2106
+ border_color_by?: string;
2107
+ border_colors?: WrunColorWord[];
2108
+ border_color_packed_by?: string;
2109
+ }
2110
+ /** One entry of the sheet's `segments` array (`segment(...)`, the per-bar
2111
+ * segment between two outputs), read with defaults by
2112
+ * `readWrunSegmentSpecs` through the same untyped seam as the boxes. */
2113
+ export interface WrunSheetSegment {
2114
+ name: string;
2115
+ y_from: string;
2116
+ y_to: string;
2117
+ x_from?: string | number;
2118
+ x_to?: string | number;
2119
+ when?: string;
2120
+ panel?: string;
2121
+ color?: string;
2122
+ width?: number;
2123
+ line_style?: string;
2124
+ }
2125
+ /** One `panes[]` entry (`pane(name, {...})`, g5 OT08 OT18 OT19 OT20 OT24): a
2126
+ * named lower pane ("lower" styles the default pane) or, with `place:
2127
+ * "price"`, a hidden scale over the candles; at most 4. */
2128
+ export interface WrunPane {
2129
+ name: string;
2130
+ /** 1..40 chars, `{{param}}` placeholders. */
2131
+ title?: string;
2132
+ place?: 'below' | 'price';
2133
+ /** A share of the chart height, 0.05..0.6 (X17: the word is `height_frac`). */
2134
+ height_frac?: number;
2135
+ scale?: 'linear' | 'log' | 'percent' | 'indexed';
2136
+ invert?: boolean;
2137
+ /** [top, bottom], each 0..0.4. */
2138
+ padding?: [number, number];
2139
+ /** Hold either end of the autoscale. */
2140
+ min?: number;
2141
+ max?: number;
2142
+ /** The axis ticks' number format (OT19, WrunValueFormatKeys). */
2143
+ format?: WrunValueFormat;
2144
+ decimals?: number;
2145
+ signed?: boolean;
2146
+ unit?: string;
2147
+ }
2148
+ /** One `heatmaps[]` entry (`plot.heatmap`, PT-heatmap): a time x price
2149
+ * heatmap over a book or volume_profile input's cells, or over an `out.grid`
2150
+ * (exactly one of `cells` / `grid`; `price_low` and `price_step` go with
2151
+ * `grid`). At most 4. */
2152
+ export interface WrunHeatmap {
2153
+ name: string;
2154
+ cells?: string;
2155
+ /** book: size | bid | ask | signed (default size); volume_profile: total |
2156
+ * buy | sell | delta (default total). */
2157
+ value?: 'size' | 'bid' | 'ask' | 'signed' | 'total' | 'buy' | 'sell' | 'delta';
2158
+ grid?: string;
2159
+ price_low?: string;
2160
+ price_step?: string | number;
2161
+ /** Price units, > 0 (book cells only; default the book's grouping). */
2162
+ row_height?: number;
2163
+ /** 2..8 stops, low to high. */
2164
+ palette?: WrunColorWord[];
2165
+ min?: number;
2166
+ max?: number;
2167
+ /** The diverging midpoint (default 0 for signed / delta values). */
2168
+ center?: number;
2169
+ /** 0.5..1 (default 0.98). */
2170
+ auto_quantile?: number;
2171
+ scale?: 'linear' | 'sqrt' | 'log';
2172
+ /** >= 0: cells within it of the centre draw nothing. */
2173
+ floor?: number;
2174
+ opacity?: number;
2175
+ /** Default true (D4). */
2176
+ behind_candles?: boolean;
2177
+ /** css px, integer 0..4. */
2178
+ cell_gap?: number;
2179
+ labels?: boolean;
2180
+ font_size?: number;
2181
+ font_weight?: WrunFontWeight;
2182
+ font_family?: WrunFontFamily;
2183
+ text_color?: WrunColorWord;
2184
+ format?: WrunValueFormat;
2185
+ decimals?: number;
2186
+ signed?: boolean;
2187
+ unit?: string;
2188
+ /** A hover template, 1..200 chars (absent = no readout). */
2189
+ tooltip?: string;
2190
+ /** The readout title, 1..40 chars. */
2191
+ label?: string;
2192
+ }
2193
+ /** The keys every `profiles[]` kind shares. */
2194
+ interface WrunProfileCommon {
2195
+ name: string;
2196
+ /** Price units (> 0) or "auto" (the input's bucket width x the native
2197
+ * interval multiplier). */
2198
+ row_height?: number | 'auto';
2199
+ value_area?: number;
2200
+ poc?: boolean;
2201
+ poc_color?: WrunColorWord;
2202
+ vah?: boolean;
2203
+ val?: boolean;
2204
+ vah_color?: WrunColorWord;
2205
+ val_color?: WrunColorWord;
2206
+ font_family?: WrunFontFamily;
2207
+ font_weight?: WrunFontWeight;
2208
+ cell_hover?: boolean;
2209
+ }
2210
+ /** `plot.footprint` (PT-footprint): one column per chart bar from a
2211
+ * volume_profile input's [low, high, buy, sell] buckets. */
2212
+ export interface WrunFootprintProfile extends WrunProfileCommon {
2213
+ kind: 'footprint';
2214
+ cells: string;
2215
+ mode?: 'cluster' | 'split_bar' | 'stacked_bar' | 'ladder' | 'imbalance_only';
2216
+ buy_color?: WrunColorWord;
2217
+ sell_color?: WrunColorWord;
2218
+ labels?: boolean;
2219
+ hide_zero?: boolean;
2220
+ text_color?: WrunColorWord;
2221
+ imbalance?: boolean;
2222
+ /** 1.1..20 (default 3). */
2223
+ imbalance_ratio?: number;
2224
+ imbalance_buy_color?: WrunColorWord;
2225
+ imbalance_sell_color?: WrunColorWord;
2226
+ /** integer 0..10 (default 3). */
2227
+ stacked_imbalances?: number;
2228
+ /** integer 1..10 px. */
2229
+ poc_width?: number;
2230
+ cell_metric?: 'volume' | 'delta' | 'trades';
2231
+ volume_color?: WrunColorWord;
2232
+ grading?: 'candle' | 'session' | 'visible';
2233
+ }
2234
+ /** `plot.tpo` (PT-tpo): letter blocks per period and price from a
2235
+ * volume_profile or intrabar input, or the chart's own candles. */
2236
+ export interface WrunTpoProfile extends WrunProfileCommon {
2237
+ kind: 'tpo';
2238
+ cells?: string;
2239
+ period?: 'day' | 'week' | 'month';
2240
+ /** integer 1..240 (default 30). */
2241
+ letter_minutes?: number;
2242
+ display?: 'letters' | 'blocks' | 'both';
2243
+ /** 2..26 colours across the letters. */
2244
+ palette?: WrunColorWord[];
2245
+ color_mode?: 'period' | 'count' | 'volume' | 'delta';
2246
+ outside_va_opacity?: number;
2247
+ initial_balance?: boolean;
2248
+ ib_color?: WrunColorWord;
2249
+ single_prints?: boolean;
2250
+ single_prints_color?: WrunColorWord;
2251
+ poor_extremes?: boolean;
2252
+ poor_extremes_color?: WrunColorWord;
2253
+ counts?: boolean;
2254
+ volume_profile?: boolean;
2255
+ }
2256
+ /** `plot.profile` (DL-time-anchored): a volume profile anchored to a time
2257
+ * span (a session, an output-bounded range, the developing session, or the
2258
+ * visible range). */
2259
+ export interface WrunVolumeProfile extends WrunProfileCommon {
2260
+ kind: 'volume';
2261
+ cells: string;
2262
+ span?: 'session' | 'range' | 'developing' | 'visible';
2263
+ session?: 'auto' | '1h' | '2h' | '4h' | '6h' | '12h' | '1d' | '1w' | 'us' | 'eu' | 'asia';
2264
+ /** span "range": output names read on the last ready row (epoch seconds);
2265
+ * `start` is required there, `end` defaults to the newest bar. */
2266
+ start?: string;
2267
+ end?: string;
2268
+ mode?: 'stacked_bar' | 'split_bar' | 'outline' | 'delta';
2269
+ buy_color?: WrunColorWord;
2270
+ sell_color?: WrunColorWord;
2271
+ dock?: 'left' | 'right';
2272
+ /** 0.05..1 of the span (session, range) or of the pane (developing, visible). */
2273
+ width_frac?: number;
2274
+ value_area_shade?: boolean;
2275
+ outside_buy_color?: WrunColorWord;
2276
+ outside_sell_color?: WrunColorWord;
2277
+ /** integer 1..10 px. */
2278
+ poc_width?: number;
2279
+ level_labels?: boolean;
2280
+ naked?: boolean;
2281
+ extend?: 'none' | 'right';
2282
+ /** span "session" with a filled mode only (D4). */
2283
+ behind_candles?: boolean;
2284
+ /** span "session" only: the session box and its colour / opacity. */
2285
+ background?: boolean;
2286
+ background_color?: WrunColorWord;
2287
+ background_opacity?: number;
2288
+ }
2289
+ /** One `profiles[]` entry, discriminated on `kind`; at most 4 across kinds. */
2290
+ export type WrunProfile = WrunFootprintProfile | WrunTpoProfile | WrunVolumeProfile;
2291
+ /** One `matrices[]` entry (`plot.matrix`, MX-price-matrix): a strike x expiry
2292
+ * matrix over a frame, docked to the price axis or in the side strip
2293
+ * (`dock: "side"`, MX-side-panel). Needs wrun-4; at most 4. */
2294
+ export interface WrunMatrix {
2295
+ name: string;
2296
+ frame: string;
2297
+ dock?: 'left' | 'right' | 'side';
2298
+ /** 1..12 column labels, each 1..16 chars (default the frame's `cols`). */
2299
+ columns?: string[];
2300
+ /** css px, integer 24..160 (default 56). */
2301
+ column_width?: number;
2302
+ /** css px, integer 8..64 (default 24). */
2303
+ row_max_px?: number;
2304
+ price_column?: boolean;
2305
+ header?: boolean;
2306
+ /** 2..8 stops (absent = no cell fill unless the cell carries one). */
2307
+ palette?: WrunColorWord[];
2308
+ min?: number;
2309
+ max?: number;
2310
+ center?: number;
2311
+ auto_quantile?: number;
2312
+ scale?: 'linear' | 'sqrt' | 'log';
2313
+ opacity?: number;
2314
+ format?: WrunValueFormat;
2315
+ decimals?: number;
2316
+ signed?: boolean;
2317
+ unit?: string;
2318
+ font_size?: number;
2319
+ font_weight?: WrunFontWeight;
2320
+ font_family?: WrunFontFamily;
2321
+ align?: WrunTextAlign;
2322
+ text_color?: WrunColorWord;
2323
+ header_text_color?: WrunColorWord;
2324
+ header_background_color?: WrunColorWord;
2325
+ background_color?: WrunColorWord;
2326
+ background_opacity?: number;
2327
+ grid_color?: WrunColorWord;
2328
+ grid_width?: number;
2329
+ grid_style?: WrunLineStyleWord;
2330
+ grid_lines?: 'all' | 'rows' | 'cols' | 'none';
2331
+ border_color?: WrunColorWord;
2332
+ border_width?: number;
2333
+ border_style?: WrunLineStyleWord;
2334
+ /** css px, integer 0..12 (default 4). */
2335
+ cell_padding?: number;
2336
+ highlight_color?: WrunColorWord;
2337
+ /** A hover template, 1..200 chars (absent = no readout). */
2338
+ tooltip?: string;
2339
+ /** The readout title, 1..40 chars. */
2340
+ label?: string;
2341
+ }
2342
+ /** One window of the exact warm-up stamp, in the `warmup` declaration's own shape: the kit writes one per
2343
+ * constructor argument of every admitted kit instance, with that argument's own floor (`min`). */
2344
+ export interface WrunHistoryWarmupWindow {
2345
+ terms: Array<{
2346
+ param: string;
2347
+ multiplier: number;
2348
+ }>;
2349
+ plus?: number;
2350
+ min?: number;
2351
+ }
2352
+ /** The exact warm-up stamp (`history_warmup`, frozen kit contract D3): W = the sum over `windows` of
2353
+ * max(ceil(sum of terms + plus), min), each window evaluated with the arithmetic the chart applies to the
2354
+ * `warmup` declaration, plus the top-level `plus` (the dependency edges and the fixed horizons). */
2355
+ export interface WrunHistoryWarmup {
2356
+ kind: 'exact';
2357
+ windows: WrunHistoryWarmupWindow[];
2358
+ plus?: number;
2359
+ }
2360
+ /** The three batched kinds, each a sheet key and the engine's plot type. */
2361
+ export type WrunBatchedMarksKind = 'marks' | 'spans' | 'rays';
2362
+ /** A colour of a batched section: a colour word (`#rrggbb`, `rgba(...)`,
2363
+ * `theme.<token>`) or a packed RGBA number (the colour param's own form,
2364
+ * `((r * 256 + g) * 256 + b) * 1024 + round(alpha * 1000)`, or a packed theme
2365
+ * token), the value a bound colour param writes there as it is. */
2366
+ export type WrunBatchedColor = WrunColorWord | number;
2367
+ /** The keys every batched section shares: the name, the slot geometry the build
2368
+ * derived, the hover template and the panel. */
2369
+ interface WrunBatchedSectionCommon {
2370
+ name: string;
2371
+ /** 1..64 records a bar. */
2372
+ slots: number;
2373
+ /** The index of the section's first output (the build derives it; contiguous, data-only). */
2374
+ first_output: number;
2375
+ /** A hover template, at most 200 chars (null or absent = no readout): `{{side}} {{qty}}
2376
+ * {{price}} {{fills}}` on marks, `{{top}} {{bottom}} {{length}} {{word}}` on spans, `{{y1}}
2377
+ * {{y2}} {{length}} {{word}}` on rays (the kit's WRUN_BATCHED_TOOLTIP_TOKENS), `{{start}}` and
2378
+ * `{{end}}` in place of `{{length}}` on a timed (stride-5) section (the kit's
2379
+ * WRUN_BATCHED_TIMED_TOOLTIP_TOKENS, printed as chart times); `{{<field>:compact|price|int}}`
2380
+ * picks a number format. */
2381
+ tooltip?: string | null;
2382
+ /** The readout title, 1..40 chars (absent = the name read as words). */
2383
+ label?: string;
2384
+ panel?: 'overlay';
2385
+ }
2386
+ /** One `marks[]` entry (`plot.marks`): per bar, `slots` records of `[price, qty, meta]` with
2387
+ * `meta = side + 4 * fills + 262144 * offset_ms` (side 0..3: 0 sell, 1 buy; fills 0..65535;
2388
+ * offset_ms 0..2^30); a NaN price is an empty slot. Look fields take the param-native units
2389
+ * (round-2 fold 1); the chart derives the pixels exactly as Big Trades 0.3.2 did. */
2390
+ export interface WrunMarksSection extends WrunBatchedSectionCommon {
2391
+ stride: 3;
2392
+ /** 0 Bubble, 1 Soft dot, 2 Ring, 3 Square (default 0). */
2393
+ look?: number;
2394
+ /** The size law over the record's quantity: `unit` is the Min size quantity (> 0), `scale`
2395
+ * the Bubble size 1..10; k = 0.5 + 0.1 * scale, d = round(clamp(11k * sqrt(qty / unit), 11k,
2396
+ * min(64, 50k))), then 6..64 css px. */
2397
+ size?: {
2398
+ law?: 'sqrt' | 'linear';
2399
+ unit?: number;
2400
+ scale?: number;
2401
+ };
2402
+ /** 0 Candle center, 1 Trade time (the record's `offset_ms` inside the bar). */
2403
+ x?: number;
2404
+ /** Indexed by the record's side: [sell, buy, ...], 2..4 colours (default the theme's down and up). */
2405
+ colors?: WrunBatchedColor[];
2406
+ /** The fill opacity in percent, 10..80 (default 30). */
2407
+ opacity_pct?: number;
2408
+ /** The caption: mode 0 Off, 1 Big bubbles (the largest a bar), 2 All (default 1, `compact`, 22 px). */
2409
+ text?: {
2410
+ mode?: number;
2411
+ field?: 'qty';
2412
+ format?: 'compact' | 'price' | 'int';
2413
+ min_px?: number;
2414
+ };
2415
+ }
2416
+ /** One `spans[]` entry (`plot.spans`): per bar, `slots` records of `[top, bottom, length, meta]`
2417
+ * with `meta = style + 8 * word + 256 * extend` (style indexes `colors`, word indexes `words`,
2418
+ * extend 1 = to the right edge); length in main-chart bars, 0 = the anchor bar only. A timed
2419
+ * section (`stride: 5`, the `out_<name>_span_at` writer, WRUN-MARKS-CONTRACT) holds `[top, bottom,
2420
+ * startTs, endTs, meta]` instead: the record runs between two timestamps the script knows,
2421
+ * epoch SECONDS in the outputs (the chart's row copy converts them to milliseconds once,
2422
+ * wrun-batched-marks.util), an end at or before the start a zero-length record at the start,
2423
+ * the extend bit continuing it to the right edge. */
2424
+ export interface WrunSpansSection extends WrunBatchedSectionCommon {
2425
+ stride: 4 | 5;
2426
+ /** 1..8 colours, the record's style picks one (default the theme's accent). */
2427
+ colors?: WrunBatchedColor[];
2428
+ /** 0..1 (default 0.2). */
2429
+ opacity?: number;
2430
+ /** The edge: width 0..4 css px, opacity 0..1 (default width 1, opacity 0.8); null draws none. */
2431
+ border?: {
2432
+ width?: number;
2433
+ opacity?: number;
2434
+ } | null;
2435
+ /** 0..16 words a record names by index. */
2436
+ words?: string[];
2437
+ }
2438
+ /** One `rays[]` entry (`plot.rays`): per bar, `slots` records of `[y1, y2, length, meta]`, a
2439
+ * segment from (anchor bar, y1) to (anchor + length, y2), the meta packed as on spans; a
2440
+ * zero-length extended ray is a horizontal ray from the anchor. A timed section (`stride: 5`,
2441
+ * `out_<name>_ray_at`) holds `[y1, y2, startTs, endTs, meta]`: a segment from (startTs, y1) to
2442
+ * (endTs, y2), both ends anywhere on the chart's grid (a sloped ray wholly in the past), the
2443
+ * times as on timed spans, the extend bit continuing it along its slope to the right edge. */
2444
+ export interface WrunRaysSection extends WrunBatchedSectionCommon {
2445
+ stride: 4 | 5;
2446
+ /** 1..8 colours, the record's style picks one (default the theme's accent). */
2447
+ colors?: WrunBatchedColor[];
2448
+ /** css px, 0.5..8 (default 1). */
2449
+ width?: number;
2450
+ line_style?: WrunLineStyleWord;
2451
+ /** 0..1 (default 1). */
2452
+ opacity?: number;
2453
+ words?: string[];
2454
+ }
2455
+ export type WrunBatchedSection = WrunMarksSection | WrunSpansSection | WrunRaysSection;
2456
+ export interface WrunIndicatorMetadata {
2457
+ id: string;
2458
+ name: string;
2459
+ description?: string;
2460
+ /** Package-declared chart placement ('' = undeclared; fall back to the
2461
+ * outputs' panels: a package drawing anything on price homes on the
2462
+ * price pane and its `lower` outputs get their own pane below; a
2463
+ * declared value pins ONE pane exactly as declared). Registry
2464
+ * `wrun/metadata.json` carries this, from a sheet overlay or, on a
2465
+ * declaration-derived sheet, from the in-source `display({ overlay })`
2466
+ * (frozen authoring contract C1.5); dev fixtures declare position in the
2467
+ * fixtures manifest instead. Every lane reads it the same way
2468
+ * (`packagePosition`: registry, editor draft, fork). */
2469
+ overlay?: 'onchart' | 'offchart' | '';
2470
+ /** The kScript define(axis=...) flag (frozen sheet contract), carried as
2471
+ * the run result's `define.axis` exactly like an engine run's (an
2472
+ * axisless onchart overlay rides the chart's price scale). Absent = the
2473
+ * loader's default (true). A declaration-derived sheet carries it from
2474
+ * `display({ axis })` (C1.5), read like an overlay's. */
2475
+ axis?: boolean;
2476
+ /** The kScript define(customTitle=...) legend suffix template (frozen
2477
+ * sheet contract), `$<param name>` tokens; the run-result adapter
2478
+ * resolves it against the run's param values
2479
+ * (utility/wrun/wrun-script-inputs.util.ts resolveWrunCustomTitle). */
2480
+ custom_title?: string;
2481
+ /** "per_output" (frozen sheet contract, opt-in) = kScript price-axis tags:
2482
+ * the run result carries the engine's output lineage and forwards each
2483
+ * declaration's `show_price_display`, so the chart tags every value plot
2484
+ * the script would (marks never) unless it opts out. Absent = the tags a
2485
+ * sheet run always had (the first output only), `show_price_display`
2486
+ * ignored. */
2487
+ price_display?: 'per_output';
2488
+ /** The overlay palette (frozen sheet contract, mount-only): what the
2489
+ * collapsed-legend chip paints (a legend dot takes its own output's).
2490
+ * Declared, even empty, the loaders mount exactly it as the overlay's
2491
+ * `settings.colors`, the way a kScript overlay mounts its colour inputs'
2492
+ * defaults in declaration order (empty = the control's amber fallback);
2493
+ * absent = the palette derived from the sheet's legend lines
2494
+ * (wrunSheetOverlayPalette). */
2495
+ legend_palette?: string[];
2496
+ /** "first_value" (frozen sheet contract, opt-in): outputs, candle groups
2497
+ * and ranges mount in the order the kScript engine creates its outputs
2498
+ * (the legend order, and the paint order within one layer), its call
2499
+ * order for every call that runs from bar 0 (an input-toggled one
2500
+ * included, even while it warms up): every output in sheet order and each
2501
+ * range right after its later-declared edge output, where a port declares
2502
+ * the edges of a kScript two-value filled plotLine (the sheet holds no
2503
+ * cross-kind order). `omit_if_empty` only leaves out a declaration that
2504
+ * never had a value and never moves one that did, so the legend is the
2505
+ * declaration order minus the omitted entries. Absent = declaration order
2506
+ * with every range after every output (the order a sheet run always had). */
2507
+ mount_order?: 'first_value';
2508
+ abi_version?: WrunAbiVersion;
2509
+ /** The sheet's warm-up window in bars (frozen sheet contract; a hand-written
2510
+ * field, no declaration spelling). With `warmup`, the window the hosted
2511
+ * runner fetches before its first evaluated bar; the chart asks for it as
2512
+ * history before the viewport (wrun-declared-warmup.util). */
2513
+ warmup_bars?: number;
2514
+ /** The scaled warm-up window the kit's `warmup({ terms, plus, min })`
2515
+ * writes: bars = max(min, ceil(sum(param * multiplier)) + plus). */
2516
+ warmup?: WrunWarmupWindow;
2517
+ params: WrunMetadataParam[];
2518
+ inputSources: Record<string, WrunInputSource>;
2519
+ inputs: WrunMetadataInput[];
2520
+ outputs: WrunMetadataOutput[];
2521
+ string_slots?: WrunStringSlot[];
2522
+ frames?: WrunFrameSlot[];
2523
+ levels?: WrunLevels[];
2524
+ panels?: WrunPanel[];
2525
+ renderers?: WrunRenderer[];
2526
+ drawings?: WrunDrawing[];
2527
+ fills?: WrunSheetFill[];
2528
+ ranges?: WrunSheetRange[];
2529
+ /** g5 OT08: the declared panes (at most 4). */
2530
+ panes?: WrunPane[];
2531
+ /** g6: the price canvases (at most 4 of each). */
2532
+ heatmaps?: WrunHeatmap[];
2533
+ profiles?: WrunProfile[];
2534
+ matrices?: WrunMatrix[];
2535
+ /** WRUN-BATCHED-MARKS: the batched per-bar records (wrun-batched-marks.util). */
2536
+ marks?: WrunMarksSection[];
2537
+ spans?: WrunSpansSection[];
2538
+ rays?: WrunRaysSection[];
2539
+ /** g4 DW21: false keeps the author's colours on a light chart (default true). */
2540
+ contrast_guard?: boolean;
2541
+ /** The history-independent stamp (kit 0.66.0, scaffold 66): the compiler proved that every bar's
2542
+ * outputs depend on that bar's inputs alone (the transform's walk of the entry over a closed
2543
+ * subset of statements, plus the sheet facts and the compiled module's import facts), so a
2544
+ * pan-back may compute only the bars it adds (a prefix run). Derived, never written by hand:
2545
+ * only the packaging step that writes `wasm_sha256` writes it, from the verdict of the compile
2546
+ * that emitted that wasm (the browser lane's compile pipeline drops the key from a plan's sheet
2547
+ * and decides it again on every result). Present only when proven, never false: an absent key
2548
+ * (an older kit, a dependent module) reads as unproven. The chart admits a pan-back session on
2549
+ * it only when the sheet pins its module (`wasm_sha256`) and the module and the sheet
2550
+ * corroborate it (no row count, every import on the kit's per-bar list, the kit's sheet facts:
2551
+ * wrun-overlay-run.util `wrunPrefixStampCorroborated`); a key holding any other value is a raw
2552
+ * stamp of false. */
2553
+ history_independent?: true;
2554
+ /** The exact warm-up stamp (kit scaffold after 0.69.0, round A of the warm-up program): the compiler
2555
+ * proved that every bar's outputs depend only on the last W bars' inputs, W the sum of `windows`
2556
+ * (each evaluated with the declaration's own arithmetic, `wrunDeclaredWarmupBars`) plus `plus`, so a
2557
+ * run started W bars before a range computes that range exactly (finite-window kit classes only:
2558
+ * wrun-declared-warmup.util `wrunHistoryWarmupBars`). Derived like `history_independent` (only the
2559
+ * packaging step that writes `wasm_sha256` writes it, from the decision over the compile that emitted
2560
+ * that wasm; the browser compile pipeline drops it from a plan's sheet and decides it again on every
2561
+ * result), present only when proven, never beside `history_independent: true` (a sheet carrying both
2562
+ * is refused whole). The chart gives such a session a hidden head of W candles on every run and
2563
+ * admits its pan-back pages to prefix runs only when the stamp is corroborated and the session is
2564
+ * warm (wrun-overlay-run.util, docs/features/kscript/wrun/wrun-browser-runtime.md "Pan-back prefix
2565
+ * runs"); a sheet with neither stamp recomputes its whole history on every pan-back, as before. */
2566
+ history_warmup?: WrunHistoryWarmup;
2567
+ /** g4 DW35: true keeps this indicator's anchored handle groups clear of
2568
+ * earlier overlays' groups at the same corner (default false). */
2569
+ stack_handles?: boolean;
2570
+ /** The stats strip's look beside the stats_row renderers (om
2571
+ * `stats_strip`, WRUN_STATS_STRIP_WORDS): the run stamps it on the
2572
+ * overlay as the Display settings titan's strip reads
2573
+ * (wrun-stats-strip.util). */
2574
+ stats_strip?: {
2575
+ grading?: string;
2576
+ label_side?: string;
2577
+ theme?: string;
2578
+ };
2579
+ /** Scaffold 18: the sheet's declared alerts, one per `alert(name, { when,
2580
+ * message?, description?, text?, every_bar? })` in the source, in
2581
+ * declaration order. `when` is the declared output NAME (the handle
2582
+ * resolved by the kit) whose false-to-true edge fires the alert on the
2583
+ * hosted lane; `message` is the fire text with delivery-time placeholders
2584
+ * and `{{<output>}}` tokens the engine fills from the fired row,
2585
+ * `description` the picker sub-line. Scaffold 37 adds `text`, a declared
2586
+ * string slot whose value on the fired row is the fire text (over
2587
+ * `message`, over the name), and `every_bar`, a fire on every bar the
2588
+ * condition holds instead of its edge (one per bar at most; the user's
2589
+ * arm-form choice overrides it). Sheet-only and ABI-neutral (the statement
2590
+ * is erased before the compiler); the alert form reads it through
2591
+ * `wrunAlertConditionsFromMetadata`, which never re-derives `when`.
2592
+ * `title` (frozen authoring contract C1.8) is the alert's display text
2593
+ * (any characters, the kScript alertcondition title verbatim) beside its
2594
+ * slug `name`: the picker, the armed rule and the fired notification show
2595
+ * `title ?? name`, while `name` stays the identity every rule is keyed by
2596
+ * (`conditionTitle`). */
2597
+ alerts?: Array<{
2598
+ name: string;
2599
+ when: string;
2600
+ title?: string;
2601
+ message?: string;
2602
+ description?: string;
2603
+ text?: string;
2604
+ every_bar?: boolean;
2605
+ }>;
2606
+ /** wrun-3: the sheet's `handles` map, one optional entry per handle kind
2607
+ * (line, box, label, polyline) with that kind's new-handle defaults.
2608
+ * Read as parsed JSON: `readWrunHandleDefaults` validates every field
2609
+ * and refuses unknown kinds by name. */
2610
+ handles?: unknown;
2611
+ /** Look defaults the run-result adapter applies to handle records (see
2612
+ * WrunHandleLookDefaults); read as parsed JSON, unknown kinds and props
2613
+ * refused by name. */
2614
+ handle_defaults?: WrunHandleLookDefaults;
2615
+ wasm_sha256?: string;
2616
+ /** The dialog layout in source order (absent = today's `group` tabs). */
2617
+ layout?: WrunLayoutEntry[];
2618
+ presets?: WrunPreset[];
2619
+ /** The legend title template ({{name}} placeholders). */
2620
+ legend_title?: string;
2621
+ /** `render.legend` / `render.hud` declarations (never renderer kinds:
2622
+ * every host passes the key through untouched). */
2623
+ presentation?: {
2624
+ legend?: WrunLegendEntry[];
2625
+ hud?: WrunHud[];
2626
+ };
2627
+ }
2628
+ /** An output's `plot` word, typed from the kit's own sheet schema (`WrunOutput['plot']`, the enum
2629
+ * `validateWrunMetadata` accepts): a kit that adds a plot word fails the visibility table's type
2630
+ * (wrun-visibility-table.ts `WRUN_OUTPUT_PLOT_RULES satisfies Record<WrunOutputPlot, ...>`) at the
2631
+ * bump, so a new word is classified (drawn or not, how its Visible row applies) before it ships.
2632
+ * `WrunMetadataOutput.plot` stays a string: a sheet written before a word existed still parses,
2633
+ * and the table reads an unknown word as a line, the adapter's own default. */
2634
+ export type WrunOutputPlot = NonNullable<import('@orangecharts/indicator-kit').WrunOutput['plot']>;
2635
+ /** The draw codes a value on one bar can trip (the ledger's WRUN3_DRAW_SKIP_CODES lists exactly these). */
2636
+ export type WrunDrawSkipCode = 'wrun_draw_non_finite' | 'wrun_draw_style_out_of_range' | 'wrun_draw_handle_missing' | 'wrun_draw_label_slot_absent' | 'wrun_draw_polyline_empty' | 'wrun_draw_kind_mismatch';
2637
+ /** The import a skipped call came through (`wrun_draw_delete` never skips: a missing id is a no-op). */
2638
+ export type WrunDrawSkipCall = 'wrun_draw_line' | 'wrun_draw_box' | 'wrun_draw_label' | 'wrun_draw_polyline' | 'wrun_draw_style' | 'wrun_draw_color';
2639
+ /** One skipped draw call. `kind` is the kind the call names (a geometry call's own, a style or colour call's live
2640
+ * handle's), null for a style or colour call on an id no handle holds; `row` the evaluation's row index; `ts` that
2641
+ * row's time in the host's row unit (epoch ms on the chart); `arg` the argument the verdict is about and its value,
2642
+ * `<name>=<value>` with the value as JavaScript prints a number (`x=NaN`, `points[3].y=Infinity`, `width=30`,
2643
+ * `slot=0`, `count=0`, `id=5`). */
2644
+ export interface WrunDrawSkip {
2645
+ code: WrunDrawSkipCode;
2646
+ kind: WrunHandleKind | null;
2647
+ id: number;
2648
+ row: number;
2649
+ ts: number;
2650
+ call: WrunDrawSkipCall;
2651
+ arg: string;
2652
+ }
2653
+ /** A run's skipped draw calls beside its rows: both keys present exactly when at least one call was skipped (a
2654
+ * clean run's answer keeps its shape). `skipped` holds the first 64 in call order (WRUN3_MAX_DRAW_SKIPS) and
2655
+ * `skippedCount` the skips past them (0 when every one fits). */
2656
+ export interface WrunDrawSkips {
2657
+ skipped?: WrunDrawSkip[];
2658
+ skippedCount?: number;
2659
+ }