@orangecharts/wrun-chart-host 0.15.0 → 0.16.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.
- package/README.md +1 -0
- package/dist/constants/economic.constants.d.ts +2 -0
- package/dist/constants/economic.constants.js +2 -0
- package/dist/constants/feature-flags.constants.d.ts +10 -0
- package/dist/constants/feature-flags.constants.js +52 -4
- package/dist/constants/feature-limits.constants.d.ts +72 -4
- package/dist/constants/feature-limits.constants.js +98 -20
- package/dist/constants/interval.constants.js +5 -0
- package/dist/constants/kscript-data-interval-restrictions.constants.d.ts +12 -0
- package/dist/constants/kscript-data-interval-restrictions.constants.js +14 -0
- package/dist/constants/typed-width-fold.leaf.d.ts +50 -0
- package/dist/constants/typed-width-fold.leaf.js +99 -0
- package/dist/constants/typed-width-source.leaf.d.ts +24 -0
- package/dist/constants/typed-width-source.leaf.js +126 -0
- package/dist/constants/typed-width.leaf.d.ts +57 -0
- package/dist/constants/typed-width.leaf.js +78 -0
- package/dist/host-env.d.ts +10 -0
- package/dist/host-env.js +7 -0
- package/dist/host-ports.types.d.ts +11 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/interfaces/kscript-diagnostics.interface.d.ts +28 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +63 -3
- package/dist/interfaces/wrun-runtime.interface.js +11 -0
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +13 -0
- package/dist/kscript-data/controls/live-trades-merge.util.js +16 -1
- package/dist/market-data/billing.interface.d.ts +12 -45
- package/dist/market-data/billing.interface.js +2 -2
- package/dist/replay/replayLadder.js +7 -4
- package/dist/settings-templates/footprint-rows.d.ts +6 -0
- package/dist/settings-templates/footprint-rows.js +6 -0
- package/dist/settings-templates/frvp-fields.js +14 -0
- package/dist/settings-templates/indicator-fields.js +31 -0
- package/dist/settings-templates/tool-tables.generated.js +19 -1
- package/dist/utility/chart/__fixtures__/live-bucket-regular-golden.json +1706 -0
- package/dist/utility/chart/cache-alignment.util.d.ts +42 -0
- package/dist/utility/chart/cache-alignment.util.js +88 -18
- package/dist/utility/chart/calendar-interval.util.d.ts +83 -1
- package/dist/utility/chart/calendar-interval.util.js +152 -4
- package/dist/utility/chart/candle-bar-end.util.d.ts +11 -4
- package/dist/utility/chart/candle-bar-end.util.js +17 -6
- package/dist/utility/chart/chart-time-domain.util.d.ts +3 -0
- package/dist/utility/chart/chart-time-domain.util.js +13 -4
- package/dist/utility/chart/feed-interval.util.d.ts +4 -2
- package/dist/utility/chart/feed-interval.util.js +5 -2
- package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +3 -1
- package/dist/utility/chart/fetch-dedupe-policy.util.js +19 -1
- package/dist/utility/chart/footprint-display-mode.util.d.ts +2 -0
- package/dist/utility/chart/footprint-display-mode.util.js +5 -0
- package/dist/utility/chart/governed-lanes-gate.util.d.ts +46 -0
- package/dist/utility/chart/governed-lanes-gate.util.js +71 -0
- package/dist/utility/chart/governed-lanes-reader-seat.d.ts +14 -0
- package/dist/utility/chart/governed-lanes-reader-seat.js +14 -0
- package/dist/utility/chart/history-wall.util.d.ts +13 -2
- package/dist/utility/chart/history-wall.util.js +11 -4
- package/dist/utility/chart/interval-ladder.util.d.ts +5 -2
- package/dist/utility/chart/interval-ladder.util.js +44 -4
- package/dist/utility/chart/interval-registry.util.d.ts +22 -1
- package/dist/utility/chart/interval-registry.util.js +50 -2
- package/dist/utility/chart/kscript-data-interval-restriction.leaf.d.ts +32 -4
- package/dist/utility/chart/kscript-data-interval-restriction.leaf.js +22 -5
- package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +10 -0
- package/dist/utility/chart/kscript-drawing-safe-area.util.js +30 -3
- package/dist/utility/chart/kscript-legend-entries.util.d.ts +21 -4
- package/dist/utility/chart/kscript-legend-entries.util.js +27 -5
- package/dist/utility/chart/kscript-main-grid-stages.util.js +74 -24
- package/dist/utility/chart/kscript-row-name.leaf.d.ts +13 -0
- package/dist/utility/chart/kscript-row-name.leaf.js +18 -0
- package/dist/utility/chart/kscript-venue-policy.util.d.ts +61 -26
- package/dist/utility/chart/kscript-venue-policy.util.js +138 -37
- package/dist/utility/chart/live-bucket.util.d.ts +29 -4
- package/dist/utility/chart/live-bucket.util.js +45 -12
- package/dist/utility/chart/market-session.util.d.ts +62 -10
- package/dist/utility/chart/market-session.util.js +93 -13
- package/dist/utility/chart/marketKind.util.d.ts +1 -7
- package/dist/utility/chart/marketKind.util.js +6 -8
- package/dist/utility/chart/mixed-mode.util.d.ts +17 -0
- package/dist/utility/chart/om-target.util.js +6 -4
- package/dist/utility/chart/price-precision.util.d.ts +20 -6
- package/dist/utility/chart/price-precision.util.js +34 -7
- package/dist/utility/chart/profile-frame-window.util.d.ts +15 -0
- package/dist/utility/chart/profile-frame-window.util.js +12 -0
- package/dist/utility/chart/rth-session.util.d.ts +3 -1
- package/dist/utility/chart/rth-session.util.js +3 -1
- package/dist/utility/chart/script-source-session.util.d.ts +43 -0
- package/dist/utility/chart/script-source-session.util.js +61 -0
- package/dist/utility/chart/typed-width-grid.util.d.ts +23 -0
- package/dist/utility/chart/typed-width-grid.util.js +203 -0
- package/dist/utility/common/transformations.util.d.ts +6 -0
- package/dist/utility/common/transformations.util.js +28 -4
- package/dist/utility/number-format.util.d.ts +14 -1
- package/dist/utility/number-format.util.js +22 -4
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.d.ts +24 -1
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +113 -0
- package/dist/utility/v2/v2-enums.leaf.js +3 -0
- package/dist/utility/wrun/wrun-batched-marks.util.d.ts +9 -3
- package/dist/utility/wrun/wrun-batched-marks.util.js +65 -17
- package/dist/utility/wrun/wrun-canvases.util.d.ts +4 -2
- package/dist/utility/wrun/wrun-canvases.util.js +7 -12
- package/dist/utility/wrun/wrun-cap-notice.util.d.ts +5 -0
- package/dist/utility/wrun/wrun-cap-notice.util.js +23 -0
- package/dist/utility/wrun/wrun-card-style.util.d.ts +1 -1
- package/dist/utility/wrun/wrun-card-style.util.js +2 -2
- package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +8 -0
- package/dist/utility/wrun/wrun-chart-market-facts.util.js +13 -1
- package/dist/utility/wrun/wrun-child-overlay-id.util.d.ts +10 -0
- package/dist/utility/wrun/wrun-child-overlay-id.util.js +24 -0
- package/dist/utility/wrun/wrun-cloud-cme-stamp.util.d.ts +72 -0
- package/dist/utility/wrun/wrun-cloud-cme-stamp.util.js +151 -0
- package/dist/utility/wrun/wrun-color-facts.util.d.ts +3 -3
- package/dist/utility/wrun/wrun-color-facts.util.js +8 -5
- package/dist/utility/wrun/wrun-colour-tone.lazy.d.ts +20 -0
- package/dist/utility/wrun/wrun-colour-tone.lazy.js +23 -0
- package/dist/utility/wrun/wrun-colour-tone.util.d.ts +14 -0
- package/dist/utility/wrun/wrun-colour-tone.util.js +119 -0
- package/dist/utility/wrun/wrun-dark-pool.util.d.ts +3 -2
- package/dist/utility/wrun/wrun-dark-pool.util.js +5 -4
- package/dist/utility/wrun/wrun-frames.d.ts +1 -1
- package/dist/utility/wrun/wrun-frames.js +2 -2
- package/dist/utility/wrun/wrun-handles.util.d.ts +1 -1
- package/dist/utility/wrun/wrun-handles.util.js +1 -1
- package/dist/utility/wrun/wrun-host.service.d.ts +32 -2
- package/dist/utility/wrun/wrun-host.service.js +44 -2
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +20 -0
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +85 -2
- package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +37 -0
- package/dist/utility/wrun/wrun-hosted-wire.util.js +54 -0
- package/dist/utility/wrun/wrun-hud-looks.util.d.ts +1 -0
- package/dist/utility/wrun/wrun-hud-looks.util.js +6 -11
- package/dist/utility/wrun/wrun-integration-route.util.d.ts +24 -0
- package/dist/utility/wrun/wrun-integration-route.util.js +19 -0
- package/dist/utility/wrun/wrun-live-intake.util.js +17 -1
- package/dist/utility/wrun/wrun-live-patch.util.d.ts +6 -1
- package/dist/utility/wrun/wrun-live-patch.util.js +10 -4
- package/dist/utility/wrun/wrun-live-tick.util.js +59 -4
- package/dist/utility/wrun/wrun-overlay-drivers.util.js +3 -0
- package/dist/utility/wrun/wrun-overlay-run.util.d.ts +15 -0
- package/dist/utility/wrun/wrun-overlay-run.util.js +274 -47
- package/dist/utility/wrun/wrun-panel-mount.util.d.ts +1 -1
- package/dist/utility/wrun/wrun-panel-mount.util.js +42 -13
- package/dist/utility/wrun/wrun-pin-venues.util.js +5 -1
- package/dist/utility/wrun/wrun-refusal.util.d.ts +4 -0
- package/dist/utility/wrun/wrun-refusal.util.js +102 -13
- package/dist/utility/wrun/wrun-registry-errors.util.d.ts +5 -3
- package/dist/utility/wrun/wrun-registry-errors.util.js +5 -3
- package/dist/utility/wrun/wrun-row-source-factory.js +17 -1
- package/dist/utility/wrun/wrun-row-source.d.ts +8 -1
- package/dist/utility/wrun/wrun-sandbox-row-source.d.ts +1 -1
- package/dist/utility/wrun/wrun-sandbox-row-source.js +9 -0
- package/dist/utility/wrun/wrun-setting-words.util.d.ts +12 -5
- package/dist/utility/wrun/wrun-setting-words.util.js +25 -8
- package/dist/utility/wrun/wrun-socket-row-source.d.ts +26 -1
- package/dist/utility/wrun/wrun-socket-row-source.js +125 -12
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +3 -3
- package/dist/utility/wrun/wrun-source-rows.util.js +8 -7
- package/dist/utility/wrun/wrun-style-words.util.d.ts +31 -9
- package/dist/utility/wrun/wrun-style-words.util.js +46 -15
- package/dist/utility/wrun/wrun-trades-lane.util.js +2 -1
- package/dist/utility/wrun/wrun-trap-replay.util.d.ts +42 -0
- package/dist/utility/wrun/wrun-trap-replay.util.js +63 -0
- package/dist/utility/wrun/wrun-volume-profile.util.js +6 -5
- package/dist/utility/wrun-display-name.util.d.ts +10 -0
- package/dist/utility/wrun-display-name.util.js +21 -0
- package/dist/utils/replay/replay-buffer-math.d.ts +2 -0
- package/dist/utils/replay/replay-buffer-math.js +2 -0
- package/dist/workers/constants/socket-slots.d.ts +1 -1
- package/dist/workers/utils/time.worker.util.js +2 -2
- package/dist/workers/utils/volume-profile.worker.util.d.ts +9 -0
- package/dist/workers/utils/volume-profile.worker.util.js +20 -0
- package/dist/workers/wrun/wrun-abi-host.d.ts +3 -0
- package/dist/workers/wrun/wrun-abi-host.js +82 -5
- package/dist/workers/wrun/wrun-engine-handler.js +53 -4
- package/dist/workers/wrun/wrun-trap-frames.leaf.d.ts +28 -0
- package/dist/workers/wrun/wrun-trap-frames.leaf.js +108 -0
- package/package.json +11 -11
|
@@ -6,6 +6,8 @@ import { forgetWrunCanvasReadout, rememberWrunCanvasReadout } from './wrun-canva
|
|
|
6
6
|
import { wrunCanvasMergeLive } from './wrun-canvases.util.js';
|
|
7
7
|
import { decodeWrunPackedColor, isWrunStyleTargetHidden, wrunPaintedDeclarationOf } from './wrun-color-settings.util.js';
|
|
8
8
|
import { WRUN_HEATMAP_TRIM_WATERMARK, wrunHeatmapCellShares, wrunHeatmapTrimTarget, } from './wrun-heatmap-cell-budget.util.js';
|
|
9
|
+
// The mark colours (`theme.up_mark`, `theme.down_mark`) a marks child resolves: bound here, off the boot path.
|
|
10
|
+
import './wrun-colour-tone.util.js';
|
|
9
11
|
import { resolveWrunColorWord, wrunThemeTokenOfPacked, wrunThemeTokenWord, } from './wrun-style-words.util.js';
|
|
10
12
|
import { decodeWrunMarkMeta, decodeWrunSpanMeta, isWrunBatchedNumberFormat, WRUN_BATCHED_NUMBER_FORMATS, wrunBatchedReadoutText, wrunMarkUnitValue, } from './wrun-batched-readout.util.js';
|
|
11
13
|
export { decodeWrunFlagMeta, decodeWrunMarkMeta, decodeWrunSpanMeta, formatWrunBatchedNumber, isWrunBatchedNumberFormat, WRUN_BATCHED_NUMBER_FORMATS, wrunBatchedReadoutText, wrunMarkQtyInUnits, WRUN_MARK_META_MAX_OFFSET_MS, } from './wrun-batched-readout.util.js';
|
|
@@ -91,7 +93,7 @@ const LOOK_DEFAULTS = {
|
|
|
91
93
|
size: { law: 'sqrt', unit: 1, scale: 5 },
|
|
92
94
|
opacity_pct: 30,
|
|
93
95
|
look: 0,
|
|
94
|
-
text: { mode: 1, field: 'qty', format: 'compact', min_px: 22 },
|
|
96
|
+
text: { mode: 1, field: 'qty', format: 'compact', min_px: 22, place: 0 },
|
|
95
97
|
x: 0,
|
|
96
98
|
colors: ['theme.down', 'theme.up'],
|
|
97
99
|
tooltip: null,
|
|
@@ -349,20 +351,31 @@ function wholeIn(value, min, max, fallback) {
|
|
|
349
351
|
function clampTo(value, min, max, fallback) {
|
|
350
352
|
return finite(value) ? Math.min(max, Math.max(min, value)) : fallback;
|
|
351
353
|
}
|
|
352
|
-
/** A word among `words` (its index), a whole number among the indexes, else
|
|
353
|
-
|
|
354
|
+
/** A word among `words` (its index) or among `aliases` (the index it names), a whole number among the indexes, else
|
|
355
|
+
* `fallback`. */
|
|
356
|
+
function wordIndex(value, words, fallback, aliases = {}) {
|
|
354
357
|
if (typeof value === 'string') {
|
|
355
358
|
const at = words.indexOf(value);
|
|
356
|
-
return at
|
|
359
|
+
return at !== -1 ? at : Object.hasOwn(aliases, value) ? aliases[value] : fallback;
|
|
357
360
|
}
|
|
358
361
|
return wholeIn(value, 0, words.length - 1, fallback);
|
|
359
362
|
}
|
|
360
|
-
/** The marks look words (round-2 fold 1), the numbers canonical; the first contract's words read too,
|
|
361
|
-
* word `diamond` (the dark pool round). */
|
|
362
|
-
const MARK_LOOKS = ['circle', 'dot', 'ring', 'square', 'diamond'];
|
|
363
|
+
/** The marks look words (round-2 fold 1), the numbers canonical; the first contract's words read too, look 4's
|
|
364
|
+
* word `diamond` (the dark pool round), and looks 5 and 6, `glass` and `solid` (the Big Trades looks round). */
|
|
365
|
+
const MARK_LOOKS = ['circle', 'dot', 'ring', 'square', 'diamond', 'glass', 'solid'];
|
|
366
|
+
/** The kit's own words for looks 0 and 1 (`WRUN_MARK_LOOKS`): a select bound to `look` through `style_values`
|
|
367
|
+
* paints these words, so they read as the looks they name. */
|
|
368
|
+
const MARK_LOOK_KIT_WORDS = { bubble: 0, soft_dot: 1 };
|
|
363
369
|
/** The diamond's index: a look an engine before the dark pool round's draws as another (`wrunBatchedEngineVerdict`). */
|
|
364
370
|
const DIAMOND_LOOK = MARK_LOOKS.indexOf('diamond');
|
|
371
|
+
/** Glass and Solid: looks an engine before the Big Trades looks round draws as another (`wrunBatchedEngineVerdict`). */
|
|
372
|
+
const GLASS_LOOK = MARK_LOOKS.indexOf('glass');
|
|
373
|
+
const SOLID_LOOK = MARK_LOOKS.indexOf('solid');
|
|
365
374
|
const MARK_TEXT_MODES = ['off', 'largest', 'all'];
|
|
375
|
+
/** Where a mark's size is written (`text.place`, the Big Trades looks round): 0 inside the mark (today's drawing),
|
|
376
|
+
* 1 beside it. */
|
|
377
|
+
const MARK_TEXT_PLACES = ['inside', 'beside'];
|
|
378
|
+
const BESIDE_PLACE = MARK_TEXT_PLACES.indexOf('beside');
|
|
366
379
|
const MARK_X_WORDS = ['bar', 'offset'];
|
|
367
380
|
/** The size laws: sqrt and linear, and log (the dark pool round's, with the `min_px` / `max_px` bounds). */
|
|
368
381
|
const MARK_SIZE_LAWS = ['sqrt', 'linear', 'log'];
|
|
@@ -391,9 +404,13 @@ const KNOWN_STRIDES = {
|
|
|
391
404
|
/** An option's values: its indexes, then its words (what the look readers take). */
|
|
392
405
|
const optionValues = (words) => [...words.keys(), ...words];
|
|
393
406
|
/** The marks options by index, or by the first contract's words (what the look readers take). */
|
|
394
|
-
const MARK_LOOK_VALUES =
|
|
407
|
+
const MARK_LOOK_VALUES = [
|
|
408
|
+
...optionValues(MARK_LOOKS),
|
|
409
|
+
...Object.keys(MARK_LOOK_KIT_WORDS),
|
|
410
|
+
];
|
|
395
411
|
const MARK_X_VALUES = optionValues(MARK_X_WORDS);
|
|
396
412
|
const MARK_TEXT_MODE_VALUES = optionValues(MARK_TEXT_MODES);
|
|
413
|
+
const MARK_TEXT_PLACE_VALUES = optionValues(MARK_TEXT_PLACES);
|
|
397
414
|
/** The size keys marks and flags read (`min_px` and `max_px` the dark pool round's). */
|
|
398
415
|
const MARK_SIZE_VOCABULARY = {
|
|
399
416
|
law: MARK_SIZE_LAWS,
|
|
@@ -420,7 +437,13 @@ const SECTION_VOCABULARY = {
|
|
|
420
437
|
size: MARK_SIZE_VOCABULARY,
|
|
421
438
|
opacity_pct: ANY,
|
|
422
439
|
look: MARK_LOOK_VALUES,
|
|
423
|
-
text: {
|
|
440
|
+
text: {
|
|
441
|
+
mode: MARK_TEXT_MODE_VALUES,
|
|
442
|
+
field: ['qty'],
|
|
443
|
+
format: WRUN_BATCHED_NUMBER_FORMATS,
|
|
444
|
+
min_px: ANY,
|
|
445
|
+
place: MARK_TEXT_PLACE_VALUES,
|
|
446
|
+
},
|
|
424
447
|
x: MARK_X_VALUES,
|
|
425
448
|
colors: ANY,
|
|
426
449
|
tooltip: ANY,
|
|
@@ -599,13 +622,14 @@ function markCaptionFloorPx(declaredPx, scale) {
|
|
|
599
622
|
const scaled = Math.round((declaredPx * markSizeK(scale)) / markSizeK(LOOK_DEFAULTS.marks.size.scale));
|
|
600
623
|
return Math.min(scaled, markMaxDiameterPx(scale));
|
|
601
624
|
}
|
|
602
|
-
/** The marks look the engine draws (r6 parity): `look` 0..
|
|
625
|
+
/** The marks look the engine draws (r6 parity): `look` 0..6 (Bubble, Soft dot, Ring, Square, Diamond, Glass,
|
|
626
|
+
* Solid; by number, by word, or by the kit's words `bubble` and `soft_dot`), the
|
|
603
627
|
* size law over the quantity (`unit` the Min size, `scale` the Bubble size 1..10; `log` and the `min_px` /
|
|
604
628
|
* `max_px` bounds when declared, `markSizeOf`), `x` 0..1
|
|
605
629
|
* (Candle center, Trade time), `opacity_pct` 10..80, the caption (`text.mode` 0 Off, 1 Big
|
|
606
|
-
* bubbles, 2 All; its format, a word of the one list,
|
|
607
|
-
* at the default Bubble size, handed scaled to this one). A key
|
|
608
|
-
* left out, or an option that is none of its values (look, x, law, the caption's mode and
|
|
630
|
+
* bubbles, 2 All; its format, a word of the one list, the smallest bubble that holds one: declared
|
|
631
|
+
* at the default Bubble size, handed scaled to this one; and `place`, 0 inside the mark or 1 beside it). A key
|
|
632
|
+
* left out, or an option that is none of its values (look, x, law, the caption's mode, format and place),
|
|
609
633
|
* takes the kit's default (LOOK_DEFAULTS.marks); a number past its range is clamped. The market's
|
|
610
634
|
* dollar unit (`valuePerUnit`, proven: finite and above zero) rides at the top for the `units`
|
|
611
635
|
* caption; without one, `units` is handed to the engine as `usd`. */
|
|
@@ -620,7 +644,7 @@ function marksSettings(section, valuePerUnit) {
|
|
|
620
644
|
const format = written === 'units' && valuePerUnit === undefined ? 'usd' : written;
|
|
621
645
|
const scale = size.scale;
|
|
622
646
|
return {
|
|
623
|
-
look: wordIndex(section.look ?? legacyShape, MARK_LOOKS, defaults.look),
|
|
647
|
+
look: wordIndex(section.look ?? legacyShape, MARK_LOOKS, defaults.look, MARK_LOOK_KIT_WORDS),
|
|
624
648
|
size,
|
|
625
649
|
x: wordIndex(section.x, MARK_X_WORDS, defaults.x),
|
|
626
650
|
colors: [...(section.colors ?? defaults.colors)],
|
|
@@ -630,6 +654,7 @@ function marksSettings(section, valuePerUnit) {
|
|
|
630
654
|
field: defaults.text.field,
|
|
631
655
|
format,
|
|
632
656
|
min_px: markCaptionFloorPx(clampTo(text.min_px, 0, 64, defaults.text.min_px), scale),
|
|
657
|
+
place: wordIndex(text.place, MARK_TEXT_PLACES, defaults.text.place),
|
|
633
658
|
},
|
|
634
659
|
...(valuePerUnit !== undefined ? { valuePerUnit } : {}),
|
|
635
660
|
};
|
|
@@ -871,17 +896,40 @@ function fallbackColor(kind, at, theme) {
|
|
|
871
896
|
* contract). An engine before it has no `flags` renderer, clamps the look to 0..3 and reads only the sqrt and
|
|
872
897
|
* linear laws, so it would draw another look or size than the declared one, silently. */
|
|
873
898
|
const DIAMOND_ENGINE_PLOT = 'flags';
|
|
899
|
+
/** The marks pack level that draws Glass (look 5), Solid (look 6) and the size beside the mark (`text.place` 1):
|
|
900
|
+
* the engine's batchedMarks pack sets `packHooks.batchedMarksLevel` to it; an older engine leaves it absent. */
|
|
901
|
+
const BIG_TRADES_LOOKS_LEVEL = 2;
|
|
902
|
+
/** The batched marks level a chart's engine draws (`tc.packHooks.batchedMarksLevel`, set by its batchedMarks pack):
|
|
903
|
+
* 0 when the chart carries none (an engine before the Big Trades looks round). */
|
|
904
|
+
export function wrunBatchedMarksLevelOf(tc) {
|
|
905
|
+
const hooks = isRecord(tc) ? tc.packHooks : undefined;
|
|
906
|
+
const level = isRecord(hooks) ? hooks.batchedMarksLevel : undefined;
|
|
907
|
+
return finite(level) ? level : 0;
|
|
908
|
+
}
|
|
874
909
|
/**
|
|
875
910
|
* Why the chart's engine cannot draw a batched child its kind's renderer draws, null when it can: the mount asks it
|
|
876
911
|
* once the engine gate passed the kind (the pack settled and registered, `hasPlotRenderer` the engine's own answer).
|
|
877
912
|
* A marks child whose look needs the dark pool round's engine (look 4, the `log` law, a `min_px` or `max_px` bound)
|
|
878
913
|
* on an engine without that release's `flags` renderer is refused by name ("Needs a newer chart"), as an unknown
|
|
879
|
-
* look is by the layout gate, never drawn as another look.
|
|
880
|
-
*
|
|
914
|
+
* look is by the layout gate, never drawn as another look. So is one that needs the Big Trades looks round's engine
|
|
915
|
+
* (look 5 Glass, look 6 Solid, or the size beside the mark, `text.place` 1) on an engine whose marks pack reads below
|
|
916
|
+
* level 2 (`marksLevel`, `wrunBatchedMarksLevelOf`; 0 when the caller passes none). A flags child is never judged
|
|
917
|
+
* here: the gate already asked the engine for its kind. The reason is diagnostic text, never copy.
|
|
881
918
|
*/
|
|
882
|
-
export function wrunBatchedEngineVerdict(child, hasPlotRenderer) {
|
|
919
|
+
export function wrunBatchedEngineVerdict(child, hasPlotRenderer, marksLevel = 0) {
|
|
883
920
|
if (child.kind !== 'marks')
|
|
884
921
|
return null;
|
|
922
|
+
const text = isRecord(child.settings.text) ? child.settings.text : {};
|
|
923
|
+
const looksNeed = child.settings.look === GLASS_LOOK
|
|
924
|
+
? 'look 5 (glass)'
|
|
925
|
+
: child.settings.look === SOLID_LOOK
|
|
926
|
+
? 'look 6 (solid)'
|
|
927
|
+
: text.place === BESIDE_PLACE
|
|
928
|
+
? 'text.place 1 (beside)'
|
|
929
|
+
: null;
|
|
930
|
+
if (looksNeed !== null && marksLevel < BIG_TRADES_LOOKS_LEVEL) {
|
|
931
|
+
return `${looksNeed} needs the chart engine whose marks pack draws level ${BIG_TRADES_LOOKS_LEVEL}`;
|
|
932
|
+
}
|
|
885
933
|
const size = isRecord(child.settings.size) ? child.settings.size : {};
|
|
886
934
|
const needs = child.settings.look === DIAMOND_LOOK
|
|
887
935
|
? 'look 4 (diamond)'
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { RuntimeDiagnostic } from '../../interfaces/kscript-diagnostics.interface.js';
|
|
2
2
|
import type { WrunHeatmap, WrunIndicatorMetadata, WrunMatrix, WrunOutputRow, WrunPanel } from '../../interfaces/wrun-runtime.interface.js';
|
|
3
|
+
import './wrun-colour-tone.util.js';
|
|
3
4
|
import { type WrunColorTheme, type WrunNumberFormatSpec } from './wrun-style-words.util.js';
|
|
4
5
|
import { type WrunMatrixFrame } from './wrun-frames.js';
|
|
5
6
|
import { type WrunCanvasReadout } from './wrun-canvas-readout.util.js';
|
|
@@ -104,8 +105,9 @@ export interface WrunCanvasChildConfig {
|
|
|
104
105
|
* (wins over the child's own rows). */
|
|
105
106
|
data?: unknown[];
|
|
106
107
|
}
|
|
107
|
-
/** The default dark palette (wrun-style-words.util 2.3
|
|
108
|
-
*
|
|
108
|
+
/** The default dark palette (wrun-style-words.util 2.3, the palette a chart
|
|
109
|
+
* without a theme answers): what a child's own rows resolve against before
|
|
110
|
+
* the mount hands the chart's theme over. */
|
|
109
111
|
export declare const WRUN_CANVAS_FALLBACK_THEME: Readonly<WrunColorTheme>;
|
|
110
112
|
/** The colour-scale defaults (PT-heatmap): the sequential ramp, the
|
|
111
113
|
* diverging ramp around a centre, the quantile of the auto bounds. */
|
|
@@ -40,7 +40,9 @@ import { isWrunStyleTargetHidden } from './wrun-color-settings.util.js';
|
|
|
40
40
|
import { isWrunBandedBookSource } from './wrun-book-bands.leaf.js';
|
|
41
41
|
import { WRUN_MAX_ROWS_PER_PERIOD, WRUN_ROW_CAP_MAX_DOUBLINGS, wrunAutoRowUnit } from './wrun-auto-row.util.js';
|
|
42
42
|
import { WRUN_FOOTPRINT_CELL_METRIC_DEFAULT, WRUN_FOOTPRINT_MODE_DEFAULT } from './wrun-footprint-modes.util.js';
|
|
43
|
-
|
|
43
|
+
// Bound before the fallback palette below reads the mark colours (off the boot path).
|
|
44
|
+
import './wrun-colour-tone.util.js';
|
|
45
|
+
import { formatWrunNumber, resolveWrunColorWord, wrunColorThemeOf, wrunFontFamilyCss, } from './wrun-style-words.util.js';
|
|
44
46
|
import { buildWrunTpoRows, WRUN_TPO_MAX_ROWS_PER_BAR, } from './wrun-tpo-rows.util.js';
|
|
45
47
|
import { wrunVolumeProfileChild } from './wrun-volume-profile.util.js';
|
|
46
48
|
import { invalidWrunFrame, parseWrunMatrixFrame } from './wrun-frames.js';
|
|
@@ -51,17 +53,10 @@ const CHILD_PLOT = {
|
|
|
51
53
|
profile: 'profile',
|
|
52
54
|
matrix: 'priceMatrix',
|
|
53
55
|
};
|
|
54
|
-
/** The default dark palette (wrun-style-words.util 2.3
|
|
55
|
-
*
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
down: '#ef5350',
|
|
59
|
-
text: '#d1d4dc',
|
|
60
|
-
muted: 'rgba(209, 212, 220, 0.55)',
|
|
61
|
-
bg: '#131722',
|
|
62
|
-
grid: '#2a2e39',
|
|
63
|
-
accent: '#ff4608',
|
|
64
|
-
});
|
|
56
|
+
/** The default dark palette (wrun-style-words.util 2.3, the palette a chart
|
|
57
|
+
* without a theme answers): what a child's own rows resolve against before
|
|
58
|
+
* the mount hands the chart's theme over. */
|
|
59
|
+
export const WRUN_CANVAS_FALLBACK_THEME = Object.freeze(wrunColorThemeOf(undefined));
|
|
65
60
|
/** The colour-scale defaults (PT-heatmap): the sequential ramp, the
|
|
66
61
|
* diverging ramp around a centre, the quantile of the auto bounds. */
|
|
67
62
|
export const WRUN_HEATMAP_DEFAULT_PALETTE = Object.freeze([
|
|
@@ -12,6 +12,11 @@ export interface WrunDrawingsBudget {
|
|
|
12
12
|
/** Increases with every budgeted result: the door never lets an older revision overwrite a newer row. */
|
|
13
13
|
revision: number;
|
|
14
14
|
}
|
|
15
|
+
/** Notes `next`'s drawings token: `previous`'s when the caller proved the two sets equal (pass `undefined` when it
|
|
16
|
+
* did not), else a new one. Returns the token, undefined when `next` is no array. */
|
|
17
|
+
export declare function noteWrunDrawingsSameAs(next: unknown, previous: unknown): number | undefined;
|
|
18
|
+
/** The token the live tick noted on a drawings array (undefined when none was noted: the door then runs in full). */
|
|
19
|
+
export declare function wrunDrawingsToken(drawings: unknown): number | undefined;
|
|
15
20
|
/** The context a result's drawings carry: the result's own field, else the one keyed by its
|
|
16
21
|
* drawings array (a live batch rebuilt around the array). */
|
|
17
22
|
export declare function wrunDrawingsBudgetOf(output: unknown): WrunDrawingsBudget | undefined;
|
|
@@ -29,6 +29,29 @@ import { wrunChartHostEnv, } from '../../host-env.js';
|
|
|
29
29
|
const UNTRIMMED_DRAWING_KINDS = new Set(['table', 'card', 'feed', 'meter', 'ladder']);
|
|
30
30
|
const budgetsByDrawings = new WeakMap();
|
|
31
31
|
let revisions = 0;
|
|
32
|
+
/**
|
|
33
|
+
* The live tick's drawings verdict, as a number per drawings array: a live result whose drawings equal the ones the
|
|
34
|
+
* tick last applied (and whose budget counts match) inherits that array's token, any other result gets a new one.
|
|
35
|
+
* The drawing door holds the token of its last full pass, so an equal token on the next live call means the same
|
|
36
|
+
* records reach it again and the pass can be skipped. A number, never a reference to the previous array: a chain of
|
|
37
|
+
* arrays would keep every old drawings set reachable for as long as the newest lives.
|
|
38
|
+
*/
|
|
39
|
+
const drawingsTokens = new WeakMap();
|
|
40
|
+
let drawingsTokenSeq = 0;
|
|
41
|
+
/** Notes `next`'s drawings token: `previous`'s when the caller proved the two sets equal (pass `undefined` when it
|
|
42
|
+
* did not), else a new one. Returns the token, undefined when `next` is no array. */
|
|
43
|
+
export function noteWrunDrawingsSameAs(next, previous) {
|
|
44
|
+
if (!Array.isArray(next))
|
|
45
|
+
return undefined;
|
|
46
|
+
const inherited = Array.isArray(previous) ? drawingsTokens.get(previous) : undefined;
|
|
47
|
+
const token = inherited ?? (drawingsTokenSeq += 1);
|
|
48
|
+
drawingsTokens.set(next, token);
|
|
49
|
+
return token;
|
|
50
|
+
}
|
|
51
|
+
/** The token the live tick noted on a drawings array (undefined when none was noted: the door then runs in full). */
|
|
52
|
+
export function wrunDrawingsToken(drawings) {
|
|
53
|
+
return Array.isArray(drawings) ? drawingsTokens.get(drawings) : undefined;
|
|
54
|
+
}
|
|
32
55
|
function isRecord(value) {
|
|
33
56
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
34
57
|
}
|
|
@@ -62,7 +62,7 @@ export type WrunWidgetEngineControls = Exclude<WrunWidgetControls, 'none'>;
|
|
|
62
62
|
*/
|
|
63
63
|
export declare function wrunWidgetEngineControls(word: WrunWidgetControls | undefined): WrunWidgetEngineControls | undefined;
|
|
64
64
|
/** The frozen colour-word message (the foundation's, 2.1). */
|
|
65
|
-
export declare const WRUN_COLOR_WORD_MESSAGE
|
|
65
|
+
export declare const WRUN_COLOR_WORD_MESSAGE: string;
|
|
66
66
|
/**
|
|
67
67
|
* DW04: what `chrome: "plain"` stands for, in the sheet's words: no state
|
|
68
68
|
* text, no stripe, no border, a muted title, glyphs on hover. A word declared
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* `controls: "none"` reaches the engine as `hover` (wrunWidgetEngineControls),
|
|
31
31
|
* so a widget never loses the viewer's hide control.
|
|
32
32
|
*/
|
|
33
|
-
import { formatWrunNumber, isWrunColorWord, WRUN_FONT_FAMILIES, WRUN_FONT_WEIGHTS, WRUN_MAX_VALUE_DECIMALS, WRUN_MAX_VALUE_UNIT_CHARS, WRUN_VALUE_FORMATS, wrunFontFamilyCss, } from './wrun-style-words.util.js';
|
|
33
|
+
import { formatWrunNumber, isWrunColorWord, WRUN_FONT_FAMILIES, WRUN_FONT_WEIGHTS, WRUN_MAX_VALUE_DECIMALS, WRUN_MAX_VALUE_UNIT_CHARS, WRUN_THEME_TOKEN_WORDS_TEXT, WRUN_VALUE_FORMATS, wrunFontFamilyCss, } from './wrun-style-words.util.js';
|
|
34
34
|
// Bounds (the kit's, restated per X22; D1 for the corner radius).
|
|
35
35
|
export const WRUN_WIDGET_CORNER_RADIUS_MAX_PX = 32;
|
|
36
36
|
export const WRUN_WIDGET_PADDING_MAX_PX = 24;
|
|
@@ -71,7 +71,7 @@ const WRUN_TEXT_ALIGNS = ['left', 'center', 'right'];
|
|
|
71
71
|
const WRUN_FEED_TIME_FORMATS = ['HH:mm:ss', 'HH:mm', 'MM-dd HH:mm', 'none'];
|
|
72
72
|
const WRUN_CARD_VALUE_FORMAT_WORDS = [...WRUN_VALUE_FORMATS, 'pct'];
|
|
73
73
|
/** The frozen colour-word message (the foundation's, 2.1). */
|
|
74
|
-
export const WRUN_COLOR_WORD_MESSAGE =
|
|
74
|
+
export const WRUN_COLOR_WORD_MESSAGE = `a colour must be #rrggbb, #rrggbbaa or one of ${WRUN_THEME_TOKEN_WORDS_TEXT}`;
|
|
75
75
|
/**
|
|
76
76
|
* DW04: what `chrome: "plain"` stands for, in the sheet's words: no state
|
|
77
77
|
* text, no stripe, no border, a muted title, glyphs on hover. A word declared
|
|
@@ -331,6 +331,14 @@ export declare function wrunMarketFactsSettled(market: WrunFactsMarket | undefin
|
|
|
331
331
|
* warmWrunMarketDollarFacts settled; 0 while it is not proven). Every word is
|
|
332
332
|
* written on every market, 0 included, so the block keeps one shape. */
|
|
333
333
|
export declare function wrunMarketFactsFor(market: WrunFactsMarket | undefined): WrunMarketFacts & WrunOptionFacts & WrunDollarFacts;
|
|
334
|
+
/**
|
|
335
|
+
* THE point value a strategy package's broker takes for `market` (`WrunStrategyRunInput.pointValue`, carried to the
|
|
336
|
+
* kit's `WrunStrategyHost` as its `pointValue`): the same fact `market.point_value()` reads (wrunMarketFactsFor), when
|
|
337
|
+
* it is a positive number other than 1. Undefined on a market with no point value (1: coins, shares; 0: unknown), so
|
|
338
|
+
* the broker keeps 1 there and its output carries no `declared.pointValue`. A size is then in contracts and every
|
|
339
|
+
* money figure the broker returns is price x size x this value.
|
|
340
|
+
*/
|
|
341
|
+
export declare function wrunStrategyPointValue(market: WrunFactsMarket | undefined): number | undefined;
|
|
334
342
|
/**
|
|
335
343
|
* What the instrument registry (StreamRegistryMetadatas, the metadata service's `getSymbolMetadata`) proves about one
|
|
336
344
|
* market's prices on every wire it rides, so the chart prices a print by the server's own facts, never by a table of
|
|
@@ -69,6 +69,7 @@ import { wrunChartHostEnv } from '../../host-env.js';
|
|
|
69
69
|
import { isCmeGoverned } from '../chart/cme-realtime.util.js';
|
|
70
70
|
import { isContinuousSymbol } from '../chart/continuous-contracts.util.js';
|
|
71
71
|
import { governedContractCoin } from '../chart/governed-contract-coin.util.js';
|
|
72
|
+
import { PUBLISHER_ONLY_EXCHANGES } from '../../constants/economic.constants.js';
|
|
72
73
|
import { checkIsEconomic, getMarketKind } from '../chart/marketKind.util.js';
|
|
73
74
|
import { optionsMarketUnderlyingVenue, optionVenueForExchange } from '../options/option-venue.util.js';
|
|
74
75
|
import { isPlainOptionContract } from '../options/option-trade-units.util.js';
|
|
@@ -762,7 +763,7 @@ class DirectoryIncomplete extends Error {
|
|
|
762
763
|
* the caller retries those after a minute, never settles them as absent. */
|
|
763
764
|
async function findDirectoryRow(venue, symbol) {
|
|
764
765
|
const exchange = Exchange[venue];
|
|
765
|
-
if (typeof exchange !== 'number')
|
|
766
|
+
if (typeof exchange !== 'number' || PUBLISHER_ONLY_EXCHANGES.has(venue))
|
|
766
767
|
return null;
|
|
767
768
|
const [{ default: metadataService }, { normalizeMarketSymbols }] = await Promise.all([
|
|
768
769
|
wrunChartHostEnv().market.loadMetadataService(),
|
|
@@ -836,6 +837,17 @@ export function wrunMarketFactsFor(market) {
|
|
|
836
837
|
dollarMultiplier: dollars.kind === 'dollars' ? dollars.unit : 0,
|
|
837
838
|
};
|
|
838
839
|
}
|
|
840
|
+
/**
|
|
841
|
+
* THE point value a strategy package's broker takes for `market` (`WrunStrategyRunInput.pointValue`, carried to the
|
|
842
|
+
* kit's `WrunStrategyHost` as its `pointValue`): the same fact `market.point_value()` reads (wrunMarketFactsFor), when
|
|
843
|
+
* it is a positive number other than 1. Undefined on a market with no point value (1: coins, shares; 0: unknown), so
|
|
844
|
+
* the broker keeps 1 there and its output carries no `declared.pointValue`. A size is then in contracts and every
|
|
845
|
+
* money figure the broker returns is price x size x this value.
|
|
846
|
+
*/
|
|
847
|
+
export function wrunStrategyPointValue(market) {
|
|
848
|
+
const { pointValue } = wrunMarketFactsFor(market);
|
|
849
|
+
return Number.isFinite(pointValue) && pointValue > 0 && pointValue !== 1 ? pointValue : undefined;
|
|
850
|
+
}
|
|
839
851
|
/** A registry field that is a finite number above zero, else null (absent, zero, negative or unreadable). */
|
|
840
852
|
function positiveUnit(value) {
|
|
841
853
|
const number = typeof value === 'number' ? value : typeof value === 'string' ? Number(value) : Number.NaN;
|
|
@@ -11,3 +11,13 @@ export declare function wrunChildOverlayParentId(id: string): string | null;
|
|
|
11
11
|
export declare function wrunChildHiddenRowKey(id: string): string | null;
|
|
12
12
|
/** True for a key wrunChildHiddenRowKey mints (a viewer row, never a param). */
|
|
13
13
|
export declare function isWrunChildHiddenRowKey(key: string): boolean;
|
|
14
|
+
/** The viewer row that keeps the height a reader dragged a child's pane to: `<kind>:<name>:gridHeight` on the OWNING
|
|
15
|
+
* Indicator's settings (`series:lower:gridHeight`), the pane's share of the chart. A child has no workspace row, so
|
|
16
|
+
* the one height writer (the store's saveGridHeights) writes it there and the child mount reads it back whenever it
|
|
17
|
+
* mounts the child (a layout or tab switch, a reload). Keyed past the owner id, which a draft swap may change. Null
|
|
18
|
+
* for any id that is no pane-owning child's. */
|
|
19
|
+
export declare function wrunChildPaneHeightRowKey(id: string): string | null;
|
|
20
|
+
/** True for a key wrunChildPaneHeightRowKey mints (a viewer row, never a param). */
|
|
21
|
+
export declare function isWrunChildPaneHeightRowKey(key: string): boolean;
|
|
22
|
+
/** The child overlay id a pane height row names under `overlayId`, null for any other key. */
|
|
23
|
+
export declare function wrunChildPaneHeightRowChildId(overlayId: string, key: string): string | null;
|
|
@@ -43,3 +43,27 @@ export function wrunChildHiddenRowKey(id) {
|
|
|
43
43
|
export function isWrunChildHiddenRowKey(key) {
|
|
44
44
|
return CHILD_HIDDEN_ROW_PATTERN.test(key);
|
|
45
45
|
}
|
|
46
|
+
/** The child kinds that own a pane below the chart a reader can drag: the mount sizes exactly these from a plan
|
|
47
|
+
* (wrun-panel-mount.util `ctx.planned`), so exactly these remember a dragged height. */
|
|
48
|
+
const CHILD_PANE_KIND_WORDS = { panel: true, series: true };
|
|
49
|
+
const CHILD_PANE_KINDS = `(?:${Object.keys(CHILD_PANE_KIND_WORDS).join('|')})`;
|
|
50
|
+
const CHILD_PANE_ID_PARTS = new RegExp(`^.+::(${CHILD_PANE_KINDS}:.+)$`);
|
|
51
|
+
const CHILD_PANE_HEIGHT_ROW_PATTERN = new RegExp(`^(${CHILD_PANE_KINDS}:.+):gridHeight$`);
|
|
52
|
+
/** The viewer row that keeps the height a reader dragged a child's pane to: `<kind>:<name>:gridHeight` on the OWNING
|
|
53
|
+
* Indicator's settings (`series:lower:gridHeight`), the pane's share of the chart. A child has no workspace row, so
|
|
54
|
+
* the one height writer (the store's saveGridHeights) writes it there and the child mount reads it back whenever it
|
|
55
|
+
* mounts the child (a layout or tab switch, a reload). Keyed past the owner id, which a draft swap may change. Null
|
|
56
|
+
* for any id that is no pane-owning child's. */
|
|
57
|
+
export function wrunChildPaneHeightRowKey(id) {
|
|
58
|
+
const child = CHILD_PANE_ID_PARTS.exec(id)?.[1];
|
|
59
|
+
return child === undefined ? null : `${child}:gridHeight`;
|
|
60
|
+
}
|
|
61
|
+
/** True for a key wrunChildPaneHeightRowKey mints (a viewer row, never a param). */
|
|
62
|
+
export function isWrunChildPaneHeightRowKey(key) {
|
|
63
|
+
return CHILD_PANE_HEIGHT_ROW_PATTERN.test(key);
|
|
64
|
+
}
|
|
65
|
+
/** The child overlay id a pane height row names under `overlayId`, null for any other key. */
|
|
66
|
+
export function wrunChildPaneHeightRowChildId(overlayId, key) {
|
|
67
|
+
const child = CHILD_PANE_HEIGHT_ROW_PATTERN.exec(key)?.[1];
|
|
68
|
+
return child === undefined ? null : `${overlayId}::${child}`;
|
|
69
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CME provenance of a hosted (Cloud) run, the twin of the OPRA mark (wrun-cloud-opra-stamp.util). One rule never
|
|
3
|
+
* opens with the governed-lanes cutover: no CME data reaches Kata or any AI feature, so every row a run derives from
|
|
4
|
+
* CME data carries the CME stamp (`settings.metaCmeExchange = 'CME'`, the key the hosted chart read, the MCP withhold
|
|
5
|
+
* and the governed-source inventory read), whatever lane or author produced it.
|
|
6
|
+
*
|
|
7
|
+
* A browser run is stamped by the chart's fetch door when it admits a CME source. A hosted run fetches nothing in the
|
|
8
|
+
* browser, so its result batch is stamped here before any of its rows lands (`integrateWrunRowSourceBatch`), by two
|
|
9
|
+
* readings joined (`wrunHostedRunReadsCme`):
|
|
10
|
+
*
|
|
11
|
+
* - the head mark: the chart is on the CME plane, or the sheet the run reads pins a CME market (the run head's
|
|
12
|
+
* `wrunSheetPinsCme`), read from the sheet and the chart alone;
|
|
13
|
+
* - the server mark: the reply's `output.wrunGoverned.cme` (the hosted wire's `wrunGoverned`, `readWrunGovernedMark`),
|
|
14
|
+
* which the batch carries as `governed` (`wrunBatchGovernedOf`): what the server knows the run read, even where the
|
|
15
|
+
* sheet shows no CME.
|
|
16
|
+
*
|
|
17
|
+
* Lane-blind and author-blind: a first-party hosted run that reads CME is stamped too. Fail closed: a host that binds
|
|
18
|
+
* no CME writer (`setOverlayCmeProvenance`), a writer that throws, a run that no longer owns its overlay, or a stamp the
|
|
19
|
+
* mounted overlay does not read back all fail the batch, so no unstamped CME row is integrated. The stamp is sticky for
|
|
20
|
+
* the mount, as the browser's is (cme-overlay-provenance.util): no result sheds it.
|
|
21
|
+
*/
|
|
22
|
+
import { type WrunGovernedMark } from './wrun-hosted-wire.util.js';
|
|
23
|
+
/** A batch as the stamp reads it: the server's governed-plane mark, when the source carries it. */
|
|
24
|
+
export interface WrunGovernedBatchFields {
|
|
25
|
+
/** The reply's `output.wrunGoverned`, as `readWrunGovernedMark` read it. */
|
|
26
|
+
governed?: WrunGovernedMark;
|
|
27
|
+
}
|
|
28
|
+
/** Whether a mounted overlay's settings carry the CME provenance stamp (cme-overlay-provenance.leaf
|
|
29
|
+
* `overlayCarriesCmeStamp`). */
|
|
30
|
+
export declare function wrunOverlayCmeStamped(meta: {
|
|
31
|
+
settings?: unknown;
|
|
32
|
+
} | null | undefined): boolean;
|
|
33
|
+
/** The server's governed-plane mark a batch carries, if any. */
|
|
34
|
+
export declare function wrunBatchGovernedOf(batch: object): WrunGovernedMark | undefined;
|
|
35
|
+
/** Whether the server's mark names the CME plane. */
|
|
36
|
+
export declare function wrunGovernedReadsCme(governed: WrunGovernedMark | undefined): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Carry the overlay's sticky governed-plane mark on a failure the socket row source rejects with (hidden, like a
|
|
39
|
+
* refusal record): the run pass reads it back (`wrunFailureGovernedOf`) so a failed run that read CME surfaces marked.
|
|
40
|
+
* A non-object failure, or no mark, is returned as it is.
|
|
41
|
+
*/
|
|
42
|
+
export declare function markWrunFailureGoverned<T>(error: T, mark: WrunGovernedMark | undefined): T;
|
|
43
|
+
/**
|
|
44
|
+
* The governed-plane mark a failure carries: the sticky mark the source attached (`markWrunFailureGoverned`), else the
|
|
45
|
+
* error frame's relayed `details.wrunGoverned` (wrun-hosted-wire-caps `wrunGovernedDetailsOfText`) read by the one
|
|
46
|
+
* fail-closed reader (`wrunGovernedMarkOf`), on the failure or any `cause` it wraps. Undefined: no mark anywhere.
|
|
47
|
+
*/
|
|
48
|
+
export declare function wrunFailureGovernedOf(error: unknown): WrunGovernedMark | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Read a failure's governed-plane mark (`wrunFailureGovernedOf`), then take the relayed governed trailer off the text
|
|
51
|
+
* of the failure and every `cause` it wraps, so every reader past it (the trap row, the refusal records, the console)
|
|
52
|
+
* reads the frame's words as before. Answers the mark.
|
|
53
|
+
*/
|
|
54
|
+
export declare function takeWrunFailureGoverned(error: unknown): WrunGovernedMark | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Whether a hosted run's result read CME: the chart is on the CME plane, the sheet pins a CME market (`sheetPinsCme`,
|
|
57
|
+
* the run head's reading), or the server's mark names CME. Never the run's author or lane.
|
|
58
|
+
*/
|
|
59
|
+
export declare function wrunHostedRunReadsCme(args: {
|
|
60
|
+
chartExchange: unknown;
|
|
61
|
+
sheetPinsCme: boolean;
|
|
62
|
+
governed: WrunGovernedMark | undefined;
|
|
63
|
+
}): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Stamp the overlay a hosted run's CME result lands on, through the host's CME writer (`setOverlayCmeProvenance`, both
|
|
66
|
+
* settings copies), then read the stamp back off the mounted overlay. `owns` judges, in the same task as the write,
|
|
67
|
+
* that the run still owns its overlay (a replacement mounted under the same id is another overlay, never written).
|
|
68
|
+
* Answers whether the overlay carries the stamp now; false fails the batch (fail closed). Never clears.
|
|
69
|
+
*/
|
|
70
|
+
export declare function stampWrunHostedCme(chartIndex: number, indicatorId: string, meta: {
|
|
71
|
+
settings?: unknown;
|
|
72
|
+
}, owns: () => boolean): Promise<boolean>;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CME provenance of a hosted (Cloud) run, the twin of the OPRA mark (wrun-cloud-opra-stamp.util). One rule never
|
|
3
|
+
* opens with the governed-lanes cutover: no CME data reaches Kata or any AI feature, so every row a run derives from
|
|
4
|
+
* CME data carries the CME stamp (`settings.metaCmeExchange = 'CME'`, the key the hosted chart read, the MCP withhold
|
|
5
|
+
* and the governed-source inventory read), whatever lane or author produced it.
|
|
6
|
+
*
|
|
7
|
+
* A browser run is stamped by the chart's fetch door when it admits a CME source. A hosted run fetches nothing in the
|
|
8
|
+
* browser, so its result batch is stamped here before any of its rows lands (`integrateWrunRowSourceBatch`), by two
|
|
9
|
+
* readings joined (`wrunHostedRunReadsCme`):
|
|
10
|
+
*
|
|
11
|
+
* - the head mark: the chart is on the CME plane, or the sheet the run reads pins a CME market (the run head's
|
|
12
|
+
* `wrunSheetPinsCme`), read from the sheet and the chart alone;
|
|
13
|
+
* - the server mark: the reply's `output.wrunGoverned.cme` (the hosted wire's `wrunGoverned`, `readWrunGovernedMark`),
|
|
14
|
+
* which the batch carries as `governed` (`wrunBatchGovernedOf`): what the server knows the run read, even where the
|
|
15
|
+
* sheet shows no CME.
|
|
16
|
+
*
|
|
17
|
+
* Lane-blind and author-blind: a first-party hosted run that reads CME is stamped too. Fail closed: a host that binds
|
|
18
|
+
* no CME writer (`setOverlayCmeProvenance`), a writer that throws, a run that no longer owns its overlay, or a stamp the
|
|
19
|
+
* mounted overlay does not read back all fail the batch, so no unstamped CME row is integrated. The stamp is sticky for
|
|
20
|
+
* the mount, as the browser's is (cme-overlay-provenance.util): no result sheds it.
|
|
21
|
+
*/
|
|
22
|
+
import { wrunChartHostEnv } from '../../host-env.js';
|
|
23
|
+
import { payloadTouchesCmeVenue } from '../chart/kscript-venue-policy.util.js';
|
|
24
|
+
import { wrunGovernedDetailsOfText, wrunTextWithoutGovernedTrailer } from './wrun-hosted-wire-caps.js';
|
|
25
|
+
import { wrunGovernedMarkOf } from './wrun-hosted-wire.util.js';
|
|
26
|
+
/** The provenance word a CME-stamped overlay carries (cme-overlay-provenance.leaf `CME_PROVENANCE`). */
|
|
27
|
+
const CME_PROVENANCE = 'CME';
|
|
28
|
+
/** Whether a mounted overlay's settings carry the CME provenance stamp (cme-overlay-provenance.leaf
|
|
29
|
+
* `overlayCarriesCmeStamp`). */
|
|
30
|
+
export function wrunOverlayCmeStamped(meta) {
|
|
31
|
+
const settings = meta?.settings;
|
|
32
|
+
return (typeof settings === 'object' &&
|
|
33
|
+
settings !== null &&
|
|
34
|
+
settings.metaCmeExchange === CME_PROVENANCE);
|
|
35
|
+
}
|
|
36
|
+
/** The server's governed-plane mark a batch carries, if any. */
|
|
37
|
+
export function wrunBatchGovernedOf(batch) {
|
|
38
|
+
const governed = batch.governed;
|
|
39
|
+
return typeof governed === 'object' && governed !== null ? governed : undefined;
|
|
40
|
+
}
|
|
41
|
+
/** Whether the server's mark names the CME plane. */
|
|
42
|
+
export function wrunGovernedReadsCme(governed) {
|
|
43
|
+
return governed?.cme !== undefined;
|
|
44
|
+
}
|
|
45
|
+
/** The key a failed ask's error carries its overlay's sticky governed-plane mark under (`markWrunFailureGoverned`). */
|
|
46
|
+
const FAILURE_GOVERNED_KEY = 'wrunGovernedFailureMark';
|
|
47
|
+
/** How deep a failure's `cause` chain is read for the mark (a transport wraps the frame's error once or twice). */
|
|
48
|
+
const FAILURE_CAUSE_DEPTH = 8;
|
|
49
|
+
/**
|
|
50
|
+
* Carry the overlay's sticky governed-plane mark on a failure the socket row source rejects with (hidden, like a
|
|
51
|
+
* refusal record): the run pass reads it back (`wrunFailureGovernedOf`) so a failed run that read CME surfaces marked.
|
|
52
|
+
* A non-object failure, or no mark, is returned as it is.
|
|
53
|
+
*/
|
|
54
|
+
export function markWrunFailureGoverned(error, mark) {
|
|
55
|
+
if (mark === undefined || typeof error !== 'object' || error === null)
|
|
56
|
+
return error;
|
|
57
|
+
try {
|
|
58
|
+
Object.defineProperty(error, FAILURE_GOVERNED_KEY, {
|
|
59
|
+
value: mark,
|
|
60
|
+
enumerable: false,
|
|
61
|
+
configurable: true,
|
|
62
|
+
writable: true,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
// A frozen failure keeps its text: the reader below still reads the relayed trailer off it.
|
|
67
|
+
}
|
|
68
|
+
return error;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The governed-plane mark a failure carries: the sticky mark the source attached (`markWrunFailureGoverned`), else the
|
|
72
|
+
* error frame's relayed `details.wrunGoverned` (wrun-hosted-wire-caps `wrunGovernedDetailsOfText`) read by the one
|
|
73
|
+
* fail-closed reader (`wrunGovernedMarkOf`), on the failure or any `cause` it wraps. Undefined: no mark anywhere.
|
|
74
|
+
*/
|
|
75
|
+
export function wrunFailureGovernedOf(error) {
|
|
76
|
+
let at = error;
|
|
77
|
+
for (let depth = 0; depth < FAILURE_CAUSE_DEPTH && at !== undefined && at !== null; depth += 1) {
|
|
78
|
+
if (typeof at === 'string')
|
|
79
|
+
return wrunGovernedMarkOf(wrunGovernedDetailsOfText(at));
|
|
80
|
+
if (typeof at !== 'object')
|
|
81
|
+
return undefined;
|
|
82
|
+
const held = at[FAILURE_GOVERNED_KEY];
|
|
83
|
+
if (typeof held === 'object' && held !== null)
|
|
84
|
+
return held;
|
|
85
|
+
const message = at.message;
|
|
86
|
+
const relayed = typeof message === 'string' ? wrunGovernedMarkOf(wrunGovernedDetailsOfText(message)) : undefined;
|
|
87
|
+
if (relayed !== undefined)
|
|
88
|
+
return relayed;
|
|
89
|
+
at = at.cause;
|
|
90
|
+
}
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Read a failure's governed-plane mark (`wrunFailureGovernedOf`), then take the relayed governed trailer off the text
|
|
95
|
+
* of the failure and every `cause` it wraps, so every reader past it (the trap row, the refusal records, the console)
|
|
96
|
+
* reads the frame's words as before. Answers the mark.
|
|
97
|
+
*/
|
|
98
|
+
export function takeWrunFailureGoverned(error) {
|
|
99
|
+
const mark = wrunFailureGovernedOf(error);
|
|
100
|
+
let at = error;
|
|
101
|
+
for (let depth = 0; depth < FAILURE_CAUSE_DEPTH && typeof at === 'object' && at !== null; depth += 1) {
|
|
102
|
+
const message = at.message;
|
|
103
|
+
if (typeof message === 'string') {
|
|
104
|
+
const stripped = wrunTextWithoutGovernedTrailer(message);
|
|
105
|
+
if (stripped !== message) {
|
|
106
|
+
try {
|
|
107
|
+
at.message = stripped;
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
// A read-only message keeps its text: the mark is read already.
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
at = at.cause;
|
|
115
|
+
}
|
|
116
|
+
return mark;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Whether a hosted run's result read CME: the chart is on the CME plane, the sheet pins a CME market (`sheetPinsCme`,
|
|
120
|
+
* the run head's reading), or the server's mark names CME. Never the run's author or lane.
|
|
121
|
+
*/
|
|
122
|
+
export function wrunHostedRunReadsCme(args) {
|
|
123
|
+
return payloadTouchesCmeVenue(args.chartExchange) || args.sheetPinsCme || wrunGovernedReadsCme(args.governed);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Stamp the overlay a hosted run's CME result lands on, through the host's CME writer (`setOverlayCmeProvenance`, both
|
|
127
|
+
* settings copies), then read the stamp back off the mounted overlay. `owns` judges, in the same task as the write,
|
|
128
|
+
* that the run still owns its overlay (a replacement mounted under the same id is another overlay, never written).
|
|
129
|
+
* Answers whether the overlay carries the stamp now; false fails the batch (fail closed). Never clears.
|
|
130
|
+
*/
|
|
131
|
+
export async function stampWrunHostedCme(chartIndex, indicatorId, meta, owns) {
|
|
132
|
+
let write;
|
|
133
|
+
try {
|
|
134
|
+
write = (await wrunChartHostEnv().chart.loadOptionsOverlayProvenance()).setOverlayCmeProvenance;
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
console.warn(`[wrun] the CME writer for '${indicatorId}' did not load; its hosted result is dropped:`, error);
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
if (write === undefined || !owns())
|
|
141
|
+
return false;
|
|
142
|
+
// Written even over a stamped mount: both copies carry it after (the writer is idempotent).
|
|
143
|
+
try {
|
|
144
|
+
write(chartIndex, indicatorId, true);
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
console.warn(`[wrun] the CME stamp of '${indicatorId}' was not written; its hosted result is dropped:`, error);
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
return wrunOverlayCmeStamped(meta);
|
|
151
|
+
}
|
|
@@ -37,9 +37,9 @@ export declare function isWrunHudViewerRowKey(key: string): boolean;
|
|
|
37
37
|
export declare const WRUN_HEATMAP_SENSITIVITY_ROW_RE: RegExp;
|
|
38
38
|
export declare function isWrunHeatmapSensitivityRowKey(key: string): boolean;
|
|
39
39
|
/** Every viewer row of a browser-run Indicator (a HUD's rows, a heatmap's
|
|
40
|
-
* Sensitivity, a child the reader hid on its own legend row
|
|
41
|
-
* overlay settings that persist by key and
|
|
42
|
-
* param or a host param. */
|
|
40
|
+
* Sensitivity, a child the reader hid on its own legend row, the height a
|
|
41
|
+
* reader dragged a child's pane to): overlay settings that persist by key and
|
|
42
|
+
* are never a sheet param, an alert param or a host param. */
|
|
43
43
|
export declare function isWrunViewerRowKey(key: string): boolean;
|
|
44
44
|
/** `((r * 256 + g) * 256 + b) * 1024 + round(alpha * 1000)`, arithmetic
|
|
45
45
|
* (the value outgrows 32-bit bitwise ops). */
|