@orangecharts/wrun-chart-host 0.5.0 → 0.7.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 (157) hide show
  1. package/README.md +17 -8
  2. package/dist/constants/feature-flags.constants.js +7 -2
  3. package/dist/constants/marketCapabilities.constants.d.ts +5 -0
  4. package/dist/constants/marketCapabilities.constants.js +16 -0
  5. package/dist/host-env.d.ts +3 -19
  6. package/dist/host-ports.types.d.ts +36 -17
  7. package/dist/index.d.ts +12 -1
  8. package/dist/index.js +12 -1
  9. package/dist/indicators/controls/tpo-session.util.js +42 -18
  10. package/dist/interfaces/wrun-runtime.interface.d.ts +88 -13
  11. package/dist/interfaces/wrun-runtime.interface.js +17 -3
  12. package/dist/market-data/billing.interface.d.ts +2 -1
  13. package/dist/settings-templates/indicator-fields.js +10 -0
  14. package/dist/utility/chart/chart-mount-epoch.util.d.ts +12 -0
  15. package/dist/utility/chart/chart-mount-epoch.util.js +32 -0
  16. package/dist/utility/chart/crypto-index.leaf.d.ts +16 -0
  17. package/dist/utility/chart/crypto-index.leaf.js +19 -0
  18. package/dist/utility/chart/index-mode-admission.util.js +9 -1
  19. package/dist/utility/chart/index-mode.util.d.ts +11 -5
  20. package/dist/utility/chart/index-mode.util.js +22 -10
  21. package/dist/utility/chart/kscript-source-answer-budget.leaf.d.ts +36 -0
  22. package/dist/utility/chart/kscript-source-answer-budget.leaf.js +39 -0
  23. package/dist/utility/chart/kscript-source-degrade.leaf.d.ts +38 -1
  24. package/dist/utility/chart/kscript-source-degrade.leaf.js +39 -1
  25. package/dist/utility/chart/live-bucket.util.d.ts +2 -1
  26. package/dist/utility/chart/live-bucket.util.js +47 -15
  27. package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +15 -1
  28. package/dist/utility/chart/local-kscript-warmup-depth.util.js +9 -0
  29. package/dist/utility/chart/market-session-schedule.util.d.ts +3 -1
  30. package/dist/utility/chart/market-session-schedule.util.js +24 -2
  31. package/dist/utility/chart/marketKind.util.d.ts +12 -7
  32. package/dist/utility/chart/marketKind.util.js +15 -5
  33. package/dist/utility/chart/ny-calendar.util.d.ts +104 -0
  34. package/dist/utility/chart/ny-calendar.util.js +346 -0
  35. package/dist/utility/chart/om-panel.util.d.ts +14 -2
  36. package/dist/utility/chart/om-panel.util.js +108 -40
  37. package/dist/utility/chart/rth-session.util.d.ts +10 -7
  38. package/dist/utility/chart/rth-session.util.js +17 -22
  39. package/dist/utility/chart/trading-day.util.js +90 -18
  40. package/dist/utility/chart/us-equities-session.util.js +20 -67
  41. package/dist/utility/chart/wrun-bar-session-facts.util.js +14 -1
  42. package/dist/utility/common/time.util.d.ts +7 -1
  43. package/dist/utility/common/time.util.js +11 -41
  44. package/dist/utility/number-format.util.d.ts +17 -7
  45. package/dist/utility/number-format.util.js +18 -8
  46. package/dist/utility/options/option-symbol.util.js +13 -2
  47. package/dist/utility/symbol-selection/contract-expiry.util.js +9 -1
  48. package/dist/utility/watchlist/import/import-request.leaf.d.ts +4 -1
  49. package/dist/utility/watchlist/import/import-request.leaf.js +5 -2
  50. package/dist/utility/watchlist/import/tradingview-symbols.leaf.d.ts +25 -4
  51. package/dist/utility/watchlist/import/tradingview-symbols.leaf.js +62 -4
  52. package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +19 -0
  53. package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.js +57 -0
  54. package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.d.ts +23 -0
  55. package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.js +90 -0
  56. package/dist/utility/wrun/run-schedule/wrun-lane-groups.util.d.ts +39 -0
  57. package/dist/utility/wrun/run-schedule/wrun-lane-groups.util.js +60 -0
  58. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +77 -0
  59. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +195 -0
  60. package/dist/utility/wrun/run-schedule/wrun-own-candles.util.d.ts +56 -0
  61. package/dist/utility/wrun/run-schedule/wrun-own-candles.util.js +70 -0
  62. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.d.ts +53 -0
  63. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.js +239 -0
  64. package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +16 -0
  65. package/dist/utility/wrun/sources/lanes/option_stats_10m.js +14 -0
  66. package/dist/utility/wrun/sources/lanes/options_flow.d.ts +43 -18
  67. package/dist/utility/wrun/sources/lanes/options_flow.js +209 -72
  68. package/dist/utility/wrun/sources/lanes/token_supply.js +5 -31
  69. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +3 -18
  70. package/dist/utility/wrun/sources/opra-option-lanes.util.js +12 -57
  71. package/dist/utility/wrun/sources/row-lane-registry.d.ts +1 -1
  72. package/dist/utility/wrun/sources/row-lane-registry.js +22 -8
  73. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +61 -0
  74. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +103 -8
  75. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +5 -0
  76. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +24 -12
  77. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +55 -0
  78. package/dist/utility/wrun/sources/row-lanes/option_prints.js +95 -18
  79. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +15 -1
  80. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +23 -8
  81. package/dist/utility/wrun/sources/row-lanes/option_surface.js +11 -11
  82. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +14 -2
  83. package/dist/utility/wrun/sources/wrun-poll-lane.types.js +6 -3
  84. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +43 -8
  85. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +77 -11
  86. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +31 -16
  87. package/dist/utility/wrun/sources/wrun-row-lane.types.js +2 -0
  88. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +52 -12
  89. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +110 -46
  90. package/dist/utility/wrun/wrun-bar-count.util.d.ts +17 -6
  91. package/dist/utility/wrun/wrun-bar-count.util.js +27 -12
  92. package/dist/utility/wrun/wrun-browser-sources.leaf.d.ts +10 -0
  93. package/dist/utility/wrun/wrun-browser-sources.leaf.js +12 -0
  94. package/dist/utility/wrun/wrun-coin-lane-live.util.d.ts +3 -3
  95. package/dist/utility/wrun/wrun-coin-lane-live.util.js +53 -18
  96. package/dist/utility/wrun/wrun-color-settings.util.d.ts +6 -0
  97. package/dist/utility/wrun/wrun-color-settings.util.js +45 -0
  98. package/dist/utility/wrun/wrun-draft-overlay.util.js +14 -8
  99. package/dist/utility/wrun/wrun-failure-cause.d.ts +1 -1
  100. package/dist/utility/wrun/wrun-failure-cause.js +14 -0
  101. package/dist/utility/wrun/wrun-frames.js +6 -2
  102. package/dist/utility/wrun/wrun-host.service.d.ts +131 -59
  103. package/dist/utility/wrun/wrun-host.service.js +391 -194
  104. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +1 -1
  105. package/dist/utility/wrun/wrun-hosted-wire-caps.js +2 -0
  106. package/dist/utility/wrun/wrun-hover.util.d.ts +3 -0
  107. package/dist/utility/wrun/wrun-hover.util.js +25 -4
  108. package/dist/utility/wrun/wrun-input-requirements.leaf.js +7 -4
  109. package/dist/utility/wrun/wrun-kit-run-tables.util.d.ts +24 -0
  110. package/dist/utility/wrun/wrun-kit-run-tables.util.js +87 -0
  111. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +2 -1
  112. package/dist/utility/wrun/wrun-live-tick.util.d.ts +8 -2
  113. package/dist/utility/wrun/wrun-live-tick.util.js +35 -16
  114. package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +40 -13
  115. package/dist/utility/wrun/wrun-opra-flow.leaf.js +39 -12
  116. package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +70 -21
  117. package/dist/utility/wrun/wrun-option-contract-flow.util.js +257 -112
  118. package/dist/utility/wrun/wrun-option-prints.util.d.ts +62 -22
  119. package/dist/utility/wrun/wrun-option-prints.util.js +148 -46
  120. package/dist/utility/wrun/wrun-option-views.util.d.ts +262 -0
  121. package/dist/utility/wrun/wrun-option-views.util.js +356 -0
  122. package/dist/utility/wrun/wrun-options-chain.util.d.ts +23 -2
  123. package/dist/utility/wrun/wrun-options-chain.util.js +37 -3
  124. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +20 -5
  125. package/dist/utility/wrun/wrun-overlay-drivers.util.js +32 -7
  126. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +9 -3
  127. package/dist/utility/wrun/wrun-overlay-recovery.util.js +146 -18
  128. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +52 -8
  129. package/dist/utility/wrun/wrun-overlay-run.util.js +816 -243
  130. package/dist/utility/wrun/wrun-pack.util.d.ts +2 -1
  131. package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +5 -0
  132. package/dist/utility/wrun/wrun-pin-spelling.util.js +28 -12
  133. package/dist/utility/wrun/wrun-pin-venues.util.js +4 -6
  134. package/dist/utility/wrun/wrun-prefix-cohort.util.d.ts +1 -1
  135. package/dist/utility/wrun/wrun-prefix-cohort.util.js +1 -1
  136. package/dist/utility/wrun/wrun-present-bits.util.d.ts +9 -0
  137. package/dist/utility/wrun/wrun-present-bits.util.js +39 -0
  138. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +3 -2
  139. package/dist/utility/wrun/wrun-refusal-surface.util.js +5 -4
  140. package/dist/utility/wrun/wrun-refusal.util.d.ts +66 -6
  141. package/dist/utility/wrun/wrun-refusal.util.js +335 -40
  142. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +5 -3
  143. package/dist/utility/wrun/wrun-sandbox-row-source.d.ts +2 -2
  144. package/dist/utility/wrun/wrun-sha256.leaf.d.ts +13 -0
  145. package/dist/utility/wrun/wrun-sha256.leaf.js +84 -0
  146. package/dist/utility/wrun/wrun-source-rows.util.js +11 -0
  147. package/dist/utility/wrun/wrun-tier-grid.util.d.ts +28 -3
  148. package/dist/utility/wrun/wrun-tier-grid.util.js +79 -19
  149. package/dist/utility/wrun/wrun-transient-rerun.util.d.ts +14 -3
  150. package/dist/utility/wrun/wrun-transient-rerun.util.js +33 -8
  151. package/dist/workers/wrun/wrun-abi-host.d.ts +15 -2
  152. package/dist/workers/wrun/wrun-abi-host.js +31 -12
  153. package/dist/workers/wrun/wrun-engine-handler.d.ts +11 -28
  154. package/dist/workers/wrun/wrun-engine-handler.js +181 -12
  155. package/package.json +5 -5
  156. package/dist/utility/wrun/wrun-opra-underlying.util.d.ts +0 -12
  157. package/dist/utility/wrun/wrun-opra-underlying.util.js +0 -1
