@mostlyrightmd/core 0.1.0-rc.7

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 (95) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -0
  3. package/dist/discovery/index.cjs +1646 -0
  4. package/dist/discovery/index.cjs.map +1 -0
  5. package/dist/discovery/index.d.cts +313 -0
  6. package/dist/discovery/index.d.ts +313 -0
  7. package/dist/discovery/index.mjs +1609 -0
  8. package/dist/discovery/index.mjs.map +1 -0
  9. package/dist/formats/index.cjs +498 -0
  10. package/dist/formats/index.cjs.map +1 -0
  11. package/dist/formats/index.d.cts +97 -0
  12. package/dist/formats/index.d.ts +97 -0
  13. package/dist/formats/index.mjs +465 -0
  14. package/dist/formats/index.mjs.map +1 -0
  15. package/dist/index.cjs +1624 -0
  16. package/dist/index.cjs.map +1 -0
  17. package/dist/index.d.cts +559 -0
  18. package/dist/index.d.ts +559 -0
  19. package/dist/index.global.js +1582 -0
  20. package/dist/index.global.js.map +1 -0
  21. package/dist/index.mjs +1557 -0
  22. package/dist/index.mjs.map +1 -0
  23. package/dist/internal/bounds.cjs +125 -0
  24. package/dist/internal/bounds.cjs.map +1 -0
  25. package/dist/internal/bounds.d.cts +36 -0
  26. package/dist/internal/bounds.d.ts +36 -0
  27. package/dist/internal/bounds.mjs +81 -0
  28. package/dist/internal/bounds.mjs.map +1 -0
  29. package/dist/internal/cache/fs.cjs +217 -0
  30. package/dist/internal/cache/fs.cjs.map +1 -0
  31. package/dist/internal/cache/fs.d.cts +57 -0
  32. package/dist/internal/cache/fs.d.ts +57 -0
  33. package/dist/internal/cache/fs.mjs +179 -0
  34. package/dist/internal/cache/fs.mjs.map +1 -0
  35. package/dist/internal/cache/index.browser.cjs +1184 -0
  36. package/dist/internal/cache/index.browser.cjs.map +1 -0
  37. package/dist/internal/cache/index.browser.d.cts +20 -0
  38. package/dist/internal/cache/index.browser.d.ts +20 -0
  39. package/dist/internal/cache/index.browser.mjs +36 -0
  40. package/dist/internal/cache/index.browser.mjs.map +1 -0
  41. package/dist/internal/cache/index.cjs +1389 -0
  42. package/dist/internal/cache/index.cjs.map +1 -0
  43. package/dist/internal/cache/index.d.cts +16 -0
  44. package/dist/internal/cache/index.d.ts +16 -0
  45. package/dist/internal/cache/index.mjs +40 -0
  46. package/dist/internal/cache/index.mjs.map +1 -0
  47. package/dist/internal/chunk-PKJXHY27.mjs +1137 -0
  48. package/dist/internal/chunk-PKJXHY27.mjs.map +1 -0
  49. package/dist/internal/convert.cjs +161 -0
  50. package/dist/internal/convert.cjs.map +1 -0
  51. package/dist/internal/convert.d.cts +44 -0
  52. package/dist/internal/convert.d.ts +44 -0
  53. package/dist/internal/convert.mjs +117 -0
  54. package/dist/internal/convert.mjs.map +1 -0
  55. package/dist/internal/fs-O6XR4WWW.mjs +183 -0
  56. package/dist/internal/fs-O6XR4WWW.mjs.map +1 -0
  57. package/dist/internal/keys-B7C8C88N.d.cts +191 -0
  58. package/dist/internal/keys-B7C8C88N.d.ts +191 -0
  59. package/dist/internal/merge/index.cjs +75 -0
  60. package/dist/internal/merge/index.cjs.map +1 -0
  61. package/dist/internal/merge/index.d.cts +74 -0
  62. package/dist/internal/merge/index.d.ts +74 -0
  63. package/dist/internal/merge/index.mjs +46 -0
  64. package/dist/internal/merge/index.mjs.map +1 -0
  65. package/dist/internal/pairs.cjs +328 -0
  66. package/dist/internal/pairs.cjs.map +1 -0
  67. package/dist/internal/pairs.d.cts +105 -0
  68. package/dist/internal/pairs.d.ts +105 -0
  69. package/dist/internal/pairs.mjs +298 -0
  70. package/dist/internal/pairs.mjs.map +1 -0
  71. package/dist/qc/index.cjs +247 -0
  72. package/dist/qc/index.cjs.map +1 -0
  73. package/dist/qc/index.d.cts +140 -0
  74. package/dist/qc/index.d.ts +140 -0
  75. package/dist/qc/index.mjs +212 -0
  76. package/dist/qc/index.mjs.map +1 -0
  77. package/dist/temporal/index.cjs +504 -0
  78. package/dist/temporal/index.cjs.map +1 -0
  79. package/dist/temporal/index.d.cts +121 -0
  80. package/dist/temporal/index.d.ts +121 -0
  81. package/dist/temporal/index.mjs +474 -0
  82. package/dist/temporal/index.mjs.map +1 -0
  83. package/dist/transforms/index.cjs +399 -0
  84. package/dist/transforms/index.cjs.map +1 -0
  85. package/dist/transforms/index.d.cts +193 -0
  86. package/dist/transforms/index.d.ts +193 -0
  87. package/dist/transforms/index.mjs +362 -0
  88. package/dist/transforms/index.mjs.map +1 -0
  89. package/dist/validator.cjs +1870 -0
  90. package/dist/validator.cjs.map +1 -0
  91. package/dist/validator.d.cts +30 -0
  92. package/dist/validator.d.ts +30 -0
  93. package/dist/validator.mjs +1843 -0
  94. package/dist/validator.mjs.map +1 -0
  95. package/package.json +115 -0
