@orangecharts/wrun-chart-host 0.6.0 → 0.7.1

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 (142) hide show
  1. package/README.md +14 -5
  2. package/dist/constants/marketCapabilities.constants.d.ts +5 -0
  3. package/dist/constants/marketCapabilities.constants.js +16 -0
  4. package/dist/host-ports.types.d.ts +35 -3
  5. package/dist/index.d.ts +11 -1
  6. package/dist/index.js +11 -1
  7. package/dist/indicators/controls/tpo-session.util.js +42 -18
  8. package/dist/market-data/billing.interface.d.ts +2 -1
  9. package/dist/settings-templates/index.d.ts +2 -0
  10. package/dist/settings-templates/index.js +19 -5
  11. package/dist/settings-templates/indicator-fields.d.ts +2 -0
  12. package/dist/settings-templates/indicator-fields.js +10 -0
  13. package/dist/settings-templates/tool-rules.d.ts +12 -2
  14. package/dist/settings-templates/tool-rules.js +9 -2
  15. package/dist/settings-templates/tool-tables.generated.js +9 -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-browser-sources.leaf.d.ts +10 -0
  91. package/dist/utility/wrun/wrun-browser-sources.leaf.js +12 -0
  92. package/dist/utility/wrun/wrun-coin-lane-live.util.d.ts +3 -3
  93. package/dist/utility/wrun/wrun-coin-lane-live.util.js +53 -18
  94. package/dist/utility/wrun/wrun-color-settings.util.d.ts +6 -0
  95. package/dist/utility/wrun/wrun-color-settings.util.js +45 -0
  96. package/dist/utility/wrun/wrun-draft-overlay.util.js +14 -8
  97. package/dist/utility/wrun/wrun-failure-cause.d.ts +1 -1
  98. package/dist/utility/wrun/wrun-failure-cause.js +14 -0
  99. package/dist/utility/wrun/wrun-frames.js +6 -2
  100. package/dist/utility/wrun/wrun-host.service.d.ts +26 -18
  101. package/dist/utility/wrun/wrun-host.service.js +49 -52
  102. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +1 -1
  103. package/dist/utility/wrun/wrun-hosted-wire-caps.js +2 -0
  104. package/dist/utility/wrun/wrun-input-requirements.leaf.js +7 -4
  105. package/dist/utility/wrun/wrun-kit-run-tables.util.d.ts +24 -0
  106. package/dist/utility/wrun/wrun-kit-run-tables.util.js +87 -0
  107. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +2 -1
  108. package/dist/utility/wrun/wrun-live-tick.util.d.ts +8 -2
  109. package/dist/utility/wrun/wrun-live-tick.util.js +35 -16
  110. package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +40 -13
  111. package/dist/utility/wrun/wrun-opra-flow.leaf.js +39 -12
  112. package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +70 -21
  113. package/dist/utility/wrun/wrun-option-contract-flow.util.js +257 -112
  114. package/dist/utility/wrun/wrun-option-prints.util.d.ts +62 -22
  115. package/dist/utility/wrun/wrun-option-prints.util.js +148 -46
  116. package/dist/utility/wrun/wrun-option-views.util.d.ts +262 -0
  117. package/dist/utility/wrun/wrun-option-views.util.js +356 -0
  118. package/dist/utility/wrun/wrun-options-chain.util.d.ts +23 -2
  119. package/dist/utility/wrun/wrun-options-chain.util.js +37 -3
  120. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +18 -3
  121. package/dist/utility/wrun/wrun-overlay-drivers.util.js +32 -7
  122. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +9 -3
  123. package/dist/utility/wrun/wrun-overlay-recovery.util.js +146 -18
  124. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +50 -6
  125. package/dist/utility/wrun/wrun-overlay-run.util.js +816 -243
  126. package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +5 -0
  127. package/dist/utility/wrun/wrun-pin-spelling.util.js +28 -12
  128. package/dist/utility/wrun/wrun-pin-venues.util.js +4 -6
  129. package/dist/utility/wrun/wrun-present-bits.util.d.ts +9 -0
  130. package/dist/utility/wrun/wrun-present-bits.util.js +39 -0
  131. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +3 -2
  132. package/dist/utility/wrun/wrun-refusal-surface.util.js +5 -4
  133. package/dist/utility/wrun/wrun-refusal.util.d.ts +66 -6
  134. package/dist/utility/wrun/wrun-refusal.util.js +335 -40
  135. package/dist/utility/wrun/wrun-source-rows.util.js +11 -0
  136. package/dist/utility/wrun/wrun-tier-grid.util.d.ts +28 -3
  137. package/dist/utility/wrun/wrun-tier-grid.util.js +79 -19
  138. package/dist/utility/wrun/wrun-transient-rerun.util.d.ts +14 -3
  139. package/dist/utility/wrun/wrun-transient-rerun.util.js +33 -8
  140. package/package.json +5 -5
  141. package/dist/utility/wrun/wrun-opra-underlying.util.d.ts +0 -12
  142. package/dist/utility/wrun/wrun-opra-underlying.util.js +0 -1
