@mailwoman/core 11.1.0 → 11.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 (477) hide show
  1. package/README.md +2 -2
  2. package/lib/api/arcgis.ts +194 -0
  3. package/lib/api/ckan.ts +1 -1
  4. package/lib/api/disk-storage.ts +2 -2
  5. package/lib/api/ogc.ts +1 -1
  6. package/lib/api/retry.ts +7 -2
  7. package/lib/api/test/transport.ts +1 -1
  8. package/lib/{binary-frame.ts → asset/binary-frame.ts} +1 -1
  9. package/lib/async/abort.ts +100 -0
  10. package/lib/{memoize.ts → async/memoize.ts} +2 -2
  11. package/lib/{promises.ts → async/promises.ts} +1 -1
  12. package/lib/cloudflare/tokens.ts +1 -1
  13. package/lib/cloudflare/wrangler.ts +3 -3
  14. package/lib/crypto/digest.ts +1 -1
  15. package/lib/crypto/ed25519.ts +8 -0
  16. package/lib/crypto/node.ts +1 -1
  17. package/lib/data-root.ts +16 -3
  18. package/lib/decoder/containment.ts +4 -1
  19. package/lib/decoder/serialize/outline.ts +50 -0
  20. package/lib/decoder/types.ts +9 -1
  21. package/lib/decoder.ts +1 -0
  22. package/lib/env/schema.ts +5 -0
  23. package/lib/fs/deflate64.ts +1 -1
  24. package/lib/fs/lock.ts +183 -25
  25. package/lib/fs/readers.ts +1 -1
  26. package/lib/fs/writers.ts +1 -1
  27. package/lib/geocode/result.ts +50 -6
  28. package/lib/html/text.ts +2 -2
  29. package/lib/index.ts +0 -1
  30. package/lib/layers/artifact.ts +2 -2
  31. package/lib/layers/coverage.ts +1 -1
  32. package/lib/layers/manifest.ts +94 -2
  33. package/lib/layers/provenance.ts +246 -0
  34. package/lib/layers/publication.ts +4 -3
  35. package/lib/layers/selection.ts +2 -2
  36. package/lib/license/branch.ts +66 -0
  37. package/lib/license/configured.ts +4 -2
  38. package/lib/license/declaration.ts +1 -1
  39. package/lib/license/key/file.ts +1 -1
  40. package/lib/license/key.ts +148 -201
  41. package/lib/license/provenance.ts +193 -0
  42. package/lib/license/register.ts +7 -78
  43. package/lib/license/stamp.ts +8 -2
  44. package/lib/license/text-url.ts +55 -0
  45. package/lib/license/training.ts +67 -0
  46. package/lib/license.ts +7 -6
  47. package/lib/locale/registry.ts +1 -1
  48. package/lib/locale/zh-cn-units.ts +1 -1
  49. package/lib/module/workspace.ts +1 -1
  50. package/lib/{routing.ts → network/routing.ts} +1 -1
  51. package/lib/pipeline/result.ts +7 -27
  52. package/lib/pipeline/runtime-pipeline.ts +131 -152
  53. package/lib/pipeline/stage.ts +290 -0
  54. package/lib/pipeline/types.ts +154 -20
  55. package/lib/pipeline.ts +14 -2
  56. package/lib/{git.ts → repo/git.ts} +21 -1
  57. package/lib/{release-config.ts → repo/release-config.ts} +8 -0
  58. package/lib/{scope-config.ts → repo/scope-config.ts} +8 -36
  59. package/lib/{spdx-header.ts → repo/spdx-header.ts} +8 -0
  60. package/lib/{workspaces.ts → repo/workspaces.ts} +1 -1
  61. package/lib/resolver/lookup-types.ts +1 -1
  62. package/lib/resolver/region-database-provider.ts +33 -0
  63. package/lib/resolver/synthetic-id-ranges.ts +76 -4
  64. package/lib/resolver/types.ts +231 -6
  65. package/lib/resolver.ts +14 -1
  66. package/lib/state-machine.ts +1 -1
  67. package/lib/strings/python-json.ts +15 -5
  68. package/lib/tokenization/Span.ts +12 -0
  69. package/lib/utils/chunk-process.ts +2 -2
  70. package/lib/utils/geodatabase-archive.ts +1 -1
  71. package/lib/utils/time.ts +190 -6
  72. package/lib/utils.ts +4 -4
  73. package/out/api/arcgis.d.ts +76 -0
  74. package/out/api/arcgis.d.ts.map +1 -1
  75. package/out/api/arcgis.js +123 -0
  76. package/out/api/arcgis.js.map +1 -1
  77. package/out/api/ckan.js +1 -1
  78. package/out/api/ckan.js.map +1 -1
  79. package/out/api/disk-storage.d.ts.map +1 -1
  80. package/out/api/disk-storage.js +2 -2
  81. package/out/api/disk-storage.js.map +1 -1
  82. package/out/api/ogc.js +1 -1
  83. package/out/api/ogc.js.map +1 -1
  84. package/out/api/retry.d.ts.map +1 -1
  85. package/out/api/retry.js +6 -2
  86. package/out/api/retry.js.map +1 -1
  87. package/out/api/test/transport.js +1 -1
  88. package/out/api/test/transport.js.map +1 -1
  89. package/out/asset/binary-frame.d.ts.map +1 -0
  90. package/out/{binary-frame.js → asset/binary-frame.js} +1 -1
  91. package/out/asset/binary-frame.js.map +1 -0
  92. package/out/asset/load-ledger.d.ts.map +1 -0
  93. package/out/asset/load-ledger.js.map +1 -0
  94. package/out/asset/overture-pins.d.ts.map +1 -0
  95. package/out/asset/overture-pins.js.map +1 -0
  96. package/out/asset/postcode-prefix-files.d.ts.map +1 -0
  97. package/out/asset/postcode-prefix-files.js.map +1 -0
  98. package/out/async/abort.d.ts +57 -0
  99. package/out/async/abort.d.ts.map +1 -0
  100. package/out/async/abort.js +89 -0
  101. package/out/async/abort.js.map +1 -0
  102. package/out/async/memoize.d.ts.map +1 -0
  103. package/out/{memoize.js → async/memoize.js} +2 -2
  104. package/out/async/memoize.js.map +1 -0
  105. package/out/{promises.d.ts → async/promises.d.ts} +1 -1
  106. package/out/async/promises.d.ts.map +1 -0
  107. package/out/{promises.js → async/promises.js} +1 -1
  108. package/out/async/promises.js.map +1 -0
  109. package/out/cloudflare/tokens.js +1 -1
  110. package/out/cloudflare/tokens.js.map +1 -1
  111. package/out/cloudflare/wrangler.js +3 -3
  112. package/out/cloudflare/wrangler.js.map +1 -1
  113. package/out/crypto/digest.d.ts +1 -1
  114. package/out/crypto/digest.js +1 -1
  115. package/out/crypto/ed25519.d.ts +7 -0
  116. package/out/crypto/ed25519.d.ts.map +1 -1
  117. package/out/crypto/ed25519.js +7 -0
  118. package/out/crypto/ed25519.js.map +1 -1
  119. package/out/crypto/hash.d.ts.map +1 -0
  120. package/out/crypto/hash.js.map +1 -0
  121. package/out/crypto/node.js +1 -1
  122. package/out/crypto/node.js.map +1 -1
  123. package/out/data-root.d.ts +11 -3
  124. package/out/data-root.d.ts.map +1 -1
  125. package/out/data-root.js +14 -3
  126. package/out/data-root.js.map +1 -1
  127. package/out/decoder/containment.d.ts.map +1 -1
  128. package/out/decoder/containment.js +1 -1
  129. package/out/decoder/containment.js.map +1 -1
  130. package/out/decoder/serialize/outline.d.ts +25 -0
  131. package/out/decoder/serialize/outline.d.ts.map +1 -0
  132. package/out/decoder/serialize/outline.js +37 -0
  133. package/out/decoder/serialize/outline.js.map +1 -0
  134. package/out/decoder/types.d.ts +8 -0
  135. package/out/decoder/types.d.ts.map +1 -1
  136. package/out/decoder/types.js +1 -1
  137. package/out/decoder/types.js.map +1 -1
  138. package/out/decoder.d.ts +1 -0
  139. package/out/decoder.d.ts.map +1 -1
  140. package/out/decoder.js +1 -0
  141. package/out/decoder.js.map +1 -1
  142. package/out/env/schema.d.ts +1 -0
  143. package/out/env/schema.d.ts.map +1 -1
  144. package/out/env/schema.js +4 -0
  145. package/out/env/schema.js.map +1 -1
  146. package/out/env.d.ts +1 -0
  147. package/out/env.d.ts.map +1 -1
  148. package/out/fs/deflate64.js +1 -1
  149. package/out/fs/deflate64.js.map +1 -1
  150. package/out/fs/lock.d.ts +73 -4
  151. package/out/fs/lock.d.ts.map +1 -1
  152. package/out/fs/lock.js +96 -19
  153. package/out/fs/lock.js.map +1 -1
  154. package/out/fs/readers.js +1 -1
  155. package/out/fs/readers.js.map +1 -1
  156. package/out/fs/writers.d.ts +1 -1
  157. package/out/fs/writers.d.ts.map +1 -1
  158. package/out/fs/writers.js +1 -1
  159. package/out/fs/writers.js.map +1 -1
  160. package/out/geocode/result.d.ts +25 -1
  161. package/out/geocode/result.d.ts.map +1 -1
  162. package/out/geocode/result.js +49 -6
  163. package/out/geocode/result.js.map +1 -1
  164. package/out/html/text.js +2 -2
  165. package/out/html/trust-policies.d.ts.map +1 -0
  166. package/out/html/trust-policies.js.map +1 -0
  167. package/out/index.d.ts +0 -1
  168. package/out/index.d.ts.map +1 -1
  169. package/out/index.js +0 -1
  170. package/out/index.js.map +1 -1
  171. package/out/layers/artifact.js +2 -2
  172. package/out/layers/artifact.js.map +1 -1
  173. package/out/layers/coverage.d.ts.map +1 -1
  174. package/out/layers/coverage.js +1 -1
  175. package/out/layers/coverage.js.map +1 -1
  176. package/out/layers/manifest.d.ts +53 -0
  177. package/out/layers/manifest.d.ts.map +1 -1
  178. package/out/layers/manifest.js +68 -2
  179. package/out/layers/manifest.js.map +1 -1
  180. package/out/layers/provenance.d.ts +127 -0
  181. package/out/layers/provenance.d.ts.map +1 -0
  182. package/out/layers/provenance.js +122 -0
  183. package/out/layers/provenance.js.map +1 -0
  184. package/out/layers/publication.d.ts.map +1 -1
  185. package/out/layers/publication.js +3 -3
  186. package/out/layers/publication.js.map +1 -1
  187. package/out/layers/selection.d.ts.map +1 -1
  188. package/out/layers/selection.js +2 -2
  189. package/out/layers/selection.js.map +1 -1
  190. package/out/license/branch.d.ts +33 -0
  191. package/out/license/branch.d.ts.map +1 -0
  192. package/out/license/branch.js +52 -0
  193. package/out/license/branch.js.map +1 -0
  194. package/out/license/configured.d.ts +1 -1
  195. package/out/license/configured.d.ts.map +1 -1
  196. package/out/license/configured.js +1 -9
  197. package/out/license/configured.js.map +1 -1
  198. package/out/license/declaration.d.ts +1 -1
  199. package/out/license/declaration.d.ts.map +1 -1
  200. package/out/license/key/file.js +1 -1
  201. package/out/license/key/file.js.map +1 -1
  202. package/out/license/key.d.ts +27 -115
  203. package/out/license/key.d.ts.map +1 -1
  204. package/out/license/key.js +98 -164
  205. package/out/license/key.js.map +1 -1
  206. package/out/license/provenance.d.ts +47 -0
  207. package/out/license/provenance.d.ts.map +1 -0
  208. package/out/license/provenance.js +134 -0
  209. package/out/license/provenance.js.map +1 -0
  210. package/out/license/register.d.ts +6 -47
  211. package/out/license/register.d.ts.map +1 -1
  212. package/out/license/register.js +7 -58
  213. package/out/license/register.js.map +1 -1
  214. package/out/license/stamp.d.ts +7 -1
  215. package/out/license/stamp.d.ts.map +1 -1
  216. package/out/license/stamp.js +2 -2
  217. package/out/license/stamp.js.map +1 -1
  218. package/out/license/text-url.d.ts +9 -0
  219. package/out/license/text-url.d.ts.map +1 -0
  220. package/out/license/text-url.js +49 -0
  221. package/out/license/text-url.js.map +1 -0
  222. package/out/license/training.d.ts +29 -0
  223. package/out/license/training.d.ts.map +1 -0
  224. package/out/license/training.js +52 -0
  225. package/out/license/training.js.map +1 -0
  226. package/out/license.d.ts +7 -6
  227. package/out/license.d.ts.map +1 -1
  228. package/out/license.js +7 -6
  229. package/out/license.js.map +1 -1
  230. package/out/locale/registry.d.ts.map +1 -1
  231. package/out/locale/registry.js +1 -1
  232. package/out/locale/registry.js.map +1 -1
  233. package/out/locale/zh-cn-units.js +1 -1
  234. package/out/locale/zh-cn-units.js.map +1 -1
  235. package/out/math/numeric.d.ts.map +1 -0
  236. package/out/math/numeric.js.map +1 -0
  237. package/out/math/random.d.ts.map +1 -0
  238. package/out/math/random.js.map +1 -0
  239. package/out/math/stats.d.ts.map +1 -0
  240. package/out/math/stats.js.map +1 -0
  241. package/out/module/workspace.js +1 -1
  242. package/out/module/workspace.js.map +1 -1
  243. package/out/network/routing.d.ts.map +1 -0
  244. package/out/{routing.js → network/routing.js} +1 -1
  245. package/out/network/routing.js.map +1 -0
  246. package/out/pipeline/result.d.ts +7 -25
  247. package/out/pipeline/result.d.ts.map +1 -1
  248. package/out/pipeline/runtime-pipeline.d.ts +8 -4
  249. package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
  250. package/out/pipeline/runtime-pipeline.js +56 -109
  251. package/out/pipeline/runtime-pipeline.js.map +1 -1
  252. package/out/pipeline/stage.d.ts +180 -0
  253. package/out/pipeline/stage.d.ts.map +1 -0
  254. package/out/pipeline/stage.js +130 -0
  255. package/out/pipeline/stage.js.map +1 -0
  256. package/out/pipeline/types.d.ts +146 -20
  257. package/out/pipeline/types.d.ts.map +1 -1
  258. package/out/pipeline/types.js +24 -8
  259. package/out/pipeline/types.js.map +1 -1
  260. package/out/pipeline.d.ts +5 -3
  261. package/out/pipeline.d.ts.map +1 -1
  262. package/out/pipeline.js +2 -1
  263. package/out/pipeline.js.map +1 -1
  264. package/out/{git.d.ts → repo/git.d.ts} +10 -1
  265. package/out/repo/git.d.ts.map +1 -0
  266. package/out/{git.js → repo/git.js} +14 -1
  267. package/out/repo/git.js.map +1 -0
  268. package/out/{release-config.d.ts → repo/release-config.d.ts} +8 -0
  269. package/out/repo/release-config.d.ts.map +1 -0
  270. package/out/repo/release-config.js.map +1 -0
  271. package/out/{scope-config.d.ts → repo/scope-config.d.ts} +8 -23
  272. package/out/repo/scope-config.d.ts.map +1 -0
  273. package/out/{scope-config.js → repo/scope-config.js} +0 -17
  274. package/out/repo/scope-config.js.map +1 -0
  275. package/out/repo/spdx-header.d.ts.map +1 -0
  276. package/out/{spdx-header.js → repo/spdx-header.js} +7 -0
  277. package/out/repo/spdx-header.js.map +1 -0
  278. package/out/repo/vale.d.ts.map +1 -0
  279. package/out/repo/vale.js.map +1 -0
  280. package/out/repo/workspaces.d.ts.map +1 -0
  281. package/out/{workspaces.js → repo/workspaces.js} +1 -1
  282. package/out/repo/workspaces.js.map +1 -0
  283. package/out/resolver/lookup-types.d.ts +1 -1
  284. package/out/resolver/region-database-provider.d.ts +30 -0
  285. package/out/resolver/region-database-provider.d.ts.map +1 -1
  286. package/out/resolver/synthetic-id-ranges.d.ts +46 -4
  287. package/out/resolver/synthetic-id-ranges.d.ts.map +1 -1
  288. package/out/resolver/synthetic-id-ranges.js +66 -4
  289. package/out/resolver/synthetic-id-ranges.js.map +1 -1
  290. package/out/resolver/types.d.ts +201 -7
  291. package/out/resolver/types.d.ts.map +1 -1
  292. package/out/resolver/types.js +57 -0
  293. package/out/resolver/types.js.map +1 -1
  294. package/out/resolver.d.ts +3 -3
  295. package/out/resolver.d.ts.map +1 -1
  296. package/out/resolver.js +1 -1
  297. package/out/resolver.js.map +1 -1
  298. package/out/scripting/process.d.ts.map +1 -0
  299. package/out/scripting/process.js.map +1 -0
  300. package/out/scripting/workers.d.ts.map +1 -0
  301. package/out/scripting/workers.js.map +1 -0
  302. package/out/state-machine.d.ts +1 -1
  303. package/out/strings/python-json.d.ts +12 -1
  304. package/out/strings/python-json.d.ts.map +1 -1
  305. package/out/strings/python-json.js +9 -4
  306. package/out/strings/python-json.js.map +1 -1
  307. package/out/tokenization/Span.d.ts +11 -0
  308. package/out/tokenization/Span.d.ts.map +1 -1
  309. package/out/tokenization/Span.js.map +1 -1
  310. package/out/tools/build-deflate64-wasm.run.js +2 -2
  311. package/out/tools/build-deflate64-wasm.run.js.map +1 -1
  312. package/out/tools/coarse-placer/build/dataset.js +1 -1
  313. package/out/tools/coarse-placer/build/dataset.js.map +1 -1
  314. package/out/tools/coarse-placer/build/outlier/exposure.js +1 -1
  315. package/out/tools/coarse-placer/build/outlier/exposure.js.map +1 -1
  316. package/out/tools/coarse-placer/build/outlier/latin.d.ts.map +1 -1
  317. package/out/tools/coarse-placer/build/outlier/latin.js +5 -1
  318. package/out/tools/coarse-placer/build/outlier/latin.js.map +1 -1
  319. package/out/tools/coarse-placer/country-sets.d.ts +2 -2
  320. package/out/tools/coarse-placer/country-sets.js +2 -2
  321. package/out/tools/coarse-placer/outlier-rows.js +2 -2
  322. package/out/tools/coarse-placer/outlier-rows.js.map +1 -1
  323. package/out/tools/coarse-placer/train.js +1 -1
  324. package/out/tools/coarse-placer/train.js.map +1 -1
  325. package/out/tools/generate-language-types.js +2 -2
  326. package/out/tools/generate-language-types.js.map +1 -1
  327. package/out/tools/license/product-fixtures.run.d.ts +2 -0
  328. package/out/tools/license/product-fixtures.run.d.ts.map +1 -0
  329. package/out/tools/license/product-fixtures.run.js +350 -0
  330. package/out/tools/license/product-fixtures.run.js.map +1 -0
  331. package/out/utils/chunk-process.js +2 -2
  332. package/out/utils/chunk-process.js.map +1 -1
  333. package/out/utils/geodatabase-archive.js +1 -1
  334. package/out/utils/geodatabase-archive.js.map +1 -1
  335. package/out/utils/time.d.ts +46 -3
  336. package/out/utils/time.d.ts.map +1 -1
  337. package/out/utils/time.js +139 -6
  338. package/out/utils/time.js.map +1 -1
  339. package/out/utils.d.ts +4 -4
  340. package/out/utils.d.ts.map +1 -1
  341. package/out/utils.js +4 -4
  342. package/out/utils.js.map +1 -1
  343. package/out/values/identical.d.ts.map +1 -0
  344. package/out/values/identical.js.map +1 -0
  345. package/out/values/json.d.ts.map +1 -0
  346. package/out/values/json.js.map +1 -0
  347. package/out/values/objects.d.ts.map +1 -0
  348. package/out/values/objects.js.map +1 -0
  349. package/package.json +278 -243
  350. package/tools/build-deflate64-wasm.run.ts +2 -2
  351. package/tools/coarse-placer/build/dataset.ts +1 -1
  352. package/tools/coarse-placer/build/outlier/exposure.ts +1 -1
  353. package/tools/coarse-placer/build/outlier/latin.ts +5 -1
  354. package/tools/coarse-placer/country-sets.ts +2 -2
  355. package/tools/coarse-placer/outlier-rows.ts +2 -2
  356. package/tools/coarse-placer/train.ts +1 -1
  357. package/tools/generate-language-types.ts +2 -2
  358. package/tools/license/product-fixtures.run.ts +449 -0
  359. package/lib/collections.ts +0 -5
  360. package/lib/license/decision.ts +0 -329
  361. package/lib/license/obligations.ts +0 -256
  362. package/lib/license/record.ts +0 -277
  363. package/lib/scripting/ingest-chunk-script.ts +0 -87
  364. package/out/binary-frame.d.ts.map +0 -1
  365. package/out/binary-frame.js.map +0 -1
  366. package/out/collections.d.ts +0 -2
  367. package/out/collections.d.ts.map +0 -1
  368. package/out/collections.js +0 -5
  369. package/out/collections.js.map +0 -1
  370. package/out/git.d.ts.map +0 -1
  371. package/out/git.js.map +0 -1
  372. package/out/hash.d.ts.map +0 -1
  373. package/out/hash.js.map +0 -1
  374. package/out/identical.d.ts.map +0 -1
  375. package/out/identical.js.map +0 -1
  376. package/out/json.d.ts.map +0 -1
  377. package/out/json.js.map +0 -1
  378. package/out/license/decision.d.ts +0 -179
  379. package/out/license/decision.d.ts.map +0 -1
  380. package/out/license/decision.js +0 -169
  381. package/out/license/decision.js.map +0 -1
  382. package/out/license/obligations.d.ts +0 -102
  383. package/out/license/obligations.d.ts.map +0 -1
  384. package/out/license/obligations.js +0 -188
  385. package/out/license/obligations.js.map +0 -1
  386. package/out/license/record.d.ts +0 -136
  387. package/out/license/record.d.ts.map +0 -1
  388. package/out/license/record.js +0 -222
  389. package/out/license/record.js.map +0 -1
  390. package/out/load-ledger.d.ts.map +0 -1
  391. package/out/load-ledger.js.map +0 -1
  392. package/out/memoize.d.ts.map +0 -1
  393. package/out/memoize.js.map +0 -1
  394. package/out/numeric.d.ts.map +0 -1
  395. package/out/numeric.js.map +0 -1
  396. package/out/objects.d.ts.map +0 -1
  397. package/out/objects.js.map +0 -1
  398. package/out/overture-pins.d.ts.map +0 -1
  399. package/out/overture-pins.js.map +0 -1
  400. package/out/postcode-prefix-files.d.ts.map +0 -1
  401. package/out/postcode-prefix-files.js.map +0 -1
  402. package/out/process.d.ts.map +0 -1
  403. package/out/process.js.map +0 -1
  404. package/out/promises.d.ts.map +0 -1
  405. package/out/promises.js.map +0 -1
  406. package/out/random.d.ts.map +0 -1
  407. package/out/random.js.map +0 -1
  408. package/out/release-config.d.ts.map +0 -1
  409. package/out/release-config.js.map +0 -1
  410. package/out/routing.d.ts.map +0 -1
  411. package/out/routing.js.map +0 -1
  412. package/out/scope-config.d.ts.map +0 -1
  413. package/out/scope-config.js.map +0 -1
  414. package/out/scripting/ingest-chunk-script.d.ts +0 -58
  415. package/out/scripting/ingest-chunk-script.d.ts.map +0 -1
  416. package/out/scripting/ingest-chunk-script.js +0 -47
  417. package/out/scripting/ingest-chunk-script.js.map +0 -1
  418. package/out/spdx-header.d.ts.map +0 -1
  419. package/out/spdx-header.js.map +0 -1
  420. package/out/stats.d.ts.map +0 -1
  421. package/out/stats.js.map +0 -1
  422. package/out/trust-policies.d.ts.map +0 -1
  423. package/out/trust-policies.js.map +0 -1
  424. package/out/vale.d.ts.map +0 -1
  425. package/out/vale.js.map +0 -1
  426. package/out/workers.d.ts.map +0 -1
  427. package/out/workers.js.map +0 -1
  428. package/out/workspaces.d.ts.map +0 -1
  429. package/out/workspaces.js.map +0 -1
  430. /package/lib/{load-ledger.ts → asset/load-ledger.ts} +0 -0
  431. /package/lib/{overture-pins.ts → asset/overture-pins.ts} +0 -0
  432. /package/lib/{postcode-prefix-files.ts → asset/postcode-prefix-files.ts} +0 -0
  433. /package/lib/{hash.ts → crypto/hash.ts} +0 -0
  434. /package/lib/{trust-policies.ts → html/trust-policies.ts} +0 -0
  435. /package/lib/{numeric.ts → math/numeric.ts} +0 -0
  436. /package/lib/{random.ts → math/random.ts} +0 -0
  437. /package/lib/{stats.ts → math/stats.ts} +0 -0
  438. /package/lib/{vale.ts → repo/vale.ts} +0 -0
  439. /package/lib/{process.ts → scripting/process.ts} +0 -0
  440. /package/lib/{workers.ts → scripting/workers.ts} +0 -0
  441. /package/lib/{identical.ts → values/identical.ts} +0 -0
  442. /package/lib/{json.ts → values/json.ts} +0 -0
  443. /package/lib/{objects.ts → values/objects.ts} +0 -0
  444. /package/out/{binary-frame.d.ts → asset/binary-frame.d.ts} +0 -0
  445. /package/out/{load-ledger.d.ts → asset/load-ledger.d.ts} +0 -0
  446. /package/out/{load-ledger.js → asset/load-ledger.js} +0 -0
  447. /package/out/{overture-pins.d.ts → asset/overture-pins.d.ts} +0 -0
  448. /package/out/{overture-pins.js → asset/overture-pins.js} +0 -0
  449. /package/out/{postcode-prefix-files.d.ts → asset/postcode-prefix-files.d.ts} +0 -0
  450. /package/out/{postcode-prefix-files.js → asset/postcode-prefix-files.js} +0 -0
  451. /package/out/{memoize.d.ts → async/memoize.d.ts} +0 -0
  452. /package/out/{hash.d.ts → crypto/hash.d.ts} +0 -0
  453. /package/out/{hash.js → crypto/hash.js} +0 -0
  454. /package/out/{trust-policies.d.ts → html/trust-policies.d.ts} +0 -0
  455. /package/out/{trust-policies.js → html/trust-policies.js} +0 -0
  456. /package/out/{numeric.d.ts → math/numeric.d.ts} +0 -0
  457. /package/out/{numeric.js → math/numeric.js} +0 -0
  458. /package/out/{random.d.ts → math/random.d.ts} +0 -0
  459. /package/out/{random.js → math/random.js} +0 -0
  460. /package/out/{stats.d.ts → math/stats.d.ts} +0 -0
  461. /package/out/{stats.js → math/stats.js} +0 -0
  462. /package/out/{routing.d.ts → network/routing.d.ts} +0 -0
  463. /package/out/{release-config.js → repo/release-config.js} +0 -0
  464. /package/out/{spdx-header.d.ts → repo/spdx-header.d.ts} +0 -0
  465. /package/out/{vale.d.ts → repo/vale.d.ts} +0 -0
  466. /package/out/{vale.js → repo/vale.js} +0 -0
  467. /package/out/{workspaces.d.ts → repo/workspaces.d.ts} +0 -0
  468. /package/out/{process.d.ts → scripting/process.d.ts} +0 -0
  469. /package/out/{process.js → scripting/process.js} +0 -0
  470. /package/out/{workers.d.ts → scripting/workers.d.ts} +0 -0
  471. /package/out/{workers.js → scripting/workers.js} +0 -0
  472. /package/out/{identical.d.ts → values/identical.d.ts} +0 -0
  473. /package/out/{identical.js → values/identical.js} +0 -0
  474. /package/out/{json.d.ts → values/json.d.ts} +0 -0
  475. /package/out/{json.js → values/json.js} +0 -0
  476. /package/out/{objects.d.ts → values/objects.d.ts} +0 -0
  477. /package/out/{objects.js → values/objects.js} +0 -0