@@ -0,0 +1,559 @@
1
+ interface ObservationV1 {
2
+ /**
3
+ * units: celsius — bounded
4
+ */
5
+ dew_point_c?: null | number;
6
+ /**
7
+ * observation valid time
8
+ */
9
+ event_time: string;
10
+ /**
11
+ * raw METAR text if source has it; null for AWC JSON (structured-only)
12
+ */
13
+ metar_raw?: null | string;
14
+ /**
15
+ * METAR | SPECI; defaults METAR when source can't distinguish (e.g. AWC JSON)
16
+ */
17
+ observation_type: "METAR" | "SPECI";
18
+ /**
19
+ * units: mm — hourly precip (METAR p01i, converted from inches)
20
+ */
21
+ precip_mm_1h?: null | number;
22
+ /**
23
+ * units: meters — first cloud layer base height (converted from feet)
24
+ */
25
+ sky_base_1_m?: null | number;
26
+ /**
27
+ * units: meters
28
+ */
29
+ sky_base_2_m?: null | number;
30
+ /**
31
+ * units: meters
32
+ */
33
+ sky_base_3_m?: null | number;
34
+ /**
35
+ * units: meters
36
+ */
37
+ sky_base_4_m?: null | number;
38
+ /**
39
+ * first cloud layer cover code
40
+ */
41
+ sky_cover_1?: "BKN" | "CLR" | "FEW" | "OVC" | "SCT" | "VV" | null;
42
+ /**
43
+ * second layer; null if not present
44
+ */
45
+ sky_cover_2?: "BKN" | "CLR" | "FEW" | "OVC" | "SCT" | "VV" | null;
46
+ /**
47
+ * third layer; null if not present
48
+ */
49
+ sky_cover_3?: "BKN" | "CLR" | "FEW" | "OVC" | "SCT" | "VV" | null;
50
+ /**
51
+ * fourth layer; null if not present
52
+ */
53
+ sky_cover_4?: "BKN" | "CLR" | "FEW" | "OVC" | "SCT" | "VV" | null;
54
+ /**
55
+ * units: hPa — sea-level pressure (canonical aviation unit, not converted across modes)
56
+ */
57
+ slp_hpa?: null | number;
58
+ /**
59
+ * ICAO/ASOS station ID (e.g. KORD)
60
+ */
61
+ station: string;
62
+ /**
63
+ * units: celsius — bounded TEMP_MIN_C..TEMP_MAX_C
64
+ */
65
+ temp_c?: null | number;
66
+ /**
67
+ * units: meters — converted from statute miles
68
+ */
69
+ visibility_m?: null | number;
70
+ /**
71
+ * units: degrees — 0-360, bounded
72
+ */
73
+ wind_dir_deg?: number | null;
74
+ /**
75
+ * units: m/s — converted from kt
76
+ */
77
+ wind_gust_ms?: null | number;
78
+ /**
79
+ * units: m/s — converted from kt
80
+ */
81
+ wind_speed_ms?: null | number;
82
+ }
83
+
84
+ interface ForecastIemMosV1 {
85
+ /**
86
+ * units: celsius
87
+ */
88
+ dew_point_c?: null | number;
89
+ /**
90
+ * units: hours — (valid_at - issued_at).total_seconds() / 3600
91
+ */
92
+ forecast_hour: number;
93
+ /**
94
+ * model run time (from source `runtime` field)
95
+ */
96
+ issued_at: string;
97
+ /**
98
+ * e.g. NBE, GFS, LAV, MET
99
+ */
100
+ model: string;
101
+ /**
102
+ * units: probability — bounded [0, 1]
103
+ */
104
+ precip_probability?: null | number;
105
+ /**
106
+ * units: percent — bounded [0, 100]
107
+ */
108
+ sky_cover_pct?: number | null;
109
+ station: string;
110
+ /**
111
+ * units: celsius
112
+ */
113
+ temp_c?: null | number;
114
+ /**
115
+ * forecast target time (from source `ftime`)
116
+ */
117
+ valid_at: string;
118
+ /**
119
+ * units: degrees
120
+ */
121
+ wind_dir_deg?: number | null;
122
+ /**
123
+ * units: m/s
124
+ */
125
+ wind_speed_ms?: null | number;
126
+ }
127
+
128
+ interface SettlementCliV1 {
129
+ /**
130
+ * NWS CLI data-quality marker (Pitfall 6/16). Allows downstream code to filter or weight settlement rows by issuer quality without re-parsing the product header.
131
+ */
132
+ cli_data_quality: "clean" | "flagged_instrument" | "flagged_late" | "flagged_other" | "missing";
133
+ /**
134
+ * 00:00 local time on observation_date converted to UTC; for sort/join only
135
+ */
136
+ event_time: string;
137
+ /**
138
+ * local climate day per NWS convention (no timezone applied to the date itself)
139
+ */
140
+ observation_date: string;
141
+ /**
142
+ * units: inches
143
+ */
144
+ precipitation_in?: null | number;
145
+ /**
146
+ * parsed from CLI product header (_climate.py::_parse_product_timestamp)
147
+ */
148
+ product_release_time: string;
149
+ /**
150
+ * preliminary | final | correction; dedup priority preliminary < final < correction
151
+ */
152
+ report_type: "correction" | "final" | "preliminary";
153
+ /**
154
+ * provisional | final | superseded. Kalshi NHIGH/NLOW settlement contractually requires 'final'; 'provisional' values are kept for early-look research only.
155
+ */
156
+ settlement_finality: "final" | "provisional" | "superseded";
157
+ /**
158
+ * units: inches
159
+ */
160
+ snowfall_in?: null | number;
161
+ /**
162
+ * ICAO/ASOS station ID
163
+ */
164
+ station: string;
165
+ /**
166
+ * IANA timezone for the station (e.g. America/Chicago for KORD). Required for local-climate-day semantics; see §U.
167
+ */
168
+ station_tz: string;
169
+ /**
170
+ * units: fahrenheit — daily high (uppercase F for consistency with obs imperial mode)
171
+ */
172
+ temp_max_F?: null | number;
173
+ /**
174
+ * units: fahrenheit — daily low
175
+ */
176
+ temp_min_F?: null | number;
177
+ }
178
+
179
+ interface ObservationLedgerV1 {
180
+ as_of_time?: null | string;
181
+ /**
182
+ * units: celsius
183
+ */
184
+ dewpoint_c?: null | number;
185
+ ingestion_id?: null | string;
186
+ observation_kind?: "METAR" | "SPECI" | null;
187
+ /**
188
+ * Lineage row-quality flag per LINEAGE-01; distinct from qc_status enum slot AND distinct from the obs_qc_status bitmask column per QC-05.
189
+ */
190
+ observation_quality?: "clean" | "flagged" | "suspect" | null;
191
+ observation_type: "METAR" | "SPECI";
192
+ observed_at: string;
193
+ parser_name?: "ghcnh" | "iem" | "mostlyright_v1" | "ncei" | null;
194
+ parser_version?: null | string;
195
+ provenance?: "legacy" | "reingested" | null;
196
+ qc_status?: "clean" | "flagged" | "suspect" | null;
197
+ /**
198
+ * ncei reserved per D-2.1-09; never written in v0.1.0.
199
+ */
200
+ source: "awc" | "ghcnh" | "iem" | "ncei";
201
+ source_received_at?: null | string;
202
+ station_code: string;
203
+ /**
204
+ * units: celsius
205
+ */
206
+ temp_c?: null | number;
207
+ }
208
+
209
+ interface ObservationQcV1 {
210
+ as_of_time?: null | string;
211
+ /**
212
+ * JSON-serialized detector payload; shape per qc_system.
213
+ */
214
+ detector_metadata?: null | string;
215
+ /**
216
+ * Observation column the rule evaluated (e.g. temp_c).
217
+ */
218
+ field: string;
219
+ flag: "clean" | "flagged" | "suspect";
220
+ ingestion_id?: null | string;
221
+ observation_kind?: "METAR" | "SPECI" | null;
222
+ observed_at: string;
223
+ parser_name?: null | string;
224
+ qc_system: string;
225
+ qc_version: string;
226
+ rule_id: string;
227
+ source: "awc" | "ghcnh" | "iem" | "ncei";
228
+ station_code: string;
229
+ }
230
+
231
+ interface StationInfo {
232
+ code: string | null;
233
+ ghcnh_id: string | null;
234
+ icao: string;
235
+ name: string | null;
236
+ tz: string;
237
+ latitude: number | null;
238
+ longitude: number | null;
239
+ country: string | null;
240
+ }
241
+ declare const STATIONS: ReadonlyArray<StationInfo>;
242
+ declare const STATION_BY_CODE: ReadonlyMap<string, StationInfo>;
243
+ declare const STATION_BY_ICAO: ReadonlyMap<string, StationInfo>;
244
+
245
+ declare const OBSERVATION_SOURCE_PRIORITY: Readonly<Record<string, number>>;
246
+ declare const CLIMATE_REPORT_TYPE_PRIORITY: Readonly<Record<string, number>>;
247
+ declare const LIVE_V1_POLICY: {
248
+ name: string;
249
+ sourcePriority: Readonly<Record<string, number>>;
250
+ secondaryKey: ReadonlyArray<string>;
251
+ };
252
+
253
+ interface QcAlphaRule {
254
+ rule_id: string;
255
+ bit_position: number;
256
+ description: string;
257
+ field: string;
258
+ }
259
+ declare const QC_ALPHA_RULES: ReadonlyArray<QcAlphaRule>;
260
+ declare const QC_ALPHA_RULES_BY_ID: ReadonlyMap<string, QcAlphaRule>;
261
+
262
+ /**
263
+ * Recursively coerce `value` into a JSON-serializable structure.
264
+ *
265
+ * Coercion rules (mirrors Python's `to_json_safe`):
266
+ * - `null` / `undefined` / `NaN` / `Infinity` / `-Infinity` → `null`
267
+ * - `Date` → ISO 8601 UTC string ending in `Z`
268
+ * - Numeric / boolean / string scalars pass through (non-finite numbers → null)
269
+ * - Arrays + plain objects → recursive (cycles → `{ _cycle: true, value: String(obj) }`)
270
+ * - Dict keys MUST be strings; non-string keys throw `TypeError`.
271
+ * - Anything else (Symbol, function, class instance without `toJSON`) →
272
+ * `{ _repr_only: true, value: String(value) }`.
273
+ */
274
+ declare function toJsonSafe(value: unknown, seen?: WeakSet<object>): unknown;
275
+ interface TradewindsErrorOptions {
276
+ errorCode?: string;
277
+ source?: string | null;
278
+ requestId?: string | null;
279
+ }
280
+ /**
281
+ * Base class for all mostlyright structured errors.
282
+ *
283
+ * `errorCode` is a stable enum (e.g. "SOURCE_UNAVAILABLE") used by callers /
284
+ * agents to branch on without parsing message text. `source` is the source id
285
+ * involved (e.g. "iem.archive") when applicable, and `requestId` correlates a
286
+ * JSON-RPC / MCP request id when applicable.
287
+ */
288
+ declare class TradewindsError extends Error {
289
+ /** Subclass override — the stable string enum surfaced via `errorCode`. */
290
+ static defaultErrorCode: string;
291
+ readonly errorCode: string;
292
+ readonly source: string | null;
293
+ readonly requestId: string | null;
294
+ constructor(message?: string, options?: TradewindsErrorOptions);
295
+ /**
296
+ * Subclass hook returning the structured attributes for `toDict`.
297
+ * Values are passed through `toJsonSafe` by `toDict()`, so subclasses
298
+ * don't need to coerce values themselves.
299
+ */
300
+ protected payload(): Record<string, unknown>;
301
+ /** Return a JSON-safe dict suitable for MCP `error.data`. */
302
+ toDict(): Record<string, unknown>;
303
+ }
304
+ interface SourceUnavailableErrorOptions extends TradewindsErrorOptions {
305
+ httpStatus?: number | null;
306
+ retryable?: boolean;
307
+ retryAfterS?: number | null;
308
+ underlying?: string;
309
+ url?: string | null;
310
+ }
311
+ declare class SourceUnavailableError extends TradewindsError {
312
+ static defaultErrorCode: string;
313
+ readonly httpStatus: number | null;
314
+ readonly retryable: boolean;
315
+ readonly retryAfterS: number | null;
316
+ readonly underlying: string;
317
+ readonly url: string | null;
318
+ constructor(message?: string, options?: SourceUnavailableErrorOptions);
319
+ protected payload(): Record<string, unknown>;
320
+ }
321
+ interface SchemaValidationErrorOptions extends TradewindsErrorOptions {
322
+ schemaId: string;
323
+ violations?: Array<Record<string, unknown>>;
324
+ quarantineCount?: number;
325
+ sampleViolations?: Array<Record<string, unknown>>;
326
+ }
327
+ declare class SchemaValidationError extends TradewindsError {
328
+ static defaultErrorCode: string;
329
+ readonly schemaId: string;
330
+ readonly violations: Array<Record<string, unknown>>;
331
+ readonly quarantineCount: number;
332
+ readonly sampleViolations: Array<Record<string, unknown>>;
333
+ constructor(message: string, options: SchemaValidationErrorOptions);
334
+ protected payload(): Record<string, unknown>;
335
+ }
336
+ type SourceMismatchRole = "observations" | "forecasts" | "settlement";
337
+ interface SourceMismatchErrorOptions extends TradewindsErrorOptions {
338
+ schemaSource: string;
339
+ dataSource: string;
340
+ role?: SourceMismatchRole | null;
341
+ catalogWarning?: string | null;
342
+ }
343
+ declare class SourceMismatchError extends TradewindsError {
344
+ static defaultErrorCode: string;
345
+ /** Canonical role-name vocabulary (design.md §R). */
346
+ static readonly VALID_ROLES: ReadonlySet<SourceMismatchRole>;
347
+ readonly schemaSource: string;
348
+ readonly dataSource: string;
349
+ readonly role: SourceMismatchRole | null;
350
+ readonly catalogWarning: string | null;
351
+ constructor(message: string, options: SourceMismatchErrorOptions);
352
+ protected payload(): Record<string, unknown>;
353
+ }
354
+ interface LeakageErrorOptions extends TradewindsErrorOptions {
355
+ asOf: string;
356
+ violatingCount: number;
357
+ sampleViolations?: Array<Record<string, unknown>>;
358
+ }
359
+ declare class LeakageError extends TradewindsError {
360
+ static defaultErrorCode: string;
361
+ readonly asOf: string;
362
+ readonly violatingCount: number;
363
+ readonly sampleViolations: Array<Record<string, unknown>>;
364
+ constructor(message: string, options: LeakageErrorOptions);
365
+ protected payload(): Record<string, unknown>;
366
+ }
367
+ interface TemporalDriftErrorOptions extends TradewindsErrorOptions {
368
+ schemaId: string;
369
+ assertedRange: [string, string];
370
+ violatingRows: number;
371
+ sampleViolations?: Array<Record<string, unknown>>;
372
+ }
373
+ declare class TemporalDriftError extends TradewindsError {
374
+ static defaultErrorCode: string;
375
+ readonly schemaId: string;
376
+ readonly assertedRange: [string, string];
377
+ readonly violatingRows: number;
378
+ readonly sampleViolations: Array<Record<string, unknown>>;
379
+ constructor(message: string, options: TemporalDriftErrorOptions);
380
+ protected payload(): Record<string, unknown>;
381
+ }
382
+ interface PayloadTooLargeErrorOptions extends TradewindsErrorOptions {
383
+ declaredSize: number;
384
+ limit: number;
385
+ acceptedModes?: string[];
386
+ }
387
+ declare class PayloadTooLargeError extends TradewindsError {
388
+ static defaultErrorCode: string;
389
+ readonly declaredSize: number;
390
+ readonly limit: number;
391
+ readonly acceptedModes: string[];
392
+ constructor(message: string, options: PayloadTooLargeErrorOptions);
393
+ protected payload(): Record<string, unknown>;
394
+ }
395
+ declare class DeferredMarketError extends TradewindsError {
396
+ static defaultErrorCode: string;
397
+ }
398
+ declare class PolymarketEventError extends TradewindsError {
399
+ static defaultErrorCode: string;
400
+ }
401
+ interface TherminalErrorOptions extends TradewindsErrorOptions {
402
+ statusCode?: number | null;
403
+ retryAfter?: number | null;
404
+ }
405
+ /**
406
+ * Base HTTP-layer marker. Subclass of `TradewindsError` so callers that
407
+ * catch `TradewindsError` also catch transport errors.
408
+ */
409
+ declare class TherminalError extends TradewindsError {
410
+ static defaultErrorCode: string;
411
+ readonly statusCode: number | null;
412
+ constructor(message: string, options?: TherminalErrorOptions);
413
+ protected payload(): Record<string, unknown>;
414
+ }
415
+ declare class NotFoundError extends TherminalError {
416
+ static defaultErrorCode: string;
417
+ constructor(message?: string, options?: TherminalErrorOptions);
418
+ }
419
+ interface RateLimitErrorOptions extends TherminalErrorOptions {
420
+ retryAfter?: number | null;
421
+ }
422
+ declare class RateLimitError extends TherminalError {
423
+ static defaultErrorCode: string;
424
+ readonly retryAfter: number | null;
425
+ constructor(retryAfter?: number | null, options?: RateLimitErrorOptions);
426
+ protected payload(): Record<string, unknown>;
427
+ }
428
+ declare class ValidationError extends TherminalError {
429
+ static defaultErrorCode: string;
430
+ constructor(message?: string, options?: TherminalErrorOptions);
431
+ }
432
+ declare class AuthenticationError extends TherminalError {
433
+ static defaultErrorCode: string;
434
+ constructor(message?: string, options?: TherminalErrorOptions);
435
+ }
436
+ declare class ForbiddenError extends TherminalError {
437
+ static defaultErrorCode: string;
438
+ constructor(message?: string, options?: TherminalErrorOptions);
439
+ }
440
+ declare class ServerError extends TherminalError {
441
+ static defaultErrorCode: string;
442
+ constructor(message?: string, options?: TherminalErrorOptions);
443
+ }
444
+ /**
445
+ * Base class for `mostlyright.live.stream` / `live.latest` failures.
446
+ *
447
+ * Mirrors Python `LiveStreamError`. Live-streaming errors are a separate
448
+ * sub-tree from `SourceUnavailableError` because the recovery path differs —
449
+ * `stream()` swallows empty-tick errors and waits for the next polite-floor
450
+ * cycle. Only `latest()` raises `NoLiveDataError` on empty responses.
451
+ */
452
+ declare class LiveStreamError extends TradewindsError {
453
+ static defaultErrorCode: string;
454
+ }
455
+ interface NoLiveDataErrorOptions extends TradewindsErrorOptions {
456
+ station: string;
457
+ source: string;
458
+ }
459
+ /**
460
+ * `mostlyright.live.latest` returned no observations for the station.
461
+ *
462
+ * Carries the resolved ICAO `station` and the canonical source identity
463
+ * tag (`"awc.live"` / `"iem.live"`) so caller logs can branch by source
464
+ * without re-parsing the message.
465
+ */
466
+ declare class NoLiveDataError extends LiveStreamError {
467
+ static defaultErrorCode: string;
468
+ readonly station: string;
469
+ constructor(message: string | undefined, options: NoLiveDataErrorOptions);
470
+ protected payload(): Record<string, unknown>;
471
+ }
472
+
473
+ declare const _STATION_TZ: Readonly<Record<string, string>>;
474
+ /** Reference UTC moment in January (no DST in Northern Hemisphere US). */
475
+ declare const _JAN_REF: Date;
476
+ /** NWS CLI typical publication delay: 10 h after midnight LST. */
477
+ declare const _CLI_PUBLICATION_DELAY_HOURS = 10;
478
+ /** Kalshi market typical close time (LST). */
479
+ declare const _MARKET_CLOSE_HOUR_LST = 16;
480
+ declare const _MARKET_CLOSE_MINUTE_LST = 30;
481
+ /**
482
+ * Return the LOCAL STANDARD TIME UTC offset (in hours) for an IANA tz,
483
+ * sampled from January 15 2024 12:00 UTC so the result is never affected
484
+ * by DST in the Northern Hemisphere.
485
+ *
486
+ * Implementation: format `_JAN_REF` in the target tz via Intl.DateTimeFormat
487
+ * and diff against the UTC formatted view to recover the offset.
488
+ */
489
+ declare function _lstOffsetHours(stationTz: string): number;
490
+ /**
491
+ * Resolve a station code (NWS 3-letter, ICAO 4-letter) to an IANA tz string.
492
+ * Honors `tzOverride` first, then the built-in `_STATION_TZ` map.
493
+ * Throws if no tz can be resolved.
494
+ */
495
+ declare function _resolveStationTz(station: string, tzOverride?: string): string;
496
+ /**
497
+ * Return the Kalshi settlement date (YYYY-MM-DD LST) for a UTC moment.
498
+ *
499
+ * Kalshi NHIGH/NLOW contracts cover midnight–midnight LOCAL STANDARD TIME.
500
+ * DST is ignored: the window is always fixed to the standard UTC offset.
501
+ */
502
+ declare function settlementDateFor(asOf: Date | string, station: string, tzOverride?: string): string;
503
+ /**
504
+ * Return UTC start/end of the Kalshi settlement window for a date.
505
+ * The window is midnight-midnight LST, expressed in UTC.
506
+ */
507
+ declare function settlementWindowUtc(dateStr: string, station: string, tzOverride?: string): [Date, Date];
508
+ /**
509
+ * Return the UTC time at which the NWS CLI for a date is expected to be
510
+ * available. Default delay is 10 h after midnight LST on the next day.
511
+ */
512
+ declare function cliAvailableAt(dateStr: string, station: string, delayHours?: number, tzOverride?: string): Date;
513
+ /**
514
+ * Return the UTC time of the Kalshi market close for a settlement date.
515
+ * Kalshi NHIGH/NLOW markets close at 4:30 PM LST on the day of settlement.
516
+ */
517
+ declare function marketCloseUtc(dateStr: string, station: string, tzOverride?: string): Date;
518
+
519
+ interface FetchWithRetryOptions {
520
+ /** Base backoff delay in milliseconds (default 1000). */
521
+ baseDelayMs?: number;
522
+ /** Total attempts (default 3). */
523
+ maxRetries?: number;
524
+ /** Per-attempt timeout in milliseconds (default 60_000). */
525
+ timeoutMs?: number;
526
+ /** Statuses that trigger a retry. Default {429, 500, 502, 503, 504}. */
527
+ retryStatuses?: ReadonlySet<number>;
528
+ /** Caller-supplied abort signal (composed with per-attempt timeout). */
529
+ signal?: AbortSignal;
530
+ /** Request headers. */
531
+ headers?: Record<string, string>;
532
+ /** Convenience: set the User-Agent header. */
533
+ userAgent?: string;
534
+ /** HTTP method (default GET). */
535
+ method?: string;
536
+ /** Optional request body (forwarded to `fetch`). */
537
+ body?: BodyInit | null;
538
+ }
539
+ /**
540
+ * GET (or other) a URL with exponential-backoff retry semantics.
541
+ *
542
+ * Behaviour:
543
+ * - `signal` is composed with a per-attempt timeout via `AbortController`.
544
+ * - On retryable status (default: 429/500/502/503/504), wait
545
+ * `baseDelayMs * 2^attempt` (with ≤25% jitter) and retry, up to
546
+ * `maxRetries` total attempts.
547
+ * - On 404 → `NotFoundError`. On 400/401/403 → `ValidationError` /
548
+ * `AuthenticationError` / `ForbiddenError`. After retry exhaustion on
549
+ * 429 → `RateLimitError` (with `retryAfter` honoured). After retry
550
+ * exhaustion on 5xx → `ServerError`.
551
+ * - On network/transport failure: retried under the same budget, last
552
+ * error rethrown as a `TherminalError` if it isn't one already.
553
+ */
554
+ declare function fetchWithRetry(url: string, opts?: FetchWithRetryOptions): Promise<Response>;
555
+
556
+ declare const version = "0.0.0";
557
+ declare function helloCore(): string;
558
+
559
+ export { AuthenticationError, CLIMATE_REPORT_TYPE_PRIORITY, DeferredMarketError, type FetchWithRetryOptions, ForbiddenError, type ForecastIemMosV1, LIVE_V1_POLICY, LeakageError, type LeakageErrorOptions, LiveStreamError, NoLiveDataError, type NoLiveDataErrorOptions, NotFoundError, OBSERVATION_SOURCE_PRIORITY, type ObservationLedgerV1, type ObservationQcV1, type ObservationV1, PayloadTooLargeError, type PayloadTooLargeErrorOptions, PolymarketEventError, QC_ALPHA_RULES, QC_ALPHA_RULES_BY_ID, type QcAlphaRule, RateLimitError, type RateLimitErrorOptions, STATIONS, STATION_BY_CODE, STATION_BY_ICAO, SchemaValidationError, type SchemaValidationErrorOptions, ServerError, type SettlementCliV1, SourceMismatchError, type SourceMismatchErrorOptions, type SourceMismatchRole, SourceUnavailableError, type SourceUnavailableErrorOptions, type StationInfo, TemporalDriftError, type TemporalDriftErrorOptions, TherminalError, type TherminalErrorOptions, TradewindsError, type TradewindsErrorOptions, ValidationError, _CLI_PUBLICATION_DELAY_HOURS, _JAN_REF, _MARKET_CLOSE_HOUR_LST, _MARKET_CLOSE_MINUTE_LST, _STATION_TZ, _lstOffsetHours, _resolveStationTz, cliAvailableAt, fetchWithRetry, helloCore, marketCloseUtc, settlementDateFor, settlementWindowUtc, toJsonSafe, version };