@orangecharts/wrun-chart-host 0.7.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/README.md +25 -3
  2. package/dist/constants/feature-flags.constants.d.ts +1 -0
  3. package/dist/constants/feature-flags.constants.js +5 -0
  4. package/dist/constants/option-venues.constants.d.ts +18 -0
  5. package/dist/constants/option-venues.constants.js +14 -0
  6. package/dist/constants/venue-presets.constants.d.ts +17 -3
  7. package/dist/constants/venue-presets.constants.js +17 -3
  8. package/dist/host-env.d.ts +24 -0
  9. package/dist/host-env.js +21 -0
  10. package/dist/host-ports.types.d.ts +12 -0
  11. package/dist/index.d.ts +16 -0
  12. package/dist/index.js +16 -0
  13. package/dist/indicators/controls/tpo-session.util.d.ts +40 -11
  14. package/dist/indicators/controls/tpo-session.util.js +138 -14
  15. package/dist/interfaces/option-instrument.interface.d.ts +6 -0
  16. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +4 -0
  17. package/dist/kscript-data/controls/live-trades-merge.util.js +4 -0
  18. package/dist/settings-templates/footprint-rows.d.ts +25 -0
  19. package/dist/settings-templates/footprint-rows.js +127 -0
  20. package/dist/settings-templates/form-rows.d.ts +56 -0
  21. package/dist/settings-templates/form-rows.js +19 -0
  22. package/dist/settings-templates/frvp-fields.js +14 -0
  23. package/dist/settings-templates/index.d.ts +10 -1
  24. package/dist/settings-templates/index.js +11 -2
  25. package/dist/settings-templates/indicator-fields.js +78 -0
  26. package/dist/settings-templates/tool-rules.d.ts +35 -9
  27. package/dist/settings-templates/tool-rules.js +42 -8
  28. package/dist/settings-templates/tool-tables.generated.js +13 -2
  29. package/dist/utility/chart/candle-volume-unit.leaf.d.ts +16 -0
  30. package/dist/utility/chart/candle-volume-unit.leaf.js +61 -0
  31. package/dist/utility/chart/footprint-columns.util.d.ts +74 -0
  32. package/dist/utility/chart/footprint-columns.util.js +106 -0
  33. package/dist/utility/chart/footprint-display-mode.util.d.ts +40 -0
  34. package/dist/utility/chart/footprint-display-mode.util.js +62 -0
  35. package/dist/utility/chart/footprint-sierra-look.util.d.ts +2 -0
  36. package/dist/utility/chart/footprint-sierra-look.util.js +37 -0
  37. package/dist/utility/chart/kscript-venue-policy.util.js +4 -2
  38. package/dist/utility/chart/om-panel.util.d.ts +11 -0
  39. package/dist/utility/chart/om-panel.util.js +59 -0
  40. package/dist/utility/chart/window-geometry.leaf.d.ts +23 -1
  41. package/dist/utility/chart/window-geometry.leaf.js +78 -6
  42. package/dist/utility/chart/window-owner.leaf.d.ts +13 -0
  43. package/dist/utility/chart/window-owner.leaf.js +5 -0
  44. package/dist/utility/options/cme-options-root.util.d.ts +25 -0
  45. package/dist/utility/options/cme-options-root.util.js +40 -0
  46. package/dist/utility/options/option-book.util.d.ts +27 -0
  47. package/dist/utility/options/option-book.util.js +76 -0
  48. package/dist/utility/options/option-trade-date.util.d.ts +50 -0
  49. package/dist/utility/options/option-trade-date.util.js +120 -0
  50. package/dist/utility/wrun/sources/host-grid-landing.d.ts +4 -2
  51. package/dist/utility/wrun/sources/host-grid-landing.js +8 -0
  52. package/dist/utility/wrun/sources/lanes/options_flow.d.ts +40 -4
  53. package/dist/utility/wrun/sources/lanes/options_flow.js +115 -18
  54. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +12 -9
  55. package/dist/utility/wrun/sources/opra-option-lanes.util.js +10 -7
  56. package/dist/utility/wrun/sources/row-lane-registry.js +9 -5
  57. package/dist/utility/wrun/sources/row-lanes/index.js +2 -0
  58. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +3 -2
  59. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +30 -5
  60. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +14 -1
  61. package/dist/utility/wrun/sources/row-lanes/option_prints.js +100 -23
  62. package/dist/utility/wrun/sources/row-lanes/option_strike_flow.d.ts +4 -0
  63. package/dist/utility/wrun/sources/row-lanes/option_strike_flow.js +65 -0
  64. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +47 -1
  65. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +71 -2
  66. package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +14 -1
  67. package/dist/utility/wrun/sources/row-lanes/option_surface.js +30 -2
  68. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +7 -1
  69. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +45 -5
  70. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +115 -3
  71. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +10 -0
  72. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +57 -0
  73. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +60 -6
  74. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +160 -23
  75. package/dist/utility/wrun/wrun-cloud-record.leaf.d.ts +27 -0
  76. package/dist/utility/wrun/wrun-cloud-record.leaf.js +71 -0
  77. package/dist/utility/wrun/wrun-cloud-record.util.d.ts +4 -21
  78. package/dist/utility/wrun/wrun-cloud-record.util.js +5 -65
  79. package/dist/utility/wrun/wrun-color-settings.util.d.ts +7 -5
  80. package/dist/utility/wrun/wrun-color-settings.util.js +26 -11
  81. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +4 -2
  82. package/dist/utility/wrun/wrun-draft-overlay.util.js +40 -3
  83. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +1 -1
  84. package/dist/utility/wrun/wrun-hosted-wire-caps.js +4 -0
  85. package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +29 -3
  86. package/dist/utility/wrun/wrun-lane-refusal.leaf.js +33 -3
  87. package/dist/utility/wrun/wrun-live-tick.util.d.ts +4 -1
  88. package/dist/utility/wrun/wrun-live-tick.util.js +39 -6
  89. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +106 -0
  90. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +159 -0
  91. package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +44 -0
  92. package/dist/utility/wrun/wrun-market-size-defaults.util.js +213 -0
  93. package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +43 -8
  94. package/dist/utility/wrun/wrun-opra-flow.leaf.js +37 -6
  95. package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +51 -10
  96. package/dist/utility/wrun/wrun-option-contract-flow.util.js +85 -33
  97. package/dist/utility/wrun/wrun-option-prints.util.d.ts +133 -3
  98. package/dist/utility/wrun/wrun-option-prints.util.js +318 -8
  99. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +96 -0
  100. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +215 -0
  101. package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +342 -0
  102. package/dist/utility/wrun/wrun-option-strike-flow.util.js +742 -0
  103. package/dist/utility/wrun/wrun-option-views.util.d.ts +183 -3
  104. package/dist/utility/wrun/wrun-option-views.util.js +504 -7
  105. package/dist/utility/wrun/wrun-options-chain.util.d.ts +6 -4
  106. package/dist/utility/wrun/wrun-options-chain.util.js +8 -5
  107. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +2 -1
  108. package/dist/utility/wrun/wrun-overlay-recovery.util.js +7 -2
  109. package/dist/utility/wrun/wrun-overlay-run.util.js +120 -18
  110. package/dist/utility/wrun/wrun-pack-widths.leaf.d.ts +15 -0
  111. package/dist/utility/wrun/wrun-pack-widths.leaf.js +22 -0
  112. package/dist/utility/wrun/wrun-pack.util.d.ts +9 -8
  113. package/dist/utility/wrun/wrun-pack.util.js +21 -15
  114. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +4 -0
  115. package/dist/utility/wrun/wrun-panel-mount.util.js +62 -22
  116. package/dist/utility/wrun/wrun-panel-style.util.d.ts +17 -2
  117. package/dist/utility/wrun/wrun-panel-style.util.js +47 -9
  118. package/dist/utility/wrun/wrun-pin-spelling.util.js +19 -10
  119. package/dist/utility/wrun/wrun-refusal.util.js +7 -1
  120. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +13 -0
  121. package/dist/utility/wrun/wrun-script-inputs.util.js +43 -0
  122. package/dist/utility/wrun/wrun-tape-source.util.d.ts +9 -0
  123. package/dist/utility/wrun/wrun-tape-source.util.js +18 -0
  124. package/package.json +3 -3
