@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
@@ -15,6 +15,10 @@
15
15
  * exchange and underlying; the K_OPTION_STRIKES control and its worker twin). A bar holding no minute (outside the
16
16
  * session, a minute the backend missed, history past its about seven days) is an EMPTY block; an empty answer is
17
17
  * quiet (om's `absence: "empty"`).
18
+ * - History: the asks reach back as far as the strike history does (`horizon`, `WRUN_OPTION_STRIKES_HISTORY_MS`),
19
+ * never across the whole window the run computes over: a warm-up page bought ahead of the viewport (one 500-bar
20
+ * page is about 105 days at 1h) or a pan back asks nothing the backend no longer holds. A bar past the reach reads
21
+ * its EMPTY block unasked, the same block an ask over it answered.
18
22
  * - A CHAIN lane (`chain`): the chain is the one chain resolver's (opra-option-lanes.util `decideWrunLaneChain`), per
19
23
  * input, and its plane is per instance: OPRA's rules on a US stock or OPRA contract chart (unchanged: the wall, native
20
24
  * rows, the provenance stamp, the routed tier), CME's on a CME futures chart (a continuous chart reads its lead
@@ -33,7 +37,7 @@
33
37
  * LIGHT at module load: the chain resolver's directory, listing and lead reads run inside `identity` and `facets`.
34
38
  */
35
39
  import { type WrunLaneChain } from '../opra-option-lanes.util.js';
36
- import type { WrunRowLaneDescriptor } from '../wrun-row-lane.types.js';
40
+ import type { WrunRowLaneDescriptor, WrunRowLaneHorizon } from '../wrun-row-lane.types.js';
37
41
  /** f64s per tuple (om's `WRUN_OPTION_STRIKES_TUPLE_WIDTH`). */
38
42
  export declare const WRUN_OPTION_STRIKES_WIDTH = 12;
39
43
  /** The columns a tuple must hold a finite number in: the strike and the expiry. */
@@ -42,6 +46,16 @@ export declare const WRUN_OPTION_STRIKES_FINITE_COLUMNS: readonly number[];
42
46
  export declare const WRUN_OPTIONS_CHAIN_MARKET_PINNED_CODE = "wrun_options_chain_market_pinned";
43
47
  /** The payload field an instance names its chain's exchange in (its plane follows it). */
44
48
  export declare const WRUN_OPTION_STRIKES_EXCHANGE_FIELD = "strikeExchange";
49
+ /**
50
+ * How far back the strike history reaches, on every plane: OPTION_STRIKE_AGG's minute table drops its day chunks
51
+ * after 7 days (`drop_after`) in a drop window that ends at 10 (`drop_before`), the same on every cluster (tsdb-gateway
52
+ * `charts/tsdb-gateway/schema/schema.{ore,cme,blk}.generated.yaml`, `option_strike_agg_1m`). The far edge of the drop
53
+ * window, so the asks reach every chunk the drop job may not have dropped yet.
54
+ */
55
+ export declare const WRUN_OPTION_STRIKES_HISTORY_MS: number;
56
+ /** The lane's `horizon` (`WrunRowLaneHorizon`): its rows start where the strike history does at the clock. A bar that
57
+ * ends before then asks nothing and reads its EMPTY block (no `present` mask to mark it). */
58
+ export declare function wrunOptionStrikesHorizon(_acquisition: Readonly<Record<string, unknown>>, nowMs: number): WrunRowLaneHorizon | undefined;
45
59
  /** Test seam: forget every resolved chart. */
46
60
  export declare function __resetWrunStrikesChartsForTests(): void;
47
61
  /** The tuples an input keeps under its `expiries` word: every one, or ("nearest:N") the tuples of the N earliest
@@ -15,6 +15,10 @@
15
15
  * exchange and underlying; the K_OPTION_STRIKES control and its worker twin). A bar holding no minute (outside the
16
16
  * session, a minute the backend missed, history past its about seven days) is an EMPTY block; an empty answer is
17
17
  * quiet (om's `absence: "empty"`).
18
+ * - History: the asks reach back as far as the strike history does (`horizon`, `WRUN_OPTION_STRIKES_HISTORY_MS`),
19
+ * never across the whole window the run computes over: a warm-up page bought ahead of the viewport (one 500-bar
20
+ * page is about 105 days at 1h) or a pan back asks nothing the backend no longer holds. A bar past the reach reads
21
+ * its EMPTY block unasked, the same block an ask over it answered.
18
22
  * - A CHAIN lane (`chain`): the chain is the one chain resolver's (opra-option-lanes.util `decideWrunLaneChain`), per
19
23
  * input, and its plane is per instance: OPRA's rules on a US stock or OPRA contract chart (unchanged: the wall, native
20
24
  * rows, the provenance stamp, the routed tier), CME's on a CME futures chart (a continuous chart reads its lead
@@ -32,10 +36,10 @@
32
36
  *
33
37
  * LIGHT at module load: the chain resolver's directory, listing and lead reads run inside `identity` and `facets`.
34
38
  */
35
- import { decideWrunLaneChain, decideWrunLaneChainIdentity, refuseWrunLaneStrayKnob, resolveWrunLaneChainChart, wrunLaneChainLeadMoved, wrunLaneChainRefusalError, wrunLaneChartKey, } from '../opra-option-lanes.util.js';
39
+ import { decideWrunLaneChain, decideWrunLaneChainIdentity, refuseWrunLaneStrayKnob, resolveWrunLaneChainChart, WRUN_OPTION_CHART_UNRESOLVED_CODE, wrunLaneChainLeadMoved, wrunLaneChainRefusalError, wrunLaneChartKey, } from '../opra-option-lanes.util.js';
36
40
  import { refuseWrunPollInput } from '../wrun-poll-lane.types.js';
37
41
  import { WRUN_OPTIONS_CHAIN_EXPIRIES_CODE, wrunOptionsChainExpiries, wrunOptionsChainIdentityKey, } from '../../wrun-options-chain.util.js';
