@uwmd/core 1.1.2 → 1.5.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 (164) hide show
  1. package/README.md +3 -3
  2. package/dist/agents/bancroft.d.ts +22 -1
  3. package/dist/agents/bancroft.d.ts.map +1 -1
  4. package/dist/agents/bancroft.js +86 -60
  5. package/dist/agents/bancroft.js.map +1 -1
  6. package/dist/agents/provider.d.ts +62 -0
  7. package/dist/agents/provider.d.ts.map +1 -0
  8. package/dist/agents/provider.js +28 -0
  9. package/dist/agents/provider.js.map +1 -0
  10. package/dist/agents/providers/anthropic.d.ts +20 -0
  11. package/dist/agents/providers/anthropic.d.ts.map +1 -0
  12. package/dist/agents/providers/anthropic.js +104 -0
  13. package/dist/agents/providers/anthropic.js.map +1 -0
  14. package/dist/agents/providers/replay.d.ts +46 -0
  15. package/dist/agents/providers/replay.d.ts.map +1 -0
  16. package/dist/agents/providers/replay.js +162 -0
  17. package/dist/agents/providers/replay.js.map +1 -0
  18. package/dist/agents/schemas.d.ts +3 -3
  19. package/dist/agents/schemas.d.ts.map +1 -1
  20. package/dist/agents/schemas.js.map +1 -1
  21. package/dist/browser.d.ts +33 -4
  22. package/dist/browser.d.ts.map +1 -1
  23. package/dist/browser.js +26 -3
  24. package/dist/browser.js.map +1 -1
  25. package/dist/calc/builtins.d.ts +10 -0
  26. package/dist/calc/builtins.d.ts.map +1 -1
  27. package/dist/calc/builtins.js +64 -42
  28. package/dist/calc/builtins.js.map +1 -1
  29. package/dist/calc/errors.js +1 -1
  30. package/dist/calc/evaluator.js +6 -2
  31. package/dist/calc/evaluator.js.map +1 -1
  32. package/dist/calc/index.d.ts +7 -0
  33. package/dist/calc/index.d.ts.map +1 -1
  34. package/dist/calc/index.js +13 -1
  35. package/dist/calc/index.js.map +1 -1
  36. package/dist/calc/quantize.d.ts +56 -0
  37. package/dist/calc/quantize.d.ts.map +1 -0
  38. package/dist/calc/quantize.js +116 -0
  39. package/dist/calc/quantize.js.map +1 -0
  40. package/dist/cascade.d.ts +60 -6
  41. package/dist/cascade.d.ts.map +1 -1
  42. package/dist/cascade.js +93 -14
  43. package/dist/cascade.js.map +1 -1
  44. package/dist/cli-packages.d.ts +11 -0
  45. package/dist/cli-packages.d.ts.map +1 -0
  46. package/dist/cli-packages.js +177 -0
  47. package/dist/cli-packages.js.map +1 -0
  48. package/dist/cli.js +691 -37
  49. package/dist/cli.js.map +1 -1
  50. package/dist/composition.d.ts +182 -0
  51. package/dist/composition.d.ts.map +1 -0
  52. package/dist/composition.js +536 -0
  53. package/dist/composition.js.map +1 -0
  54. package/dist/deal-package-context.d.ts +52 -0
  55. package/dist/deal-package-context.d.ts.map +1 -0
  56. package/dist/deal-package-context.js +132 -0
  57. package/dist/deal-package-context.js.map +1 -0
  58. package/dist/deal-package-zip.d.ts +36 -0
  59. package/dist/deal-package-zip.d.ts.map +1 -0
  60. package/dist/deal-package-zip.js +132 -0
  61. package/dist/deal-package-zip.js.map +1 -0
  62. package/dist/deal-package.d.ts +82 -0
  63. package/dist/deal-package.d.ts.map +1 -0
  64. package/dist/deal-package.js +189 -0
  65. package/dist/deal-package.js.map +1 -0
  66. package/dist/defaults.d.ts +48 -0
  67. package/dist/defaults.d.ts.map +1 -1
  68. package/dist/defaults.js +512 -0
  69. package/dist/defaults.js.map +1 -1
  70. package/dist/index.d.ts +39 -4
  71. package/dist/index.d.ts.map +1 -1
  72. package/dist/index.js +30 -3
  73. package/dist/index.js.map +1 -1
  74. package/dist/init.js +1 -1
  75. package/dist/init.js.map +1 -1
  76. package/dist/integrity.d.ts +9 -0
  77. package/dist/integrity.d.ts.map +1 -1
  78. package/dist/integrity.js +12 -2
  79. package/dist/integrity.js.map +1 -1
  80. package/dist/lease-abstract.d.ts +82 -0
  81. package/dist/lease-abstract.d.ts.map +1 -0
  82. package/dist/lease-abstract.js +183 -0
  83. package/dist/lease-abstract.js.map +1 -0
  84. package/dist/lite-bridge.d.ts +67 -0
  85. package/dist/lite-bridge.d.ts.map +1 -0
  86. package/dist/lite-bridge.js +564 -0
  87. package/dist/lite-bridge.js.map +1 -0
  88. package/dist/lite.d.ts +63 -0
  89. package/dist/lite.d.ts.map +1 -0
  90. package/dist/lite.js +398 -0
  91. package/dist/lite.js.map +1 -0
  92. package/dist/market-data.d.ts +134 -0
  93. package/dist/market-data.d.ts.map +1 -0
  94. package/dist/market-data.js +292 -0
  95. package/dist/market-data.js.map +1 -0
  96. package/dist/modules.d.ts.map +1 -1
  97. package/dist/modules.js +278 -13
  98. package/dist/modules.js.map +1 -1
  99. package/dist/packs/excel-emit.d.ts +18 -1
  100. package/dist/packs/excel-emit.d.ts.map +1 -1
  101. package/dist/packs/excel-emit.js +18 -1
  102. package/dist/packs/excel-emit.js.map +1 -1
  103. package/dist/packs/hospitality.d.ts +3 -0
  104. package/dist/packs/hospitality.d.ts.map +1 -0
  105. package/dist/packs/hospitality.js +122 -0
  106. package/dist/packs/hospitality.js.map +1 -0
  107. package/dist/packs/index.d.ts +5 -1
  108. package/dist/packs/index.d.ts.map +1 -1
  109. package/dist/packs/index.js +13 -1
  110. package/dist/packs/index.js.map +1 -1
  111. package/dist/packs/land.d.ts +3 -0
  112. package/dist/packs/land.d.ts.map +1 -0
  113. package/dist/packs/land.js +124 -0
  114. package/dist/packs/land.js.map +1 -0
  115. package/dist/packs/senior-housing.d.ts +3 -0
  116. package/dist/packs/senior-housing.d.ts.map +1 -0
  117. package/dist/packs/senior-housing.js +123 -0
  118. package/dist/packs/senior-housing.js.map +1 -0
  119. package/dist/packs/student-housing.d.ts +3 -0
  120. package/dist/packs/student-housing.d.ts.map +1 -0
  121. package/dist/packs/student-housing.js +124 -0
  122. package/dist/packs/student-housing.js.map +1 -0
  123. package/dist/parser.d.ts +9 -0
  124. package/dist/parser.d.ts.map +1 -1
  125. package/dist/parser.js +40 -6
  126. package/dist/parser.js.map +1 -1
  127. package/dist/protocol.d.ts +125 -9
  128. package/dist/protocol.d.ts.map +1 -1
  129. package/dist/protocol.js +182 -4
  130. package/dist/protocol.js.map +1 -1
  131. package/dist/receipts.d.ts +396 -0
  132. package/dist/receipts.d.ts.map +1 -0
  133. package/dist/receipts.js +913 -0
  134. package/dist/receipts.js.map +1 -0
  135. package/dist/runner.d.ts +13 -0
  136. package/dist/runner.d.ts.map +1 -1
  137. package/dist/runner.js +5 -5
  138. package/dist/runner.js.map +1 -1
  139. package/dist/source-representation.d.ts +40 -0
  140. package/dist/source-representation.d.ts.map +1 -0
  141. package/dist/source-representation.js +114 -0
  142. package/dist/source-representation.js.map +1 -0
  143. package/dist/types.d.ts +63 -1
  144. package/dist/types.d.ts.map +1 -1
  145. package/dist/types.js +34 -0
  146. package/dist/types.js.map +1 -1
  147. package/dist/uwcsv.d.ts.map +1 -1
  148. package/dist/uwcsv.js +10 -78
  149. package/dist/uwcsv.js.map +1 -1
  150. package/dist/uwxml.d.ts.map +1 -1
  151. package/dist/uwxml.js +10 -2
  152. package/dist/uwxml.js.map +1 -1
  153. package/dist/validator.d.ts.map +1 -1
  154. package/dist/validator.js +27 -10
  155. package/dist/validator.js.map +1 -1
  156. package/dist/version.d.ts +3 -0
  157. package/dist/version.d.ts.map +1 -0
  158. package/dist/version.js +8 -0
  159. package/dist/version.js.map +1 -0
  160. package/dist/zip-safety.d.ts +15 -0
  161. package/dist/zip-safety.d.ts.map +1 -0
  162. package/dist/zip-safety.js +109 -0
  163. package/dist/zip-safety.js.map +1 -0
  164. package/package.json +12 -3
