@mailwoman/resolver 9.2.0 → 9.3.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 (143) hide show
  1. package/README.md +5 -5
  2. package/{admin-coherence-passes.ts → lib/admin/coherence-passes.ts} +8 -8
  3. package/{admin-containment.ts → lib/admin/containment.ts} +5 -14
  4. package/lib/admin/index.ts +10 -0
  5. package/lib/admin/jp-municipality.ts +97 -0
  6. package/{admin-winner.ts → lib/admin/winner.ts} +13 -2
  7. package/{backend-capabilities.ts → lib/backend-capabilities.ts} +3 -3
  8. package/{bare-toponym-race.ts → lib/bare-toponym-race.ts} +1 -1
  9. package/{decorate-node.ts → lib/decorate-node.ts} +2 -2
  10. package/{fold-name.ts → lib/fold-name.ts} +2 -2
  11. package/{index.ts → lib/index.ts} +16 -21
  12. package/{plausibility.ts → lib/plausibility.ts} +5 -4
  13. package/{postcode-country-coherence.ts → lib/postcode/country-coherence.ts} +27 -32
  14. package/lib/postcode/index.ts +9 -0
  15. package/{postcode-prefix.ts → lib/postcode/prefix.ts} +4 -4
  16. package/{postcode-shape-coherence.ts → lib/postcode/shape-coherence.ts} +10 -24
  17. package/{remote-resolver.ts → lib/remote-resolver.ts} +13 -4
  18. package/{rerank.ts → lib/rerank.ts} +2 -2
  19. package/{resolve.ts → lib/resolve/index.ts} +120 -602
  20. package/lib/resolve/passes.ts +544 -0
  21. package/{span-rescore.ts → lib/span-rescore.ts} +63 -97
  22. package/{street-evidence.ts → lib/street/evidence.ts} +39 -6
  23. package/lib/street/index.ts +8 -0
  24. package/{street-tier.ts → lib/street/tier.ts} +125 -110
  25. package/{toponym-prior.ts → lib/toponym-prior.ts} +8 -8
  26. package/out/{admin-coherence-passes.d.ts → admin/coherence-passes.d.ts} +6 -6
  27. package/out/admin/coherence-passes.d.ts.map +1 -0
  28. package/out/{admin-coherence-passes.js → admin/coherence-passes.js} +9 -9
  29. package/out/admin/coherence-passes.js.map +1 -0
  30. package/out/{admin-containment.d.ts → admin/containment.d.ts} +5 -5
  31. package/out/admin/containment.d.ts.map +1 -0
  32. package/out/{admin-containment.js → admin/containment.js} +6 -12
  33. package/out/admin/containment.js.map +1 -0
  34. package/out/admin/index.d.ts +10 -0
  35. package/out/admin/index.d.ts.map +1 -0
  36. package/out/admin/index.js +10 -0
  37. package/out/admin/index.js.map +1 -0
  38. package/out/admin/jp-municipality.d.ts +50 -0
  39. package/out/admin/jp-municipality.d.ts.map +1 -0
  40. package/out/admin/jp-municipality.js +54 -0
  41. package/out/admin/jp-municipality.js.map +1 -0
  42. package/out/{admin-winner.d.ts → admin/winner.d.ts} +8 -3
  43. package/out/admin/winner.d.ts.map +1 -0
  44. package/out/{admin-winner.js → admin/winner.js} +14 -3
  45. package/out/admin/winner.js.map +1 -0
  46. package/out/backend-capabilities.d.ts.map +1 -1
  47. package/out/backend-capabilities.js +3 -3
  48. package/out/backend-capabilities.js.map +1 -1
  49. package/out/bare-toponym-race.d.ts.map +1 -1
  50. package/out/bare-toponym-race.js +1 -1
  51. package/out/bare-toponym-race.js.map +1 -1
  52. package/out/decorate-node.d.ts +1 -1
  53. package/out/decorate-node.d.ts.map +1 -1
  54. package/out/decorate-node.js +1 -1
  55. package/out/decorate-node.js.map +1 -1
  56. package/out/fold-name.d.ts +2 -2
  57. package/out/fold-name.d.ts.map +1 -1
  58. package/out/fold-name.js +2 -2
  59. package/out/fold-name.js.map +1 -1
  60. package/out/index.d.ts +15 -15
  61. package/out/index.d.ts.map +1 -1
  62. package/out/index.js +9 -9
  63. package/out/index.js.map +1 -1
  64. package/out/plausibility.d.ts +5 -4
  65. package/out/plausibility.d.ts.map +1 -1
  66. package/out/plausibility.js +5 -4
  67. package/out/plausibility.js.map +1 -1
  68. package/out/{postcode-country-coherence.d.ts → postcode/country-coherence.d.ts} +16 -16
  69. package/out/postcode/country-coherence.d.ts.map +1 -0
  70. package/out/{postcode-country-coherence.js → postcode/country-coherence.js} +24 -25
  71. package/out/postcode/country-coherence.js.map +1 -0
  72. package/out/postcode/index.d.ts +9 -0
  73. package/out/postcode/index.d.ts.map +1 -0
  74. package/out/postcode/index.js +9 -0
  75. package/out/postcode/index.js.map +1 -0
  76. package/out/{postcode-prefix.d.ts → postcode/prefix.d.ts} +4 -4
  77. package/out/postcode/prefix.d.ts.map +1 -0
  78. package/out/{postcode-prefix.js → postcode/prefix.js} +4 -4
  79. package/out/postcode/prefix.js.map +1 -0
  80. package/out/{postcode-shape-coherence.d.ts → postcode/shape-coherence.d.ts} +3 -3
  81. package/out/postcode/shape-coherence.d.ts.map +1 -0
  82. package/out/{postcode-shape-coherence.js → postcode/shape-coherence.js} +11 -20
  83. package/out/postcode/shape-coherence.js.map +1 -0
  84. package/out/remote-resolver.d.ts +18 -3
  85. package/out/remote-resolver.d.ts.map +1 -1
  86. package/out/remote-resolver.js +2 -2
  87. package/out/remote-resolver.js.map +1 -1
  88. package/out/rerank.d.ts +1 -1
  89. package/out/rerank.d.ts.map +1 -1
  90. package/out/rerank.js +2 -2
  91. package/out/rerank.js.map +1 -1
  92. package/out/{resolve.d.ts → resolve/index.d.ts} +1 -1
  93. package/out/resolve/index.d.ts.map +1 -0
  94. package/out/{resolve.js → resolve/index.js} +88 -387
  95. package/out/resolve/index.js.map +1 -0
  96. package/out/resolve/passes.d.ts +218 -0
  97. package/out/resolve/passes.d.ts.map +1 -0
  98. package/out/resolve/passes.js +333 -0
  99. package/out/resolve/passes.js.map +1 -0
  100. package/out/span-rescore.d.ts +16 -16
  101. package/out/span-rescore.d.ts.map +1 -1
  102. package/out/span-rescore.js +43 -69
  103. package/out/span-rescore.js.map +1 -1
  104. package/out/{street-evidence.d.ts → street/evidence.d.ts} +18 -3
  105. package/out/street/evidence.d.ts.map +1 -0
  106. package/out/{street-evidence.js → street/evidence.js} +22 -6
  107. package/out/street/evidence.js.map +1 -0
  108. package/out/street/index.d.ts +8 -0
  109. package/out/street/index.d.ts.map +1 -0
  110. package/out/street/index.js +8 -0
  111. package/out/street/index.js.map +1 -0
  112. package/out/{street-tier.d.ts → street/tier.d.ts} +14 -3
  113. package/out/street/tier.d.ts.map +1 -0
  114. package/out/{street-tier.js → street/tier.js} +115 -99
  115. package/out/street/tier.js.map +1 -0
  116. package/out/toponym-prior.d.ts +8 -8
  117. package/out/toponym-prior.d.ts.map +1 -1
  118. package/out/toponym-prior.js +8 -8
  119. package/out/toponym-prior.js.map +1 -1
  120. package/package.json +116 -59
  121. package/vitest.config.ts +5 -6
  122. package/out/admin-coherence-passes.d.ts.map +0 -1
  123. package/out/admin-coherence-passes.js.map +0 -1
  124. package/out/admin-containment.d.ts.map +0 -1
  125. package/out/admin-containment.js.map +0 -1
  126. package/out/admin-winner.d.ts.map +0 -1
  127. package/out/admin-winner.js.map +0 -1
  128. package/out/postcode-country-coherence.d.ts.map +0 -1
  129. package/out/postcode-country-coherence.js.map +0 -1
  130. package/out/postcode-prefix.d.ts.map +0 -1
  131. package/out/postcode-prefix.js.map +0 -1
  132. package/out/postcode-shape-coherence.d.ts.map +0 -1
  133. package/out/postcode-shape-coherence.js.map +0 -1
  134. package/out/resolve.d.ts.map +0 -1
  135. package/out/resolve.js.map +0 -1
  136. package/out/street-evidence.d.ts.map +0 -1
  137. package/out/street-evidence.js.map +0 -1
  138. package/out/street-tier.d.ts.map +0 -1
  139. package/out/street-tier.js.map +0 -1
  140. package/out/vitest.config.d.ts +0 -16
  141. package/out/vitest.config.d.ts.map +0 -1
  142. package/out/vitest.config.js +0 -36
  143. package/out/vitest.config.js.map +0 -1