@@ -1,27 +1,47 @@
1
1
  /**
2
- * The `options_flow` lane (UW-PARITY source S2): one bar's US listed option flow (OPRA) of the chart's underlying, or
3
- * of a market-wide scope, as 32 scalars per bar: premium in USD, contracts and prints as counts, share delta in
4
- * shares, vega in USD per IV point (`input("calls", options_flow.net_call_prem, { scope: "market", dte: "0dte" })`).
2
+ * The `options_flow` lane (UW-PARITY source S2, a CHAIN lane since OPTIONS-PORT P7): one bar's option flow of the
3
+ * chart's options chain, or of a scope across underlyings or venues, as 32 scalars per bar: premium in USD, contracts
4
+ * (coin on a crypto chain, contracts on CME and OPRA) and prints as counts, share delta in the chart's size unit, vega
5
+ * in USD per IV point (`input("calls", options_flow.net_call_prem, { scope: "market", dte: "0dte" })`).
5
6
  *
6
- * It reads OPTION_PRINT_AGG flow scope rows (wrun-opra-flow.leaf: which rows each knob names) through the
7
+ * It reads OPTION_PRINT_AGG flow scope rows (wrun-opra-flow.leaf: which rows each ask names) through the
7
8
  * `K_OPTION_PRINT_AGG_SCOPE` control and its worker twin, which sums a bucket's matching rows into the 32 fields
8
9
  * (`foldWrunOptionsFlowRows`); this lane lands the buckets on the chart's bars under the tier rule (rule 9: 1m kept 7
9
10
  * days, 5m kept 30, 1d kept, the finest that fits the bar and still holds it; a stock chart's 09:30 New York bars, an
10
- * OPRA contract chart's UTC ones), summed per bar. A bar no tier holds any more reads the input's `missing` fill.
11
+ * OPRA contract chart's and a crypto chart's UTC ones, a CME chart's intraday ones on their stamps; a CME bar of a day
12
+ * or longer over its Globex session, from the 17:00 Chicago open before its 00:00Z stamp, which no UTC day bucket fits:
13
+ * such a bar older than the 5m tier reads its fill, never a misdated day), summed per bar. A bar no tier holds any more
14
+ * reads the input's `missing` fill.
11
15
  *
12
- * Knobs (acquisition facets, each validated here before any fetch, refused by name otherwise):
13
- * - `scope`: `ticker` (the default: COIN rows of the chart's underlying), `market` (MARKET rows of every issue type),
14
- * `equity`, `etf`, `index` (MARKET rows of that issue type), `venue` (VENUE rows of the `venue` knob's exchange);
16
+ * A CHAIN lane (`chain`): the chain is the one chain resolver's (opra-option-lanes.util `resolveWrunLaneChainChart`
17
+ * then `decideWrunLaneChain`, `auto`: the chain `options_chain` reads), resolved once per run for every input, and its
18
+ * plane is per instance: OPRA's rules on a US stock or OPRA contract chart (the wall, the plane and its routed tier in
19
+ * the ask, the provenance stamp), CME's on a CME futures chart (the display wall, the routed tier; a continuous chart
20
+ * reads its lead future and a live session rebuilds once the lead rolls: `acquisitionMoved`), none on a crypto chain. On
21
+ * the OPRA plane (`ctx.opraPlane`) the chain is the plane's own by coin (`wrunLaneOpraPlaneChain`): no chain directory
22
+ * read, and its reads stay byte-identical. It rides the native-rows path on every plane (`nativeRows` + `barGrid`), so
23
+ * the index-mode stock chart serves it too.
24
+ *
25
+ * Knobs (acquisition facets, each validated here before any fetch, refused by name otherwise), the scope words per
26
+ * plane (R7c C7-2):
27
+ * - `scope`: `ticker` (the default: COIN rows of the chain's underlying; on a crypto chain on its venue, ONE book),
28
+ * `market` (OPRA: MARKET rows of every issue type; CME: MARKET rows of the chain's exchange; crypto: COIN rows of the
29
+ * chart's coin on every crypto venue of the venue table the crypto-options gate leaves open, every book: Deribit
30
+ * alone for a guest, as every other chain class reads the gate), `equity`, `etf`, `index` (MARKET rows of that US
31
+ * issue type: OPRA only), `venue` (OPRA: VENUE rows of the `venue` knob's exchange; crypto: COIN rows of the chart's
32
+ * coin on that venue, every book, a venue the gate keeps dark refused `flag-off` as the chain decision refuses it;
33
+ * CME, one venue: none);
15
34
  * - `dte`: `all` (the default), `0dte`, `week` (1 to 7 days), `month` (8 to 35), `later`;
16
35
  * - `moneyness`: `all` (the default), `otm`, `itm`;
17
- * - `venue`: scope `venue` only, required there: an exchange's ISO MIC (`XCBO`), read by its Databento publisher id
18
- * (`WRUN_OPTIONS_FLOW_VENUE_PUBLISHER_IDS`). That scope serves `call_prem_total`, `put_prem_total`,
19
- * `call_contracts_total`, `put_contracts_total` and `prints` alone, with no `dte` or `moneyness` split.
20
- *
21
- * OPRA: `opra`, so the run's wall refuses a package that may not read US options (`opra-official-only:options_flow`),
22
- * the lane is served only where the chart's options ride the OPRA plane, its asks name the plane and their routed
23
- * tier, and the overlay's OPRA provenance is stamped before the first ask. `nativeRows` + `barGrid`: served on the
24
- * index-mode stock chart, asked on the native-rows path, landed on the host grid.
36
+ * - `venue`: scope `venue` only, required there: on OPRA an exchange's ISO MIC (`XCBO`), read by its Databento
37
+ * publisher id (`WRUN_OPTIONS_FLOW_VENUE_PUBLISHER_IDS`); on a crypto chain a crypto venue's exchange name
38
+ * (`OKEX_OPTIONS`, the venue table's). That scope serves `call_prem_total`, `put_prem_total`,
39
+ * `call_contracts_total`, `put_contracts_total` and `prints` alone, with no `dte` or `moneyness` split;
40
+ * - `book`: scope `ticker` only: `auto` (the default, the chain's default book) or one series of the chain, decided
41
+ * when the run plans; a crypto chain's ask names it, an OPRA or CME chain's one book is its underlying.
42
+ * A scope the chart's plane does not serve (a US issue type off OPRA, `venue` on CME, a venue word of another plane) is
43
+ * refused with `wrunLaneUnservedScopeSeed`'s seed, so the planner drops an input that declared a fill with the market's
44
+ * note, as on a chart with no option chain (the options chain's `no-chain`, a LINK perp).
25
45
  *
26
46
  * Before the protocol package names OPTION_PRINT_AGG, every input refuses by name before any fetch
27
47
  * (`protocol-pending:OPTION_PRINT_AGG`). The gateway's scope reads stay behind its `read.option_print_scopes`
@@ -29,18 +49,20 @@
29
49
  * degrades the lane once, its chip the record below (wrun-lane-refusal.leaf), never a blank or a retry loop.
30
50
  */