38
- import { attachWrunRefusal } from '../../wrun-refusal.util.js';
42
+ import { attachWrunRefusal, wrunAuthorRuleSeed } from '../../wrun-refusal.util.js';
39
43
  /** f64s per tuple (om's `WRUN_OPTION_STRIKES_TUPLE_WIDTH`). */
40
44
  export const WRUN_OPTION_STRIKES_WIDTH = 12;
41
45
  /** The columns a tuple must hold a finite number in: the strike and the expiry. */
@@ -44,6 +48,19 @@ export const WRUN_OPTION_STRIKES_FINITE_COLUMNS = Object.freeze([0, 1]);
44
48
  export const WRUN_OPTIONS_CHAIN_MARKET_PINNED_CODE = 'wrun_options_chain_market_pinned';
45
49
  /** The payload field an instance names its chain's exchange in (its plane follows it). */
46
50
  export const WRUN_OPTION_STRIKES_EXCHANGE_FIELD = 'strikeExchange';
51
+ const DAY_MS = 86_400_000;
52
+ /**
53
+ * How far back the strike history reaches, on every plane: OPTION_STRIKE_AGG's minute table drops its day chunks
54
+ * after 7 days (`drop_after`) in a drop window that ends at 10 (`drop_before`), the same on every cluster (tsdb-gateway
55
+ * `charts/tsdb-gateway/schema/schema.{ore,cme,blk}.generated.yaml`, `option_strike_agg_1m`). The far edge of the drop
56
+ * window, so the asks reach every chunk the drop job may not have dropped yet.
57
+ */
58
+ export const WRUN_OPTION_STRIKES_HISTORY_MS = 10 * DAY_MS;
59
+ /** The lane's `horizon` (`WrunRowLaneHorizon`): its rows start where the strike history does at the clock. A bar that
60
+ * ends before then asks nothing and reads its EMPTY block (no `present` mask to mark it). */
61
+ export function wrunOptionStrikesHorizon(_acquisition, nowMs) {
62
+ return Number.isFinite(nowMs) ? { servedFromMs: nowMs - WRUN_OPTION_STRIKES_HISTORY_MS } : undefined;
63
+ }
47
64
  /** What `identity` resolved for a chart (the one chain resolver's chart), read back by `facets`. Keyed by the chart
48
65
  * market; the newest entries kept. */
49
66
  const STRIKES_CHARTS_KEPT = 16;
