@orangecharts/wrun-chart-host 0.14.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 +11 -0
- package/dist/constants/feature-flags.constants.js +56 -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 +24 -0
- package/dist/host-env.js +22 -0
- package/dist/host-ports.types.d.ts +11 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/interfaces/kscript-diagnostics.interface.d.ts +28 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +107 -4
- 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/market-data/venues/index.d.ts +2 -2
- package/dist/market-data/venues/opra.js +3 -3
- package/dist/market-data/venues/stocks.contract.copy.json +3 -2
- package/dist/market-data/venues/stocks.d.ts +2 -2
- package/dist/market-data/venues/stocks.js +10 -9
- 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 +46 -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 +65 -0
- package/dist/utility/chart/cache-alignment.util.js +124 -24
- 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-band.util.d.ts +21 -5
- package/dist/utility/chart/footprint-band.util.js +53 -14
- 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/chart/wrun-run-result.util.d.ts +9 -1
- package/dist/utility/chart/wrun-run-result.util.js +8 -2
- 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 +15 -5
- package/dist/utility/wrun/wrun-batched-marks.util.js +70 -20
- package/dist/utility/wrun/wrun-canvases.util.d.ts +28 -9
- package/dist/utility/wrun/wrun-canvases.util.js +99 -39
- 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-hover.util.d.ts +8 -2
- package/dist/utility/wrun/wrun-hover.util.js +24 -13
- 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 +81 -19
- package/dist/utility/wrun/wrun-output-words.util.d.ts +14 -0
- package/dist/utility/wrun/wrun-output-words.util.js +51 -0
- package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +41 -0
- package/dist/utility/wrun/wrun-overlay-drivers.util.js +35 -0
- package/dist/utility/wrun/wrun-overlay-result.util.d.ts +6 -1
- package/dist/utility/wrun/wrun-overlay-result.util.js +2 -0
- package/dist/utility/wrun/wrun-overlay-run.util.d.ts +23 -2
- package/dist/utility/wrun/wrun-overlay-run.util.js +305 -51
- package/dist/utility/wrun/wrun-panel-mount.util.d.ts +10 -2
- package/dist/utility/wrun/wrun-panel-mount.util.js +144 -18
- 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-run-health.util.d.ts +6 -3
- package/dist/utility/wrun/wrun-run-health.util.js +5 -2
- 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-script-inputs.util.d.ts +25 -8
- package/dist/utility/wrun/wrun-script-inputs.util.js +145 -45
- 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-names.util.d.ts +23 -0
- package/dist/utility/wrun/wrun-style-names.util.js +74 -0
- 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,34 @@ export async function readWrunHostedWire(output) {
|
|
|
6
6
|
const { decodeWrunHostedWire } = await wrunChartHostEnv().loadSharedHost();
|
|
7
7
|
return decodeWrunHostedWire(output);
|
|
8
8
|
}
|
|
9
|
+
const WRUN_GOVERNED_PLANES = ['cme', 'stocks'];
|
|
10
|
+
/**
|
|
11
|
+
* Read a reply's `wrunGoverned` mark: undefined when the reply carries no such record or it names no plane. A plane is
|
|
12
|
+
* named by an own key holding anything but `undefined`, `null` or `false` (fail closed: the mark withholds, so a
|
|
13
|
+
* receipt the chart cannot read still marks its plane); its receipt fields ride only when well formed.
|
|
14
|
+
*/
|
|
15
|
+
export function readWrunGovernedMark(value) {
|
|
16
|
+
if (!isRecord(value))
|
|
17
|
+
return undefined;
|
|
18
|
+
const mark = {};
|
|
19
|
+
for (const plane of WRUN_GOVERNED_PLANES) {
|
|
20
|
+
if (!Object.hasOwn(value, plane))
|
|
21
|
+
continue;
|
|
22
|
+
const entry = value[plane];
|
|
23
|
+
if (entry === undefined || entry === null || entry === false)
|
|
24
|
+
continue;
|
|
25
|
+
const read = {};
|
|
26
|
+
if (isRecord(entry)) {
|
|
27
|
+
if (typeof entry.tier === 'string' && entry.tier.length > 0)
|
|
28
|
+
read.tier = entry.tier;
|
|
29
|
+
const delay = entry.delaySeconds;
|
|
30
|
+
if (typeof delay === 'number' && Number.isFinite(delay) && delay >= 0)
|
|
31
|
+
read.delaySeconds = delay;
|
|
32
|
+
}
|
|
33
|
+
mark[plane] = read;
|
|
34
|
+
}
|
|
35
|
+
return Object.keys(mark).length > 0 ? mark : undefined;
|
|
36
|
+
}
|
|
9
37
|
/** Read a reply's run-level keys beside the wire: each own key exactly as the reply carries it (the OPRA mark only as
|
|
10
38
|
* the boolean `true`, its receipt only beside it), never a key inside `wrunHost`. A reply that is not a record
|
|
11
39
|
* carries none. */
|
|
@@ -32,8 +60,34 @@ export function readWrunHostedRunLevel(output) {
|
|
|
32
60
|
level.wrunOpraDelaySeconds = delay;
|
|
33
61
|
}
|
|
34
62
|
}
|
|
63
|
+
const governed = Object.hasOwn(output, 'wrunGoverned') ? readWrunGovernedMark(output.wrunGoverned) : undefined;
|
|
64
|
+
if (governed !== undefined)
|
|
65
|
+
level.wrunGoverned = governed;
|
|
35
66
|
return level;
|
|
36
67
|
}
|
|
68
|
+
/** A mark that names every governed plane with no receipt: what a mark the chart cannot read stands for. */
|
|
69
|
+
const WRUN_GOVERNED_UNREADABLE = Object.freeze({ cme: {}, stocks: {} });
|
|
70
|
+
/**
|
|
71
|
+
* THE one fail-closed reader of a governed run's server mark, for every reader of a cloud answer (the socket row
|
|
72
|
+
* source's replies and live frames, its error frames' relayed details, the Cloud test's reply and error frame): the
|
|
73
|
+
* `wrunGoverned` key of `container` (a reply's `output`, or an error frame's `details`). A key holding anything but
|
|
74
|
+
* nothing (`undefined`, `null`, `false`) or a record is a mark the chart cannot read, and names every plane
|
|
75
|
+
* (`WRUN_GOVERNED_UNREADABLE`: a `true`, a word, a number, an array). A record naming no plane is no mark. Lane-blind and
|
|
76
|
+
* author-blind: the mark alone decides.
|
|
77
|
+
*/
|
|
78
|
+
export function wrunGovernedMarkOf(container) {
|
|
79
|
+
if (typeof container !== 'object' || container === null)
|
|
80
|
+
return undefined;
|
|
81
|
+
const read = readWrunHostedRunLevel(container).wrunGoverned;
|
|
82
|
+
if (read !== undefined)
|
|
83
|
+
return read;
|
|
84
|
+
if (!Object.hasOwn(container, 'wrunGoverned'))
|
|
85
|
+
return undefined;
|
|
86
|
+
const raw = container.wrunGoverned;
|
|
87
|
+
if (raw === undefined || raw === null || raw === false)
|
|
88
|
+
return undefined;
|
|
89
|
+
return isRecord(raw) ? undefined : WRUN_GOVERNED_UNREADABLE;
|
|
90
|
+
}
|
|
37
91
|
function isRecord(value) {
|
|
38
92
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
39
93
|
}
|
|
@@ -39,12 +39,16 @@ import { type WrunColorTheme } from './wrun-style-words.util.js';
|
|
|
39
39
|
* `colorTheme` (DW13, TH-theme-tokens): the owning chart's palette; with it
|
|
40
40
|
* every colour word a block or an output declares resolves here (a theme
|
|
41
41
|
* token becomes the chart's colour), without it the words pass as written.
|
|
42
|
+
* `builtIn` (TWIN-LEGEND): the built-in the package ports (builtinPortOf),
|
|
43
|
+
* whose words name every line it names on the card, like the legend
|
|
44
|
+
* (wrun-output-words.util); absent, the sheet's words.
|
|
42
45
|
*/
|
|
43
46
|
export interface WrunValuePlacement {
|
|
44
47
|
priceDigits: number;
|
|
45
48
|
onPrice: (name: string | undefined) => boolean;
|
|
46
49
|
builtinTwin?: WrunBuiltinTwin;
|
|
47
50
|
colorTheme?: WrunColorTheme;
|
|
51
|
+
builtIn?: string;
|
|
48
52
|
}
|
|
49
53
|
/** The number-format companions an output declares beside `format` (OT32,
|
|
50
54
|
* conventions 8): the formatter's 4th argument. */
|
|
@@ -123,8 +127,10 @@ export declare const WRUN_SPARK_DEFAULT_BARS = 32;
|
|
|
123
127
|
* else undefined. The gate paintColor and every block view sink (WrunBlocks) share. */
|
|
124
128
|
export declare function wrunPaintColor(value: unknown): string | undefined;
|
|
125
129
|
/** An output's display label: the declared `label`, else its name read as
|
|
126
|
-
* words (the legend's own rule, wrunLegendName)
|
|
127
|
-
|
|
130
|
+
* words (the legend's own rule, wrunLegendName); for a package that ports
|
|
131
|
+
* built-in `builtIn`, a line the built-in names in its built-in's words
|
|
132
|
+
* (wrunOutputWords, the words its legend line carries). */
|
|
133
|
+
export declare function wrunOutputDisplayLabel(output: Pick<WrunMetadataOutput, 'name' | 'label'>, builtIn?: string): string;
|
|
128
134
|
/** A sheet name as a legend surface prints it where the declaration carries
|
|
129
135
|
* no words of its own (a `render.legend` entry without `text`, a HUD's
|
|
130
136
|
* settings rows): the legend's own rule (wrunLegendName: `spot_entry` reads
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
* unknown name stays as written too, so a typo shows instead of vanishing.
|
|
24
24
|
*/
|
|
25
25
|
import { wrunLegendName } from '../chart/wrun-legend-name.util.js';
|
|
26
|
+
import { wrunDeclaredOutputWords, wrunOutputWords } from './wrun-output-words.util.js';
|
|
26
27
|
import { WRUN_MAX_BLOCK_HEIGHT_PX, WRUN_MAX_HUD_FONT_SIZE_PX, WRUN_MAX_HUD_RINGS, WRUN_MIN_BLOCK_HEIGHT_PX, WRUN_MIN_HUD_FONT_SIZE_PX, isWrunRowLeader, wrunBlockDraw, } from './wrun-hud-looks.util.js';
|
|
27
28
|
import { formatWrunLegendValue, formatWrunValue, isWrunValueFormat, } from './wrun-pane-format.util.js';
|
|
28
29
|
import { isWrunColorWord, parseWrunThemeToken, resolveWrunColorWord, } from './wrun-style-words.util.js';
|
|
@@ -127,9 +128,11 @@ function paintColor(word, placement) {
|
|
|
127
128
|
return isWrunColorWord(word) || wrunPaintColor(word) !== undefined ? word : undefined;
|
|
128
129
|
}
|
|
129
130
|
/** An output's display label: the declared `label`, else its name read as
|
|
130
|
-
* words (the legend's own rule, wrunLegendName)
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
* words (the legend's own rule, wrunLegendName); for a package that ports
|
|
132
|
+
* built-in `builtIn`, a line the built-in names in its built-in's words
|
|
133
|
+
* (wrunOutputWords, the words its legend line carries). */
|
|
134
|
+
export function wrunOutputDisplayLabel(output, builtIn) {
|
|
135
|
+
return wrunOutputWords(output, builtIn);
|
|
133
136
|
}
|
|
134
137
|
/** A sheet name as a legend surface prints it where the declaration carries
|
|
135
138
|
* no words of its own (a `render.legend` entry without `text`, a HUD's
|
|
@@ -227,14 +230,17 @@ function referenceText(name, format, snapshot, metadata, placement) {
|
|
|
227
230
|
const output = outputByName(metadata, name);
|
|
228
231
|
return formatPlacedValue(latestValue(snapshot, name), name, formatWordFor(format, output), placement, formatOptionsFor(output));
|
|
229
232
|
}
|
|
230
|
-
/** The label a block shows: its own
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
233
|
+
/** The label a block shows: its own (words that restate its output's line
|
|
234
|
+
* read that line's words, wrunDeclaredOutputWords), else its reference's
|
|
235
|
+
* display label; `builtIn` names a built-in port's lines in its words. */
|
|
236
|
+
function blockLabel(block, metadata, builtIn) {
|
|
234
237
|
const name = block.output ?? block.slot;
|
|
235
238
|
const output = outputByName(metadata, name);
|
|
239
|
+
if (typeof block.label === 'string' && block.label.trim() !== '') {
|
|
240
|
+
return wrunDeclaredOutputWords(block.label, output, builtIn);
|
|
241
|
+
}
|
|
236
242
|
if (output !== undefined)
|
|
237
|
-
return wrunOutputDisplayLabel(output);
|
|
243
|
+
return wrunOutputDisplayLabel(output, builtIn);
|
|
238
244
|
return name === undefined ? undefined : wrunLegendName(name);
|
|
239
245
|
}
|
|
240
246
|
/** The kinds that draw a mark in the series' own colour (a sparkline, an
|
|
@@ -297,9 +303,12 @@ function ringViews(block, snapshot, metadata, placement) {
|
|
|
297
303
|
const output = outputByName(metadata, ring.output);
|
|
298
304
|
const current = latestValue(snapshot, ring.output);
|
|
299
305
|
const color = paintColor(typeof ring.color === 'string' && ring.color !== '' ? ring.color : undefined, placement);
|
|
306
|
+
const builtIn = placement?.builtIn;
|
|
300
307
|
return [
|
|
301
308
|
{
|
|
302
|
-
label: typeof ring.label === 'string' && ring.label !== ''
|
|
309
|
+
label: typeof ring.label === 'string' && ring.label !== ''
|
|
310
|
+
? wrunDeclaredOutputWords(ring.label, output, builtIn)
|
|
311
|
+
: wrunOutputWords(output ?? { name: ring.output }, builtIn),
|
|
303
312
|
value: formatPlacedValue(current, ring.output, formatWordFor(undefined, output), placement, formatOptionsFor(output)),
|
|
304
313
|
fraction: shareOf(current, ring.min, ring.max) ?? 0,
|
|
305
314
|
...(color !== undefined ? { color } : {}),
|
|
@@ -331,7 +340,7 @@ function deltaTone(delta) {
|
|
|
331
340
|
function buildBlockView(block, snapshot, metadata, placement) {
|
|
332
341
|
if (!block || typeof block !== 'object')
|
|
333
342
|
return undefined;
|
|
334
|
-
const label = blockLabel(block, metadata);
|
|
343
|
+
const label = blockLabel(block, metadata, placement?.builtIn);
|
|
335
344
|
const color = blockColor(block, snapshot, metadata, placement);
|
|
336
345
|
const labelled = label !== undefined ? { label } : {};
|
|
337
346
|
const words = blockLookWords(block);
|
|
@@ -408,11 +417,13 @@ function buildBlockView(block, snapshot, metadata, placement) {
|
|
|
408
417
|
// A row is [label, reference] or [label, reference, format].
|
|
409
418
|
const [rowLabel, reference, rowFormat] = row;
|
|
410
419
|
const name = typeof reference === 'string' ? reference : undefined;
|
|
411
|
-
const
|
|
420
|
+
const output = outputByName(metadata, name);
|
|
421
|
+
const swatch = paintColor(output?.color, placement);
|
|
412
422
|
const format = typeof rowFormat === 'string' ? rowFormat : undefined;
|
|
413
423
|
return [
|
|
414
424
|
{
|
|
415
|
-
|
|
425
|
+
// A row that names its line by the line's own words reads them as the legend does.
|
|
426
|
+
label: wrunDeclaredOutputWords(rowLabel, output, placement?.builtIn),
|
|
416
427
|
value: referenceText(name, format, snapshot, metadata, placement),
|
|
417
428
|
...(swatch !== undefined ? { swatch } : {}),
|
|
418
429
|
},
|
|
@@ -511,7 +522,7 @@ const WRUN_HEADER_SEPARATOR = ' \u00b7 ';
|
|
|
511
522
|
*/
|
|
512
523
|
export function wrunOutputHoverView(output, snapshot, metadata, options = {}) {
|
|
513
524
|
const { placement } = options;
|
|
514
|
-
const label = wrunOutputDisplayLabel(output);
|
|
525
|
+
const label = wrunOutputDisplayLabel(output, placement?.builtIn);
|
|
515
526
|
const value = options.value ?? latestValue(snapshot, output.name);
|
|
516
527
|
const format = formatWordFor(undefined, output);
|
|
517
528
|
const formatOptions = formatOptionsFor(output);
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
*/
|
|
23
23
|
import type { WrunGaugeDraw, WrunHoverBlock, WrunHud, WrunHudChrome, WrunHudLook, WrunIndicatorMetadata, WrunMeterDraw, WrunPillDraw, WrunSparkDraw, WrunTextCase } from '../../interfaces/wrun-runtime.interface.js';
|
|
24
24
|
import type { WrunLatestSnapshot } from './wrun-latest-snapshot.js';
|
|
25
|
+
import './wrun-colour-tone.util.js';
|
|
25
26
|
import { type WrunColorTheme, type WrunFontFamily, type WrunFontWeight } from './wrun-style-words.util.js';
|
|
26
27
|
/** LK01: the looks, the rows of the look table. */
|
|
27
28
|
export declare const WRUN_HUD_LOOKS: readonly ["default", "glass", "stage", "signal", "terminal", "broadsheet", "chart_desk", "dial", "grid", "cockpit", "phosphor", "classic"];
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
// Bound before the fallback palette below reads the mark colours (off the boot path).
|
|
2
|
+
import './wrun-colour-tone.util.js';
|
|
3
|
+
import { WRUN_FONT_FAMILIES, isWrunColorWord, resolveWrunColorWord, wrunColorThemeOf, wrunFontFamilyCss, wrunFontWeightCss, } from './wrun-style-words.util.js';
|
|
2
4
|
// ── Word lists (the om kit's `wrun-style/widgets.ts`, restated) ──────────────
|
|
3
5
|
/** LK01: the looks, the rows of the look table. */
|
|
4
6
|
export const WRUN_HUD_LOOKS = [
|
|
@@ -534,16 +536,9 @@ export function resolveWrunHudLook(entry, options = {}) {
|
|
|
534
536
|
css,
|
|
535
537
|
};
|
|
536
538
|
}
|
|
537
|
-
/** The dark-chart palette a resolver without a chart answers `theme.down` with
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
down: '#ef5350',
|
|
541
|
-
text: '#d1d4dc',
|
|
542
|
-
muted: 'rgba(209, 212, 220, 0.55)',
|
|
543
|
-
bg: '#131722',
|
|
544
|
-
grid: '#2a2e39',
|
|
545
|
-
accent: '#ff4608',
|
|
546
|
-
};
|
|
539
|
+
/** The dark-chart palette a resolver without a chart answers `theme.down` with
|
|
540
|
+
* (the palette a chart without a theme answers). */
|
|
541
|
+
const FALLBACK_THEME = wrunColorThemeOf(undefined);
|
|
547
542
|
/**
|
|
548
543
|
* The defaults the look in force gives a tile of `kind` (undefined fields
|
|
549
544
|
* keep the kit's own drawing). `cardMark` is the card's first meter mark, the
|
|
@@ -12,6 +12,30 @@ import type { WrunRunReason } from './wrun-lifecycle.contract.js';
|
|
|
12
12
|
/** The core's `owedFullIntegration` for a wrun run: one of the reasons above,
|
|
13
13
|
* or no good result on the overlay yet. */
|
|
14
14
|
export declare function wrunRunOwesFullIntegration(reason: WrunRunReason, hasGoodResult: boolean): boolean;
|
|
15
|
+
/** What a run's drawings do to the overlay's mounted drawing set. */
|
|
16
|
+
export type WrunRunDrawingsPlan = 'replace' | 'keep-mounted';
|
|
17
|
+
/**
|
|
18
|
+
* The drawings rule of a wrun run, beside its row route (both apply routes, the rows merge and the remount, read it).
|
|
19
|
+
* A script's handles make and delete drawings over the whole history it ran on (a session level deleted after 13
|
|
20
|
+
* sessions, a gap mitigated weeks later), so only a whole-range run can produce the set the newest bar should show. A
|
|
21
|
+
* partial window (the pan wave's clamped span, a prefix page) answers rows inside that window only: its rows apply on
|
|
22
|
+
* their route, but its drawings never replace the mounted set, which stays until a whole-range result lands. A run that
|
|
23
|
+
* owes a full integration (no good result yet, or a reason that asks a new question: new settings, another market, a
|
|
24
|
+
* resume) replaces whatever its window, since the mounted set answers an old question or nothing. A redraw of the live
|
|
25
|
+
* session's own computation (its reseed, its style repaint, its TPO block refine) replaces too: the session's set is
|
|
26
|
+
* what every live tick mounts (wrun-live-tick.util hands the tick's whole result to the drawing door), so a redraw that
|
|
27
|
+
* kept the older set would leave the old look until the next tick, and on a quiet market until a whole-range run.
|
|
28
|
+
* 'keep-mounted' means the mounted set is LEFT ALONE: the adapter is handed no drawings and told so
|
|
29
|
+
* (`keepMountedDrawings`), never handed the mounted set back as input.
|
|
30
|
+
*/
|
|
31
|
+
export declare function wrunRunDrawingsPlan(input: {
|
|
32
|
+
/** The run computed a window narrower than the loaded range (`WrunRunWindow.partial`). */
|
|
33
|
+
partialWindow: boolean;
|
|
34
|
+
/** `wrunRunOwesFullIntegration` for the run. */
|
|
35
|
+
owedFullIntegration: boolean;
|
|
36
|
+
/** The result redraws the overlay's live session's own computation (`WrunIntegrateOptions.sessionRedraw`). */
|
|
37
|
+
sessionRedraw: boolean;
|
|
38
|
+
}): WrunRunDrawingsPlan;
|
|
15
39
|
export interface WrunIntegrationRouteInput {
|
|
16
40
|
reason: WrunRunReason;
|
|
17
41
|
/** The overlay shows a result an earlier run of this lane integrated. */
|
|
@@ -25,6 +25,25 @@ const WRUN_FULL_INTEGRATION_REASONS = new Set([
|
|
|
25
25
|
export function wrunRunOwesFullIntegration(reason, hasGoodResult) {
|
|
26
26
|
return !hasGoodResult || WRUN_FULL_INTEGRATION_REASONS.has(reason);
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* The drawings rule of a wrun run, beside its row route (both apply routes, the rows merge and the remount, read it).
|
|
30
|
+
* A script's handles make and delete drawings over the whole history it ran on (a session level deleted after 13
|
|
31
|
+
* sessions, a gap mitigated weeks later), so only a whole-range run can produce the set the newest bar should show. A
|
|
32
|
+
* partial window (the pan wave's clamped span, a prefix page) answers rows inside that window only: its rows apply on
|
|
33
|
+
* their route, but its drawings never replace the mounted set, which stays until a whole-range result lands. A run that
|
|
34
|
+
* owes a full integration (no good result yet, or a reason that asks a new question: new settings, another market, a
|
|
35
|
+
* resume) replaces whatever its window, since the mounted set answers an old question or nothing. A redraw of the live
|
|
36
|
+
* session's own computation (its reseed, its style repaint, its TPO block refine) replaces too: the session's set is
|
|
37
|
+
* what every live tick mounts (wrun-live-tick.util hands the tick's whole result to the drawing door), so a redraw that
|
|
38
|
+
* kept the older set would leave the old look until the next tick, and on a quiet market until a whole-range run.
|
|
39
|
+
* 'keep-mounted' means the mounted set is LEFT ALONE: the adapter is handed no drawings and told so
|
|
40
|
+
* (`keepMountedDrawings`), never handed the mounted set back as input.
|
|
41
|
+
*/
|
|
42
|
+
export function wrunRunDrawingsPlan(input) {
|
|
43
|
+
if (input.sessionRedraw)
|
|
44
|
+
return 'replace';
|
|
45
|
+
return input.partialWindow && !input.owedFullIntegration ? 'keep-mounted' : 'replace';
|
|
46
|
+
}
|
|
28
47
|
/**
|
|
29
48
|
* In order: the identity check, the unchanged-result skip (never over stale
|
|
30
49
|
* settings or an owed full integration), then the core. Its inputs: stale
|
|
@@ -76,6 +76,8 @@ import { FUNDING_INTERVAL_MAP } from '../../constants/overlay-data.constants.js'
|
|
|
76
76
|
import { liveCandleAtInterval, mergeLiveOhlcvDataPoint } from '../../kscript-data/controls/live-ohlcv-merge.util.js';
|
|
77
77
|
import { liveTradeOfPoint, mergeLiveTradesDataPoint, readLiveTradePrint, tradesBarStartMs, tradesTapeCellSize, tradesTapeFloorValuesPrints, } from '../../kscript-data/controls/live-trades-merge.util.js';
|
|
78
78
|
import { liveAmountUsd, peekOptionTradeUnits } from '../options/option-trade-units.util.js';
|
|
79
|
+
import { profileFrameLastInstantMs } from '../chart/profile-frame-window.util.js';
|
|
80
|
+
import { isInScriptSourceSession, isVolumeProfileLiveFrameInSession, tapeSourceSessionHours, } from '../chart/script-source-session.util.js';
|
|
79
81
|
import { parseWrunTapeHistory, wrunTapeHistoryOf } from './wrun-tape-source.util.js';
|
|
80
82
|
import { noteWrunCoinTapePrice } from './wrun-tape-coins.util.js';
|
|
81
83
|
import { wrunDollarUnitReader } from './wrun-dollar-unit-port.leaf.js';
|
|
@@ -695,7 +697,16 @@ rowMarket = market) {
|
|
|
695
697
|
*/
|
|
696
698
|
export function wrunTapeHostBarResolver(intervalMs, market, rowMarket = market) {
|
|
697
699
|
const grids = wrunLaneHostGridsOf('trades', intervalMs, market, rowMarket);
|
|
698
|
-
|
|
700
|
+
const hostBarOf = grids && hostBucketResolverFor(intervalMs, grids.hostBar);
|
|
701
|
+
const sessionHours = tapeSourceSessionHours(market, intervalMs, rowMarket);
|
|
702
|
+
if (sessionHours === undefined || !rowMarket)
|
|
703
|
+
return hostBarOf;
|
|
704
|
+
// The history worker serves no print outside the candle's session (script-source-session.util): no bar holds one live.
|
|
705
|
+
return (instantMs) => !isInScriptSourceSession(sessionHours, rowMarket.exchange, rowMarket.symbol, instantMs)
|
|
706
|
+
? null
|
|
707
|
+
: hostBarOf
|
|
708
|
+
? hostBarOf(instantMs)
|
|
709
|
+
: tradesBarStartMs(instantMs, intervalMs, rowMarket.exchange);
|
|
699
710
|
}
|
|
700
711
|
/** The bar a tape print folds into (`wrunTapeHostBarResolver`'s host bar, else its own grid's): the fold, the queue's
|
|
701
712
|
* loss marks and the reconcile's drops key a print here, so they name one bar. Null: no chart bar holds it. */
|
|
@@ -834,6 +845,11 @@ function foldVpPoint(rows, rowIndexOf, point, intervalMs, acquisition, market) {
|
|
|
834
845
|
if (!(gridHeight > 0))
|
|
835
846
|
return null;
|
|
836
847
|
const precision = getDecimalPlaces(gridHeight);
|
|
848
|
+
// A day-plus bar of a regular stock chart reads its session's ladder only (script-source-session.util), judged at
|
|
849
|
+
// the last instant inside the frame's window: its stamp is the window's end.
|
|
850
|
+
const lastInstantMs = profileFrameLastInstantMs(vpa);
|
|
851
|
+
if (lastInstantMs !== null && !isVolumeProfileLiveFrameInSession(market, intervalMs, lastInstantMs))
|
|
852
|
+
return null;
|
|
837
853
|
const bucket = wrunLiveBucketTs('volume_profile', tsMs, intervalMs, market);
|
|
838
854
|
if (bucket === null)
|
|
839
855
|
return null;
|
|
@@ -54,7 +54,12 @@ export declare function wrunLiveValuesEqual(a: unknown, b: unknown): boolean;
|
|
|
54
54
|
* differs from its set's first row (stamped among unstamped, or the reverse)
|
|
55
55
|
* is structural.
|
|
56
56
|
*/
|
|
57
|
-
export declare function diffWrunLiveResults(applied: WrunRunResult, next: WrunRunResult
|
|
57
|
+
export declare function diffWrunLiveResults(applied: WrunRunResult, next: WrunRunResult,
|
|
58
|
+
/** Filled with the drawings half of the verdict: whether the drawings or the drawing budget's counts changed
|
|
59
|
+
* (true whenever the diff stopped before comparing them). */
|
|
60
|
+
out?: {
|
|
61
|
+
drawingsChanged?: boolean;
|
|
62
|
+
}): WrunLiveResultChange;
|
|
58
63
|
/** The chart's bars and the run clock a result applies on. */
|
|
59
64
|
export declare function wrunLiveChartBarsOf(rows: ReadonlyArray<ArrayLike<number>>, clock: {
|
|
60
65
|
runMs: number;
|
|
@@ -130,7 +130,12 @@ function budgetCounts(budget) {
|
|
|
130
130
|
* differs from its set's first row (stamped among unstamped, or the reverse)
|
|
131
131
|
* is structural.
|
|
132
132
|
*/
|
|
133
|
-
export function diffWrunLiveResults(applied, next
|
|
133
|
+
export function diffWrunLiveResults(applied, next,
|
|
134
|
+
/** Filled with the drawings half of the verdict: whether the drawings or the drawing budget's counts changed
|
|
135
|
+
* (true whenever the diff stopped before comparing them). */
|
|
136
|
+
out) {
|
|
137
|
+
if (out)
|
|
138
|
+
out.drawingsChanged = true;
|
|
134
139
|
const before = applied;
|
|
135
140
|
const after = next;
|
|
136
141
|
const ownKeys = (record) => Object.keys(record).filter((key) => !WRUN_LIVE_DIFF_OWN_FIELDS.has(key));
|
|
@@ -141,9 +146,10 @@ export function diffWrunLiveResults(applied, next) {
|
|
|
141
146
|
for (const key of afterKeys)
|
|
142
147
|
if (!wrunLiveValuesEqual(before[key], after[key]))
|
|
143
148
|
return STRUCTURAL;
|
|
144
|
-
let changed = !wrunLiveValuesEqual(before.drawings, after.drawings)
|
|
145
|
-
|
|
146
|
-
|
|
149
|
+
let changed = !wrunLiveValuesEqual(before.drawings, after.drawings) ||
|
|
150
|
+
!wrunLiveValuesEqual(budgetCounts(before.drawingsBudget), budgetCounts(after.drawingsBudget));
|
|
151
|
+
if (out)
|
|
152
|
+
out.drawingsChanged = changed;
|
|
147
153
|
const beforeOutputs = before.outputs;
|
|
148
154
|
const afterOutputs = after.outputs;
|
|
149
155
|
if (beforeOutputs === undefined && afterOutputs === undefined)
|
|
@@ -176,7 +176,7 @@ import { ensureWrunChartHostSharedHost, wrunChartHostEnv } from '../../host-env.
|
|
|
176
176
|
import { isPackedOhlcvRows, unpackOhlcvRows } from '../../instances/script-engine-worker-ohlcv-transfer.js';
|
|
177
177
|
import { findMonday } from '../chart/titan-constants.pin.js';
|
|
178
178
|
import { Intervals } from '../../constants/interval.constants.js';
|
|
179
|
-
import { barEndMs, barStartMs, prevBarStartMs } from '../chart/calendar-interval.util.js';
|
|
179
|
+
import { barEndMs, barStartMs, fixedGridFloorDivMs, prevBarStartMs } from '../chart/calendar-interval.util.js';
|
|
180
180
|
import { isRealChartTimeRangeMs } from '../chart/chart-time-domain.util.js';
|
|
181
181
|
import { resolveV2LiveEffectiveMinIntervalMs, V2_TECHNICAL_SCRIPT_LIVE_UPDATE_MIN_MS, } from '../chart/live-cadence.util.js';
|
|
182
182
|
import { noteWrunLiveHiddenHold, noteWrunLiveHiddenReturnDrains, noteWrunLiveHiddenRun, } from './wrun-live-hidden-hold.util.js';
|
|
@@ -227,7 +227,7 @@ import { serverNowMs } from '../auth/server-clock.util.js';
|
|
|
227
227
|
import { wrunModuleReadsBarCount } from './wrun-bar-count.util.js';
|
|
228
228
|
import { isWrunBatchedChildRefused, mountWrunChildOverlays } from './wrun-panel-mount.util.js';
|
|
229
229
|
import { getWrunBrowserHost, wrunLiveOf, WrunLiveOrderError, WrunLiveSessionLostError, } from './wrun-host.service.js';
|
|
230
|
-
import { getWrunOverlayLiveContext, isWrunOverlayRerunInFlight, onWrunOverlayLiveTeardown, rerunWrunOverlayForChartWave, setWrunChartRowsIdentityReader, setWrunLazyWaveAbsorber, setWrunLiveSheetReader, suspendWrunOverlayLiveSession, teardownWrunOverlay, withWrunOverlaySessionLock, wrunChartMarketIdentity, } from './wrun-overlay-drivers.util.js';
|
|
230
|
+
import { getWrunOverlayLiveContext, isWrunOverlayRerunInFlight, onWrunOverlayLiveTeardown, rerunWrunOverlayForChartWave, setWrunChartRowsIdentityReader, setWrunLazyWaveAbsorber, setWrunLiveSheetReader, suspendWrunOverlayLiveSession, teardownWrunOverlay, withWrunOverlaySessionLock, wrunChartMarketIdentity, wrunPictureIdentityOf, } from './wrun-overlay-drivers.util.js';
|
|
231
231
|
import { composeWrunSessionSources, takeWrunCompositionRevisionKept, wrunSessionCompositionToken, wrunSessionLanesOfContext, } from './wrun-session-composition.util.js';
|
|
232
232
|
import { withWrunOverlayExecutionMeasure } from './wrun-overlay-lifecycle.util.js';
|
|
233
233
|
import { cutWrunReplayRows, cutWrunReplayRowsAfterApply } from './wrun-replay-rows.util.js';
|
|
@@ -239,6 +239,7 @@ import { wrunCanvasChildId, wrunCellRowsOf } from './wrun-canvases.util.js';
|
|
|
239
239
|
import { readWrunBatchedSections, wrunBatchedChildId, wrunSheetHasBatchedMarks } from './wrun-batched-marks.util.js';
|
|
240
240
|
import { isWrunStyleTargetHidden } from './wrun-color-settings.util.js';
|
|
241
241
|
import { buildWrunOverlayRunResult, closedLegCandles, forgetWrunOverlayCanvasState, openLegCandles, wrunLegReadsFormingOpen, wrunLegReadsLiveCandleOnly, cutWrunOddsLegRows, placeWrunResultTables, presentWrunIntegration, publishWrunRunHealth, publishWrunSessionCanvasNotices, recordWrunHostBuildMs, reseedWrunOverlayFromBuffers, wrunCandleAskSource, wrunCanvasHostFillFor, wrunChartPriceDigits, wrunHostFillContextFor, wrunLegFetchType, wrunLegPayloadExtras, wrunIntegratedRowsView, wrunSessionCanvasFillOf, wrunSessionPinnedSheet, wrunSessionRespelledSheet, wrunResultMarketUnits, wrunSessionRunHealth, } from './wrun-overlay-run.util.js';
|
|
242
|
+
import { builtinPortOf } from './wrun-builtin-twin.util.js';
|
|
242
243
|
import { forgetWrunCanvasCache } from './wrun-canvas-cache.util.js';
|
|
243
244
|
import { wrunLegNativeRowsOption } from './wrun-pin-venues.util.js';
|
|
244
245
|
import { wrunSessionChartNamesOf } from './wrun-chart-context-names.util.js';
|
|
@@ -248,7 +249,7 @@ import { wrunLaneRefusalLeavesWindowOwed, wrunLaneRefusedCodeOf } from './wrun-l
|
|
|
248
249
|
import { WRUN_RUN_INTERVAL_ROWS_KEY, wrunRunIntervalComputeRows, wrunRunIntervalProjectionOf, wrunRunIntervalRowsThrough, wrunRunIntervalSentRow, wrunRunIntervalSessionOf, } from './wrun-run-interval-session.util.js';
|
|
249
250
|
import { WRUN_NO_READY_ROWS_CODE, wrunNothingReadyRefusal, wrunRunHealthDiagnostics } from './wrun-run-health.util.js';
|
|
250
251
|
import { attachWrunRefusal, serializeWrunRefusal, wrunOverlayEditable, wrunRefusalFor, } from './wrun-refusal.util.js';
|
|
251
|
-
import { noteWrunRunRetained, trimWrunRunDrawings } from './wrun-cap-notice.util.js';
|
|
252
|
+
import { noteWrunDrawingsSameAs, noteWrunRunRetained, trimWrunRunDrawings } from './wrun-cap-notice.util.js';
|
|
252
253
|
import { evictWrunRetainedOutputRows, ringWrunRunRetained, trimWrunRetainedCanvasLanes, wrunRetainedCanvasSources, wrunStrategyOnRows, } from './wrun-run-retained.util.js';
|
|
253
254
|
import { projectWrunRefusal, retractWrunRefusal, wrunRefusalRetractionCount } from './wrun-refusal-surface.util.js';
|
|
254
255
|
import { advanceWrunInputCarry, buildWrunInputTailRows, planWrunPinnedWires, wrunDeclaredSourceLanes, wrunDemandedSourceClass, wrunFormingBucketStart, wrunAskWirePieces, wrunChartIntervalKeyOf, wrunPinnedLegTierMs, wrunSourceVerdictWhole, wrunLaneAcquisitionIntervalMs, wrunLegRowHostBar, wrunLegRowVenue, wrunPinnedLegFetchSuffix, wrunTradeLegIntervals, wrunWireRowPieces, wrunChartCandleRows, wrunChartCandleRowsWithin, } from './wrun-source-rows.util.js';
|
|
@@ -1406,7 +1407,7 @@ function wrunPinnedLegCloseAt(leg, context, atMs) {
|
|
|
1406
1407
|
const { market } = context;
|
|
1407
1408
|
const settleMs = wrunLegCloseSettleMs(leg, market?.exchange, market?.sessionType);
|
|
1408
1409
|
const fromMs = atMs - settleMs;
|
|
1409
|
-
const open = leg.legMs === Intervals.WEEK ? findMonday(fromMs) :
|
|
1410
|
+
const open = leg.legMs === Intervals.WEEK ? findMonday(fromMs) : fixedGridFloorDivMs(fromMs, leg.legMs);
|
|
1410
1411
|
const closeMs = wrunLegBarCloseAt(leg, market?.exchange, fromMs, market?.sessionType, market?.symbol, context.intervalMs);
|
|
1411
1412
|
return (closeMs ?? open + leg.legMs) + settleMs;
|
|
1412
1413
|
}
|
|
@@ -1852,6 +1853,38 @@ async function extendWrunReplayRowLanes(context, owed, cursorTs) {
|
|
|
1852
1853
|
ledger.inFlight = false;
|
|
1853
1854
|
}
|
|
1854
1855
|
}
|
|
1856
|
+
/**
|
|
1857
|
+
* Whether a socket row source's live frame was computed over CME data: its governed mark (`WrunRowFrame.governed`, the
|
|
1858
|
+
* reply's `wrunGoverned`) names the CME plane. Fail closed: a frame carrying a mark that is not a record reads as
|
|
1859
|
+
* marked. A frame with no mark reads unmarked (the source carries a run's mark onto every later frame itself).
|
|
1860
|
+
*/
|
|
1861
|
+
function wrunLiveFrameReadsCme(frame) {
|
|
1862
|
+
if (!Object.hasOwn(frame, 'governed'))
|
|
1863
|
+
return false;
|
|
1864
|
+
const governed = frame.governed;
|
|
1865
|
+
if (governed === undefined || governed === null)
|
|
1866
|
+
return false;
|
|
1867
|
+
if (typeof governed !== 'object' || Array.isArray(governed))
|
|
1868
|
+
return true;
|
|
1869
|
+
return governed.cme !== undefined;
|
|
1870
|
+
}
|
|
1871
|
+
/**
|
|
1872
|
+
* Stamp the overlay a CME-marked live frame lands on (wrun-cloud-cme-stamp.util `stampWrunHostedCme`), unless its
|
|
1873
|
+
* result stamped it already. False when the stamp's module does not load or the stamp cannot be written: the frame is
|
|
1874
|
+
* skipped (fail closed).
|
|
1875
|
+
*/
|
|
1876
|
+
async function stampWrunLiveFrameCme(chartIndex, indicatorId, meta, owns) {
|
|
1877
|
+
try {
|
|
1878
|
+
const { stampWrunHostedCme, wrunOverlayCmeStamped } = await import('./wrun-cloud-cme-stamp.util.js');
|
|
1879
|
+
if (wrunOverlayCmeStamped(meta))
|
|
1880
|
+
return true;
|
|
1881
|
+
return await stampWrunHostedCme(chartIndex, indicatorId, meta, owns);
|
|
1882
|
+
}
|
|
1883
|
+
catch (error) {
|
|
1884
|
+
console.warn(`[wrun] the CME stamp of '${indicatorId}' did not load; its live frame is skipped:`, error);
|
|
1885
|
+
return false;
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1855
1888
|
/**
|
|
1856
1889
|
* A socket row source's live frames (WRUN-PARITY-PLAN C7, plan row 18), the drain's integrate of every
|
|
1857
1890
|
* frame folded since the last one (`queueWrunSourceLiveFrame`): the bars the cloud moved enter the live
|
|
@@ -1910,6 +1943,24 @@ export async function integrateWrunOverlayLiveFrame(indicatorId, frame, cellRows
|
|
|
1910
1943
|
return;
|
|
1911
1944
|
if (!wrunLiveTickEligible(context, generation))
|
|
1912
1945
|
return;
|
|
1946
|
+
// The CME twin (wrun-cloud-cme-stamp.util, the AI boundary that never opens): a frame the cloud computed over CME
|
|
1947
|
+
// (its governed mark names the plane, or a mark that cannot be read) is stamped before anything of it lands,
|
|
1948
|
+
// whoever wrote the script and whatever lane ran it, and a frame whose stamp cannot be written is skipped (fail
|
|
1949
|
+
// closed). An overlay its result stamped already is not written again. A frame never clears the stamp.
|
|
1950
|
+
// The stamp's module loads only for a marked frame (a frame of a run that reads no CME never pulls it in); one
|
|
1951
|
+
// that does not load fails the frame like a stamp that cannot be written.
|
|
1952
|
+
const readsCme = wrunLiveFrameReadsCme(frame);
|
|
1953
|
+
if (readsCme) {
|
|
1954
|
+
const owns = () => wrunLiveTickEligible(context, generation) &&
|
|
1955
|
+
tc.metadata?.includes(meta) === true;
|
|
1956
|
+
if (!(await stampWrunLiveFrameCme(context.chartIndex, indicatorId, meta, owns)))
|
|
1957
|
+
return;
|
|
1958
|
+
if (!wrunLiveTickEligible(context, generation))
|
|
1959
|
+
return;
|
|
1960
|
+
}
|
|
1961
|
+
// The session reads CME from here: its debug lines and its exports state it (the console provenance).
|
|
1962
|
+
if (readsCme)
|
|
1963
|
+
context.cmeRead = true;
|
|
1913
1964
|
// A frame with the mark names the receipt of the rows it carries (contract opra-server-lanes C4): the legend's
|
|
1914
1965
|
// served word follows it from this tick on, and a frame naming no tier leaves none (never the account's tier).
|
|
1915
1966
|
// The session reads OPRA from here: its debug lines state it (the console provenance).
|
|
@@ -1967,8 +2018,8 @@ export async function integrateWrunOverlayLiveFrame(indicatorId, frame, cellRows
|
|
|
1967
2018
|
hostStartMs,
|
|
1968
2019
|
cellRowsOf: () => cellRowsOf(ohlcvRows),
|
|
1969
2020
|
});
|
|
1970
|
-
//
|
|
1971
|
-
// callers (the replay lane's cutoff) read it as applied rather than reopening the session.
|
|
2021
|
+
// The engine's ordering door took the frame's apply as a deferred unit (integrateWrunLiveTail): the frame is
|
|
2022
|
+
// taken, so its callers (the replay lane's cutoff) read it as applied rather than reopening the session.
|
|
1972
2023
|
outcome = 'applied';
|
|
1973
2024
|
});
|
|
1974
2025
|
return outcome;
|
|
@@ -2800,14 +2851,14 @@ async function integrateWrunLiveTail(tail) {
|
|
|
2800
2851
|
return 'applied';
|
|
2801
2852
|
}
|
|
2802
2853
|
/**
|
|
2803
|
-
*
|
|
2804
|
-
*
|
|
2805
|
-
*
|
|
2806
|
-
*
|
|
2807
|
-
*
|
|
2808
|
-
*
|
|
2809
|
-
*
|
|
2810
|
-
*
|
|
2854
|
+
* Ordered behind the overlay's queued updates: while the engine's ingest queue still holds updates of this overlay
|
|
2855
|
+
* (a gesture's sliced ingest), the WHOLE apply phase of this integrate waits behind them as one host unit owned by
|
|
2856
|
+
* the overlay: the parent's live ladder, the child overlays (their pack wait included), the presentation, the
|
|
2857
|
+
* painted watermark and repaint bookkeeping, and the failure path. Nothing of it runs now, so no mounted row (the
|
|
2858
|
+
* parent's or a lower-pane child's) moves before the queued updates land. The door is the chart's own
|
|
2859
|
+
* `enqueueHeldHostApply` (live-feed.service.ts `enqueueHeldOverlayApply` calls the same door; the package reaches
|
|
2860
|
+
* the chart): it answers false when nothing of the overlay is queued, and inside a queued unit, and the integrate
|
|
2861
|
+
* then runs in the tick as before. True when the queue took the unit.
|
|
2811
2862
|
*/
|
|
2812
2863
|
function deferWrunLiveTailWhileHeld(tail) {
|
|
2813
2864
|
const door = tail.tc.enqueueHeldHostApply;
|
|
@@ -2821,11 +2872,11 @@ function deferWrunLiveTailWhileHeld(tail) {
|
|
|
2821
2872
|
}
|
|
2822
2873
|
}
|
|
2823
2874
|
/**
|
|
2824
|
-
* The
|
|
2875
|
+
* The queued unit when it runs. The tick's apply gates are read again (the context and its generation, replay, pause
|
|
2825
2876
|
* or a tripped guard, the market identity, protection, the pane budget), and the chart must still be the tick's chart
|
|
2826
2877
|
* mounting the tick's meta under the overlay id (a remount without a generation bump hands a fresh meta): a failing
|
|
2827
2878
|
* recheck drops the unit, nothing applied. The integrate starts inside the engine's drain, in order with the overlay's
|
|
2828
|
-
* other
|
|
2879
|
+
* other queued units; it does not take the session lock (that wait is a promise, and the parent's apply must land inside
|
|
2829
2880
|
* the unit), and a tick holding the lock meanwhile defers its own apply behind it while the engine still drains. A
|
|
2830
2881
|
* failure runs the tick's own failure path: the repaint stays owed and a classified refusal is said once.
|
|
2831
2882
|
*/
|
|
@@ -2841,11 +2892,11 @@ function replayWrunLiveTail(tail) {
|
|
|
2841
2892
|
// The tick's clock stopped with the tick: the replay is its own apply sample.
|
|
2842
2893
|
const mainClock = new MainThreadClock();
|
|
2843
2894
|
void integrateWrunLiveTailNow({ ...tail, mainClock, hostStartMs: mainClock.read() }).catch((error) => {
|
|
2844
|
-
console.warn(`[wrun]
|
|
2895
|
+
console.warn(`[wrun] queued live apply failed for '${indicatorId}' (keeping the last rendered result):`, error);
|
|
2845
2896
|
void noteWrunLiveTickRefusal(context, ledger, generation, error);
|
|
2846
2897
|
});
|
|
2847
2898
|
}
|
|
2848
|
-
/** The integrate itself, now (`integrateWrunLiveTail` decides whether it waits
|
|
2899
|
+
/** The integrate itself, now (`integrateWrunLiveTail` decides whether it waits behind queued updates first). */
|
|
2849
2900
|
async function integrateWrunLiveTailNow(tail) {
|
|
2850
2901
|
const { context, ledger, generation, tc, meta, outputRows, newestTs, tailFromTs, framesReplaced, holdsResult, evicted = false, runSession, mainClock, hostStartMs, cellRowsOf, } = tail;
|
|
2851
2902
|
const { indicatorId } = context;
|
|
@@ -2930,6 +2981,8 @@ async function integrateWrunLiveTailNow(tail) {
|
|
|
2930
2981
|
...(hostFill.tickSize !== undefined ? { priceTick: hostFill.tickSize } : {}),
|
|
2931
2982
|
...(canvasFill.tpoBlockSize !== undefined ? { tpoBlockSize: canvasFill.tpoBlockSize } : {}),
|
|
2932
2983
|
overlayId: indicatorId,
|
|
2984
|
+
// A built-in's port names its lines in its built-in's words, as its full run did (wrun-output-words.util).
|
|
2985
|
+
builtIn: builtinPortOf(meta.settings),
|
|
2933
2986
|
};
|
|
2934
2987
|
const projection = runSession
|
|
2935
2988
|
? wrunRunIntervalProjectionOf(runSession.run, context.chartIndex, context.market?.exchange)
|
|
@@ -2984,6 +3037,10 @@ async function integrateWrunLiveTailNow(tail) {
|
|
|
2984
3037
|
// The canvases' rows since the bar they last painted (or swapped whole).
|
|
2985
3038
|
...canvasPass.mount,
|
|
2986
3039
|
...(projection ? { projection } : {}),
|
|
3040
|
+
// What the session computed these rows for (its full run's settings generation and market, never the
|
|
3041
|
+
// settings' current ones: a save leaves the session ticking until its rerun installs): an eviction's or a
|
|
3042
|
+
// gap's swap, or a window that rolled past the mounted rows, keeps each heatmap's colour scale.
|
|
3043
|
+
pictureIdentity: wrunPictureIdentityOf(context),
|
|
2987
3044
|
// OT29: the lower pane's legend prints prices at the chart's digits.
|
|
2988
3045
|
priceDigits: () => wrunChartPriceDigits(context.chartIndex) ?? priceDigits ?? 2,
|
|
2989
3046
|
onMainThreadMs: (ms) => mainClock.add(ms),
|
|
@@ -3144,7 +3201,12 @@ function applyWrunLiveRunResult(context, tc, meta, runResult, projection) {
|
|
|
3144
3201
|
const bars = wrunLiveChartBarsOf(chartRows, clock);
|
|
3145
3202
|
const outcome = withWrunOverlayExecutionMeasure(chartIndex, indicatorId, 'wrun-live-tick', () => {
|
|
3146
3203
|
const applied = context.repaintOwed ? undefined : context.liveApplied;
|
|
3147
|
-
const
|
|
3204
|
+
const verdict = {};
|
|
3205
|
+
const change = applied && bars ? diffWrunLiveResults(applied.result, runResult, verdict) : undefined;
|
|
3206
|
+
// The drawings verdict travels with the drawings array as a token (wrun-cap-notice.util): equal drawings
|
|
3207
|
+
// under no owed repaint inherit the applied set's token, so the drawing door can skip its pass; anything else
|
|
3208
|
+
// gets a new token and the door runs in full.
|
|
3209
|
+
noteWrunDrawingsSameAs(runResult.drawings, applied && bars && verdict.drawingsChanged === false ? applied.result.drawings : undefined);
|
|
3148
3210
|
if (applied && bars && change?.kind === 'unchanged' && wrunLiveChartBarsEqual(applied.bars, bars)) {
|
|
3149
3211
|
return 'unchanged';
|
|
3150
3212
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { WrunMetadataOutput } from '../../interfaces/wrun-runtime.interface.js';
|
|
2
|
+
/** The sheet facts an output's words read. */
|
|
3
|
+
export type WrunOutputWordsSubject = Pick<WrunMetadataOutput, 'name' | 'label'>;
|
|
4
|
+
/** The words `output` reads on a chart surface of an overlay that ports built-in `builtIn` (undefined for any other
|
|
5
|
+
* package): a line its built-in names reads the built-in's words, every other line the legend's rule (wrunLegendName:
|
|
6
|
+
* the declared label, else the name read as words). */
|
|
7
|
+
export declare function wrunOutputWords(output: WrunOutputWordsSubject, builtIn: string | undefined): string;
|
|
8
|
+
/** Whether declared `words` name `output` by its own sheet label or name: an author restating the line in a card. */
|
|
9
|
+
export declare function wrunWordsRestateOutput(words: string, output: WrunOutputWordsSubject): boolean;
|
|
10
|
+
/** The words a declaration that names `output` prints (a hover block's or a ring's `label`, a rows block's row label),
|
|
11
|
+
* declared as `words`: words that restate the line (wrunWordsRestateOutput) read the built-in's words for it when the
|
|
12
|
+
* overlay's built-in names it, like the line itself; any other words are the author's and stay as written ("Overbought
|
|
13
|
+
* / oversold" over MFI's meter). */
|
|
14
|
+
export declare function wrunDeclaredOutputWords(words: string, output: WrunOutputWordsSubject | undefined, builtIn: string | undefined): string;
|