@@ -1,14 +1,18 @@
1
1
  import { kScriptSourceAnswerRows } from '../../chart/kscript-source-answer-budget.leaf.js';
2
2
  import { wrunRowLaneByKey, wrunRowLaneOfClass, wrunRowLanes } from './row-lane-registry.js';
3
- import { assertWrunLaneChainPlaneReadable, stableJson, wrunChainLaneStop, wrunChartOpraPlane, wrunHostGridAsksWithinHorizon, wrunLaneNoChainRefusal, wrunOpraPlaneStopDetail, wrunPollLaneChainAsk, wrunPollLaneChainExchange, wrunPollLaneChainGovernedExchange, wrunPollLaneChainPlane, wrunUnservedLaneInput, } from './wrun-poll-lanes.util.js';
3
+ import { assertWrunLaneChainPlaneReadable, stableJson, wrunChainLaneStop, wrunChartOpraPlane, wrunHostGridAsksWithinHorizon, wrunLaneNoChainRefusal, wrunOpraPlaneStopDetail, wrunPollLaneChainAsk, wrunPollLaneChainExchange, wrunPollLaneChainGovernedExchange, wrunPollLaneChainPlane, resolveWrunOptionSettingKnobs, wrunUnservedLaneInput, } from './wrun-poll-lanes.util.js';
4
4
  import { WRUN_ROW_LANE_ID_PREFIX, } from './wrun-row-lane.types.js';
5
5
  import { assertWrunOpraLaneReadable } from '../wrun-opra-lane.util.js';
6
+ import { WRUN_OPTION_FLOW_TODAY_FIELD, wrunOptionFlowTodayFromOf } from '../wrun-option-contract-flow.util.js';
7
+ import { wrunOptionInputTupleWidth, wrunOptionKitBarHasRows, wrunOptionLaneCarriesNext, wrunOptionLaneFirstPaintBudget, wrunOptionLaneTupleWidth, } from '../wrun-option-views.util.js';
6
8
  import { wrunPartialMarkerTuple, wrunPresentIsPartial, wrunTuplesMarkedPartial } from '../wrun-present-bits.util.js';
7
9
  import { wrunCellRowsWithPartialBars, wrunHostBarSpanOf, wrunHostGridAsks, wrunHostGridFallbackAsks, wrunLandCellRowsOnHostBars, } from '../wrun-tier-grid.util.js';
8
10
  /**
9
11
  * The static plan: every input whose class a row lane serves, in declaration order, with its lane. Refused by
10
12
  * name: a scalar input (a row lane serves cell blocks) and a celled one with no `max_cells` (the bound its blocks
11
- * are packed under). Empty when the sheet reads no row-lane class.
13
+ * are packed under). Empty when the sheet reads no row-lane class. The lane's width follows the input's own words
14
+ * (wrun-option-views.util `wrunOptionInputTupleWidth`, the SDK's one rule: the strike kit fold's 14-value rows), so
15
+ * the row builder reads and hands on the block each input's words make.
12
16
  */
13
17
  export function planWrunRowLaneInputs(metadata) {
14
18
  const planned = [];
@@ -29,7 +33,14 @@ export function planWrunRowLaneInputs(metadata) {
29
33
  if (typeof maxCells !== 'number' || !Number.isInteger(maxCells) || maxCells < 1) {
30
34
  throw new Error(`WRUN ${metadata.id}: input '${input.name}' (${source.source}) declares no max_cells: a celled input names the most tuples a bar may hold`);
31
35
  }
32
- planned.push({ inputIndex: input.index, inputName: input.name, source, lane, maxCells });
36
+ const width = wrunOptionInputTupleWidth(source, lane.width);
37
+ planned.push({
38
+ inputIndex: input.index,
39
+ inputName: input.name,
40
+ source,
41
+ lane: width === lane.width ? lane : { ...lane, width },
42
+ maxCells,
43
+ });
33
44
  }
34
45
  return planned;
35
46
  }
@@ -80,7 +91,9 @@ function wrunRowLaneUnserved(lane, plane, indexMode, run, ctx) {
80
91
  * reason (`opraPlaneStop`: the `opra` flag dark, an index chart) says that reason instead (`options-stopped`, the
81
92
  * note and the refusal alike);
82
93
  * 3. the lane's identity, once per lane (the first admitted input's context names a refusal), then the input's
83
- * facets (awaited, in declaration order); the instance is the identity and the facets together. A lane with
94
+ * facets (awaited, in declaration order), each knob naming a setting first read as the setting's current value
95
+ * (`resolveWrunOptionSettingKnobs` over `run.paramValues`), the context carrying the plan's facts beside the chart
96
+ * (`WrunRowLanePlanFacts`); the instance is the identity and the facets together. A lane with
84
97
  * `acquisitions: 'one'` refuses a second input whose acquisition differs (one fetch, one live fold per package). A
85
98
  * chart with no option chain (an identity or facets refusal seeded `no-options` / `chain`, `wrunLaneNoChainRefusal`:
86
99
  * a LINK perp, a forex pair) does not serve the feed either: the same one rule, its note naming the feed with the