@@ -0,0 +1,262 @@
1
+ import type { WrunLaneChartChain } from './sources/opra-option-lanes.util.js';
2
+ /** The classes whose inputs declare views (the cell class each view's block is built in). */
3
+ export type WrunOptionViewClass = 'options_chain' | 'option_contract_state';
4
+ /** One view word's contract (section 6.1). */
5
+ export interface WrunOptionViewSpec {
6
+ cls: WrunOptionViewClass;
7
+ /** The params it takes: the input's knob, then the wire name (`OptionChainView.params` key). */
8
+ params: Readonly<Record<string, string>>;
9
+ /** `tuples`: class tuples, a projection of B; `fold`: rows of another layout. */
10
+ answer: 'tuples' | 'fold';
11
+ /** The view centres on the chart's close (`spotHint`) and covers every close inside the band. */
12
+ hinted?: true;
13
+ }
14
+ /** Every view word, in section 6.1's order. The worker names each by `OPTION_CHAIN_VIEW_<WORD>` (pb-common
15
+ * `OptionChainViewKind`; tests/utility/wrun/wrun-option-views.util.spec.ts pins every name). */
16
+ export declare const WRUN_OPTION_VIEWS: Readonly<{
17
+ readonly whole: {
18
+ readonly cls: "options_chain";
19
+ readonly params: {};
20
+ readonly answer: "tuples";
21
+ };
22
+ readonly clock: {
23
+ readonly cls: "options_chain";
24
+ readonly params: {};
25
+ readonly answer: "tuples";
26
+ };
27
+ readonly atm: {
28
+ readonly cls: "options_chain";
29
+ readonly params: {
30
+ readonly center: "center";
31
+ readonly rate: "rate";
32
+ readonly within_pct: "withinPct";
33
+ };
34
+ readonly answer: "tuples";
35
+ };
36
+ readonly delta_band: {
37
+ readonly cls: "options_chain";
38
+ readonly params: {
39
+ readonly expiry: "expiry";
40
+ readonly lo: "lo";
41
+ readonly hi: "hi";
42
+ readonly rate: "rate";
43
+ };
44
+ readonly answer: "tuples";
45
+ };
46
+ readonly window: {
47
+ readonly cls: "options_chain";
48
+ readonly params: {
49
+ readonly view_expiries: "expiries";
50
+ readonly center: "center";
51
+ readonly pct: "pct";
52
+ readonly min_oi: "minOi";
53
+ };
54
+ readonly answer: "tuples";
55
+ readonly hinted: true;
56
+ };
57
+ readonly horizon_otm: {
58
+ readonly cls: "options_chain";
59
+ readonly params: {
60
+ readonly days1: "days1";
61
+ readonly days2: "days2";
62
+ readonly days3: "days3";
63
+ readonly pct: "pct";
64
+ readonly wing_pct: "wingPct";
65
+ readonly points: "points";
66
+ };
67
+ readonly answer: "tuples";
68
+ readonly hinted: true;
69
+ };
70
+ readonly surface_buckets: {
71
+ readonly cls: "options_chain";
72
+ readonly params: {
73
+ readonly view_expiries: "expiries";
74
+ readonly range_pct: "rangePct";
75
+ };
76
+ readonly answer: "tuples";
77
+ readonly hinted: true;
78
+ };
79
+ readonly contract: {
80
+ readonly cls: "options_chain";
81
+ readonly params: {
82
+ readonly expiry_day: "expiryDay";
83
+ readonly side: "side";
84
+ readonly strike: "strike";
85
+ readonly rate: "rate";
86
+ };
87
+ readonly answer: "tuples";
88
+ };
89
+ readonly front_delta: {
90
+ readonly cls: "options_chain";
91
+ readonly params: {};
92
+ readonly answer: "tuples";
93
+ };
94
+ readonly traded: {
95
+ readonly cls: "option_contract_state";
96
+ readonly params: {};
97
+ readonly answer: "tuples";
98
+ };
99
+ readonly extremes: {
100
+ readonly cls: "option_contract_state";
101
+ readonly params: {};
102
+ readonly answer: "tuples";
103
+ };
104
+ readonly top: {
105
+ readonly cls: "option_contract_state";
106
+ readonly params: {
107
+ readonly rank: "rank";
108
+ readonly side: "side";
109
+ readonly rows: "rows";
110
+ readonly min_volume: "minVolume";
111
+ };
112
+ readonly answer: "tuples";
113
+ };
114
+ readonly totals: {
115
+ readonly cls: "option_contract_state";
116
+ readonly params: {};
117
+ readonly answer: "fold";
118
+ };
119
+ readonly oi_board: {
120
+ readonly cls: "option_contract_state";
121
+ readonly params: {
122
+ readonly lens: "lens";
123
+ readonly side: "side";
124
+ readonly columns: "columns";
125
+ readonly window_pct: "pct";
126
+ };
127
+ readonly answer: "fold";
128
+ readonly hinted: true;
129
+ };
130
+ readonly strike_change: {
131
+ readonly cls: "option_contract_state";
132
+ readonly params: {
133
+ readonly side: "side";
134
+ readonly rank: "rank";
135
+ readonly min_prior_oi: "minPriorOi";
136
+ };
137
+ readonly answer: "fold";
138
+ };
139
+ readonly leaders: {
140
+ readonly cls: "option_contract_state";
141
+ readonly params: {
142
+ readonly side: "side";
143
+ readonly rank: "rank";
144
+ readonly min_prior_oi: "minPriorOi";
145
+ };
146
+ readonly answer: "tuples";
147
+ };
148
+ readonly exposure: {
149
+ readonly cls: "options_chain";
150
+ readonly params: {
151
+ readonly lens: "lens";
152
+ readonly units: "units";
153
+ readonly scope: "scope";
154
+ readonly nearest: "nearest";
155
+ readonly rate: "rate";
156
+ };
157
+ readonly answer: "fold";
158
+ };
159
+ readonly strike_table: {
160
+ readonly cls: "options_chain";
161
+ readonly params: {};
162
+ readonly answer: "fold";
163
+ };
164
+ readonly gex_curve: {
165
+ readonly cls: "options_chain";
166
+ readonly params: {
167
+ readonly grid_down: "gridDown";
168
+ readonly grid_up: "gridUp";
169
+ readonly points: "points";
170
+ };
171
+ readonly answer: "fold";
172
+ };
173
+ }>;
174
+ export type WrunOptionViewWord = keyof typeof WRUN_OPTION_VIEWS;
175
+ /** One view an ask names: its word and its params by wire name, each a finite number. */
176
+ export interface WrunOptionView {
177
+ view: WrunOptionViewWord;
178
+ params: Readonly<Record<string, number>>;
179
+ }
180
+ /** The hint band each side of the hint, percent of it (section 12: 0.5% of the close). */
181
+ export declare const WRUN_OPTION_VIEW_MARGIN_PCT = 0.5;
182
+ /** The lane refusal code (wrun-lane-refusal.leaf) of a view ask the gateway answered without the views. */
183
+ export declare const WRUN_OPTION_VIEWS_UNSERVED_CODE = "option-views-unserved";
184
+ /** The plan's refusal of a view whose answer no reader of this host takes yet (a fold). */
185
+ export declare const WRUN_OPTION_VIEW_UNREAD_CODE = "wrun_option_view_unread";
186
+ /** The plan's refusal of one chain lane whose inputs read it through views and whole at once (one ask serves both
187
+ * never: B and a view of B are two answers). */
188
+ export declare const WRUN_OPTION_VIEWS_ONE_ASK_CODE = "wrun_option_views_one_ask";
189
+ /** A view's spec, or undefined for a word that names none. */
190
+ export declare function wrunOptionViewSpec(word: unknown): WrunOptionViewSpec | undefined;
191
+ /**
192
+ * The knobs an input names its views in: `page_view` (one word) or `page_views` (a list), the chain page's views
193
+ * (section 6.1's title). Never `view`: that is every input's bar view (`confirmed`, `forming`, `is_new_period`,
194
+ * `offset`; wrun-source-rows.util refuses any other word on it), so the plan's section 9 spelling cannot be the knob.
195
+ */
196
+ export declare const WRUN_OPTION_VIEW_KNOB = "page_view";
197
+ export declare const WRUN_OPTION_VIEWS_KNOB = "page_views";
198
+ /** Every view word an input source declares, in either knob, unvalidated (the paint seam and the stray-knob rule
199
+ * read which params the declared views take). */
200
+ export declare function wrunOptionViewWordsDeclared(source: Readonly<Record<string, unknown>>): unknown[];
201
+ /** The knob names every view the source declares takes as params. */
202
+ export declare function wrunOptionViewParamKnobs(source: Readonly<Record<string, unknown>>): Set<string>;
203
+ /**
204
+ * An input's views, validated (main thread, after the paint seam): undefined when it declares none (today's path),
205
+ * else the views in canonical order (`canonicalViews`). Refuses by name a word that names no view of the input's
206
+ * class, a param that is no finite number (a `"@<param>"` the sheet declares no param of stays a string here), and a
207
+ * fold, which no reader of this host takes yet.
208
+ */
209
+ export declare function wrunOptionViewsOfSource(input: object, ctx: {
210
+ inputName: string;
211
+ sourceClass: string;
212
+ }, cls: WrunOptionViewClass): WrunOptionView[] | undefined;
213
+ /** The union of several inputs' views, canonical. */
214
+ export declare function wrunOptionViewsUnion(sets: ReadonlyArray<readonly WrunOptionView[]>): WrunOptionView[];
215
+ /** The canonical text of a set of views (the payload's `<prefix>Views`). */
216
+ export declare function wrunOptionViewsText(views: readonly WrunOptionView[]): string;
217
+ /** Whether any view of a set centres on the chart's close. */
218
+ export declare function wrunOptionViewsHinted(views: readonly WrunOptionView[]): boolean;
219
+ /**
220
+ * A payload's `<prefix>Views` read back (the worker twins, the K controls): the views of `cls`, canonical, or
221
+ * undefined for a payload that names none; null for a text that is not one this module writes (a word of another
222
+ * class, a param that is no finite number, garbage): the ask is refused, never widened to B whole.
223
+ */
224
+ export declare function wrunOptionViewsOf(text: unknown, cls: WrunOptionViewClass): WrunOptionView[] | null | undefined;
225
+ /** What an `options_chain` view ask hands the gateway to size B on its page (section 5.1). */
226
+ export interface WrunOptionsChainViewScope {
227
+ /** The largest `nearest:N` over the lane's inputs; absent when one reads every expiry. */
228
+ nearestExpiries?: number;
229
+ /** The smallest `max_cells` over the lane's inputs; absent when none declares one. */
230
+ maxContracts?: number;
231
+ }
232
+ /** A view ask's payload fields (see the module doc). */
233
+ export declare function wrunOptionViewLaneFields(cls: WrunOptionViewClass, views: readonly WrunOptionView[], scope?: WrunOptionsChainViewScope): Record<string, unknown>;
234
+ /** The view fields of a payload, as they ride (a K control copies them onto the request it builds). */
235
+ export declare function wrunOptionViewPayloadFields(cls: WrunOptionViewClass, payload: Readonly<Record<string, unknown>> | undefined): Record<string, unknown>;
236
+ /** A view ask read off a payload (the worker twins): the views and the scope and hint fields, or null for a payload
237
+ * whose views are not this module's text; undefined for one that names no views (today's path). */
238
+ export interface WrunOptionViewAskFields {
239
+ views: WrunOptionView[];
240
+ nearestExpiries?: number;
241
+ maxContracts?: number;
242
+ spotHint?: number;
243
+ spotMarginPct?: number;
244
+ }
245
+ export declare function wrunOptionViewAskFieldsOf(cls: WrunOptionViewClass, payload: Readonly<Record<string, unknown>>): WrunOptionViewAskFields | null | undefined;
246
+ /** Whether a block built for `hint` (margin percent each side) covers the close `close`. */
247
+ export declare function wrunOptionViewHintCovers(hint: number, marginPct: number, close: number): boolean;
248
+ /** The hint an ask carries for `close`: the held hint while it covers the close (one key, one read, for every close
249
+ * inside the band), else the close itself; undefined when no close is known (the gateway centres on its underlying). */
250
+ export declare function wrunOptionViewHint(held: unknown, marginPct: number, close: number | undefined): number | undefined;
251
+ /** The close of a chart's last row (`[ts, open, high, low, close, ...]`), or undefined. */
252
+ export declare function wrunChartLastClose(rows: unknown): number | undefined;
253
+ /**
254
+ * The chart's chain on the OPRA plane by coin, held in place of the chain directory's answer (section 8, O1): the
255
+ * chain `wrunLaneOpraPlaneChain` reads for the chart's coin when the chart's options ride the OPRA plane (the
256
+ * planner's verdict when the lane context carries it, `opraPlane`, else the run's own rule over the chart's exchange,
257
+ * `governedOptionPlane`, the predicate the planners' `isOpraPlaneExchange` is). Undefined off the plane, for a chart
258
+ * naming no coin, and while another screen holds the plane's session (the directory resolution then stops by that
259
+ * name before any read). Main thread only; the lane resolver loads lazily (this module stays light: the paint seam
260
+ * reads its view table).
261
+ */
262
+ export declare function wrunHeldOpraPlaneChain(exchange: unknown, coin: unknown, opraPlane?: boolean): Promise<WrunLaneChartChain | undefined>;
@@ -0,0 +1,356 @@
1
+ /**
2
+ * The chain page views on the browser host (OPTLOAD G5, UW-PARITY/design/OPTLOAD-CHAIN-PLAN.md rev 2, sections 5, 6.1
3
+ * and 8): the words an `options_chain` or `option_contract_state` input declares to read a view of today's block B in
4
+ * place of B whole, the params of each view, the hint band of the views that follow the chart's close, and the main
5
+ * thread's half of the one chain snapshot owner (the OPRA plane's chain by coin, `wrunHeldOpraPlaneChain`).
6
+ *
7
+ * - Words: `page_view: "<word>"` or `page_views: ["<word>", ...]` (one of the two; never `view`, every input's bar
8
+ * view), each word a view of section 6.1 in snake case (`WRUN_OPTION_VIEWS`) of the input's own class. A view's
9
+ * params ride the input as flat knobs (`WrunOptionViewSpec` `params`: the knob, then the wire name the gateway
10
+ * reads), each a finite number once the paint seam ran (`wrunSheetWithSettings` writes a `"@<param>"` handle's
11
+ * current value, the `ticks_per_bar` rule). The views' `expiries` param rides `view_expiries`: the class keeps its own
12
+ * `expiries` word. Every refusal is om's one knob name (`wrun_option_knob_invalid`), but for a fold (below).
13
+ * - Answers. A projection (`answer: 'tuples'`) is a subsequence of B in B's order with B's values, so a package whose
14
+ * code is unchanged reads it as it reads B: it reaches the package as the class's own block. A fold
15
+ * (`answer: 'fold'`: totals, boards, the curve) answers rows of another layout, which no reader of this host takes
16
+ * yet (the shared host's kit adapter reads class tuples only): such a view refuses by name before any read
17
+ * (`wrun_option_view_unread`), never an empty or misread block.
18
+ * - Hinted views (`hinted`: the window board, the smile and surface reads) cover every close within
19
+ * `WRUN_OPTION_VIEW_MARGIN_PCT` of the hint the ask carries, the chart's close at ask time; a run whose close left
20
+ * the band asks again before it reads (`wrunOptionViewHintCovers`, `wrunOptionViewHint`).
21
+ * - The ask's payload fields (`wrunOptionViewLaneFields`): `<prefix>Views`, the canonical text (`wrunOptionViewsText`:
22
+ * one spelling for one set of views and values, whatever the declaration order, so equal asks share one key and one
23
+ * read), `<prefix>SpotMarginPct` for a hinted set, and on `options_chain` the gateway's scope inputs
24
+ * (`chainNearestExpiries`, `chainMaxContracts`: the gateway sizes B on its page, so a view ask reads no expiry
25
+ * directory). The worker twins read them back (`wrunOptionViewsOf`, `wrunOptionViewAskFieldsOf`).
26
+ * - A gateway without the views answers `knobsVersion` 0: the worker refuses the views by name
27
+ * (`WRUN_OPTION_VIEWS_UNSERVED_CODE`), and an input that declares none reads today's path.
28
+ *
29
+ * Worker-safe: the worker twins parse the same words. The one main-thread door (`wrunHeldOpraPlaneChain`) touches the
30
+ * host env only when called.
31
+ */
32
+ import { wrunChartHostEnv } from '../../host-env.js';
33
+ import { gateSessionHeldElsewhere } from '../v2/gate-session-latch.util.js';
34
+ import { refuseWrunPollInput } from './sources/wrun-poll-lane.types.js';
35
+ import { refuseWrunOptionKnob } from './wrun-option-knobs.util.js';
36
+ import { wrunAuthorRuleSeed } from './wrun-refusal.util.js';
37
+ /** Every view word, in section 6.1's order. The worker names each by `OPTION_CHAIN_VIEW_<WORD>` (pb-common
38
+ * `OptionChainViewKind`; tests/utility/wrun/wrun-option-views.util.spec.ts pins every name). */
39
+ export const WRUN_OPTION_VIEWS = Object.freeze({
40
+ whole: { cls: 'options_chain', params: {}, answer: 'tuples' },
41
+ clock: { cls: 'options_chain', params: {}, answer: 'tuples' },
42
+ atm: { cls: 'options_chain', params: { center: 'center', rate: 'rate', within_pct: 'withinPct' }, answer: 'tuples' },
43
+ delta_band: {
44
+ cls: 'options_chain',
45
+ params: { expiry: 'expiry', lo: 'lo', hi: 'hi', rate: 'rate' },
46
+ answer: 'tuples',
47
+ },
48
+ window: {
49
+ cls: 'options_chain',
50
+ params: { view_expiries: 'expiries', center: 'center', pct: 'pct', min_oi: 'minOi' },
51
+ answer: 'tuples',
52
+ hinted: true,
53
+ },
54
+ horizon_otm: {
55
+ cls: 'options_chain',
56
+ params: { days1: 'days1', days2: 'days2', days3: 'days3', pct: 'pct', wing_pct: 'wingPct', points: 'points' },
57
+ answer: 'tuples',
58
+ hinted: true,
59
+ },
60
+ surface_buckets: {
61
+ cls: 'options_chain',
62
+ params: { view_expiries: 'expiries', range_pct: 'rangePct' },
63
+ answer: 'tuples',
64
+ hinted: true,
65
+ },
66
+ contract: {
67
+ cls: 'options_chain',
68
+ params: { expiry_day: 'expiryDay', side: 'side', strike: 'strike', rate: 'rate' },
69
+ answer: 'tuples',
70
+ },
71
+ front_delta: { cls: 'options_chain', params: {}, answer: 'tuples' },
72
+ traded: { cls: 'option_contract_state', params: {}, answer: 'tuples' },
73
+ extremes: { cls: 'option_contract_state', params: {}, answer: 'tuples' },
74
+ top: {
75
+ cls: 'option_contract_state',
76
+ params: { rank: 'rank', side: 'side', rows: 'rows', min_volume: 'minVolume' },
77
+ answer: 'tuples',
78
+ },
79
+ totals: { cls: 'option_contract_state', params: {}, answer: 'fold' },
80
+ oi_board: {
81
+ cls: 'option_contract_state',
82
+ params: { lens: 'lens', side: 'side', columns: 'columns', window_pct: 'pct' },
83
+ answer: 'fold',
84
+ hinted: true,
85
+ },
86
+ strike_change: {
87
+ cls: 'option_contract_state',
88
+ params: { side: 'side', rank: 'rank', min_prior_oi: 'minPriorOi' },
89
+ answer: 'fold',
90
+ },
91
+ leaders: {
92
+ cls: 'option_contract_state',
93
+ params: { side: 'side', rank: 'rank', min_prior_oi: 'minPriorOi' },
94
+ answer: 'tuples',
95
+ },
96
+ exposure: {
97
+ cls: 'options_chain',
98
+ params: { lens: 'lens', units: 'units', scope: 'scope', nearest: 'nearest', rate: 'rate' },
99
+ answer: 'fold',
100
+ },
101
+ strike_table: { cls: 'options_chain', params: {}, answer: 'fold' },
102
+ gex_curve: {
103
+ cls: 'options_chain',
104
+ params: { grid_down: 'gridDown', grid_up: 'gridUp', points: 'points' },
105
+ answer: 'fold',
106
+ },
107
+ });
108
+ /** The hint band each side of the hint, percent of it (section 12: 0.5% of the close). */
109
+ export const WRUN_OPTION_VIEW_MARGIN_PCT = 0.5;
110
+ /** The lane refusal code (wrun-lane-refusal.leaf) of a view ask the gateway answered without the views. */
111
+ export const WRUN_OPTION_VIEWS_UNSERVED_CODE = 'option-views-unserved';
112
+ /** The plan's refusal of a view whose answer no reader of this host takes yet (a fold). */
113
+ export const WRUN_OPTION_VIEW_UNREAD_CODE = 'wrun_option_view_unread';
114
+ /** The plan's refusal of one chain lane whose inputs read it through views and whole at once (one ask serves both
115
+ * never: B and a view of B are two answers). */
116
+ export const WRUN_OPTION_VIEWS_ONE_ASK_CODE = 'wrun_option_views_one_ask';
117
+ /** A view's spec, or undefined for a word that names none. */
118
+ export function wrunOptionViewSpec(word) {
119
+ return typeof word === 'string' && Object.prototype.hasOwnProperty.call(WRUN_OPTION_VIEWS, word)
120
+ ? WRUN_OPTION_VIEWS[word]
121
+ : undefined;
122
+ }
123
+ /** The words of one class, spelled for a refusal. */
124
+ function wrunOptionViewWordsOf(cls) {
125
+ const words = Object.keys(WRUN_OPTION_VIEWS)
126
+ .filter((word) => WRUN_OPTION_VIEWS[word].cls === cls)
127
+ .map((word) => `"${word}"`);
128
+ return `one of ${words.join(', ')}`;
129
+ }
130
+ /**
131
+ * The knobs an input names its views in: `page_view` (one word) or `page_views` (a list), the chain page's views
132
+ * (section 6.1's title). Never `view`: that is every input's bar view (`confirmed`, `forming`, `is_new_period`,
133
+ * `offset`; wrun-source-rows.util refuses any other word on it), so the plan's section 9 spelling cannot be the knob.
134
+ */
135
+ export const WRUN_OPTION_VIEW_KNOB = 'page_view';
136
+ export const WRUN_OPTION_VIEWS_KNOB = 'page_views';
137
+ /** Every view word an input source declares, in either knob, unvalidated (the paint seam and the stray-knob rule
138
+ * read which params the declared views take). */
139
+ export function wrunOptionViewWordsDeclared(source) {
140
+ const many = source[WRUN_OPTION_VIEWS_KNOB];
141
+ return [source[WRUN_OPTION_VIEW_KNOB], ...(Array.isArray(many) ? many : [])].filter((word) => word !== undefined);
142
+ }
143
+ /** The knob names every view the source declares takes as params. */
144
+ export function wrunOptionViewParamKnobs(source) {
145
+ return new Set(wrunOptionViewWordsDeclared(source).flatMap((word) => Object.keys(wrunOptionViewSpec(word)?.params ?? {})));
146
+ }
147
+ /** The input's declared view words (`page_view` or `page_views`), undefined when it declares neither. */
148
+ function declaredViewWords(source, ctx) {
149
+ const one = source[WRUN_OPTION_VIEW_KNOB];
150
+ const many = source[WRUN_OPTION_VIEWS_KNOB];
151
+ if (one === undefined && many === undefined)
152
+ return undefined;
153
+ if (one !== undefined && many !== undefined) {
154
+ return refuseWrunOptionKnob(ctx, WRUN_OPTION_VIEWS_KNOB, many, `a list of view words, declared in place of \`${WRUN_OPTION_VIEW_KNOB}\`, never beside it`);
155
+ }
156
+ if (one !== undefined)
157
+ return [one];
158
+ if (!Array.isArray(many) || many.length === 0) {
159
+ return refuseWrunOptionKnob(ctx, WRUN_OPTION_VIEWS_KNOB, many, 'a non-empty list of view words');
160
+ }
161
+ return many;
162
+ }
163
+ /**
164
+ * An input's views, validated (main thread, after the paint seam): undefined when it declares none (today's path),
165
+ * else the views in canonical order (`canonicalViews`). Refuses by name a word that names no view of the input's
166
+ * class, a param that is no finite number (a `"@<param>"` the sheet declares no param of stays a string here), and a
167
+ * fold, which no reader of this host takes yet.
168
+ */
169
+ export function wrunOptionViewsOfSource(input, ctx, cls) {
170
+ // A sheet's input source, read by knob name (its knobs are open: the class's own and each view's params).
171
+ const source = input;
172
+ const words = declaredViewWords(source, ctx);
173
+ if (words === undefined)
174
+ return undefined;
175
+ const views = [];
176
+ for (const word of words) {
177
+ const spec = wrunOptionViewSpec(word);
178
+ const knob = source[WRUN_OPTION_VIEW_KNOB] !== undefined ? WRUN_OPTION_VIEW_KNOB : WRUN_OPTION_VIEWS_KNOB;
179
+ if (spec === undefined || spec.cls !== cls) {
180
+ return refuseWrunOptionKnob(ctx, knob, word, wrunOptionViewWordsOf(cls));
181
+ }
182
+ if (spec.answer === 'fold') {
183
+ return refuseWrunPollInput(ctx, `reads ${cls} with ${knob} "${String(word)}" (${WRUN_OPTION_VIEW_UNREAD_CODE}): its answer is a fold, whose ` +
184
+ 'rows no reader of this host takes yet; declare a projection view or read the block whole', wrunAuthorRuleSeed(WRUN_OPTION_VIEW_UNREAD_CODE));
185
+ }
186
+ const params = {};
187
+ for (const [knob, wire] of Object.entries(spec.params)) {
188
+ const value = source[knob];
189
+ if (value === undefined)
190
+ continue;
191
+ if (typeof value !== 'number' || !Number.isFinite(value)) {
192
+ return refuseWrunOptionKnob(ctx, knob, value, `a finite number, or "@<param>" naming a number param the sheet declares (view "${String(word)}")`);
193
+ }
194
+ params[wire] = value;
195
+ }
196
+ views.push({ view: word, params });
197
+ }
198
+ return canonicalViews(views);
199
+ }
200
+ /** Views deduplicated and sorted by word, then by params, each view's params by name: one spelling per set. */
201
+ function canonicalViews(views) {
202
+ const byText = new Map();
203
+ for (const view of views) {
204
+ const params = Object.fromEntries(Object.entries(view.params).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)));
205
+ const canonical = { view: view.view, params };
206
+ byText.set(JSON.stringify(canonical), canonical);
207
+ }
208
+ return [...byText.entries()].sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)).map(([, view]) => view);
209
+ }
210
+ /** The union of several inputs' views, canonical. */
211
+ export function wrunOptionViewsUnion(sets) {
212
+ return canonicalViews(sets.flat());
213
+ }
214
+ /** The canonical text of a set of views (the payload's `<prefix>Views`). */
215
+ export function wrunOptionViewsText(views) {
216
+ return JSON.stringify(canonicalViews(views));
217
+ }
218
+ /** Whether any view of a set centres on the chart's close. */
219
+ export function wrunOptionViewsHinted(views) {
220
+ return views.some((view) => wrunOptionViewSpec(view.view)?.hinted === true);
221
+ }
222
+ /**
223
+ * A payload's `<prefix>Views` read back (the worker twins, the K controls): the views of `cls`, canonical, or
224
+ * undefined for a payload that names none; null for a text that is not one this module writes (a word of another
225
+ * class, a param that is no finite number, garbage): the ask is refused, never widened to B whole.
226
+ */
227
+ export function wrunOptionViewsOf(text, cls) {
228
+ if (text === undefined || text === null)
229
+ return undefined;
230
+ if (typeof text !== 'string')
231
+ return null;
232
+ let parsed;
233
+ try {
234
+ parsed = JSON.parse(text);
235
+ }
236
+ catch {
237
+ return null;
238
+ }
239
+ if (!Array.isArray(parsed) || parsed.length === 0)
240
+ return null;
241
+ const views = [];
242
+ for (const entry of parsed) {
243
+ const record = entry;
244
+ const spec = wrunOptionViewSpec(record?.view);
245
+ if (spec === undefined || spec.cls !== cls || spec.answer !== 'tuples')
246
+ return null;
247
+ const params = record?.params;
248
+ if (params === null || typeof params !== 'object' || Array.isArray(params))
249
+ return null;
250
+ const wires = new Set(Object.values(spec.params));
251
+ for (const [wire, value] of Object.entries(params)) {
252
+ if (!wires.has(wire) || typeof value !== 'number' || !Number.isFinite(value))
253
+ return null;
254
+ }
255
+ views.push({ view: record?.view, params: params });
256
+ }
257
+ return canonicalViews(views);
258
+ }
259
+ /** The payload prefix of each class's view fields (the class's own field prefix). */
260
+ const WRUN_OPTION_VIEW_PREFIX = Object.freeze({
261
+ options_chain: 'chain',
262
+ option_contract_state: 'state',
263
+ });
264
+ /** A view ask's payload fields (see the module doc). */
265
+ export function wrunOptionViewLaneFields(cls, views, scope = {}) {
266
+ const prefix = WRUN_OPTION_VIEW_PREFIX[cls];
267
+ return {
268
+ [`${prefix}Views`]: wrunOptionViewsText(views),
269
+ ...(wrunOptionViewsHinted(views) ? { [`${prefix}SpotMarginPct`]: WRUN_OPTION_VIEW_MARGIN_PCT } : {}),
270
+ ...(cls === 'options_chain' && scope.nearestExpiries !== undefined
271
+ ? { chainNearestExpiries: scope.nearestExpiries }
272
+ : {}),
273
+ ...(cls === 'options_chain' && scope.maxContracts !== undefined ? { chainMaxContracts: scope.maxContracts } : {}),
274
+ };
275
+ }
276
+ /** The view fields of a payload, as they ride (a K control copies them onto the request it builds). */
277
+ export function wrunOptionViewPayloadFields(cls, payload) {
278
+ const prefix = WRUN_OPTION_VIEW_PREFIX[cls];
279
+ const keys = [`${prefix}Views`, `${prefix}SpotHint`, `${prefix}SpotMarginPct`];
280
+ if (cls === 'options_chain')
281
+ keys.push('chainNearestExpiries', 'chainMaxContracts');
282
+ const fields = {};
283
+ for (const key of keys)
284
+ if (payload?.[key] !== undefined)
285
+ fields[key] = payload[key];
286
+ return fields;
287
+ }
288
+ function positiveNumber(value) {
289
+ return typeof value === 'number' && Number.isFinite(value) && value > 0 ? value : undefined;
290
+ }
291
+ function positiveInteger(value) {
292
+ return typeof value === 'number' && Number.isSafeInteger(value) && value > 0 ? value : undefined;
293
+ }
294
+ export function wrunOptionViewAskFieldsOf(cls, payload) {
295
+ const prefix = WRUN_OPTION_VIEW_PREFIX[cls];
296
+ const views = wrunOptionViewsOf(payload[`${prefix}Views`], cls);
297
+ if (views === undefined || views === null)
298
+ return views;
299
+ const hinted = wrunOptionViewsHinted(views);
300
+ const spotHint = hinted ? positiveNumber(payload[`${prefix}SpotHint`]) : undefined;
301
+ const spotMarginPct = hinted ? positiveNumber(payload[`${prefix}SpotMarginPct`]) : undefined;
302
+ const nearestExpiries = cls === 'options_chain' ? positiveInteger(payload.chainNearestExpiries) : undefined;
303
+ const maxContracts = cls === 'options_chain' ? positiveInteger(payload.chainMaxContracts) : undefined;
304
+ return {
305
+ views,
306
+ ...(nearestExpiries !== undefined ? { nearestExpiries } : {}),
307
+ ...(maxContracts !== undefined ? { maxContracts } : {}),
308
+ ...(spotHint !== undefined ? { spotHint } : {}),
309
+ ...(spotHint !== undefined && spotMarginPct !== undefined ? { spotMarginPct } : {}),
310
+ };
311
+ }
312
+ /** Whether a block built for `hint` (margin percent each side) covers the close `close`. */
313
+ export function wrunOptionViewHintCovers(hint, marginPct, close) {
314
+ return (Number.isFinite(hint) &&
315
+ hint > 0 &&
316
+ Number.isFinite(close) &&
317
+ close > 0 &&
318
+ Math.abs(close - hint) <= (hint * marginPct) / 100);
319
+ }
320
+ /** The hint an ask carries for `close`: the held hint while it covers the close (one key, one read, for every close
321
+ * inside the band), else the close itself; undefined when no close is known (the gateway centres on its underlying). */
322
+ export function wrunOptionViewHint(held, marginPct, close) {
323
+ if (close === undefined || !Number.isFinite(close) || !(close > 0))
324
+ return undefined;
325
+ const hint = positiveNumber(held);
326
+ return hint !== undefined && wrunOptionViewHintCovers(hint, marginPct, close) ? hint : close;
327
+ }
328
+ /** The close of a chart's last row (`[ts, open, high, low, close, ...]`), or undefined. */
329
+ export function wrunChartLastClose(rows) {
330
+ if (!Array.isArray(rows) || rows.length === 0)
331
+ return undefined;
332
+ const close = Number(rows[rows.length - 1]?.[4]);
333
+ return Number.isFinite(close) && close > 0 ? close : undefined;
334
+ }
335
+ /**
336
+ * The chart's chain on the OPRA plane by coin, held in place of the chain directory's answer (section 8, O1): the
337
+ * chain `wrunLaneOpraPlaneChain` reads for the chart's coin when the chart's options ride the OPRA plane (the
338
+ * planner's verdict when the lane context carries it, `opraPlane`, else the run's own rule over the chart's exchange,
339
+ * `governedOptionPlane`, the predicate the planners' `isOpraPlaneExchange` is). Undefined off the plane, for a chart
340
+ * naming no coin, and while another screen holds the plane's session (the directory resolution then stops by that
341
+ * name before any read). Main thread only; the lane resolver loads lazily (this module stays light: the paint seam
342
+ * reads its view table).
343
+ */
344
+ export async function wrunHeldOpraPlaneChain(exchange, coin, opraPlane) {
345
+ if (typeof coin !== 'string' || coin.trim() === '' || gateSessionHeldElsewhere('opra'))
346
+ return undefined;
347
+ let onPlane = opraPlane;
348
+ if (onPlane === undefined) {
349
+ const { governedOptionPlane } = await wrunChartHostEnv().market.loadOptionsGate();
350
+ onPlane = governedOptionPlane({ exchange: typeof exchange === 'string' ? exchange : undefined }) === 'opra';
351
+ }
352
+ if (!onPlane)
353
+ return undefined;
354
+ const { wrunLaneOpraPlaneChain } = await import('./sources/opra-option-lanes.util.js');
355
+ return wrunLaneOpraPlaneChain(coin);
356
+ }
@@ -31,6 +31,11 @@ export declare const WRUN_OPTIONS_CHAIN_CRYPTO_VENUE_IDS: Readonly<{
31
31
  }>;
