@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
@@ -9,10 +9,9 @@
9
9
  * `wrunOptionsChainLaneExtrasFor`), the chain row lanes and the chain poll lanes (`option_daily`, `option_stats_10m`
10
10
  * under `./lanes/`, OPTIONS-PORT P5) resolve the chart's chain through the same function (`resolveWrunChartChain`, over
11
11
  * the chart's market and category) and decide a venue word through the same one (`decideWrunLaneChainIdentity`), so a
12
- * package reading `options_chain`, `option_surface` and `option_daily` never mixes venues.
13
- *
14
- * The OPRA-only lanes keep their own wrappers over the same chart resolution (`resolveWrunLaneOpraChain`,
15
- * `resolveWrunOpraLaneUnderlying`) with their words unchanged, until they read the one resolver too.
12
+ * package reading `options_chain`, `option_surface` and `option_daily` never mixes venues. Every options row lane is
13
+ * a chain lane since OPTIONS-PORT P7 (`option_prints` and `option_contract_flow` too), so no lane keeps an OPRA-only
14
+ * wrapper over the chart's resolution.
16
15
  *
17
16
  * LIGHT at module load: the row-lane registry loads every lane file, and so this module, on the row builder's import
18
17
  * graph. Types, the refusal helpers, the governed exchange predicates (constant sets) and pure parsers only; the
@@ -23,11 +22,11 @@ import { wrunChartHostEnv } from '../../../host-env.js';
23
22
  import { OPRA_GOVERNED_EXCHANGES } from '../../../constants/governed-exchanges.constants.js';
24
23
  import { isCmeGoverned } from '../../chart/cme-realtime.util.js';
25
24
  import { peekRegisteredContinuousLead } from '../../chart/continuous-contracts.util.js';
26
- import { refuseWrunPollInput } from './wrun-poll-lane.types.js';
25
+ import { refuseWrunPollInput, WRUN_LANE_KNOB_INVALID_CODE } from './wrun-poll-lane.types.js';
27
26
  import { wrunLaneChainPlaneOf } from './wrun-row-lane.types.js';
28
- import { decideWrunOptionsChainIdentity, WRUN_OPTIONS_CHAIN_CRYPTO_VENUE_IDS, WRUN_OPTIONS_CHAIN_UNAVAILABLE_CODE, } from '../wrun-options-chain.util.js';
27
+ import { decideWrunOptionsChainIdentity, WRUN_OPTIONS_CHAIN_CRYPTO_VENUE_IDS, WRUN_OPTIONS_CHAIN_ONE_VENUE_CODE, WRUN_OPTIONS_CHAIN_UNAVAILABLE_CODE, WRUN_OPTIONS_CHAIN_VENUE_CODE, } from '../wrun-options-chain.util.js';
29
28
  import { refuseWrunOptionKnob } from '../wrun-option-knobs.util.js';
30
- import { attachWrunRefusal, wrunOptionsStopSeed } from '../wrun-refusal.util.js';
29
+ import { attachWrunRefusal, wrunAuthorRuleSeed, wrunOptionsStopSeed } from '../wrun-refusal.util.js';
31
30
  import { gateSessionHeldElsewhere } from '../../v2/gate-session-latch.util.js';
32
31
  /** The chart market a lane resolves its chain for, keyed (one resolution per chart per run). */
