@orangecharts/wrun-chart-host 0.1.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.
Files changed (198) hide show
  1. package/README.md +72 -0
  2. package/dist/constants/governed-exchanges.constants.d.ts +11 -0
  3. package/dist/constants/governed-exchanges.constants.js +11 -0
  4. package/dist/constants/indicator-sets.constants.d.ts +8 -0
  5. package/dist/constants/indicator-sets.constants.js +8 -0
  6. package/dist/constants/interval.constants.d.ts +34 -0
  7. package/dist/constants/interval.constants.js +121 -0
  8. package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.d.ts +28 -0
  9. package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.js +65 -0
  10. package/dist/constants/tpo-color-schemes.constants.d.ts +30 -0
  11. package/dist/constants/tpo-color-schemes.constants.js +32 -0
  12. package/dist/host-env.d.ts +102 -0
  13. package/dist/host-env.js +26 -0
  14. package/dist/index.d.ts +93 -0
  15. package/dist/index.js +96 -0
  16. package/dist/indicators/controls/tpo-letter.util.d.ts +2 -0
  17. package/dist/indicators/controls/tpo-letter.util.js +13 -0
  18. package/dist/indicators/controls/tpo-session.util.d.ts +99 -0
  19. package/dist/indicators/controls/tpo-session.util.js +389 -0
  20. package/dist/interfaces/kscript-diagnostics.interface.d.ts +64 -0
  21. package/dist/interfaces/kscript-diagnostics.interface.js +1 -0
  22. package/dist/interfaces/om-panel-data.interface.d.ts +103 -0
  23. package/dist/interfaces/om-panel-data.interface.js +7 -0
  24. package/dist/interfaces/wrun-runtime.interface.d.ts +2659 -0
  25. package/dist/interfaces/wrun-runtime.interface.js +55 -0
  26. package/dist/utility/chart/calendar-interval.util.d.ts +24 -0
  27. package/dist/utility/chart/calendar-interval.util.js +81 -0
  28. package/dist/utility/chart/candle-bar-end.util.d.ts +15 -0
  29. package/dist/utility/chart/candle-bar-end.util.js +23 -0
  30. package/dist/utility/chart/cme-realtime.util.d.ts +24 -0
  31. package/dist/utility/chart/cme-realtime.util.js +53 -0
  32. package/dist/utility/chart/interval-ladder.util.d.ts +27 -0
  33. package/dist/utility/chart/interval-ladder.util.js +92 -0
  34. package/dist/utility/chart/kscript-drawing-prep.util.d.ts +40 -0
  35. package/dist/utility/chart/kscript-drawing-prep.util.js +184 -0
  36. package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +95 -0
  37. package/dist/utility/chart/kscript-drawing-safe-area.util.js +805 -0
  38. package/dist/utility/chart/kscript-legend-entries.util.d.ts +166 -0
  39. package/dist/utility/chart/kscript-legend-entries.util.js +538 -0
  40. package/dist/utility/chart/kscript-output-role.util.d.ts +32 -0
  41. package/dist/utility/chart/kscript-output-role.util.js +215 -0
  42. package/dist/utility/chart/kscript-provenance-keys.util.d.ts +22 -0
  43. package/dist/utility/chart/kscript-provenance-keys.util.js +56 -0
  44. package/dist/utility/chart/kscript-run-result-normalize.util.d.ts +53 -0
  45. package/dist/utility/chart/kscript-run-result-normalize.util.js +476 -0
  46. package/dist/utility/chart/kscript-run-result-shape.util.d.ts +14 -0
  47. package/dist/utility/chart/kscript-run-result-shape.util.js +66 -0
  48. package/dist/utility/chart/kscript-titancharts-container.util.d.ts +29 -0
  49. package/dist/utility/chart/kscript-titancharts-container.util.js +151 -0
  50. package/dist/utility/chart/kscript-viewport-overlays.util.d.ts +83 -0
  51. package/dist/utility/chart/kscript-viewport-overlays.util.js +443 -0
  52. package/dist/utility/chart/om-panel-push-style.util.d.ts +78 -0
  53. package/dist/utility/chart/om-panel-push-style.util.js +301 -0
  54. package/dist/utility/chart/om-panel.util.d.ts +166 -0
  55. package/dist/utility/chart/om-panel.util.js +815 -0
  56. package/dist/utility/chart/om-series.util.d.ts +42 -0
  57. package/dist/utility/chart/om-series.util.js +330 -0
  58. package/dist/utility/chart/om-target.util.d.ts +11 -0
  59. package/dist/utility/chart/om-target.util.js +24 -0
  60. package/dist/utility/chart/om-widget.util.d.ts +148 -0
  61. package/dist/utility/chart/om-widget.util.js +413 -0
  62. package/dist/utility/chart/overlay-output-budget.util.d.ts +16 -0
  63. package/dist/utility/chart/overlay-output-budget.util.js +109 -0
  64. package/dist/utility/chart/overlay-paint-flags.util.d.ts +24 -0
  65. package/dist/utility/chart/overlay-paint-flags.util.js +55 -0
  66. package/dist/utility/chart/profile-row-height.util.d.ts +21 -0
  67. package/dist/utility/chart/profile-row-height.util.js +110 -0
  68. package/dist/utility/chart/session-interval.util.d.ts +1 -0
  69. package/dist/utility/chart/session-interval.util.js +35 -0
  70. package/dist/utility/chart/technical-script-legend-value.util.d.ts +18 -0
  71. package/dist/utility/chart/technical-script-legend-value.util.js +53 -0
  72. package/dist/utility/chart/trading-day.util.d.ts +70 -0
  73. package/dist/utility/chart/trading-day.util.js +238 -0
  74. package/dist/utility/chart/wrun-legend-name.util.d.ts +25 -0
  75. package/dist/utility/chart/wrun-legend-name.util.js +87 -0
  76. package/dist/utility/chart/wrun-run-result.util.d.ts +977 -0
  77. package/dist/utility/chart/wrun-run-result.util.js +5179 -0
  78. package/dist/utility/chart/wrun-visibility-chart.util.d.ts +25 -0
  79. package/dist/utility/chart/wrun-visibility-chart.util.js +22 -0
  80. package/dist/utility/indicators/heatmap-sensitivity.util.d.ts +62 -0
  81. package/dist/utility/indicators/heatmap-sensitivity.util.js +82 -0
  82. package/dist/utility/number-format.util.d.ts +68 -0
  83. package/dist/utility/number-format.util.js +188 -0
  84. package/dist/utility/v2/opra-governed.util.d.ts +1 -0
  85. package/dist/utility/v2/opra-governed.util.js +13 -0
  86. package/dist/utility/wrun/wrun-auto-row.util.d.ts +54 -0
  87. package/dist/utility/wrun/wrun-auto-row.util.js +96 -0
  88. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +341 -0
  89. package/dist/utility/wrun/wrun-batched-marks.util.js +938 -0
  90. package/dist/utility/wrun/wrun-batched-readout.util.d.ts +75 -0
  91. package/dist/utility/wrun/wrun-batched-readout.util.js +171 -0
  92. package/dist/utility/wrun/wrun-box-segment.util.d.ts +185 -0
  93. package/dist/utility/wrun/wrun-box-segment.util.js +570 -0
  94. package/dist/utility/wrun/wrun-build-memo.util.d.ts +133 -0
  95. package/dist/utility/wrun/wrun-build-memo.util.js +301 -0
  96. package/dist/utility/wrun/wrun-builtin-twin-ports.util.d.ts +25 -0
  97. package/dist/utility/wrun/wrun-builtin-twin-ports.util.js +75 -0
  98. package/dist/utility/wrun/wrun-builtin-twin.util.d.ts +9 -0
  99. package/dist/utility/wrun/wrun-builtin-twin.util.js +40 -0
  100. package/dist/utility/wrun/wrun-canvas-cache.util.d.ts +28 -0
  101. package/dist/utility/wrun/wrun-canvas-cache.util.js +56 -0
  102. package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +69 -0
  103. package/dist/utility/wrun/wrun-canvas-readout.util.js +53 -0
  104. package/dist/utility/wrun/wrun-canvases.util.d.ts +295 -0
  105. package/dist/utility/wrun/wrun-canvases.util.js +1432 -0
  106. package/dist/utility/wrun/wrun-cap-notice.util.d.ts +77 -0
  107. package/dist/utility/wrun/wrun-cap-notice.util.js +296 -0
  108. package/dist/utility/wrun/wrun-card-style.util.d.ts +154 -0
  109. package/dist/utility/wrun/wrun-card-style.util.js +539 -0
  110. package/dist/utility/wrun/wrun-chart-context.util.d.ts +89 -0
  111. package/dist/utility/wrun/wrun-chart-context.util.js +213 -0
  112. package/dist/utility/wrun/wrun-chart-names.util.d.ts +23 -0
  113. package/dist/utility/wrun/wrun-chart-names.util.js +33 -0
  114. package/dist/utility/wrun/wrun-chart-time.util.d.ts +12 -0
  115. package/dist/utility/wrun/wrun-chart-time.util.js +23 -0
  116. package/dist/utility/wrun/wrun-child-overlay-id.util.d.ts +13 -0
  117. package/dist/utility/wrun/wrun-child-overlay-id.util.js +44 -0
  118. package/dist/utility/wrun/wrun-color-facts.util.d.ts +40 -0
  119. package/dist/utility/wrun/wrun-color-facts.util.js +88 -0
  120. package/dist/utility/wrun/wrun-color-settings.lazy.d.ts +26 -0
  121. package/dist/utility/wrun/wrun-color-settings.lazy.js +9 -0
  122. package/dist/utility/wrun/wrun-color-settings.util.d.ts +351 -0
  123. package/dist/utility/wrun/wrun-color-settings.util.js +1363 -0
  124. package/dist/utility/wrun/wrun-footprint-modes.util.d.ts +23 -0
  125. package/dist/utility/wrun/wrun-footprint-modes.util.js +24 -0
  126. package/dist/utility/wrun/wrun-frames.d.ts +217 -0
  127. package/dist/utility/wrun/wrun-frames.js +1021 -0
  128. package/dist/utility/wrun/wrun-handles.util.d.ts +792 -0
  129. package/dist/utility/wrun/wrun-handles.util.js +2050 -0
  130. package/dist/utility/wrun/wrun-heatmap-cell-budget.util.d.ts +156 -0
  131. package/dist/utility/wrun/wrun-heatmap-cell-budget.util.js +342 -0
  132. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +218 -0
  133. package/dist/utility/wrun/wrun-hosted-wire-caps.js +667 -0
  134. package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +40 -0
  135. package/dist/utility/wrun/wrun-hosted-wire.util.js +27 -0
  136. package/dist/utility/wrun/wrun-hover.util.d.ts +182 -0
  137. package/dist/utility/wrun/wrun-hover.util.js +534 -0
  138. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +246 -0
  139. package/dist/utility/wrun/wrun-hud-looks.util.js +587 -0
  140. package/dist/utility/wrun/wrun-integration-budget.util.d.ts +47 -0
  141. package/dist/utility/wrun/wrun-integration-budget.util.js +122 -0
  142. package/dist/utility/wrun/wrun-latest-snapshot.d.ts +19 -0
  143. package/dist/utility/wrun/wrun-latest-snapshot.js +7 -0
  144. package/dist/utility/wrun/wrun-levels-child.util.d.ts +131 -0
  145. package/dist/utility/wrun/wrun-levels-child.util.js +514 -0
  146. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +75 -0
  147. package/dist/utility/wrun/wrun-lifecycle.contract.js +9 -0
  148. package/dist/utility/wrun/wrun-market-facts.util.d.ts +116 -0
  149. package/dist/utility/wrun/wrun-market-facts.util.js +238 -0
  150. package/dist/utility/wrun/wrun-output-style.util.d.ts +344 -0
  151. package/dist/utility/wrun/wrun-output-style.util.js +1239 -0
  152. package/dist/utility/wrun/wrun-overlay-identity.util.d.ts +84 -0
  153. package/dist/utility/wrun/wrun-overlay-identity.util.js +142 -0
  154. package/dist/utility/wrun/wrun-overlay-result.util.d.ts +120 -0
  155. package/dist/utility/wrun/wrun-overlay-result.util.js +219 -0
  156. package/dist/utility/wrun/wrun-pack.util.d.ts +70 -0
  157. package/dist/utility/wrun/wrun-pack.util.js +301 -0
  158. package/dist/utility/wrun/wrun-pane-format.util.d.ts +180 -0
  159. package/dist/utility/wrun/wrun-pane-format.util.js +299 -0
  160. package/dist/utility/wrun/wrun-panel-style.lazy.d.ts +25 -0
  161. package/dist/utility/wrun/wrun-panel-style.lazy.js +15 -0
  162. package/dist/utility/wrun/wrun-panel-style.util.d.ts +174 -0
  163. package/dist/utility/wrun/wrun-panel-style.util.js +726 -0
  164. package/dist/utility/wrun/wrun-param-values.util.d.ts +69 -0
  165. package/dist/utility/wrun/wrun-param-values.util.js +230 -0
  166. package/dist/utility/wrun/wrun-refusal.util.d.ts +263 -0
  167. package/dist/utility/wrun/wrun-refusal.util.js +1259 -0
  168. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +199 -0
  169. package/dist/utility/wrun/wrun-registry-errors.util.js +257 -0
  170. package/dist/utility/wrun/wrun-render-select.util.d.ts +336 -0
  171. package/dist/utility/wrun/wrun-render-select.util.js +1157 -0
  172. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +434 -0
  173. package/dist/utility/wrun/wrun-script-inputs.util.js +1971 -0
  174. package/dist/utility/wrun/wrun-setting-words.lazy.d.ts +20 -0
  175. package/dist/utility/wrun/wrun-setting-words.lazy.js +9 -0
  176. package/dist/utility/wrun/wrun-setting-words.util.d.ts +79 -0
  177. package/dist/utility/wrun/wrun-setting-words.util.js +176 -0
  178. package/dist/utility/wrun/wrun-socket-row-store.d.ts +98 -0
  179. package/dist/utility/wrun/wrun-socket-row-store.js +417 -0
  180. package/dist/utility/wrun/wrun-style-flags.util.d.ts +18 -0
  181. package/dist/utility/wrun/wrun-style-flags.util.js +21 -0
  182. package/dist/utility/wrun/wrun-style-words.util.d.ts +148 -0
  183. package/dist/utility/wrun/wrun-style-words.util.js +439 -0
  184. package/dist/utility/wrun/wrun-table-look.util.d.ts +125 -0
  185. package/dist/utility/wrun/wrun-table-look.util.js +225 -0
  186. package/dist/utility/wrun/wrun-text-look.util.d.ts +51 -0
  187. package/dist/utility/wrun/wrun-text-look.util.js +227 -0
  188. package/dist/utility/wrun/wrun-text-params.util.d.ts +106 -0
  189. package/dist/utility/wrun/wrun-text-params.util.js +171 -0
  190. package/dist/utility/wrun/wrun-tpo-rows.util.d.ts +71 -0
  191. package/dist/utility/wrun/wrun-tpo-rows.util.js +438 -0
  192. package/dist/utility/wrun/wrun-twin-compute-inputs.util.d.ts +14 -0
  193. package/dist/utility/wrun/wrun-twin-compute-inputs.util.js +58 -0
  194. package/dist/utility/wrun/wrun-visibility-table.d.ts +437 -0
  195. package/dist/utility/wrun/wrun-visibility-table.js +237 -0
  196. package/dist/utility/wrun/wrun-volume-profile.util.d.ts +37 -0
  197. package/dist/utility/wrun/wrun-volume-profile.util.js +278 -0
  198. package/package.json +38 -0