@@ -0,0 +1,290 @@
1
+ // SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
3
+
4
+ /**
5
+ * A pipeline stage, the context every stage of one request reads, and the runner.
6
+ *
7
+ * A stage is an object with an `id` and a `run` function.
8
+ * The runner checks the abort signal, times the stage and captures its fault,
9
+ * so a stage does none of the three.
10
+ *
11
+ * The parse pipeline and the geocode path run their stages through {@linkcode runStage}.
12
+ */
13
+
14
+ import { decodeAsOutlineLines } from "#decoder/serialize/outline"
15
+ import type { AddressTree } from "#decoder/types"
16
+ import { errorMessage } from "#errors/schema"
17
+ import type { PipelineTiming } from "#pipeline/types"
18
+
19
+ /**
20
+ * The identifier of each stage of the parse pipeline, spelled as its timing keys were first published.
21
+ * A timing record keys a stage's duration by its identifier.
22
+ *
23
+ * A package that runs stages of its own declares their identifiers beside them,
24
+ * as `GeocodeStageID` in `mailwoman` does, so a new stage there changes zero lines here.
25
+ */
26
+ export const StageID = {
27
+ Normalize: "normalize",
28
+ PlaceCountry: "place-country",
29
+ QueryShape: "query-shape",
30
+ LocaleHint: "locale-hint",
31
+ KindClassifier: "kind-classifier",
32
+ POIIntent: "poi-intent",
33
+ PhraseGrouper: "phrase-grouper",
34
+ TokenClassify: "token-classify",
35
+ GrouperAudit: "grouper-audit",
36
+ Resolve: "resolve",
37
+ } as const
38
+
39
+ /**
40
+ * One of the {@link StageID} values.
41
+ */
42
+ export type StageID = (typeof StageID)[keyof typeof StageID]
43
+
44
+ /**
45
+ * The two stages a fault spells differently from the stage's identifier.
46
+ *
47
+ * `mailwoman parse` prints a fault's `stage`, so each spelling stays as it was first published.
48
+ */
49
+ const FAULT_STAGE_SPELLINGS: Readonly<Record<string, string>> = {
50
+ [StageID.TokenClassify]: "classifier",
51
+ [StageID.Resolve]: "resolver",
52
+ }
53
+
54
+ /**
55
+ * A stage of the parse pipeline as a fault spells it: `classifier` for the decode,
56
+ * `resolver` for the resolve, and the stage's identifier for every other stage.
57
+ */
58
+ export type PipelineFaultStage =
59
+ | Exclude<StageID, typeof StageID.TokenClassify | typeof StageID.Resolve>
60
+ | "classifier"
61
+ | "resolver"
62
+
63
+ /**
64
+ * One failure that a request caught and degraded past.
65
+ *
66
+ * `runPipeline` still resolves.
67
+ * `tree` contains whatever the remaining stages could prove.
68
+ *
69
+ * @typeParam Stage The spellings of the stages that can fault.
70
+ * The parse pipeline's result states {@link PipelineFaultStage}, and a context with stages of another package states `string`.
71
+ */
72
+ export interface PipelineFault<Stage extends string = string> {
73
+ /**
74
+ * The stage that threw, as a fault spells it.
75
+ */
76
+ stage: Stage
77
+ /**
78
+ * The thrown value's `name`, or `"Error"` when something that isn't an `Error` was thrown.
79
+ *
80
+ * It is machine-stable enough to branch on, with the `cause` carrying the rest.
81
+ */
82
+ name: string
83
+ message: string
84
+ /**
85
+ * The value the stage threw, verbatim: not JSON-serializable in the useful sense,
86
+ * so serialize `stage`/`name`/`message` when you need this on a wire.
87
+ */
88
+ cause: unknown
89
+ }
90
+
91
+ /**
92
+ * What a stage that rewrites the parse tree changed, as outline lines of the tree.
93
+ *
94
+ * A line reads `tag [start, end): "value"` with the node's metadata after it, indented two
95
+ * spaces for each level, so a node that only moved under another parent appears in both lists.
96
+ */
97
+ export interface TreeRewriteRecord {
98
+ kind: "tree-rewrite"
99
+ /**
100
+ * The identifier of the stage that rewrote the tree.
101
+ */
102
+ stage: string
103
+ /**
104
+ * The lines the tree had before the stage and lacks after it.
105
+ */
106
+ removed: string[]
107
+ /**
108
+ * The lines the tree has after the stage and lacked before it.
109
+ */
110
+ added: string[]
111
+ }
112
+
113
+ /**
114
+ * A record that a stage of this package writes to a request's trace.
115
+ */
116
+ export type StageRecord = TreeRewriteRecord
117
+
118
+ /**
119
+ * What every stage of one request reads and writes.
120
+ *
121
+ * @typeParam Trace The records the request's stages write.
122
+ * @typeParam FaultStage The spellings of the stages whose failures the request records.
123
+ */
124
+ export interface RequestContext<Trace = StageRecord, FaultStage extends string = string> {
125
+ /**
126
+ * The signal that cancels the request, or null for a request that can't be cancelled.
127
+ */
128
+ readonly signal: AbortSignal | null
129
+
130
+ /**
131
+ * Receives each record a stage writes, or null when the request records none.
132
+ *
133
+ * A stage builds a record only after it has read a sink here.
134
+ */
135
+ readonly trace: ((record: Trace) => void) | null
136
+
137
+ /**
138
+ * Whether a stage also writes the records that cost work to build, such as the
139
+ * outlines of a tree rewrite or the decoder's trace.
140
+ *
141
+ * A stage writes a record it already holds, such as a decision it made, whenever {@link trace} is set.
142
+ */
143
+ readonly detail: boolean
144
+
145
+ /**
146
+ * The milliseconds each stage has taken, summed when a stage runs more than once.
147
+ */
148
+ readonly timing: PipelineTiming
149
+
150
+ /**
151
+ * Every failure the request caught and degraded past, in order.
152
+ */
153
+ readonly faults: PipelineFault<FaultStage>[]
154
+ }
155
+
156
+ /**
157
+ * Builds the context of one request.
158
+ *
159
+ * `detail` defaults to whether the request has a trace, so a caller states it only to
160
+ * receive the records a stage already holds without the costly ones.
161
+ */
162
+ export function createRequestContext<Trace = StageRecord, FaultStage extends string = string>(
163
+ init: { signal?: AbortSignal | null; trace?: ((record: Trace) => void) | null; detail?: boolean } = {}
164
+ ): RequestContext<Trace, FaultStage> {
165
+ const trace = init.trace ?? null
166
+
167
+ return { signal: init.signal ?? null, trace, detail: init.detail ?? trace != null, timing: {}, faults: [] }
168
+ }
169
+
170
+ /**
171
+ * Records a failure the request degrades past, under `stage`.
172
+ *
173
+ * The runner calls it for a stage that declares `recover`.
174
+ * A stage calls it for a failure of work the answer doesn't depend on, such as building a trace.
175
+ */
176
+ export function recordFault(context: Pick<RequestContext<never>, "faults">, stage: string, cause: unknown): void {
177
+ context.faults.push({
178
+ stage,
179
+ name: cause instanceof Error ? cause.name : "Error",
180
+ message: errorMessage(cause),
181
+ cause,
182
+ })
183
+ }
184
+
185
+ /**
186
+ * One step of a pipeline.
187
+ *
188
+ * @typeParam Input What the stage reads.
189
+ * @typeParam Output What the stage returns.
190
+ * @typeParam Trace The records the stage writes.
191
+ * @typeParam ID The stage identifiers of the pipeline the stage belongs to.
192
+ */
193
+ export interface PipelineStage<Input, Output, Trace = StageRecord, ID extends string = string> {
194
+ /**
195
+ * The stage's identifier.
196
+ * The context's timing keys the stage's duration by it.
197
+ */
198
+ readonly id: ID
199
+ run(input: Input, context: RequestContext<Trace>): Output | Promise<Output>
200
+
201
+ /**
202
+ * The output the pipeline continues with when `run` throws.
203
+ *
204
+ * The runner records a fault for a stage that declares it, and rethrows for a stage that leaves it out.
205
+ */
206
+ recover?(input: Input): Output
207
+ }
208
+
209
+ /**
210
+ * Runs one stage: checks the abort signal, runs the stage, and adds its duration to the context's timing.
211
+ *
212
+ * An aborted request rejects with the signal's reason, the value the cancelling code aborted with.
213
+ * `abortKindOf` in `#async/abort` reads that reason's kind.
214
+ *
215
+ * The signal is checked before the stage, so a running stage finishes first.
216
+ *
217
+ * A stage that declares `recover` and throws has a fault recorded, and the run
218
+ * continues with the recovered output.
219
+ */
220
+ export async function runStage<Input, Output, Trace>(
221
+ stage: PipelineStage<Input, Output, Trace>,
222
+ input: Input,
223
+ context: RequestContext<Trace>
224
+ ): Promise<Output> {
225
+ if (context.signal?.aborted) {
226
+ throw context.signal.reason ?? new DOMException("Pipeline aborted", "AbortError")
227
+ }
228
+
229
+ const startedAt = performance.now()
230
+
231
+ try {
232
+ return await stage.run(input, context)
233
+ } catch (error) {
234
+ if (!stage.recover) throw error
235
+
236
+ recordFault(context, FAULT_STAGE_SPELLINGS[stage.id] ?? stage.id, error)
237
+
238
+ return stage.recover(input)
239
+ } finally {
240
+ context.timing[stage.id] = (context.timing[stage.id] ?? 0) + (performance.now() - startedAt)
241
+ }
242
+ }
243
+
244
+ /**
245
+ * Runs stages in order, each reading the output of the stage before it.
246
+ */
247
+ export async function runStages<Value, Trace>(
248
+ stages: readonly PipelineStage<Value, Value, Trace>[],
249
+ input: Value,
250
+ context: RequestContext<Trace>
251
+ ): Promise<Value> {
252
+ let value = input
253
+
254
+ for (const stage of stages) {
255
+ value = await runStage(stage, value, context)
256
+ }
257
+
258
+ return value
259
+ }
260
+
261
+ /**
262
+ * A stage that rewrites the parse tree and writes what it changed to the trace.
263
+ *
264
+ * It writes a {@linkcode TreeRewriteRecord} only when the request traces in detail
265
+ * and the tree's outline changed.
266
+ * The rewrite may change the tree in place, so the stage reads the outline before the rewrite runs.
267
+ */
268
+ export function treeRewriteStage<ID extends string>(
269
+ id: ID,
270
+ rewrite: (tree: AddressTree) => AddressTree
271
+ ): PipelineStage<AddressTree, AddressTree, TreeRewriteRecord, ID> {
272
+ return {
273
+ id,
274
+ run(tree, context) {
275
+ if (!context.trace || !context.detail) return rewrite(tree)
276
+
277
+ const before = decodeAsOutlineLines(tree, { metadata: true })
278
+ const rewritten = rewrite(tree)
279
+ const after = decodeAsOutlineLines(rewritten, { metadata: true })
280
+ const removed = before.filter((line) => !after.includes(line))
281
+ const added = after.filter((line) => !before.includes(line))
282
+
283
+ if (removed.length || added.length) {
284
+ context.trace({ kind: "tree-rewrite", stage: id, removed, added })
285
+ }
286
+
287
+ return rewritten
288
+ },
289
+ }
290
+ }
@@ -5,7 +5,7 @@
5
5
  * Declares the types for the runtime pipeline and its injected stages.