@@ -103,6 +120,7 @@ export const rowLane = {
103
120
  acquisitions: 'one',
104
121
  emptyAnswer: 'quiet',
105
122
  landing: { kind: 'snapshot' },
123
+ horizon: wrunOptionStrikesHorizon,
106
124
  acquisitionMoved: wrunOptionStrikesAcquisitionMoved,
107
125
  identity: async (ctx) => {
108
126
  rememberStrikesChart(wrunLaneChartKey(ctx), await resolveWrunLaneChainChart(ctx));
@@ -113,14 +131,11 @@ export const rowLane = {
113
131
  refuseWrunLaneStrayKnob(ctx, knob, "'tape' celled");
114
132
  }
115
133
  if (source.symbol !== undefined || source.exchange !== undefined) {
116
- refuseWrunPollInput(ctx, `pins option_strikes cells to a fixed market (${WRUN_OPTIONS_CHAIN_MARKET_PINNED_CODE}); option_strikes reads the chain of the chart's own underlying (pick the chain family with venue), so drop the symbol and exchange pin`, { cls: 'run-failed', variant: 'generic' });
134
+ refuseWrunPollInput(ctx, `pins option_strikes cells to a fixed market (${WRUN_OPTIONS_CHAIN_MARKET_PINNED_CODE}); option_strikes reads the chain of the chart's own underlying (pick the chain family with venue), so drop the symbol and exchange pin`, wrunAuthorRuleSeed(WRUN_OPTIONS_CHAIN_MARKET_PINNED_CODE));
117
135
  }
118
136
  const chart = strikesCharts.get(wrunLaneChartKey(ctx));
119
137
  if (chart === undefined) {
120
- return refuseWrunPollInput(ctx, 'could not resolve the chart market for its options chain: Run again', {
121
- cls: 'run-failed',
122
- variant: 'generic',
123
- });
138
+ return refuseWrunPollInput(ctx, 'could not resolve the chart market for its options chain: Run again', wrunAuthorRuleSeed(WRUN_OPTION_CHART_UNRESOLVED_CODE));
124
139
  }
125
140
  // om's order: the venue word, then the expiries word, then the chain the word resolves.
126
141
  const decision = decideWrunLaneChainIdentity(chart, source.venue, ctx);
@@ -130,7 +145,7 @@ export const rowLane = {
130
145
  const expiries = source.expiries;
131
146
  const expiriesRead = expiries === undefined || (typeof expiries === 'string' && wrunOptionsChainExpiries(expiries) !== undefined);
132
147
  if (!expiriesRead) {
133
- throw attachWrunRefusal(new Error(`Input '${ctx.inputName}' reads option_strikes cells with expiries '${String(expiries)}' (${WRUN_OPTIONS_CHAIN_EXPIRIES_CODE}): declare "all" or "nearest:N" (the N nearest live expiries, 1..999)`), { cls: 'run-failed', variant: 'generic' });
148
+ throw attachWrunRefusal(new Error(`Input '${ctx.inputName}' reads option_strikes cells with expiries '${String(expiries)}' (${WRUN_OPTIONS_CHAIN_EXPIRIES_CODE}): declare "all" or "nearest:N" (the N nearest live expiries, 1..999)`), wrunAuthorRuleSeed(WRUN_OPTIONS_CHAIN_EXPIRIES_CODE));
134
149
  }
135
150
  if (!decision.ok)
136
151
  throw wrunLaneChainRefusalError(decision, 'option_strikes');
@@ -30,9 +30,10 @@
30
30
  *
31
31
  * LIGHT at module load: pb-common and the chain resolver are imported inside `identity`.
32
32
  */
33
- import { decideWrunLaneChain, refuseWrunLaneStrayKnob, resolveWrunLaneChainChart, wrunLaneChainLeadMoved, wrunLaneChainPlaneOf, wrunLaneChartKey, } from '../opra-option-lanes.util.js';
33
+ import { decideWrunLaneChain, refuseWrunLaneStrayKnob, resolveWrunLaneChainChart, WRUN_OPTION_CHART_UNRESOLVED_CODE, wrunLaneChainLeadMoved, wrunLaneChainPlaneOf, wrunLaneChartKey, } from '../opra-option-lanes.util.js';
34
34
  import { refuseWrunPollInput } from '../wrun-poll-lane.types.js';
35
35
  import { assertWrunProtocolType } from '../../wrun-protocol-pending.util.js';
36
+ import { wrunAuthorRuleSeed } from '../../wrun-refusal.util.js';
36
37
  const MINUTE_MS = 60_000;
37
38
  const DAY_MS = 86_400_000;
38
39
  /** f64s per tuple (the source contract's width, the `present` mask included). */
@@ -46,17 +47,19 @@ export const WRUN_OPTION_SURFACE_TIERS = Object.freeze([
46
47
  ]);
47
48
  /** The payload field an instance names its chain's exchange in (its plane follows it). */
48
49
  export const WRUN_OPTION_SURFACE_EXCHANGE_FIELD = 'surfaceExchange';
49
- /** The knobs of the other options classes, each refused here by name. */
50
+ /** The knobs of the other options classes, each refused here by name (the print classes' knobs are option_prints_v2's
51
+ * too, and `structure` its own, since kit 0.88.0). */
50
52
  const STRAY_KNOBS = [
51
53
  [
52
54
  'expiries',
53
- "'options_chain', 'option_strikes', 'option_prints', 'option_contract_flow' and 'option_contract_state'",
55
+ "'options_chain', 'option_strikes', 'option_prints', 'option_prints_v2', 'option_contract_flow' and 'option_contract_state'",
54
56
  ],
55
57
  ['strike_window_pct', "'option_contract_flow' and 'option_contract_state'"],
56
- ['history', "'tape' and 'option_prints' celled"],
58
+ ['history', "'tape', 'option_prints' and 'option_prints_v2' celled"],
57
59
  ['min_size', "'tape' celled"],
58
- ['min_premium', "'option_prints' celled"],
59
- ['overflow', "'option_prints' celled"],
60
+ ['min_premium', "'option_prints' and 'option_prints_v2' celled"],
61
+ ['overflow', "'option_prints' and 'option_prints_v2' celled"],
62
+ ['structure', "'option_prints_v2' celled"],
60
63
  ['min_volume', "'option_contract_flow' celled"],
61
64
  ];
62
65
  /** What `identity` resolved for a chart, read back by `facets` (synchronous). Keyed by the chart market; the newest
@@ -130,14 +133,11 @@ export const rowLane = {
130
133
  refuseWrunLaneStrayKnob(ctx, knob, owners);
131
134
  }
132
135
  if (source.symbol !== undefined || source.exchange !== undefined) {
133
- refuseWrunPollInput(ctx, "pins option_surface cells to a fixed market (wrun_option_market_pinned); it reads the chart's own underlying, so drop the symbol and exchange pin", { cls: 'run-failed', variant: 'generic' });
136
+ refuseWrunPollInput(ctx, "pins option_surface cells to a fixed market (wrun_option_market_pinned); it reads the chart's own underlying, so drop the symbol and exchange pin", wrunAuthorRuleSeed('wrun_option_market_pinned'));
134
137
  }
135
138
  const chart = surfaceCharts.get(wrunLaneChartKey(ctx));
136
139
  if (chart === undefined) {
137
- return refuseWrunPollInput(ctx, 'could not resolve the chart market for its options chain: Run again', {
138
- cls: 'run-failed',
139
- variant: 'generic',
140
- });
140
+ return refuseWrunPollInput(ctx, 'could not resolve the chart market for its options chain: Run again', wrunAuthorRuleSeed(WRUN_OPTION_CHART_UNRESOLVED_CODE));
141
141
  }
142
142
  return wrunOptionSurfaceExtras(await decideWrunLaneChain(chart, { venue: source.venue, book: source.book }, ctx));
143
143
  },
@@ -42,7 +42,7 @@ import type { WrunInputSource } from '../../../interfaces/wrun-runtime.interface
42
42
  import type { WrunDailyLanding } from '../wrun-daily-lane.util.js';
43
43
  import { type WrunRefusalSeed } from '../wrun-refusal.util.js';
44
44
  import type { WrunBackendTier, WrunTierLanding } from '../wrun-tier-grid.util.js';
45
- import type { WrunRowLaneChain } from './wrun-row-lane.types.js';
45
+ import type { WrunRowLaneChain, WrunRowLaneHorizon } from './wrun-row-lane.types.js';
46
46
  /** An input's declaration as a lane reads it: the typed fields, and any knob the sheet carries
47
47
  * that the interface does not name yet (`asset`, `publisher`, `series`, ...), as `unknown`. */
48
48
  export type WrunPollLaneSource = WrunInputSource & Readonly<Record<string, unknown>>;
@@ -207,6 +207,15 @@ export interface WrunPollLane {
207
207
  nativeRows?: true;
208
208
  /** The host-grid landing of a per-bar `nativeRows` lane (required there, refused on any other lane). */
209
209
  barGrid?: WrunPollLaneBarGrid;
210
+ /**
211
+ * The backend's span for one acquisition at the clock (`WrunRowLaneHorizon`, the row lanes' word), for a `barGrid`
212
+ * lane whose history no tier can name (a ten-minute row lands on any bar, so no tier width divides every bar it
213
+ * serves): the asks start at the first bar that ends after `servedFromMs` (an ask wholly before it is dropped), so a
214
+ * run over a longer window (a warm-up page, a pan back) never asks what its source no longer holds, and the bars
215
+ * before it read the input's `missing` policy. Called with the instance's payload and the window's clock. Absent:
216
+ * the tier rule alone.
217
+ */
218
+ horizon?: (extras: Readonly<Record<string, unknown>>, nowMs: number) => WrunRowLaneHorizon | undefined;
210
219
  /**
211
220
  * The lane reads US options data (the OPRA plane): an input of it is refused by name before its `plan`
212
221
  * runs for a run that may not read OPRA (`opra-official-only:<class>`, wrun-opra-lane.util), its asks name
@@ -304,6 +313,9 @@ export declare function refuseWrunPollInput(ctx: Pick<WrunPollLaneContext, 'inpu
304
313
  * coin is another. A chart that names no coin has no such feed at all (the market words), so a
305
314
  * sentence never ends on an empty coin. */
306
315
  export declare function wrunPollCoinGateSeed(feed: string, coins: readonly string[], chartCoin: string): WrunRefusalSeed;
316
+ /** The code of a declared knob a lane refuses (a knob word, a fund the coin does not list, a knob the class does not
317
+ * take): the author's to fix in the code. */
318
+ export declare const WRUN_LANE_KNOB_INVALID_CODE = "wrun_lane_knob_invalid";
307
319
  /** The seed of a gate the author fixes in the code (a knob word, a fund the coin does not list): a
308
- * failed run, its text in the details. */
320
+ * failed run, its text in the details, `WRUN_LANE_KNOB_INVALID_CODE` its code. */
309
321
  export declare const WRUN_POLL_AUTHOR_GATE_SEED: WrunRefusalSeed;
@@ -1,4 +1,4 @@
1
- import { attachWrunRefusal } from '../wrun-refusal.util.js';
1
+ import { attachWrunRefusal, wrunAuthorRuleSeed } from '../wrun-refusal.util.js';
2
2
  export const WRUN_POLL_LANE_ID_PREFIX = 'poll:';
3
3
  export function isWrunPollLaneId(value) {
4
4
  return typeof value === 'string' && value.startsWith(WRUN_POLL_LANE_ID_PREFIX);
@@ -21,6 +21,9 @@ export function wrunPollCoinGateSeed(feed, coins, chartCoin) {
21
21
  return { cls: 'feed-missing', variant: 'market-paused', params: { feed } };
22
22
  return { cls: 'coin-outside-feed', params: { feed, coins: coins.join(', '), coin: chartCoin } };
23
23
  }
24
+ /** The code of a declared knob a lane refuses (a knob word, a fund the coin does not list, a knob the class does not
25
+ * take): the author's to fix in the code. */
26
+ export const WRUN_LANE_KNOB_INVALID_CODE = 'wrun_lane_knob_invalid';
24
27
  /** The seed of a gate the author fixes in the code (a knob word, a fund the coin does not list): a
25
- * failed run, its text in the details. */
26
- export const WRUN_POLL_AUTHOR_GATE_SEED = Object.freeze({ cls: 'run-failed', variant: 'generic' });
28
+ * failed run, its text in the details, `WRUN_LANE_KNOB_INVALID_CODE` its code. */
29
+ export const WRUN_POLL_AUTHOR_GATE_SEED = Object.freeze(wrunAuthorRuleSeed(WRUN_LANE_KNOB_INVALID_CODE));
@@ -39,10 +39,12 @@
39
39
  import type { WrunIndicatorMetadata, WrunInputSource } from '../../../interfaces/wrun-runtime.interface.js';
40
40
  import type { OpraReadFacts } from '../../chart/opra-read-access.leaf.js';
41
41
  import type { OpraOptionPlaneStop } from '../../../host-ports.types.js';
42
+ import { type WrunRefusalSeed } from '../wrun-refusal.util.js';
42
43
  import { type WrunPollLane, type WrunPollLaneContext, type WrunPollLaneId, type WrunPollLaneInstance } from './wrun-poll-lane.types.js';
43
- import { type WrunLaneChainPlane } from './wrun-row-lane.types.js';
44
+ import { type WrunLaneChainPlane, type WrunRowLaneHorizon } from './wrun-row-lane.types.js';
44
45
  import type { WrunMissingFeed } from '../wrun-run-health.util.js';
45
46
  import type { LiveBucketVenue } from '../../chart/live-bucket.util.js';
47
+ import { type WrunHostGridAsk } from '../wrun-tier-grid.util.js';
46
48
  /** One input of a registry class under the static plan. */
47
49
  export interface WrunPollLaneInput {
48
50
  inputIndex: number;
@@ -132,11 +134,25 @@ export interface WrunUnservedLaneInput {
132
134
  export declare function wrunUnservedLaneInput(missing: Map<string, WrunMissingFeed>, input: WrunUnservedLaneInput, fills: readonly string[], why: WrunUnservedLaneWhy, cryptoVenue: boolean | undefined): void;
133
135
  /**
134
136
  * Whether a lane's refusal says the chart has no option chain: its record's seed is `no-options` / `chain` (the chain
135
- * decision's `no-chain`, opra-option-lanes.util `wrunLaneChainRefusalSeed`, and the OPRA-only lanes' "OPRA lists no
136
- * options here"), read off the seed, never the words. Such a chart (a LINK perp, a forex pair, a stock listing no
137
+ * decision's `no-chain`, opra-option-lanes.util `wrunLaneChainRefusalSeed`, every options lane's since each reads the
138
+ * one chain resolver), read off the seed, never the words. Such a chart (a LINK perp, a forex pair, a stock listing no
137
139
  * options) does not serve the feed: both planners hand the refusal to `wrunUnservedLaneInput`, so a declared fill reads.
138
140
  */
139
141
  export declare function wrunLaneNoChainRefusal(error: unknown): error is Error;
142
+ /**
143
+ * The seed of a lane's refusal that the chart's options plane serves no such scope (OPTIONS-PORT P7, R7c C7-2:
144
+ * `options_flow`'s US issue types off the OPRA plane, its `venue` on CME, a venue word of another plane): the
145
+ * feed-missing record under the lane's feed ("this market has no such feed"). Made here, so the planner tells it from
146
+ * every other feed-missing refusal by the seed itself (`wrunLaneUnservedScopeRefusal`), never the words.
147
+ */
148
+ export declare function wrunLaneUnservedScopeSeed(feed: string): WrunRefusalSeed;
149
+ /**
150
+ * Whether a lane's refusal says the chart's options plane serves no such scope: its seed is one
151
+ * `wrunLaneUnservedScopeSeed` made. Such a chart does not serve the input, as a chart with no option chain does not:
152
+ * the planner hands the refusal to `wrunUnservedLaneInput` as the lane's own (`noChain`), so a declared fill drops the
153
+ * input with the market's note and any other input refuses with the lane's own words and seed.
154
+ */
155
+ export declare function wrunLaneUnservedScopeRefusal(error: unknown): error is Error;
140
156
  /**
141
157
  * A chain lane's input before its chain is resolved, both planners' one rule: where the chart's options list on OPRA
142
158
  * (riding the plane, or kept off it by a known stop) the OPRA wall first (`opra-official-only:<class>`), every chain it
@@ -336,15 +352,34 @@ export interface WrunHostGridWindow {
336
352
  barGrid?: LiveBucketVenue | null;
337
353
  nowMs: number;
338
354
  }
355
+ /**
356
+ * A host-grid ask plan cut to a lane's horizon for one acquisition (`WrunRowLaneHorizon`): every window bar that opens
357
+ * before `completeFromMs` joins the partial bars, and the asks start at the first bar that ends after `servedFromMs`
358
+ * (an ask wholly before it is dropped). A bar opens and ends where its span does (wrun-tier-grid.util
359
+ * `wrunHostBarSpanOf`: its Globex session under a CME session grid). No horizon: the plan as the tier rule made it.
360
+ * The one cut a row lane
361
+ * (sources/wrun-row-lanes.util `wrunRowLaneAsksWithinHorizon`) and a host-grid poll lane (`horizon`) take.
362
+ */
363
+ export declare function wrunHostGridAsksWithinHorizon(plan: {
364
+ asks: WrunHostGridAsk[];
365
+ partialBars: number[];
366
+ }, window: Pick<WrunHostGridWindow, 'barOpens' | 'intervalMs'>, horizon: WrunRowLaneHorizon | undefined, sessionGrid?: LiveBucketVenue | null): {
367
+ asks: WrunHostGridAsk[];
368
+ partialBars: number[];
369
+ };
339
370
  /**
340
371
  * A lane's rows over a chart window, landed on the host bars when it is a host-grid lane (`barGrid`): its asks
341
372
  * under the tier rule (`wrunHostGridAsks` over the window's host bars: one per run of bars on a tier, the
342
- * tier's key in its extras as `tier`), each answer landed by the lane's landing (`wrunLandScalarRowsOnHostBars`:
343
- * a flow summed per bar, a snapshot's newest sealed row, sealed by its ask's tier), ascending. A bar no tier
344
- * retains asks nothing and reads no row. Any other lane is asked once over `[fromTs, toTs]` (`fallback`), its
345
- * rows as they come. `ask` is the caller's fetch (the full run's, a reconcile's).
373
+ * tier's key in its extras as `tier`), cut to the lane's `horizon` for the acquisition (`wrunHostGridAsksWithinHorizon`:
374
+ * the bars its source no longer holds ask nothing and read the input's `missing` policy), each answer landed by the
375
+ * lane's landing (`wrunLandScalarRowsOnHostBars`: a flow summed per bar, a snapshot's newest sealed row, sealed by its
376
+ * ask's tier), ascending. A bar no tier retains asks nothing and reads no row. A flow sums every bucket inside its bar,
377
+ * so its plan reads the window's bar grid as its session grid (wrun-tier-grid.util `wrunCmeSessionBarSpan`): a CME
378
+ * session bar of a day or longer is asked over its Globex session, never from a UTC day bucket; a snapshot keeps its
379
+ * stamps. Any other lane is asked once over `[fromTs, toTs]` (`fallback`), its rows as they come. `ask` is the
380
+ * caller's fetch (the full run's, a reconcile's).
346
381
  */
347
- export declare function fetchWrunPollLaneHostGridRows(lane: Pick<WrunPollLane, 'barGrid'>, extras: Readonly<Record<string, unknown>>, window: WrunHostGridWindow, fallback: {
382
+ export declare function fetchWrunPollLaneHostGridRows(lane: Pick<WrunPollLane, 'barGrid' | 'horizon'>, extras: Readonly<Record<string, unknown>>, window: WrunHostGridWindow, fallback: {
348
383
  fromTs: number;
349
384
  toTs: number;
350
385
  }, ask: (extras: Readonly<Record<string, unknown>>, fromTs: number, toTs: number) => Promise<ArrayLike<number>[]>): Promise<ArrayLike<number>[]>;
@@ -4,7 +4,7 @@ import { refuseWrunPollInput, WRUN_POLL_LANE_ID_PREFIX, } from './wrun-poll-lane
4
4
  import { wrunLaneChainPlaneOf } from './wrun-row-lane.types.js';
5
5
  import { WRUN_DAILY_LANE_INTERVAL_KEY, wrunDailyLaneFetchFrom, wrunDailyLaneFetchTo, wrunDailyLaneReconcileFrom, wrunDailyLaneReconcileTo, } from '../wrun-daily-lane.util.js';
6
6
  import { assertWrunOpraLaneReadable, wrunOpraLanePayloadFields } from '../wrun-opra-lane.util.js';
7
- import { wrunHostGridAsks, wrunHostGridFetchTo, wrunLandScalarRowsOnHostBars } from '../wrun-tier-grid.util.js';
7
+ import { wrunHostBarSpanOf, wrunHostGridAsks, wrunHostGridFetchTo, wrunLandScalarRowsOnHostBars, } from '../wrun-tier-grid.util.js';
8
8
  /**
9
9
  * The static plan: every input whose class the registry serves, in declaration order, with the
10
10
  * lane serving its field and the field's column. Refused by name: a celled input (poll lanes
@@ -151,14 +151,37 @@ export function wrunUnservedLaneInput(missing, input, fills, why, cryptoVenue) {
151
151
  }
152
152
  /**
153
153
  * Whether a lane's refusal says the chart has no option chain: its record's seed is `no-options` / `chain` (the chain
154
- * decision's `no-chain`, opra-option-lanes.util `wrunLaneChainRefusalSeed`, and the OPRA-only lanes' "OPRA lists no
155
- * options here"), read off the seed, never the words. Such a chart (a LINK perp, a forex pair, a stock listing no
154
+ * decision's `no-chain`, opra-option-lanes.util `wrunLaneChainRefusalSeed`, every options lane's since each reads the
155
+ * one chain resolver), read off the seed, never the words. Such a chart (a LINK perp, a forex pair, a stock listing no
156
156
  * options) does not serve the feed: both planners hand the refusal to `wrunUnservedLaneInput`, so a declared fill reads.
157
157
  */
158
158
  export function wrunLaneNoChainRefusal(error) {
159
159
  const seed = wrunRefusalSeedOf(error);
160
160
  return error instanceof Error && seed?.cls === 'no-options' && seed.variant === 'chain';
161
161
  }
162
+ /** The seeds `wrunLaneUnservedScopeSeed` made: the one evidence `wrunLaneUnservedScopeRefusal` reads. */
163
+ const WRUN_LANE_UNSERVED_SCOPE_SEEDS = new WeakSet();
164
+ /**
165
+ * The seed of a lane's refusal that the chart's options plane serves no such scope (OPTIONS-PORT P7, R7c C7-2:
166
+ * `options_flow`'s US issue types off the OPRA plane, its `venue` on CME, a venue word of another plane): the
167
+ * feed-missing record under the lane's feed ("this market has no such feed"). Made here, so the planner tells it from
168
+ * every other feed-missing refusal by the seed itself (`wrunLaneUnservedScopeRefusal`), never the words.
169
+ */
170
+ export function wrunLaneUnservedScopeSeed(feed) {
171
+ const seed = Object.freeze({ cls: 'feed-missing', variant: 'market-paused', params: { feed } });
172
+ WRUN_LANE_UNSERVED_SCOPE_SEEDS.add(seed);
173
+ return seed;
174
+ }
175
+ /**
176
+ * Whether a lane's refusal says the chart's options plane serves no such scope: its seed is one
177
+ * `wrunLaneUnservedScopeSeed` made. Such a chart does not serve the input, as a chart with no option chain does not:
178
+ * the planner hands the refusal to `wrunUnservedLaneInput` as the lane's own (`noChain`), so a declared fill drops the
179
+ * input with the market's note and any other input refuses with the lane's own words and seed.
180
+ */
181
+ export function wrunLaneUnservedScopeRefusal(error) {
182
+ const seed = wrunRefusalSeedOf(error);
183
+ return error instanceof Error && seed !== undefined && WRUN_LANE_UNSERVED_SCOPE_SEEDS.has(seed);
184
+ }
162
185
  /**
163
186
  * A chain lane's input before its chain is resolved, both planners' one rule: where the chart's options list on OPRA
164
187
  * (riding the plane, or kept off it by a known stop) the OPRA wall first (`opra-official-only:<class>`), every chain it
@@ -315,8 +338,9 @@ export async function planWrunPollLanes(metadata, chart, isIndexModeExchange = (
315
338
  answered = await planned.lane.plan(planned.source, ctx);
316
339
  }
317
340
  catch (error) {
318
- // A chart with no option chain does not serve the feed (`wrunLaneNoChainRefusal`): the same one rule.
319
- if (!wrunLaneNoChainRefusal(error))
341
+ // A chart with no option chain does not serve the feed (`wrunLaneNoChainRefusal`), nor one whose options plane
342
+ // serves no such scope (`wrunLaneUnservedScopeRefusal`): the same one rule.
343
+ if (!wrunLaneNoChainRefusal(error) && !wrunLaneUnservedScopeRefusal(error))
320
344
  throw error;
321
345
  wrunUnservedLaneInput(missing, unserved, WRUN_POLL_LANE_UNSERVED_FILLS, { noChain: error }, cryptoVenue);
322
346
  continue;
@@ -539,24 +563,66 @@ export function wrunPollLaneReconcileFrom(lane, fromTs, sessionFirstRowTs) {
539
563
  /** The payload field a host-grid lane's ask names its backend tier in (`WrunPollLaneBarGrid.tiers`, a tier's
540
564
  * `key`): the K control asks that tier. */
541
565
  export const WRUN_POLL_LANE_TIER_FIELD = 'tier';
566
+ function finiteMsOrUndefined(value) {
567
+ return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
568
+ }
569
+ /**
570
+ * A host-grid ask plan cut to a lane's horizon for one acquisition (`WrunRowLaneHorizon`): every window bar that opens
571
+ * before `completeFromMs` joins the partial bars, and the asks start at the first bar that ends after `servedFromMs`
572
+ * (an ask wholly before it is dropped). A bar opens and ends where its span does (wrun-tier-grid.util
573
+ * `wrunHostBarSpanOf`: its Globex session under a CME session grid). No horizon: the plan as the tier rule made it.
574
+ * The one cut a row lane
575
+ * (sources/wrun-row-lanes.util `wrunRowLaneAsksWithinHorizon`) and a host-grid poll lane (`horizon`) take.
576
+ */
577
+ export function wrunHostGridAsksWithinHorizon(plan, window, horizon, sessionGrid) {
578
+ if (horizon === undefined)
579
+ return plan;
580
+ const servedFrom = finiteMsOrUndefined(horizon.servedFromMs);
581
+ const completeFrom = finiteMsOrUndefined(horizon.completeFromMs) ?? servedFrom;
582
+ const spanOf = (open) => wrunHostBarSpanOf(open, window.intervalMs, sessionGrid);
583
+ const partial = new Set(plan.partialBars);
584
+ if (completeFrom !== undefined) {
585
+ for (const open of window.barOpens)
586
+ if (spanOf(open).fromMs < completeFrom)
587
+ partial.add(open);
588
+ }
589
+ let asks = plan.asks;
590
+ if (servedFrom !== undefined) {
591
+ const firstServed = window.barOpens.find((open) => spanOf(open).toMs > servedFrom);
592
+ asks =
593
+ firstServed === undefined
594
+ ? []
595
+ : plan.asks.flatMap((gridAsk) => {
596
+ const fromMs = Math.max(gridAsk.fromMs, spanOf(firstServed).fromMs);
597
+ return fromMs < gridAsk.toMs ? [{ ...gridAsk, fromMs }] : [];
598
+ });
599
+ }
600
+ return { asks, partialBars: [...partial].sort((a, b) => a - b) };
601
+ }
542
602
  /**
543
603
  * A lane's rows over a chart window, landed on the host bars when it is a host-grid lane (`barGrid`): its asks
544
604
  * under the tier rule (`wrunHostGridAsks` over the window's host bars: one per run of bars on a tier, the
545
- * tier's key in its extras as `tier`), each answer landed by the lane's landing (`wrunLandScalarRowsOnHostBars`:
546
- * a flow summed per bar, a snapshot's newest sealed row, sealed by its ask's tier), ascending. A bar no tier
547
- * retains asks nothing and reads no row. Any other lane is asked once over `[fromTs, toTs]` (`fallback`), its
548
- * rows as they come. `ask` is the caller's fetch (the full run's, a reconcile's).
605
+ * tier's key in its extras as `tier`), cut to the lane's `horizon` for the acquisition (`wrunHostGridAsksWithinHorizon`:
606
+ * the bars its source no longer holds ask nothing and read the input's `missing` policy), each answer landed by the
607
+ * lane's landing (`wrunLandScalarRowsOnHostBars`: a flow summed per bar, a snapshot's newest sealed row, sealed by its
608
+ * ask's tier), ascending. A bar no tier retains asks nothing and reads no row. A flow sums every bucket inside its bar,
609
+ * so its plan reads the window's bar grid as its session grid (wrun-tier-grid.util `wrunCmeSessionBarSpan`): a CME
610
+ * session bar of a day or longer is asked over its Globex session, never from a UTC day bucket; a snapshot keeps its
611
+ * stamps. Any other lane is asked once over `[fromTs, toTs]` (`fallback`), its rows as they come. `ask` is the
612
+ * caller's fetch (the full run's, a reconcile's).
549
613
  */
550
614
  export async function fetchWrunPollLaneHostGridRows(lane, extras, window, fallback, ask) {
551
615
  const grid = lane.barGrid;
552
616
  if (grid === undefined)
553
617
  return ask(extras, fallback.fromTs, fallback.toTs);
554
- const { asks } = wrunHostGridAsks({
618
+ const sessionGrid = grid.landing === 'flow' ? window.barGrid : undefined;
619
+ const { asks } = wrunHostGridAsksWithinHorizon(wrunHostGridAsks({
555
620
  tiers: grid.tiers,
556
621
  barOpens: window.barOpens,
557
622
  intervalMs: window.intervalMs,
558
623
  nowMs: window.nowMs,
559
- });
624
+ ...(sessionGrid !== undefined ? { sessionGrid } : {}),
625
+ }), window, lane.horizon?.(extras, window.nowMs), sessionGrid);
560
626
  const answers = await Promise.all(asks.map(async (gridAsk) => {
561
627
  const askExtras = gridAsk.tier === undefined ? extras : { ...extras, [WRUN_POLL_LANE_TIER_FIELD]: gridAsk.tier.key };
562
628
  const rows = await ask(askExtras, gridAsk.fromMs, gridAsk.toMs);
@@ -87,19 +87,23 @@ export interface WrunRowLaneHorizon {
87
87
  completeFromMs?: number;
88
88
  }
89
89
  /**
90
- * A read that can pass its worker's row cap (`option_contract_flow` reads every contract of the underlying): the cap,
91
- * in rows, and the rows one host bar is projected to read at its tier, up to the clock. Before any fetch the host
92
- * keeps the NEWEST asked bars whose projected rows fit the cap and marks every older asked bar PARTIAL (bit 14 of
93
- * `present`: one marker tuple), the asks starting at the first kept bar's open, never inside a bar; a bar whose own
94
- * projection passes the cap leaves every bar at or before it partial. Applied after the tier rule and the horizon.
90
+ * A read whose answer can pass the source answer budget (`option_contract_flow` reads every contract of the
91
+ * underlying): how many numeric cells one answered row holds (the raw tuple the worker hands over) and the rows one
92
+ * host bar is projected to read at its tier, up to the clock, for the instance's own acquisition (its payload: a chain
93
+ * lane's plane follows the exchange it names, so each plane reads its own projection). The cap is never the lane's to
94
+ * pick: it is the source answer budget (kscript-source-answer-budget.leaf) in rows of that width
95
+ * (`wrunRowLaneMaxRows`), the one size the row cache, the worker's row cap and the fetch guard agree on. Before any
96
+ * fetch the host keeps the NEWEST asked bars whose projected rows fit it and marks every older asked bar PARTIAL (bit
97
+ * 14 of `present`: one marker tuple), the asks starting at the first kept bar's open, never inside a bar; a bar whose
98
+ * own projection passes it leaves every bar at or before it partial. Applied after the tier rule and the horizon.
95
99
  */
96
100
  export interface WrunRowLaneRowBudget {
97
- maxRows: number;
101
+ cellsPerRow: number;
98
102
  barRows: (bar: {
99
103
  openMs: number;
100
104
  endMs: number;
101
105
  tier?: WrunBackendTier;
102
- }, nowMs: number) => number;
106
+ }, nowMs: number, acquisition: Readonly<Record<string, unknown>>) => number;
103
107
  }
104
108
  /** What a lane's live fold reads beside the points: the chart's bar span and grid, and the acquisition the
105
109
  * instance's history was asked with (its knobs: a floor, an expiry set). */
@@ -110,14 +114,22 @@ export interface WrunRowLaneFoldContext {
110
114
  }
111
115
  /**
112
116
  * A lane fed live by COIN (UW-PARITY rule for the print class): a coin-scoped channel carries every point of
113
- * the chart's underlying (one OPRA print per contract of the root), and the intake admits a point whose coin is
114
- * the coin the instance was asked for (`WrunRowLaneDescriptor.coinOf`), whatever contract it names, the chart's
115
- * own market or not. The channel's key is `wrunCoinChannel` (live-feed-channel-factory.util); no lane opens one
116
- * until the live-feed serves the coin route.
117
+ * an underlying (one print per contract of the root), and the intake admits a point whose coin is the coin the
118
+ * instance was asked for (`WrunRowLaneDescriptor.coinOf`), whatever contract it names, the chart's own market or not.
119
+ * The channel's key is `wrunCoinChannel` (live-feed-channel-factory.util): for a governed lane its plane's exchange,
120
+ * for a `chain` lane the exchange the instance's chain lists on (a crypto venue, OPRA, a CME Group exchange), with
121
+ * the instance's coin (its chain's underlying), on a governed exchange only while the read is routed real-time
122
+ * (wrun-coin-lane-live.util). The lane's `fold` keeps only the points its acquisition reads (a chain lane's: its
123
+ * exchange and its ONE book). No lane opens a channel until the live-feed serves the coin route.
117
124
  */
118
125
  export interface WrunRowLaneLiveByCoin {
119
126
  /** The fan-out's script source name the lane's frames arrive under. */
120
127
  scriptSource: string;
128
+ /** A chain lane's planes whose coin channel carries its points (a live producer of its type streams there): an
129
+ * instance whose chain lists on another plane subscribes nothing and refreshes from history alone, the live tick's
130
+ * reconcile re-asking it as it re-asks a lane with no channel (its answer merged by `reconcile`). Absent: every
131
+ * plane. */
132
+ chainPlanes?: readonly WrunLaneChainPlane[];
121
133
  /** The coin a point names (its series' coin); absent: `point.series.coin`, else the frame's own. */
122
134
  coinOf?: (point: unknown) => string | undefined;
123
135
  /** A point's time, ms (the host bar it folds into); null for a point that names none. */
@@ -147,6 +159,8 @@ export interface WrunRowLaneChain {
147
159
  /** The plane a chain lane instance reads: the gate its chain's exchange rides (`opra`, `cme`), or `plain` (a crypto
148
160
  * options venue: no gate, no licence delay, no plane stamp, no routed tier). */
149
161
  export type WrunLaneChainPlane = 'opra' | 'cme' | 'plain';
162
+ /** Every chain plane (the registry checks a lane's `liveByCoin.chainPlanes` against it). */
163
+ export declare const WRUN_LANE_CHAIN_PLANES: readonly WrunLaneChainPlane[];
150
164
  /** An exchange's plane, read off the governed exchange sets the gate table is built from (never a venue list): a CME
151
165
  * Group exchange is `cme`, OPRA `opra`, any other `plain`. Here, beside the chain mark, so the planner on the row
152
166
  * builder's (and the boot path's) import graph reads it without the chain resolver's module. */
@@ -197,9 +211,9 @@ export interface WrunRowLaneDescriptor {
197
211
  * identity, facets and plane fields) and the window's clock, for a flow or snapshot lane. Absent: the tier rule
198
212
  * alone. */
199
213
  horizon?: (extras: Readonly<Record<string, unknown>>, nowMs: number) => WrunRowLaneHorizon | undefined;
200
- /** The row cap the lane's read keeps under (`WrunRowLaneRowBudget`), for a flow or snapshot lane: the newest bars
201
- * that fit are read, every older asked bar is partial. Absent: the asks as the tier rule and the horizon made
202
- * them. */
214
+ /** The source answer budget the lane's read keeps under (`WrunRowLaneRowBudget`), for a flow or snapshot lane: the
215
+ * newest bars that fit are read, every older asked bar is partial. Absent: the asks as the tier rule and the
216
+ * horizon made them (a lane whose answer cannot pass the budget). */
203
217
  rowBudget?: WrunRowLaneRowBudget;
204
218
  /**
205
219
  * The lane reads a governed plane on every chart it serves: `opra` (US options data). Its inputs are refused by
@@ -215,7 +229,7 @@ export interface WrunRowLaneDescriptor {
215
229
  * the one chain resolver (sources/opra-option-lanes.util `decideWrunLaneChain`), never per descriptor (see
216
230
  * `WrunRowLaneChain`). It is admitted on every chart (a chart with no chain is refused by name in its identity or
217
231
  * facets), and its asks ride the native-rows path on every plane (its rows are its chain's, never the chart
218
- * market's).
232
+ * market's). It may be fed live by coin too (`liveByCoin`): each instance subscribes its own chain's channel.
219
233
  */
220
234
  chain?: WrunRowLaneChain;
221
235
  /** How an empty answer reads: `quiet` (a window with nothing in it is legitimate: present EMPTY blocks) or
@@ -242,7 +256,8 @@ export interface WrunRowLaneDescriptor {
242
256
  /** The lane's OWN fetch in place of the chart's (a series no K control serves): the poll lanes' ask shape,
243
257
  * answered as rows `[ts, tuple, ...]` at the asked tier, ascending. */
244
258
  fetch?: (ask: WrunPollLaneFetchAsk) => Promise<ReadonlyArray<ReadonlyArray<unknown>>>;
245
- /** Live points by coin (see `WrunRowLaneLiveByCoin`); absent: a poll lane (the reconcile re-asks it). */
259
+ /** Live points by coin (see `WrunRowLaneLiveByCoin`: a governed lane's plane, a chain lane's own chain per
260
+ * instance); absent: a poll lane (the reconcile re-asks it). */
246
261
  liveByCoin?: WrunRowLaneLiveByCoin;
247
262
  }
248
263
  /** The input a lane's per-input projection (`cells`) reads: its name, its declaration and the most tuples a bar of
@@ -1,5 +1,7 @@
1
1
  import { isCmeGoverned } from '../../chart/cme-realtime.util.js';
2
2
  import { isOpraGoverned } from '../../v2/opra-governed.util.js';
3
+ /** Every chain plane (the registry checks a lane's `liveByCoin.chainPlanes` against it). */
4
+ export const WRUN_LANE_CHAIN_PLANES = Object.freeze(['opra', 'cme', 'plain']);
3
5
  /** An exchange's plane, read off the governed exchange sets the gate table is built from (never a venue list): a CME
4
6
  * Group exchange is `cme`, OPRA `opra`, any other `plain`. Here, beside the chain mark, so the planner on the row
5
7
  * builder's (and the boot path's) import graph reads it without the chain resolver's module. */