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