@orangecharts/wrun-chart-host 0.8.0 → 0.9.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 (145) hide show
  1. package/README.md +2 -1
  2. package/dist/constants/feature-flags.constants.d.ts +4 -0
  3. package/dist/constants/feature-flags.constants.js +27 -0
  4. package/dist/constants/marketCapabilities.constants.d.ts +14 -9
  5. package/dist/constants/marketCapabilities.constants.js +36 -13
  6. package/dist/constants/opra-compliance.constants.d.ts +14 -0
  7. package/dist/constants/opra-compliance.constants.js +14 -0
  8. package/dist/constants/option-venues.constants.d.ts +11 -6
  9. package/dist/constants/option-venues.constants.js +5 -2
  10. package/dist/host-env.d.ts +10 -4
  11. package/dist/host-ports.types.d.ts +39 -3
  12. package/dist/index.d.ts +1 -0
  13. package/dist/index.js +1 -0
  14. package/dist/interfaces/opra-realtime.interface.d.ts +13 -11
  15. package/dist/interfaces/opra-realtime.interface.js +10 -10
  16. package/dist/interfaces/wrun-runtime.interface.d.ts +34 -13
  17. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +53 -10
  18. package/dist/kscript-data/controls/live-trades-merge.util.js +81 -16
  19. package/dist/market-data/billing.interface.d.ts +138 -17
  20. package/dist/market-data/billing.interface.js +25 -8
  21. package/dist/market-data/venues/index.d.ts +3 -3
  22. package/dist/market-data/venues/opra.contract.copy.json +5 -3
  23. package/dist/market-data/venues/opra.d.ts +3 -3
  24. package/dist/market-data/venues/opra.js +5 -4
  25. package/dist/replay/replayLadder.js +3 -1
  26. package/dist/utility/chart/crypto-index.leaf.d.ts +2 -2
  27. package/dist/utility/chart/crypto-index.leaf.js +2 -2
  28. package/dist/utility/chart/index-mode-admission.util.js +9 -1
  29. package/dist/utility/chart/index-mode.util.d.ts +5 -2
  30. package/dist/utility/chart/index-mode.util.js +23 -13
  31. package/dist/utility/chart/kscript-venue-policy.util.d.ts +28 -21
  32. package/dist/utility/chart/kscript-venue-policy.util.js +30 -24
  33. package/dist/utility/chart/marketKind.util.d.ts +12 -10
  34. package/dist/utility/chart/marketKind.util.js +17 -7
  35. package/dist/utility/chart/om-panel-push-style.util.d.ts +7 -7
  36. package/dist/utility/chart/om-panel-push-style.util.js +17 -15
  37. package/dist/utility/chart/om-panel.util.js +6 -6
  38. package/dist/utility/chart/profile-block-size.util.d.ts +16 -0
  39. package/dist/utility/chart/profile-block-size.util.js +7 -0
  40. package/dist/utility/chart/quote-perp.leaf.d.ts +17 -0
  41. package/dist/utility/chart/quote-perp.leaf.js +20 -0
  42. package/dist/utility/chart/wrun-run-result.util.d.ts +5 -0
  43. package/dist/utility/chart/wrun-run-result.util.js +4 -1
  44. package/dist/utility/common/transformations.util.d.ts +7 -0
  45. package/dist/utility/common/transformations.util.js +11 -0
  46. package/dist/utility/options/option-venue.util.d.ts +3 -3
  47. package/dist/utility/options/option-venue.util.js +3 -3
  48. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +1 -1
  49. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +2 -2
  50. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.d.ts +2 -2
  51. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.js +5 -1
  52. package/dist/utility/wrun/sources/row-lane-registry.js +3 -2
  53. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +9 -3
  54. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +13 -5
  55. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +11 -0
  56. package/dist/utility/wrun/sources/row-lanes/option_prints.js +63 -9
  57. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +8 -0
  58. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +12 -0
  59. package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +5 -2
  60. package/dist/utility/wrun/sources/row-lanes/option_surface.js +5 -2
  61. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +11 -5
  62. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +31 -10
  63. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +33 -1
  64. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +95 -6
  65. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +25 -5
  66. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +55 -18
  67. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +146 -40
  68. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +16 -3
  69. package/dist/utility/wrun/wrun-batched-marks.util.js +30 -19
  70. package/dist/utility/wrun/wrun-batched-readout.util.d.ts +37 -9
  71. package/dist/utility/wrun/wrun-batched-readout.util.js +61 -15
  72. package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -0
  73. package/dist/utility/wrun/wrun-cell-capacity.leaf.d.ts +66 -0
  74. package/dist/utility/wrun/wrun-cell-capacity.leaf.js +86 -0
  75. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +147 -9
  76. package/dist/utility/wrun/wrun-chart-market-facts.util.js +345 -11
  77. package/dist/utility/wrun/wrun-color-facts.util.d.ts +19 -9
  78. package/dist/utility/wrun/wrun-color-facts.util.js +24 -14
  79. package/dist/utility/wrun/wrun-color-settings.util.d.ts +15 -4
  80. package/dist/utility/wrun/wrun-color-settings.util.js +31 -12
  81. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.d.ts +17 -0
  82. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.js +9 -0
  83. package/dist/utility/wrun/wrun-download-meter.util.d.ts +92 -0
  84. package/dist/utility/wrun/wrun-download-meter.util.js +122 -0
  85. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +6 -1
  86. package/dist/utility/wrun/wrun-draft-overlay.util.js +23 -3
  87. package/dist/utility/wrun/wrun-frames.js +5 -5
  88. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
  89. package/dist/utility/wrun/wrun-hosted-wire-caps.js +7 -0
  90. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +33 -17
  91. package/dist/utility/wrun/wrun-hud-looks.util.js +30 -16
  92. package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +8 -6
  93. package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +8 -6
  94. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -2
  95. package/dist/utility/wrun/wrun-live-intake.util.d.ts +6 -2
  96. package/dist/utility/wrun/wrun-live-intake.util.js +136 -21
  97. package/dist/utility/wrun/wrun-live-tick.util.js +91 -38
  98. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.d.ts +53 -0
  99. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.js +162 -0
  100. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +166 -48
  101. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +216 -33
  102. package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +51 -7
  103. package/dist/utility/wrun/wrun-market-size-defaults.util.js +314 -56
  104. package/dist/utility/wrun/wrun-option-prints.util.d.ts +41 -2
  105. package/dist/utility/wrun/wrun-option-prints.util.js +80 -13
  106. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +3 -0
  107. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +3 -0
  108. package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +23 -0
  109. package/dist/utility/wrun/wrun-option-strike-flow.util.js +55 -0
  110. package/dist/utility/wrun/wrun-option-views.util.d.ts +51 -7
  111. package/dist/utility/wrun/wrun-option-views.util.js +151 -28
  112. package/dist/utility/wrun/wrun-options-stop.util.d.ts +2 -1
  113. package/dist/utility/wrun/wrun-options-stop.util.js +3 -2
  114. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +3 -0
  115. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +31 -14
  116. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +22 -0
  117. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +7 -0
  118. package/dist/utility/wrun/wrun-overlay-recovery.util.js +25 -1
  119. package/dist/utility/wrun/wrun-overlay-result.util.d.ts +7 -1
  120. package/dist/utility/wrun/wrun-overlay-result.util.js +2 -0
  121. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +34 -6
  122. package/dist/utility/wrun/wrun-overlay-run.util.js +416 -171
  123. package/dist/utility/wrun/wrun-pack-widths.leaf.d.ts +4 -4
  124. package/dist/utility/wrun/wrun-pack-widths.leaf.js +4 -4
  125. package/dist/utility/wrun/wrun-pack.util.d.ts +7 -3
  126. package/dist/utility/wrun/wrun-pack.util.js +20 -9
  127. package/dist/utility/wrun/wrun-panel-style.util.d.ts +27 -15
  128. package/dist/utility/wrun/wrun-panel-style.util.js +42 -20
  129. package/dist/utility/wrun/wrun-param-map.util.d.ts +7 -6
  130. package/dist/utility/wrun/wrun-param-map.util.js +8 -5
  131. package/dist/utility/wrun/wrun-param-values.util.d.ts +10 -2
  132. package/dist/utility/wrun/wrun-param-values.util.js +2 -0
  133. package/dist/utility/wrun/wrun-prefix-lanes.util.js +2 -2
  134. package/dist/utility/wrun/wrun-refusal.util.js +10 -1
  135. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +7 -0
  136. package/dist/utility/wrun/wrun-source-rows.util.d.ts +4 -0
  137. package/dist/utility/wrun/wrun-source-rows.util.js +92 -40
  138. package/dist/utility/wrun/wrun-tape-source.util.d.ts +126 -50
  139. package/dist/utility/wrun/wrun-tape-source.util.js +193 -68
  140. package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +7 -5
  141. package/dist/utility/wrun/wrun-volume-profile-lane.util.js +8 -6
  142. package/dist/workers/utils/volume-profile.worker.util.d.ts +4 -1
  143. package/dist/workers/utils/volume-profile.worker.util.js +5 -2
  144. package/dist/workers/wrun/wrun-abi-host.js +3 -2
  145. package/package.json +11 -11