@@ -0,0 +1,134 @@
1
+ import type { MarketDataLookup } from './cascade.js';
2
+ import { type ProtocolError } from './protocol.js';
3
+ import type { ConfidenceLevel, MarketDataRef, ParsedUWFile } from './types.js';
4
+ export declare const MARKET_DATA_PROFILE_ID: "market-data-v1";
5
+ /** The section a market-data document carries its observations in. */
6
+ export declare const MARKET_OBSERVATIONS_SECTION: "market_observations";
7
+ export interface MarketObservationRange {
8
+ low: number;
9
+ central: number;
10
+ high: number;
11
+ }
12
+ export interface MarketObservation {
13
+ /** A path a deal record could carry, e.g. `valuation.going_in_cap_rate`. */
14
+ field_path: string;
15
+ value: unknown;
16
+ unit: string;
17
+ range?: MarketObservationRange;
18
+ /** What the observation rests on — sample size, method. Required, non-empty. */
19
+ basis: string;
20
+ confidence?: ConfidenceLevel;
21
+ [key: string]: unknown;
22
+ }
23
+ export interface MarketDataDocument {
24
+ document_id: string;
25
+ /** ISO `YYYY-MM-DD`. The observation set's vintage, not the file's mtime. */
26
+ as_of: string;
27
+ provider: string;
28
+ geo: string;
29
+ /** Optional: an observation set may span asset classes. */
30
+ asset_class?: string;
31
+ observations: MarketObservation[];
32
+ }
33
+ export declare class MarketDataError extends Error {
34
+ readonly code: string;
35
+ constructor(code: string, message: string);
36
+ }
37
+ export declare function isValidAsOf(value: string): boolean;
38
+ /**
39
+ * A field path is `<section>.<rest>`, where `<section>` is registered by
40
+ * FORMAT_SPEC Part IV or is an `x_` extension section (§ 4.21). The bare
41
+ * section id with no `rest` is rejected: an observation about an entire section
42
+ * is not a value a deal record could carry at a path.
43
+ */
44
+ export declare function isDealFieldPath(path: string): boolean;
45
+ /**
46
+ * Validate a market-data document, returning every problem rather than the
47
+ * first. Returns `[]` when the candidate conforms.
48
+ */
49
+ export declare function validateMarketDataDocument(candidate: unknown): ProtocolError[];
50
+ /**
51
+ * Read a market-data document out of a parsed UW file, refusing rather than
52
+ * repairing. Throws `MarketDataError` naming the first problem.
53
+ */
54
+ export declare function parseMarketDataDocument(parsed: ParsedUWFile): MarketDataDocument;
55
+ export interface DocumentMarketDataOptions {
56
+ /** Clock for the staleness check. Injectable so tests are not time-dependent. */
57
+ now?: Date;
58
+ /**
59
+ * How long an observation remains usable, from `as_of`. Defaults to 90 days,
60
+ * a quarter — the cadence most published market series actually move at.
61
+ */
62
+ staleness_seconds?: number;
63
+ /**
64
+ * Geography this deal sits in. When set, an observation set for a different
65
+ * `geo` does not resolve. Matching is exact; normalizing place names is a
66
+ * judgment call this module deliberately declines to make.
67
+ */
68
+ geo?: string;
69
+ }
70
+ /** 90 days. */
71
+ export declare const DEFAULT_MARKET_DATA_STALENESS_SECONDS: number;
72
+ /**
73
+ * Wrap a market-data document as a `MarketDataLookup`, so it drops into the
74
+ * existing cascade with no change to `resolveValue`.
75
+ *
76
+ * Staleness is measured from the document's `as_of`, not from a wall-clock
77
+ * guess about when the file was written. A stale observation resolves to
78
+ * `null`, so the cascade falls through to `asset_class_default` — the value is
79
+ * not silently used past its vintage.
80
+ */
81
+ export declare function createDocumentMarketData(doc: MarketDataDocument, opts?: DocumentMarketDataOptions): MarketDataLookup;
82
+ export interface PromoteObservationOptions {
83
+ /** The observation set being accepted from. */
84
+ document: MarketDataDocument;
85
+ /** Which observation. Must exist in the set. */
86
+ field_path: string;
87
+ /** Digest of the observation set, `sha256:<64 lowercase hex>`. */
88
+ digest: string;
89
+ /** Why this was accepted as the underwritten value. */
90
+ rationale?: string;
91
+ }
92
+ export interface PromotedObservation {
93
+ /** Section the value belongs in, e.g. `valuation`. */
94
+ section: string;
95
+ /** Path relative to the section root, e.g. `going_in_cap_rate`. */
96
+ field: string;
97
+ value: unknown;
98
+ unit: string;
99
+ /** Always `market_data_accepted` — never `user_input`. */
100
+ source: 'market_data_accepted';
101
+ /**
102
+ * The observation's confidence, carried through unchanged. Promotion does not
103
+ * upgrade it: accepting a `low`-confidence observation for lack of better
104
+ * evidence leaves it low-confidence evidence.
105
+ */
106
+ confidence?: ConfidenceLevel;
107
+ market_data_ref: MarketDataRef;
108
+ }
109
+ /**
110
+ * Build the value and provenance for promoting one observation to an input of
111
+ * record.
112
+ *
113
+ * This deliberately returns a payload rather than editing a document. Promotion
114
+ * is an explicit Tier-2 edit by a named actor, never automatic and never a side
115
+ * effect of resolution — so the host applies it through `applyEdit` with its own
116
+ * actor and timestamp, and this function cannot promote anything by itself.
117
+ *
118
+ * The result is always tagged `market_data_accepted`, never `user_input`. That
119
+ * is the crux of §4: a value accepted for lack of better evidence and a value
120
+ * established by diligence are different claims, and a file that renders them
121
+ * identically has destroyed something a credit reviewer needs.
122
+ */
123
+ export declare function promoteMarketObservation(opts: PromoteObservationOptions): PromotedObservation;
124
+ /**
125
+ * Pick the observation set to use when several are in scope: the most recent
126
+ * `as_of` wins.
127
+ *
128
+ * A tie is an error rather than a silent pick, on the same reasoning as RFC
129
+ * 0021's ambiguous-inheritance rule — two same-dated sets from different
130
+ * providers genuinely disagree about which is authoritative, and choosing by
131
+ * array order would make the answer depend on directory listing.
132
+ */
133
+ export declare function selectCurrentMarketData(docs: readonly MarketDataDocument[]): MarketDataDocument;
134
+ //# sourceMappingURL=market-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"market-data.d.ts","sourceRoot":"","sources":["../src/market-data.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/E,eAAO,MAAM,sBAAsB,kBAAsB,CAAC;AAE1D,sEAAsE;AACtE,eAAO,MAAM,2BAA2B,EAAG,qBAA8B,CAAC;AAE1E,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAiB;IAChC,4EAA4E;IAC5E,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,sBAAsB,CAAC;IAC/B,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAC;I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AAmB;IAClC,sDAAsD;IACtD,OAAO,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,MAAM,EAAE,sBAAsB,CAAC;IAC/B;;;;OAIG;IACH,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,eAAe,EAAE,aAAa,CAAC;CAChC;AAID;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,yBAAyB,GAAG,mBAAmB,CAiC7F;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,SAAS,kBAAkB,EAAE,GAAG,kBAAkB,CAsB/F"}
@@ -0,0 +1,292 @@
1
+ // `market-data-v1` document profile (RFC 0022).
2
+ //
3
+ // A market-data document carries dated, attributable *observations* — not
4
+ // conclusions. It has no `deal_id`, contains no calculations, and no pack
5
+ // applies to it. Making an external number attributable is the entire point;
6
+ // this module does not make it true.
7
+ //
8
+ // Two rules carry the profile's weight, and both are refusals rather than
9
+ // warnings:
10
+ //
11
+ // 1. `document_id`, `as_of`, `provider`, and `geo` are required. An
12
+ // observation set with no as-of date or no named provider is not
13
+ // attributable, and storing it with those fields blank would leave a
14
+ // number in the file that nothing can ever trace.
15
+ // 2. Every observation states a `basis`. A number with no stated basis is an
16
+ // assertion, and this profile is for observations.
17
+ //
18
+ // Browser-safe: no network access of any kind. Resolution reads a parsed
19
+ // document, never a vendor API — a host querying a live warehouse implements
20
+ // `MarketDataLookup` directly and snapshots to a document when it needs a
21
+ // receipt.
22
+ import { EXTENSION_SECTION_PREFIX, isStandardSectionId, MARKET_DATA_PROFILE, } from './protocol.js';
23
+ export const MARKET_DATA_PROFILE_ID = MARKET_DATA_PROFILE;
24
+ /** The section a market-data document carries its observations in. */
25
+ export const MARKET_OBSERVATIONS_SECTION = 'market_observations';
26
+ export class MarketDataError extends Error {
27
+ code;
28
+ constructor(code, message) {
29
+ super(`[${code}] ${message}`);
30
+ this.name = 'MarketDataError';
31
+ this.code = code;
32
+ }
33
+ }
34
+ function mdError(code, message, pointer) {
35
+ return { category: 'validate', code, message, ...(pointer ? { pointer } : {}) };
36
+ }
37
+ function isRecord(v) {
38
+ return typeof v === 'object' && v !== null && !Array.isArray(v);
39
+ }
40
+ function nonEmptyString(v) {
41
+ return typeof v === 'string' && v.trim() !== '';
42
+ }
43
+ /**
44
+ * `YYYY-MM-DD`, and a real calendar date. The round-trip check rejects
45
+ * `2026-02-30`, which `Date.parse` would otherwise roll forward to March 2 —
46
+ * silently dating an observation set to a day that does not exist.
47
+ */
48
+ const AS_OF_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
49
+ export function isValidAsOf(value) {
50
+ if (!AS_OF_PATTERN.test(value))
51
+ return false;
52
+ const date = new Date(`${value}T00:00:00Z`);
53
+ if (Number.isNaN(date.getTime()))
54
+ return false;
55
+ return date.toISOString().slice(0, 10) === value;
56
+ }
57
+ /**
58
+ * A field path is `<section>.<rest>`, where `<section>` is registered by
59
+ * FORMAT_SPEC Part IV or is an `x_` extension section (§ 4.21). The bare
60
+ * section id with no `rest` is rejected: an observation about an entire section
61
+ * is not a value a deal record could carry at a path.
62
+ */
63
+ export function isDealFieldPath(path) {
64
+ const dot = path.indexOf('.');
65
+ if (dot <= 0 || dot === path.length - 1)
66
+ return false;
67
+ const section = path.slice(0, dot);
68
+ const rest = path.slice(dot + 1);
69
+ if (rest.trim() === '')
70
+ return false;
71
+ return isStandardSectionId(section) || section.startsWith(EXTENSION_SECTION_PREFIX);
72
+ }
73
+ /**
74
+ * Validate a market-data document, returning every problem rather than the
75
+ * first. Returns `[]` when the candidate conforms.
76
+ */
77
+ export function validateMarketDataDocument(candidate) {
78
+ const errors = [];
79
+ if (!isRecord(candidate)) {
80
+ return [mdError('MD-001', 'Market-data document must be an object.')];
81
+ }
82
+ const doc = candidate;
83
+ for (const key of ['document_id', 'provider', 'geo']) {
84
+ if (!nonEmptyString(doc[key])) {
85
+ errors.push(mdError('MD-002', `${key} is required and must be a non-empty string.`, key));
86
+ }
87
+ }
88
+ if (!nonEmptyString(doc.as_of)) {
89
+ errors.push(mdError('MD-003', 'as_of is required — an observation set with no vintage is not attributable.', 'as_of'));
90
+ }
91
+ else if (!isValidAsOf(doc.as_of)) {
92
+ errors.push(mdError('MD-004', `as_of must be a real calendar date as YYYY-MM-DD; got '${doc.as_of}'.`, 'as_of'));
93
+ }
94
+ // A market-data document is not an underwriting record, and the cheapest way
95
+ // for it to be misread as one is to carry a deal_id.
96
+ if ('deal_id' in doc) {
97
+ errors.push(mdError('MD-005', 'A market-data document MUST NOT carry deal_id — it is not an underwriting record.', 'deal_id'));
98
+ }
99
+ if (!Array.isArray(doc.observations)) {
100
+ errors.push(mdError('MD-006', 'observations must be an array.', 'observations'));
101
+ return errors;
102
+ }
103
+ if (doc.observations.length === 0) {
104
+ errors.push(mdError('MD-007', 'observations must not be empty.', 'observations'));
105
+ }
106
+ const seen = new Set();
107
+ doc.observations.forEach((raw, i) => {
108
+ const at = `observations[${i}]`;
109
+ if (!isRecord(raw)) {
110
+ errors.push(mdError('MD-008', 'Observation must be an object.', at));
111
+ return;
112
+ }
113
+ const obs = raw;
114
+ if (!nonEmptyString(obs.field_path)) {
115
+ errors.push(mdError('MD-009', 'field_path is required.', `${at}.field_path`));
116
+ }
117
+ else if (!isDealFieldPath(obs.field_path)) {
118
+ errors.push(mdError('MD-010', `field_path '${obs.field_path}' is not a path a deal record could carry. It must be <section>.<field> where the section is registered by FORMAT_SPEC Part IV or is an x_ extension section.`, `${at}.field_path`));
119
+ }
120
+ else if (seen.has(obs.field_path)) {
121
+ // Two observations for one path make resolution order-dependent, which is
122
+ // the one thing a deterministic resolver must never be.
123
+ errors.push(mdError('MD-011', `Duplicate observation for field_path '${obs.field_path}'.`, `${at}.field_path`));
124
+ }
125
+ else {
126
+ seen.add(obs.field_path);
127
+ }
128
+ if (!('value' in obs)) {
129
+ errors.push(mdError('MD-012', 'value is required.', `${at}.value`));
130
+ }
131
+ if (!nonEmptyString(obs.unit)) {
132
+ errors.push(mdError('MD-013', 'unit is required.', `${at}.unit`));
133
+ }
134
+ if (!nonEmptyString(obs.basis)) {
135
+ errors.push(mdError('MD-014', 'basis is required and must not be empty — a number with no stated basis is an assertion, not an observation.', `${at}.basis`));
136
+ }
137
+ if (obs.range !== undefined) {
138
+ const r = obs.range;
139
+ if (!isRecord(r) || !['low', 'central', 'high'].every((k) => typeof r[k] === 'number')) {
140
+ errors.push(mdError('MD-015', 'range must carry numeric low, central, and high.', `${at}.range`));
141
+ }
142
+ else if (!(r.low <= r.central && r.central <= r.high)) {
143
+ errors.push(mdError('MD-016', `range must satisfy low <= central <= high; got ${r.low}, ${r.central}, ${r.high}.`, `${at}.range`));
144
+ }
145
+ }
146
+ });
147
+ return errors;
148
+ }
149
+ /**
150
+ * Read a market-data document out of a parsed UW file, refusing rather than
151
+ * repairing. Throws `MarketDataError` naming the first problem.
152
+ */
153
+ export function parseMarketDataDocument(parsed) {
154
+ const frontmatter = parsed.frontmatter;
155
+ const profile = frontmatter.document_profile;
156
+ if (profile !== MARKET_DATA_PROFILE_ID) {
157
+ throw new MarketDataError('MD-017', `Expected document_profile '${MARKET_DATA_PROFILE_ID}'; got ${profile === undefined ? 'none' : `'${String(profile)}'`}.`);
158
+ }
159
+ const entry = parsed.sections[MARKET_OBSERVATIONS_SECTION];
160
+ if (!entry) {
161
+ throw new MarketDataError('MD-018', `A market-data document must carry a '${MARKET_OBSERVATIONS_SECTION}' section.`);
162
+ }
163
+ const block = 'annotation' in entry
164
+ ? entry
165
+ : Object.values(entry)[0];
166
+ const content = block.content;
167
+ const candidate = {
168
+ document_id: frontmatter.document_id,
169
+ as_of: frontmatter.as_of,
170
+ provider: frontmatter.provider,
171
+ geo: frontmatter.geo,
172
+ ...(frontmatter.asset_class !== undefined ? { asset_class: frontmatter.asset_class } : {}),
173
+ ...('deal_id' in frontmatter ? { deal_id: frontmatter.deal_id } : {}),
174
+ observations: content?.observations,
175
+ };
176
+ const errors = validateMarketDataDocument(candidate);
177
+ if (errors.length > 0) {
178
+ throw new MarketDataError(errors[0].code, errors.map((e) => e.message).join('; '));
179
+ }
180
+ return candidate;
181
+ }
182
+ /** 90 days. */
183
+ export const DEFAULT_MARKET_DATA_STALENESS_SECONDS = 90 * 24 * 60 * 60;
184
+ /**
185
+ * Wrap a market-data document as a `MarketDataLookup`, so it drops into the
186
+ * existing cascade with no change to `resolveValue`.
187
+ *
188
+ * Staleness is measured from the document's `as_of`, not from a wall-clock
189
+ * guess about when the file was written. A stale observation resolves to
190
+ * `null`, so the cascade falls through to `asset_class_default` — the value is
191
+ * not silently used past its vintage.
192
+ */
193
+ export function createDocumentMarketData(doc, opts = {}) {
194
+ const staleness = opts.staleness_seconds ?? DEFAULT_MARKET_DATA_STALENESS_SECONDS;
195
+ const byPath = new Map(doc.observations.map((o) => [o.field_path, o]));
196
+ return {
197
+ staleness_seconds: staleness,
198
+ resolve(field_path, context) {
199
+ if (doc.asset_class !== undefined && doc.asset_class !== context.asset_class)
200
+ return null;
201
+ // `context.geo` is the caller's; `opts.geo` lets a host pin one without
202
+ // threading it through every cascade call. Either mismatching is a miss.
203
+ const wantedGeo = context.geo ?? opts.geo;
204
+ if (wantedGeo !== undefined && wantedGeo !== doc.geo)
205
+ return null;
206
+ const observation = byPath.get(field_path);
207
+ if (!observation)
208
+ return null;
209
+ const now = opts.now ?? new Date();
210
+ const asOfMs = new Date(`${doc.as_of}T00:00:00Z`).getTime();
211
+ const ageSeconds = (now.getTime() - asOfMs) / 1000;
212
+ if (ageSeconds > staleness)
213
+ return null;
214
+ return {
215
+ value: observation.value,
216
+ ...(observation.range ? { range: observation.range } : {}),
217
+ source_id: doc.document_id,
218
+ };
219
+ },
220
+ };
221
+ }
222
+ const DIGEST_PATTERN = /^sha256:[0-9a-f]{64}$/;
223
+ /**
224
+ * Build the value and provenance for promoting one observation to an input of
225
+ * record.
226
+ *
227
+ * This deliberately returns a payload rather than editing a document. Promotion
228
+ * is an explicit Tier-2 edit by a named actor, never automatic and never a side
229
+ * effect of resolution — so the host applies it through `applyEdit` with its own
230
+ * actor and timestamp, and this function cannot promote anything by itself.
231
+ *
232
+ * The result is always tagged `market_data_accepted`, never `user_input`. That
233
+ * is the crux of §4: a value accepted for lack of better evidence and a value
234
+ * established by diligence are different claims, and a file that renders them
235
+ * identically has destroyed something a credit reviewer needs.
236
+ */
237
+ export function promoteMarketObservation(opts) {
238
+ const { document, field_path, digest, rationale } = opts;
239
+ if (!DIGEST_PATTERN.test(digest)) {
240
+ throw new MarketDataError('MD-021', `Promotion requires the observation set's digest as 'sha256:<64 lowercase hex>'; got '${digest}'.`);
241
+ }
242
+ const observation = document.observations.find((o) => o.field_path === field_path);
243
+ if (!observation) {
244
+ throw new MarketDataError('MD-022', `Observation set '${document.document_id}' carries no observation for '${field_path}'.`);
245
+ }
246
+ const dot = field_path.indexOf('.');
247
+ return {
248
+ section: field_path.slice(0, dot),
249
+ field: field_path.slice(dot + 1),
250
+ value: observation.value,
251
+ unit: observation.unit,
252
+ source: 'market_data_accepted',
253
+ ...(observation.confidence ? { confidence: observation.confidence } : {}),
254
+ market_data_ref: {
255
+ document_id: document.document_id,
256
+ as_of: document.as_of,
257
+ digest,
258
+ ...(rationale ? { rationale } : {}),
259
+ },
260
+ };
261
+ }
262
+ /**
263
+ * Pick the observation set to use when several are in scope: the most recent
264
+ * `as_of` wins.
265
+ *
266
+ * A tie is an error rather than a silent pick, on the same reasoning as RFC
267
+ * 0021's ambiguous-inheritance rule — two same-dated sets from different
268
+ * providers genuinely disagree about which is authoritative, and choosing by
269
+ * array order would make the answer depend on directory listing.
270
+ */
271
+ export function selectCurrentMarketData(docs) {
272
+ if (docs.length === 0) {
273
+ throw new MarketDataError('MD-019', 'No market-data documents to select from.');
274
+ }
275
+ let best = docs[0];
276
+ let tied = [];
277
+ for (const doc of docs.slice(1)) {
278
+ if (doc.as_of > best.as_of) {
279
+ best = doc;
280
+ tied = [];
281
+ }
282
+ else if (doc.as_of === best.as_of && doc.document_id !== best.document_id) {
283
+ tied.push(doc);
284
+ }
285
+ }
286
+ if (tied.length > 0) {
287
+ const ids = [best, ...tied].map((d) => d.document_id).sort().join(', ');
288
+ throw new MarketDataError('MD-020', `Ambiguous market data: ${tied.length + 1} documents share as_of '${best.as_of}' (${ids}). Resolve which is authoritative rather than letting order decide.`);
289
+ }
290
+ return best;
291
+ }
292
+ //# sourceMappingURL=market-data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"market-data.js","sourceRoot":"","sources":["../src/market-data.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,EAAE;AACF,0EAA0E;AAC1E,0EAA0E;AAC1E,6EAA6E;AAC7E,qCAAqC;AACrC,EAAE;AACF,0EAA0E;AAC1E,YAAY;AACZ,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,0EAA0E;AAC1E,uDAAuD;AACvD,+EAA+E;AAC/E,wDAAwD;AACxD,EAAE;AACF,yEAAyE;AACzE,6EAA6E;AAC7E,0EAA0E;AAC1E,WAAW;AAGX,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,GAEpB,MAAM,eAAe,CAAC;AAGvB,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAE1D,sEAAsE;AACtE,MAAM,CAAC,MAAM,2BAA2B,GAAG,qBAA8B,CAAC;AA+B1E,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAC/B,IAAI,CAAS;IACtB,YAAY,IAAY,EAAE,OAAe;QACvC,KAAK,CAAC,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,SAAS,OAAO,CAAC,IAAY,EAAE,OAAe,EAAE,OAAgB;IAC9D,O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