31
51
  import { refuseWrunPollInput, WRUN_POLL_AUTHOR_GATE_SEED, } from '../wrun-poll-lane.types.js';
32
- import { WRUN_OPTION_PRINT_AGG_SCOPE_KTYPE, WRUN_OPTION_SCOPE_READS_OFF_CODE, WRUN_OPTIONS_FLOW_DTE, WRUN_OPTIONS_FLOW_FIELDS, WRUN_OPTIONS_FLOW_MONEYNESS, WRUN_OPTIONS_FLOW_SCOPES, WRUN_OPTIONS_FLOW_TYPE, WRUN_OPTIONS_FLOW_VENUE_FIELDS, WRUN_OPTIONS_FLOW_VENUE_RE, } from '../../wrun-opra-flow.leaf.js';
52
+ import { decideWrunLaneChain, resolveWrunLaneChainChart, wrunLaneChainLeadMoved, wrunLaneChainRefusalError, wrunLaneOpraPlaneChain, } from '../opra-option-lanes.util.js';
53
+ import { wrunOptionsChainFlagOffRefusal, wrunOptionsChainGatedVenueName } from '../../wrun-options-chain.util.js';
54
+ import { WRUN_OPTION_PRINT_AGG_SCOPE_KTYPE, WRUN_OPTION_SCOPE_READS_OFF_CODE, WRUN_OPTIONS_FLOW_BOOK_FIELD, WRUN_OPTIONS_FLOW_CONTINUOUS_FIELD, WRUN_OPTIONS_FLOW_DTE, WRUN_OPTIONS_FLOW_EXCHANGE_FIELD, WRUN_OPTIONS_FLOW_FIELDS, WRUN_OPTIONS_FLOW_MONEYNESS, WRUN_OPTIONS_FLOW_OPRA_SCOPES, WRUN_OPTIONS_FLOW_SCOPES, WRUN_OPTIONS_FLOW_TIER_MS, WRUN_OPTIONS_FLOW_TYPE, WRUN_OPTIONS_FLOW_VENUE_FIELDS, WRUN_OPTIONS_FLOW_VENUE_RE, WRUN_OPTIONS_FLOW_VENUES_FIELD, } from '../../wrun-opra-flow.leaf.js';
33
55
  import { assertWrunProtocolType, wrunProtocolPendingSeed } from '../../wrun-protocol-pending.util.js';
34
56
  /** The lane key (the refusal record's feed words, `wrun.refusal.feed.optionsFlow`). */
35
57
  export const WRUN_OPTIONS_FLOW_LANE_KEY = 'options_flow';
36
- const MINUTE = 60_000;
37
58
  const DAY = 86_400_000;
