@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,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
|
}
|
|
@@ -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';
|
|
@@ -249,7 +249,7 @@ import { wrunLaneRefusalLeavesWindowOwed, wrunLaneRefusedCodeOf } from './wrun-l
|
|
|
249
249
|
import { WRUN_RUN_INTERVAL_ROWS_KEY, wrunRunIntervalComputeRows, wrunRunIntervalProjectionOf, wrunRunIntervalRowsThrough, wrunRunIntervalSentRow, wrunRunIntervalSessionOf, } from './wrun-run-interval-session.util.js';
|
|
250
250
|
import { WRUN_NO_READY_ROWS_CODE, wrunNothingReadyRefusal, wrunRunHealthDiagnostics } from './wrun-run-health.util.js';
|
|
251
251
|
import { attachWrunRefusal, serializeWrunRefusal, wrunOverlayEditable, wrunRefusalFor, } from './wrun-refusal.util.js';
|
|
252
|
-
import { noteWrunRunRetained, trimWrunRunDrawings } from './wrun-cap-notice.util.js';
|
|
252
|
+
import { noteWrunDrawingsSameAs, noteWrunRunRetained, trimWrunRunDrawings } from './wrun-cap-notice.util.js';
|
|
253
253
|
import { evictWrunRetainedOutputRows, ringWrunRunRetained, trimWrunRetainedCanvasLanes, wrunRetainedCanvasSources, wrunStrategyOnRows, } from './wrun-run-retained.util.js';
|
|
254
254
|
import { projectWrunRefusal, retractWrunRefusal, wrunRefusalRetractionCount } from './wrun-refusal-surface.util.js';
|
|
255
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';
|
|
@@ -1407,7 +1407,7 @@ function wrunPinnedLegCloseAt(leg, context, atMs) {
|
|
|
1407
1407
|
const { market } = context;
|
|
1408
1408
|
const settleMs = wrunLegCloseSettleMs(leg, market?.exchange, market?.sessionType);
|
|
1409
1409
|
const fromMs = atMs - settleMs;
|
|
1410
|
-
const open = leg.legMs === Intervals.WEEK ? findMonday(fromMs) :
|
|
1410
|
+
const open = leg.legMs === Intervals.WEEK ? findMonday(fromMs) : fixedGridFloorDivMs(fromMs, leg.legMs);
|
|
1411
1411
|
const closeMs = wrunLegBarCloseAt(leg, market?.exchange, fromMs, market?.sessionType, market?.symbol, context.intervalMs);
|
|
1412
1412
|
return (closeMs ?? open + leg.legMs) + settleMs;
|
|
1413
1413
|
}
|
|
@@ -1853,6 +1853,38 @@ async function extendWrunReplayRowLanes(context, owed, cursorTs) {
|
|
|
1853
1853
|
ledger.inFlight = false;
|
|
1854
1854
|
}
|
|
1855
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
|
+
}
|
|
1856
1888
|
/**
|
|
1857
1889
|
* A socket row source's live frames (WRUN-PARITY-PLAN C7, plan row 18), the drain's integrate of every
|
|
1858
1890
|
* frame folded since the last one (`queueWrunSourceLiveFrame`): the bars the cloud moved enter the live
|
|
@@ -1911,6 +1943,24 @@ export async function integrateWrunOverlayLiveFrame(indicatorId, frame, cellRows
|
|
|
1911
1943
|
return;
|
|
1912
1944
|
if (!wrunLiveTickEligible(context, generation))
|
|
1913
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;
|
|
1914
1964
|
// A frame with the mark names the receipt of the rows it carries (contract opra-server-lanes C4): the legend's
|
|
1915
1965
|
// served word follows it from this tick on, and a frame naming no tier leaves none (never the account's tier).
|
|
1916
1966
|
// The session reads OPRA from here: its debug lines state it (the console provenance).
|
|
@@ -3151,7 +3201,12 @@ function applyWrunLiveRunResult(context, tc, meta, runResult, projection) {
|
|
|
3151
3201
|
const bars = wrunLiveChartBarsOf(chartRows, clock);
|
|
3152
3202
|
const outcome = withWrunOverlayExecutionMeasure(chartIndex, indicatorId, 'wrun-live-tick', () => {
|
|
3153
3203
|
const applied = context.repaintOwed ? undefined : context.liveApplied;
|
|
3154
|
-
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);
|
|
3155
3210
|
if (applied && bars && change?.kind === 'unchanged' && wrunLiveChartBarsEqual(applied.bars, bars)) {
|
|
3156
3211
|
return 'unchanged';
|
|
3157
3212
|
}
|
|
@@ -84,6 +84,7 @@ import { closeWrunRefusalAttempts, concludeWrunRefusalAttempt, liveWrunRefusalAt
|
|
|
84
84
|
import { attachWrunRefusal, stampWrunRefusalTelemetry } from './wrun-refusal.util.js';
|
|
85
85
|
import { wrunRunFailedIdentityOf } from './wrun-cap-notice.util.js';
|
|
86
86
|
import { __resetWrunHistoryAsOfForTests, forgetWrunHistoryAsOf } from './wrun-history-as-of.util.js';
|
|
87
|
+
import { releaseWrunTrapSeedsFor } from './wrun-trap-replay.util.js';
|
|
87
88
|
import { effectiveChartSessionType } from '../chart/effective-chart-session.util.js';
|
|
88
89
|
import { wrunMainCandleSourceOf } from './run-schedule/wrun-own-candles.util.js';
|
|
89
90
|
import { hasWrunChartHostEnv, wrunChartHostEnv } from '../../host-env.js';
|
|
@@ -617,6 +618,8 @@ function releaseWrunOverlayLiveSession(indicatorId, mode) {
|
|
|
617
618
|
drivers.delete(indicatorId);
|
|
618
619
|
// The overlay's history session goes with it: an overlay mounted again pins its lanes afresh.
|
|
619
620
|
forgetWrunHistoryAsOf(indicatorId);
|
|
621
|
+
// A trap replay seed the overlay parked goes with it: nothing replays an overlay that left its chart.
|
|
622
|
+
releaseWrunTrapSeedsFor(indicatorId);
|
|
620
623
|
// The overlay's refusal attempts and verdicts go with it: a settlement
|
|
621
624
|
// landing after this claims nothing, and a later tenant starts clean.
|
|
622
625
|
if (chartIndex !== undefined)
|
|
@@ -235,6 +235,14 @@ export interface WrunRunComputedFor {
|
|
|
235
235
|
* type. Synchronous over what it reads, so the caller judges in the same task as the act the verdict guards.
|
|
236
236
|
*/
|
|
237
237
|
export declare function wrunRunSupersededReason(run: WrunRunComputedFor): WrunRunSupersededReason | undefined;
|
|
238
|
+
/** The trap row of an editor draft run that carried a replay seed (wrun-trap-replay.util: a full run or a live start
|
|
239
|
+
* that trapped in the sandbox): the seed parks under a token the row carries in `details.trap.token`, which the
|
|
240
|
+
* editor's replay controller takes it by. Any other row (a published Indicator, an app layer, no seed) as it is, and
|
|
241
|
+
* nothing parks for it. */
|
|
242
|
+
export declare function wrunTrapRowWithReplayToken(trap: RuntimeDiagnostic, error: unknown, overlay: {
|
|
243
|
+
indicatorId: string;
|
|
244
|
+
settings: unknown;
|
|
245
|
+
}): RuntimeDiagnostic;
|
|
238
246
|
/**
|
|
239
247
|
* Where a run stands when it fails (the `stage` of `wrun-run-failed`): its head (the holds, the walls, the market
|
|
240
248
|
* reads), its lanes (the plans and the fetches of the browser lanes), the compute (the sandbox worker, or the row
|
|
@@ -1169,6 +1177,13 @@ export type WrunIntegrateOptions = Omit<WrunOverlayResultOptions, 'builtIn'> & {
|
|
|
1169
1177
|
pictureIdentity: WrunPictureIdentity | undefined;
|
|
1170
1178
|
/** The full run's route facts; absent, the result remounts (a reseed, a direct caller). */
|
|
1171
1179
|
integration?: WrunIntegrationFacts;
|
|
1180
|
+
/** The drawings rule's facts for a caller without route facts that integrates a run's own rows again (the TPO block
|
|
1181
|
+
* refine of a run no live session owns): that run's reason and good-result fact, so the refine keeps or replaces
|
|
1182
|
+
* the mounted drawings exactly as its run did (wrunRunDrawingsPlan). */
|
|
1183
|
+
drawingsRun?: Pick<WrunIntegrationFacts, 'reason' | 'hasGoodResult'>;
|
|
1184
|
+
/** The result redraws the live session's own computation (its reseed, its style repaint, its TPO block refine:
|
|
1185
|
+
* the set every live tick mounts): its drawings replace the mounted set whatever its window (wrunRunDrawingsPlan). */
|
|
1186
|
+
sessionRedraw?: boolean;
|
|
1172
1187
|
/** A settings gesture's preview (the style patch's session repaint, wrun-style-preview.util): the overlay's
|
|
1173
1188
|
* settings are never written (no legend palette, no stats strip stamp), so nothing a preview paints reaches its
|
|
1174
1189
|
* engine copy; the gesture's commit or the cancel's repaint stamps them. */
|