33
32
  export function wrunLaneChartKey(ctx) {
@@ -82,11 +81,6 @@ export async function resolveWrunChartChain(metadata) {
82
81
  const opraStop = opraOptionPlaneStop({ exchange });
83
82
  return { chartSource, ...(opraStop !== undefined ? { opraStop } : {}) };
84
83
  }
85
- /** An OPRA-only lane on a chart whose plane another screen holds the session of: refused by that name before any read
86
- * (`options-stopped` / `session-elsewhere`, Resume here), never "the directory did not answer". */
87
- function refuseWrunLaneSessionElsewhere(ctx, plane) {
88
- return refuseWrunPollInput(ctx, `reads US options data, but the ${plane.toUpperCase()} options data session is open on another screen: Resume here takes it back`, wrunOptionsStopSeed('session-elsewhere', { severity: 'paused', plane }));
89
- }
90
84
  /** Resolve the chart's chain for a lane: `resolveWrunChartChain` over the lane context's market and category. */
91
85
  export function resolveWrunLaneChartChain(ctx) {
92
86
  return resolveWrunChartChain({
@@ -96,48 +90,6 @@ export function resolveWrunLaneChartChain(ctx) {
96
90
  ...(typeof ctx.category === 'number' ? { category: ctx.category } : {}),
97
91
  });
98
92
  }
99
- /**
100
- * The OPRA chain an OPRA-only lane reads on this chart (`option_contract_state`: admitted only where the chart's
101
- * options ride the OPRA plane): its exchange and underlying, or a refusal by name with the options chain's own seeds
102
- * (the directory did not answer: a service that did not answer; no chain: no options here). A wrapper over the chart's
103
- * chain resolution, its words unchanged, for the OPRA-only lanes that still import it.
104
- */
105
- export async function resolveWrunLaneOpraChain(ctx) {
106
- const { chartSource, directoryFailed, heldElsewhere } = await resolveWrunLaneChartChain(ctx);
107
- if (heldElsewhere !== undefined)
108
- return refuseWrunLaneSessionElsewhere(ctx, heldElsewhere);
109
- const market = `${ctx.exchange}/${ctx.symbol}`;
110
- if (directoryFailed !== undefined) {
111
- return refuseWrunPollInput(ctx, `reads US options data, and the US option chain directory did not answer for the chart market ${market}: Run again`, { cls: 'service-no-answer', variant: directoryFailed === 'opra' ? 'opra-directory' : 'cme-directory' });
112
- }
113
- if (chartSource?.venue === 'opra' && chartSource.exchange.length > 0 && chartSource.underlying.length > 0) {
114
- return { exchange: chartSource.exchange, underlying: chartSource.underlying };
115
- }
116
- return refuseWrunPollInput(ctx, `reads US options data, and OPRA lists no option chain for the chart market ${market} (an index's options do not attach to a stock chart); open a US stock or ETF chart that lists options`, { cls: 'no-options', variant: 'chain', ...(ctx.coin !== '' ? { params: { coin: ctx.coin } } : {}) });
117
- }
118
- /**
119
- * The underlying the OPRA plane keys an OPRA-only lane's series by (`option_prints`, `option_contract_flow`: a US
120
- * stock or ETF chart's ticker, an OPRA contract chart's underlying, upper case), or a refusal by name before any
121
- * fetch: any failure of the chart's chain resolution is the US directory that did not answer (`service-no-answer` /
122
- * `opra-directory`, Retry), and a chart OPRA lists no options for is `no-options` / `chain`. A wrapper over the
123
- * chart's chain resolution, its words unchanged (wrun-opra-underlying.util re-exports it for its importers).
124
- */
125
- export async function resolveWrunOpraLaneUnderlying(ctx) {
126
- const market = `${ctx.exchange}/${ctx.symbol}`;
127
- const chain = await resolveWrunLaneChartChain(ctx).catch(() => ({ directoryFailed: 'opra' }));
128
- if (chain.heldElsewhere !== undefined)
129
- return refuseWrunLaneSessionElsewhere(ctx, chain.heldElsewhere);
130
- if (chain.directoryFailed !== undefined) {
131
- return refuseWrunPollInput(ctx, `reads US options data, but the US option chain directory did not answer for the chart market ${market}: Run again`, { cls: 'service-no-answer', variant: 'opra-directory' });
132
- }
133
- const source = chain.chartSource;
134
- const underlying = source?.venue === 'opra' && typeof source.underlying === 'string' ? source.underlying.trim() : '';
135
- if (underlying === '') {
136
- return refuseWrunPollInput(ctx, `reads US options data, but OPRA lists no options for the chart market ${market} (an index's options do not ` +
137
- 'attach to a stock chart): open a US stock or ETF chart that lists options, or one of its option contracts', { cls: 'no-options', variant: 'chain', params: ctx.coin !== '' ? { coin: ctx.coin } : {} });
138
- }
139
- return underlying.toUpperCase();
140
- }
141
93
  /** The crypto venue words a chain decision reads on this chart: on the OPRA plane no crypto venue lists a US
142
94
  * stock's options (the words refuse by the flag alone, no listing asked); anywhere else the run's own resolver
143
95
  * over every crypto word (the listing is asked once per coin, and only with the crypto-options gate on). */
@@ -260,6 +212,9 @@ async function readWrunLaneChainSeries(exchangeName, underlying) {
260
212
  }
261
213
  return listed.size > 0 ? listed : undefined;
262
214
  }
215
+ /** The code of an options row lane that holds no resolved chart market for its chain (its identity step's
216
+ * `resolveWrunLaneChainChart` left none): the lane refuses with it, its words say Run again. */
217
+ export const WRUN_OPTION_CHART_UNRESOLVED_CODE = 'wrun_option_chart_unresolved';
263
218
  /**
264
219
  * Resolve the chart for the one chain resolver (lazy imports: the chain directory, the venue listing and table, the
265
220
  * continuous lead resolver): the chart's chain (`resolveWrunLaneChartChain`, the options chain lane's own, or the
@@ -430,7 +385,7 @@ export function wrunLaneChainRefusalSeed(refusal) {
430
385
  severity: 'paused',
431
386
  ...(refusal.plane !== undefined ? { plane: refusal.plane } : {}),
432
387
  })
433
- : { cls: 'run-failed', variant: 'generic' };
388
+ : wrunAuthorRuleSeed(WRUN_OPTIONS_CHAIN_UNAVAILABLE_CODE);
434
389
  case 'flag-off':
435
390
  return { cls: 'no-options', variant: 'flag-off', params: { ...venue, ...coin } };
436
391
  case 'venue-not-listed':
@@ -448,7 +403,7 @@ export function wrunLaneChainRefusalSeed(refusal) {
448
403
  case 'opra-directory':
449
404
  return { cls: 'service-no-answer', variant: 'opra-directory' };
450
405
  default:
451
- return { cls: 'run-failed', variant: 'generic' };
406
+ return wrunAuthorRuleSeed(refusal.reason === 'one-venue' ? WRUN_OPTIONS_CHAIN_ONE_VENUE_CODE : WRUN_OPTIONS_CHAIN_VENUE_CODE);
452
407
  }
453
408
  }
454
409
  /** A refused chain decision as the error a lane refuses with: the decision's technical words with the input's class
@@ -470,7 +425,7 @@ export function wrunLaneChainLeadMoved(exchange, alias, planned) {
470
425
  return typeof lead === 'string' && lead !== '' && lead !== planned;
471
426
  }
472
427
  /** The seed of a knob the author fixes in the code: a failed run, its words in the details. */
473
- const WRUN_LANE_KNOB_SEED = Object.freeze({ cls: 'run-failed', variant: 'generic' });
428
+ const WRUN_LANE_KNOB_SEED = Object.freeze(wrunAuthorRuleSeed(WRUN_LANE_KNOB_INVALID_CODE));
474
429
  /** Refuse a knob the class does not take, by name (om's sheet refusal for a stray knob). */
475
430
  export function refuseWrunLaneStrayKnob(ctx, knob, owners) {
476
431
  return refuseWrunPollInput(ctx, `declares ${knob}, which is only valid on ${owners} sources: drop it`, WRUN_LANE_KNOB_SEED);
@@ -1,4 +1,4 @@
1
- import type { WrunRowLaneDescriptor, WrunRowLaneModule } from './wrun-row-lane.types.js';
1
+ import { type WrunRowLaneDescriptor, type WrunRowLaneModule } from './wrun-row-lane.types.js';
2
2
  /** The poll lanes' classes and keys, as the poll-lane registry binds them (none until it loads). */
3
3
  type WrunRowLanePollPeers = () => {
4
4
  classes: readonly string[];
@@ -13,9 +13,10 @@
13
13
  * tiers) or `latest` (no tiers, no tier choice, no fold);
14
14
  * - `governed` is `opra` or absent; `emptyAnswer` is `quiet`, `degrades` or absent; `acquisitions` is `one` or
15
15
  * absent; a `liveByCoin` lane names its script source and its stamp and fold functions, and is no `latest` one;
16
- * a `rowBudget` names a whole row cap and a projection, on a flow or snapshot that carries a present mask;
16
+ * a `rowBudget` names the whole cells of one answered row and a projection (its cap is the source answer budget,
17
+ * never the lane's own), on a flow or snapshot that carries a present mask;
17
18
  * - a `chain` lane names its exchange field, resolves its chain in its identity or facets, and declares no
18
- * `governed` and no `liveByCoin` (its plane is each instance's).
19
+ * `governed` (its plane is each instance's); fed live by coin, its channel is each instance's chain too.
19
20
  *
20
21
  * The consumers read the lookups below at call time, so the one test hook (`__setWrunRowLanesForTest`) swaps the
21
22
  * whole registry for a spec. The folder ships EMPTY of lanes until a class lands (UW-PARITY units U10b, U11).
@@ -26,6 +27,7 @@
26
27
  */
27
28
  // First: the row lane modules evaluate before this module's other imports, the order the bundler glob gave them.
28
29
  import { WRUN_ROW_LANE_MODULES } from './row-lanes/index.js';
30
+ import { WRUN_LANE_CHAIN_PLANES } from './wrun-row-lane.types.js';
29
31
  import { assertWrunHostGridLanding } from './host-grid-landing.js';
30
32
  import { WRUN_BROWSER_BUILTIN_SOURCE_CLASSES, wrunPollLaneClassOfFile } from '../wrun-browser-sources.leaf.js';
31
33
  import { registerWrunRefusalFeedKeys } from '../wrun-refusal.util.js';
@@ -43,8 +45,9 @@ function nonEmptyText(value) {
43
45
  return typeof value === 'string' && value !== '';
44
46
  }
45
47
  /** A chain lane's rules (`chain`): it names the payload field its chain's exchange rides in, resolves that chain in
46
- * its identity or facets, and keeps no per-descriptor plane (`governed`) and no live channel by coin (one plane's
47
- * channel). */
48
+ * its identity or facets, and keeps no per-descriptor plane (`governed`). It may be fed live by coin (`liveByCoin`,
49
+ * `option_prints`): each instance's coin channel names the exchange and the underlying its own chain lists on, never
50
+ * one plane's (wrun-coin-lane-live.util). */
48
51
  function assertWrunRowChainLane(who, lane) {
49
52
  const chain = lane.chain;
50
53
  if (chain === undefined)
@@ -58,8 +61,6 @@ function assertWrunRowChainLane(who, lane) {
58
61
  if (lane.identity === undefined && lane.facets === undefined) {
59
62
  throw new Error(`${who}: a chain lane resolves its chain in its identity or facets`);
60
63
  }
61
- if (lane.liveByCoin !== undefined)
62
- throw new Error(`${who}: a chain lane is polled, never fed live by coin`);
63
64
  }
64
65
  /** Refuse a malformed descriptor set by name (a programming error, never a user's). */
65
66
  function assertWrunRowLanes(lanes) {
@@ -142,8 +143,13 @@ function assertWrunRowLanes(lanes) {
142
143
  if (landing.kind === 'latest' || lane.presentMask === false) {
143
144
  throw new Error(`${who}: a row budget marks the bars it leaves out partial: a flow or snapshot with a present mask`);
144
145
  }
145
- if (!Number.isInteger(budget.maxRows) || budget.maxRows < 1 || typeof budget.barRows !== 'function') {
146
- throw new Error(`${who}: rowBudget is { maxRows: a whole number of rows, barRows: a function } or absent`);
146
+ if ('maxRows' in budget) {
147
+ throw new Error(`${who}: rowBudget names no row cap of its own; the cap is the source answer budget in rows of cellsPerRow`);
148
+ }
149
+ if (!Number.isInteger(budget.cellsPerRow) ||
150
+ budget.cellsPerRow < 1 ||
151
+ typeof budget.barRows !== 'function') {
152
+ throw new Error(`${who}: rowBudget is { cellsPerRow: a whole number of cells, barRows: a function } or absent`);
147
153
  }
148
154
  }
149
155
  const live = lane.liveByCoin;
@@ -158,6 +164,14 @@ function assertWrunRowLanes(lanes) {
158
164
  if (!isFunctionOrAbsent(live.coinOf) || !isFunctionOrAbsent(live.reconcile)) {
159
165
  throw new Error(`${who}: liveByCoin coinOf and reconcile are functions or absent`);
160
166
  }
167
+ const planes = live.chainPlanes;
168
+ if (planes !== undefined &&
169
+ (lane.chain === undefined ||
170
+ !Array.isArray(planes) ||
171
+ planes.length === 0 ||
172
+ !planes.every((plane) => WRUN_LANE_CHAIN_PLANES.includes(plane)))) {
173
+ throw new Error(`${who}: liveByCoin chainPlanes names a chain lane's planes (opra, cme, plain), or is absent`);
174
+ }
161
175
  }
162
176
  }
163
177
  }
@@ -1,2 +1,63 @@
1
+ /**
2
+ * `option_contract_flow` (UW-PARITY source contract v2, S4; on every chain since OPTIONS-PORT P7): one 17-value tuple per
3
+ * contract of the chain's ONE book that traded in the bar (wrun-option-contract-flow.util), summed per host bar from
4
+ * OPTION_PRINT_AGG's CONTRACT rows. A row lane: the host plans, asks under the tier rule, lands and reconciles it from
5
+ * this descriptor.
6
+ *
7
+ * - A CHAIN lane (`chain`): the chain is the one chain resolver's (opra-option-lanes.util `resolveWrunLaneChainChart`
8
+ * in `identity`, then `decideWrunLaneChain` per input in `facets`, the decision `options_chain` and `option_surface`
9
+ * read), and its plane is per instance: OPRA's rules on a US stock or OPRA contract chart (unchanged: the wall, the
10
+ * provenance stamp, the routed tier), CME's on a CME futures chart (a continuous chart reads its lead contract, and a
11
+ * live session rebuilds once the lead rolls: `acquisitionMoved`), none on a crypto chain. A chart with no option chain
12
+ * is refused by the decision's own name (`no-options` / `chain`), which a declared `missing: "empty"` drops with a
13
+ * note.
14
+ * - The acquisition names the chain: `coin` (the chain's underlying, the key its plane files the rows under),
15
+ * `flowExchange` (its plane follows it), `flowBook` for a book other than the underlying's own series (ONE book per
16
+ * input, D11: the worker keeps that book's rows) and `flowContinuous` for a CME chain read off a continuous alias.
17
+ * - Facets (om's facet list and words): `venue` and `book` (the chain classes' words), `expiries`, `strike_window_pct`
18
+ * and `min_volume` (above 0, in the chain's size unit: contracts on OPRA and CME, coin on a crypto chain), each
19
+ * refused by name outside its words (`wrun_option_knob_invalid`); `max_cells` required (the static plan's rule).
20
+ * - Tiers: 1m kept 7 days, 5m 30, 1h and 1d kept. The fold is tier-invariant (the backend rolls every tier up from
21
+ * the 1m one: sums, the strike window's contract-weighted underlying among them, the newest last price and the
22
+ * newest set IV), so the lane takes the COARSEST tier choice: each host bar reads the coarsest tier that fits it,
23
+ * still holds it and already serves it (a 5m bar one 5m bucket, a sealed daily bar one day bucket; the forming bar a
24
+ * real-time tier; a 09:30 New York stock bar never an hourly bucket), which cuts a liquid underlying's read several
25
+ * times over. A bar none holds is partial. A CME bar of a day or longer is read over its Globex session (the host's
26
+ * flow plan, wrun-tier-grid.util `wrunCmeSessionBarSpan`: from the 17:00 Chicago open before its 00:00Z stamp), so a
27
+ * sealed one reads hour buckets, never a UTC day bucket, which straddles the flip: an evening print folds into the
28
+ * next trade date's bar and its "0dte" reads that trade date.
29
+ * - Row budget: before any fetch the host projects each asked bar's rows on the plane of the instance's chain
30
+ * (`wrunOptionContractFlowBarRows` over the acquisition: OPRA's sessions at SPY's measured rows at the bar's tier,
31
+ * CME's Globex trade days, a crypto chain's UTC days at the busiest crypto chain's measured rows) and keeps the
32
+ * newest bars that fit the source answer budget (kscript-source-answer-budget.leaf, in rows of the raw tuple's 21
33
+ * cells: about 49,900 rows, 1.6 MB on the wire for SPY); every older bar of the window is partial (bit 14, one
34
+ * marker tuple) instead of the read failing. The kept bars are read whole, so they stay complete and exact. SPY at
35
+ * that budget: the newest 0.44 of a session on a 09:30-anchored chart (the 5m tier, about 3 hourly bars), 1.8
36
+ * sessions on a UTC hourly one, 7 on a daily one. Before the budget the cap was the worker's 500,000-row failure
37
+ * cap, ten times over every other layer's limit (2026-10-20 field hang: 25 MB asks that outlived the lane deadline
38
+ * and the row cache's entry cap).
39
+ * - The fold sums each contract over the host bar and applies the knobs that need the whole bar: the N nearest
40
+ * expiries, the strike window around the bar's contract-weighted underlying, the volume floor. "0dte" (a contract
41
+ * expiring on the bucket's trade date, on the chain's market's own clock) is kept per row by the worker twin of
42
+ * `K_OPTION_CONTRACT_FLOW`.
43
+ * - No live channel: the live tick's reconcile re-asks it (a flow: an empty window is quiet).
44
+ *
45
+ * LIGHT at module load: the chain resolver's directory, listing and lead reads run inside `identity` and `facets`.
46
+ */
47
+ import { type WrunLaneChain } from '../opra-option-lanes.util.js';
1
48
  import type { WrunRowLaneDescriptor } from '../wrun-row-lane.types.js';
49
+ /** Test seam: forget every resolved chart. */
50
+ export declare function __resetWrunContractFlowChartsForTests(): void;
51
+ /**
52
+ * An input's chain as the ask's fields (the acquisition key: the class, the plane its exchange names, the exchange,
53
+ * the underlying, the book and, per ask, the tier): `coin` (the chain's underlying, upper case: an OPRA chain's ticker
54
+ * exactly as before) and `flowExchange` always, `flowBook` for a book other than the underlying's own series (Deribit's
55
+ * BTC_USDC, OKX's BTC-USD), and `flowContinuous` for a CME chain read off a continuous alias
56
+ * (`wrunOptionContractFlowAcquisitionMoved` reads it).
57
+ */
58
+ export declare function wrunOptionContractFlowExtras(chain: WrunLaneChain): Record<string, unknown>;
59
+ /** Whether an acquisition no longer names the contract the lane would plan now (D12): a CME chain read off a
60
+ * continuous alias whose lead rolled since the run planned it (`wrunLaneChainLeadMoved`). A live session holding it
61
+ * rebuilds, so no ask, cache or buffer joins the old contract's rows to the new one's. */
62
+ export declare function wrunOptionContractFlowAcquisitionMoved(acquisition: Readonly<Record<string, unknown>>): boolean;
2
63
  export declare const rowLane: WrunRowLaneDescriptor;
@@ -1,17 +1,109 @@
1
+ /**
2
+ * `option_contract_flow` (UW-PARITY source contract v2, S4; on every chain since OPTIONS-PORT P7): one 17-value tuple per
3
+ * contract of the chain's ONE book that traded in the bar (wrun-option-contract-flow.util), summed per host bar from
4
+ * OPTION_PRINT_AGG's CONTRACT rows. A row lane: the host plans, asks under the tier rule, lands and reconciles it from
5
+ * this descriptor.
6
+ *
7
+ * - A CHAIN lane (`chain`): the chain is the one chain resolver's (opra-option-lanes.util `resolveWrunLaneChainChart`
8
+ * in `identity`, then `decideWrunLaneChain` per input in `facets`, the decision `options_chain` and `option_surface`
9
+ * read), and its plane is per instance: OPRA's rules on a US stock or OPRA contract chart (unchanged: the wall, the
10
+ * provenance stamp, the routed tier), CME's on a CME futures chart (a continuous chart reads its lead contract, and a
11
+ * live session rebuilds once the lead rolls: `acquisitionMoved`), none on a crypto chain. A chart with no option chain
12
+ * is refused by the decision's own name (`no-options` / `chain`), which a declared `missing: "empty"` drops with a
13
+ * note.
14
+ * - The acquisition names the chain: `coin` (the chain's underlying, the key its plane files the rows under),
15
+ * `flowExchange` (its plane follows it), `flowBook` for a book other than the underlying's own series (ONE book per
16
+ * input, D11: the worker keeps that book's rows) and `flowContinuous` for a CME chain read off a continuous alias.
17
+ * - Facets (om's facet list and words): `venue` and `book` (the chain classes' words), `expiries`, `strike_window_pct`
18
+ * and `min_volume` (above 0, in the chain's size unit: contracts on OPRA and CME, coin on a crypto chain), each
19
+ * refused by name outside its words (`wrun_option_knob_invalid`); `max_cells` required (the static plan's rule).
20
+ * - Tiers: 1m kept 7 days, 5m 30, 1h and 1d kept. The fold is tier-invariant (the backend rolls every tier up from
21
+ * the 1m one: sums, the strike window's contract-weighted underlying among them, the newest last price and the
22
+ * newest set IV), so the lane takes the COARSEST tier choice: each host bar reads the coarsest tier that fits it,
23
+ * still holds it and already serves it (a 5m bar one 5m bucket, a sealed daily bar one day bucket; the forming bar a
24
+ * real-time tier; a 09:30 New York stock bar never an hourly bucket), which cuts a liquid underlying's read several
25
+ * times over. A bar none holds is partial. A CME bar of a day or longer is read over its Globex session (the host's
26
+ * flow plan, wrun-tier-grid.util `wrunCmeSessionBarSpan`: from the 17:00 Chicago open before its 00:00Z stamp), so a
27
+ * sealed one reads hour buckets, never a UTC day bucket, which straddles the flip: an evening print folds into the
28
+ * next trade date's bar and its "0dte" reads that trade date.
29
+ * - Row budget: before any fetch the host projects each asked bar's rows on the plane of the instance's chain
30
+ * (`wrunOptionContractFlowBarRows` over the acquisition: OPRA's sessions at SPY's measured rows at the bar's tier,
31
+ * CME's Globex trade days, a crypto chain's UTC days at the busiest crypto chain's measured rows) and keeps the
32
+ * newest bars that fit the source answer budget (kscript-source-answer-budget.leaf, in rows of the raw tuple's 21
33
+ * cells: about 49,900 rows, 1.6 MB on the wire for SPY); every older bar of the window is partial (bit 14, one
34
+ * marker tuple) instead of the read failing. The kept bars are read whole, so they stay complete and exact. SPY at
35
+ * that budget: the newest 0.44 of a session on a 09:30-anchored chart (the 5m tier, about 3 hourly bars), 1.8
36
+ * sessions on a UTC hourly one, 7 on a daily one. Before the budget the cap was the worker's 500,000-row failure
37
+ * cap, ten times over every other layer's limit (2026-10-20 field hang: 25 MB asks that outlived the lane deadline
38
+ * and the row cache's entry cap).
39
+ * - The fold sums each contract over the host bar and applies the knobs that need the whole bar: the N nearest
40
+ * expiries, the strike window around the bar's contract-weighted underlying, the volume floor. "0dte" (a contract
41
+ * expiring on the bucket's trade date, on the chain's market's own clock) is kept per row by the worker twin of
42
+ * `K_OPTION_CONTRACT_FLOW`.
43
+ * - No live channel: the live tick's reconcile re-asks it (a flow: an empty window is quiet).
44
+ *
45
+ * LIGHT at module load: the chain resolver's directory, listing and lead reads run inside `identity` and `facets`.
46
+ */
47
+ import { decideWrunLaneChain, resolveWrunLaneChainChart, WRUN_OPTION_CHART_UNRESOLVED_CODE, wrunLaneChainLeadMoved, wrunLaneChartKey, } from '../opra-option-lanes.util.js';
48
+ import { refuseWrunPollInput } from '../wrun-poll-lane.types.js';
1
49
  import { refuseWrunOptionKnob, wrunOptionExpiriesKnob, wrunOptionExpiriesWord, wrunOptionStrikeWindowKnob, } from '../../wrun-option-knobs.util.js';
2
- import { foldWrunOptionContractFlowBar, WRUN_OPTION_CONTRACT_FLOW_MAX_ROWS, WRUN_OPTION_CONTRACT_FLOW_WIDTH, WRUN_OPTION_PRINT_AGG_TIERS, wrunOptionContractFlowBarRows, } from '../../wrun-option-contract-flow.util.js';
3
- import { resolveWrunOpraLaneUnderlying } from '../../wrun-opra-underlying.util.js';
50
+ import { foldWrunOptionContractFlowBar, WRUN_OPTION_CONTRACT_FLOW_BOOK_FIELD, WRUN_OPTION_CONTRACT_FLOW_CONTINUOUS_FIELD, WRUN_OPTION_CONTRACT_FLOW_EXCHANGE_FIELD, WRUN_OPTION_CONTRACT_FLOW_RAW_WIDTH, WRUN_OPTION_CONTRACT_FLOW_WIDTH, WRUN_OPTION_PRINT_AGG_TIERS, wrunOptionContractFlowBarRows, } from '../../wrun-option-contract-flow.util.js';
51
+ import { wrunAuthorRuleSeed } from '../../wrun-refusal.util.js';
4
52
  /** The lane's key, its feed in a refusal record. */
5
53
  const LANE_KEY = 'option_contract_flow';
6
- /** One input's facets: the expiries word, the strike window and the volume floor (each absent when not declared). */
7
- function contractFlowFacets(source, ctx) {
54
+ /** What `identity` resolved for a chart (the one chain resolver's chart), read back by `facets`. Keyed by the chart
55
+ * market; the newest entries kept. */
56
+ const FLOW_CHARTS_KEPT = 16;
57
+ const flowCharts = new Map();
58
+ function rememberFlowChart(key, chart) {
59
+ flowCharts.delete(key);
60
+ flowCharts.set(key, chart);
61
+ while (flowCharts.size > FLOW_CHARTS_KEPT)
62
+ flowCharts.delete(flowCharts.keys().next().value);
63
+ }
64
+ /** Test seam: forget every resolved chart. */
65
+ export function __resetWrunContractFlowChartsForTests() {
66
+ flowCharts.clear();
67
+ }
68
+ /**
69
+ * An input's chain as the ask's fields (the acquisition key: the class, the plane its exchange names, the exchange,
70
+ * the underlying, the book and, per ask, the tier): `coin` (the chain's underlying, upper case: an OPRA chain's ticker
71
+ * exactly as before) and `flowExchange` always, `flowBook` for a book other than the underlying's own series (Deribit's
72
+ * BTC_USDC, OKX's BTC-USD), and `flowContinuous` for a CME chain read off a continuous alias
73
+ * (`wrunOptionContractFlowAcquisitionMoved` reads it).
74
+ */
75
+ export function wrunOptionContractFlowExtras(chain) {
76
+ const coin = chain.underlying.toUpperCase();
77
+ const book = chain.book.toUpperCase();
78
+ return {
79
+ coin,
80
+ [WRUN_OPTION_CONTRACT_FLOW_EXCHANGE_FIELD]: chain.exchange,
81
+ ...(book !== coin ? { [WRUN_OPTION_CONTRACT_FLOW_BOOK_FIELD]: book } : {}),
82
+ ...(chain.continuous !== undefined ? { [WRUN_OPTION_CONTRACT_FLOW_CONTINUOUS_FIELD]: chain.continuous } : {}),
83
+ };
84
+ }
85
+ /** Whether an acquisition no longer names the contract the lane would plan now (D12): a CME chain read off a
86
+ * continuous alias whose lead rolled since the run planned it (`wrunLaneChainLeadMoved`). A live session holding it
87
+ * rebuilds, so no ask, cache or buffer joins the old contract's rows to the new one's. */
88
+ export function wrunOptionContractFlowAcquisitionMoved(acquisition) {
89
+ return wrunLaneChainLeadMoved(acquisition[WRUN_OPTION_CONTRACT_FLOW_EXCHANGE_FIELD], acquisition[WRUN_OPTION_CONTRACT_FLOW_CONTINUOUS_FIELD], acquisition.coin);
90
+ }
91
+ /** One input's facets: the expiries word, the strike window and the volume floor (each absent when not declared),
92
+ * then its chain, decided by the one chain resolver over the chart `identity` resolved (its `venue` and `book`). */
93
+ async function contractFlowFacets(source, ctx) {
8
94
  const expiries = wrunOptionExpiriesWord(wrunOptionExpiriesKnob(source, ctx));
9
95
  const strikeWindowPct = wrunOptionStrikeWindowKnob(source, ctx);
10
96
  const minVolume = source.min_volume;
11
97
  if (minVolume !== undefined && !(typeof minVolume === 'number' && Number.isFinite(minVolume) && minVolume > 0)) {
12
- refuseWrunOptionKnob(ctx, 'min_volume', minVolume, 'a contract count above 0');
98
+ refuseWrunOptionKnob(ctx, 'min_volume', minVolume, 'a size above 0 (contracts, or coin on a crypto chain)');
13
99
  }
100
+ const chart = flowCharts.get(wrunLaneChartKey(ctx));
101
+ if (chart === undefined) {
102
+ return refuseWrunPollInput(ctx, 'could not resolve the chart market for its options chain: Run again', wrunAuthorRuleSeed(WRUN_OPTION_CHART_UNRESOLVED_CODE));
103
+ }
104
+ const chain = await decideWrunLaneChain(chart, { venue: source.venue, book: source.book }, ctx);
14
105
  return {
106
+ ...wrunOptionContractFlowExtras(chain),
15
107
  ...(expiries !== undefined ? { expiries } : {}),
16
108
  ...(strikeWindowPct !== undefined ? { strikeWindowPct } : {}),
17
109
  ...(minVolume !== undefined ? { minVolume } : {}),
@@ -24,7 +116,11 @@ export const rowLane = {
24
116
  label: 'Option contract flow',
25
117
  feedWords: 'wrun.refusal.feed.optionContractFlow',
26
118
  width: WRUN_OPTION_CONTRACT_FLOW_WIDTH,
27
- identity: async (ctx) => ({ coin: await resolveWrunOpraLaneUnderlying(ctx) }),
119
+ chain: { exchangeField: WRUN_OPTION_CONTRACT_FLOW_EXCHANGE_FIELD },
120
+ acquisitionMoved: wrunOptionContractFlowAcquisitionMoved,
121
+ identity: async (ctx) => {
122
+ rememberFlowChart(wrunLaneChartKey(ctx), await resolveWrunLaneChainChart(ctx));
123
+ },
28
124
  facets: contractFlowFacets,
29
125
  landing: {
30
126
  kind: 'flow',
@@ -32,7 +128,6 @@ export const rowLane = {
32
128
  tierChoice: 'coarsest',
33
129
  fold: (group, acquisition) => foldWrunOptionContractFlowBar(group.rows, acquisition),
34
130
  },
35
- rowBudget: { maxRows: WRUN_OPTION_CONTRACT_FLOW_MAX_ROWS, barRows: wrunOptionContractFlowBarRows },
36
- governed: 'opra',
131
+ rowBudget: { cellsPerRow: WRUN_OPTION_CONTRACT_FLOW_RAW_WIDTH, barRows: wrunOptionContractFlowBarRows },
37
132
  emptyAnswer: 'quiet',
38
133
  };
@@ -28,6 +28,11 @@
28
28
  * the one venue decision names for the word, in `options_chain`'s words; absent reads `auto`, the chain
29
29
  * `options_chain`'s `auto` reads on the same chart); `max_cells` is required (the static plan) and a block over it
30
30
  * refuses the run, never truncated. A market pin and the knobs of the other options classes are refused by name.
31
+ * - Views (OPTLOAD G5, wrun-option-views.util): `page_view` or `page_views` reads a projection of the class's block B
32
+ * in place of B whole (`stateViews`; a view's own params, `min_volume` included, ride as flat knobs). The worker asks
33
+ * the gateway for them in ONE chain summary read; a gateway without the views refuses them by name.
34
+ * - On the OPRA plane the chain is the plane's own by coin (section 8, O1: `wrunHeldOpraPlaneChain`): no chain
35
+ * directory is read before the lane's first ask.
31
36
  *
32
37
  * LIGHT at module load: the chain resolver's directory, listing and lead reads run inside `identity` and `facets`.
33
38
  */
@@ -28,24 +28,33 @@
28
28
  * the one venue decision names for the word, in `options_chain`'s words; absent reads `auto`, the chain
29
29
  * `options_chain`'s `auto` reads on the same chart); `max_cells` is required (the static plan) and a block over it
30
30
  * refuses the run, never truncated. A market pin and the knobs of the other options classes are refused by name.
31
+ * - Views (OPTLOAD G5, wrun-option-views.util): `page_view` or `page_views` reads a projection of the class's block B
32
+ * in place of B whole (`stateViews`; a view's own params, `min_volume` included, ride as flat knobs). The worker asks
33
+ * the gateway for them in ONE chain summary read; a gateway without the views refuses them by name.
34
+ * - On the OPRA plane the chain is the plane's own by coin (section 8, O1: `wrunHeldOpraPlaneChain`): no chain
35
+ * directory is read before the lane's first ask.
31
36
  *
32
37
  * LIGHT at module load: the chain resolver's directory, listing and lead reads run inside `identity` and `facets`.
33
38
  */
34
- import { decideWrunLaneChain, refuseWrunLaneStrayKnob, resolveWrunLaneChainChart, wrunLaneChainLeadMoved, wrunLaneChartKey, } from '../opra-option-lanes.util.js';
39
+ import { decideWrunLaneChain, refuseWrunLaneStrayKnob, resolveWrunLaneChainChart, WRUN_OPTION_CHART_UNRESOLVED_CODE, wrunLaneChainLeadMoved, wrunLaneChartKey, } from '../opra-option-lanes.util.js';
35
40
  import { refuseWrunPollInput } from '../wrun-poll-lane.types.js';
36
41
  import { wrunOptionExpiriesKnob, wrunOptionExpiriesText, wrunOptionStrikeWindowKnob, } from '../../wrun-option-knobs.util.js';
42
+ import { wrunAuthorRuleSeed } from '../../wrun-refusal.util.js';
43
+ import { wrunHeldOpraPlaneChain, wrunOptionViewLaneFields, wrunOptionViewParamKnobs, wrunOptionViewsOfSource, } from '../../wrun-option-views.util.js';
37
44
  /** f64s per tuple (the source contract's width, the `present` mask included). */
38
45
  export const WRUN_OPTION_CONTRACT_STATE_WIDTH = 13;
39
46
  /** om's code for a market pin on the OPRA classes. */
40
47
  export const WRUN_OPTION_MARKET_PINNED_CODE = 'wrun_option_market_pinned';
41
48
  /** The payload field an instance names its chain's exchange in (its plane follows it). */
42
49
  export const WRUN_OPTION_CONTRACT_STATE_EXCHANGE_FIELD = 'stateExchange';
43
- /** The knobs of the other options classes, each refused here by name (`venue` is this class's own since kit 0.87.0). */
50
+ /** The knobs of the other options classes, each refused here by name (`venue` is this class's own since kit 0.87.0;
51
+ * the print classes' knobs are option_prints_v2's too, and `structure` its own, since kit 0.88.0). */
44
52
  const STRAY_KNOBS = [
45
- ['history', "'tape' and 'option_prints' celled"],
53
+ ['history', "'tape', 'option_prints' and 'option_prints_v2' celled"],
46
54
  ['min_size', "'tape' celled"],
47
- ['min_premium', "'option_prints' celled"],
48
- ['overflow', "'option_prints' celled"],
55
+ ['min_premium', "'option_prints' and 'option_prints_v2' celled"],
56
+ ['overflow', "'option_prints' and 'option_prints_v2' celled"],
57
+ ['structure', "'option_prints_v2' celled"],
49
58
  ['min_volume', "'option_contract_flow' celled"],
50
59
  ];
51
60
  /** What `identity` resolved for a chart (the one chain resolver's chart), read back by `facets`. Keyed by the chart
@@ -95,31 +104,34 @@ export const rowLane = {
95
104
  landing: { kind: 'latest' },
96
105
  acquisitionMoved: wrunOptionContractStateAcquisitionMoved,
97
106
  identity: async (ctx) => {
98
- rememberStateChart(wrunLaneChartKey(ctx), await resolveWrunLaneChainChart(ctx));
107
+ // On the OPRA plane the chain is the plane's own by coin: no chain directory is read (O1).
108
+ const held = await wrunHeldOpraPlaneChain(ctx.exchange, ctx.coin, ctx.opraPlane);
109
+ rememberStateChart(wrunLaneChartKey(ctx), await resolveWrunLaneChainChart(ctx, held));
99
110
  },
100
111
  facets: async (source, ctx) => {
112
+ // A knob a declared view takes is that view's param, never another class's stray knob.
113
+ const viewKnobs = wrunOptionViewParamKnobs(source);
101
114
  for (const [knob, owners] of STRAY_KNOBS) {
102
- if (source[knob] !== undefined)
115
+ if (source[knob] !== undefined && !viewKnobs.has(knob))
103
116
  refuseWrunLaneStrayKnob(ctx, knob, owners);
104
117
  }
105
118
  if (source.symbol !== undefined || source.exchange !== undefined) {
106
- refuseWrunPollInput(ctx, `pins option_contract_state cells to a fixed market (${WRUN_OPTION_MARKET_PINNED_CODE}); it reads the chart's own underlying, so drop the symbol and exchange pin`, { cls: 'run-failed', variant: 'generic' });
119
+ refuseWrunPollInput(ctx, `pins option_contract_state cells to a fixed market (${WRUN_OPTION_MARKET_PINNED_CODE}); it reads the chart's own underlying, so drop the symbol and exchange pin`, wrunAuthorRuleSeed(WRUN_OPTION_MARKET_PINNED_CODE));
107
120
  }
108
121
  // om's knob words and its one refusal name (`wrun_option_knob_invalid`), as every options class refuses them.
109
122
  const expiries = wrunOptionExpiriesKnob(source, ctx);
110
123
  const strikeWindowPct = wrunOptionStrikeWindowKnob(source, ctx);
111
124
  const chart = stateCharts.get(wrunLaneChartKey(ctx));
112
125
  if (chart === undefined) {
113
- return refuseWrunPollInput(ctx, 'could not resolve the chart market for its options chain: Run again', {
114
- cls: 'run-failed',
115
- variant: 'generic',
116
- });
126
+ return refuseWrunPollInput(ctx, 'could not resolve the chart market for its options chain: Run again', wrunAuthorRuleSeed(WRUN_OPTION_CHART_UNRESOLVED_CODE));
117
127
  }
128
+ const views = wrunOptionViewsOfSource(source, ctx, 'option_contract_state');
118
129
  const chain = await decideWrunLaneChain(chart, { venue: source.venue, book: source.book }, ctx);
119
130
  return {
120
131
  ...wrunOptionContractStateExtras(chain),
121
132
  stateExpiries: wrunOptionExpiriesText(expiries),
122
133
  ...(strikeWindowPct !== undefined ? { stateStrikeWindowPct: strikeWindowPct } : {}),
134
+ ...(views !== undefined ? wrunOptionViewLaneFields('option_contract_state', views) : {}),
123
135
  };
124
136
  },
125
137
  };
@@ -1,4 +1,59 @@
1
+ /**
2
+ * `option_prints` (UW-PARITY source contract v2, S3; on every chain since OPTIONS-PORT P7): every print of the chain's
3
+ * ONE book at or above the input's `min_premium`, one 16-value tuple per print on the bar it printed in
4
+ * (wrun-option-prints.util), history plus live. A row lane: the host plans, asks, lands and reconciles it from this
5
+ * descriptor.
6
+ *
7
+ * - A CHAIN lane (`chain`): the chain is the one chain resolver's (opra-option-lanes.util `resolveWrunLaneChainChart`
8
+ * in `identity`, then `decideWrunLaneChain` per input in `facets`, the decision `options_chain` and `option_surface`
9
+ * read), and its plane is per instance: OPRA's rules on a US stock or OPRA contract chart (unchanged: the wall, the
10
+ * provenance stamp, the routed tier), CME's on a CME futures chart (a continuous chart reads its lead contract, and a
11
+ * live session rebuilds once the lead rolls: `acquisitionMoved`), none on a crypto chain. A chart with no option chain
12
+ * is refused by the decision's own name (`no-options` / `chain`), which a declared `missing: "empty"` drops with a
13
+ * note.
14
+ * - The acquisition names the chain: `coin` (the chain's underlying, the key its plane files prints under),
15
+ * `printExchange` (its plane follows it), `printBook` for a book other than the underlying's own series (ONE book per
16
+ * input, D11: the worker and the live fold keep that book's prints) and `printContinuous` for a CME chain read off a
17
+ * continuous alias.
18
+ * - Facets (the acquisition, om's facet list and words): `min_premium` (required: `wrun_option_prints_min_premium_
19
+ * required`), `expiries`, `history` ("live" | "3d" | "90d") and `overflow` ("refuse" | "largest"), each refused by
20
+ * name outside its words (`wrun_option_knob_invalid`), and the chain classes' `venue` and `book`. One acquisition a
21
+ * package: two inputs whose knobs or chains differ refuse by name.
22
+ * - History: one ask over the window from the span the backend serves the acquisition (`horizon`: the table the
23
+ * floor and the history reach, the gateway's bar limit); older bars are partial. The K control `K_OPTION_PRINT`
24
+ * reads it on the native-rows path, keyed by second; the landing re-bases each print's offset on its host bar.
25
+ * - Projection, per input: `expiries: "nearest:N"` keeps the bar's N nearest expiries; `overflow: "largest"` cuts a
26
+ * bar over the input's own `max_cells` to its largest premiums (om's packer rule, bit 14 on the first kept print).
27
+ * - Live by coin, on the planes whose OPTION_PRINT producer streams (`chainPlanes`: OPRA and CME): the coin channel of
28
+ * the instance's chain (`K_OPTION_PRINT` subscribes the chain's exchange and underlying, on a governed exchange at a
29
+ * real-time routed tier only: wrun-coin-lane-live.util) feeds every print of the underlying; the fold keeps the
30
+ * acquisition's chain (its exchange and its ONE book), its floor and "0dte"; a reconcile merges by `print_key`, so a
31
+ * print shown live never vanishes and one seen on both paths is one tuple. A crypto chain subscribes no channel: the
32
+ * gateway derives its prints from the venue trades ore stores each minute and serves them from history alone (no
33
+ * frame ever reaches a crypto coin channel), so the live tick's reconcile re-asks it, as it re-asks
34
+ * `option_contract_flow`, and the same merge by `print_key` keeps every print once. Never a TRADE channel: the browser
35
+ * builds no print from trades.
36
+ * - A CME chart's daily or longer bar is asked over its Globex session (the host's flow plan, wrun-tier-grid.util
37
+ * `wrunCmeSessionBarSpan`): an evening print belongs to the next trade date's bar, stamped 00:00Z, so its offset on it
38
+ * reads below 0.
39
+ *
40
+ * LIGHT at module load: the chain resolver's directory, listing and lead reads run inside `identity` and `facets`.
41
+ */
42
+ import { type WrunLaneChain } from '../opra-option-lanes.util.js';
1
43
  import type { WrunRowLaneDescriptor } from '../wrun-row-lane.types.js';
2
44
  /** om's refusal name of a missing floor. */
3
45
  export declare const WRUN_OPTION_PRINTS_MIN_PREMIUM_REQUIRED_CODE = "wrun_option_prints_min_premium_required";
46
+ /** Test seam: forget every resolved chart. */
47
+ export declare function __resetWrunPrintsChartsForTests(): void;
48
+ /**
49
+ * An input's chain as the ask's fields (the acquisition key: the class, the plane its exchange names, the exchange,
50
+ * the underlying and the book): `coin` (the chain's underlying, upper case: an OPRA chain's ticker exactly as before)
51
+ * and `printExchange` always, `printBook` for a book other than the underlying's own series (Deribit's BTC_USDC, OKX's
52
+ * BTC-USD), and `printContinuous` for a CME chain read off a continuous alias (`wrunOptionPrintsAcquisitionMoved`).
53
+ */
54
+ export declare function wrunOptionPrintsExtras(chain: WrunLaneChain): Record<string, unknown>;
55
+ /** Whether an acquisition no longer names the contract the lane would plan now (D12): a CME chain read off a
56
+ * continuous alias whose lead rolled since the run planned it (`wrunLaneChainLeadMoved`). A live session holding it
57
+ * rebuilds, so no ask, live fold or buffer joins the old contract's prints to the new one's. */
58
+ export declare function wrunOptionPrintsAcquisitionMoved(acquisition: Readonly<Record<string, unknown>>): boolean;
4
59
  export declare const rowLane: WrunRowLaneDescriptor;