6
6
  */
7
7
 
8
- import type { NormalizedInputLite } from "@mailwoman/query-shape"
8
+ import type { BCP47 } from "@mailwoman/registry/types"
9
9
  import { z } from "zod"
10
10
 
11
11
  import { type AddressTree, AddressTreeSchema } from "#decoder/types"
@@ -192,6 +192,122 @@ export interface PipelineOpts {
192
192
  signal?: AbortSignal
193
193
  }
194
194
 
195
+ /**
196
+ * The normalized-input fields that the pipeline stages and several other packages read.
197
+ *
198
+ * `NormalizedInput` from `@mailwoman/normalize` has a compatible shape.
199
+ */
200
+ export interface NormalizedInputLite {
201
+ raw: string
202
+ normalized: string
203
+ appliedLocale?: string | null
204
+ }
205
+
206
+ /**
207
+ * Whether a known-format name is a postcode format.
208
+ *
209
+ * The check uses the naming convention instead of a set, so a format added to the recognizer's
210
+ * known-format table becomes a postcode everywhere once it follows the convention.
211
+ * The `legacy` generation reports `us_zip`, `us_zip4` and `<cc>_postcode`,
212
+ * and the `postal` generation reports every postcode as `postcode`.
213
+ */
214
+ export function isPostcodeFormat(format: string): boolean {
215
+ return format === "postcode" || format === "us_zip" || format === "us_zip4" || format.endsWith("_postcode")
216
+ }
217
+
218
+ /**
219
+ * The hit a locale or a country can be read from: the countries a postal-generation
220
+ * hit's syntax accepts, and the locale of the most populous of them.
221
+ */
222
+ export interface KnownFormatCountryView {
223
+ /**
224
+ * The BCP 47 locale of the most populous accepting country, or null when the hit names none.
225
+ */
226
+ locale?: string | null
227
+ /**
228
+ * What the form is made of: `designated` (a printed prefix), `alnum` (a letter) or `numeric` (digits).
229
+ */
230
+ form?: "alnum" | "numeric" | "designated" | null
231
+ }
232
+
233
+ /**
234
+ * A read-only view of the known-format hit fields that later stages read.
235
+ */
236
+ export interface KnownFormatHitView extends KnownFormatCountryView {
237
+ format: string
238
+ span: { start: number; end: number }
239
+ confidence: number
240
+ }
241
+
242
+ /**
243
+ * A read-only view of one segment.
244
+ *
245
+ * `span` holds the segment's character offsets, or `null` for a hand-built shape that has none.
246
+ */
247
+ export interface SegmentView {
248
+ body: string
249
+ index: number
250
+ span: { start: number; end: number } | null
251
+ }
252
+
253
+ /**
254
+ * A read-only view of one token classification.
255
+ */
256
+ export interface TokenClassView {
257
+ span: { start: number; end: number; body: string }
258
+ class: string
259
+ script: BCP47.ScriptCode | null
260
+ }
261
+
262
+ /**
263
+ * A read-only view of a query shape with the format hits and the whole-input class.
264
+ * It is the input type of `@mailwoman/locale-hint`.
265
+ */
266
+ export interface QueryShapeFormatsView {
267
+ knownFormats: ReadonlyArray<KnownFormatHitView>
268
+ characterClass: string | null
269
+ /**
270
+ * The generation of the query-shape rules that computed the shape, `legacy` when absent.
271
+ * A consumer that recomputes a shape passes it on.
272
+ */
273
+ generation?: "legacy" | "postal"
274
+ /**
275
+ * The ranked scripts, or null for a hand-built shape that has none.
276
+ */
277
+ scripts: ReadonlyArray<{ script: BCP47.ScriptCode; share: number }> | null
278
+ totalLength: number | null
279
+ }
280
+
281
+ /**
282
+ * A {@link QueryShapeFormatsView} with segments.
283
+ * It is the input type of `@mailwoman/kind-classifier`.
284
+ */
285
+ export interface QueryShapeSegmentsView extends QueryShapeFormatsView {
286
+ segments: ReadonlyArray<SegmentView> | null
287
+ }
288
+
289
+ /**
290
+ * A {@link QueryShapeSegmentsView} with token classes.
291
+ * It is the input type of `@mailwoman/phrase-grouper`.
292
+ */
293
+ export interface QueryShapeTokensView extends QueryShapeSegmentsView {
294
+ tokenClasses: ReadonlyArray<TokenClassView> | null
295
+ }
296
+
297
+ /**
298
+ * A query-shape view with no format hits and every optional part null.
299
+ *
300
+ * Hand-built shapes spread it and set the parts they need.
301
+ */
302
+ export const EMPTY_QUERY_SHAPE_VIEW: QueryShapeTokensView = {
303
+ knownFormats: [],
304
+ characterClass: null,
305
+ scripts: null,
306
+ totalLength: null,
307
+ segments: null,
308
+ tokenClasses: null,
309
+ }
310
+
195
311
  /**
196
312
  * The fields of a query shape that the pipeline reads.
197
313
  */