@@ -11,13 +11,13 @@
11
11
  * turns THAT into a hard `spr.country = 'US'` WHERE clause. The candidate pool is all-US before
12
12
  * ranking begins, so a coarse placer that already called this address FR at confidence
13
13
  * 0.9999908844 has nothing to promote — a soft re-rank downstream of a hard filter is inert by
14
- * construction. Population then picks Paris, Texas (pop 24,969). With the postal shards attached
14
+ * construction. Population then picks Paris, Texas (pop 24,969). With the postal extracts attached
15
15
  * the answer gets WORSE, not merely wrong: the postcode resolves to the US row (ZIP 75001,
16
- * Addison TX), `applyPostcodeConsistency` finds no Paris within its 50 km gate (the nearest is
16
+ * Addison TX), `applyPostcodeConsistency` finds no Paris within its 50 km check (the nearest is
17
17
  * 143.8 km), and falls the locality coordinate back to the ZIP point. See
18
18
  * `docs/records/evals/2026-08-03-postcode-locality-scoping.md` for the instrumented diagnosis.
19
19
  *
20
- * No pattern-only lever can fix this. `75001` is NOT unambiguously French:
20
+ * No pattern-only change can fix this. `75001` is NOT unambiguously French:
21
21
  * `candidateSystemsForPostcode("75001")` returns `["us", "de", "fr"]`, and the 2026-08-04
22
22
  * candidate gazetteer holds the literal string in FOUR countries — FR 48.863,2.336 (Paris 1er),
23
23
  * US 32.960,-96.838 (Addison TX), DE 48.844,9.367, PL 54.190,16.188 (×2 rows). The SHAPE is
@@ -40,7 +40,7 @@
40
40
  * `state.defaultCountry` for the whole walk. Everything downstream — including the three post-walk
41
41
  * coherence passes and the street/rooftop tiers — then sees the corrected country.
42
42
  *
43
- * ## Why it is not a hard veto (the doctrine gate)
43
+ * ## Why it is not a hard veto (the doctrine check)
44
44
  *
45
45
  * Registries are SOFT priors here, positive evidence only. Two properties keep this one honest:
46
46
  *
@@ -86,9 +86,9 @@
86
86
  * Prototyped out-of-tree against the live gazetteer over the public `findPlace` surface (2026-08-03):
87
87
  * 400 real US (ZIP, city) pairs from `postalcode-us.db` + 400 real FR (CP, commune) pairs from
88
88
  * `postcode-locality-fr.db` — 800 pairs, **zero** border crossings, at both the 15 km and 25 km
89
- * gates. The 22 US abstentions were pairs whose ZIP parent name is not an exact-matching locality
89
+ * checks. The 22 US abstentions were pairs whose ZIP parent name is not an exact-matching locality
90
90
  * in the admin gazetteer (a recall gap; abstention is the safe outcome). The confound board's
91
- * verdicts were identical at 15, 25 AND 50 km, so the mechanism is not gate-tuned; the default
91
+ * verdicts were identical at 15, 25 AND 50 km, so the mechanism is not check-tuned; the default
92
92
  * below is the 25 km the scale run measured.
93
93
  *
94
94
  * Cost: 2 lookups on the byte-stable path (postcode + locality under the default country), and at
@@ -97,23 +97,23 @@
97
97
  * unless the tree carries both a postcode and a locality.
98
98
  *