@@ -97,7 +110,10 @@ export async function planWrunRowLanes(metadata, chart, run) {
97
110
  const cryptoVenue = chart.isCryptoVenueExchange?.(chart.exchange);
98
111
  // The chart's OPRA plane facts, read once, as the poll lanes' planner reads them (`wrunChartOpraPlane`).
99
112
  const plane = wrunChartOpraPlane(chart.exchange, chart);
100
- for (const planned of planWrunRowLaneInputs(metadata)) {
113
+ const params = metadata.params ?? [];
114
+ const plannedInputs = planWrunRowLaneInputs(metadata);
115
+ const laneMaxCells = wrunRowLaneMaxCellsByClass(plannedInputs);
116
+ for (const planned of plannedInputs) {
101
117
  if (planned.source.undemanded === true)
102
118
  continue;
103
119
  const { lane } = planned;
@@ -113,6 +129,10 @@ export async function planWrunRowLanes(metadata, chart, run) {
113
129
  cryptoVenue,
114
130
  official: run?.official === true,
115
131
  opraUserScripts: run?.opraUserScripts === true,
132
+ maxCells: planned.maxCells,
133
+ laneMaxCells: laneMaxCells.get(lane.sourceClass),
134
+ params,
135
+ ...(run?.paramValues !== undefined ? { paramValues: run.paramValues } : {}),
116
136
  };
117
137
  const unserved = {
118
138
  inputName: planned.inputName,
@@ -137,7 +157,9 @@ export async function planWrunRowLanes(metadata, chart, run) {
137
157
  identity = definedFields(await lane.identity?.(ctx));
138
158
  identities.set(lane.laneKey, identity);
139
159
  }
140
- extras = { ...identity, ...definedFields(await lane.facets?.(planned.source, ctx)) };
160
+ // A knob naming a setting reads its current value first: a settings change re-plans and re-asks.
161
+ const source = resolveWrunOptionSettingKnobs(ctx, planned.source, params, run?.paramValues);
162
+ extras = { ...identity, ...definedFields(await lane.facets?.(source, ctx)) };
141
163
  }
142
164
  catch (error) {
143
165
  // A chart with no option chain does not serve the feed (`wrunLaneNoChainRefusal`): the same one rule.
@@ -167,6 +189,14 @@ export async function planWrunRowLanes(metadata, chart, run) {
167
189
  }
168
190
  return { lanes: [...instances.values()], missingFeeds: [...missing.values()] };
169
191
  }
192
+ /** The most `max_cells` among a sheet's planned inputs of each row-lane class (`WrunRowLanePlanFacts.laneMaxCells`). */
193
+ function wrunRowLaneMaxCellsByClass(planned) {
194
+ const most = new Map();
195
+ for (const { lane, maxCells } of planned) {
196
+ most.set(lane.sourceClass, Math.max(most.get(lane.sourceClass) ?? 0, maxCells));
197
+ }
198
+ return most;
199
+ }
170
200
  function definedFields(fields) {
171
201
  const out = {};
172
202
  for (const [key, value] of Object.entries(fields ?? {}))
@@ -262,9 +292,15 @@ export const WRUN_ROW_LANE_TIER_FIELD = 'tier';
262
292
  */
263
293
  export async function fetchWrunRowLaneRows(lane, extras, window, fallback, ask) {
264
294
  const landing = lane.landing;
265
- if (landing.kind === 'latest')
266
- return (await ask(extras, fallback.fromTs, fallback.toTs)).map((row) => [...row]);
295
+ // The instance's rows are its facets' (a strike kit fold's 14-value rows), read as plain tuples once landed.
296
+ const width = wrunOptionLaneTupleWidth(lane.sourceClass, extras, lane.width);
297
+ if (landing.kind === 'latest') {
298
+ return (await ask(extras, fallback.fromTs, fallback.toTs)).map((row) => wrunRowLanePlainRow(row, width));
299
+ }
267
300
  const sessionGrid = landing.kind === 'flow' ? window.barGrid : undefined;
301
+ // What the row budget and the first-paint slice project the window's bars under: the instance's payload with
302
+ // `history` "today" dated off the window's newest bar as each ask's K control dates it (`wrunRowLaneBudgetAcquisition`).
303
+ const budgetAcquisition = await wrunRowLaneBudgetAcquisition(lane, extras, window);
268
304
  const { asks, partialBars } = wrunRowLaneAsksWithinRowBudget(wrunRowLaneAsksWithinHorizon(wrunHostGridAsks({
269
305
  tiers: landing.tiers,
270
306
  barOpens: window.barOpens,
@@ -272,19 +308,39 @@ export async function fetchWrunRowLaneRows(lane, extras, window, fallback, ask)
272
308
  nowMs: window.nowMs,
273
309
  choice: landing.tierChoice,
274
310
  sessionGrid,
275
- }), window, lane.horizon?.(extras, window.nowMs), sessionGrid), window, lane.rowBudget, extras, sessionGrid);
311
+ }), window, lane.horizon?.(extras, window.nowMs), sessionGrid), window, lane.rowBudget, budgetAcquisition, sessionGrid);
312
+ // A row-budget lane's newest bars are asked first and on their own (wrun-row-lane-first-paint.util, off the boot path),
313
+ // and so are an instance's whose facets ask a per-bar word of the gateway (OPTLOAD G5: a surface pick, the strike kit
314
+ // fold), sized by the rows its answer holds; every other instance asks as the tier rule made it.
315
+ const sliceBudget = lane.rowBudget ?? wrunOptionLaneFirstPaintBudget(lane.sourceClass, extras, lane.width);
316
+ const ordered = sliceBudget === undefined
317
+ ? asks
318
+ : (await import('./wrun-row-lane-first-paint.util.js')).wrunRowLaneFirstPaintAsks(asks, window, sliceBudget, budgetAcquisition, sessionGrid);
276
319
  const fold = landing.fold;
277
- const askAndLand = async (gridAsk) => {
320
+ // `askToMs` reads past the ask's own end (a kit fold's seam, below); only the ask's own bars ever land.
321
+ const askAndLand = async (gridAsk, askToMs = gridAsk.toMs) => {
278
322
  const askExtras = gridAsk.tier === undefined ? extras : { ...extras, [WRUN_ROW_LANE_TIER_FIELD]: gridAsk.tier.key };
279
323
  // Rows stamped at or past the ask's end belong to a bar the plan did not ask (a skipped newest bar): never land
280
324
  // them, whatever the control answered.
281
- const rows = (await ask(askExtras, gridAsk.fromMs, gridAsk.toMs)).filter((row) => Number(row[0]) < gridAsk.toMs);
282
- return wrunLandCellRowsOnHostBars(rows, landing.kind, { intervalMs: window.intervalMs, barGrid: window.barGrid, tierMs: gridAsk.tier?.ms, nowMs: window.nowMs }, fold === undefined ? undefined : (group) => fold(group, askExtras));
325
+ const rows = (await ask(askExtras, gridAsk.fromMs, askToMs)).filter((row) => Number(row[0]) < gridAsk.toMs);
326
+ return wrunLandCellRowsOnHostBars(rows, landing.kind, { intervalMs: window.intervalMs, barGrid: window.barGrid, tierMs: gridAsk.tier?.ms, nowMs: window.nowMs }, fold === undefined ? undefined : (group) => fold(group, askExtras)).map((row) => wrunRowLanePlainRow(row, width));
283
327
  };
284
328
  const byBar = new Map();
285
- for (const landed of await Promise.all(asks.map(askAndLand))) {
286
- for (const row of landed)
287
- byBar.set(Number(row[0]), row);
329
+ if (!wrunOptionLaneCarriesNext(lane.sourceClass, extras)) {
330
+ for (const landed of await Promise.all(ordered.map((gridAsk) => askAndLand(gridAsk)))) {
331
+ for (const row of landed)
332
+ byBar.set(Number(row[0]), row);
333
+ }
334
+ }
335
+ else {
336
+ // A kit fold carrying the next bar's strikes (OPTLOAD G5): its carry stops at the read's window, so the asks run
337
+ // newest first, one at a time, each older one read through the newer answer's first bar with rows and landing its
338
+ // own bars alone; a seam between two pages then reads as one read would.
339
+ for (const gridAsk of ordered) {
340
+ for (const row of await askAndLand(gridAsk, wrunRowLaneSeamEndMs(gridAsk, byBar, window.intervalMs))) {
341
+ byBar.set(Number(row[0]), row);
342
+ }
343
+ }
288
344
  }
289
345
  // D12: a snapshot's bar its tier answered nothing for reads the next coarser tier that fits and retains it, for an
290
346
  // acquisition its lane says so of (`coarserWhenEmpty`: a CME surface's daily bar whose 5m tier holds no session
@@ -301,7 +357,7 @@ export async function fetchWrunRowLaneRows(lane, extras, window, fallback, ask)
301
357
  });
302
358
  if (fallback.length === 0)
303
359
  break;
304
- for (const landed of await Promise.all(fallback.map(askAndLand))) {
360
+ for (const landed of await Promise.all(fallback.map((gridAsk) => askAndLand(gridAsk)))) {
305
361
  for (const row of landed)
306
362
  if (!byBar.has(Number(row[0])))
307
363
  byBar.set(Number(row[0]), row);
@@ -311,7 +367,46 @@ export async function fetchWrunRowLaneRows(lane, extras, window, fallback, ask)
311
367
  }
312
368
  const landed = [...byBar.entries()].sort((a, b) => a[0] - b[0]).map(([, row]) => row);
313
369
  // A class with no `present` mask marks nothing: a partial bar asked nothing and reads an empty block.
314
- return lane.presentMask === false ? landed : wrunCellRowsWithPartialBars(landed, partialBars, lane.width);
370
+ return lane.presentMask === false ? landed : wrunCellRowsWithPartialBars(landed, partialBars, width);
371
+ }
372
+ /**
373
+ * Where a kit fold page carrying the next bar's strikes is read to (the paging seam, OPTLOAD G5): through the end of the
374
+ * first bar at or after the page's end that a newer page already landed with rows (`wrunOptionKitBarHasRows`), so the
375
+ * page's last bar carries what that bar draws; the page's own end when no newer bar has rows (the newest page, a window
376
+ * whose newer bars answered nothing).
377
+ */
378
+ function wrunRowLaneSeamEndMs(gridAsk, landed, intervalMs) {
379
+ let next;
380
+ for (const [open, row] of landed) {
381
+ if (open < gridAsk.toMs || !wrunOptionKitBarHasRows(row.slice(1)))
382
+ continue;
383
+ if (next === undefined || open < next)
384
+ next = open;
385
+ }
386
+ return next === undefined ? gridAsk.toMs : Math.max(gridAsk.toMs, wrunHostBarSpanOf(next, intervalMs).toMs);
387
+ }
388
+ /**
389
+ * A landed row with every packed block (a Float64Array a worker handed the page by transfer, `count x width` values back
390
+ * to back: OPTLOAD G5 O6) split into plain tuples of `width` values, every other cell as it is; a new array. The one
391
+ * point a lane's rows enter its buffer, so every reader of them reads arrays: the partial marks (which keep array
392
+ * tuples), the live reconcile's comparison of a re-asked bar (a typed block compares by identity, so an unchanged bar
393
+ * would read revised on every poll and reseed the session), the row builder. A block that is no whole number of tuples
394
+ * stays as it is (`exactTuples` skips it).
395
+ */
396
+ export function wrunRowLanePlainRow(row, width) {
397
+ const out = [row[0]];
398
+ for (let at = 1; at < row.length; at += 1) {
399
+ const cell = row[at];
400
+ if (cell instanceof Float64Array && width > 0 && cell.length % width === 0) {
401
+ for (let offset = 0; offset < cell.length; offset += width) {
402
+ out.push(Array.from(cell.subarray(offset, offset + width)));
403
+ }
404
+ }
405
+ else {
406
+ out.push(cell);
407
+ }
408
+ }
409
+ return out;
315
410
  }
316
411
  /**
317
412
  * A host-grid ask plan cut to a lane's horizon for one acquisition (`WrunRowLaneHorizon`): every window bar that
@@ -323,6 +418,35 @@ export async function fetchWrunRowLaneRows(lane, extras, window, fallback, ask)
323
418
  export function wrunRowLaneAsksWithinHorizon(plan, window, horizon, sessionGrid) {
324
419
  return wrunHostGridAsksWithinHorizon(plan, window, horizon, sessionGrid);
325
420
  }
421
+ /**
422
+ * The acquisition a row lane's budget projects the window's bars under (`wrunRowLaneAsksWithinRowBudget` and the
423
+ * first-paint slice, both from `fetchWrunRowLaneRows`): the instance's payload, and for a chain instance under the flow
424
+ * lanes' `history` "today" the first instant of today named off the window's NEWEST bar exactly as each ask's K control
425
+ * names it (option-flow-bars.util `optionFlowTodayFields`: the trade date of the chart's newest bar on the chain's venue
426
+ * clock, option-trade-date.util `optionTodayStartMsByClock`, under `WRUN_OPTION_FLOW_TODAY_FIELD`), so the projection
427
+ * (wrun-option-contract-flow.util `wrunOptionFlowBarBeforeToday`) budgets exactly the bars the worker reads. The payload
428
+ * names no today (the control adds it per ask, off the chart): projected without it, every bar before today was
429
+ * projected in full though it reads nothing, and once the budget filled the older bars were cut and marked partial. The
430
+ * window's newest bar is the chart's on a full run and a reconcile, and never newer than it on a clamped window, so this
431
+ * today is never later than the worker's: a bar the worker reads is never projected at nothing. The trade-date rules
432
+ * load only for such an instance (they stay off the boot path).
433
+ */
434
+ export async function wrunRowLaneBudgetAcquisition(lane, extras, window) {
435
+ if (extras.history !== 'today' || lane.chain === undefined || wrunOptionFlowTodayFromOf(extras) !== undefined) {
436
+ return extras;
437
+ }
438
+ const newest = window.barOpens[window.barOpens.length - 1];
439
+ if (newest === undefined || !Number.isFinite(newest))
440
+ return extras;
441
+ const { optionTodayStartMsByClock, optionTradeDateClockOf } = await import('../../options/option-trade-date.util.js');
442
+ const clock = optionTradeDateClockOf({
443
+ exchange: wrunRowLaneChainExchange(lane, extras),
444
+ coin: typeof extras.coin === 'string' ? extras.coin : '',
445
+ });
446
+ // The K control's newest bar: its stamp, one interval long (option-flow-bars.util `optionFlowNewestBarOf`).
447
+ const todayFromMs = optionTodayStartMsByClock(clock, { openMs: newest, endMs: newest + window.intervalMs });
448
+ return Number.isFinite(todayFromMs) ? { ...extras, [WRUN_OPTION_FLOW_TODAY_FIELD]: todayFromMs } : extras;
449
+ }
326
450
  /** A row budget's cap in rows: the source answer budget (kscript-source-answer-budget.leaf) in rows of the lane's
327
451
  * answered width. One number for every lane, the row cache and the worker's cap; a lane never picks its own. */
328
452
  export function wrunRowLaneMaxRows(budget) {
@@ -446,23 +570,36 @@ function wrunCellMember(member) {
446
570
  /** A row's tuples as the host's exact adapter reads them: arrays of exactly `width` numbers, finite in every column
447
571
  * (the kit's rule for an exact class: any other tuple is dropped whole), or, for a lane naming its `finiteColumns`,
448
572
  * finite in those columns while any other column that is not a finite number reads NaN (om's adapter for such a
449
- * class: a null, a missing member or an infinity is NaN, never 0). */
573
+ * class: a null, a missing member or an infinity is NaN, never 0). A packed block (a Float64Array of `count x width`
574
+ * values, a worker's transfer) reads as its tuples back to back, each under the same rule; a block that is no whole
575
+ * number of tuples is skipped like any cell of another shape. */
450
576
  function exactTuples(row, lane) {
451
577
  const { width, finiteColumns } = lane;
452
578
  const tuples = [];
453
- for (let at = 1; at < row.length; at += 1) {
454
- const cell = row[at];
455
- if (!Array.isArray(cell) || cell.length !== width)
456
- continue;
579
+ const take = (cell) => {
457
580
  if (finiteColumns === undefined) {
458
581
  const tuple = cell.map(Number);
459
582
  if (tuple.every((value) => Number.isFinite(value)))
460
583
  tuples.push(tuple);
461
- continue;
584
+ return;
462
585
  }
463
586
  const tuple = cell.map(wrunCellMember);
464
587
  if (finiteColumns.every((column) => Number.isFinite(tuple[column])))
465
588
  tuples.push(tuple);
589
+ };
590
+ for (let at = 1; at < row.length; at += 1) {
591
+ const cell = row[at];
592
+ if (cell instanceof Float64Array) {
593
+ if (width < 1 || cell.length % width !== 0)
594
+ continue;
595
+ for (let offset = 0; offset < cell.length; offset += width) {
596
+ take(Array.from(cell.subarray(offset, offset + width)));
597
+ }
598
+ continue;
599
+ }
600
+ if (!Array.isArray(cell) || cell.length !== width)
601
+ continue;
602
+ take(cell);
466
603
  }
467
604
  return tuples;
468
605
  }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The cloud record's migration on read (`wrunCloudRecordOf`) and the pane side a sheet declares (`wrunSheetPositionOf`),
3
+ * moved out of wrun-cloud-record.util, which re-exports both: the kScript venue policy reads the migration
4
+ * synchronously at every run door (titan-charts' dataFetch guard among them, so on the code parsed before the first
5
+ * candle), and the util stays off that path (tests/utility/wrun/wrun-door.closure.spec.ts). A near-leaf (the identity
6
+ * leaf only); the header of wrun-cloud-record.util says what each read is for.
7
+ */
8
+ /** A sheet's chart placement, the registry loader's `packagePosition` read loosely (a record's persisted
9
+ * copy may be trimmed or malformed, a cloud batch's sheet is the cloud's): a declared `overlay` wins; a
10
+ * strategy homes on price; a plotted, non-inset output on the `overlay` panel homes on price; otherwise
11
+ * the primary output's panel decides. */
12
+ export declare function wrunSheetPositionOf(sheet: unknown): 'onchart' | 'offchart';
13
+ /**
14
+ * A record persisted for the protected pipeline before lane parity wave 3, read as the cloud record
15
+ * it is (the migration on read): its wire identity becomes the registry identity (a marketplace mount
16
+ * carried none; one it carried stays, its pane side kept), the slug is the registry's, the row source
17
+ * the cloud's, and the protected flag goes. Every other key rides as persisted. The pane side is the
18
+ * one the record carried, else its persisted sheet's (wrunSheetPositionOf); a record with neither (a
19
+ * marketplace mount) leaves it undecided, so the control mounts it on the price pane and the first
20
+ * batch's delivered sheet decides it, instead of a side guessed here being persisted for good. What
21
+ * else a registry identity naming the same tuple carried (the source mode a mount with the version doc
22
+ * in hand stamped, read by wrunOverlayEditable) stays: a cloud row persisted during the rollout carries
23
+ * `wrunRef` too (wrun-cloud-row-compat.util), and one that reaches the chart past the store's entry (a
24
+ * collab add, a paste) is read here. Undefined for a record that carries no wire identity (nothing to
25
+ * read again).
26
+ */
27
+ export declare function wrunCloudRecordOf(settings: unknown): Record<string, unknown> | undefined;
@@ -0,0 +1,71 @@
1
+ /**
2
+ * The cloud record's migration on read (`wrunCloudRecordOf`) and the pane side a sheet declares (`wrunSheetPositionOf`),
3
+ * moved out of wrun-cloud-record.util, which re-exports both: the kScript venue policy reads the migration
4
+ * synchronously at every run door (titan-charts' dataFetch guard among them, so on the code parsed before the first
5
+ * candle), and the util stays off that path (tests/utility/wrun/wrun-door.closure.spec.ts). A near-leaf (the identity
6
+ * leaf only); the header of wrun-cloud-record.util says what each read is for.
7
+ */
8
+ import { wrunRegistrySlugFor } from './wrun-overlay-identity.util.js';
9
+ function isRecord(value) {
10
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
11
+ }
12
+ function hasPackageName(ref) {
13
+ return isRecord(ref) && typeof ref.package === 'string' && ref.package !== '';
14
+ }
15
+ /** A sheet's chart placement, the registry loader's `packagePosition` read loosely (a record's persisted
16
+ * copy may be trimmed or malformed, a cloud batch's sheet is the cloud's): a declared `overlay` wins; a
17
+ * strategy homes on price; a plotted, non-inset output on the `overlay` panel homes on price; otherwise
18
+ * the primary output's panel decides. */
19
+ export function wrunSheetPositionOf(sheet) {
20
+ const read = sheet ?? {};
21
+ if (read.overlay === 'offchart')
22
+ return 'offchart';
23
+ if (read.overlay === 'onchart')
24
+ return 'onchart';
25
+ if (read.strategy !== undefined)
26
+ return 'onchart';
27
+ const outputs = Array.isArray(read.outputs)
28
+ ? read.outputs
29
+ : [];
30
+ if (outputs.some((output) => output?.plot !== '' && output?.plot !== 'inset' && output?.panel === 'overlay')) {
31
+ return 'onchart';
32
+ }
33
+ return outputs[0]?.panel === 'lower' ? 'offchart' : 'onchart';
34
+ }
35
+ /**
36
+ * A record persisted for the protected pipeline before lane parity wave 3, read as the cloud record
37
+ * it is (the migration on read): its wire identity becomes the registry identity (a marketplace mount
38
+ * carried none; one it carried stays, its pane side kept), the slug is the registry's, the row source
39
+ * the cloud's, and the protected flag goes. Every other key rides as persisted. The pane side is the
40
+ * one the record carried, else its persisted sheet's (wrunSheetPositionOf); a record with neither (a
41
+ * marketplace mount) leaves it undecided, so the control mounts it on the price pane and the first
42
+ * batch's delivered sheet decides it, instead of a side guessed here being persisted for good. What
43
+ * else a registry identity naming the same tuple carried (the source mode a mount with the version doc
44
+ * in hand stamped, read by wrunOverlayEditable) stays: a cloud row persisted during the rollout carries
45
+ * `wrunRef` too (wrun-cloud-row-compat.util), and one that reaches the chart past the store's entry (a
46
+ * collab add, a paste) is read here. Undefined for a record that carries no wire identity (nothing to
47
+ * read again).
48
+ */
49
+ export function wrunCloudRecordOf(settings) {
50
+ if (!isRecord(settings))
51
+ return undefined;
52
+ const { isProtectedScript: _protected, wrunRef, ...record } = settings;
53
+ if (!hasPackageName(wrunRef))
54
+ return undefined;
55
+ const packageName = wrunRef.package;
56
+ const version = typeof wrunRef.version === 'string' ? wrunRef.version : '';
57
+ const kept = isRecord(record.wrunRegistryRef) ? record.wrunRegistryRef : undefined;
58
+ const position = kept?.position === 'onchart' || kept?.position === 'offchart'
59
+ ? kept.position
60
+ : isRecord(record.wrunSheet)
61
+ ? wrunSheetPositionOf(record.wrunSheet)
62
+ : undefined;
63
+ const facts = kept?.package === packageName && kept.version === version ? { ...kept } : {};
64
+ delete facts.position;
65
+ return {
66
+ ...record,
67
+ customScriptId: wrunRegistrySlugFor(packageName, version),
68
+ wrunRegistryRef: { ...facts, package: packageName, version, ...(position ? { position } : {}) },
69
+ wrunRunTarget: 'cloud',
70
+ };
71
+ }
@@ -24,32 +24,15 @@
24
24
  * read loosely), for a sheet the loader did not download (a persisted copy, a cloud batch's).
25
25
  *
26
26
  * A near-leaf (the identity leaf only), so the loader, the factory and the catalog read one
27
- * definition.
27
+ * definition. The migration on read and the sheet's pane side live in wrun-cloud-record.leaf.ts and are
28
+ * re-exported here: the kScript venue policy reads the migration on the code parsed before the first
29
+ * candle, and this module stays off it (tests/utility/wrun/wrun-door.closure.spec.ts).
28
30
  */
31
+ export { wrunCloudRecordOf, wrunSheetPositionOf } from './wrun-cloud-record.leaf.js';
29
32
  /** `wrun-<package>-<version>` with every non-alphanumeric run collapsed to `-`,
30
33
  * byte-identical to tharamine's wrunCustomScriptSlug. Lossy on purpose (the
31
34
  * registry's publish door refuses colliding coordinates). */
32
35
  export declare function wrunCustomScriptSlug(packageId: string, version: string): string;
33
- /** A sheet's chart placement, the registry loader's `packagePosition` read loosely (a record's persisted
34
- * copy may be trimmed or malformed, a cloud batch's sheet is the cloud's): a declared `overlay` wins; a
35
- * strategy homes on price; a plotted, non-inset output on the `overlay` panel homes on price; otherwise
36
- * the primary output's panel decides. */
37
- export declare function wrunSheetPositionOf(sheet: unknown): 'onchart' | 'offchart';
38
- /**
39
- * A record persisted for the protected pipeline before lane parity wave 3, read as the cloud record
40
- * it is (the migration on read): its wire identity becomes the registry identity (a marketplace mount
41
- * carried none; one it carried stays, its pane side kept), the slug is the registry's, the row source
42
- * the cloud's, and the protected flag goes. Every other key rides as persisted. The pane side is the
43
- * one the record carried, else its persisted sheet's (wrunSheetPositionOf); a record with neither (a
44
- * marketplace mount) leaves it undecided, so the control mounts it on the price pane and the first
45
- * batch's delivered sheet decides it, instead of a side guessed here being persisted for good. What
46
- * else a registry identity naming the same tuple carried (the source mode a mount with the version doc
47
- * in hand stamped, read by wrunOverlayEditable) stays: a cloud row persisted during the rollout carries
48
- * `wrunRef` too (wrun-cloud-row-compat.util), and one that reaches the chart past the store's entry (a
49
- * collab add, a paste) is read here. Undefined for a record that carries no wire identity (nothing to
50
- * read again).
51
- */
52
- export declare function wrunCloudRecordOf(settings: unknown): Record<string, unknown> | undefined;
53
36
  /**
54
37
  * The settings the protected payload builder reads for a cloud record (the socket row source's default
55
38
  * transport builds the createScript payload through the technical-script control): the wire identity
@@ -24,78 +24,18 @@
24
24
  * read loosely), for a sheet the loader did not download (a persisted copy, a cloud batch's).
25
25
  *
26
26
  * A near-leaf (the identity leaf only), so the loader, the factory and the catalog read one
27
- * definition.
27
+ * definition. The migration on read and the sheet's pane side live in wrun-cloud-record.leaf.ts and are
28
+ * re-exported here: the kScript venue policy reads the migration on the code parsed before the first
29
+ * candle, and this module stays off it (tests/utility/wrun/wrun-door.closure.spec.ts).
28
30
  */
29
- import { wrunRegistryRefOf, wrunRegistrySlugFor } from './wrun-overlay-identity.util.js';
31
+ import { wrunRegistryRefOf } from './wrun-overlay-identity.util.js';
32
+ export { wrunCloudRecordOf, wrunSheetPositionOf } from './wrun-cloud-record.leaf.js';
30
33
  /** `wrun-<package>-<version>` with every non-alphanumeric run collapsed to `-`,
31
34
  * byte-identical to tharamine's wrunCustomScriptSlug. Lossy on purpose (the
32
35
  * registry's publish door refuses colliding coordinates). */
33
36
  export function wrunCustomScriptSlug(packageId, version) {
34
37
  return `wrun-${`${packageId}-${version}`.replace(/[^a-zA-Z0-9]+/g, '-')}`;
35
38
  }
36
- function isRecord(value) {
37
- return typeof value === 'object' && value !== null && !Array.isArray(value);
38
- }
39
- function hasPackageName(ref) {
40
- return isRecord(ref) && typeof ref.package === 'string' && ref.package !== '';
41
- }
42
- /** A sheet's chart placement, the registry loader's `packagePosition` read loosely (a record's persisted
43
- * copy may be trimmed or malformed, a cloud batch's sheet is the cloud's): a declared `overlay` wins; a
44
- * strategy homes on price; a plotted, non-inset output on the `overlay` panel homes on price; otherwise
45
- * the primary output's panel decides. */
46
- export function wrunSheetPositionOf(sheet) {
47
- const read = sheet ?? {};
48
- if (read.overlay === 'offchart')
49
- return 'offchart';
50
- if (read.overlay === 'onchart')
51
- return 'onchart';
52
- if (read.strategy !== undefined)
53
- return 'onchart';
54
- const outputs = Array.isArray(read.outputs)
55
- ? read.outputs
56
- : [];
57
- if (outputs.some((output) => output?.plot !== '' && output?.plot !== 'inset' && output?.panel === 'overlay')) {
58
- return 'onchart';
59
- }
60
- return outputs[0]?.panel === 'lower' ? 'offchart' : 'onchart';
61
- }
62
- /**
63
- * A record persisted for the protected pipeline before lane parity wave 3, read as the cloud record
64
- * it is (the migration on read): its wire identity becomes the registry identity (a marketplace mount
65
- * carried none; one it carried stays, its pane side kept), the slug is the registry's, the row source
66
- * the cloud's, and the protected flag goes. Every other key rides as persisted. The pane side is the
67
- * one the record carried, else its persisted sheet's (wrunSheetPositionOf); a record with neither (a
68
- * marketplace mount) leaves it undecided, so the control mounts it on the price pane and the first
69
- * batch's delivered sheet decides it, instead of a side guessed here being persisted for good. What
70
- * else a registry identity naming the same tuple carried (the source mode a mount with the version doc
71
- * in hand stamped, read by wrunOverlayEditable) stays: a cloud row persisted during the rollout carries
72
- * `wrunRef` too (wrun-cloud-row-compat.util), and one that reaches the chart past the store's entry (a
73
- * collab add, a paste) is read here. Undefined for a record that carries no wire identity (nothing to
74
- * read again).
75
- */
76
- export function wrunCloudRecordOf(settings) {
77
- if (!isRecord(settings))
78
- return undefined;
79
- const { isProtectedScript: _protected, wrunRef, ...record } = settings;
80
- if (!hasPackageName(wrunRef))
81
- return undefined;
82
- const packageName = wrunRef.package;
83
- const version = typeof wrunRef.version === 'string' ? wrunRef.version : '';
84
- const kept = isRecord(record.wrunRegistryRef) ? record.wrunRegistryRef : undefined;
85
- const position = kept?.position === 'onchart' || kept?.position === 'offchart'
86
- ? kept.position
87
- : isRecord(record.wrunSheet)
88
- ? wrunSheetPositionOf(record.wrunSheet)
89
- : undefined;
90
- const facts = kept?.package === packageName && kept.version === version ? { ...kept } : {};
91
- delete facts.position;
92
- return {
93
- ...record,
94
- customScriptId: wrunRegistrySlugFor(packageName, version),
95
- wrunRegistryRef: { ...facts, package: packageName, version, ...(position ? { position } : {}) },
96
- wrunRunTarget: 'cloud',
97
- };
98
- }
99
39
  /**
100
40
  * The settings the protected payload builder reads for a cloud record (the socket row source's default
101
41
  * transport builds the createScript payload through the technical-script control): the wire identity
@@ -48,12 +48,14 @@
48
48
  * change follow it, the way a timeframe or symbol param rewrites its pins.
49
49
  * A value equal to the baked `ticks_per_bar` writes nothing; the lane util
50
50
  * clamps it to 1..500 (`wrunVolumeProfileLaneExtras`).
51
- * - A chain view's params (OPTLOAD G5, wrun-option-views.util,
51
+ * - An option word's params (OPTLOAD G5, wrun-option-views.util,
52
52
  * `optionViewParamWrites`): on an `options_chain` or `option_contract_state`
53
- * input that declares views, each view param knob bound to a declared param
54
- * (`"@<param>"`, or `<knob>_param` beside a literal default) takes the
55
- * param's current value, the `ticks_per_bar` rule, so a settings change
56
- * asks the gateway with the new values.
53
+ * input that declares views, an `option_surface` input its `pick` and an
54
+ * `option_strikes` input its kit `fold` (the classes the words' own tables
55
+ * name), each param knob bound to a declared param (`"@<param>"`, or
56
+ * `<knob>_param` beside a literal default) takes the param's current value,
57
+ * the `ticks_per_bar` rule, so a settings change asks the gateway with the
58
+ * new values.
57
59
  * - The lane words (kit 0.77.0, `laneWordWrites`): `currency_param` and `when`.
58
60
  * - A Style page row (`__style__<output>__<property>`, an FE-only declared
59
61
  * input that never reaches any host) writes the output's `width`,
@@ -48,12 +48,14 @@
48
48
  * change follow it, the way a timeframe or symbol param rewrites its pins.
49
49
  * A value equal to the baked `ticks_per_bar` writes nothing; the lane util
50
50
  * clamps it to 1..500 (`wrunVolumeProfileLaneExtras`).
51
- * - A chain view's params (OPTLOAD G5, wrun-option-views.util,
51
+ * - An option word's params (OPTLOAD G5, wrun-option-views.util,
52
52
  * `optionViewParamWrites`): on an `options_chain` or `option_contract_state`
53
- * input that declares views, each view param knob bound to a declared param
54
- * (`"@<param>"`, or `<knob>_param` beside a literal default) takes the
55
- * param's current value, the `ticks_per_bar` rule, so a settings change
56
- * asks the gateway with the new values.
53
+ * input that declares views, an `option_surface` input its `pick` and an
54
+ * `option_strikes` input its kit `fold` (the classes the words' own tables
55
+ * name), each param knob bound to a declared param (`"@<param>"`, or
56
+ * `<knob>_param` beside a literal default) takes the param's current value,
57
+ * the `ticks_per_bar` rule, so a settings change asks the gateway with the
58
+ * new values.
57
59
  * - The lane words (kit 0.77.0, `laneWordWrites`): `currency_param` and `when`.
58
60
  * - A Style page row (`__style__<output>__<property>`, an FE-only declared
59
61
  * input that never reaches any host) writes the output's `width`,
@@ -91,7 +93,7 @@ import { WRUN_SOURCE_FIELD_WORDS, wrunInputGateOn } from './wrun-market-facts.ut
91
93
  import { wrunParamValuesFromSettings } from './wrun-param-values.util.js';
92
94
  import { bindWrunColorSettings } from './wrun-color-settings.lazy.js';
93
95
  import { WRUN_LEVELS_COLOR_PICKED_KEY } from './wrun-style-flags.util.js';
94
- import { wrunOptionViewParamKnobs } from './wrun-option-views.util.js';
96
+ import { WRUN_OPTION_LANE_WORDS, WRUN_OPTION_VIEWS, wrunOptionViewParamKnobs } from './wrun-option-views.util.js';
95
97
  import { findWrunVisibilityTarget, wrunVisibilitySectionOfPrefix, wrunVisibilityTargetAt, } from './wrun-visibility-table.js';
96
98
  import { isWrunHudViewerRowKey, packWrunColor, parseWrunColor, WRUN_HEATMAP_SENSITIVITY_ROW_RE, WRUN_HUD_LOOK_ROW_PREFIX, WRUN_HUD_LOOK_ROW_RE, } from './wrun-color-facts.util.js';
97
99
  // The key predicates and the colour parse are thin facts boot-path readers take without this
@@ -1093,11 +1095,24 @@ function viewParamBinding(source, knob) {
1093
1095
  ? reference.slice(1)
1094
1096
  : undefined;
1095
1097
  }
1098
+ let optionParamClasses;
1099
+ /** The classes whose declared words take params, off the words' own tables (OPTLOAD G5): a chain view's class
1100
+ * (`WRUN_OPTION_VIEWS`) and a per-bar word's (`WRUN_OPTION_LANE_WORDS`: the `option_surface` pick, the `option_strikes`
1101
+ * kit fold), never a list here, so a class the tables gain has its handles written the run it lands. */
1102
+ function wrunOptionParamClasses() {
1103
+ optionParamClasses ??= new Set([
1104
+ ...Object.values(WRUN_OPTION_VIEWS).map((spec) => spec.cls),
1105
+ ...Object.keys(WRUN_OPTION_LANE_WORDS),
1106
+ ]);
1107
+ return optionParamClasses;
1108
+ }
1096
1109
  /**
1097
- * The chain view param bindings (OPTLOAD G5, wrun-option-views.util): on an `options_chain` or `option_contract_state`
1098
- * input that declares views (`page_view` or `page_views`), every param knob of its views bound to a declared param
1099
- * takes that param's current value (`wrunValueParamSetting`: the setting, else the declared default), so the lane's
1100
- * ask, and a settings change's ask, carries the value the run computes with. A value equal to the knob's writes
1110
+ * The option word param bindings (OPTLOAD G5, wrun-option-views.util): on an input of a class whose words take params
1111
+ * (`wrunOptionParamClasses`: an `options_chain` or `option_contract_state` input declaring views, `page_view` or
1112
+ * `page_views`; an `option_surface` input declaring its `pick`, an `option_strikes` input its `fold`), every param knob
1113
+ * its declared words take (`wrunOptionViewParamKnobs`; a flag takes none) bound to a declared param takes that param's
1114
+ * current value (`wrunValueParamSetting`: the setting, else the declared default; a select's picked value), so the
1115
+ * lane's ask, and a settings change's ask, carries the value the run computes with. A value equal to the knob's writes
1101
1116
  * nothing; an unknown param or a value that is not a finite number writes nothing either, so the handle reaches the
1102
1117
  * lane, which refuses it by name.
1103
1118
  */
@@ -1106,7 +1121,7 @@ function optionViewParamWrites(metadata, settings) {
1106
1121
  const params = Array.isArray(metadata.params) ? metadata.params : [];
1107
1122
  const writes = [];
1108
1123
  for (const [name, source] of Object.entries(sources)) {
1109
- if (!isRecord(source) || (source.source !== 'options_chain' && source.source !== 'option_contract_state'))
1124
+ if (!isRecord(source) || !wrunOptionParamClasses().has(source.source))
1110
1125
  continue;
1111
1126
  for (const knob of wrunOptionViewParamKnobs(source)) {
1112
1127
  const bound = viewParamBinding(source, knob);
@@ -92,9 +92,11 @@ export interface WrunSourceCountMetadataLike {
92
92
  * - `stream_currency`: a lane stream's quote (`oi_candles`, `volume_profile_candles`: absent or any word but "USD"
93
93
  * reads Coin, the streams' default), one leg fetch per quote;
94
94
  * - `ticks_per_bar`: a profile stream's bucket size as the profile lane normalizes it (a whole number 1 to 500,
95
- * absent or invalid 1); an unresolved `"@<param>"` reads as written (its param resolves it before the run).
95
+ * absent or invalid 1); an unresolved `"@<param>"` reads as written (its param resolves it before the run);
96
+ * - the grouped flow knobs (OPTLOAD G3, each value its own read): numbers as they are, a setting's name as written, a
97
+ * flag true or false, `flow_expiries` absent "all", `span` absent "bar", `flow_history` (`history`) absent "window".
96
98
  */
97
- export type WrunKScriptPayloadKey = 'market' | 'odds' | 'interval' | 'expiries' | 'delta' | 'venue' | 'fund' | 'publisher' | 'series' | 'token' | 'asset' | 'ref' | 'min_size' | 'history' | 'scope' | 'dte' | 'moneyness' | 'chain_venue' | 'book' | 'stream_currency' | 'ticks_per_bar';
99
+ export type WrunKScriptPayloadKey = 'market' | 'odds' | 'interval' | 'expiries' | 'delta' | 'venue' | 'fund' | 'publisher' | 'series' | 'token' | 'asset' | 'ref' | 'min_size' | 'history' | 'scope' | 'dte' | 'moneyness' | 'chain_venue' | 'book' | 'stream_currency' | 'ticks_per_bar' | 'group' | 'flow_expiries' | 'strike_window_pct' | 'strike_rows' | 'min_volume' | 'min_premium' | 'split_dte' | 'fold_types' | 'span' | 'flow_history';
98
100
  /** How a wrun source class reads as a kScript source call. */
99
101
  export interface WrunKScriptSourceMapping {
100
102
  /** The kScript-equivalent source type (a SOURCE_TYPE_CONFIG key, or a K data