32
32
  export type WrunOptionsChainCryptoVenueWord = keyof typeof WRUN_OPTIONS_CHAIN_CRYPTO_VENUE_IDS;
33
33
  export declare function isWrunOptionsChainCryptoVenueWord(word: string): word is WrunOptionsChainCryptoVenueWord;
34
+ /** The name a venue the crypto-options gate keeps dark for a guest goes by in a refusal, by its venue table id (a
35
+ * crypto venue word's row: every plain venue but Deribit); undefined for a venue the gate never darkens (Deribit,
36
+ * CME, OPRA). A chain class naming venues by another word than the decision's (`options_flow`'s `venue` knob names
37
+ * the venue's exchange) reads the gate off this one table. */
38
+ export declare function wrunOptionsChainGatedVenueName(venueId: string): string | undefined;
34
39
  /** The chain snapshot's freshness window (`FRESH_SNAPSHOT_MS` in
35
40
  * options-chain-state.worker.util.ts, mirrored here so the main thread
36
41
  * never imports the worker module): the K_OPTIONS_CHAIN request stamps the
@@ -219,6 +224,19 @@ export declare const WRUN_OPTIONS_CHAIN_UNAVAILABLE_CODE = "wrun_options_chain_u
219
224
  export declare const WRUN_OPTIONS_CHAIN_VENUE_UNAVAILABLE_CODE = "wrun_options_chain_venue_unavailable";
220
225
  export declare const WRUN_OPTIONS_CHAIN_ONE_VENUE_CODE = "wrun_options_chain_one_venue";
221
226
  export declare const WRUN_OPTIONS_CHAIN_EXPIRIES_CODE = "wrun_options_chain_expiries";
227
+ /**
228
+ * The ONE refusal of a venue the crypto-options gate keeps dark (a guest: reason `flag-off`), for every chain class:
229
+ * the options chain decision's venue word and a scope across venues (`options_flow`, whose `venue` knob names the
230
+ * venue's exchange). `who` names the input and its class, `venue` the word it declared, `name` the venue's name
231
+ * (`wrunOptionsChainGatedVenueName`), `coin` the coin asked about and `wayOut` what the input may declare instead.
232
+ */
233
+ export declare function wrunOptionsChainFlagOffRefusal(args: {
234
+ who: string;
235
+ venue: string;
236
+ name: string;
237
+ coin: string;
238
+ wayOut: string;
239
+ }): WrunOptionsChainRefusal;
222
240
  /**
223
241
  * The `venue` knob against the chart, decided in ONE place for the run lane,
224
242
  * the works-on list and the K_ control: `chartSource` is what the chart's own
@@ -291,8 +309,11 @@ export type WrunOptionsChainTuple = [
291
309
  export declare function wrunOptionsChainTuples(instruments: Iterable<OptionInstrumentSnapshot>): WrunOptionsChainTuple[];
292
310
  /** A lane row `[ts, [tuple], ...]` (the K_OPTIONS_CHAIN worker's shape,
293
311
  * nested like the volume-profile lane's) read back as tuples; a malformed
294
- * tuple (not an array of nine finite numbers) is skipped whole, the VP
295
- * lane's malformed-bucket rule. */
312
+ * tuple (not an array of ten finite numbers) is skipped whole, the VP
313
+ * lane's malformed-bucket rule. The run itself reads the rows through the
314
+ * shared host's kit adapter (`adaptWrunCells`), which takes nested tuples
315
+ * only: the worker sends the row nested (OPTLOAD G5 keeps it so until that
316
+ * adapter reads packed blocks). */
296
317
  export declare function wrunOptionsChainRowTuples(row: ReadonlyArray<unknown>): number[][];
297
318
  /** The newest lane row's chain (the row with the greatest finite ts), or
298
319
  * undefined when no row carries one: the hosts serve the latest chain, so