@orangecharts/wrun-chart-host 0.5.0 → 0.7.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 +17 -8
- package/dist/constants/feature-flags.constants.js +7 -2
- package/dist/constants/marketCapabilities.constants.d.ts +5 -0
- package/dist/constants/marketCapabilities.constants.js +16 -0
- package/dist/host-env.d.ts +3 -19
- package/dist/host-ports.types.d.ts +36 -17
- package/dist/index.d.ts +12 -1
- package/dist/index.js +12 -1
- package/dist/indicators/controls/tpo-session.util.js +42 -18
- package/dist/interfaces/wrun-runtime.interface.d.ts +88 -13
- package/dist/interfaces/wrun-runtime.interface.js +17 -3
- package/dist/market-data/billing.interface.d.ts +2 -1
- package/dist/settings-templates/indicator-fields.js +10 -0
- package/dist/utility/chart/chart-mount-epoch.util.d.ts +12 -0
- package/dist/utility/chart/chart-mount-epoch.util.js +32 -0
- package/dist/utility/chart/crypto-index.leaf.d.ts +16 -0
- package/dist/utility/chart/crypto-index.leaf.js +19 -0
- package/dist/utility/chart/index-mode-admission.util.js +9 -1
- package/dist/utility/chart/index-mode.util.d.ts +11 -5
- package/dist/utility/chart/index-mode.util.js +22 -10
- package/dist/utility/chart/kscript-source-answer-budget.leaf.d.ts +36 -0
- package/dist/utility/chart/kscript-source-answer-budget.leaf.js +39 -0
- package/dist/utility/chart/kscript-source-degrade.leaf.d.ts +38 -1
- package/dist/utility/chart/kscript-source-degrade.leaf.js +39 -1
- package/dist/utility/chart/live-bucket.util.d.ts +2 -1
- package/dist/utility/chart/live-bucket.util.js +47 -15
- package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +15 -1
- package/dist/utility/chart/local-kscript-warmup-depth.util.js +9 -0
- package/dist/utility/chart/market-session-schedule.util.d.ts +3 -1
- package/dist/utility/chart/market-session-schedule.util.js +24 -2
- package/dist/utility/chart/marketKind.util.d.ts +12 -7
- package/dist/utility/chart/marketKind.util.js +15 -5
- package/dist/utility/chart/ny-calendar.util.d.ts +104 -0
- package/dist/utility/chart/ny-calendar.util.js +346 -0
- package/dist/utility/chart/om-panel.util.d.ts +14 -2
- package/dist/utility/chart/om-panel.util.js +108 -40
- package/dist/utility/chart/rth-session.util.d.ts +10 -7
- package/dist/utility/chart/rth-session.util.js +17 -22
- package/dist/utility/chart/trading-day.util.js +90 -18
- package/dist/utility/chart/us-equities-session.util.js +20 -67
- package/dist/utility/chart/wrun-bar-session-facts.util.js +14 -1
- package/dist/utility/common/time.util.d.ts +7 -1
- package/dist/utility/common/time.util.js +11 -41
- package/dist/utility/number-format.util.d.ts +17 -7
- package/dist/utility/number-format.util.js +18 -8
- package/dist/utility/options/option-symbol.util.js +13 -2
- package/dist/utility/symbol-selection/contract-expiry.util.js +9 -1
- package/dist/utility/watchlist/import/import-request.leaf.d.ts +4 -1
- package/dist/utility/watchlist/import/import-request.leaf.js +5 -2
- package/dist/utility/watchlist/import/tradingview-symbols.leaf.d.ts +25 -4
- package/dist/utility/watchlist/import/tradingview-symbols.leaf.js +62 -4
- package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +19 -0
- package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.js +57 -0
- package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.d.ts +23 -0
- package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.js +90 -0
- package/dist/utility/wrun/run-schedule/wrun-lane-groups.util.d.ts +39 -0
- package/dist/utility/wrun/run-schedule/wrun-lane-groups.util.js +60 -0
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +77 -0
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +195 -0
- package/dist/utility/wrun/run-schedule/wrun-own-candles.util.d.ts +56 -0
- package/dist/utility/wrun/run-schedule/wrun-own-candles.util.js +70 -0
- package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.d.ts +53 -0
- package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.js +239 -0
- package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +16 -0
- package/dist/utility/wrun/sources/lanes/option_stats_10m.js +14 -0
- package/dist/utility/wrun/sources/lanes/options_flow.d.ts +43 -18
- package/dist/utility/wrun/sources/lanes/options_flow.js +209 -72
- package/dist/utility/wrun/sources/lanes/token_supply.js +5 -31
- package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +3 -18
- package/dist/utility/wrun/sources/opra-option-lanes.util.js +12 -57
- package/dist/utility/wrun/sources/row-lane-registry.d.ts +1 -1
- package/dist/utility/wrun/sources/row-lane-registry.js +22 -8
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +61 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +103 -8
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +5 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +24 -12
- package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +55 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.js +95 -18
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +15 -1
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +23 -8
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +11 -11
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +14 -2
- package/dist/utility/wrun/sources/wrun-poll-lane.types.js +6 -3
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +43 -8
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +77 -11
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +31 -16
- package/dist/utility/wrun/sources/wrun-row-lane.types.js +2 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +52 -12
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +110 -46
- package/dist/utility/wrun/wrun-bar-count.util.d.ts +17 -6
- package/dist/utility/wrun/wrun-bar-count.util.js +27 -12
- package/dist/utility/wrun/wrun-browser-sources.leaf.d.ts +10 -0
- package/dist/utility/wrun/wrun-browser-sources.leaf.js +12 -0
- package/dist/utility/wrun/wrun-coin-lane-live.util.d.ts +3 -3
- package/dist/utility/wrun/wrun-coin-lane-live.util.js +53 -18
- package/dist/utility/wrun/wrun-color-settings.util.d.ts +6 -0
- package/dist/utility/wrun/wrun-color-settings.util.js +45 -0
- package/dist/utility/wrun/wrun-draft-overlay.util.js +14 -8
- package/dist/utility/wrun/wrun-failure-cause.d.ts +1 -1
- package/dist/utility/wrun/wrun-failure-cause.js +14 -0
- package/dist/utility/wrun/wrun-frames.js +6 -2
- package/dist/utility/wrun/wrun-host.service.d.ts +131 -59
- package/dist/utility/wrun/wrun-host.service.js +391 -194
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +1 -1
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +2 -0
- package/dist/utility/wrun/wrun-hover.util.d.ts +3 -0
- package/dist/utility/wrun/wrun-hover.util.js +25 -4
- package/dist/utility/wrun/wrun-input-requirements.leaf.js +7 -4
- package/dist/utility/wrun/wrun-kit-run-tables.util.d.ts +24 -0
- package/dist/utility/wrun/wrun-kit-run-tables.util.js +87 -0
- package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +2 -1
- package/dist/utility/wrun/wrun-live-tick.util.d.ts +8 -2
- package/dist/utility/wrun/wrun-live-tick.util.js +35 -16
- package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +40 -13
- package/dist/utility/wrun/wrun-opra-flow.leaf.js +39 -12
- package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +70 -21
- package/dist/utility/wrun/wrun-option-contract-flow.util.js +257 -112
- package/dist/utility/wrun/wrun-option-prints.util.d.ts +62 -22
- package/dist/utility/wrun/wrun-option-prints.util.js +148 -46
- package/dist/utility/wrun/wrun-option-views.util.d.ts +262 -0
- package/dist/utility/wrun/wrun-option-views.util.js +356 -0
- package/dist/utility/wrun/wrun-options-chain.util.d.ts +23 -2
- package/dist/utility/wrun/wrun-options-chain.util.js +37 -3
- package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +20 -5
- package/dist/utility/wrun/wrun-overlay-drivers.util.js +32 -7
- package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +9 -3
- package/dist/utility/wrun/wrun-overlay-recovery.util.js +146 -18
- package/dist/utility/wrun/wrun-overlay-run.util.d.ts +52 -8
- package/dist/utility/wrun/wrun-overlay-run.util.js +816 -243
- package/dist/utility/wrun/wrun-pack.util.d.ts +2 -1
- package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +5 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.js +28 -12
- package/dist/utility/wrun/wrun-pin-venues.util.js +4 -6
- package/dist/utility/wrun/wrun-prefix-cohort.util.d.ts +1 -1
- package/dist/utility/wrun/wrun-prefix-cohort.util.js +1 -1
- package/dist/utility/wrun/wrun-present-bits.util.d.ts +9 -0
- package/dist/utility/wrun/wrun-present-bits.util.js +39 -0
- package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +3 -2
- package/dist/utility/wrun/wrun-refusal-surface.util.js +5 -4
- package/dist/utility/wrun/wrun-refusal.util.d.ts +66 -6
- package/dist/utility/wrun/wrun-refusal.util.js +335 -40
- package/dist/utility/wrun/wrun-registry-errors.util.d.ts +5 -3
- package/dist/utility/wrun/wrun-sandbox-row-source.d.ts +2 -2
- package/dist/utility/wrun/wrun-sha256.leaf.d.ts +13 -0
- package/dist/utility/wrun/wrun-sha256.leaf.js +84 -0
- package/dist/utility/wrun/wrun-source-rows.util.js +11 -0
- package/dist/utility/wrun/wrun-tier-grid.util.d.ts +28 -3
- package/dist/utility/wrun/wrun-tier-grid.util.js +79 -19
- package/dist/utility/wrun/wrun-transient-rerun.util.d.ts +14 -3
- package/dist/utility/wrun/wrun-transient-rerun.util.js +33 -8
- package/dist/workers/wrun/wrun-abi-host.d.ts +15 -2
- package/dist/workers/wrun/wrun-abi-host.js +31 -12
- package/dist/workers/wrun/wrun-engine-handler.d.ts +11 -28
- package/dist/workers/wrun/wrun-engine-handler.js +181 -12
- package/package.json +5 -5
- package/dist/utility/wrun/wrun-opra-underlying.util.d.ts +0 -12
- package/dist/utility/wrun/wrun-opra-underlying.util.js +0 -1
|
@@ -21,6 +21,16 @@
|
|
|
21
21
|
* the typed errors (no bars, deadline, source data unavailable), else `run-failed`: `code` when the
|
|
22
22
|
* words are the engine's trap or the host's write and memory rules, else `generic`. A run-failed
|
|
23
23
|
* record is deterministic (no Retry) unless its cause is one a second run can get past.
|
|
24
|
+
* - A run-failed record in the generic words carries the code that names it at `params.code` (an
|
|
25
|
+
* author's rule, `wrunAuthorRuleSeed`; a loader phase, `wrunLoaderFailureCodeOf`; this module's own
|
|
26
|
+
* fallbacks), which the events report; one without a code is no typed verdict, so its cause is a
|
|
27
|
+
* named word or `other`, never `none` (tests/structure/wrun-run-failed-seed-has-code.spec.ts).
|
|
28
|
+
* - A code that says what happened reads in words of its own (`seedOfVerdict`): a package its publisher withdrew
|
|
29
|
+
* (`WRUN_WITHDRAWN_PACKAGE_CODES`) is the run-failed `package-withdrawn` record, whose way out is Remove (no Retry
|
|
30
|
+
* can bring it back), except a built-in's twin, which keeps the generic words and Retry (`builtinTwin`: an official
|
|
31
|
+
* version a Retry can reach again once its pin moved); a secondary source the source ladder gave up on
|
|
32
|
+
* (`WRUN_SOURCE_REFUSAL_VARIANTS`) is the `service-no-answer` record of what happened to it: no answer in time, a
|
|
33
|
+
* failed read, a market it declines.
|
|
24
34
|
* - A cloud run's refusal reads by its code alone (WRUN-PARITY-PLAN row 21, lane parity U16): the
|
|
25
35
|
* code the error frame's `details.wrunRefusal` names (wrun-hosted-wire-caps `wrunFrameRefusalOf`),
|
|
26
36
|
* or a whole-run refusal of the socket row source, maps onto this table through
|
|
@@ -38,7 +48,7 @@ import { Intervals } from '../../constants/interval.constants.js';
|
|
|
38
48
|
import { isCalendarIntervalLabel } from '../chart/calendar-interval.util.js';
|
|
39
49
|
import { isWrunFailureCause, isWrunTransientFailureCause, wrunServerFailureCause, } from './wrun-failure-cause.js';
|
|
40
50
|
import { WRUN_KIT_REFUSAL_STAGES, WRUN_NO_CANDLES_CODE, wrunFrameRefusalOf, wrunKitRefusalStageOf, wrunServerAnswerOfText, wrunServerAnswerVerdict, } from './wrun-hosted-wire-caps.js';
|
|
41
|
-
import { WrunDeadlineError,
|
|
51
|
+
import { WrunDeadlineError, WrunNoBarsError, WrunQuarantinedError, WrunRegistryAddRefusedError, WrunSourceDataUnavailableError, WrunWorkerPoisonError, } from './wrun-registry-errors.util.js';
|
|
42
52
|
/** Every stop reason, closed: the class spec walks it, and a reason without a variant row fails it. */
|
|
43
53
|
export const WRUN_OPTIONS_STOP_REASONS = Object.freeze([
|
|
44
54
|
'session-elsewhere',
|
|
@@ -78,8 +88,10 @@ export const WRUN_REFUSAL_EVENT_MARKET_KEY = 'wrun.refusal.market.event';
|
|
|
78
88
|
/**
|
|
79
89
|
* The words of every row-builder class and registered poll lane (C4 `feed`): a `feed` param holds
|
|
80
90
|
* a builtin class (`trade_volume_by_size`) or a lane key (`bitfinex_margin_rate`; a class served
|
|
81
|
-
* by several lanes is named by the lane its input reads)
|
|
82
|
-
*
|
|
91
|
+
* by several lanes is named by the lane its input reads), or a class the browser lane refuses by
|
|
92
|
+
* its own code (wrun-browser-sources.leaf `WRUN_BROWSER_REFUSED_CLASS_CODES`, whose record names
|
|
93
|
+
* the class). Full literal keys, so the boot scanner harvests them. The spec fails when a builtin
|
|
94
|
+
* class, a registered lane or a refused class has no row here.
|
|
83
95
|
*/
|
|
84
96
|
export const WRUN_REFUSAL_FEED_KEYS = Object.freeze({
|
|
85
97
|
ohlcv: 'wrun.refusal.feed.ohlcv',
|
|
@@ -115,6 +127,8 @@ export const WRUN_REFUSAL_FEED_KEYS = Object.freeze({
|
|
|
115
127
|
options_flow: 'wrun.refusal.feed.optionsFlow',
|
|
116
128
|
option_daily: 'wrun.refusal.feed.optionDaily',
|
|
117
129
|
option_stats_10m: 'wrun.refusal.feed.optionStats10m',
|
|
130
|
+
// A class the browser lane refuses by its own code (kit 0.88.0): its record names the class.
|
|
131
|
+
option_prints_v2: 'wrun.refusal.feed.optionPrintsV2',
|
|
118
132
|
token_supply: 'wrun.refusal.feed.tokenSupply',
|
|
119
133
|
treasury_balance: 'wrun.refusal.feed.treasuryBalance',
|
|
120
134
|
volatility_index: 'wrun.refusal.feed.volatilityIndex',
|
|
@@ -137,6 +151,15 @@ export function wrunRefusalFeedKey(feed) {
|
|
|
137
151
|
return Object.prototype.hasOwnProperty.call(laneFeedKeys, feed) ? laneFeedKeys[feed] : undefined;
|
|
138
152
|
}
|
|
139
153
|
const row = (sentence, chip, params, extra) => ({ sentence, chip, params, ...extra });
|
|
154
|
+
/** The source variants' words when their record names no feed with words: the chip's own generic noun ("data"). */
|
|
155
|
+
const WRUN_SOURCE_DATA_KEY = 'wrun.unavailable.data';
|
|
156
|
+
/**
|
|
157
|
+
* The words of a secondary source the source ladder gave up on after its two rungs (wrun-overlay-run.util
|
|
158
|
+
* `wrunTerminalDegradeRefusalFor`), one row per code its seed carries (`WRUN_SOURCE_REFUSAL_VARIANTS`): the source
|
|
159
|
+
* did not answer in time or its read failed (Retry; the card's Report it stands beside it), or it declines the chart's
|
|
160
|
+
* market (no rerun brings it here: Remove). `{feed}` names the source, else `WRUN_SOURCE_DATA_KEY`.
|
|
161
|
+
*/
|
|
162
|
+
const sourceRow = (sentence, chip, out) => row(sentence, chip, [], { optional: ['code', 'feed'], out, feedFallback: WRUN_SOURCE_DATA_KEY });
|
|
140
163
|
/**
|
|
141
164
|
* The `options-stopped` rows: ONE row per stop reason, typed by the reason word, so a reason without its own chip is
|
|
142
165
|
* a type error here and a failure of the class spec (tests/utility/wrun/wrun-options-stop.class.spec.ts). Each
|
|
@@ -220,6 +243,16 @@ const VARIANTS = {
|
|
|
220
243
|
// A read the data source keeps switched off for now (a lane's answer refused by name, wrun-lane-refusal.leaf: the
|
|
221
244
|
// OPTION_PRINT_AGG flow scope reads before their switch turns on); a later Retry may bring it.
|
|
222
245
|
'switched-off': row('wrun.refusal.sentence.feedSwitchedOff', 'wrun.refusal.chip.feedSwitchedOff', ['feed']),
|
|
246
|
+
// The source ladder gave up on a secondary source (`sourceRow`), by its seed's code.
|
|
247
|
+
'source-budget': sourceRow('wrun.unavailable.sentence.sourceBudget', 'wrun.unavailable.chip.sourceBudget', {
|
|
248
|
+
kind: 'retry',
|
|
249
|
+
}),
|
|
250
|
+
'source-failed': sourceRow('wrun.unavailable.sentence.sourceFailed', 'wrun.unavailable.chip.sourceFailed', {
|
|
251
|
+
kind: 'retry',
|
|
252
|
+
}),
|
|
253
|
+
'source-declined': sourceRow('wrun.unavailable.sentence.sourceDeclined', 'wrun.unavailable.chip.sourceDeclined', {
|
|
254
|
+
kind: 'remove',
|
|
255
|
+
}),
|
|
223
256
|
},
|
|
224
257
|
waiting: {
|
|
225
258
|
default: row('wrun.refusal.sentence.waiting', 'wrun.refusal.chip.waiting', [], { severity: 'note' }),
|
|
@@ -286,12 +319,20 @@ const VARIANTS = {
|
|
|
286
319
|
'window-budget': row('dialogs.makeRoom.titleRun', 'wrun.refusal.chip.notAdded', ['name'], { severity: 'paused' }),
|
|
287
320
|
},
|
|
288
321
|
'run-failed': {
|
|
289
|
-
|
|
322
|
+
// The code that names the failure (`wrunAuthorRuleSeed`: an author's rule, a loader phase) rides the record for
|
|
323
|
+
// the events; the words never say it.
|
|
324
|
+
generic: row('wrun.refusal.sentence.runFailed', 'wrun.refusal.chip.runFailed', [], {
|
|
325
|
+
severity: 'paused',
|
|
326
|
+
optional: ['code'],
|
|
327
|
+
}),
|
|
290
328
|
compile: row('wrun.refusal.sentence.compileBlocked', 'wrun.refusal.chip.runFailed', ['line'], {
|
|
291
329
|
severity: 'paused',
|
|
292
330
|
}),
|
|
293
331
|
// The engine's trap or the host's write and memory rules: the Indicator's own code stopped.
|
|
294
|
-
code: row('wrun.refusal.sentence.codeError', 'wrun.refusal.chip.runFailed', [], {
|
|
332
|
+
code: row('wrun.refusal.sentence.codeError', 'wrun.refusal.chip.runFailed', [], {
|
|
333
|
+
severity: 'paused',
|
|
334
|
+
optional: ['code'],
|
|
335
|
+
}),
|
|
295
336
|
// A pin on a venue word the chart's lanes cannot ask (wrun_pin_venue_unknown), refused before any
|
|
296
337
|
// fetch: the sheet contract's sentence, the venue named.
|
|
297
338
|
'pin-venue-unknown': row('wrun.refusal.sentence.pinVenueUnknown', 'wrun.refusal.chip.runFailed', ['venue'], {
|
|
@@ -329,6 +370,10 @@ const VARIANTS = {
|
|
|
329
370
|
'session-lost': row('wrun.refusal.sentence.sessionLost', 'wrun.refusal.chip.sessionLost', [], {
|
|
330
371
|
severity: 'note',
|
|
331
372
|
}),
|
|
373
|
+
// A package its publisher withdrew since the save (a resolve answered 404 or 410, its deleted code, a yanked
|
|
374
|
+
// version: `WRUN_WITHDRAWN_PACKAGE_CODES`): no rerun can load it, so Remove, never Retry; the code rides on for
|
|
375
|
+
// the events, and the card's Report it stands beside the way out.
|
|
376
|
+
'package-withdrawn': row('wrun.unavailable.sentence.packageWithdrawn', 'wrun.unavailable.chip.packageWithdrawn', [], { severity: 'paused', optional: ['code'], out: { kind: 'remove' } }),
|
|
332
377
|
},
|
|
333
378
|
// An options lane stopped for a reason the gate, the plane router or the flag check knows.
|
|
334
379
|
'options-stopped': OPTIONS_STOPPED_VARIANTS,
|
|
@@ -412,6 +457,7 @@ function canonicalOut(value) {
|
|
|
412
457
|
case 'open-editor':
|
|
413
458
|
case 'run-on-chart':
|
|
414
459
|
case 'report':
|
|
460
|
+
case 'remove':
|
|
415
461
|
case 'reload':
|
|
416
462
|
return { kind: value.kind };
|
|
417
463
|
default:
|
|
@@ -738,8 +784,8 @@ function seedFromCodes(message, ctx) {
|
|
|
738
784
|
return { cls: 'no-options', variant: flagOff ? 'flag-off' : 'venue', params: { venue, coin } };
|
|
739
785
|
}
|
|
740
786
|
default:
|
|
741
|
-
// A bad venue word, two venues in one sheet, a bad expiries word: the author's to fix.
|
|
742
|
-
return
|
|
787
|
+
// A bad venue word, two venues in one sheet, a bad expiries word: the author's to fix, by its code.
|
|
788
|
+
return wrunAuthorRuleSeed(optionsCode);
|
|
743
789
|
}
|
|
744
790
|
}
|
|
745
791
|
if (message.includes('wrun_pin_venue_refused')) {
|
|
@@ -776,6 +822,30 @@ export const WRUN_SESSION_LOST_CODE = 'wrun_session_lost';
|
|
|
776
822
|
export function wrunSessionLostSeed() {
|
|
777
823
|
return { cls: 'run-failed', variant: 'session-lost', out: { kind: 'retry' } };
|
|
778
824
|
}
|
|
825
|
+
/**
|
|
826
|
+
* The seed of a failed run a closed code names: an author's rule the raiser's words print (`wrun_pin_unresolvable`,
|
|
827
|
+
* `wrun_lane_knob_invalid`), a loader phase (`registry_404`, `wrunLoaderFailureCodeOf`), a fallback this module words
|
|
828
|
+
* itself. The generic words with the code at `params.code` (the record keeps it, the words never say it), and the way
|
|
829
|
+
* out when the raiser gives one. The code is the verdict: `wrun_failure_shown` reports it as its code, the lane row as
|
|
830
|
+
* `refused:<code>` when it is an author's rule (`wrun_*`, minus the internal fallbacks) and as `failed:<reason>` for
|
|
831
|
+
* any other code (a loader phase, an engine trap: the reason classifier and the record's cause say why), and the cause
|
|
832
|
+
* read takes the seed as a typed verdict. A
|
|
833
|
+
* run-failed seed in the generic words without a code names nothing
|
|
834
|
+
* (tests/structure/wrun-run-failed-seed-has-code.spec.ts pins every such literal).
|
|
835
|
+
*/
|
|
836
|
+
export function wrunAuthorRuleSeed(code, out) {
|
|
837
|
+
return { cls: 'run-failed', variant: 'generic', params: { code }, ...(out !== undefined ? { out } : {}) };
|
|
838
|
+
}
|
|
839
|
+
/** The code of an engine trap no runtime row explains (`RuntimeError: memory access out of bounds`): the record and
|
|
840
|
+
* the events name it, and its cause reads `other`, never `none` (nothing explains which line of the code broke). */
|
|
841
|
+
export const WRUN_ENGINE_TRAP_CODE = 'engine_trap';
|
|
842
|
+
/** The codes of the run-failed fallbacks this module words itself: a pin finer than every picker interval (the Run's
|
|
843
|
+
* own analytics code of the same words, run-failure-props.util ROWLESS_REJECTIONS), a TPO letter the bars cannot
|
|
844
|
+
* place, a feed with no words, a failure the record read itself could not read. */
|
|
845
|
+
const WRUN_INTERVAL_PIN_FINER_CODE = 'WRUN_INTERVAL_PIN_FINER';
|
|
846
|
+
const WRUN_TPO_LETTER_MISMATCH_CODE = 'wrun_tpo_letter_mismatch';
|
|
847
|
+
const WRUN_FEED_UNNAMED_CODE = 'wrun_feed_unnamed';
|
|
848
|
+
const WRUN_REFUSAL_READ_FAILED_CODE = 'wrun_refusal_read_failed';
|
|
779
849
|
/** The codes whose way out is the settings: a value a declaration refuses, a param the package no
|
|
780
850
|
* longer declares, a paint the settings ask that no host draws. */
|
|
781
851
|
const SETTINGS_REFUSAL_CODES = new Set([
|
|
@@ -911,7 +981,7 @@ function standardIntervalDividing(letterMinutes) {
|
|
|
911
981
|
export function wrunPinFinerSeed(pinMs, strictlyFiner) {
|
|
912
982
|
const interval = Number.isFinite(pinMs) && pinMs > 0 ? coarsestStandardDividing(pinMs, strictlyFiner) : undefined;
|
|
913
983
|
return interval === undefined
|
|
914
|
-
?
|
|
984
|
+
? wrunAuthorRuleSeed(WRUN_INTERVAL_PIN_FINER_CODE)
|
|
915
985
|
: { cls: 'interval-unserved', variant: 'at-most', params: { interval } };
|
|
916
986
|
}
|
|
917
987
|
/** The seed of a TPO letter refusal: the chart's own bars (their span is the chart's interval) are
|
|
@@ -926,7 +996,7 @@ function tpoLetterSeed(letterMinutes, bars, ctx) {
|
|
|
926
996
|
const chartBars = chartInterval !== undefined &&
|
|
927
997
|
(barsMs !== undefined && chartMs !== undefined ? barsMs === chartMs : bars === chartInterval);
|
|
928
998
|
if (interval === undefined || !chartBars)
|
|
929
|
-
return
|
|
999
|
+
return wrunAuthorRuleSeed(WRUN_TPO_LETTER_MISMATCH_CODE);
|
|
930
1000
|
return { cls: 'interval-unserved', variant: 'at-most', params: { interval, chartInterval: bars } };
|
|
931
1001
|
}
|
|
932
1002
|
/** Leg classes: an unseeded refusal of theirs names a pinned market the message alone does not
|
|
@@ -951,10 +1021,19 @@ function laneFeedOf(message) {
|
|
|
951
1021
|
return undefined;
|
|
952
1022
|
return wrunRefusalFeedKey(lane) !== undefined ? lane : undefined;
|
|
953
1023
|
}
|
|
1024
|
+
/** A seed that names no failure (the generic run-failed words without a code, as the loader's own catch-all seeds
|
|
1025
|
+
* its phases) on a failure the loader's table names takes that phase code, so the record says what failed; every
|
|
1026
|
+
* other seed stays as its raiser made it. */
|
|
1027
|
+
function withLoaderCode(seed, error) {
|
|
1028
|
+
if (seedNamesItsFailure(seed))
|
|
1029
|
+
return seed;
|
|
1030
|
+
const code = wrunLoaderFailureCodeOf(error);
|
|
1031
|
+
return code === null ? seed : { ...seed, params: { ...seed.params, code } };
|
|
1032
|
+
}
|
|
954
1033
|
function seedOfError(error, ctx) {
|
|
955
1034
|
const attached = wrunRefusalSeedOf(error);
|
|
956
1035
|
if (attached)
|
|
957
|
-
return attached;
|
|
1036
|
+
return withLoaderCode(attached, error);
|
|
958
1037
|
const plain = validSeed(error);
|
|
959
1038
|
if (plain && !(error instanceof Error))
|
|
960
1039
|
return plain;
|
|
@@ -1043,14 +1122,21 @@ function firstLineOf(text) {
|
|
|
1043
1122
|
const line = text.split('\n').find((part) => part.trim() !== '') ?? '';
|
|
1044
1123
|
return line.trim().replace(/\s+/g, ' ');
|
|
1045
1124
|
}
|
|
1046
|
-
/** A run that failed for none of the named reasons: Retry for a transient cause
|
|
1047
|
-
*
|
|
1125
|
+
/** A run that failed for none of the named reasons: Retry for a transient cause; the phase code of a failure the
|
|
1126
|
+
* loader's table names (`wrunLoaderFailureCodeOf`: a typed failure never drops its type); the code's words for the
|
|
1127
|
+
* engine's trap (code `engine_trap`) and the host's rules; else the generic words (all deterministic). */
|
|
1048
1128
|
function runFailedSeedOf(error, message) {
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
if (
|
|
1052
|
-
return
|
|
1129
|
+
const out = isTransientRunFailure(error, message) ? { kind: 'retry' } : undefined;
|
|
1130
|
+
const code = wrunLoaderFailureCodeOf(error);
|
|
1131
|
+
if (code !== null)
|
|
1132
|
+
return wrunAuthorRuleSeed(code, out);
|
|
1133
|
+
if (out !== undefined)
|
|
1134
|
+
return { cls: 'run-failed', variant: 'generic', out };
|
|
1135
|
+
if (ENGINE_TRAP_RE.test(firstLineOf(message))) {
|
|
1136
|
+
return { cls: 'run-failed', variant: 'code', params: { code: WRUN_ENGINE_TRAP_CODE } };
|
|
1053
1137
|
}
|
|
1138
|
+
if (HOST_RULE_RE.test(message))
|
|
1139
|
+
return { cls: 'run-failed', variant: 'code' };
|
|
1054
1140
|
return { cls: 'run-failed', variant: 'generic' };
|
|
1055
1141
|
}
|
|
1056
1142
|
/** The default variant of a class when the seed names none (or names one the facts disprove). */
|
|
@@ -1155,6 +1241,11 @@ function paramsFor(spec, seed, ctx, market) {
|
|
|
1155
1241
|
out[name] = '';
|
|
1156
1242
|
}
|
|
1157
1243
|
}
|
|
1244
|
+
for (const name of spec.optional ?? []) {
|
|
1245
|
+
const value = given[name];
|
|
1246
|
+
if (isFailureCode(value))
|
|
1247
|
+
out[name] = value;
|
|
1248
|
+
}
|
|
1158
1249
|
return out;
|
|
1159
1250
|
}
|
|
1160
1251
|
function switchOrWorksOn(ctx) {
|
|
@@ -1236,14 +1327,66 @@ function defaultSeverity(cls) {
|
|
|
1236
1327
|
? 'note'
|
|
1237
1328
|
: 'paused';
|
|
1238
1329
|
}
|
|
1239
|
-
|
|
1330
|
+
/**
|
|
1331
|
+
* The codes of a package its publisher withdrew since the save (`wrunLoaderFailureCodeOf`): a resolve the registry
|
|
1332
|
+
* answered 404 or 410, the registry's own deleted code, a yanked version. A run-failed record in the generic words
|
|
1333
|
+
* that names one is the `package-withdrawn` record (a built-in's twin's excepted: `seedOfVerdict`).
|
|
1334
|
+
*/
|
|
1335
|
+
export const WRUN_WITHDRAWN_PACKAGE_CODES = new Set([
|
|
1336
|
+
'registry_404',
|
|
1337
|
+
'registry_410',
|
|
1338
|
+
'package_deleted',
|
|
1339
|
+
'yanked',
|
|
1340
|
+
]);
|
|
1341
|
+
/**
|
|
1342
|
+
* The codes of the source ladder's terminal record (wrun-overlay-run.util `wrunTerminalDegradeRefusalFor`, its seed
|
|
1343
|
+
* built with `wrunAuthorRuleSeed(code)`), each with the `service-no-answer` variant that words it: the source did not
|
|
1344
|
+
* answer within its budget, its read failed, it declined the chart's market.
|
|
1345
|
+
*/
|
|
1346
|
+
export const WRUN_SOURCE_REFUSAL_VARIANTS = Object.freeze({
|
|
1347
|
+
wrun_source_budget: 'source-budget',
|
|
1348
|
+
wrun_source_failed: 'source-failed',
|
|
1349
|
+
wrun_source_declined: 'source-declined',
|
|
1350
|
+
});
|
|
1351
|
+
/** A seed in words of its class that name no cause (the run-failed generic words; the `service-no-answer` did-not-load
|
|
1352
|
+
* words, `lane` and `global`): a code it carries may name the record instead. */
|
|
1353
|
+
function inGenericWords(seed) {
|
|
1354
|
+
const variant = seed.variant;
|
|
1355
|
+
if (seed.cls === 'run-failed')
|
|
1356
|
+
return variant === undefined || variant === 'generic';
|
|
1357
|
+
return seed.cls === 'service-no-answer' && (variant === undefined || variant === 'lane' || variant === 'global');
|
|
1358
|
+
}
|
|
1359
|
+
/**
|
|
1360
|
+
* The seed a record is built from when its code says what happened: a seed in the generic words whose code is one of
|
|
1361
|
+
* the source ladder's (`WRUN_SOURCE_REFUSAL_VARIANTS`) is the `service-no-answer` variant of that code, whatever class
|
|
1362
|
+
* its raiser spelled; a run-failed one whose code names a withdrawn package (`WRUN_WITHDRAWN_PACKAGE_CODES`), or whose
|
|
1363
|
+
* failure the loader's table reads `package-withdrawn` (a 404 the registry coded in a word of its own), is the
|
|
1364
|
+
* `package-withdrawn` record, unless it is a built-in's twin (`ctx.builtinTwin`): an official version is not withdrawn
|
|
1365
|
+
* by its publisher in the person's eyes, and a Retry can reach a pin that moved, so the twin's record stays in the
|
|
1366
|
+
* generic words with its Retry (its code and its cause still ride on for the events). Every other seed stays as its
|
|
1367
|
+
* raiser made it.
|
|
1368
|
+
*/
|
|
1369
|
+
function seedOfVerdict(seed, cause, ctx) {
|
|
1370
|
+
if (!inGenericWords(seed))
|
|
1371
|
+
return seed;
|
|
1372
|
+
const code = seed.params?.code;
|
|
1373
|
+
if (typeof code === 'string' && Object.hasOwn(WRUN_SOURCE_REFUSAL_VARIANTS, code)) {
|
|
1374
|
+
return { ...seed, cls: 'service-no-answer', variant: WRUN_SOURCE_REFUSAL_VARIANTS[code] };
|
|
1375
|
+
}
|
|
1376
|
+
if (ctx.builtinTwin === true)
|
|
1377
|
+
return seed;
|
|
1378
|
+
const withdrawn = (typeof code === 'string' && WRUN_WITHDRAWN_PACKAGE_CODES.has(code)) || cause === 'package-withdrawn';
|
|
1379
|
+
return seed.cls === 'run-failed' && withdrawn ? { ...seed, variant: 'package-withdrawn' } : seed;
|
|
1380
|
+
}
|
|
1381
|
+
function buildRecord(raised, ctx, details, telemetry = {}, cause = 'none') {
|
|
1382
|
+
const seed = seedOfVerdict(raised, cause, ctx);
|
|
1240
1383
|
const cls = seed.cls;
|
|
1241
1384
|
const variant = variantFor(seed, ctx);
|
|
1242
1385
|
const spec = variantSpec(cls, variant) ?? RUN_FAILED_GENERIC;
|
|
1243
1386
|
const market = canonicalMarket(seed.market) ?? chartMarketOf(ctx);
|
|
1244
1387
|
const params = paramsFor(spec, seed, ctx, market);
|
|
1245
1388
|
const severity = spec.severity ?? seed.severity ?? defaultSeverity(cls);
|
|
1246
|
-
const out = outFor(seed, cls, variant, ctx, params);
|
|
1389
|
+
const out = spec.out ?? outFor(seed, cls, variant, ctx, params);
|
|
1247
1390
|
const record = {
|
|
1248
1391
|
v: 1,
|
|
1249
1392
|
cls,
|
|
@@ -1258,9 +1401,9 @@ function buildRecord(seed, ctx, details, telemetry = {}, cause = 'none') {
|
|
|
1258
1401
|
// A typed verdict's record carries no cause: it serializes as it did before the cause existed.
|
|
1259
1402
|
...(cause !== 'none' ? { telemetry: { cause } } : {}),
|
|
1260
1403
|
};
|
|
1261
|
-
// A feed with no words cannot be named: the generic words, the class's way out kept.
|
|
1404
|
+
// A feed with no words cannot be named: the generic words, the class's way out kept, the fallback's code.
|
|
1262
1405
|
if (spec.params.includes('feed') && wrunRefusalFeedKey(params.feed) === undefined) {
|
|
1263
|
-
return { ...record, cls: 'run-failed', variant: 'generic', params: {} };
|
|
1406
|
+
return { ...record, cls: 'run-failed', variant: 'generic', params: { code: WRUN_FEED_UNNAMED_CODE } };
|
|
1264
1407
|
}
|
|
1265
1408
|
return parseWrunRefusal(record) ?? record;
|
|
1266
1409
|
}
|
|
@@ -1270,7 +1413,7 @@ export function wrunRefusalSeedFor(error, ctx) {
|
|
|
1270
1413
|
return seedOfError(error, ctx);
|
|
1271
1414
|
}
|
|
1272
1415
|
catch {
|
|
1273
|
-
return
|
|
1416
|
+
return wrunAuthorRuleSeed(WRUN_REFUSAL_READ_FAILED_CODE);
|
|
1274
1417
|
}
|
|
1275
1418
|
}
|
|
1276
1419
|
/**
|
|
@@ -1305,10 +1448,12 @@ export function wrunRefusalFor(errorOrSeed, ctx) {
|
|
|
1305
1448
|
cls: 'run-failed',
|
|
1306
1449
|
variant: 'generic',
|
|
1307
1450
|
indicatorName: typeof ctx?.indicatorName === 'string' ? ctx.indicatorName : '',
|
|
1308
|
-
params: {},
|
|
1451
|
+
params: { code: WRUN_REFUSAL_READ_FAILED_CODE },
|
|
1309
1452
|
severity: 'paused',
|
|
1310
1453
|
out: { kind: 'retry' },
|
|
1311
1454
|
details,
|
|
1455
|
+
// Nothing read the failure, so nothing names what produced it.
|
|
1456
|
+
telemetry: { cause: 'other' },
|
|
1312
1457
|
};
|
|
1313
1458
|
}
|
|
1314
1459
|
}
|
|
@@ -1337,16 +1482,12 @@ const LEADING_FAILURE_CODE = /^([A-Z][A-Z0-9_]*)(?![A-Za-z0-9_])/;
|
|
|
1337
1482
|
const KSCRIPT_REQUEST_FAILED = 'Failed to process KScript request';
|
|
1338
1483
|
/** The module words of NETWORK_FAILURE_RE: a lazily loaded chunk that did not arrive. */
|
|
1339
1484
|
const CHUNK_LOAD_FAILURE_RE = /\b(?:dynamically imported module|Importing a module script failed|ChunkLoadError)\b/i;
|
|
1340
|
-
/** The lane's typed errors whose own type says what failed (a refusal of a gate, the market or the data, the
|
|
1341
|
-
* deadline
|
|
1485
|
+
/** The lane's typed errors whose own type says what failed (a refusal of a gate, the market or the data, no bars, the
|
|
1486
|
+
* run deadline): their cause is `none`. The loader's own failures name theirs (`wrunLoaderFailureCauseOf`). */
|
|
1342
1487
|
const TYPED_VERDICT_ERRORS = [
|
|
1343
1488
|
WrunRegistryAddRefusedError,
|
|
1344
1489
|
WrunNoBarsError,
|
|
1345
1490
|
WrunDeadlineError,
|
|
1346
|
-
WrunIntegrationError,
|
|
1347
|
-
WrunQuarantinedError,
|
|
1348
|
-
WrunRegistryHostedOnlyError,
|
|
1349
|
-
WrunProvenTwinDeclinedError,
|
|
1350
1491
|
];
|
|
1351
1492
|
/** The context the stable codes read with no chart in hand (the cause reads only whether a code names a refusal). */
|
|
1352
1493
|
const NO_CONTEXT = { indicatorName: '', editable: false, hasSettings: false };
|
|
@@ -1417,18 +1558,163 @@ function transportCodeCauseOf(error, message) {
|
|
|
1417
1558
|
? WRUN_TRANSPORT_CODE_CAUSES[code]
|
|
1418
1559
|
: undefined;
|
|
1419
1560
|
}
|
|
1420
|
-
|
|
1421
|
-
|
|
1561
|
+
// ---------------------------------------------------------------------------
|
|
1562
|
+
// The loader's own failures (inv-a 2026-10-21: a resolve, a download, a compile, a twin, the adapter)
|
|
1563
|
+
// ---------------------------------------------------------------------------
|
|
1564
|
+
/** The registry client's refusal of a non-OK answer (`WrunRegistryHttpError`, web services/wrun-registry.service):
|
|
1565
|
+
* read by its name and fields (`status`, the registry's own `code`), as the socket errors are, since the client lives
|
|
1566
|
+
* in the web app. */
|
|
1567
|
+
const REGISTRY_HTTP_ERROR = 'WrunRegistryHttpError';
|
|
1568
|
+
/** The registry client's fixed words for a tarball download it refused (`registryRefusal(response, ...)`): the one fact
|
|
1569
|
+
* that tells a download's refusal from a resolve's, both `WrunRegistryHttpError`. */
|
|
1570
|
+
const TARBALL_REFUSAL_PREFIX = 'wrun package tarball failed to download';
|
|
1571
|
+
/** A code of the registry's error envelope the phase carries as itself (`package_deleted`, `hosted_only`). */
|
|
1572
|
+
const REGISTRY_CODE_RE = /^[a-z][a-z0-9_]{0,47}$/;
|
|
1573
|
+
/** A closed failure code a record carries at `params.code`, the bound `wrun_failure_shown` holds its code to: never
|
|
1574
|
+
* message text. */
|
|
1575
|
+
const FAILURE_CODE_RE = /^[A-Za-z0-9_.-]{1,64}$/;
|
|
1576
|
+
function isFailureCode(value) {
|
|
1577
|
+
return typeof value === 'string' && FAILURE_CODE_RE.test(value);
|
|
1578
|
+
}
|
|
1579
|
+
function httpStatusOf(error) {
|
|
1580
|
+
const status = isRecordObject(error) ? error.status : undefined;
|
|
1581
|
+
return typeof status === 'number' && Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
1582
|
+
}
|
|
1583
|
+
function registryCodeOf(error) {
|
|
1584
|
+
const code = isRecordObject(error) ? error.code : undefined;
|
|
1585
|
+
return typeof code === 'string' && REGISTRY_CODE_RE.test(code) ? code : undefined;
|
|
1586
|
+
}
|
|
1587
|
+
/** A yanked version: the typed error, or the registry client's own words (`assertWrunRegistryPackageServeable`). */
|
|
1588
|
+
function isYankedFailure(error) {
|
|
1589
|
+
if (errorNameOf(error) === 'WrunRegistryYankedError')
|
|
1590
|
+
return true;
|
|
1591
|
+
const message = messageOf(error);
|
|
1592
|
+
return message.startsWith("wrun package '") && message.includes('is yanked');
|
|
1593
|
+
}
|
|
1594
|
+
/** A module this device could not compile or link (the host rebuilds the worker's compile refusal as a
|
|
1595
|
+
* `WebAssembly.CompileError`), or whose instantiation trapped. */
|
|
1596
|
+
function isWasmLoadFailure(error) {
|
|
1597
|
+
if (typeof WebAssembly === 'undefined')
|
|
1598
|
+
return false;
|
|
1599
|
+
return (error instanceof WebAssembly.CompileError ||
|
|
1600
|
+
error instanceof WebAssembly.LinkError ||
|
|
1601
|
+
error instanceof WebAssembly.RuntimeError);
|
|
1602
|
+
}
|
|
1603
|
+
function registryRefusalCauseOf(error) {
|
|
1604
|
+
if (registryCodeOf(error) === 'hosted_only')
|
|
1605
|
+
return 'package-hosted';
|
|
1606
|
+
const status = httpStatusOf(error);
|
|
1607
|
+
if (status === undefined)
|
|
1608
|
+
return null;
|
|
1609
|
+
if (status === 404 || status === 410)
|
|
1610
|
+
return 'package-withdrawn';
|
|
1611
|
+
if (status === 401 || status === 402 || status === 403)
|
|
1612
|
+
return 'access-denied';
|
|
1613
|
+
return status === 429 || status >= 500 ? 'backend-unavailable' : null;
|
|
1614
|
+
}
|
|
1615
|
+
/**
|
|
1616
|
+
* What stopped a package the loader owns, as a word of the closed cause set, or null for a failure it does not own:
|
|
1617
|
+
* the registry's refusal by its status (404 and 410 `package-withdrawn`, 401, 402 and 403 `access-denied`, 429 and
|
|
1618
|
+
* 5xx `backend-unavailable`; its own `hosted_only` code `package-hosted`), a version gone hosted (`package-hosted`)
|
|
1619
|
+
* or yanked (`package-withdrawn`), a module this device could not compile or link (`compile-failed`), a built-in's
|
|
1620
|
+
* twin that declined (`twin-declined`), the adapter's refusal of the output (`integration-error`), a package the
|
|
1621
|
+
* sandbox quarantined (`worker-dead`: the aftermath of a sandbox it killed). Read by name (a module duplicate under
|
|
1622
|
+
* test still matches), never by the words around a code. Never throws.
|
|
1623
|
+
*/
|
|
1624
|
+
export function wrunLoaderFailureCauseOf(error) {
|
|
1625
|
+
try {
|
|
1626
|
+
switch (errorNameOf(error)) {
|
|
1627
|
+
case REGISTRY_HTTP_ERROR:
|
|
1628
|
+
return registryRefusalCauseOf(error);
|
|
1629
|
+
case 'WrunRegistryHostedOnlyError':
|
|
1630
|
+
return 'package-hosted';
|
|
1631
|
+
case 'WrunProvenTwinDeclinedError':
|
|
1632
|
+
return 'twin-declined';
|
|
1633
|
+
case 'WrunIntegrationError':
|
|
1634
|
+
return 'integration-error';
|
|
1635
|
+
case 'WrunQuarantinedError':
|
|
1636
|
+
return 'worker-dead';
|
|
1637
|
+
default:
|
|
1638
|
+
break;
|
|
1639
|
+
}
|
|
1640
|
+
if (isYankedFailure(error))
|
|
1641
|
+
return 'package-withdrawn';
|
|
1642
|
+
return isWasmLoadFailure(error) ? 'compile-failed' : null;
|
|
1643
|
+
}
|
|
1644
|
+
catch {
|
|
1645
|
+
return null;
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
function registryRefusalCodeOf(error) {
|
|
1649
|
+
const status = httpStatusOf(error);
|
|
1650
|
+
if (status !== undefined && messageOf(error).startsWith(TARBALL_REFUSAL_PREFIX))
|
|
1651
|
+
return `tarball_${status}`;
|
|
1652
|
+
return registryCodeOf(error) ?? (status !== undefined ? `registry_${status}` : null);
|
|
1653
|
+
}
|
|
1654
|
+
function loaderFailureCodeOf(error, followCause) {
|
|
1655
|
+
switch (errorNameOf(error)) {
|
|
1656
|
+
case REGISTRY_HTTP_ERROR:
|
|
1657
|
+
return registryRefusalCodeOf(error);
|
|
1658
|
+
case 'WrunRegistryHostedOnlyError':
|
|
1659
|
+
return 'hosted_only';
|
|
1660
|
+
case 'WrunProvenTwinDeclinedError': {
|
|
1661
|
+
const { reason, cause } = error;
|
|
1662
|
+
if (reason === 'pin-mismatch')
|
|
1663
|
+
return 'twin_pin_mismatch';
|
|
1664
|
+
// A resolve that failed under the twin names that failure's phase.
|
|
1665
|
+
return followCause ? loaderFailureCodeOf(cause, false) : null;
|
|
1666
|
+
}
|
|
1667
|
+
case 'WrunIntegrationError':
|
|
1668
|
+
return 'integration_error';
|
|
1669
|
+
case 'WrunQuarantinedError':
|
|
1670
|
+
return 'quarantined';
|
|
1671
|
+
default:
|
|
1672
|
+
break;
|
|
1673
|
+
}
|
|
1674
|
+
if (isYankedFailure(error))
|
|
1675
|
+
return 'yanked';
|
|
1676
|
+
return isWasmLoadFailure(error) ? 'compile_failed' : null;
|
|
1677
|
+
}
|
|
1678
|
+
/**
|
|
1679
|
+
* The phase a package the loader owns stopped in, as a closed code word, or null for a failure it does not own: the
|
|
1680
|
+
* registry's refusal (`tarball_<status>` for a download, else the registry's own code when it names one, else
|
|
1681
|
+
* `registry_<status>`), `hosted_only`, `yanked`, `compile_failed`, `twin_pin_mismatch` (a twin whose resolve failed
|
|
1682
|
+
* names the failure under it), `integration_error`, `quarantined`. A record carries it at `params.code`
|
|
1683
|
+
* (`wrunAuthorRuleSeed`), so `wrun_failure_shown` names the phase where it said `run-failed`. Never throws.
|
|
1684
|
+
*/
|
|
1685
|
+
export function wrunLoaderFailureCodeOf(error) {
|
|
1686
|
+
try {
|
|
1687
|
+
return loaderFailureCodeOf(error, true);
|
|
1688
|
+
}
|
|
1689
|
+
catch {
|
|
1690
|
+
return null;
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
/** Whether a seed says what failed: any class but run-failed, a run-failed seed that carries its code (`params.code`,
|
|
1694
|
+
* `wrunAuthorRuleSeed`), a named run-failed variant. The generic words and the engine's code words without a code
|
|
1695
|
+
* (`DETAIL_VARIANTS`: only their detail line names the cause) say nothing, so the cause read goes on past them, to
|
|
1696
|
+
* the type, the words and finally `other`. */
|
|
1697
|
+
function seedNamesItsFailure(seed) {
|
|
1698
|
+
if (seed.cls !== 'run-failed')
|
|
1699
|
+
return true;
|
|
1700
|
+
if (isFailureCode(seed.params?.code))
|
|
1701
|
+
return true;
|
|
1702
|
+
const variant = seed.variant !== undefined && variantSpec('run-failed', seed.variant) ? seed.variant : 'generic';
|
|
1703
|
+
return !DETAIL_VARIANTS.has(variant);
|
|
1704
|
+
}
|
|
1705
|
+
/** A failure that already says what it is: a typed error of the lane, a seed its raiser attached or a bare seed that
|
|
1706
|
+
* names its failure (`seedNamesItsFailure`), a stable code of the browser lane, the host's write and memory rules the
|
|
1707
|
+
* Indicator's own code broke. An engine trap no runtime row explains is none of these: it reads `other`. */
|
|
1422
1708
|
function isTypedVerdict(error, message) {
|
|
1423
1709
|
if (TYPED_VERDICT_ERRORS.some((type) => error instanceof type))
|
|
1424
1710
|
return true;
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
if (!(error instanceof Error) && validSeed(error) !== undefined)
|
|
1711
|
+
const seed = wrunRefusalSeedOf(error) ?? (error instanceof Error ? undefined : validSeed(error));
|
|
1712
|
+
if (seed !== undefined && seedNamesItsFailure(seed))
|
|
1428
1713
|
return true;
|
|
1429
|
-
|
|
1714
|
+
const coded = seedFromCodes(message, NO_CONTEXT);
|
|
1715
|
+
if (coded !== undefined && seedNamesItsFailure(coded))
|
|
1430
1716
|
return true;
|
|
1431
|
-
return
|
|
1717
|
+
return HOST_RULE_RE.test(message);
|
|
1432
1718
|
}
|
|
1433
1719
|
/**
|
|
1434
1720
|
* Why a failure happened, as one word of the closed set (wrun-failure-cause): what produced it, beside the attempt
|
|
@@ -1439,10 +1725,13 @@ function isTypedVerdict(error, message) {
|
|
|
1439
1725
|
* 2. a cause its raiser stamped (`stampWrunRefusalTelemetry`);
|
|
1440
1726
|
* 3. its own type, by name (the socket row source's transient reasons, a stopped or unreadable ask, a denied
|
|
1441
1727
|
* capability, the cloud's whole-run refusal, a dead sandbox, an abort its ask's signal did not cause), the kScript
|
|
1442
|
-
* socket's codes (`WRUN_TRANSPORT_CODE_CAUSES`) and our worker's one fixed literal (`backend-unavailable`)
|
|
1728
|
+
* socket's codes (`WRUN_TRANSPORT_CODE_CAUSES`) and our worker's one fixed literal (`backend-unavailable`), then a
|
|
1729
|
+
* package the loader could not load (`wrunLoaderFailureCauseOf`: the registry's refusal by its status, a version
|
|
1730
|
+
* gone hosted or yanked, a module this device could not compile, a declined twin, the adapter's refusal);
|
|
1443
1731
|
* 4. the server's answer through the one answer table: `server:<row>`, a superseded create's answer `superseded`;
|
|
1444
1732
|
* 5. a dropped connection under the run: a lazy chunk (`chunk-load`) or a fetch (`network`);
|
|
1445
|
-
* 6. `none` for a typed verdict (`isTypedVerdict
|
|
1733
|
+
* 6. `none` for a typed verdict (`isTypedVerdict`: never a run-failed seed in the generic words without a code),
|
|
1734
|
+
* else `other`.
|
|
1446
1735
|
* Closed words only, never the message. Never throws.
|
|
1447
1736
|
*/
|
|
1448
1737
|
export function wrunFailureCauseOf(error) {
|
|
@@ -1469,6 +1758,9 @@ function unrecordedFailureCauseOf(error) {
|
|
|
1469
1758
|
return named;
|
|
1470
1759
|
if (message === KSCRIPT_REQUEST_FAILED)
|
|
1471
1760
|
return 'backend-unavailable';
|
|
1761
|
+
const loader = wrunLoaderFailureCauseOf(error);
|
|
1762
|
+
if (loader !== null)
|
|
1763
|
+
return loader;
|
|
1472
1764
|
const answered = serverAnswerCauseOf(wrunServerAnswerOfText(message));
|
|
1473
1765
|
if (answered !== undefined)
|
|
1474
1766
|
return answered;
|
|
@@ -1504,6 +1796,8 @@ function outLabelOf(out, t) {
|
|
|
1504
1796
|
return t('wrun.refusal.out.runOnChart');
|
|
1505
1797
|
case 'report':
|
|
1506
1798
|
return t('wrunReport.legend.report');
|
|
1799
|
+
case 'remove':
|
|
1800
|
+
return t('kscript.legend.card.removeIndicator');
|
|
1507
1801
|
case 'reload':
|
|
1508
1802
|
return t('dialogs.loadingTimeout.reloadApp');
|
|
1509
1803
|
case 'take-session':
|
|
@@ -1529,8 +1823,9 @@ export function wrunRefusalDetailOf(r) {
|
|
|
1529
1823
|
* The ONE text path: chip, sentence, OUT label and severity word of a record, in the injected
|
|
1530
1824
|
* translate's locale, and its detail line (`wrunRefusalDetailOf`, the raiser's own words, never
|
|
1531
1825
|
* translated). `name` and `market` render from the record when the variant does not carry
|
|
1532
|
-
* them as params; a `feed` param renders as its `wrun.refusal.feed.*` words
|
|
1533
|
-
*
|
|
1826
|
+
* them as params; a `feed` param renders as its `wrun.refusal.feed.*` words (a variant's
|
|
1827
|
+
* `feedFallback` when the record names no feed with words); plural keys pass the record's
|
|
1828
|
+
* `count` / `n` as the plural choice. A note has no severity word.
|
|
1534
1829
|
*/
|
|
1535
1830
|
export function wrunRefusalTexts(r, t) {
|
|
1536
1831
|
const spec = renderSpec(r);
|
|
@@ -1539,7 +1834,7 @@ export function wrunRefusalTexts(r, t) {
|
|
|
1539
1834
|
market: r.market?.label ?? '',
|
|
1540
1835
|
...(spec === RUN_FAILED_GENERIC ? {} : r.params),
|
|
1541
1836
|
};
|
|
1542
|
-
const feedKey = wrunRefusalFeedKey(named.feed);
|
|
1837
|
+
const feedKey = wrunRefusalFeedKey(named.feed) ?? spec.feedFallback;
|
|
1543
1838
|
if (feedKey !== undefined)
|
|
1544
1839
|
named.feed = t(feedKey);
|
|
1545
1840
|
const choice = spec.plural === undefined ? undefined : r.params[spec.plural];
|
|
@@ -115,13 +115,15 @@ export declare function isWrunQuarantinedError(error: unknown): error is WrunQua
|
|
|
115
115
|
* arrived without a record, e.g. a host message form that predates it);
|
|
116
116
|
* `quarantineKey` and `sessionKey` name the request the worker was running
|
|
117
117
|
* (its package and, for a live lane, its session, which is the overlay id);
|
|
118
|
-
* `heldMs` is the
|
|
119
|
-
*
|
|
120
|
-
*
|
|
118
|
+
* `heldMs` is the budget a timeout exhausted, so it bounds how long that
|
|
119
|
+
* request held the sandbox, never how long it executed; `at` is the death's
|
|
120
|
+
* epoch ms. */
|
|
121
121
|
export interface WrunHostDeathContext {
|
|
122
122
|
readonly kind: 'timeout' | 'worker-error' | 'unknown';
|
|
123
123
|
readonly quarantineKey?: string;
|
|
124
124
|
readonly sessionKey?: string;
|
|
125
|
+
/** The culprit's phase: `start` (its wait, compile and instantiation, from the post) or `run` (executing). */
|
|
126
|
+
readonly phase?: 'start' | 'run';
|
|
125
127
|
readonly heldMs?: number;
|
|
126
128
|
readonly at: number;
|
|
127
129
|
}
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* registry and dedupe table.
|
|
33
33
|
*/
|
|
34
34
|
import type { WrunChartHandle } from '../../host-ports.types.js';
|
|
35
|
-
import type { WrunIndicatorMetadata, WrunOutputRow } from '../../interfaces/wrun-runtime.interface.js';
|
|
35
|
+
import type { WrunIndicatorMetadata, WrunModuleHandle, WrunOutputRow } from '../../interfaces/wrun-runtime.interface.js';
|
|
36
36
|
import type { WrunCellRows } from './wrun-canvases.util.js';
|
|
37
37
|
import { type WrunStrategyRunInput } from './wrun-host.service.js';
|
|
38
38
|
import { type WrunInputRow } from './wrun-pack.util.js';
|
|
@@ -101,7 +101,7 @@ export declare function wrunRowBatchCellRows(batch: WrunRowBatch): WrunCellRows
|
|
|
101
101
|
export declare function wrunSandboxRowBatchOf(input: WrunSandboxBatchInput): WrunRowBatch;
|
|
102
102
|
/** The engine worker's request one window resolves to (`WrunBrowserHost.runSeries` / `startLiveSeries`). */
|
|
103
103
|
export interface WrunSandboxRunRequest {
|
|
104
|
-
module:
|
|
104
|
+
module: WrunModuleHandle;
|
|
105
105
|
metadata: WrunIndicatorMetadata;
|
|
106
106
|
rows: readonly WrunInputRow[];
|
|
107
107
|
initArgs: readonly number[];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SHA-256 of a wrun module's bytes, synchronously and with no global: the engine worker's load path
|
|
3
|
+
* (wrun-engine-handler.ts) hashes every module it is handed before it checks the sheet's `wasm_sha256` pin, and mints
|
|
4
|
+
* the module's cache key from the digest. The main thread never hashes a module (wrun-host.service.ts posts the bytes
|
|
5
|
+
* and reads the digest off the worker's reply), so nothing here may reach for `crypto.subtle`: it is missing outside a
|
|
6
|
+
* secure context, it answers only through a promise, and the worker's load has no await to spare before its cache
|
|
7
|
+
* entry exists.
|
|
8
|
+
*
|
|
9
|
+
* Ported from the phone's `wrunSha256Hex` (kiyotaka-frontend-app chart-web/src/wrun/wrun-memory-clamp.ts:242), which
|
|
10
|
+
* phase A moves onto this leaf before its own copy goes. FIPS 180-4 sections 4.2.2 and 5.3.3.
|
|
11
|
+
*/
|
|
12
|
+
/** SHA-256 of `bytes` (the view's own range) as 64 lowercase hex digits, synchronously. */
|
|
13
|
+
export declare function wrunSha256Hex(bytes: Uint8Array): string;
|