99
99
  * **Default-ON** since the operator promotion of 2026-08-05 (#1477) — the resolver gauntlet, pinned
100
- * both ways, returned zero newly-failing gated cases, and 56,000 pair evaluations across both
100
+ * both ways, returned zero newly-failing conditional cases, and 56,000 pair evaluations across both
101
101
  * backends returned zero false positives. `ResolveOpts.postcodeCountryCoherence: false` opts out,
102
102
  * and the walk is byte-stable then. Receipts:
103
103
  * `docs/records/evals/2026-08-05-postcode-coherence-default-on-evidence.md`.
104
104
  */
105
- import type { AddressNode } from "@mailwoman/core/decoder";
105
+ import { type AddressNode } from "@mailwoman/core/decoder";
106
106
  import type { ResolvedPlace, ResolverBackend } from "@mailwoman/core/resolver";
107
107
  /**
108
- * Default gate radius (km) for the postcode↔locality consistency test. 25 km is what the 800-pair scale run measured;
108
+ * Default check radius (km) for the postcode↔locality consistency test. 25 km is what the 800-pair scale run measured;
109
109
  * the confound board returned identical verdicts at 15, 25 and 50, so this is a floor choice, not a tuned one.
110
110
  */
111
- export declare const POSTCODE_COUNTRY_COHERENCE_GATE_KM = 25;
111
+ export declare const POSTCODE_COUNTRY_COHERENCE_THRESHOLD_KM = 25;
112
112
  /**
113
113
  * Which half (or halves) of the address bought the verdict — the firing receipt, so a reader of a scoped result can
114
114
  * tell a two-sided agreement from a one-sided uniqueness claim without re-deriving it.
115
115
  *
116
- * - `pair` — postcode AND locality both resolve in this country, within the gate. The strongest rung and the only one
116
+ * - `pair` — postcode AND locality both resolve in this country, within the radius. The strongest rung and the only one
117
117
  * that existed before #24.
118
118
  * - `locality` — the locality names exactly one country in the whole gazetteer, and the postcode names none that
119
119
  * contradict it. This is the CH/BE class: the gazetteer carries no Swiss or Belgian postcodes at all, so the pair
@@ -143,7 +143,7 @@ export interface PostcodeCountryScope {
143
143
  */
144
144
  evidence: PostcodeCountryScopeEvidence;
145
145
  /**
146
- * Distance between the resolved postcode point and the nearest same-named locality, in km. Always `<= gateKm`.
146
+ * Distance between the resolved postcode point and the nearest same-named locality, in km. Always `<= thresholdKm`.
147
147
  * Present ONLY for the `pair` rung — a single-sided verdict has no two points to measure between, and reporting a `0`
148
148
  * there would assert an agreement nobody tested (the meaning-of-zero rule).
149
149
  */
@@ -171,9 +171,9 @@ export interface PostcodeCountryScopeOpts {
171
171
  */
172
172
  defaultCountry: string | undefined;
173
173
  /**
174
- * Consistency gate radius in km. Defaults to {@link POSTCODE_COUNTRY_COHERENCE_GATE_KM}.
174
+ * Consistency check radius in km. Defaults to {@link POSTCODE_COUNTRY_COHERENCE_THRESHOLD_KM}.
175
175
  */
176
- gateKm?: number;
176
+ thresholdKm?: number;
177
177
  /**
178
178
  * Optional narrowing of the SHAPE half of the candidate-country set — the shape-coherence pass's intersection for a
179
179
  * CONFIRMED postcode span (see `resolver/postcode-shape-coherence.ts`, #31 Mechanism 1). When present it REPLACES
@@ -191,7 +191,7 @@ export interface PostcodeCountryScopeOpts {
191
191
  * case-insensitively deduplicated. Two passes so a real locality always beats a dependent one regardless of tree
192
192
  * order.
193
193
  *
194
- * Document order is load-bearing, not cosmetic. The original stack-pop traversal visited the LAST node first, so on `92
194
+ * Document order is required, not cosmetic. The original stack-pop traversal visited the LAST node first, so on `92
195
195
  * Laurell Road, Gander, NL A1V 0A9` — where the model tags both `Gander` and the province abbreviation `NL` as
196
196
  * localities — the pass keyed its whole country verdict on "NL", whose only exact locality-band bearer is an alias of
197
197
  * Nal, Afghanistan, and the walk resolved a Newfoundland street 10,000 km away. The FIRST-written locality is the one
@@ -229,4 +229,4 @@ export declare function findPostcodeCountryScope(roots: readonly AddressNode[],
229
229
  * untouched, this only writes `metadata`.
230
230
  */
231
231
  export declare function stampPostcodeCountryScope(roots: readonly AddressNode[], scope: PostcodeCountryScope): void;
232
- //# sourceMappingURL=postcode-country-coherence.d.ts.map
232
+ //# sourceMappingURL=country-coherence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"country-coherence.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AAC,KAAK,EAAE,SAAS,WAAW,EAAE,GAAG,MAAM,GAAG,SAAS,CAEpF;AA2ID;;;;;;;;;;;;;GAaG;AACH,wBAAsB,wBAAwB,CAC7C,KAAK,EAAE,SAAS,WAAW,EAAE,EAC7B,OAAO,EAAE,eAAe,EACxB,IAAI,EAAE,wBAAwB,GAC5B,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CA2JtC;AAmBD;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,EAAE,KAAK,EAAE,oBAAoB,GAAG,IAAI,CAe1G"}
@@ -11,13 +11,13 @@
11
11
  * turns THAT into a hard `spr.country = 'US'` WHERE clause. The candidate pool is all-US before
12
12
  * ranking begins, so a coarse placer that already called this address FR at confidence
13
13
  * 0.9999908844 has nothing to promote — a soft re-rank downstream of a hard filter is inert by
14
- * construction. Population then picks Paris, Texas (pop 24,969). With the postal shards attached
14
+ * construction. Population then picks Paris, Texas (pop 24,969). With the postal extracts attached
15
15
  * the answer gets WORSE, not merely wrong: the postcode resolves to the US row (ZIP 75001,
16
- * Addison TX), `applyPostcodeConsistency` finds no Paris within its 50 km gate (the nearest is
16
+ * Addison TX), `applyPostcodeConsistency` finds no Paris within its 50 km check (the nearest is
17
17
  * 143.8 km), and falls the locality coordinate back to the ZIP point. See
18
18
  * `docs/records/evals/2026-08-03-postcode-locality-scoping.md` for the instrumented diagnosis.
19
19
  *
20
- * No pattern-only lever can fix this. `75001` is NOT unambiguously French:
20
+ * No pattern-only change can fix this. `75001` is NOT unambiguously French:
21
21
  * `candidateSystemsForPostcode("75001")` returns `["us", "de", "fr"]`, and the 2026-08-04
22
22
  * candidate gazetteer holds the literal string in FOUR countries — FR 48.863,2.336 (Paris 1er),
23
23
  * US 32.960,-96.838 (Addison TX), DE 48.844,9.367, PL 54.190,16.188 (×2 rows). The SHAPE is
@@ -40,7 +40,7 @@
40
40
  * `state.defaultCountry` for the whole walk. Everything downstream — including the three post-walk
41
41
  * coherence passes and the street/rooftop tiers — then sees the corrected country.
42
42
  *
43
- * ## Why it is not a hard veto (the doctrine gate)
43
+ * ## Why it is not a hard veto (the doctrine check)
44
44
  *
45
45
  * Registries are SOFT priors here, positive evidence only. Two properties keep this one honest:
46
46
  *
@@ -86,9 +86,9 @@
86
86
  * Prototyped out-of-tree against the live gazetteer over the public `findPlace` surface (2026-08-03):
87
87
  * 400 real US (ZIP, city) pairs from `postalcode-us.db` + 400 real FR (CP, commune) pairs from
88
88
  * `postcode-locality-fr.db` — 800 pairs, **zero** border crossings, at both the 15 km and 25 km
89
- * gates. The 22 US abstentions were pairs whose ZIP parent name is not an exact-matching locality
89
+ * checks. The 22 US abstentions were pairs whose ZIP parent name is not an exact-matching locality
90
90
  * in the admin gazetteer (a recall gap; abstention is the safe outcome). The confound board's
91
- * verdicts were identical at 15, 25 AND 50 km, so the mechanism is not gate-tuned; the default
91
+ * verdicts were identical at 15, 25 AND 50 km, so the mechanism is not check-tuned; the default
92
92
  * below is the 25 km the scale run measured.
93
93
  *
94
94
  * Cost: 2 lookups on the byte-stable path (postcode + locality under the default country), and at
@@ -97,7 +97,7 @@
97
97
  * unless the tree carries both a postcode and a locality.
98
98
  *
99
99
  * **Default-ON** since the operator promotion of 2026-08-05 (#1477) — the resolver gauntlet, pinned
100
- * both ways, returned zero newly-failing gated cases, and 56,000 pair evaluations across both
100
+ * both ways, returned zero newly-failing conditional cases, and 56,000 pair evaluations across both
101
101
  * backends returned zero false positives. `ResolveOpts.postcodeCountryCoherence: false` opts out,
102
102
  * and the walk is byte-stable then. Receipts:
103
103
  * `docs/records/evals/2026-08-05-postcode-coherence-default-on-evidence.md`.
@@ -105,14 +105,15 @@
105
105
  // `postcode-systems` has no dedicated export subpath; the barrel is where every other consumer
106
106
  // (`neural/postcode-anchor.ts`) reaches it from.
107
107
  import { candidateSystemsForPostcode } from "@mailwoman/codex";
108
+ import { walkNodes } from "@mailwoman/core/decoder";
108
109
  import { haversineKm } from "@mailwoman/spatial";
109
110
  /**
110
- * Default gate radius (km) for the postcode↔locality consistency test. 25 km is what the 800-pair scale run measured;
111
+ * Default check radius (km) for the postcode↔locality consistency test. 25 km is what the 800-pair scale run measured;
111
112
  * the confound board returned identical verdicts at 15, 25 and 50, so this is a floor choice, not a tuned one.
112
113
  */
113
- export const POSTCODE_COUNTRY_COHERENCE_GATE_KM = 25;
114
+ export const POSTCODE_COUNTRY_COHERENCE_THRESHOLD_KM = 25;
114
115
  /**
115
- * A usable coordinate — the gazetteer stores an unlocated row as 0,0, which haversine would happily measure against.
116
+ * A usable coordinate — the gazetteer stores an unlocated row as 0,0, which haversine would measure against.
116
117
  */
117
118
  function hasCoord(p) {
118
119
  return p.lat !== 0 || p.lon !== 0;
@@ -127,7 +128,7 @@ const MAX_LOCALITY_VALUES = 3;
127
128
  * case-insensitively deduplicated. Two passes so a real locality always beats a dependent one regardless of tree
128
129
  * order.
129
130
  *
130
- * Document order is load-bearing, not cosmetic. The original stack-pop traversal visited the LAST node first, so on `92
131
+ * Document order is required, not cosmetic. The original stack-pop traversal visited the LAST node first, so on `92
131
132
  * Laurell Road, Gander, NL A1V 0A9` — where the model tags both `Gander` and the province abbreviation `NL` as
132
133
  * localities — the pass keyed its whole country verdict on "NL", whose only exact locality-band bearer is an alias of
133
134
  * Nal, Afghanistan, and the walk resolved a Newfoundland street 10,000 km away. The FIRST-written locality is the one
@@ -219,10 +220,11 @@ async function countriesHolding(backend, text, placetype, limit, opts) {
219
220
  /**
220
221
  * Is the (postcode, locality) pair geographically consistent in `country`? Returns the winning pair and its distance,
221
222
  * or `null` when the postcode does not resolve there, no same-named locality exists there, or the nearest one is
222
- * outside the gate. Costs one postcode lookup plus (only if that hit) one locality lookup — or just the locality lookup
223
- * when the caller already knows the country's postcode row (`knownPostcodePlace`, from the exhaustive unscoped probe).
223
+ * outside the check. Costs one postcode lookup plus (only if that hit) one locality lookup — or just the locality
224
+ * lookup when the caller already knows the country's postcode row (`knownPostcodePlace`, from the exhaustive unscoped
225
+ * probe).
224
226
  */
225
- async function coherenceIn(country, postcode, locality, backend, gateKm, knownPostcodePlace) {
227
+ async function coherenceIn(country, postcode, locality, backend, thresholdKm, knownPostcodePlace) {
226
228
  let postcodePlace = knownPostcodePlace;
227
229
  if (!postcodePlace) {
228
230
  let postcodeHits;
@@ -251,7 +253,7 @@ async function coherenceIn(country, postcode, locality, backend, gateKm, knownPo
251
253
  if (!candidate.exactMatch || !hasCoord(candidate))
252
254
  continue;
253
255
  const distanceKm = haversineKm(postcodePlace.lat, postcodePlace.lon, candidate.lat, candidate.lon);
254
- if (distanceKm > gateKm)
256
+ if (distanceKm > thresholdKm)
255
257
  continue;
256
258
  if (!best || distanceKm < best.distanceKm) {
257
259
  best = { localityPlace: candidate, distanceKm };
@@ -284,14 +286,14 @@ export async function findPostcodeCountryScope(roots, backend, opts) {
284
286
  // and on every bare-postcode query.
285
287
  if (!localities.length)
286
288
  return null;
287
- const gateKm = opts.gateKm ?? POSTCODE_COUNTRY_COHERENCE_GATE_KM;
289
+ const thresholdKm = opts.thresholdKm ?? POSTCODE_COUNTRY_COHERENCE_THRESHOLD_KM;
288
290
  // 1. Is the caller's own default country coherent with ANY of the address's locality values? If so we are done —
289
291
  // positive evidence for the default, no override, and the common domestic path (one locality value) costs two
290
292
  // lookups and changes nothing. With no default in force (the browser cascade) there is nothing to test — the
291
293
  // sweep below carries the whole verdict.
292
294
  if (defaultCountry) {
293
295
  for (const locality of localities) {
294
- if (await coherenceIn(defaultCountry, postcode, locality, backend, gateKm))
296
+ if (await coherenceIn(defaultCountry, postcode, locality, backend, thresholdKm))
295
297
  return null;
296
298
  }
297
299
  }
@@ -321,7 +323,7 @@ export async function findPostcodeCountryScope(roots, backend, opts) {
321
323
  for (const locality of localities) {
322
324
  const coherent = [];
323
325
  for (const country of candidates) {
324
- const hit = await coherenceIn(country, postcode, locality, backend, gateKm, pcHolders.get(country));
326
+ const hit = await coherenceIn(country, postcode, locality, backend, thresholdKm, pcHolders.get(country));
325
327
  if (hit) {
326
328
  coherent.push({ country, postcode, locality, evidence: "pair", ...hit });
327
329
  }
@@ -359,7 +361,7 @@ export async function findPostcodeCountryScope(roots, backend, opts) {
359
361
  return null;
360
362
  // 4a. A locality value names exactly one country. Stronger than the postcode rung — a place name is far
361
363
  // more discriminative than a four-digit code — so it is tried first. A verdict stands down when that
362
- // country's OWN postcode row contradicts the locality (outside the gate): the two halves disagreeing
364
+ // country's OWN postcode row contradicts the locality (outside the check): the two halves disagreeing
363
365
  // inside one country is exactly what the pair test exists to catch, and a single-sided rung must not
364
366
  // launder it.
365
367
  // PRIMARY-keyed rows only (#1626's re-reading discipline, applied to a country verdict): "the locality
@@ -385,7 +387,7 @@ export async function findPostcodeCountryScope(roots, backend, opts) {
385
387
  const [country, localityPlace] = [...locHolders.entries()][0];
386
388
  const ownPostcode = pcHolders.get(country);
387
389
  const contradicted = ownPostcode !== undefined &&
388
- haversineKm(ownPostcode.lat, ownPostcode.lon, localityPlace.lat, localityPlace.lon) > gateKm;
390
+ haversineKm(ownPostcode.lat, ownPostcode.lon, localityPlace.lat, localityPlace.lon) > thresholdKm;
389
391
  if (country !== defaultCountry && !contradicted && !verdicts.has(country)) {
390
392
  verdicts.set(country, { country, postcode, locality, evidence: "locality", localityPlace });
391
393
  }
@@ -429,10 +431,7 @@ async function holdsLocality(backend, locality, country) {
429
431
  * untouched, this only writes `metadata`.
430
432
  */
431
433
  export function stampPostcodeCountryScope(roots, scope) {
432
- const stack = [...roots];
433
- while (stack.length) {
434
- const n = stack.pop();
435
- stack.push(...n.children);
434
+ for (const n of walkNodes(roots)) {
436
435
  if (n.tag !== "postcode" && n.tag !== "locality" && n.tag !== "dependent_locality")
437
436
  continue;
438
437
  n.metadata = {
@@ -447,4 +446,4 @@ export function stampPostcodeCountryScope(roots, scope) {
447
446
  };
448
447
  }
449
448
  }
450
- //# sourceMappingURL=postcode-country-coherence.js.map
449
+ //# sourceMappingURL=country-coherence.js.map
@@ -0,0 +1 @@
1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AM,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;QAClC,IAAI,CAAC,CAAC,GAAG,KAAK,UAAU,IAAI,CAAC,CAAC,GAAG,KAAK,UAAU,IAAI,CAAC,CAAC,GAAG,KAAK,oBAAoB;YAAE,SAAQ;QAE5F,CAAC,CAAC,QAAQ,GAAG;YACZ,GAAG,CAAC,CAAC,QAAQ;YACb,sBAAsB,EAAE,KAAK,CAAC,OAAO;YACrC,oGAAoG;YACpG,6EAA6E;YAC7E,+BAA+B,EAAE,KAAK,CAAC,QAAQ;YAC/C,mGAAmG;YACnG,2BAA2B;YAC3B,GAAG,CAAC,KAAK,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,yBAAyB,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1F,CAAA;IACF,CAAC;AACF,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ */
6
+ export * from "#postcode/country-coherence";
7
+ export * from "#postcode/prefix";
8
+ export * from "#postcode/shape-coherence";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/postcode/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kBAAkB,CAAA;AAChC,cAAc,2BAA2B,CAAA"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ */
6
+ export * from "#postcode/country-coherence";
7
+ export * from "#postcode/prefix";
8
+ export * from "#postcode/shape-coherence";
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/postcode/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kBAAkB,CAAA;AAChC,cAAc,2BAA2B,CAAA"}
@@ -29,7 +29,7 @@
29
29
  * acquisition) — the branch exists so the law is tested before the data.
30
30
  * - **Anything else** — abstain (null).
31
31
  *
32
- * ## The probe's country gate
32
+ * ## The probe's country restriction
33
33
  *
34
34
  * The index is country-specific EVIDENCE: it is only probed when its `country` matches the
35
35
  * query's country scope (or the scope is absent). A GB index must not speak under a US scope —
@@ -61,7 +61,7 @@ import type { PostcodePrefixIndexLike, PostcodePrefixNode, ResolvedPlace } from
61
61
  * even the 0,0 unlocated sentinel), and the prefix prior's ancestry-only tier must express absence as `undefined`
62
62
  * instead — B3-3: inventing a centroid would reproduce the `BT3 9QQ` → Sheffield defect #1480. `decorateNode` copies
63
63
  * `lat`/`lon` onto the node verbatim, so an undefined coordinate stays absent on the node — the meaning-of-zero rule.
64
- * Widened ONLY at this seam: gazetteer places (always coordinate-bearing) remain plain `ResolvedPlace`.
64
+ * Widened ONLY at this boundary: gazetteer places (always coordinate-bearing) remain plain `ResolvedPlace`.
65
65
  */
66
66
  export type CoordinateOptionalPlace = Omit<ResolvedPlace, "lat" | "lon"> & {
67
67
  lat?: number;
@@ -86,7 +86,7 @@ export interface PostcodePrefixProbeResult {
86
86
  node: PostcodePrefixNode;
87
87
  }
88
88
  /**
89
- * Probe the index for `code`'s prefix. Two abstention gates, in order: the index's country must match the query's
89
+ * Probe the index for `code`'s prefix. Two abstention checks, in order: the index's country must match the query's
90
90
  * country scope (or the scope is absent), and the derivation law must yield a prefix the index carries. Returns null to
91
91
  * abstain — never throws, never guesses.
92
92
  */
@@ -98,4 +98,4 @@ export declare function probePostcodePrefix(code: string, index: PostcodePrefixI
98
98
  * half).
99
99
  */
100
100
  export declare function postcodePrefixResolvedPlace(prefix: string, node: PostcodePrefixNode, index: PostcodePrefixIndexLike): CoordinateOptionalPlace;
101
- //# sourceMappingURL=postcode-prefix.d.ts.map
101
+ //# sourceMappingURL=prefix.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prefix.d.ts","sourceRoot":"","sources":["../../lib/postcode/prefix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAE1G;;;;;;GAMG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,aAAa,EAAE,KAAK,GAAG,KAAK,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAazG;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAkBlF;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACzC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,IAAI,EAAE,kBAAkB,CAAA;CACxB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,uBAAuB,EAC9B,YAAY,CAAC,EAAE,MAAM,GACnB,yBAAyB,GAAG,IAAI,CAclC;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAC1C,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,kBAAkB,EACxB,KAAK,EAAE,uBAAuB,GAC5B,uBAAuB,CAYzB"}
@@ -29,7 +29,7 @@
29
29
  * acquisition) — the branch exists so the law is tested before the data.
30
30
  * - **Anything else** — abstain (null).
31
31
  *
32
- * ## The probe's country gate
32
+ * ## The probe's country restriction
33
33
  *
34
34
  * The index is country-specific EVIDENCE: it is only probed when its `country` matches the
35
35
  * query's country scope (or the scope is absent). A GB index must not speak under a US scope —
@@ -87,13 +87,13 @@ export function derivePostcodePrefix(code, country) {
87
87
  }
88
88
  }
89
89
  /**
90
- * Probe the index for `code`'s prefix. Two abstention gates, in order: the index's country must match the query's
90
+ * Probe the index for `code`'s prefix. Two abstention checks, in order: the index's country must match the query's
91
91
  * country scope (or the scope is absent), and the derivation law must yield a prefix the index carries. Returns null to
92
92
  * abstain — never throws, never guesses.
93
93
  */
94
94
  export function probePostcodePrefix(code, index, queryCountry) {
95
95
  const indexCountry = index.country?.toUpperCase();
96
- // Country gate: the index is evidence FOR its own country only. A GB index under a US scope stays
96
+ // Country check: the index is evidence FOR its own country only. A GB index under a US scope stays
97
97
  // silent — the walk's country filter is the caller's declared universe.
98
98
  if (queryCountry && indexCountry && queryCountry.toUpperCase() !== indexCountry)
99
99
  return null;
@@ -122,4 +122,4 @@ export function postcodePrefixResolvedPlace(prefix, node, index) {
122
122
  exactMatch: false,
123
123
  };
124
124
  }
125
- //# sourceMappingURL=postcode-prefix.js.map
125
+ //# sourceMappingURL=prefix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prefix.js","sourceRoot":"","sources":["../../lib/postcode/prefix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AAaH;;;GAGG;AACH,MAAM,0BAA0B,GAAG,CAAC,CAAA;AAEpC;;GAEG;AACH,MAAM,0BAA0B,GAAG,CAAC,CAAA;AAEpC;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAY,EAAE,OAAgB;IAClE,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAA;IAElC,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;IAE3C,QAAQ,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;QAC/B,0FAA0F;QAC1F,2FAA2F;QAC3F,KAAK,IAAI;YACR,OAAO,OAAO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,CAAC,GAAG,KAAK,SAAS,IAAI,IAAI,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7F,KAAK,EAAE,CAAC;QACR,UAAU,EAAE,KAAK;KACjB,CAAA;AACF,CAAC"}
@@ -69,11 +69,11 @@
69
69
  * CONFIRMS it instead.
70
70
  *
71
71
  * **D-rule: opt-in behind `ResolveOpts.postcodeShapeCoherence`, default-OFF.** Demotion is the
72
- * failure mode with teeth, so a default-on promotion needs the full pre-registered gate (B1-1
72
+ * failure mode with teeth, so a default-on promotion needs the full pre-registered eval (B1-1
73
73
  * byte-stability, B1-2 exclusion ≥90% with the correct sibling tag surviving, B1-3 confound ≤2%
74
74
  * false exclusions; kill on any B1-3 δ).
75
75
  */
76
- import type { AddressNode } from "@mailwoman/core/decoder";
76
+ import { type AddressNode } from "@mailwoman/core/decoder";
77
77
  /**
78
78
  * The pass's per-tree verdict — the caller (and the B1 board tests) can see exactly which spans were confirmed,
79
79
  * excluded, or abstained, and which confirmed span's narrowed systems should bound the country-scope pass.
@@ -110,4 +110,4 @@ export declare function applyPostcodeShapeCoherence(roots: readonly AddressNode[
110
110
  * skip these, which is what "strip the postcode tag's contribution" means for a span that keeps its tag.
111
111
  */
112
112
  export declare function isShapeExcludedPostcode(node: AddressNode): boolean;
113
- //# sourceMappingURL=postcode-shape-coherence.d.ts.map
113
+ //# sourceMappingURL=shape-coherence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shape-coherence.d.ts","sourceRoot":"","sources":["../../lib/postcode/shape-coherence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0EG;AAKH,OAAO,EAA2B,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAWnF;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACpC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB;;OAEG;IACH,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB;;OAEG;IACH,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB;;OAEG;IACH,SAAS,EAAE,MAAM,EAAE,CAAA;CACnB;AA+CD;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,SAAS,WAAW,EAAE,GAAG,oBAAoB,CA2D/F;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAElE"}
@@ -69,20 +69,22 @@
69
69
  * CONFIRMS it instead.
70
70
  *
71
71
  * **D-rule: opt-in behind `ResolveOpts.postcodeShapeCoherence`, default-OFF.** Demotion is the
72
- * failure mode with teeth, so a default-on promotion needs the full pre-registered gate (B1-1
72
+ * failure mode with teeth, so a default-on promotion needs the full pre-registered eval (B1-1
73
73
  * byte-stability, B1-2 exclusion ≥90% with the correct sibling tag surviving, B1-3 confound ≤2%
74
74
  * false exclusions; kill on any B1-3 δ).
75
75
  */
76
- import { candidateSystemsForPostcode } from "@mailwoman/codex";
76
+ import { candidateSystemsForPostcode, SYSTEM_CODES } from "@mailwoman/codex";
77
77
  import { matchCountry, matchSubdivision } from "@mailwoman/codex/country";
78
78
  import { isUSStateAbbreviation } from "@mailwoman/codex/us";
79
+ import { collectNodes, walkNodes } from "@mailwoman/core/decoder";
79
80
  /**
80
81
  * The codex address systems a sibling signal can speak for — the universe `candidateSystemsForPostcode` can return, in
81
82
  * the upper-case ISO form this module's signals are emitted in (`SystemCode` itself is lower-case). Signals from
82
83
  * countries with no codex slice are filtered out BEFORE the intersection test, so a slice-less country can never
83
- * manufacture an empty intersection (the false-exclusion trap; see the header).
84
+ * manufacture an empty intersection (the false-exclusion trap; see the header). Derived from codex's own list so a
85
+ * system added there is admitted here in the same change.
84
86
  */
85
- const SYSTEM_UNIVERSE = new Set(["US", "DE", "FR", "CA", "GB", "JP", "AU", "NZ"]);
87
+ const SYSTEM_UNIVERSE = new Set(SYSTEM_CODES.map((system) => system.toUpperCase()));
86
88
  /**
87
89
  * Collect the sibling country signals: the country node (territory-mapped), the region node (`matchSubdivision` +
88
90
  * `country_hint`), each filtered to the codex SystemCode universe. The tree is walked once for ALL postcode spans —
@@ -90,10 +92,7 @@ const SYSTEM_UNIVERSE = new Set(["US", "DE", "FR", "CA", "GB", "JP", "AU", "NZ"]
90
92
  */
91
93
  function collectSiblingSystems(roots) {
92
94
  const out = new Set();
93
- const stack = [...roots];
94
- while (stack.length) {
95
- const n = stack.pop();
96
- stack.push(...n.children);
95
+ for (const n of walkNodes(roots)) {
97
96
  if (n.tag === "country") {
98
97
  const matched = matchCountry(n.value);
99
98
  if (!matched)
@@ -109,7 +108,7 @@ function collectSiblingSystems(roots) {
109
108
  if (n.tag === "region") {
110
109
  // (a) The region's value as a subdivision ("CA" → US, "ON" → CA — the US-wins tiebreak for
111
110
  // "CA" is matchSubdivision's own). (b) The `country_hint` stamp annotateUSRegions writes on
112
- // 2-letter US state abbreviations — the same evidence via the pipeline's other seam.
111
+ // 2-letter US state abbreviations — the same evidence via the pipeline's other path.
113
112
  const sub = matchSubdivision(n.value);
114
113
  if (sub && SYSTEM_UNIVERSE.has(sub.country.toUpperCase())) {
115
114
  out.add(sub.country.toUpperCase());
@@ -129,17 +128,9 @@ function collectSiblingSystems(roots) {
129
128
  */
130
129
  export function applyPostcodeShapeCoherence(roots) {
131
130
  const verdict = { confirmed: [], excluded: [], abstained: [] };
132
- // The postcode spans in tree order — the same DFS `firstPostcodeValue` uses, so the verdict's
131
+ // The postcode spans in document order — the same walk `firstPostcodeValue` uses, so the verdict's
133
132
  // "first confirmed" is the node `state.postcode` will read.
134
- const postcodes = [];
135
- const stack = [...roots];
136
- while (stack.length) {
137
- const n = stack.pop();
138
- if (n.tag === "postcode" && n.value.trim().length) {
139
- postcodes.push(n);
140
- }
141
- stack.push(...n.children);
142
- }
133
+ const postcodes = collectNodes(roots, (n) => n.tag === "postcode" && n.value.trim().length > 0);
143
134
  if (!postcodes.length)
144
135
  return verdict;
145
136
  const siblingSystems = collectSiblingSystems(roots);
@@ -190,4 +181,4 @@ export function applyPostcodeShapeCoherence(roots) {
190
181
  export function isShapeExcludedPostcode(node) {
191
182
  return node.tag === "postcode" && node.metadata?.["postcode_shape_excluded"] === true;
192
183
  }
193
- //# sourceMappingURL=postcode-shape-coherence.js.map
184
+ //# sourceMappingURL=shape-coherence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shape-coherence.js","sourceRoot":"","sources":["../../lib/postcode/shape-coherence.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0EG;AAEH,OAAO,EAAE,2BAA2B,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC5E,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAC3D,OAAO,EAAE,YAAY,EAAE,SAAS,EAAoB,MAAM,yBAAyB,CAAA;AAEnF;;;;;;GAMG;AACH,MAAM,eAAe,GAAwB,IAAI,GAAG,CAAS,YAAY,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAA;AA2BhH;;;;GAIG;AACH,SAAS,qBAAqB,CAAC,KAA6B;IAC3D,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAA;IAE7B,KAAK,MAAM,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;QAClC,IAAI,CAAC,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,OAAO,GAAG,YAAY,CAAC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AED,SAAQ;QACT,CAAC;QAED,IAAI,cAAc,CAAC,IAAI,EAAE,CAAC;YACzB,yFAAyF;YACzF,2FAA2F;YAC3F,+EAA+E;YAC/E,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAE3B,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBACxB,IAAI,CAAC,GAAG,GAAG,cAAc,CAAA;YAC1B,CAAC;iBAAM,CAAC;gBACP,IAAI,CAAC,QAAQ,GAAG,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,uBAAuB,EAAE,IAAI,EAAE,CAAA;YACpE,CAAC;YAED,SAAQ;QACT,CAAC;QAED,8FAA8F;QAC9F,uEAAuE;QACvE,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC7B,CAAC;IAED,OAAO,OAAO,CAAA;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAAiB;IACxD,OAAO,IAAI,CAAC,GAAG,KAAK,UAAU,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,yBAAyB,CAAC,KAAK,IAAI,CAAA;AACtF,CAAC"}
@@ -5,11 +5,11 @@
5
5
  *
6
6
  * `RemoteResolver` — the `Resolver` interface (`resolveTree`) over HTTP. The adapter the interface
7
7
  * docstring anticipated (Phase 4.4): a client POSTs a parsed `AddressTree` + the serializable
8
- * `ResolveOpts` to a resolver service, which owns the gazetteer + situs/interpolation shards,
8
+ * `ResolveOpts` to a resolver service, which owns the gazetteer + situs/interpolation extracts,
9
9
  * runs the cascade, and returns the resolved tree. Two payoffs:
10
10
  *
11
11
  * 1. **Multi-instance** — stateless parser nodes (the ~30 MB ONNX model) talk to ONE resolver service
12
- * (the multi-GB gazetteer + shards). `parse` locally, `new RemoteResolver(...).resolveTree`
12
+ * (the multi-GB gazetteer + extracts). `parse` locally, `new RemoteResolver(...).resolveTree`
13
13
  * remotely — same interface the in-process `WOFResolver` satisfies, so it's a drop-in.
14
14
  * 2. **Canary** — point it at a second resolver build (or an adapter fronting Pelias/Nominatim/BAN)
15
15
  * and diff the resolved trees through the identical contract.
@@ -30,6 +30,17 @@ export type SerializableResolveOpts = Omit<ResolveOpts, "addressPoints" | "inter
30
30
  * Strip the live lookup handles from `ResolveOpts` so the rest can be JSON-serialized over HTTP.
31
31
  */
32
32
  export declare function serializableResolveOpts(opts?: ResolveOpts): SerializableResolveOpts | undefined;
33
+ export type RemoteResolverFetch = (url: string, init: {
34
+ method: string;
35
+ headers: Record<string, string>;
36
+ body: string;
37
+ signal?: AbortSignal;
38
+ }) => Promise<{
39
+ ok: boolean;
40
+ status: number;
41
+ statusText: string;
42
+ json(): Promise<unknown>;
43
+ }>;
33
44
  export interface RemoteResolverOpts {
34
45
  /**
35
46
  * Full URL of the resolver service's resolve-tree endpoint, e.g. `http://resolver:7081/v1/resolve`.
@@ -37,8 +48,12 @@ export interface RemoteResolverOpts {
37
48
  endpoint: string;
38
49
  /**
39
50
  * Injectable fetch (tests / custom agents). Defaults to the global `fetch`.
51
+ *
52
+ * Typed by what this module reads — `ok`, `status`, `statusText`, `json()` — rather than the full `fetch`, whose
53
+ * `Response` carries a body stream and headers no code here touches. The global `fetch` satisfies this shape, and a
54
+ * test double can be an object instead of an assertion.
40
55
  */
41
- fetch?: typeof fetch;
56
+ fetch?: RemoteResolverFetch;
42
57
  /**
43
58
  * Per-request timeout in ms. Default 10000.
44
59
  */
@@ -1 +1 @@
1
- {"version":3,"file":"remote-resolver.d.ts","sourceRoot":"","sources":["../remote-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAErE;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,WAAW,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,EAAE,MAAM,EACX,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE,KACzF,OAAO,CAAC;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,CAAA;CAAE,CAAC,CAAA;AAE3F,MAAM,WAAW,kBAAkB;IAClC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,mBAAmB,CAAA;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,IAAI,EAAE,WAAW,CAAA;IACjB,IAAI,CAAC,EAAE,uBAAuB,CAAA;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC,IAAI,EAAE,WAAW,CAAA;CACjB;AAED,qBAAa,cAAe,YAAW,QAAQ;;gBAMlC,IAAI,EAAE,kBAAkB;IAQ9B,WAAW,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;CA6B9E"}
@@ -5,11 +5,11 @@
5
5
  *
6
6
  * `RemoteResolver` — the `Resolver` interface (`resolveTree`) over HTTP. The adapter the interface
7
7
  * docstring anticipated (Phase 4.4): a client POSTs a parsed `AddressTree` + the serializable
8
- * `ResolveOpts` to a resolver service, which owns the gazetteer + situs/interpolation shards,
8
+ * `ResolveOpts` to a resolver service, which owns the gazetteer + situs/interpolation extracts,
9
9
  * runs the cascade, and returns the resolved tree. Two payoffs:
10
10
  *
11
11
  * 1. **Multi-instance** — stateless parser nodes (the ~30 MB ONNX model) talk to ONE resolver service
12
- * (the multi-GB gazetteer + shards). `parse` locally, `new RemoteResolver(...).resolveTree`
12
+ * (the multi-GB gazetteer + extracts). `parse` locally, `new RemoteResolver(...).resolveTree`
13
13
  * remotely — same interface the in-process `WOFResolver` satisfies, so it's a drop-in.
14
14
  * 2. **Canary** — point it at a second resolver build (or an adapter fronting Pelias/Nominatim/BAN)
15
15
  * and diff the resolved trees through the identical contract.
@@ -1 +1 @@
1
- {"version":3,"file":"remote-resolver.js","sourceRoot":"","sources":["../remote-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAUH;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAAkB;IACzD,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAA;IAC3B,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAA;IAEhE,OAAO,IAAI,CAAA;AACZ,CAAC;AAoCD,MAAM,OAAO,cAAc;IACjB,SAAS,CAAQ;IACjB,MAAM,CAAc;IACpB,UAAU,CAAQ;IAClB,QAAQ,CAAwB;IAEzC,YAAY,IAAwB;QACnC,IAAI,CAAC,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;QAC7E,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAA;QAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAA;QAC5C,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,SAAS,IAAI,MAAM,CAAA;QAC1C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,CAAA;IACnC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC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gBACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE;gBACjE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;gBAC1B,MAAM,EAAE,UAAU,CAAC,MAAM;aACzB,CAAC,CAAA;YAEF,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;gBACb,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,CAAC,SAAS,WAAW,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC,CAAA;YAC5F,CAAC;YAED,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAiC,CAAA;YAE/D,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC5D,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAA;YAC7E,CAAC;YAED,OAAO,IAAI,CAAC,IAAI,CAAA;QACjB,CAAC;gBAAS,CAAC;YACV,YAAY,CAAC,KAAK,CAAC,CAAA;QACpB,CAAC;IACF,CAAC;CACD"}
package/out/rerank.d.ts CHANGED
@@ -98,7 +98,7 @@ export interface RerankOpts {
98
98
  *
99
99
  * **When every resolved candidate is implausible, the model's rank-1 wins.** A reranker that returns nothing is worse
100
100
  * than one that defers: "all my evidence says these are all bad" is not grounds to invent a different answer, only
101
- * grounds to flag low confidence (the Phase-4b ambiguity gate).
101
+ * grounds to flag low confidence (the Phase-4b ambiguity check).
102
102
  */
103
103
  export declare function rerankByResolution<T>(candidates: ReadonlyArray<RerankCandidate<T>>, resolveTree: ResolveTree, opts?: RerankOpts): Promise<RerankResult<T>>;
104
104
  //# sourceMappingURL=rerank.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rerank.d.ts","sourceRoot":"","sources":["../rerank.ts"],"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