38
- /** The tiers a bar is read from (rule 9, ADDENDUM-2 B3; the VENUE family keeps no 5m tier, so a 5m ask of it the
39
- * gateway rolls up from its 1m rows, which a bar older than 7 days no longer has: that bar reads its fill). */
59
+ /** The tiers a bar is read from (rule 9, ADDENDUM-2 B3, the cme plane's scope families and ore's alike: C7-1; the VENUE
60
+ * family keeps no 5m tier, so a 5m ask of it the gateway rolls up from its 1m rows, which a bar older than 7 days no
61
+ * longer has: that bar reads its fill). */
40
62
  export const WRUN_OPTIONS_FLOW_TIERS = Object.freeze([
41
- { key: '1m', ms: MINUTE, retentionMs: 7 * DAY },
42
- { key: '5m', ms: 5 * MINUTE, retentionMs: 30 * DAY },
43
- { key: '1d', ms: DAY },
63
+ { key: '1m', ms: WRUN_OPTIONS_FLOW_TIER_MS['1m'], retentionMs: 7 * DAY },
64
+ { key: '5m', ms: WRUN_OPTIONS_FLOW_TIER_MS['5m'], retentionMs: 30 * DAY },
65
+ { key: '1d', ms: WRUN_OPTIONS_FLOW_TIER_MS['1d'] },
44
66
  ]);