@@ -206,15 +322,14 @@ export interface QueryShapeLite {
206
322
  /**
207
323
  * ISO 15924 scripts ranked by share of characters that belong to a script.
208
324
  */
209
- scripts: ReadonlyArray<{ script: string; share: number }> | null
325
+ scripts: ReadonlyArray<{ script: BCP47.ScriptCode; share: number }> | null
210
326
  /**
211
327
  * The class and script of each token.
212
328
  */
213
329
  tokenClasses: ReadonlyArray<{
214
330
  span: { start: number; end: number; body: string }
215
331
  class: string
216
- length: number
217
- script: string | null
332
+ script: BCP47.ScriptCode | null
218
333
  }> | null
219
334
  totalLength: number | null
220
335
  }
@@ -233,7 +348,7 @@ export interface LocaleHint {
233
348
  * The array is empty when no character of the input belongs to a script.
234
349
  * `locale` stays a BCP-47 language tag.
235
350
  */
236
- script: ReadonlyArray<{ script: string; confidence: number }>
351
+ script: ReadonlyArray<{ script: BCP47.ScriptCode; confidence: number }>
237
352
  /**
238
353
  * Diagnostic values that fed the inferred preferences, or null when none did.
239
354
  * Locale and time zone are independent signals.
@@ -699,6 +814,23 @@ export interface VenueHeadStage {
699
814
  venueHeadOpts?: VenueHeadPriorOpts
700
815
  }
701
816
 
817
+ /**
818
+ * The stated country that `pairIndexOwnCountry` compares against a placetype-pair index's own country.
819
+ */
820
+ export interface PairIndexOwnCountry {
821
+ /**
822
+ * The country the caller states for the parse, such as its locale's or default country.
823
+ *
824
+ * `null` leaves the decision to the locale head's confident verdict.
825
+ */
826
+ declaredCountry: string | null
827
+ }
828
+
829
+ /**
830
+ * Returns the gazetteer FST shipped for an ISO 3166-1 alpha-2 country, or `null` when none ships.
831
+ */
832
+ export type CountryFSTLookup = (country: string) => FSTMatcherLike | null | Promise<FSTMatcherLike | null>
833
+
702
834
  /**
703
835
  * Options for {@link AddressClassifier.parse}.
704
836
  */
@@ -765,6 +897,22 @@ export interface ClassifierOpts {
765
897
  */
766
898
  enforceWordConsistency?: WordConsistencySetting
767
899
  placetypePair?: PlacetypePairSelection
900
+ /**
901
+ * Whether the placetype-pair prior leaves separator pieces unbiased.
902
+ */
903
+ pairPriorWordPieces?: boolean
904
+ /**
905
+ * Whether a segment child's pair bias leaves out the same-field postcode its probe key stripped.
906
+ */
907
+ pairPriorChildPostcodeStrip?: boolean
908
+ /**
909
+ * Applies the placetype-pair index only when the parse's country is the index's country.
910
+ */
911
+ pairIndexOwnCountry?: PairIndexOwnCountry
912
+ /**
913
+ * The gazetteer FST for the country the locale head reads, used in place of `fst` when one ships.
914
+ */
915
+ fstForCountry?: CountryFSTLookup
768
916
  }
769
917
 
770
918
  /**
@@ -804,7 +952,7 @@ export type LocaleDetector = (
804
952
  */
805
953
  export interface RuntimePipelineStages {
806
954
  normalize?: (raw: string, opts?: { locale?: string }) => NormalizedInputLite
807
- computeQueryShape?: (input: NormalizedInputLite | string, opts?: { locale?: string }) => QueryShapeLite
955
+ computeQueryShape?: (input: NormalizedInputLite | string) => QueryShapeLite
808
956
  detectLocale?: LocaleDetector
809
957
  classifyKind?: (input: NormalizedInputLite, shape: QueryShapeLite, locale: LocaleHint) => Promise<QueryKindResult>
810
958
  /**
@@ -870,17 +1018,3 @@ export interface RuntimePipelineStages {
870
1018
  * Stage durations in milliseconds, keyed by stage name.
871
1019
  */
872
1020
  export type PipelineTiming = Record<string, number>
873
-
874
- /**
875
- * The stages whose failures the pipeline records before it continues.
876
- */
877
- export const PipelineFaultStage = {
878
- Classifier: "classifier",
879
- PhraseGrouper: "phrase-grouper",
880
- Resolver: "resolver",
881
- } as const
882
-
883
- /**
884
- * One of the {@link PipelineFaultStage} values.
885
- */
886
- export type PipelineFaultStage = (typeof PipelineFaultStage)[keyof typeof PipelineFaultStage]
package/lib/pipeline.ts CHANGED
@@ -31,7 +31,6 @@ export {
31
31
  deriveInputMode,
32
32
  InputModeSchema,
33
33
  InputModeSelectionSchema,
34
- PipelineFaultStage,
35
34
  POIIntentSchema,
36
35
  POIQueryResultSchema,
37
36
  POIResultSchema,
@@ -52,6 +51,7 @@ export type {
52
51
  ClassifierOpts,
53
52
  AnchorRegionAncestor,
54
53
  AnchorRegionLookupLike,
54
+ CountryFSTLookup,
55
55
  FSTMatcherLike,
56
56
  InputMode,
57
57
  InputModeSelection,
@@ -61,6 +61,7 @@ export type {
61
61
  PhraseKind,
62
62
  PhraseProposal,
63
63
  PipelineOpts,
64
+ PairIndexOwnCountry,
64
65
  PipelineTiming,
65
66
  PlacetypePairSelection,
66
67
  PlacerCountryUse,
@@ -84,4 +85,15 @@ export type {
84
85
  } from "#pipeline/types"
85
86
 
86
87
  export type { MachinePreferences } from "#pipeline/preferences"
87
- export type { PipelineFault, PipelineResult } from "#pipeline/result"
88
+ export type { PipelineResult } from "#pipeline/result"
89
+
90
+ export { createRequestContext, recordFault, runStage, runStages, StageID, treeRewriteStage } from "#pipeline/stage"
91
+
92
+ export type {
93
+ PipelineFault,
94
+ PipelineFaultStage,
95
+ PipelineStage,
96
+ RequestContext,
97
+ StageRecord,
98
+ TreeRewriteRecord,
99
+ } from "#pipeline/stage"
@@ -26,7 +26,7 @@ import {
26
26
  runFile,
27
27
  runFileSync,
28
28
  spawnProcess,
29
- } from "#process"
29
+ } from "#scripting/process"
30
30
  import { TypedEventTarget } from "#utils/events"
31
31
 
32
32
  /**
@@ -382,6 +382,26 @@ export async function gitCommonDirectory(repoRoot: PathBuilderLike = repoRootPat
382
382
  return git(["rev-parse", "--path-format=absolute", "--git-common-dir"], repoRoot)
383
383
  }
384
384
 
385
+ /**
386
+ * The count of commits `head` has that `base` lacks, and the count `base` has that `head` lacks.
387
+ *
388
+ * Both are read from local refs, so a remote-tracking `base` reflects the last fetch.
389
+ */
390
+ export async function commitsAheadBehind(
391
+ base: string,
392
+ head = "HEAD",
393
+ repoRoot: PathBuilderLike = repoRootPathBuilder
394
+ ): Promise<{ ahead: number; behind: number }> {
395
+ const counts = await git(["rev-list", "--left-right", "--count", `${base}...${head}`], repoRoot)
396
+ const [behind, ahead] = counts.trim().split(/\s+/u).map(Number)
397
+
398
+ if (!Number.isInteger(behind) || !Number.isInteger(ahead)) {
399
+ throw new TypeError(`git rev-list --left-right --count ${base}...${head} printed "${counts}"`)
400
+ }
401
+
402
+ return { ahead: ahead!, behind: behind! }
403
+ }
404
+
385
405
  /**
386
406
  * The absolute path of the working tree that contains `repoRoot`.
387
407
  */
@@ -96,6 +96,14 @@ export interface ReleaseConfig {
96
96
  charWeights?: Record<string, CharWeightsRecipe>
97
97
  softFeed?: SoftFeedRecipe
98
98
  assets?: { hfBucket?: string; [key: string]: unknown }
99
+ /**
100
+ * The address-layer version the release serves, keyed by ISO 3166-1 country code,
101
+ * such as `{ "US": "2026-11-13" }`.
102
+ *
103
+ * The data bill of materials reads that version's manifest and ledgers to list the layer's sources.
104
+ * A key starting with `$` is a comment.
105
+ */
106
+ addressLayers?: Record<string, string>
99
107
  }
100
108
 
101
109
  /**
@@ -4,15 +4,14 @@
4
4
  /**
5
5
  * Reads `scope.config.json`.
6
6
  *
7
- * It lists the countries in each locale tier, the shipping locales outside any tier,
8
- * and the training config behind each shipped model.
9
- * Tier membership grants no release privilege: release requirements are registered
10
- * in `packages/mailwoman/tools/eval-harness/release/specs/`.
7
+ * It lists the training config behind each shipped model and each shipping
8
+ * country that holds no support promise.
9
+ * The customer-facing claim is the promise list in `@mailwoman/codex/support`.
11
10
  *
12
- * The config holds membership only.
13
- * `docs/engineering/scope.mdx` contains the evidence for each tier.
11
+ * Release requirements are registered in `packages/mailwoman/tools/eval-harness/release/specs/`.
14
12
  *
15
- * The `repo-health` `locale-scope` check fails when the two disagree.
13
+ * The `repo-health` `locale-scope` check fails when a shipping country is
14
+ * neither promised nor listed here.
16
15
  */
17
16
 
18
17
  import type { PathBuilderLike } from "path-ts"
@@ -20,17 +19,6 @@ import type { PathBuilderLike } from "path-ts"
20
19
  import { readLocalJSONFile } from "#fs/readers"
21
20
  import { repoRootPathBuilder } from "#paths"
22
21
 
23
- /**
24
- * The tier keys, numbered as in `scope.mdx`.
25
- * They're strings because JSON object keys are strings.
26
- */
27
- export const SCOPE_TIER_KEYS = ["1", "2", "3", "4", "5"] as const
28
-
29
- /**
30
- * One of the {@link SCOPE_TIER_KEYS}.
31
- */
32
- export type ScopeTierKey = (typeof SCOPE_TIER_KEYS)[number]
33
-
34
22
  /**
35
23
  * The parsed `scope.config.json`.
36
24
  *
@@ -40,11 +28,10 @@ export type ScopeTierKey = (typeof SCOPE_TIER_KEYS)[number]
40
28
  * The `locale-scope` check validates those reasons, so this reader accepts empty ones.
41
29
  */
42
30
  export interface ScopeConfig {
43
- tiers: Record<string, string[]>
44
31
  /**
45
- * Maps each shipping locale's country that belongs to no tier to the reason.
32
+ * Maps each shipping locale's country that holds no support promise to the reason.
46
33
  */
47
- untieredShippingLocales: Record<string, string>
34
+ unpromisedShippingLocales: Record<string, string>
48
35
  /**
49
36
  * Maps each weights-family ID to the training config that produced its shipped model.
50
37
  */
@@ -82,21 +69,6 @@ export async function readScopeConfig(repoRoot: PathBuilderLike = repoRootPathBu
82
69
  return readLocalJSONFile<ScopeConfig>(repoRoot, "scope.config.json")
83
70
  }
84
71
 
85
- /**
86
- * Returns every country in any tier.
87
- */
88
- export function tieredCountries(scope: ScopeConfig): Set<string> {
89
- const countries = new Set<string>()
90
-
91
- for (const key of SCOPE_TIER_KEYS) {
92
- for (const country of scope.tiers[key] ?? []) {
93
- countries.add(country)
94
- }
95
- }
96
-
97
- return countries
98
- }
99
-
100
72
  /**
101
73
  * Returns the training config for one weights family.
102
74
  *