@mailwoman/core 9.1.0 → 9.2.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 (371) hide show
  1. package/README.md +1 -1
  2. package/api/responses.ts +12 -0
  3. package/coarse-placer/featurize.ts +0 -2
  4. package/coarse-placer/tools/build-dataset.ts +1 -1
  5. package/coarse-placer/tools/build-outlier-exposure.ts +1 -1
  6. package/coarse-placer/tools/build-outlier-latin.ts +13 -7
  7. package/coarse-placer/tools/build-outlier-oa.ts +11 -5
  8. package/coarse-placer/tools/eval-latin-offmap.ts +3 -2
  9. package/coarse-placer/tools/eval-openset.ts +3 -2
  10. package/coarse-placer/tools/eval-quant-compare.ts +3 -2
  11. package/coarse-placer/tools/eval.ts +3 -2
  12. package/coarse-placer/tools/fnv-hash.ts +1 -6
  13. package/coarse-placer/tools/index.ts +1 -1
  14. package/coarse-placer/tools/probe-frontier.ts +3 -2
  15. package/coarse-placer/tools/quantize.ts +2 -2
  16. package/coarse-placer/tools/train.ts +2 -1
  17. package/crypto/node.ts +3 -1
  18. package/data/internal/dictionaries/languages.csv +184 -184
  19. package/data/libpostal/README.md +8 -2
  20. package/db/schema.ts +12 -3
  21. package/decoder/containment.ts +5 -1
  22. package/decoder/index.ts +1 -0
  23. package/decoder/parse-diff.ts +347 -0
  24. package/decoder/proposals-to-tree.ts +1 -1
  25. package/decoder/serialize-json.ts +51 -7
  26. package/decoder/serialize-tuples.ts +7 -1
  27. package/decoder/serialize-xml.ts +1 -1
  28. package/decoder/tree-shape.ts +144 -0
  29. package/decoder/types.ts +8 -0
  30. package/decoder/validate-tree.ts +15 -3
  31. package/env/index.ts +3 -1
  32. package/env/paths.ts +21 -33
  33. package/env/schema.ts +26 -3
  34. package/fs/utils/formatters.ts +107 -0
  35. package/fs/utils/index.ts +7 -0
  36. package/fs/zip.ts +1 -1
  37. package/layers/manifest.ts +56 -15
  38. package/layers/schema.ts +54 -2
  39. package/locale/locale.ts +1 -1
  40. package/locale/registry.ts +1 -1
  41. package/objects.ts +20 -8
  42. package/out/api/responses.d.ts +9 -0
  43. package/out/api/responses.d.ts.map +1 -1
  44. package/out/api/responses.js +11 -0
  45. package/out/api/responses.js.map +1 -1
  46. package/out/coarse-placer/featurize.d.ts +0 -1
  47. package/out/coarse-placer/featurize.d.ts.map +1 -1
  48. package/out/coarse-placer/featurize.js.map +1 -1
  49. package/out/coarse-placer/tools/build-dataset.js +1 -1
  50. package/out/coarse-placer/tools/build-dataset.js.map +1 -1
  51. package/out/coarse-placer/tools/build-outlier-exposure.js +1 -1
  52. package/out/coarse-placer/tools/build-outlier-exposure.js.map +1 -1
  53. package/out/coarse-placer/tools/build-outlier-latin.d.ts.map +1 -1
  54. package/out/coarse-placer/tools/build-outlier-latin.js +12 -7
  55. package/out/coarse-placer/tools/build-outlier-latin.js.map +1 -1
  56. package/out/coarse-placer/tools/build-outlier-oa.d.ts.map +1 -1
  57. package/out/coarse-placer/tools/build-outlier-oa.js +10 -5
  58. package/out/coarse-placer/tools/build-outlier-oa.js.map +1 -1
  59. package/out/coarse-placer/tools/eval-latin-offmap.d.ts.map +1 -1
  60. package/out/coarse-placer/tools/eval-latin-offmap.js +2 -2
  61. package/out/coarse-placer/tools/eval-latin-offmap.js.map +1 -1
  62. package/out/coarse-placer/tools/eval-openset.d.ts.map +1 -1
  63. package/out/coarse-placer/tools/eval-openset.js +2 -2
  64. package/out/coarse-placer/tools/eval-openset.js.map +1 -1
  65. package/out/coarse-placer/tools/eval-quant-compare.d.ts.map +1 -1
  66. package/out/coarse-placer/tools/eval-quant-compare.js +2 -2
  67. package/out/coarse-placer/tools/eval-quant-compare.js.map +1 -1
  68. package/out/coarse-placer/tools/eval.d.ts.map +1 -1
  69. package/out/coarse-placer/tools/eval.js +2 -2
  70. package/out/coarse-placer/tools/eval.js.map +1 -1
  71. package/out/coarse-placer/tools/fnv-hash.d.ts +1 -6
  72. package/out/coarse-placer/tools/fnv-hash.d.ts.map +1 -1
  73. package/out/coarse-placer/tools/fnv-hash.js +1 -6
  74. package/out/coarse-placer/tools/fnv-hash.js.map +1 -1
  75. package/out/coarse-placer/tools/index.d.ts +1 -1
  76. package/out/coarse-placer/tools/index.js +1 -1
  77. package/out/coarse-placer/tools/probe-frontier.d.ts.map +1 -1
  78. package/out/coarse-placer/tools/probe-frontier.js +2 -2
  79. package/out/coarse-placer/tools/probe-frontier.js.map +1 -1
  80. package/out/coarse-placer/tools/quantize.js +2 -2
  81. package/out/coarse-placer/tools/quantize.js.map +1 -1
  82. package/out/coarse-placer/tools/train.d.ts.map +1 -1
  83. package/out/coarse-placer/tools/train.js +1 -1
  84. package/out/coarse-placer/tools/train.js.map +1 -1
  85. package/out/crypto/node.d.ts.map +1 -1
  86. package/out/crypto/node.js +2 -1
  87. package/out/crypto/node.js.map +1 -1
  88. package/out/db/schema.d.ts +12 -3
  89. package/out/db/schema.d.ts.map +1 -1
  90. package/out/db/schema.js +6 -0
  91. package/out/db/schema.js.map +1 -1
  92. package/out/decoder/containment.d.ts.map +1 -1
  93. package/out/decoder/containment.js +5 -1
  94. package/out/decoder/containment.js.map +1 -1
  95. package/out/decoder/index.d.ts +1 -0
  96. package/out/decoder/index.d.ts.map +1 -1
  97. package/out/decoder/index.js +1 -0
  98. package/out/decoder/index.js.map +1 -1
  99. package/out/decoder/parse-diff.d.ts +125 -0
  100. package/out/decoder/parse-diff.d.ts.map +1 -0
  101. package/out/decoder/parse-diff.js +219 -0
  102. package/out/decoder/parse-diff.js.map +1 -0
  103. package/out/decoder/proposals-to-tree.js.map +1 -1
  104. package/out/decoder/serialize-json.d.ts +29 -0
  105. package/out/decoder/serialize-json.d.ts.map +1 -1
  106. package/out/decoder/serialize-json.js +20 -4
  107. package/out/decoder/serialize-json.js.map +1 -1
  108. package/out/decoder/serialize-tuples.d.ts +8 -1
  109. package/out/decoder/serialize-tuples.d.ts.map +1 -1
  110. package/out/decoder/serialize-tuples.js +7 -1
  111. package/out/decoder/serialize-tuples.js.map +1 -1
  112. package/out/decoder/serialize-xml.js +1 -1
  113. package/out/decoder/serialize-xml.js.map +1 -1
  114. package/out/decoder/tree-shape.d.ts +84 -0
  115. package/out/decoder/tree-shape.d.ts.map +1 -0
  116. package/out/decoder/tree-shape.js +98 -0
  117. package/out/decoder/tree-shape.js.map +1 -0
  118. package/out/decoder/types.d.ts +11 -0
  119. package/out/decoder/types.d.ts.map +1 -1
  120. package/out/decoder/validate-tree.d.ts +8 -0
  121. package/out/decoder/validate-tree.d.ts.map +1 -1
  122. package/out/decoder/validate-tree.js +4 -3
  123. package/out/decoder/validate-tree.js.map +1 -1
  124. package/out/env/index.d.ts +10 -1
  125. package/out/env/index.d.ts.map +1 -1
  126. package/out/env/index.js +2 -1
  127. package/out/env/index.js.map +1 -1
  128. package/out/env/paths.d.ts +15 -8
  129. package/out/env/paths.d.ts.map +1 -1
  130. package/out/env/paths.js +19 -29
  131. package/out/env/paths.js.map +1 -1
  132. package/out/env/schema.d.ts +9 -1
  133. package/out/env/schema.d.ts.map +1 -1
  134. package/out/env/schema.js +25 -3
  135. package/out/env/schema.js.map +1 -1
  136. package/out/fs/utils/formatters.d.ts +57 -0
  137. package/out/fs/utils/formatters.d.ts.map +1 -0
  138. package/out/fs/utils/formatters.js +79 -0
  139. package/out/fs/utils/formatters.js.map +1 -0
  140. package/out/fs/utils/index.d.ts +7 -0
  141. package/out/fs/utils/index.d.ts.map +1 -0
  142. package/out/fs/utils/index.js +7 -0
  143. package/out/fs/utils/index.js.map +1 -0
  144. package/out/fs/zip.js +1 -1
  145. package/out/fs/zip.js.map +1 -1
  146. package/out/layers/manifest.d.ts +32 -7
  147. package/out/layers/manifest.d.ts.map +1 -1
  148. package/out/layers/manifest.js +31 -6
  149. package/out/layers/manifest.js.map +1 -1
  150. package/out/layers/schema.d.ts +48 -2
  151. package/out/layers/schema.d.ts.map +1 -1
  152. package/out/layers/schema.js +32 -0
  153. package/out/layers/schema.js.map +1 -1
  154. package/out/locale/locale.d.ts +1 -1
  155. package/out/locale/locale.d.ts.map +1 -1
  156. package/out/locale/registry.js +1 -1
  157. package/out/locale/registry.js.map +1 -1
  158. package/out/objects.d.ts +12 -6
  159. package/out/objects.d.ts.map +1 -1
  160. package/out/objects.js +4 -1
  161. package/out/objects.js.map +1 -1
  162. package/out/pipeline/index.d.ts +2 -6
  163. package/out/pipeline/index.d.ts.map +1 -1
  164. package/out/pipeline/index.js +1 -3
  165. package/out/pipeline/index.js.map +1 -1
  166. package/out/pipeline/runtime-pipeline.d.ts +51 -9
  167. package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
  168. package/out/pipeline/runtime-pipeline.js +29 -132
  169. package/out/pipeline/runtime-pipeline.js.map +1 -1
  170. package/out/pipeline/span-proposer.js +1 -1
  171. package/out/pipeline/span-proposer.js.map +1 -1
  172. package/out/pipeline/types.d.ts +22 -14
  173. package/out/pipeline/types.d.ts.map +1 -1
  174. package/out/pipeline/types.js.map +1 -1
  175. package/out/policy/defaults.d.ts +1 -1
  176. package/out/policy/defaults.d.ts.map +1 -1
  177. package/out/policy/defaults.js +1 -1
  178. package/out/policy/defaults.js.map +1 -1
  179. package/out/policy/policy.d.ts +1 -1
  180. package/out/policy/policy.d.ts.map +1 -1
  181. package/out/policy/registry.d.ts +1 -1
  182. package/out/policy/registry.d.ts.map +1 -1
  183. package/out/resolver/coverage-facts.d.ts +89 -0
  184. package/out/resolver/coverage-facts.d.ts.map +1 -0
  185. package/out/resolver/coverage-facts.js +22 -0
  186. package/out/resolver/coverage-facts.js.map +1 -0
  187. package/out/resolver/index.d.ts +2 -1
  188. package/out/resolver/index.d.ts.map +1 -1
  189. package/out/resolver/index.js +1 -0
  190. package/out/resolver/index.js.map +1 -1
  191. package/out/resolver/lookup-types.d.ts +178 -0
  192. package/out/resolver/lookup-types.d.ts.map +1 -0
  193. package/out/resolver/lookup-types.js +11 -0
  194. package/out/resolver/lookup-types.js.map +1 -0
  195. package/out/resolver/placetype-map.d.ts +71 -0
  196. package/out/resolver/placetype-map.d.ts.map +1 -0
  197. package/out/resolver/placetype-map.js +98 -0
  198. package/out/resolver/placetype-map.js.map +1 -0
  199. package/out/resolver/postcode-format.d.ts +38 -0
  200. package/out/resolver/postcode-format.d.ts.map +1 -0
  201. package/out/resolver/postcode-format.js +83 -0
  202. package/out/resolver/postcode-format.js.map +1 -0
  203. package/out/resolver/types.d.ts +271 -297
  204. package/out/resolver/types.d.ts.map +1 -1
  205. package/out/resolver/types.js +4 -97
  206. package/out/resolver/types.js.map +1 -1
  207. package/out/resources/git.d.ts +8 -1
  208. package/out/resources/git.d.ts.map +1 -1
  209. package/out/resources/git.js +4 -3
  210. package/out/resources/git.js.map +1 -1
  211. package/out/resources/languages/types.gen.d.ts +1 -1
  212. package/out/resources/languages/types.gen.d.ts.map +1 -1
  213. package/out/resources/languages/types.gen.js +40 -0
  214. package/out/resources/languages/types.gen.js.map +1 -1
  215. package/out/resources/libpostal.d.ts +2 -2
  216. package/out/resources/libpostal.d.ts.map +1 -1
  217. package/out/resources/libpostal.js +2 -2
  218. package/out/resources/libpostal.js.map +1 -1
  219. package/out/resources/whosonfirst/DataSourceCache.d.ts.map +1 -1
  220. package/out/resources/whosonfirst/DataSourceCache.js.map +1 -1
  221. package/out/resources/whosonfirst/PlacetypeDataSource.d.ts +2 -2
  222. package/out/resources/whosonfirst/PlacetypeDataSource.d.ts.map +1 -1
  223. package/out/resources/whosonfirst/PlacetypeDataSource.js +28 -3
  224. package/out/resources/whosonfirst/PlacetypeDataSource.js.map +1 -1
  225. package/out/resources/whosonfirst/loader.d.ts +2 -2
  226. package/out/resources/whosonfirst/loader.d.ts.map +1 -1
  227. package/out/resources/whosonfirst/loader.js.map +1 -1
  228. package/out/resources/whosonfirst/placetypes/Placetype.d.ts.map +1 -1
  229. package/out/resources/whosonfirst/placetypes/Placetype.js +2 -2
  230. package/out/resources/whosonfirst/placetypes/Placetype.js.map +1 -1
  231. package/out/resources/whosonfirst/placetypes/admin.d.ts +9 -1
  232. package/out/resources/whosonfirst/placetypes/admin.d.ts.map +1 -1
  233. package/out/resources/whosonfirst/placetypes/admin.js +1 -1
  234. package/out/resources/whosonfirst/placetypes/admin.js.map +1 -1
  235. package/out/resources/whosonfirst/placetypes/definition.d.ts.map +1 -1
  236. package/out/resources/whosonfirst/placetypes/definition.js +1 -1
  237. package/out/resources/whosonfirst/placetypes/definition.js.map +1 -1
  238. package/out/resources/whosonfirst/placetypes/index.d.ts +1 -0
  239. package/out/resources/whosonfirst/placetypes/index.d.ts.map +1 -1
  240. package/out/resources/whosonfirst/placetypes/index.js +1 -0
  241. package/out/resources/whosonfirst/placetypes/index.js.map +1 -1
  242. package/out/resources/whosonfirst/placetypes/specificity.d.ts +65 -0
  243. package/out/resources/whosonfirst/placetypes/specificity.d.ts.map +1 -0
  244. package/out/resources/whosonfirst/placetypes/specificity.js +101 -0
  245. package/out/resources/whosonfirst/placetypes/specificity.js.map +1 -0
  246. package/out/resources/whosonfirst/sharded-repo.d.ts +28 -0
  247. package/out/resources/whosonfirst/sharded-repo.d.ts.map +1 -1
  248. package/out/resources/whosonfirst/sharded-repo.js +46 -2
  249. package/out/resources/whosonfirst/sharded-repo.js.map +1 -1
  250. package/out/scripting/arguments.d.ts +27 -0
  251. package/out/scripting/arguments.d.ts.map +1 -0
  252. package/out/scripting/arguments.js +32 -0
  253. package/out/scripting/arguments.js.map +1 -0
  254. package/out/scripting/command.d.ts +28 -0
  255. package/out/scripting/command.d.ts.map +1 -0
  256. package/out/scripting/command.js +47 -0
  257. package/out/scripting/command.js.map +1 -0
  258. package/out/scripting/index.js +3 -3
  259. package/out/scripting/index.js.map +1 -1
  260. package/out/scripting/utils/index.d.ts +1 -12
  261. package/out/scripting/utils/index.d.ts.map +1 -1
  262. package/out/scripting/utils/index.js +4 -21
  263. package/out/scripting/utils/index.js.map +1 -1
  264. package/out/tools/download-libpostal-resources.d.ts.map +1 -1
  265. package/out/tools/download-libpostal-resources.js +4 -7
  266. package/out/tools/download-libpostal-resources.js.map +1 -1
  267. package/out/tools/download-ssl-address.d.ts +3 -3
  268. package/out/tools/download-ssl-address.d.ts.map +1 -1
  269. package/out/tools/download-ssl-address.js +26 -13
  270. package/out/tools/download-ssl-address.js.map +1 -1
  271. package/out/tools/generate-language-types.d.ts +16 -1
  272. package/out/tools/generate-language-types.d.ts.map +1 -1
  273. package/out/tools/generate-language-types.js +38 -5
  274. package/out/tools/generate-language-types.js.map +1 -1
  275. package/out/tools/index.d.ts +1 -2
  276. package/out/tools/index.d.ts.map +1 -1
  277. package/out/tools/index.js +1 -2
  278. package/out/tools/index.js.map +1 -1
  279. package/out/utils/data-root.d.ts +27 -7
  280. package/out/utils/data-root.d.ts.map +1 -1
  281. package/out/utils/data-root.js +36 -13
  282. package/out/utils/data-root.js.map +1 -1
  283. package/out/utils/hash.d.ts +2 -3
  284. package/out/utils/hash.d.ts.map +1 -1
  285. package/out/utils/hash.js +3 -3
  286. package/out/utils/hash.js.map +1 -1
  287. package/out/utils/index.d.ts +1 -0
  288. package/out/utils/index.d.ts.map +1 -1
  289. package/out/utils/index.js +1 -0
  290. package/out/utils/index.js.map +1 -1
  291. package/out/utils/jsonl.js +1 -1
  292. package/out/utils/jsonl.js.map +1 -1
  293. package/out/utils/repo.d.ts +8 -0
  294. package/out/utils/repo.d.ts.map +1 -1
  295. package/out/utils/repo.js +10 -1
  296. package/out/utils/repo.js.map +1 -1
  297. package/out/utils/sealed-db.d.ts +11 -0
  298. package/out/utils/sealed-db.d.ts.map +1 -1
  299. package/out/utils/sealed-db.js +28 -1
  300. package/out/utils/sealed-db.js.map +1 -1
  301. package/out/utils/sqlite-rows.d.ts +34 -0
  302. package/out/utils/sqlite-rows.d.ts.map +1 -0
  303. package/out/utils/sqlite-rows.js +37 -0
  304. package/out/utils/sqlite-rows.js.map +1 -0
  305. package/out/utils/stats.d.ts +1 -6
  306. package/out/utils/stats.d.ts.map +1 -1
  307. package/out/utils/stats.js +1 -6
  308. package/out/utils/stats.js.map +1 -1
  309. package/package.json +476 -7
  310. package/pipeline/index.ts +12 -14
  311. package/pipeline/runtime-pipeline.ts +29 -183
  312. package/pipeline/span-proposer.ts +1 -1
  313. package/pipeline/types.ts +26 -15
  314. package/policy/defaults.ts +1 -1
  315. package/policy/policy.ts +1 -1
  316. package/policy/registry.ts +1 -1
  317. package/resolver/coverage-facts.ts +102 -0
  318. package/resolver/index.ts +5 -0
  319. package/resolver/lookup-types.ts +174 -0
  320. package/resolver/placetype-map.ts +122 -0
  321. package/resolver/postcode-format.ts +89 -0
  322. package/resolver/types.ts +293 -351
  323. package/resources/git.ts +18 -4
  324. package/resources/languages/types.gen.ts +60 -0
  325. package/resources/libpostal.ts +4 -3
  326. package/resources/whosonfirst/DataSourceCache.ts +2 -1
  327. package/resources/whosonfirst/PlacetypeDataSource.ts +36 -11
  328. package/resources/whosonfirst/loader.ts +3 -2
  329. package/resources/whosonfirst/placetypes/Placetype.ts +3 -2
  330. package/resources/whosonfirst/placetypes/admin.ts +11 -2
  331. package/resources/whosonfirst/placetypes/definition.ts +4 -3
  332. package/resources/whosonfirst/placetypes/index.ts +1 -0
  333. package/resources/whosonfirst/placetypes/specificity.ts +114 -0
  334. package/resources/whosonfirst/sharded-repo.ts +55 -2
  335. package/scripting/arguments.ts +38 -0
  336. package/scripting/command.ts +55 -0
  337. package/scripting/index.ts +3 -3
  338. package/scripting/utils/index.ts +6 -23
  339. package/tools/download-libpostal-resources.ts +4 -7
  340. package/tools/download-ssl-address.ts +28 -12
  341. package/tools/generate-language-types.ts +39 -5
  342. package/tools/index.ts +1 -2
  343. package/utils/data-root.ts +40 -14
  344. package/utils/hash.ts +5 -4
  345. package/utils/index.ts +1 -0
  346. package/utils/jsonl.ts +1 -1
  347. package/utils/repo.ts +12 -1
  348. package/utils/sealed-db.ts +30 -1
  349. package/utils/sqlite-rows.ts +40 -0
  350. package/utils/stats.ts +1 -6
  351. package/data/libpostal/dictionaries/all/chains.txt +0 -504
  352. package/kysley/adapter.ts +0 -29
  353. package/out/kysley/adapter.d.ts +0 -13
  354. package/out/kysley/adapter.d.ts.map +0 -1
  355. package/out/kysley/adapter.js +0 -25
  356. package/out/kysley/adapter.js.map +0 -1
  357. package/out/pipeline/reconcile-lookups.d.ts +0 -39
  358. package/out/pipeline/reconcile-lookups.d.ts.map +0 -1
  359. package/out/pipeline/reconcile-lookups.js +0 -88
  360. package/out/pipeline/reconcile-lookups.js.map +0 -1
  361. package/out/pipeline/reconcile.d.ts +0 -153
  362. package/out/pipeline/reconcile.d.ts.map +0 -1
  363. package/out/pipeline/reconcile.js +0 -388
  364. package/out/pipeline/reconcile.js.map +0 -1
  365. package/out/pipeline/span-logit-aggregation.d.ts +0 -58
  366. package/out/pipeline/span-logit-aggregation.d.ts.map +0 -1
  367. package/out/pipeline/span-logit-aggregation.js +0 -117
  368. package/out/pipeline/span-logit-aggregation.js.map +0 -1
  369. package/pipeline/reconcile-lookups.ts +0 -111
  370. package/pipeline/reconcile.ts +0 -583
  371. package/pipeline/span-logit-aggregation.ts +0 -156