@@ -0,0 +1,199 @@
1
+ /**
2
+ * Error taxonomy for the wrun lanes (registry add, rehydrate, the run pass).
3
+ * Deliberately its own tiny module (no loader imports): callers that must
4
+ * stay off the boot path check these types statically while the loader
5
+ * itself keeps arriving through dynamic import. The analytics envelope
6
+ * (utility/chart/wrun-attempt-envelope.util.ts) classifies outcomes by these
7
+ * classes, so a NEW failure class the run pass can name gets a class here,
8
+ * never a message-pattern match. Its one import is a type (erased at build).
9
+ */
10
+ import type { WrunOverlayHold } from './wrun-lifecycle.contract.js';
11
+ /** Thrown by the registry loader's mount chokepoint when the enforced
12
+ * chartStore.addIndicator declines to mount: the slot/plan gate, or a venue
13
+ * policy refusal. Every such refusal already surfaced its own message
14
+ * (upgrade dialog or warning toast), so callers must show NOTHING more, a
15
+ * stacked "failed to add" toast would read as a second, phantom error. */
16
+ export declare class WrunRegistryAddRefusedError extends Error {
17
+ constructor(message?: string);
18
+ }
19
+ export declare function isWrunRegistryAddRefusedError(error: unknown): error is WrunRegistryAddRefusedError;
20
+ /** Thrown by the add chokepoint (wrun-registry-catalog.util
21
+ * addWrunRegistryPackage) for an official PORT (a package the twins join
22
+ * names) while the native indicators are off for the viewer
23
+ * (`wrun-native-indicators`, wrun-twins.util isWrunOfficialPackageLit):
24
+ * nothing resolves and nothing mounts. No door offers a port then (the
25
+ * OpenMarket group lists the built-ins and the originals, super search drops
26
+ * the port rows), so only a stale link or a leftover door reaches here; it
27
+ * subclasses the add refusal so no caller stacks a "failed to add" toast over
28
+ * a row the viewer was never offered. An ORIGINAL never meets it: it rides
29
+ * the Indicators section alone (WRUN-MARKET-SESSIONS C4). */
30
+ export declare class WrunNativeIndicatorsOffError extends WrunRegistryAddRefusedError {
31
+ constructor(packageName: string);
32
+ }
33
+ /** Why the proven route of a built-in's twin declined before anything mounted:
34
+ * the registry answered the pinned ask with another version, or the resolve
35
+ * failed (unreachable, past its deadline, unknown, the pin yanked or never
36
+ * published, the section gone dark). */
37
+ export type WrunProvenTwinDeclineReason = 'pin-mismatch' | 'resolve-failed';
38
+ /** Thrown by the proven route of a built-in's twin (option A,
39
+ * wrun-proven-twin-add.util) when it declined BEFORE anything mounted: the
40
+ * chart is untouched, and the caller adds the built-in's shipped template
41
+ * instead, so the user is never left without the indicator. Past a proven
42
+ * resolve the registry lane's own errors pass through unchanged. */
43
+ export declare class WrunProvenTwinDeclinedError extends Error {
44
+ readonly reason: WrunProvenTwinDeclineReason;
45
+ constructor(packageName: string, reason: WrunProvenTwinDeclineReason, options?: {
46
+ cause?: unknown;
47
+ });
48
+ }
49
+ export declare function isWrunProvenTwinDeclinedError(error: unknown): error is WrunProvenTwinDeclinedError;
50
+ /** Thrown by every browser download door of the registry client (the
51
+ * resolve-then-download load, the memoized download, the loader's add and
52
+ * rehydrate) for a HOSTED version: the registry serves its bytes to the
53
+ * hosted executors only, so the browser never fetches them. The catalog's
54
+ * add chokepoint mounts such a package through the hosted lane instead; a
55
+ * browser-saved overlay whose package went hosted lands this on its legend. */
56
+ export declare class WrunRegistryHostedOnlyError extends Error {
57
+ constructor(packageName: string);
58
+ }
59
+ export declare function isWrunRegistryHostedOnlyError(error: unknown): error is WrunRegistryHostedOnlyError;
60
+ /** Thrown by the WRUN run pass when a declared source lane is declined or
61
+ * answers with no rows at all (the fail-loud STATE lanes: volume_profile,
62
+ * funding, implied_volatility, skew; flow-sparse liquidations instead
63
+ * computes over a quiet window under its missing policy): the run
64
+ * cannot honestly compute, and silently feeding the module empty cell
65
+ * blocks would render a wrong-but-plausible overlay. The lane toasts its
66
+ * own LABELED message before throwing, so this subclasses the add refusal:
67
+ * every existing "already surfaced, show nothing more" check covers it and
68
+ * no caller stacks a generic failure toast on top. */
69
+ export declare class WrunSourceDataUnavailableError extends WrunRegistryAddRefusedError {
70
+ constructor(message: string);
71
+ }
72
+ /** Thrown at the head of the WRUN run pass when the CME display wall
73
+ * (`isKScriptDisplayBlockedOnExchange`, kscript-venue-policy.util) refuses
74
+ * the overlay on the chart's venue: a community package, an editor draft or
75
+ * a dev fixture on a governed chart. Nothing is fetched and nothing
76
+ * computes; before this refusal a walled overlay restored onto such a chart
77
+ * was hidden by the wall's painter and still ran every lane behind it. The
78
+ * message is the venue policy's own (`createKScriptVenueBlockedError`,
79
+ * handed in by the run pass so this module keeps its zero imports), which
80
+ * is what `isKScriptVenueBlockedError` recognizes. It subclasses the add
81
+ * refusal because the wall's painter already put the ONE standing message
82
+ * on the legend: no caller surfaces a second one, and the driver stays
83
+ * registered so the run after the chart leaves the governed venue computes. */
84
+ export declare class WrunVenueBlockedError extends WrunRegistryAddRefusedError {
85
+ constructor(message: string);
86
+ }
87
+ export declare function isWrunVenueBlockedError(error: unknown): error is WrunVenueBlockedError;
88
+ /** The run head refused because the overlay is paused or its execution guard
89
+ * tripped. Silent like the venue wall: the legend already shows the Paused
90
+ * state, so no caller adds a chip or a toast, the driver stays registered,
91
+ * and Resume reruns it. */
92
+ export declare class WrunOverlayPausedError extends WrunRegistryAddRefusedError {
93
+ readonly hold: 'paused' | 'tripped';
94
+ constructor(hold: 'paused' | 'tripped');
95
+ }
96
+ export declare function isWrunOverlayPausedError(error: unknown): error is WrunOverlayPausedError;
97
+ /** Why the lifecycle door held a mount's first compute. */
98
+ export type WrunFirstRunHold = NonNullable<WrunOverlayHold>;
99
+ /** The first run of a mount whose caller awaits that run (the editor's draft
100
+ * Run) was held by the lifecycle door: nothing computed and nothing will for
101
+ * this Run, so the add refuses like the chart gate (the overlay leaves the
102
+ * chart) instead of reporting an add that never draws. It subclasses the add
103
+ * refusal, so every caller reads it on the blocked path; `hold` says why. */
104
+ export declare class WrunFirstRunHeldError extends WrunRegistryAddRefusedError {
105
+ readonly hold: WrunFirstRunHold;
106
+ constructor(subject: string, hold: WrunFirstRunHold);
107
+ }
108
+ export declare function isWrunFirstRunHeldError(error: unknown): error is WrunFirstRunHeldError;
109
+ /** The host refused to dispatch a package that recently killed the shared
110
+ * worker (its run past the timeout, or the worker's `onerror`) until `until`.
111
+ * The death's `reason` and the package's consecutive `strikes` ride along:
112
+ * the heal ladder waits out a first-strike timeout (one slow run on a loaded
113
+ * host) and runs once more, and treats every other quarantine as
114
+ * deterministic (the same package spins the same way). A Retry or a settings
115
+ * save overrides it. Both are absent when the raiser did not know them. */
116
+ export declare class WrunQuarantinedError extends Error {
117
+ readonly quarantineKey: string;
118
+ readonly until: number;
119
+ readonly reason: WrunWorkerPoisonError['reason'] | undefined;
120
+ readonly strikes: number | undefined;
121
+ constructor(quarantineKey: string, until: number, reason?: WrunWorkerPoisonError['reason'], strikes?: number);
122
+ }
123
+ export declare function isWrunQuarantinedError(error: unknown): error is WrunQuarantinedError;
124
+ /** Who held the shared wrun worker when it died, recorded once per death by
125
+ * the host (frozen) and carried unchanged by every rejection of that death
126
+ * (each pending request's, the respawn hold's) and by every casualty record
127
+ * the recovery queues for it. `kind` is the cause ('unknown' when a casualty
128
+ * arrived without a record, e.g. a host message form that predates it);
129
+ * `quarantineKey` and `sessionKey` name the request the worker was running
130
+ * (its package and, for a live lane, its session, which is the overlay id);
131
+ * `heldMs` is the run budget a timeout exhausted, counted from dispatch, so
132
+ * it bounds how long that run held the sandbox, never how long it executed;
133
+ * `at` is the death's epoch ms. */
134
+ export interface WrunHostDeathContext {
135
+ readonly kind: 'timeout' | 'worker-error' | 'unknown';
136
+ readonly quarantineKey?: string;
137
+ readonly sessionKey?: string;
138
+ readonly heldMs?: number;
139
+ readonly at: number;
140
+ }
141
+ /** The shared wrun worker died (run timeout or `onerror`) and took every
142
+ * pending request and live session with it. Each casualty's caller receives
143
+ * this rejection; `casualtySessionKeys` lists every session lost in the same
144
+ * death, for logging; `death` is the host's record of that death (absent on
145
+ * an error built outside the host). */
146
+ export declare class WrunWorkerPoisonError extends Error {
147
+ readonly reason: 'timeout' | 'worker-error';
148
+ readonly casualtySessionKeys: readonly string[];
149
+ readonly death?: WrunHostDeathContext;
150
+ constructor(reason: 'timeout' | 'worker-error', casualtySessionKeys: readonly string[], death?: WrunHostDeathContext);
151
+ }
152
+ export declare function isWrunWorkerPoisonError(error: unknown): error is WrunWorkerPoisonError;
153
+ /** The deadline wrapper's rejection (wrun-deadline.util.ts): the awaited
154
+ * phase (download, mount, run, one source lane) did not settle inside its
155
+ * ceiling. The message names the phase; the class is what the envelope
156
+ * reads as `timeout`. */
157
+ export declare class WrunDeadlineError extends Error {
158
+ constructor(message: string);
159
+ }
160
+ /** The run pass (or the driver executor) found no chart at the index, no
161
+ * mounted record for the overlay, or a teardown mid-run: nothing to compute
162
+ * for, not a compute failure. */
163
+ export declare class WrunChartGoneError extends Error {
164
+ constructor(message: string);
165
+ }
166
+ /** The chart has no candle rows to compute over yet (boot before the main
167
+ * series lands): the run is retried by the next chart trigger, never a
168
+ * compute failure of the package. */
169
+ export declare class WrunNoBarsError extends Error {
170
+ constructor(message: string);
171
+ }
172
+ /** The canonical adapter refused the built run-result; the message carries
173
+ * the adapter diagnostics. The package computed, the chart did not accept
174
+ * the shape. */
175
+ export declare class WrunIntegrationError extends Error {
176
+ constructor(message: string);
177
+ }
178
+ /**
179
+ * Stamp the mounted overlay's id on a run's rejection (the field the script
180
+ * editor's kScript and hosted run catches already read, and the one
181
+ * `chart.add-indicator` stamps on a failed add): a caller awaiting a mount's
182
+ * first run (the editor's draft Run) can then bind the tab to the overlay
183
+ * that IS on the chart and read its diagnostics and print outputs for the
184
+ * failed run entry. An id already carried wins (the nearest failure site
185
+ * named it); a non-object rejection is returned as it is.
186
+ */
187
+ export declare function annotateWrunErrorIndicatorId<T>(error: T, indicatorId: string): T;
188
+ /**
189
+ * Hand a run's rejection the write of its failure row (a trap, an output never written: the runtime
190
+ * diagnostic the console and the legend chip read). The write waits on the chart store's module, so it can
191
+ * land after the rejection reaches a caller; a non-object rejection carries none.
192
+ */
193
+ export declare function annotateWrunErrorFailureRow(error: unknown, write: Promise<void>): void;
194
+ /**
195
+ * Resolves once the failure row of the run that rejected with `error` has landed in the chart store, at once
196
+ * when that run wrote none. Never rejects. The editor's Run awaits it before reading the overlay's
197
+ * diagnostics, so the failed attempt names the row the console shows.
198
+ */
199
+ export declare function wrunErrorFailureRowWritten(error: unknown): Promise<void>;
@@ -0,0 +1,257 @@
1
+ /**
2
+ * Error taxonomy for the wrun lanes (registry add, rehydrate, the run pass).
3
+ * Deliberately its own tiny module (no loader imports): callers that must
4
+ * stay off the boot path check these types statically while the loader
5
+ * itself keeps arriving through dynamic import. The analytics envelope
6
+ * (utility/chart/wrun-attempt-envelope.util.ts) classifies outcomes by these
7
+ * classes, so a NEW failure class the run pass can name gets a class here,
8
+ * never a message-pattern match. Its one import is a type (erased at build).
9
+ */
10
+ /** Thrown by the registry loader's mount chokepoint when the enforced
11
+ * chartStore.addIndicator declines to mount: the slot/plan gate, or a venue
12
+ * policy refusal. Every such refusal already surfaced its own message
13
+ * (upgrade dialog or warning toast), so callers must show NOTHING more, a
14
+ * stacked "failed to add" toast would read as a second, phantom error. */
15
+ export class WrunRegistryAddRefusedError extends Error {
16
+ constructor(message = 'wrun registry add refused by the chart gate (already surfaced to the user)') {
17
+ super(message);
18
+ this.name = 'WrunRegistryAddRefusedError';
19
+ }
20
+ }
21
+ export function isWrunRegistryAddRefusedError(error) {
22
+ return error instanceof WrunRegistryAddRefusedError;
23
+ }
24
+ /** Thrown by the add chokepoint (wrun-registry-catalog.util
25
+ * addWrunRegistryPackage) for an official PORT (a package the twins join
26
+ * names) while the native indicators are off for the viewer
27
+ * (`wrun-native-indicators`, wrun-twins.util isWrunOfficialPackageLit):
28
+ * nothing resolves and nothing mounts. No door offers a port then (the
29
+ * OpenMarket group lists the built-ins and the originals, super search drops
30
+ * the port rows), so only a stale link or a leftover door reaches here; it
31
+ * subclasses the add refusal so no caller stacks a "failed to add" toast over
32
+ * a row the viewer was never offered. An ORIGINAL never meets it: it rides
33
+ * the Indicators section alone (WRUN-MARKET-SESSIONS C4). */
34
+ export class WrunNativeIndicatorsOffError extends WrunRegistryAddRefusedError {
35
+ constructor(packageName) {
36
+ super(`'${packageName}' is an official Indicator, and the native indicators are off for this account`);
37
+ this.name = 'WrunNativeIndicatorsOffError';
38
+ }
39
+ }
40
+ /** Thrown by the proven route of a built-in's twin (option A,
41
+ * wrun-proven-twin-add.util) when it declined BEFORE anything mounted: the
42
+ * chart is untouched, and the caller adds the built-in's shipped template
43
+ * instead, so the user is never left without the indicator. Past a proven
44
+ * resolve the registry lane's own errors pass through unchanged. */
45
+ export class WrunProvenTwinDeclinedError extends Error {
46
+ reason;
47
+ constructor(packageName, reason, options) {
48
+ super(`'${packageName}' declined as its built-in's twin (${reason})`);
49
+ this.name = 'WrunProvenTwinDeclinedError';
50
+ this.reason = reason;
51
+ if (options && 'cause' in options)
52
+ this.cause = options.cause;
53
+ }
54
+ }
55
+ export function isWrunProvenTwinDeclinedError(error) {
56
+ return error instanceof WrunProvenTwinDeclinedError;
57
+ }
58
+ /** Thrown by every browser download door of the registry client (the
59
+ * resolve-then-download load, the memoized download, the loader's add and
60
+ * rehydrate) for a HOSTED version: the registry serves its bytes to the
61
+ * hosted executors only, so the browser never fetches them. The catalog's
62
+ * add chokepoint mounts such a package through the hosted lane instead; a
63
+ * browser-saved overlay whose package went hosted lands this on its legend. */
64
+ export class WrunRegistryHostedOnlyError extends Error {
65
+ constructor(packageName) {
66
+ super(`'${packageName}' runs on OpenMarket servers: the browser never downloads it`);
67
+ this.name = 'WrunRegistryHostedOnlyError';
68
+ }
69
+ }
70
+ export function isWrunRegistryHostedOnlyError(error) {
71
+ return error instanceof WrunRegistryHostedOnlyError;
72
+ }
73
+ /** Thrown by the WRUN run pass when a declared source lane is declined or
74
+ * answers with no rows at all (the fail-loud STATE lanes: volume_profile,
75
+ * funding, implied_volatility, skew; flow-sparse liquidations instead
76
+ * computes over a quiet window under its missing policy): the run
77
+ * cannot honestly compute, and silently feeding the module empty cell
78
+ * blocks would render a wrong-but-plausible overlay. The lane toasts its
79
+ * own LABELED message before throwing, so this subclasses the add refusal:
80
+ * every existing "already surfaced, show nothing more" check covers it and
81
+ * no caller stacks a generic failure toast on top. */
82
+ export class WrunSourceDataUnavailableError extends WrunRegistryAddRefusedError {
83
+ constructor(message) {
84
+ super(message);
85
+ this.name = 'WrunSourceDataUnavailableError';
86
+ }
87
+ }
88
+ /** Thrown at the head of the WRUN run pass when the CME display wall
89
+ * (`isKScriptDisplayBlockedOnExchange`, kscript-venue-policy.util) refuses
90
+ * the overlay on the chart's venue: a community package, an editor draft or
91
+ * a dev fixture on a governed chart. Nothing is fetched and nothing
92
+ * computes; before this refusal a walled overlay restored onto such a chart
93
+ * was hidden by the wall's painter and still ran every lane behind it. The
94
+ * message is the venue policy's own (`createKScriptVenueBlockedError`,
95
+ * handed in by the run pass so this module keeps its zero imports), which
96
+ * is what `isKScriptVenueBlockedError` recognizes. It subclasses the add
97
+ * refusal because the wall's painter already put the ONE standing message
98
+ * on the legend: no caller surfaces a second one, and the driver stays
99
+ * registered so the run after the chart leaves the governed venue computes. */
100
+ export class WrunVenueBlockedError extends WrunRegistryAddRefusedError {
101
+ constructor(message) {
102
+ super(message);
103
+ this.name = 'WrunVenueBlockedError';
104
+ }
105
+ }
106
+ export function isWrunVenueBlockedError(error) {
107
+ return error instanceof WrunVenueBlockedError;
108
+ }
109
+ /** The run head refused because the overlay is paused or its execution guard
110
+ * tripped. Silent like the venue wall: the legend already shows the Paused
111
+ * state, so no caller adds a chip or a toast, the driver stays registered,
112
+ * and Resume reruns it. */
113
+ export class WrunOverlayPausedError extends WrunRegistryAddRefusedError {
114
+ hold;
115
+ constructor(hold) {
116
+ super(`wrun overlay ${hold}`);
117
+ this.name = 'WrunOverlayPausedError';
118
+ this.hold = hold;
119
+ }
120
+ }
121
+ export function isWrunOverlayPausedError(error) {
122
+ return error instanceof WrunOverlayPausedError;
123
+ }
124
+ /** The first run of a mount whose caller awaits that run (the editor's draft
125
+ * Run) was held by the lifecycle door: nothing computed and nothing will for
126
+ * this Run, so the add refuses like the chart gate (the overlay leaves the
127
+ * chart) instead of reporting an add that never draws. It subclasses the add
128
+ * refusal, so every caller reads it on the blocked path; `hold` says why. */
129
+ export class WrunFirstRunHeldError extends WrunRegistryAddRefusedError {
130
+ hold;
131
+ constructor(subject, hold) {
132
+ super(`the first run of '${subject}' was held (${hold}): it was not added`);
133
+ this.name = 'WrunFirstRunHeldError';
134
+ this.hold = hold;
135
+ }
136
+ }
137
+ export function isWrunFirstRunHeldError(error) {
138
+ return error instanceof WrunFirstRunHeldError;
139
+ }
140
+ /** The host refused to dispatch a package that recently killed the shared
141
+ * worker (its run past the timeout, or the worker's `onerror`) until `until`.
142
+ * The death's `reason` and the package's consecutive `strikes` ride along:
143
+ * the heal ladder waits out a first-strike timeout (one slow run on a loaded
144
+ * host) and runs once more, and treats every other quarantine as
145
+ * deterministic (the same package spins the same way). A Retry or a settings
146
+ * save overrides it. Both are absent when the raiser did not know them. */
147
+ export class WrunQuarantinedError extends Error {
148
+ quarantineKey;
149
+ until;
150
+ reason;
151
+ strikes;
152
+ constructor(quarantineKey, until, reason, strikes) {
153
+ super(`wrun package quarantined until ${new Date(until).toISOString()}`);
154
+ this.name = 'WrunQuarantinedError';
155
+ this.quarantineKey = quarantineKey;
156
+ this.until = until;
157
+ this.reason = reason;
158
+ this.strikes = strikes;
159
+ }
160
+ }
161
+ export function isWrunQuarantinedError(error) {
162
+ return error instanceof WrunQuarantinedError;
163
+ }
164
+ /** The shared wrun worker died (run timeout or `onerror`) and took every
165
+ * pending request and live session with it. Each casualty's caller receives
166
+ * this rejection; `casualtySessionKeys` lists every session lost in the same
167
+ * death, for logging; `death` is the host's record of that death (absent on
168
+ * an error built outside the host). */
169
+ export class WrunWorkerPoisonError extends Error {
170
+ reason;
171
+ casualtySessionKeys;
172
+ death;
173
+ constructor(reason, casualtySessionKeys, death) {
174
+ super(`wrun worker ${reason === 'timeout' ? 'timed out' : 'crashed'}`);
175
+ this.name = 'WrunWorkerPoisonError';
176
+ this.reason = reason;
177
+ this.casualtySessionKeys = casualtySessionKeys;
178
+ if (death !== undefined)
179
+ this.death = death;
180
+ }
181
+ }
182
+ export function isWrunWorkerPoisonError(error) {
183
+ return error instanceof WrunWorkerPoisonError;
184
+ }
185
+ /** The deadline wrapper's rejection (wrun-deadline.util.ts): the awaited
186
+ * phase (download, mount, run, one source lane) did not settle inside its
187
+ * ceiling. The message names the phase; the class is what the envelope
188
+ * reads as `timeout`. */
189
+ export class WrunDeadlineError extends Error {
190
+ constructor(message) {
191
+ super(message);
192
+ this.name = 'WrunDeadlineError';
193
+ }
194
+ }
195
+ /** The run pass (or the driver executor) found no chart at the index, no
196
+ * mounted record for the overlay, or a teardown mid-run: nothing to compute
197
+ * for, not a compute failure. */
198
+ export class WrunChartGoneError extends Error {
199
+ constructor(message) {
200
+ super(message);
201
+ this.name = 'WrunChartGoneError';
202
+ }
203
+ }
204
+ /** The chart has no candle rows to compute over yet (boot before the main
205
+ * series lands): the run is retried by the next chart trigger, never a
206
+ * compute failure of the package. */
207
+ export class WrunNoBarsError extends Error {
208
+ constructor(message) {
209
+ super(message);
210
+ this.name = 'WrunNoBarsError';
211
+ }
212
+ }
213
+ /** The canonical adapter refused the built run-result; the message carries
214
+ * the adapter diagnostics. The package computed, the chart did not accept
215
+ * the shape. */
216
+ export class WrunIntegrationError extends Error {
217
+ constructor(message) {
218
+ super(message);
219
+ this.name = 'WrunIntegrationError';
220
+ }
221
+ }
222
+ /**
223
+ * Stamp the mounted overlay's id on a run's rejection (the field the script
224
+ * editor's kScript and hosted run catches already read, and the one
225
+ * `chart.add-indicator` stamps on a failed add): a caller awaiting a mount's
226
+ * first run (the editor's draft Run) can then bind the tab to the overlay
227
+ * that IS on the chart and read its diagnostics and print outputs for the
228
+ * failed run entry. An id already carried wins (the nearest failure site
229
+ * named it); a non-object rejection is returned as it is.
230
+ */
231
+ export function annotateWrunErrorIndicatorId(error, indicatorId) {
232
+ if (error && typeof error === 'object' && !('indicatorId' in error)) {
233
+ error.indicatorId = indicatorId;
234
+ }
235
+ return error;
236
+ }
237
+ // The failure row each failed run is writing to the chart store, keyed by its rejection (a weak key: the row
238
+ // write goes with the error).
239
+ const failureRowWrites = new WeakMap();
240
+ /**
241
+ * Hand a run's rejection the write of its failure row (a trap, an output never written: the runtime
242
+ * diagnostic the console and the legend chip read). The write waits on the chart store's module, so it can
243
+ * land after the rejection reaches a caller; a non-object rejection carries none.
244
+ */
245
+ export function annotateWrunErrorFailureRow(error, write) {
246
+ if (error && typeof error === 'object')
247
+ failureRowWrites.set(error, write);
248
+ }
249
+ /**
250
+ * Resolves once the failure row of the run that rejected with `error` has landed in the chart store, at once
251
+ * when that run wrote none. Never rejects. The editor's Run awaits it before reading the overlay's
252
+ * diagnostics, so the failed attempt names the row the console shows.
253
+ */
254
+ export function wrunErrorFailureRowWritten(error) {
255
+ const write = error && typeof error === 'object' ? failureRowWrites.get(error) : undefined;
256
+ return write ? write.catch(() => undefined) : Promise.resolve();
257
+ }