@@ -71,7 +71,8 @@ export const WRUN_HUD_RINGS_HEIGHT_PX = 86;
71
71
  export const WRUN_HUD_RING_STRENGTHS = [1, 0.7, 0.45];
72
72
  const WRUN_HUD_DEFAULT_CHROME = 'card';
73
73
  const WRUN_HUD_DEFAULT_TEXTURE = 'none';
74
- /** Today's title is uppercase and labels keep their case (LK06). */
74
+ /** A look that names no case prints its title uppercase and keeps its labels' case (LK06); the default
75
+ * look names `none` (sentence case). */
75
76
  const WRUN_HUD_DEFAULT_TITLE_CASE = 'upper';
76
77
  const WRUN_HUD_DEFAULT_LABEL_CASE = 'none';
77
78
  export function isWrunHudLook(value) {
@@ -95,21 +96,29 @@ export function wrunBlockDraw(kind, value) {
95
96
  const draws = WRUN_BLOCK_DRAWS[kind];
96
97
  return typeof value === 'string' && draws !== undefined && draws.includes(value) ? value : undefined;
97
98
  }
98
- const TODAY = {
99
+ /** The bare card: no surface, type or frame word of its own. */
100
+ const BARE_ROW = {
99
101
  draws: {},
100
102
  chrome: 'card',
101
103
  texture: 'none',
102
104
  home: false,
103
105
  };
104
- /** The frozen look table (g3 addendum, "The look table"). `default` is
105
- * today's card: the g3 HUD defaults with the g3 drawings (arc, line, bar,
106
- * capsule), adaptive. Where the table names no accent and the look's mock
106
+ /** The frozen look table (g3 addendum, "The look table"). `default` is the
107
+ * house look (C4), worn by every card without a look word: sentence case,
108
+ * pills as words, no row swatch, no label over a titled card's headline; its
109
+ * surface and type are the stylesheet's. Where the table names no accent and the look's mock
107
110
  * paints one colour throughout, the row carries that colour as its accent
108
111
  * (broadsheet newsprint ink, classic's navy, phosphor's green): without it
109
112
  * LK03 would hand the look the app's accent (glass keeps the app's: its
110
113
  * mock's reds and greens are reading tones, not an accent). */
111
114
  export const WRUN_HUD_LOOK_TABLE = {
112
- default: { ...TODAY, draws: { gauge: 'arc', spark: 'line', meter: 'bar', pill: 'capsule' } },
115
+ default: {
116
+ ...BARE_ROW,
117
+ titleCase: 'none',
118
+ draws: { gauge: 'arc', spark: 'line', meter: 'bar', pill: 'text' },
119
+ headlineLabel: false,
120
+ rowSwatch: false,
121
+ },
113
122
  glass: {
114
123
  background: '#1c1c1ee6',
115
124
  borderColor: '#ffffff29',
@@ -369,17 +378,18 @@ function backgroundCss(entry, row, light, theme) {
369
378
  return undefined;
370
379
  }
371
380
  /**
372
- * The style of one HUD entry: declared word > viewer pick > look row >
373
- * today's (LK01, LK09). Every value lands in `css` as a custom property the
374
- * card's base rules read (today's value is each rule's fallback), so an
375
- * entry without a look and without a word resolves to an empty style.
381
+ * The style of one HUD entry: declared word > viewer pick > look row, the
382
+ * `default` row when neither the viewer nor the author named a look (LK01,
383
+ * LK09, C4). Every value lands in `css` as a custom property the card's base
384
+ * rules read, so an entry without a look and without a word resolves to an
385
+ * empty `css`: the default look's surface and type are the stylesheet's.
376
386
  */
377
387
  export function resolveWrunHudLook(entry, options = {}) {
378
388
  const { theme } = options;
379
389
  const authorLook = isWrunHudLook(entry.look) ? entry.look : undefined;
380
390
  const viewerPick = isWrunHudLook(options.viewerPick) ? options.viewerPick : undefined;
381
- const look = viewerPick ?? authorLook;
382
- const row = look === undefined ? TODAY : WRUN_HUD_LOOK_TABLE[look];
391
+ const look = viewerPick ?? authorLook ?? 'default';
392
+ const row = WRUN_HUD_LOOK_TABLE[look];
383
393
  const light = options.light === true;
384
394
  const css = {};
385
395
  // Surface
@@ -451,11 +461,11 @@ export function resolveWrunHudLook(entry, options = {}) {
451
461
  if (textGlow > 0)
452
462
  css['--wrun-hud-glow'] = `0 0 ${textGlow}px currentColor`;
453
463
  // Accent (LK03): a declared colour, the ladder's rung, the look's, else the
454
- // theme's for any look but `default` (today's marks keep the app accent).
464
+ // theme's for any look but `default` (whose marks ink in the text colour).
455
465
  const accentWord = colorWord(entry.accent_color) ??
456
466
  accentRung(entry, options.snapshot) ??
457
467
  row.accentColor ??
458
- ((look !== undefined && look !== 'default') || entry.accent_color_by !== undefined ? 'theme.accent' : undefined);
468
+ (look !== 'default' || entry.accent_color_by !== undefined ? 'theme.accent' : undefined);
459
469
  const accent = accentWord === undefined ? undefined : paint(accentWord, theme);
460
470
  if (accent !== undefined) {
461
471
  css['--wrun-hud-accent'] = accent;
@@ -469,7 +479,7 @@ export function resolveWrunHudLook(entry, options = {}) {
469
479
  `linear-gradient(90deg, ${row.windowBar.map((stop) => paint(stop, theme)).join(', ')})`;
470
480
  }
471
481
  return {
472
- ...(look !== undefined ? { look } : {}),
482
+ look,
473
483
  ...(authorLook !== undefined ? { authorLook } : {}),
474
484
  ...(viewerPick !== undefined ? { viewerPick } : {}),
475
485
  ...(fontFamily !== undefined ? { fontFamily } : {}),
@@ -485,6 +495,8 @@ export function resolveWrunHudLook(entry, options = {}) {
485
495
  ...(row.sparkHeight !== undefined ? { sparkHeight: row.sparkHeight } : {}),
486
496
  ...(row.sparkBaseline !== undefined ? { sparkBaseline: row.sparkBaseline } : {}),
487
497
  ...(row.rowLeader !== undefined ? { rowLeader: row.rowLeader } : {}),
498
+ ...(row.headlineLabel === false ? { headlineLabel: false } : {}),
499
+ ...(row.rowSwatch === false ? { rowSwatch: false } : {}),
488
500
  ...(offset !== undefined ? { offset } : {}),
489
501
  ...(opacity !== undefined ? { opacity } : {}),
490
502
  css,
@@ -502,7 +514,7 @@ const FALLBACK_THEME = {
502
514
  };
503
515
  /**
504
516
  * The defaults the look in force gives a tile of `kind` (undefined fields
505
- * keep today's drawing). `cardMark` is the card's first meter mark, the
517
+ * keep the kit's own drawing). `cardMark` is the card's first meter mark, the
506
518
  * baseline spark bars grow from on a look that says so.
507
519
  */
508
520
  export function wrunHudTileLookDefaults(style, kind, cardMark) {
@@ -521,6 +533,8 @@ export function wrunHudTileLookDefaults(style, kind, cardMark) {
521
533
  }
522
534
  if (kind === 'rows' && style.rowLeader !== undefined)
523
535
  defaults.leader = style.rowLeader;
536
+ if (kind === 'rows' && style.rowSwatch === false)
537
+ defaults.swatch = false;
524
538
  return defaults;
525
539
  }
526
540
  /** The luminance of a palette's background, read as a light theme above
@@ -1,17 +1,18 @@
1
1
  /**
2
2
  * The browser-run wrun overlay runtime that the chart's boot graph reaches only through
3
3
  * `wrun-overlay-lifecycle.lazy.ts`: the lifecycle door (with the recovery ladders and the replay
4
- * lane behind it) and the live tick lane, and through them the run pass. None of it can do
5
- * anything for an overlay without a driver, and only the wrun loaders register drivers (behind the
6
- * Indicators gate), so this graph stays out of the pre-candle closure and evaluates with the first
7
- * loader instead.
4
+ * lane behind it), the live tick lane and the live intake's market rule and gap mark (with the row
5
+ * builder and the source lanes the intake reads), and through them the run pass. None of it can do
6
+ * anything for an overlay without a driver or a live session, and only the wrun loaders register
7
+ * drivers (behind the Indicators gate) and run the pass that opens a session, so this graph stays
8
+ * out of the pre-candle closure and evaluates with the first loader instead.
8
9
  *
9
10
  * The loaders import this module statically and bind it (`bindWrunLifecycleRuntime`) before they
10
11
  * register a driver. Two things follow, and both must hold before any driver exists:
11
12
  * - the import-time registrations of these modules (the door's compute-succeeded and teardown
12
13
  * hooks, the recovery ladders' hooks, the replay lane's teardown, the live tick's drain
13
- * requester, teardown hook and rows identity reader) are in place, exactly as when they
14
- * evaluated at boot;
14
+ * requester, teardown hook and rows identity reader, the live intake's teardown hook, the
15
+ * poll-lane registry's peer bind) are in place, exactly as when they evaluated at boot;
15
16
  * - the boot-side accessor answers synchronously for a driver id, so a trigger runs in the same
16
17
  * turn as before.
17
18
  *
@@ -19,3 +20,4 @@
19
20
  */
20
21
  export { healWrunOverlayIfIdle, pauseWrunOverlay, requestWrunOverlayRerun, requestWrunOverlayRerunsForChart, resumeWrunOverlay, resyncWrunOverlayAfterWake, } from './wrun-overlay-lifecycle.util.js';
21
22
  export { feedWrunRideBookRows, scheduleWrunOverlayLiveTick } from './wrun-live-tick.util.js';
23
+ export { markWrunLiveGap, wrunLiveFrameMarketAdmitted } from './wrun-live-intake.util.js';
@@ -1,17 +1,18 @@
1
1
  /**
2
2
  * The browser-run wrun overlay runtime that the chart's boot graph reaches only through
3
3
  * `wrun-overlay-lifecycle.lazy.ts`: the lifecycle door (with the recovery ladders and the replay
4
- * lane behind it) and the live tick lane, and through them the run pass. None of it can do
5
- * anything for an overlay without a driver, and only the wrun loaders register drivers (behind the
6
- * Indicators gate), so this graph stays out of the pre-candle closure and evaluates with the first
7
- * loader instead.
4
+ * lane behind it), the live tick lane and the live intake's market rule and gap mark (with the row
5
+ * builder and the source lanes the intake reads), and through them the run pass. None of it can do
6
+ * anything for an overlay without a driver or a live session, and only the wrun loaders register
7
+ * drivers (behind the Indicators gate) and run the pass that opens a session, so this graph stays
8
+ * out of the pre-candle closure and evaluates with the first loader instead.
8
9
  *
9
10
  * The loaders import this module statically and bind it (`bindWrunLifecycleRuntime`) before they
10
11
  * register a driver. Two things follow, and both must hold before any driver exists:
11
12
  * - the import-time registrations of these modules (the door's compute-succeeded and teardown
12
13
  * hooks, the recovery ladders' hooks, the replay lane's teardown, the live tick's drain
13
- * requester, teardown hook and rows identity reader) are in place, exactly as when they
14
- * evaluated at boot;
14
+ * requester, teardown hook and rows identity reader, the live intake's teardown hook, the
15
+ * poll-lane registry's peer bind) are in place, exactly as when they evaluated at boot;
15
16
  * - the boot-side accessor answers synchronously for a driver id, so a trigger runs in the same
16
17
  * turn as before.
17
18
  *
@@ -19,3 +20,4 @@
19
20
  */
20
21
  export { healWrunOverlayIfIdle, pauseWrunOverlay, requestWrunOverlayRerun, requestWrunOverlayRerunsForChart, resumeWrunOverlay, resyncWrunOverlayAfterWake, } from './wrun-overlay-lifecycle.util.js';
21
22
  export { feedWrunRideBookRows, scheduleWrunOverlayLiveTick } from './wrun-live-tick.util.js';
23
+ export { markWrunLiveGap, wrunLiveFrameMarketAdmitted } from './wrun-live-intake.util.js';
@@ -65,12 +65,14 @@ export interface WrunRunSettledEvent {
65
65
  /** A failed run's identity (its window and settings), set by the run's settle producer. */
66
66
  failedIdentity?: WrunRunFailedIdentity;
67
67
  }
68
- /** One secondary lane a run treated as empty instead of failing the run. */
68
+ /** One secondary lane a run treated as empty instead of failing the run, or (cause `filling`) one that drew its
69
+ * first-paint slice alone while the rest of its window is still out: a planned fill, never a failure, which the
70
+ * source ladder adopts without spending an attempt (wrun-overlay-recovery.util). */
69
71
  export interface WrunDegradedLane {
70
72
  lane: string;
71
73
  /** The source type name the kScript degrade registry and its chips use. */
72
74
  kType: string;
73
75
  label: string;
74
- cause: 'budget' | 'declined' | 'empty' | 'error';
76
+ cause: 'budget' | 'declined' | 'empty' | 'error' | 'filling';
75
77
  retryable: boolean;
76
78
  }
@@ -47,9 +47,13 @@ export interface WrunLiveFrame {
47
47
  bucketed?: boolean;
48
48
  }
49
49
  export type WrunLiveIntakeVerdict = 'queued' | 'ignored:no-context' | 'ignored:foreign' | 'ignored:undeclared' | 'ignored:replaying' | 'ignored:ineligible' | 'ignored:generation'
50
- /** A raw print below the tape acquisition's `minSize`: it can never fold (the kScript fan-out's
51
- * floor), so it takes no queue slot and arms no drain. */
50
+ /** A raw print below the tape acquisition's floor (its `minSize`, or its dollar value below its
51
+ * `minValue`): it can never fold, so it takes no queue slot and arms no drain. */
52
52
  | 'ignored:below-floor'
53
+ /** A print on a dollar tape (`minValue`, C-DOLLAR) whose market's dollar unit the run head could not
54
+ * prove: no live print is valued by a guess, so none folds (the history still serves the gateway's
55
+ * own dollar values). */
56
+ | 'ignored:value-unproven'
53
57
  /** The tick's own verdict: the overlay is paused or its execution guard tripped. */
54
58
  | 'ignored:paused';
55
59
  /** `pinned-close`: a pinned coarser leg's candle closed (armed by the tick
@@ -73,9 +73,11 @@ import { findMonday, getDecimalPlaces } from '../chart/titan-constants.pin.js';
73
73
  import { Intervals } from '../../constants/interval.constants.js';
74
74
  import { FUNDING_INTERVAL_MAP } from '../../constants/overlay-data.constants.js';
75
75
  import { mergeLiveOhlcvDataPoint } from '../../kscript-data/controls/live-ohlcv-merge.util.js';
76
- import { mergeLiveTradesDataPoint, readLiveTradePrint, tradesBarStartMs, tradesBelowLargeFloor, tradesLargeHistoryAnswers, } from '../../kscript-data/controls/live-trades-merge.util.js';
76
+ import { mergeLiveTradesDataPoint, readLiveTradePrint, tradesBarStartMs, tradesBelowLargeFloor, tradesLargeHistoryAnswers, tradesTapeCellSize, tradesTapeFloorValuesPrints, } from '../../kscript-data/controls/live-trades-merge.util.js';
77
77
  import { liveAmountUsd, peekOptionTradeUnits } from '../options/option-trade-units.util.js';
78
78
  import { parseWrunTapeHistory, wrunTapeHistoryOf } from './wrun-tape-source.util.js';
79
+ import { wrunDollarUnitReader } from './wrun-dollar-unit-port.leaf.js';
80
+ import { wrunChartHostEnv } from '../../host-env.js';
79
81
  import { v2LiveTradePrintBelowFloor } from '../chart/kscript-live-coalesce.util.js';
80
82
  import { roundObTimestamp } from '../common/data-processing.util.js';
81
83
  import { liveFeedSeriesMatchesChartStream } from '../chart/live-feed-series-match.leaf.js';
@@ -810,22 +812,24 @@ function foldVolumeProfile(base, points, intervalMs, acquisition, market) {
810
812
  return foldResult(mergeLaneRows(base, replaced, added), touched);
811
813
  }
812
814
  /** The tape fold: K_TRADES's live fold per raw print (`mergeLiveTradesDataPoint`), each point onto
813
- * the rows as folded so far, under the acquisition's `minSize`. The leaf answers a NEW container
814
- * with the touched row new and every other row shared, or null for a rejected print (the rows
815
- * stand); the touched bucket is the newest row (a fold never writes behind it). A bucket the fold
816
- * capped (its newest 20k prints kept, the oldest dropped) is reported: its row is truncated, and
817
- * a block is never truncated, so the tick refuses it by name where the kScript lane only warns. On
818
- * the large lane the large-print table's floor applies too (`largeFloor`, the chart's market for a
819
- * frame that names none). */
815
+ * the rows as folded so far, under the acquisition's floor (`wrunTapeLiveFloorOf`: its `minSize`,
816
+ * or its dollar `minValue`, where each cell's size is the print's dollar value). The leaf answers a
817
+ * NEW container with the touched row new and every other row shared, or null for a rejected print
818
+ * (the rows stand); the touched bucket is the newest row (a fold never writes behind it). A bucket
819
+ * the fold capped (its newest 20k prints kept, the oldest dropped) is reported: its row is
820
+ * truncated, and a block is never truncated, so the tick refuses it by name where the kScript lane
821
+ * only warns. On the large lane the large-print table's floor applies too (`largeFloor`, the
822
+ * chart's market for a frame that names none). */
820
823
  function foldTape(base, points, intervalMs, acquisition, market) {
821
824
  let rows = base;
822
825
  const touched = new Set();
823
826
  const capped = new Set();
824
827
  const largeFloor = acquisition.large === true ? largeFloorMarketOf(market ?? {}) : undefined;
828
+ const floor = wrunTapeLiveFloorOf(acquisition, market);
825
829
  for (const point of points) {
826
830
  let cappedNow = false;
827
831
  const next = mergeLiveTradesDataPoint(rows, point, intervalMs, {
828
- minSize: acquisition.minSize,
832
+ ...floor,
829
833
  largeFloor,
830
834
  onCapped: () => {
831
835
  cappedNow = true;
@@ -923,6 +927,99 @@ function largeFloorMarketOf(market) {
923
927
  const optionUnits = peekOptionTradeUnits({ exchange, symbol });
924
928
  return optionUnits ? { ...market, optionUnits } : market;
925
929
  }
930
+ /** The market facts' dollar unit reader through its port (wrun-dollar-unit-port.leaf): live-feed loads this module
931
+ * before the first candle, and the facts module stays out of that closure. A dollar tape's full run loads the facts
932
+ * module before its live session starts, so the reader is bound by then; unbound, the module is loaded and the unit
933
+ * reads as not known yet. */
934
+ function wrunLiveDollarUnitReader() {
935
+ const reader = wrunDollarUnitReader();
936
+ if (reader === undefined)
937
+ void import('./wrun-chart-market-facts.util.js').catch(() => undefined);
938
+ return reader;
939
+ }
940
+ /** The dollar unit a dollar tape's live prints are priced with (C-DOLLAR) when its full run froze none: the market's
941
+ * dollar unit as the market facts prove it now (wrun-chart-market-facts.util `wrunMarketDollarUnit`, synchronous over
942
+ * the reads the run warmed), so a read that failed at the run (a directory row, the registry record) or a continuous
943
+ * chart's lead not known yet is resolved again on the session's own prints. A unit still unknown asks the reads
944
+ * again, never more often than their own retry windows allow; undefined until one answers. */
945
+ function wrunTapeLiveValuePerUnit(market) {
946
+ if (typeof market?.exchange !== 'string' || typeof market.symbol !== 'string')
947
+ return undefined;
948
+ const reader = wrunLiveDollarUnitReader();
949
+ if (reader === undefined)
950
+ return undefined;
951
+ const unit = reader.unit(market);
952
+ if (unit.kind === 'dollars')
953
+ return unit.unit;
954
+ if (unit.transient)
955
+ void reader.warm(market);
956
+ return undefined;
957
+ }
958
+ /** The floor the tape's live rules read (live-trades-merge `tradesTapeCellSize`, shared by the enqueue and the fold)
959
+ * off its acquisition, the K_TRADES payload the history fetch used: its `minSize`, or its dollar `minValue` with the
960
+ * market's `valuePerUnit` the full run priced (C-DOLLAR), else the one the market facts prove now
961
+ * (`wrunTapeLiveValuePerUnit`: never a transient unknown frozen for the session) and, on an option contract of a
962
+ * plain option venue, the registry trade units as answered (a dollar floor values an option print by its USD
963
+ * premium). */
964
+ function wrunTapeLiveFloorOf(acquisition, market) {
965
+ const floor = { minSize: acquisition?.minSize };
966
+ if (acquisition?.minValue === undefined)
967
+ return floor;
968
+ const { exchange, symbol } = market ?? {};
969
+ const optionUnits = typeof exchange === 'string' && typeof symbol === 'string' ? peekOptionTradeUnits({ exchange, symbol }) : null;
970
+ const frozen = Number(acquisition.valuePerUnit);
971
+ const valuePerUnit = Number.isFinite(frozen) && frozen > 0 ? frozen : optionUnits ? undefined : wrunTapeLiveValuePerUnit(market);
972
+ const priced = { minValue: acquisition.minValue, valuePerUnit };
973
+ return optionUnits ? { ...priced, optionUnits } : priced;
974
+ }
975
+ /** The dollar tapes the intake recorded as unable to value a live print (no `valuePerUnit` yet), by overlay, so the
976
+ * ring names each once (C-DOLLAR: such prints never fold). */
977
+ const wrunTapeUnvaluedNoted = new Set();
978
+ /** Note, once per overlay, a dollar tape whose live prints cannot be valued yet: they never fold (no guessed
979
+ * multiplier), their bars are owed a repair (`wrunTapePrintUnvalued`), and the history rows still carry the gateway's
980
+ * own dollar value. */
981
+ function noteWrunTapeUnvalued(indicatorId, context) {
982
+ if (wrunTapeUnvaluedNoted.has(indicatorId))
983
+ return;
984
+ wrunTapeUnvaluedNoted.add(indicatorId);
985
+ // Advisory: a host that binds no diagnostics port (a spec, a lean host) never fails the intake over a note.
986
+ try {
987
+ const diagnostics = wrunChartHostEnv().diagnostics;
988
+ if (!diagnostics.debugEnabled())
989
+ return;
990
+ diagnostics.debug('wrun-tape-live-value-unproven', {
991
+ indicatorId,
992
+ market: context.marketIdentity ?? null,
993
+ minValue: context.acquisition.tape?.minValue ?? null,
994
+ });
995
+ }
996
+ catch {
997
+ // The verdict (`ignored:value-unproven`) still counts in the intake's stats.
998
+ }
999
+ }
1000
+ /** A live print a dollar tape could not value (its unit not proven yet): it never folds, and its bar is owed the
1001
+ * print, exactly like a print the queue cap dropped (`pushAdditive`): the drain has the reconcile restore the bar
1002
+ * from the large-print table where it holds the market (`tape-lost`), else the tick refuses the bar by name
1003
+ * (`tapeLostBuckets`). A unit that no read can ever prove by now (a later answer: no point value, a quote that is no
1004
+ * dollar) values no print of the session again, so its bar is refused by name at once, never re-asked on every drain
1005
+ * (the Resume's full run then refuses the tape by name, `wrun_tape_value_unproven`). A block is never served short
1006
+ * of a print it should hold. */
1007
+ function wrunTapePrintUnvalued(intake, context, intervalMs, data) {
1008
+ if (!(intervalMs > 0))
1009
+ return;
1010
+ const print = readLiveTradePrint(data);
1011
+ if (print === null)
1012
+ return;
1013
+ const bucket = tradesBarStartMs(print.tsMs, intervalMs, print.exchange);
1014
+ const market = context.market;
1015
+ const unit = typeof market?.exchange === 'string' && typeof market.symbol === 'string'
1016
+ ? wrunLiveDollarUnitReader()?.unit(market)
1017
+ : undefined;
1018
+ if (unit?.kind === 'unproven' && !unit.transient)
1019
+ (context.tapeLostBuckets ??= new Set()).add(bucket);
1020
+ else
1021
+ intake.tapeLost.add(bucket);
1022
+ }
926
1023
  /** The large-print table's floor at the tape enqueue (the fold applies it again): on the large
927
1024
  * lane, a print under the table's floor (`tradesBelowLargeFloor`: a dollar-quoted market's notional,
928
1025
  * a CME Group root's contracts, an option book's premium; the frame's envelope names the market,
@@ -934,9 +1031,11 @@ function wrunTapePrintBelowLargeFloor(context, data) {
934
1031
  return (print !== null && tradesBelowLargeFloor(print, context.market ? largeFloorMarketOf(context.market) : undefined));
935
1032
  }
936
1033
  /** Whether a reconcile can restore the tape prints the queue cap dropped: the large lane with a
937
- * history to re-ask (not the live edge, history "0") on a market the re-ask answers
938
- * (`tradesLargeHistoryAnswers`: the table on a dollar quote, the raw tape on a CME Group root the
939
- * table skips; a context that names no normalized symbol is assumed held). */
1034
+ * history to re-ask (not the live edge, history "0") on a market the re-ask answers under the
1035
+ * acquisition's floor (`tradesLargeHistoryAnswers`, the lane rule `tradesLaneLimits` the request
1036
+ * builder reads: the table on a dollar quote, the raw tape on a CME Group root the table skips under
1037
+ * a size floor and never under a dollar floor, which that lane serves no history to; a context that
1038
+ * names no normalized symbol is assumed held). */
940
1039
  function wrunTapeLostRestorable(context) {
941
1040
  const acquisition = context.acquisition.tape;
942
1041
  if (acquisition?.large !== true)
@@ -949,7 +1048,7 @@ function wrunTapeLostRestorable(context) {
949
1048
  catch {
950
1049
  // The full run validated the history; a malformed record reads as the live edge.
951
1050
  }
952
- return historySec > 0 && tradesLargeHistoryAnswers(context.market ?? {});
1051
+ return historySec > 0 && tradesLargeHistoryAnswers(context.market ?? {}, { minValue: acquisition.minValue });
953
1052
  }
954
1053
  function pushAdditive(intake, lane, point) {
955
1054
  let queue = intake.additive[lane];
@@ -1252,14 +1351,28 @@ export function enqueueWrunLiveFrame(a) {
1252
1351
  // BTC floor on a perp) must never read as a dead feed. `ignored:below-floor` counts the turned
1253
1352
  // away ones, `queued` what remains.
1254
1353
  intake.stats.frames.tape = (intake.stats.frames.tape ?? 0) + 1;
1255
- // The kScript fan-out's floor: a raw print below the acquisition's minSize can never fold, so it
1256
- // never takes a slot a qualifying print needs in the capped queue (the fold applies it again).
1257
- // The large-print table's own floor too: a print under it (a dollar-quoted market's notional, a
1258
- // CME Group root's contracts) would fold live and vanish when the next reconcile answers the
1259
- // bucket from the table.
1260
- const floor = Number(context.acquisition.tape?.minSize);
1261
- if (v2LiveTradePrintBelowFloor(a.frame.data, Number.isFinite(floor) ? floor : 0) ||
1262
- wrunTapePrintBelowLargeFloor(context, a.frame.data)) {
1354
+ // The tape's own floor (`tradesTapeCellSize`, the rule the fold applies again): a print below the
1355
+ // acquisition's minSize, or one whose dollar value is below its minValue, can never fold, so it
1356
+ // never takes a slot a qualifying print needs in the capped queue. A dollar tape that cannot value
1357
+ // a print at all (C-DOLLAR: no proven dollar unit) folds none, recorded once by name. The
1358
+ // large-print table's own floor too: a print under it (a dollar-quoted market's notional, a CME
1359
+ // Group root's contracts) would fold live and vanish when the next reconcile answers the bucket
1360
+ // from the table.
1361
+ const floor = wrunTapeLiveFloorOf(context.acquisition.tape, context.market);
1362
+ if (!tradesTapeFloorValuesPrints(floor)) {
1363
+ noteWrunTapeUnvalued(a.indicatorId, context);
1364
+ wrunTapePrintUnvalued(intake, context, intervalMs, a.frame.data);
1365
+ return noteVerdict(a.indicatorId, 'ignored:value-unproven', context);
1366
+ }
1367
+ // A frame the fold cannot read as a print (no side, a bad stamp) is judged by its raw amount under a
1368
+ // size floor, as it always was, and never folds under a dollar floor.
1369
+ const print = readLiveTradePrint(a.frame.data);
1370
+ const minSize = Number(floor.minSize);
1371
+ const belowTapeFloor = print === null
1372
+ ? floor.minValue !== undefined ||
1373
+ v2LiveTradePrintBelowFloor(a.frame.data, Number.isFinite(minSize) ? minSize : 0)
1374
+ : tradesTapeCellSize(print, floor) === null;
1375
+ if (belowTapeFloor || wrunTapePrintBelowLargeFloor(context, a.frame.data)) {
1263
1376
  return noteVerdict(a.indicatorId, 'ignored:below-floor', context);
1264
1377
  }
1265
1378
  pushAdditive(intake, 'tape', a.frame.data);
@@ -1772,6 +1885,7 @@ export function takeWrunLiveGaps(indicatorId) {
1772
1885
  * teardown hook at import time. */
1773
1886
  export function disposeWrunLiveIntake(indicatorId) {
1774
1887
  intakes.delete(indicatorId);
1888
+ wrunTapeUnvaluedNoted.delete(indicatorId);
1775
1889
  }
1776
1890
  /**
1777
1891
  * The tick lane's accounting into the overlay's stats: computes carry the
@@ -2012,6 +2126,7 @@ export function wrunLiveContextSnapshot(indicatorId) {
2012
2126
  }
2013
2127
  export function __resetWrunLiveIntakeForTests() {
2014
2128
  intakes.clear();
2129
+ wrunTapeUnvaluedNoted.clear();
2015
2130
  drainRequester = null;
2016
2131
  }
2017
2132
  // Registered at import: a torn-down overlay's queues, gaps and stats go