@@ -12,16 +12,12 @@
12
12
  * Implementation contract per `docs/engineering/reference/STAGES.md`.
13
13
  */
14
14
 
15
+ import { isBareTreeOf } from "../decoder/tree-shape.ts"
15
16
  import type { AddressNode, AddressTree } from "../decoder/types.ts"
16
17
  import type { ComponentTag } from "../types/component.ts"
17
- import { prefetchReconcileLookups } from "./reconcile-lookups.ts"
18
- import type { ClassifierCandidate } from "./reconcile.ts"
19
- import { reconcileSpans } from "./reconcile.ts"
20
- import { aggregateSpanLogits } from "./span-logit-aggregation.ts"
21
18
  import { PipelineFaultStage, WORD_CONSISTENCY_SHIP_DEFAULT, deriveInputMode } from "./types.ts"
22
19
  import type {
23
20
  AddressClassifier,
24
- ClassifierOpts,
25
21
  FSTMatcherLike,
26
22
  InputMode,
27
23
  LocaleHint,
@@ -74,7 +70,7 @@ function isPostcodeFormat(format: string): boolean {
74
70
  * whole-string country guess is a broader, softer signal than a postcode that pins the country, so it blends more
75
71
  * gently with the candidate score.
76
72
  */
77
- const COARSE_PLACER_ANCHOR_WEIGHT = 1
73
+ export const COARSE_PLACER_ANCHOR_WEIGHT = 1
78
74
 
79
75
  /**
80
76
  * #194: minimum placer confidence to promote the soft country prior to a HARD filter (empty→unresolved). The placer
@@ -127,20 +123,20 @@ export const HARD_PLACE_COUNTRY_SAFELIST: ReadonlySet<string> = new Set([
127
123
  * runs as before.
128
124
  */
129
125
  export function isBareLocalityTree(tree: AddressTree): boolean {
130
- let sawLocality = false
131
- const stack = [...tree.roots]
132
-
133
- while (stack.length) {
134
- const node = stack.pop()!
135
-
136
- if (node.tag === "locality") {
137
- sawLocality = true
138
- } else if (node.value.trim() !== "") return false
139
-
140
- stack.push(...node.children)
141
- }
126
+ return isBareTreeOf(tree, "locality")
127
+ }
142
128
 
143
- return sawLocality
129
+ /**
130
+ * #1589's sibling of the #912 guard: true when the tree's ONLY value-bearing node is a `postcode`.
131
+ *
132
+ * A bare postcode under a locale-inferred country scope is the same disaster shape as a bare locality: `SW1A 1AA` under
133
+ * the default en-US locale gets a HARD `defaultCountry: "US"` that filters the GB postalcode row the gazetteer holds,
134
+ * and the query resolves to nothing — while the identical query under `--locale en-GB` answers 38 m from the rooftop.
135
+ * The postcode's own FORMAT is harder evidence than the locale hint (the #928 table's premise), so the caller withholds
136
+ * the inferred scope for this shape when the format implies countries that exclude it.
137
+ */
138
+ export function isBarePostcodeTree(tree: AddressTree): boolean {
139
+ return isBareTreeOf(tree, "postcode")
144
140
  }
145
141
 
146
142
  /**
@@ -475,104 +471,8 @@ export async function runPipeline(
475
471
  }
476
472
 
477
473
  let tree: AddressTree = { raw: normalized.normalized, roots: [] }
478
- // Captured from the joint-reconcile path so the grouper-audit can defer to the classifier's
479
- // per-span verdict on orphaned spans (see the assignment + grouperAudit below).
480
- let auditClassifierTopK: ClassifierCandidate[] | undefined
481
-
482
- // Joint-reconcile path: RETIRED AS DEFAULT 2026-06-14 (#427 promoted it; this de-promotes it).
483
- // A reconcile-vs-raw-neural audit on two non-circular US holdouts (Travis E-911 + 7-state
484
- // OpenAddresses) found it BREAKS the street+house_number geocode precondition on 77-84% of clean
485
- // US addresses and fixes 0% — the phrase grouper bundles the house number into the STREET_PHRASE
486
- // ("3075 Hill Street") and reconcileSpans then fuses the whole span into one node, leaving no
487
- // separate `street`. Confirmed on golden v0.1.2 US+FR (n=4507, per-tag recall vs raw argmax):
488
- // street -25.6pp, house_number -23.1pp, locality -2.3pp, venue -0.6pp, region/postcode/unit flat.
489
- // It is worse-or-flat on EVERY tag — including venue, the thing #427 promoted it for. The #427
490
- // re-gate's "DE +25pp / IT-ES +15pp" was loose street-STRING recall on OOD inputs (where raw
491
- // neural mangles the street); it never measured the geocode precondition our evals grade on raw
492
- // neural, so the regression was invisible. The destructive piece is the grouper HN-bundling (see
493
- // the tracked issue); until that's fixed, argmax is the correct default. Set `jointReconcile: true`
494
- // to opt back into reconcile (the A/B harnesses do). Report:
495
- // docs/articles/evals/experiments/2026-06-14-reconcile-retirement.md.
496
- const jointEnabled = opts?.jointReconcile ?? false
497
-
498
- const useJointReconcile =
499
- jointEnabled && phraseProposals.length > 0 && stages.classifier && "parseWithLogits" in stages.classifier
500
-
501
- if (useJointReconcile) {
502
- const classifierWithLogits = stages.classifier as AddressClassifier & {
503
- parseWithLogits: (
504
- text: string,
505
- opts?: ClassifierOpts
506
- ) => Promise<{ tree: AddressTree; logits: number[][]; pieces: Array<{ start: number; end: number }> }>
507
- }
508
-
509
- throwIfAborted(opts)
510
- const tClassify = performance.now()
511
-
512
- const {
513
- tree: argmaxTree,
514
- logits,
515
- pieces,
516
- } = await classifierWithLogits.parseWithLogits(normalized.normalized, {
517
- queryShape,
518
- fst: stages.fst,
519
- ...streetContextGateFor(stages),
520
- })
521
-
522
- timing["token-classify"] = performance.now() - tClassify
523
474
 
524
- throwIfAborted(opts)
525
- const tReconcile = performance.now()
526
-
527
- // The classifier must expose its label vocabulary so the aggregation can strip BIO prefixes.
528
- // NeuralAddressClassifier surfaces this as `cfg.labels` — extracted via structural typing here.
529
- const labels: readonly string[] =
530
- "labels" in classifierWithLogits ? (classifierWithLogits as unknown as { labels: readonly string[] }).labels : []
531
-
532
- const classifierTopK = aggregateSpanLogits(
533
- logits,
534
- pieces,
535
- phraseProposals.map((p) => ({ start: p.span.start, end: p.span.end })),
536
- { labels, text: normalized.normalized }
537
- )
538
-
539
- if (classifierTopK.length) {
540
- // Concordance axes (#478): when the caller wires a backend, one bounded pre-fetch
541
- // activates the resolver-candidate + parent-chain scoring the reconciler already
542
- // implements. Absent backend = classifier-only reconcile (byte-stable).
543
- // Country constraint from the locale gate's BCP-47 tag ("en-US" -> "US"); absent or
544
- // und-like tags pass no constraint (ranking alone decides — matches resolveTree's default).
545
- const localeCountry = locale.locale.split("-")[1]?.toUpperCase()
546
-
547
- const lookups = stages.resolverBackend
548
- ? await prefetchReconcileLookups(
549
- stages.resolverBackend,
550
- normalized.normalized,
551
- classifierTopK,
552
- localeCountry && localeCountry.length === 2 ? { defaultCountry: localeCountry } : {}
553
- )
554
- : undefined
555
-
556
- const result = reconcileSpans({
557
- raw: normalized.normalized,
558
- phraseProposals,
559
- classifierTopK,
560
- ...(lookups ? { resolverCandidates: lookups.resolverCandidates, parentChain: lookups.parentChain } : {}),
561
- })
562
-
563
- tree = result.tree
564
- // The reconciler can leave a span uncovered (e.g. it picked the single-token street
565
- // `Trento` over `Via Trento`, orphaning `Via`). The grouper-audit below would then promote
566
- // that orphan's LOCALITY_PHRASE proposal to a `locality` node — even though the classifier
567
- // confidently typed it `street`. Hand the audit the classifier's per-span verdict so it
568
- // respects that opinion instead of trusting the structural phrase kind (#425 re-gate).
569
- auditClassifierTopK = classifierTopK
570
- } else {
571
- tree = argmaxTree
572
- }
573
-
574
- timing["reconcile"] = performance.now() - tReconcile
575
- } else if (stages.classifier) {
475
+ if (stages.classifier) {
576
476
  throwIfAborted(opts)
577
477
  const tClassify = performance.now()
578
478
 
@@ -590,7 +490,7 @@ export async function runPipeline(
590
490
 
591
491
  if (phraseProposals.length && tree.roots.length >= 0) {
592
492
  const tAudit = performance.now()
593
- tree = grouperAudit(tree, phraseProposals, normalized.normalized, auditClassifierTopK)
493
+ tree = grouperAudit(tree, phraseProposals, normalized.normalized)
594
494
  timing["grouper-audit"] = performance.now() - tAudit
595
495
  }
596
496
 
@@ -600,7 +500,9 @@ export async function runPipeline(
600
500
 
601
501
  // #912 lever 1: the placer abstains on a single bare locality — strip ONLY the anchor it
602
502
  // added (a caller-supplied posterior was never overwritten and passes through untouched).
603
- if (placerAnchorApplied && isBareLocalityTree(tree)) {
503
+ // #1589: a bare POSTCODE abstains the same way — the code's format carries the country
504
+ // evidence, and the placer's language read of it is noise (see isBarePostcodeTree).
505
+ if (placerAnchorApplied && (isBareLocalityTree(tree) || isBarePostcodeTree(tree))) {
604
506
  effectiveOpts = opts
605
507
  }
606
508
 
@@ -709,7 +611,7 @@ async function safeClassify(
709
611
  * fragment-positive) without the emission prior (measured US-golden −48). Absent either matcher, the spread is `{}` and
710
612
  * the decode is byte-stable.
711
613
  */
712
- const ZEROED_MORPHOLOGY_OPTS = { biasScale: 0, dependentLocalityPenalty: 0 } as const
614
+ export const ZEROED_MORPHOLOGY_OPTS = { biasScale: 0, dependentLocalityPenalty: 0 } as const
713
615
 
714
616
  /**
715
617
  * D2 remediation (#1320, ROAD_TO_MAILWOMAN_V8_1_0 §5.2): the pipeline ships the gate at FULL suppression (0.0), not the
@@ -718,9 +620,9 @@ const ZEROED_MORPHOLOGY_OPTS = { biasScale: 0, dependentLocalityPenalty: 0 } as
718
620
  * fragment class byte-identical to 0.25 — the "some admin mass for the semi-markov decoder" rationale for 0.25 carried
719
621
  * no measured benefit at the pipeline level. Satisfies the D-rule (iron rule 6) ≥P0 clause for #1318.
720
622
  */
721
- const STREET_CONTEXT_POSITIVE_SCALE = 0
623
+ export const STREET_CONTEXT_POSITIVE_SCALE = 0
722
624
 
723
- function streetContextGateFor(stages: { fst?: FSTMatcherLike; streetMorphology?: FSTMatcherLike }): {
625
+ export function streetContextGateFor(stages: { fst?: FSTMatcherLike; streetMorphology?: FSTMatcherLike }): {
724
626
  fstStreetMorphology?: FSTMatcherLike
725
627
  fstStreetMorphologyOpts?: { biasScale: number; dependentLocalityPenalty: number }
726
628
  fstStreetContextPositiveScale?: number
@@ -771,19 +673,12 @@ const PHRASE_KIND_TO_TAG: ReadonlyMap<string, ComponentTag> = new Map([
771
673
  * classifier output, inject a provisional node using the grouper's structural hypothesis. This rescues spans the neural
772
674
  * model couldn't type — primarily venue text.
773
675
  *
774
- * When `classifierTopK` is supplied (the joint-reconcile path), the audit defers to the classifier's own verdict for
775
- * the orphaned span: if the classifier confidently typed it as a DIFFERENT component than the phrase kind, we inject
776
- * the classifier's tag rather than the structural guess. Without this, a reconciler that leaves a street-prefix word
777
- * like `Via` orphaned (because it picked the single `Trento` street span) would see the audit promote `Via`'s
778
- * LOCALITY_PHRASE to a spurious `locality` node — burying the real trailing city. The classifier said `street:0.73` for
779
- * `Via`; trust it (#425).
676
+ * The audit once took a classifier top-k and deferred to it on an orphaned span, and once suppressed a duplicate
677
+ * singleton tag. Both existed for the joint-reconcile path, which fed the only top-k that ever reached here and was
678
+ * removed in #1749; on the surviving argmax path the parameter was always `undefined`, so neither branch could fire.
679
+ * Removed rather than left as unreachable code — the #425 reasoning they encoded is in the retirement report.
780
680
  */
781
- export function grouperAudit(
782
- tree: AddressTree,
783
- proposals: PhraseProposal[],
784
- text: string,
785
- classifierTopK?: ClassifierCandidate[]
786
- ): AddressTree {
681
+ export function grouperAudit(tree: AddressTree, proposals: PhraseProposal[], text: string): AddressTree {
787
682
  if (!proposals.length) return tree
788
683
 
789
684
  const roots = [...tree.roots]
@@ -802,44 +697,6 @@ export function grouperAudit(
802
697
 
803
698
  collectNodes(roots)
804
699
 
805
- // Index the classifier's single best tag per exact span (start:end) so the audit can defer to it.
806
- const CLASSIFIER_OVERRIDE_MIN = 0.4
807
- const bestTagBySpan = new Map<string, { tag: ComponentTag; score: number }>()
808
-
809
- for (const c of classifierTopK ?? []) {
810
- const k = `${c.span.start}:${c.span.end}`
811
- const cur = bestTagBySpan.get(k)
812
-
813
- if (!cur || c.score > cur.score) {
814
- bestTagBySpan.set(k, { tag: c.tag, score: c.score })
815
- }
816
- }
817
-
818
- // Tags that may appear AT MOST ONCE per address. On the joint path, the reconciler has already
819
- // placed the confident locality/region/postcode; a SECOND one injected here is almost always a
820
- // street-name word the OOD model mistyped ("Via Francesca Nord" → `Francesca`) or an area-line
821
- // prefix ("LUGAR …" / "URBANIZACION …"). Suppressing the duplicate keeps the real trailing city
822
- // from being shadowed by an earlier-positioned spurious node in `decodeAsJSON` (#425 residual tail).
823
- const SINGLETON_TAGS: ReadonlySet<ComponentTag> = new Set<ComponentTag>(["locality", "region", "postcode", "country"])
824
- const presentSingletons = new Set<ComponentTag>()
825
-
826
- const collectSingletons = (nodes: typeof roots): void => {
827
- for (const n of nodes) {
828
- if (SINGLETON_TAGS.has(n.tag)) {
829
- presentSingletons.add(n.tag)
830
- }
831
-
832
- if (n.children) {
833
- collectSingletons(n.children as typeof roots)
834
- }
835
- }
836
- }
837
-
838
- collectSingletons(roots)
839
- const dedupeSingletons = classifierTopK !== undefined
840
-
841
- // joint path only — argmax stays byte-stable
842
-
843
700
  for (const proposal of proposals) {
844
701
  const phraseTag = PHRASE_KIND_TO_TAG.get(proposal.kindHypothesis)
845
702
 
@@ -852,14 +709,7 @@ export function grouperAudit(
852
709
 
853
710
  if (covered) continue
854
711
 
855
- // Defer to the classifier when it confidently typed this exact span as something else.
856
- const classifierVerdict = bestTagBySpan.get(`${proposal.span.start}:${proposal.span.end}`)
857
-
858
- const tag =
859
- classifierVerdict && classifierVerdict.score >= CLASSIFIER_OVERRIDE_MIN ? classifierVerdict.tag : phraseTag
860
-
861
- // Don't inject a second singleton-tag node when the reconciler already produced one.
862
- if (dedupeSingletons && SINGLETON_TAGS.has(tag) && presentSingletons.has(tag)) continue
712
+ const tag = phraseTag
863
713
 
864
714
  const provisionalNode: AddressNode = {
865
715
  tag,
@@ -873,10 +723,6 @@ export function grouperAudit(
873
723
  }
874
724
 
875
725
  roots.push(provisionalNode)
876
-
877
- if (SINGLETON_TAGS.has(tag)) {
878
- presentSingletons.add(tag)
879
- }
880
726
  }
881
727
 
882
728
  roots.sort((a, b) => a.start - b.start)
@@ -286,7 +286,7 @@ function findSameCharPairs(text: string, ch: string): Array<{ open: number; clos
286
286
  * - Everything else (capitalized mid-string: "[Building A]", "(The White House)") → moderate.
287
287
  */
288
288
  function annotationConfidence(content: string, atEndOfInput: boolean, lexicon: SpanProposerLexicon): number {
289
- const tokens = content.split(/\s+/).filter(Boolean)
289
+ const tokens = content.split(/\s+/).filter((value) => value.length > 0)
290
290
 
291
291
  if (!tokens.length) return 0
292
292
 
package/pipeline/types.ts CHANGED
@@ -19,6 +19,14 @@ import type { Section } from "../types/classifier.ts"
19
19
 
20
20
  export type LocaleTag = string
21
21
 
22
+ /**
23
+ * Independent host/browser preferences. A timezone is evidence, never a locale conversion.
24
+ */
25
+ export interface MachinePreferences {
26
+ locale?: LocaleTag
27
+ timeZone?: string
28
+ }
29
+
22
30
  /**
23
31
  * Optional user-location signal for Stage 6 resolver scoring.
24
32
  */
@@ -51,19 +59,6 @@ export interface PipelineOpts {
51
59
  * still takes the poi branch regardless of this flag.
52
60
  */
53
61
  forceFullPipeline?: boolean
54
- /**
55
- * The joint-reconcile path (Stage 5 beam search). Promoted to default by Route A Phase II (#427), then RETIRED AS
56
- * DEFAULT 2026-06-14: a reconcile-vs-raw-neural audit found it breaks the street+house_number geocode precondition on
57
- * 77-84% of clean US addresses (golden v0.1.2 US+FR, n=4507: street -25.6pp, house_number -23.1pp; worse-or-flat on
58
- * every tag, venue included). The phrase grouper bundles the house number into the STREET_PHRASE and reconcileSpans
59
- * fuses the span. The #427 "DE +25pp" gains were loose street-string recall on OOD inputs, not the geocode
60
- * precondition. Default (unset) is now `false` (argmax). It still requires a phrase grouper + a classifier exposing
61
- * `parseWithLogits`; when either is absent the pipeline uses argmax regardless.
62
- *
63
- * Set `jointReconcile: true` to opt back into reconcile (the A/B harnesses do). Report:
64
- * docs/articles/evals/experiments/2026-06-14-reconcile-retirement.md.
65
- */
66
- jointReconcile?: boolean
67
62
  /**
68
63
  * Hard cap on lookups the resolver may issue; passed through.
69
64
  */
@@ -136,7 +131,15 @@ export interface LocaleHint {
136
131
  locale: LocaleTag
137
132
  confidence: number
138
133
  alternatives: ReadonlyArray<{ locale: LocaleTag; confidence: number }>
139
- source: "caller" | "detected" | "ensemble"
134
+ source: "caller" | "environment" | "machine" | "detected" | "ensemble"
135
+ /**
136
+ * Diagnostic provenance for inferred preferences. Locale and timezone remain independent signals.
137
+ */
138
+ evidence?: {
139
+ intlLocale?: string
140
+ timeZone?: string
141
+ environmentLocale?: string
142
+ }
140
143
  }
141
144
 
142
145
  /**
@@ -303,6 +306,10 @@ export interface POIIntent {
303
306
  | { kind: "category"; categoryID: string; matched: string }
304
307
  | { kind: "brand"; name: string; wikidata?: string; matched: string }
305
308
  | { kind: "name"; text: string }
309
+ /**
310
+ * The relation crossing from the recognized subject span to the anchor span.
311
+ */
312
+ relation?: "comma" | "near" | "in" | "at" | "around" | "to"
306
313
  /**
307
314
  * Spatial anchor: the split-off remainder text and its parse, when the query carried one.
308
315
  */
@@ -487,7 +494,11 @@ export interface AddressClassifier {
487
494
  export interface RuntimePipelineStages {
488
495
  normalize?: (raw: string, opts?: { locale?: string }) => NormalizedInputLite
489
496
  computeQueryShape?: (input: NormalizedInputLite | string, opts?: { locale?: string }) => QueryShapeLite
490
- detectLocale?: (input: NormalizedInputLite, shape: QueryShapeLite, opts?: { hint?: LocaleTag }) => Promise<LocaleHint>
497
+ detectLocale?: (
498
+ input: NormalizedInputLite,
499
+ shape: QueryShapeLite,
500
+ opts?: { hint?: LocaleTag; machinePreferences?: MachinePreferences; environmentLocale?: LocaleTag }
501
+ ) => Promise<LocaleHint>
491
502
  classifyKind?: (input: NormalizedInputLite, shape: QueryShapeLite, locale: LocaleHint) => Promise<QueryKindResult>
492
503
  /**
493
504
  * Coarse country router (#244). A `(normalizedText) → { country, confidence, posterior? }` predictor (a
@@ -8,7 +8,7 @@
8
8
  * edits one entry here with a commit-message rationale.
9
9
  */
10
10
 
11
- import { COMPONENT_TAGS, type ComponentTag } from "@mailwoman/core/types"
11
+ import { COMPONENT_TAGS, type ComponentTag } from "#types"
12
12
 
13
13
  import type { ClassifierPolicy, PolicyMode } from "./policy.ts"
14
14
 
package/policy/policy.ts CHANGED
@@ -9,7 +9,7 @@
9
9
  * neural-backed modes happen one component at a time, gated on golden-set metrics.
10
10
  */
11
11
 
12
- import type { ClassificationProposal, ComponentTag } from "@mailwoman/core/types"
12
+ import type { ClassificationProposal, ComponentTag } from "#types"
13
13
 
14
14
  /**
15
15
  * How a component is sourced.
@@ -10,7 +10,7 @@
10
10
  * per-locale overrides at startup. Look-up and `apply` are pure.
11
11
  */
12
12
 
13
- import type { ClassificationProposal, ComponentTag } from "@mailwoman/core/types"
13
+ import type { ClassificationProposal, ComponentTag } from "#types"
14
14
 
15
15
  import { buildDefaultPolicies, defaultPolicyFor } from "./defaults.ts"
16
16
  import type { ClassifierPolicy, PolicyMode, PolicyRegistry } from "./policy.ts"
@@ -0,0 +1,102 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * What a loaded gazetteer artifact declares about its own country coverage, and the one derivation the
7
+ * reader and the build share. A country ABSENT from a coverage map was never measured — never measured and
8
+ * failed; the failed case is present with `hardFilterSafe: false`.
9
+ */
10
+
11
+ /**
12
+ * One country's measured hard-filter coverage fact, as recorded at a promote gate. Facts about the gazetteer artifact
13
+ * live IN the artifact (the `country_coverage` table the gazetteer build emits) — code constants are only the fallback
14
+ * for artifacts that predate the manifest.
15
+ *
16
+ * Meaning-of-zero discipline: a country ABSENT from the coverage map was never measured — never "measured and failed".
17
+ * A measured-and-failed country is PRESENT with `hardFilterSafe: false` (e.g. FI at 69.5% hard-resolve), so the
18
+ * negative result is a first-class record, distinguishable from ignorance.
19
+ */
20
+ export interface CountryCoverageFact {
21
+ /**
22
+ * ISO 3166-1 alpha-2, uppercase.
23
+ */
24
+ country: string
25
+ /**
26
+ * The promote-gate VERDICT: hard-filtering this country is a pure win (a hard-filter miss is almost always a genuine
27
+ * non-match, not a coverage gap). Stored as a verdict — not re-derived from `hardResolveRate` at read time — because
28
+ * the gate is a judgment over a panel, not a pure rate function (CA cleared at the #928 promote on the
29
+ * postcode-format-prior rationale despite a sub-95% panel resolve rate).
30
+ */
31
+ hardFilterSafe: boolean
32
+ /**
33
+ * Measured hard-resolve rate (0..1) on the panel named in `source`, when the receipt recorded one.
34
+ */
35
+ hardResolveRate?: number
36
+ /**
37
+ * Panel size behind `hardResolveRate`, when recorded.
38
+ */
39
+ sampleSize?: number
40
+ /**
41
+ * ISO-8601 date of the measurement / promote gate.
42
+ */
43
+ measuredAt: string
44
+ /**
45
+ * The receipt: which panel/gate produced this row (issue + date, human-readable).
46
+ */
47
+ source: string
48
+ }
49
+
50
+ /**
51
+ * One country's coarse guard-B bounding box, as carried by the gazetteer artifact's `country_bbox` table.
52
+ */
53
+ export interface CountryBBoxFact {
54
+ /**
55
+ * ISO 3166-1 alpha-2, uppercase.
56
+ */
57
+ country: string
58
+ latMin: number
59
+ latMax: number
60
+ lonMin: number
61
+ lonMax: number
62
+ /**
63
+ * Provenance of the box (harness + date).
64
+ */
65
+ source: string
66
+ }
67
+
68
+ /**
69
+ * Facts a loaded gazetteer artifact declares about itself — read from the artifact's own manifest tables at open time,
70
+ * carried on the {@link ResolverBackend}/{@link Resolver} handle so consumers read the facts from the artifact they are
71
+ * actually resolving against. `undefined` on the handle = the artifact predates the manifest → consumers fall back to
72
+ * the code constants (byte-identical legacy behavior).
73
+ */
74
+ export interface GazetteerArtifactCoverage {
75
+ /**
76
+ * Country → measured coverage fact. ABSENCE = never measured (meaning-of-zero), never "failed".
77
+ */
78
+ countryCoverage: ReadonlyMap<string, CountryCoverageFact>
79
+ /**
80
+ * Country → guard-B bbox. ABSENCE = no box → the plausibility guard fails open for that country.
81
+ */
82
+ countryBBoxes: ReadonlyMap<string, CountryBBoxFact>
83
+ /**
84
+ * Derived at load: the countries whose fact says `hardFilterSafe` — the artifact's hard-country safelist.
85
+ */
86
+ hardCountrySafelist: ReadonlySet<string>
87
+ }
88
+
89
+ /**
90
+ * Derive the hard-country safelist from coverage facts — the ONE derivation both the reader and the build share.
91
+ */
92
+ export function hardCountrySafelistFromCoverage(facts: Iterable<CountryCoverageFact>): ReadonlySet<string> {
93
+ const out = new Set<string>()
94
+
95
+ for (const fact of facts) {
96
+ if (fact.hardFilterSafe) {
97
+ out.add(fact.country.toUpperCase())
98
+ }
99
+ }
100
+
101
+ return out
102
+ }
package/resolver/index.ts CHANGED
@@ -21,6 +21,8 @@ export {
21
21
 
22
22
  export type { ReferentiallyRankable } from "./referential.ts"
23
23
 
24
+ export { countriesFromPostcodeFormat, countryFromPostcodeFormat, POSTCODE_FORMAT_COUNTRY } from "./postcode-format.ts"
25
+
24
26
  export {
25
27
  DEFAULT_PLACETYPE_MAP,
26
28
  PLACETYPE_FILTER_GROUPS,
@@ -33,6 +35,7 @@ export type {
33
35
  AddressPointHit,
34
36
  AddressPointLookup,
35
37
  Ancestor,
38
+ BackendCapabilityGap,
36
39
  CoincidentLocality,
37
40
  CountryBBoxFact,
38
41
  CountryCoverageFact,
@@ -43,6 +46,8 @@ export type {
43
46
  PostcodePrefixAncestor,
44
47
  PostcodePrefixIndexLike,
45
48
  PostcodePrefixNode,
49
+ ResolveCandidateTrace,
50
+ ResolveNodeTrace,
46
51
  ResolveOpts,
47
52
  ResolvedPlace,
48
53
  Resolver,