45
67
  /**
46
68
  * The Databento publisher id the data plane names each `venue` word by (the VENUE rows' `venue`, the request's
@@ -81,62 +103,176 @@ function knobWord(source, ctx, knob, words) {
81
103
  return refuseWrunPollInput(ctx, `declares ${knob} '${String(declared)}': ${knob} is one of ${words.map((word) => `"${word}"`).join(', ')} ` +
82
104
  `("${words[0]}" when absent)`, WRUN_POLL_AUTHOR_GATE_SEED);
83
105
  }
84
- /** One input against the chart: its knobs, then the protocol gate; the answer is the acquisition's knobs. */
106
+ /** Scope `venue`'s rules on any plane, before the chain is resolved: the venue required and spelled as an exchange id,
107
+ * and the fields its rows serve with no side, DTE or moneyness split; answers the venue word. */
108
+ function venueScopeWord(source, ctx, dte, moneyness) {
109
+ const venue = source.venue;
110
+ if (venue === undefined) {
111
+ return refuseWrunPollInput(ctx, 'declares scope "venue" with no venue: name the exchange whose prints it reads (options-flow-venue-required)', WRUN_POLL_AUTHOR_GATE_SEED);
112
+ }
113
+ if (typeof venue !== 'string' || !WRUN_OPTIONS_FLOW_VENUE_RE.test(venue)) {
114
+ return refuseWrunPollInput(ctx, `declares venue '${String(venue)}': a venue is an exchange id, 2 to 16 upper-case letters, digits or underscores`, WRUN_POLL_AUTHOR_GATE_SEED);
115
+ }
116
+ const field = String(source.field ?? '');
117
+ const served = WRUN_OPTIONS_FLOW_VENUE_FIELDS;
118
+ const split = !served.includes(field)
119
+ ? `field '${field}'`
120
+ : dte !== 'all'
121
+ ? `dte "${dte}"`
122
+ : moneyness !== 'all'
123
+ ? `moneyness "${moneyness}"`
124
+ : undefined;
125
+ if (split !== undefined) {
126
+ return refuseWrunPollInput(ctx, `reads ${split} under scope "venue": the venue rows serve ${served.join(', ')}, with no side, DTE or ` +
127
+ 'moneyness split (options-flow-venue-field)', WRUN_POLL_AUTHOR_GATE_SEED);
128
+ }
129
+ return venue;
130
+ }
131
+ /** The chart each run's plan resolved for the flow lane, by the plan's scope (`WrunPollLaneContext.runScope`): every
132
+ * input of one run reads one resolution (one chain, one `auto` book), and the next run resolves afresh. */
133
+ const flowCharts = new WeakMap();
134
+ /** The chart the lane decides its chain over: on the OPRA plane the plane's own chain by coin (no chain directory
135
+ * read: `wrunLaneOpraPlaneChain`), off it the chart's chain as the one resolver resolves it. */
136
+ function flowChartOf(ctx) {
137
+ const resolve = () => resolveWrunLaneChainChart(ctx, ctx.opraPlane === true ? wrunLaneOpraPlaneChain(ctx.coin) : undefined);
138
+ const scope = ctx.runScope;
139
+ if (scope === undefined)
140
+ return resolve();
141
+ let chart = flowCharts.get(scope);
142
+ if (chart === undefined) {
143
+ chart = resolve();
144
+ flowCharts.set(scope, chart);
145
+ }
146
+ return chart;
147
+ }
148
+ /** The crypto options venues of the venue table (its `plain` rows' exchanges, in its order): config, never a venue of
149
+ * this lane's own. Read lazily: the table rides the chain resolver's lazy graph. */
150
+ async function cryptoVenuesOfTable() {
151
+ const { OPTION_VENUES } = await import('../../../../constants/option-venues.constants.js');
152
+ return OPTION_VENUES.filter((venue) => venue.lane === 'plain').flatMap((venue) => {
153
+ const gatedName = wrunOptionsChainGatedVenueName(venue.id);
154
+ return venue.exchanges.map((exchange) => (gatedName === undefined ? { exchange } : { exchange, gatedName }));
155
+ });
156
+ }
157
+ /** The exchanges of the crypto venues open to the chart: every one with the crypto-options gate on (a signed-in
158
+ * session), only those the gate never darkens (Deribit) with it off (a guest), as every other chain class reads it. */
159
+ function openCryptoVenueExchanges(venues, gateOn) {
160
+ return venues.filter((venue) => gateOn || venue.gatedName === undefined).map((venue) => venue.exchange);
161
+ }
162
+ /** Refuse an input whose scope the chart's options plane does not serve, with the planner's unserved-scope seed (a
163
+ * declared fill drops it with the market's note, `wrunLaneUnservedScopeRefusal`). The planner module is read lazily:
164
+ * it loads the registry, which loads this file. */
165
+ async function refuseUnservedScope(ctx, words) {
166
+ const { wrunLaneUnservedScopeSeed } = await import('../wrun-poll-lanes.util.js');
167
+ return refuseWrunPollInput(ctx, words, wrunLaneUnservedScopeSeed(WRUN_OPTIONS_FLOW_LANE_KEY));
168
+ }
169
+ /** Refuse a venue word no plane's table holds: the data plane names a venue by the table's id, never a guess. */
170
+ function refuseUnmappedVenue(ctx, venue) {
171
+ return refuseWrunPollInput(ctx, `declares venue '${venue}': the data plane names a venue by its publisher id or its exchange, and this version of ` +
172
+ `the app holds none for ${venue} (options-flow-venue-unmapped:${venue})`, wrunProtocolPendingSeed(WRUN_OPTIONS_FLOW_LANE_KEY));
173
+ }
174
+ /**
175
+ * What one input reads on the chain its run decided (the acquisition's fields beside `scope`, `dte` and `moneyness`),
176
+ * the scope table per plane (R7c C7-2): always the chain's exchange (`flowExchange`, the lane's chain mark); a read of
177
+ * one underlying its coin; a crypto ticker its ONE book (`flowBook`), a CME ticker off a continuous alias the alias
178
+ * (`flowContinuous`); a crypto scope across venues its venues (`flowVenues`), the ones the crypto-options gate leaves
179
+ * open to the chart (`gateOn`, the run's resolved chart's: every crypto venue for a signed-in session, Deribit alone for
180
+ * a guest, as every other chain class reads them), a gated `venue` word refused as the chain decision refuses one
181
+ * (`flag-off`); an OPRA venue its publisher id. A scope the plane does not serve refuses with the unserved-scope seed.
182
+ */
183
+ async function flowReadOf(scope, venue, chain, gateOn, ctx) {
184
+ const exchange = { [WRUN_OPTIONS_FLOW_EXCHANGE_FIELD]: chain.exchange };
185
+ const coin = chain.underlying.toUpperCase();
186
+ const lists = `this chart's options list on ${chain.exchange}`;
187
+ if (scope === 'ticker') {
188
+ if (chain.plane === 'plain')
189
+ return { coin, ...exchange, [WRUN_OPTIONS_FLOW_BOOK_FIELD]: chain.book.toUpperCase() };
190
+ const continuous = chain.continuous !== undefined ? { [WRUN_OPTIONS_FLOW_CONTINUOUS_FIELD]: chain.continuous } : {};
191
+ return { coin, ...exchange, ...continuous };
192
+ }
193
+ if (chain.plane !== 'opra' && WRUN_OPTIONS_FLOW_OPRA_SCOPES.includes(scope)) {
194
+ return refuseUnservedScope(ctx, `reads scope "${scope}", which only US listed options serve: ${lists}`);
195
+ }
196
+ if (scope !== 'venue') {
197
+ if (chain.plane !== 'plain')
198
+ return exchange;
199
+ const open = openCryptoVenueExchanges(await cryptoVenuesOfTable(), gateOn);
200
+ return { coin, ...exchange, [WRUN_OPTIONS_FLOW_VENUES_FIELD]: open };
201
+ }
202
+ const word = venue;
203
+ if (chain.plane === 'cme') {
204
+ return refuseUnservedScope(ctx, `reads scope "venue": ${lists}, which lists every option of the chain on that one venue (no venue to split by)`);
205
+ }
206
+ const publisherId = wrunOptionsFlowVenuePublisherId(word);
207
+ if (chain.plane === 'opra' && publisherId !== undefined)
208
+ return { venueId: publisherId, ...exchange };
209
+ const cryptoVenues = await cryptoVenuesOfTable();
210
+ const listed = cryptoVenues.find((candidate) => candidate.exchange === word);
211
+ if (chain.plane === 'opra') {
212
+ if (listed !== undefined) {
213
+ return refuseUnservedScope(ctx, `declares venue '${word}', a crypto options venue: ${lists}, whose venues are US exchanges (an ISO MIC)`);
214
+ }
215
+ return refuseUnmappedVenue(ctx, word);
216
+ }
217
+ const open = openCryptoVenueExchanges(cryptoVenues, gateOn);
218
+ if (listed !== undefined) {
219
+ if (listed.gatedName !== undefined && !gateOn) {
220
+ throw wrunLaneChainRefusalError(wrunOptionsChainFlagOffRefusal({
221
+ who: `Input '${ctx.inputName}' reads ${ctx.sourceClass} cells`,
222
+ venue: word,
223
+ name: listed.gatedName,
224
+ coin: chain.coin.toUpperCase(),
225
+ wayOut: `declare venue ${open.map((name) => `"${name}"`).join(' or ')} (the crypto options venues open to this chart), or scope "market"`,
226
+ }), ctx.sourceClass);
227
+ }
228
+ return { coin, ...exchange, [WRUN_OPTIONS_FLOW_VENUES_FIELD]: [word] };
229
+ }
230
+ if (publisherId !== undefined) {
231
+ return refuseUnservedScope(ctx, `declares venue '${word}', a US options exchange: ${lists}, whose venues are the crypto options venues ` +
232
+ `(${open.join(', ')})`);
233
+ }
234
+ return refuseUnmappedVenue(ctx, word);
235
+ }
236
+ /**
237
+ * One input against the chart: its knobs (the plane-free rules first, `book` beside scope `ticker` only), a ticker read
238
+ * on a chart that names no underlying refused by name, the protocol gate, then the chain (the run's one resolution of
239
+ * the chart, `flowChartOf`: on the OPRA plane its own by coin) decided by the one chain resolver (`auto`, the input's
240
+ * `book` on a ticker read; its refusals are the options chain's own), and the read the scope names on that chain's
241
+ * plane (`flowReadOf`); the answer is the acquisition's knobs.
242
+ */
85
243
  async function planWrunOptionsFlow(source, ctx) {
86
244
  const scope = knobWord(source, ctx, 'scope', WRUN_OPTIONS_FLOW_SCOPES);
87
245
  const dte = knobWord(source, ctx, 'dte', WRUN_OPTIONS_FLOW_DTE);
88
246
  const moneyness = knobWord(source, ctx, 'moneyness', WRUN_OPTIONS_FLOW_MONEYNESS);
89
- let extras;
247
+ let venue;
90
248
  if (scope === 'venue') {
91
- const venue = source.venue;
92
- if (venue === undefined) {
93
- return refuseWrunPollInput(ctx, 'declares scope "venue" with no venue: name the exchange whose prints it reads (options-flow-venue-required)', WRUN_POLL_AUTHOR_GATE_SEED);
94
- }
95
- if (typeof venue !== 'string' || !WRUN_OPTIONS_FLOW_VENUE_RE.test(venue)) {
96
- return refuseWrunPollInput(ctx, `declares venue '${String(venue)}': a venue is an exchange id, 2 to 16 upper-case letters, digits or underscores`, WRUN_POLL_AUTHOR_GATE_SEED);
97
- }
98
- const field = String(source.field ?? '');
99
- const served = WRUN_OPTIONS_FLOW_VENUE_FIELDS;
100
- const split = !served.includes(field)
101
- ? `field '${field}'`
102
- : dte !== 'all'
103
- ? `dte "${dte}"`
104
- : moneyness !== 'all'
105
- ? `moneyness "${moneyness}"`
106
- : undefined;
107
- if (split !== undefined) {
108
- return refuseWrunPollInput(ctx, `reads ${split} under scope "venue": the venue rows serve ${served.join(', ')}, with no side, DTE or ` +
109
- 'moneyness split (options-flow-venue-field)', WRUN_POLL_AUTHOR_GATE_SEED);
110
- }
111
- const venueId = wrunOptionsFlowVenuePublisherId(venue);
112
- if (venueId === undefined) {
113
- return refuseWrunPollInput(ctx, `declares venue '${venue}': the data plane names a venue by its publisher id, and this version of the app ` +
114
- `holds none for ${venue} (options-flow-venue-unmapped:${venue})`, wrunProtocolPendingSeed(WRUN_OPTIONS_FLOW_LANE_KEY));
115
- }
116
- extras = { scope, venueId, dte, moneyness };
249
+ venue = venueScopeWord(source, ctx, dte, moneyness);
117
250
  }
118
- else {
119
- if (source.venue !== undefined) {
120
- return refuseWrunPollInput(ctx, `declares venue '${String(source.venue)}' beside scope "${scope}": a venue names the exchange of scope ` +
121
- '"venue" only (options-flow-venue-scope)', WRUN_POLL_AUTHOR_GATE_SEED);
122
- }
123
- if (scope === 'ticker') {
124
- const coin = ctx.coin.trim().toUpperCase();
125
- if (coin === '') {
126
- return refuseWrunPollInput(ctx, "reads the options flow of the chart's underlying, and this chart names none", {
127
- cls: 'feed-missing',
128
- variant: 'market-paused',
129
- params: { feed: WRUN_OPTIONS_FLOW_LANE_KEY },
130
- });
131
- }
132
- extras = { scope, coin, dte, moneyness };
133
- }
134
- else {
135
- extras = { scope, dte, moneyness };
136
- }
251
+ else if (source.venue !== undefined) {
252
+ return refuseWrunPollInput(ctx, `declares venue '${String(source.venue)}' beside scope "${scope}": a venue names the exchange of scope ` +
253
+ '"venue" only (options-flow-venue-scope)', WRUN_POLL_AUTHOR_GATE_SEED);
254
+ }
255
+ if (scope !== 'ticker' && source.book !== undefined) {
256
+ return refuseWrunPollInput(ctx, `declares book '${String(source.book)}' beside scope "${scope}": a book names the one series of scope ` +
257
+ '"ticker" only, every other scope reads every book (options-flow-book-scope)', WRUN_POLL_AUTHOR_GATE_SEED);
258
+ }
259
+ if (scope === 'ticker' && ctx.coin.trim() === '') {
260
+ return refuseWrunPollInput(ctx, "reads the options flow of the chart's underlying, and this chart names none", {
261
+ cls: 'feed-missing',
262
+ variant: 'market-paused',
263
+ params: { feed: WRUN_OPTIONS_FLOW_LANE_KEY },
264
+ });
137
265
  }
138
266
  await assertWrunProtocolType(ctx, WRUN_OPTIONS_FLOW_TYPE, WRUN_OPTIONS_FLOW_LANE_KEY);
139
- return extras;
267
+ const chart = await flowChartOf(ctx);
268
+ const chain = await decideWrunLaneChain(chart, { book: scope === 'ticker' ? source.book : undefined }, ctx);
269
+ return { scope, ...(await flowReadOf(scope, venue, chain, chart.cryptoVenues.enabled, ctx)), dte, moneyness };
270
+ }
271
+ /** Whether an acquisition no longer names the chain the lane would plan now (D12): a CME ticker read off a continuous
272
+ * alias whose lead future rolled since the run planned it (`wrunLaneChainLeadMoved`). A live session holding it
273
+ * rebuilds, so no ask, cache or buffer joins the old future's flow to the new one's. */
274
+ export function wrunOptionsFlowAcquisitionMoved(acquisition) {
275
+ return wrunLaneChainLeadMoved(acquisition[WRUN_OPTIONS_FLOW_EXCHANGE_FIELD], acquisition[WRUN_OPTIONS_FLOW_CONTINUOUS_FIELD], acquisition.coin);
140
276
  }
141
277
  export const lane = {
142
278
  sourceClass: 'options_flow',
@@ -148,7 +284,8 @@ export const lane = {
148
284
  label: 'Options flow',
149
285
  nativeRows: true,
150
286
  barGrid: { landing: 'flow', tiers: WRUN_OPTIONS_FLOW_TIERS },
151
- opra: true,
287
+ chain: { exchangeField: WRUN_OPTIONS_FLOW_EXCHANGE_FIELD },
288
+ acquisitionMoved: wrunOptionsFlowAcquisitionMoved,
152
289
  refusedAnswers: {
153
290
  [WRUN_OPTION_SCOPE_READS_OFF_CODE]: { cls: 'service-no-answer', variant: 'switched-off' },
154
291
  },
@@ -32,12 +32,11 @@
32
32
  * Units are the gateway's: USD for the valuations, volume and price, coins for the supplies,
33
33
  * percent for the dominance, a plain rank; documented, never converted.
34
34
  *
35
- * The kit table is read through the kit seam (`wrun-kit.ts`), imported lazily inside `plan`:
36
- * the bundle is heavy and this file sits on the row builder's import graph, and by the time a
37
- * run plans its lanes the host's compile step has loaded the kit already, so the import
38
- * resolves at once (the `assertWrunBrowserSources` pattern).
35
+ * The kit table is its import-free copy (`WRUN_KIT_TOKEN_NAMES`, wrun-kit-run-tables.util, pinned
36
+ * to the kit's export by its kit-mirror spec): a plan never loads the 3.6 MB kit bundle on the
37
+ * main thread to read 62 names (OPTLOAD g1 round 3).
39
38
  */
40
- import { wrunChartHostEnv } from '../../../../host-env.js';
39
+ import { WRUN_KIT_TOKEN_NAMES } from '../../wrun-kit-run-tables.util.js';
41
40
  import { refuseWrunPollInput, } from '../wrun-poll-lane.types.js';
42
41
  export const WRUN_TOKEN_SUPPLY_SOURCE_CLASS = 'token_supply';
43
42
  /** The fields in the kit's declaration order, each at its lane row column (column 0 is the
@@ -64,12 +63,6 @@ export const WRUN_TOKEN_SUPPLY_LOOKBACK_DAYS = 90;
64
63
  * fill in for any it does not. */
65
64
  const EXAMPLE_TOKEN_NAMES = ['Bitcoin', 'Ethereum', 'Solana'];
66
65
  const EXAMPLE_COUNT = 3;
67
- function isWrunTokenNamesTable(value) {
68
- if (value === null || typeof value !== 'object')
69
- return false;
70
- const entries = Object.entries(value);
71
- return entries.length > 0 && entries.every(([coin, name]) => coin !== '' && typeof name === 'string' && name !== '');
72
- }
73
66
  /** A few display names of the table, for a refusal: the well-known ones it lists first. */
74
67
  export function wrunTokenSupplyExampleNames(table) {
75
68
  const names = Object.values(table);
@@ -107,29 +100,10 @@ export function wrunTokenSupplyCoinOf(source, ctx, table) {
107
100
  const count = Object.keys(table).length;
108
101
  return refuseWrunPollInput(ctx, `declares token '${token}': the chart serves the ${count} tokens its table lists, by display name (${examples})`);
109
102
  }
110
- let tokenNamesLoad;
111
- /** The kit's table, loaded once through the kit seam; undefined when the vendored kit exports
112
- * none (a re-vendor that dropped it). A failed load is retried on the next plan. */
113
- function loadWrunTokenNames() {
114
- tokenNamesLoad ??= wrunChartHostEnv()
115
- .transport.loadWrunKit()
116
- .then(({ wrunIndicatorKit }) => {
117
- const table = wrunIndicatorKit.WRUN_TOKEN_NAMES;
118
- return isWrunTokenNamesTable(table) ? table : undefined;
119
- }, (error) => {
120
- tokenNamesLoad = undefined;
121
- throw error;
122
- });
123
- return tokenNamesLoad;
124
- }
125
103
  /** One input against the kit's table, before any fetch: the control's ask `{ coin, tokenName }`
126
104
  * or a refusal by name. */
127
105
  async function planWrunTokenSupply(source, ctx) {
128
- const table = await loadWrunTokenNames();
129
- if (table === undefined) {
130
- return refuseWrunPollInput(ctx, 'cannot be planned: the vendored indicator kit exports no WRUN_TOKEN_NAMES table');
131
- }
132
- return wrunTokenSupplyCoinOf({ token: source.token }, ctx, table);
106
+ return wrunTokenSupplyCoinOf({ token: source.token }, ctx, WRUN_KIT_TOKEN_NAMES);
133
107
  }
134
108
  export const lane = {
135
109
  sourceClass: WRUN_TOKEN_SUPPLY_SOURCE_CLASS,
@@ -42,24 +42,6 @@ export interface WrunChainChartMetadata {
42
42
  export declare function resolveWrunChartChain(metadata: WrunChainChartMetadata | undefined): Promise<WrunLaneChartChain>;
43
43
  /** Resolve the chart's chain for a lane: `resolveWrunChartChain` over the lane context's market and category. */
44
44
  export declare function resolveWrunLaneChartChain(ctx: Pick<WrunPollLaneContext, 'exchange' | 'symbol' | 'coin' | 'category'>): Promise<WrunLaneChartChain>;
45
- /**
46
- * The OPRA chain an OPRA-only lane reads on this chart (`option_contract_state`: admitted only where the chart's
47
- * options ride the OPRA plane): its exchange and underlying, or a refusal by name with the options chain's own seeds
48
- * (the directory did not answer: a service that did not answer; no chain: no options here). A wrapper over the chart's
49
- * chain resolution, its words unchanged, for the OPRA-only lanes that still import it.
50
- */
51
- export declare function resolveWrunLaneOpraChain(ctx: LaneCtx): Promise<{
52
- exchange: string;
53
- underlying: string;
54
- }>;
55
- /**
56
- * The underlying the OPRA plane keys an OPRA-only lane's series by (`option_prints`, `option_contract_flow`: a US
57
- * stock or ETF chart's ticker, an OPRA contract chart's underlying, upper case), or a refusal by name before any
58
- * fetch: any failure of the chart's chain resolution is the US directory that did not answer (`service-no-answer` /
59
- * `opra-directory`, Retry), and a chart OPRA lists no options for is `no-options` / `chain`. A wrapper over the
60
- * chart's chain resolution, its words unchanged (wrun-opra-underlying.util re-exports it for its importers).
61
- */
62
- export declare function resolveWrunOpraLaneUnderlying(ctx: LaneCtx): Promise<string>;
63
45
  /** The crypto venue words a chain decision reads on this chart: on the OPRA plane no crypto venue lists a US
64
46
  * stock's options (the words refuse by the flag alone, no listing asked); anywhere else the run's own resolver
65
47
  * over every crypto word (the listing is asked once per coin, and only with the crypto-options gate on). */
@@ -136,6 +118,9 @@ export interface WrunLaneChainChart {
136
118
  * run whose directory read answers.
137
119
  */
138
120
  export declare function resolveWrunLaneChainAutoBook(chain: WrunLaneChainOfBook): Promise<string>;
121
+ /** The code of an options row lane that holds no resolved chart market for its chain (its identity step's
122
+ * `resolveWrunLaneChainChart` left none): the lane refuses with it, its words say Run again. */
123
+ export declare const WRUN_OPTION_CHART_UNRESOLVED_CODE = "wrun_option_chart_unresolved";
139
124
  /**
140
125
  * Resolve the chart for the one chain resolver (lazy imports: the chain directory, the venue listing and table, the
141
126
  * continuous lead resolver): the chart's chain (`resolveWrunLaneChartChain`, the options chain lane's own, or the
@@ -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[];