@mailwoman/core 4.16.2 → 5.1.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.
- package/data/chromium-i18n/ssl-address-download.ts +110 -0
- package/data/libpostal/resources-download.ts +121 -0
- package/out/api/APIClient.d.ts +2 -2
- package/out/api/APIClient.d.ts.map +1 -1
- package/out/api/APIClient.js +2 -2
- package/out/api/APIClient.js.map +1 -1
- package/out/api/responses.d.ts.map +1 -1
- package/out/api/responses.js.map +1 -1
- package/out/classification/Classification.d.ts +3 -4
- package/out/classification/Classification.d.ts.map +1 -1
- package/out/classification/Classification.js.map +1 -1
- package/out/classification/CompositeClassifier.d.ts +1 -1
- package/out/classification/CompositeClassifier.d.ts.map +1 -1
- package/out/classification/CompositeClassifier.js +1 -1
- package/out/classification/CompositeClassifier.js.map +1 -1
- package/out/classification/PhraseClassifier.d.ts.map +1 -1
- package/out/classification/PhraseClassifier.js.map +1 -1
- package/out/classification/SectionClassifier.d.ts.map +1 -1
- package/out/classification/SectionClassifier.js.map +1 -1
- package/out/classification/WordClassifier.d.ts.map +1 -1
- package/out/classification/WordClassifier.js.map +1 -1
- package/out/classification/scheme.d.ts.map +1 -1
- package/out/classification/scheme.js.map +1 -1
- package/out/coarse-placer/coarse-placer.d.ts +28 -34
- package/out/coarse-placer/coarse-placer.d.ts.map +1 -1
- package/out/coarse-placer/coarse-placer.js +19 -21
- package/out/coarse-placer/coarse-placer.js.map +1 -1
- package/out/coarse-placer/featurize.d.ts +17 -19
- package/out/coarse-placer/featurize.d.ts.map +1 -1
- package/out/coarse-placer/featurize.js +17 -19
- package/out/coarse-placer/featurize.js.map +1 -1
- package/out/collections.d.ts +1 -2
- package/out/collections.d.ts.map +1 -1
- package/out/collections.js +1 -2
- package/out/collections.js.map +1 -1
- package/out/data/chromium-i18n/ssl-address-download.d.ts +30 -0
- package/out/data/chromium-i18n/ssl-address-download.d.ts.map +1 -0
- package/out/data/chromium-i18n/ssl-address-download.js +98 -0
- package/out/data/chromium-i18n/ssl-address-download.js.map +1 -0
- package/out/data/libpostal/resources-download.d.ts +29 -0
- package/out/data/libpostal/resources-download.d.ts.map +1 -0
- package/out/data/libpostal/resources-download.js +107 -0
- package/out/data/libpostal/resources-download.js.map +1 -0
- package/out/db/schema.d.ts +2 -2
- package/out/decoder/arbitrate-tree.d.ts +3 -3
- package/out/decoder/arbitrate-tree.d.ts.map +1 -1
- package/out/decoder/arbitrate-tree.js +5 -5
- package/out/decoder/arbitrate-tree.js.map +1 -1
- package/out/decoder/build-tree.d.ts +12 -14
- package/out/decoder/build-tree.d.ts.map +1 -1
- package/out/decoder/build-tree.js +4 -5
- package/out/decoder/build-tree.js.map +1 -1
- package/out/decoder/calibration.d.ts +3 -4
- package/out/decoder/calibration.d.ts.map +1 -1
- package/out/decoder/calibration.js +3 -4
- package/out/decoder/calibration.js.map +1 -1
- package/out/decoder/containment.d.ts +5 -6
- package/out/decoder/containment.d.ts.map +1 -1
- package/out/decoder/containment.js +5 -6
- package/out/decoder/containment.js.map +1 -1
- package/out/decoder/index.d.ts +1 -0
- package/out/decoder/index.d.ts.map +1 -1
- package/out/decoder/index.js +1 -0
- package/out/decoder/index.js.map +1 -1
- package/out/decoder/proposals-to-tree.d.ts +9 -9
- package/out/decoder/proposals-to-tree.d.ts.map +1 -1
- package/out/decoder/proposals-to-tree.js +11 -11
- package/out/decoder/proposals-to-tree.js.map +1 -1
- package/out/decoder/resolve-proposal-overlaps.d.ts +3 -5
- package/out/decoder/resolve-proposal-overlaps.d.ts.map +1 -1
- package/out/decoder/resolve-proposal-overlaps.js +5 -6
- package/out/decoder/resolve-proposal-overlaps.js.map +1 -1
- package/out/decoder/serialize-json.d.ts +13 -1
- package/out/decoder/serialize-json.d.ts.map +1 -1
- package/out/decoder/serialize-json.js +6 -2
- package/out/decoder/serialize-json.js.map +1 -1
- package/out/decoder/serialize-tuples.d.ts +10 -1
- package/out/decoder/serialize-tuples.d.ts.map +1 -1
- package/out/decoder/serialize-tuples.js +13 -5
- package/out/decoder/serialize-tuples.js.map +1 -1
- package/out/decoder/serialize-xml.d.ts +15 -9
- package/out/decoder/serialize-xml.d.ts.map +1 -1
- package/out/decoder/serialize-xml.js +29 -12
- package/out/decoder/serialize-xml.js.map +1 -1
- package/out/decoder/types.d.ts +52 -61
- package/out/decoder/types.d.ts.map +1 -1
- package/out/decoder/types.js +2 -2
- package/out/decoder/unknown-spans.d.ts +46 -0
- package/out/decoder/unknown-spans.d.ts.map +1 -0
- package/out/decoder/unknown-spans.js +56 -0
- package/out/decoder/unknown-spans.js.map +1 -0
- package/out/decoder/validate-tree.d.ts.map +1 -1
- package/out/decoder/validate-tree.js +2 -3
- package/out/decoder/validate-tree.js.map +1 -1
- package/out/env/index.d.ts +80 -0
- package/out/env/index.d.ts.map +1 -0
- package/out/env/index.js +35 -0
- package/out/env/index.js.map +1 -0
- package/out/env/load.d.ts +7 -0
- package/out/env/load.d.ts.map +1 -0
- package/out/env/load.js +13 -0
- package/out/env/load.js.map +1 -0
- package/out/env/paths.d.ts +13 -0
- package/out/env/paths.d.ts.map +1 -0
- package/out/env/paths.js +34 -0
- package/out/env/paths.js.map +1 -0
- package/out/env/schema.d.ts +81 -0
- package/out/env/schema.d.ts.map +1 -0
- package/out/env/schema.js +92 -0
- package/out/env/schema.js.map +1 -0
- package/out/errors/schema.d.ts +1 -2
- package/out/errors/schema.d.ts.map +1 -1
- package/out/errors/schema.js +1 -2
- package/out/errors/schema.js.map +1 -1
- package/out/filters/RelationshipFilter.d.ts.map +1 -1
- package/out/filters/RelationshipFilter.js.map +1 -1
- package/out/formatter/index.d.ts.map +1 -1
- package/out/formatter/index.js.map +1 -1
- package/out/identifiers.d.ts.map +1 -1
- package/out/identifiers.js.map +1 -1
- package/out/kysley/client.d.ts +3 -4
- package/out/kysley/client.d.ts.map +1 -1
- package/out/kysley/client.js +3 -4
- package/out/kysley/client.js.map +1 -1
- package/out/kysley/dialect-config.d.ts +1 -1
- package/out/kysley/dialect-config.d.ts.map +1 -1
- package/out/kysley/dialect.d.ts +4 -4
- package/out/kysley/dialect.js +4 -4
- package/out/kysley/driver.d.ts.map +1 -1
- package/out/kysley/driver.js +1 -1
- package/out/kysley/driver.js.map +1 -1
- package/out/lifecycle/ServiceSymbol.d.ts +2 -4
- package/out/lifecycle/ServiceSymbol.d.ts.map +1 -1
- package/out/lifecycle/ServiceSymbol.js +2 -4
- package/out/lifecycle/ServiceSymbol.js.map +1 -1
- package/out/lifecycle/services.d.ts +7 -8
- package/out/lifecycle/services.d.ts.map +1 -1
- package/out/lifecycle/services.js +5 -4
- package/out/lifecycle/services.js.map +1 -1
- package/out/locale/locale.d.ts +5 -6
- package/out/locale/locale.d.ts.map +1 -1
- package/out/locale/registry.d.ts.map +1 -1
- package/out/locale/registry.js.map +1 -1
- package/out/logging/index.d.ts +1 -0
- package/out/logging/index.d.ts.map +1 -1
- package/out/logging/index.js +1 -0
- package/out/logging/index.js.map +1 -1
- package/out/logging/shared.d.ts +2 -2
- package/out/logging/shared.js +2 -2
- package/out/logging/utils.d.ts +30 -0
- package/out/logging/utils.d.ts.map +1 -0
- package/out/logging/utils.js +30 -0
- package/out/logging/utils.js.map +1 -0
- package/out/objects.d.ts +3 -4
- package/out/objects.d.ts.map +1 -1
- package/out/objects.js +1 -2
- package/out/objects.js.map +1 -1
- package/out/parser/AddressParser.d.ts +12 -16
- package/out/parser/AddressParser.d.ts.map +1 -1
- package/out/parser/AddressParser.js.map +1 -1
- package/out/parser/proposal-pipeline.d.ts +12 -12
- package/out/parser/proposal-pipeline.d.ts.map +1 -1
- package/out/parser/proposal-pipeline.js +12 -12
- package/out/parser/proposal-pipeline.js.map +1 -1
- package/out/parser/solution-to-proposals.d.ts +4 -4
- package/out/parser/solution-to-proposals.d.ts.map +1 -1
- package/out/parser/solution-to-proposals.js +5 -5
- package/out/parser/solution-to-proposals.js.map +1 -1
- package/out/pipeline/index.d.ts +1 -1
- package/out/pipeline/reconcile-lookups.d.ts +4 -4
- package/out/pipeline/reconcile-lookups.d.ts.map +1 -1
- package/out/pipeline/reconcile-lookups.js +4 -4
- package/out/pipeline/reconcile-lookups.js.map +1 -1
- package/out/pipeline/reconcile.d.ts +21 -23
- package/out/pipeline/reconcile.d.ts.map +1 -1
- package/out/pipeline/reconcile.js +49 -51
- package/out/pipeline/reconcile.js.map +1 -1
- package/out/pipeline/runtime-pipeline.d.ts +14 -16
- package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
- package/out/pipeline/runtime-pipeline.js +33 -37
- package/out/pipeline/runtime-pipeline.js.map +1 -1
- package/out/pipeline/span-logit-aggregation.d.ts +5 -6
- package/out/pipeline/span-logit-aggregation.d.ts.map +1 -1
- package/out/pipeline/span-logit-aggregation.js +7 -8
- package/out/pipeline/span-logit-aggregation.js.map +1 -1
- package/out/pipeline/span-proposer.d.ts +18 -22
- package/out/pipeline/span-proposer.d.ts.map +1 -1
- package/out/pipeline/span-proposer.js +21 -22
- package/out/pipeline/span-proposer.js.map +1 -1
- package/out/pipeline/types.d.ts +77 -86
- package/out/pipeline/types.d.ts.map +1 -1
- package/out/policy/defaults.d.ts +5 -6
- package/out/policy/defaults.d.ts.map +1 -1
- package/out/policy/defaults.js +5 -6
- package/out/policy/defaults.js.map +1 -1
- package/out/policy/from-config.d.ts +8 -9
- package/out/policy/from-config.d.ts.map +1 -1
- package/out/policy/from-config.js +8 -9
- package/out/policy/from-config.js.map +1 -1
- package/out/policy/input-shape-router.d.ts +15 -19
- package/out/policy/input-shape-router.d.ts.map +1 -1
- package/out/policy/input-shape-router.js +11 -14
- package/out/policy/input-shape-router.js.map +1 -1
- package/out/policy/policy.d.ts +10 -13
- package/out/policy/policy.d.ts.map +1 -1
- package/out/policy/registry.d.ts +4 -5
- package/out/policy/registry.d.ts.map +1 -1
- package/out/policy/registry.js +6 -7
- package/out/policy/registry.js.map +1 -1
- package/out/resolver/index.d.ts +1 -1
- package/out/resolver/index.js +1 -1
- package/out/resolver/types.d.ts +212 -216
- package/out/resolver/types.d.ts.map +1 -1
- package/out/resolver/types.js +32 -39
- package/out/resolver/types.js.map +1 -1
- package/out/resources/LocaleIndex.d.ts +1 -2
- package/out/resources/LocaleIndex.d.ts.map +1 -1
- package/out/resources/LocaleIndex.js +1 -2
- package/out/resources/LocaleIndex.js.map +1 -1
- package/out/resources/ResourceMapCache.d.ts.map +1 -1
- package/out/resources/ResourceMapCache.js.map +1 -1
- package/out/resources/collections.d.ts +1 -2
- package/out/resources/collections.d.ts.map +1 -1
- package/out/resources/collections.js +1 -2
- package/out/resources/collections.js.map +1 -1
- package/out/resources/fs.d.ts.map +1 -1
- package/out/resources/fs.js.map +1 -1
- package/out/resources/git.d.ts.map +1 -1
- package/out/resources/git.js.map +1 -1
- package/out/resources/libaddressinput.d.ts +2 -2
- package/out/resources/libaddressinput.js +2 -2
- package/out/resources/libpostal.d.ts +4 -5
- package/out/resources/libpostal.d.ts.map +1 -1
- package/out/resources/libpostal.js +6 -7
- package/out/resources/libpostal.js.map +1 -1
- package/out/resources/set.d.ts +1 -2
- package/out/resources/set.d.ts.map +1 -1
- package/out/resources/set.js +1 -2
- package/out/resources/set.js.map +1 -1
- package/out/resources/whosonfirst/DataSourceCache.d.ts.map +1 -1
- package/out/resources/whosonfirst/DataSourceCache.js.map +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.d.ts +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.d.ts.map +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.js +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.js.map +1 -1
- package/out/resources/whosonfirst/loader.d.ts +1 -2
- package/out/resources/whosonfirst/loader.d.ts.map +1 -1
- package/out/resources/whosonfirst/loader.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/Placetype.d.ts +6 -9
- package/out/resources/whosonfirst/placetypes/Placetype.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/Placetype.js +7 -10
- package/out/resources/whosonfirst/placetypes/Placetype.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/admin.d.ts +1 -2
- package/out/resources/whosonfirst/placetypes/admin.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/admin.js +1 -2
- package/out/resources/whosonfirst/placetypes/admin.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/graph.d.ts +10 -10
- package/out/resources/whosonfirst/placetypes/graph.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/graph.js +0 -0
- package/out/resources/whosonfirst/placetypes/graph.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/mermaid.d.ts +16 -19
- package/out/resources/whosonfirst/placetypes/mermaid.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/mermaid.js +15 -16
- package/out/resources/whosonfirst/placetypes/mermaid.js.map +1 -1
- package/out/resources/whosonfirst/placetypes/tree.d.ts +6 -7
- package/out/resources/whosonfirst/placetypes/tree.d.ts.map +1 -1
- package/out/resources/whosonfirst/placetypes/tree.js +3 -4
- package/out/resources/whosonfirst/placetypes/tree.js.map +1 -1
- package/out/routing/index.d.ts +2 -3
- package/out/routing/index.d.ts.map +1 -1
- package/out/routing/index.js +1 -1
- package/out/routing/index.js.map +1 -1
- package/out/solver/HashMapSolver.d.ts.map +1 -1
- package/out/solver/HashMapSolver.js.map +1 -1
- package/out/solver/Solution.d.ts +2 -2
- package/out/solver/Solution.d.ts.map +1 -1
- package/out/solver/Solution.js +2 -2
- package/out/solver/Solution.js.map +1 -1
- package/out/solver/mask.d.ts.map +1 -1
- package/out/solver/mask.js.map +1 -1
- package/out/solvers/LeadingAreaDeclassifier.d.ts.map +1 -1
- package/out/solvers/LeadingAreaDeclassifier.js.map +1 -1
- package/out/solvers/MultiStreetSolver.d.ts +10 -15
- package/out/solvers/MultiStreetSolver.d.ts.map +1 -1
- package/out/solvers/MultiStreetSolver.js +10 -15
- package/out/solvers/MultiStreetSolver.js.map +1 -1
- package/out/solvers/PostcodePositionPenalty.d.ts +2 -2
- package/out/solvers/PostcodePositionPenalty.d.ts.map +1 -1
- package/out/solvers/PostcodePositionPenalty.js +2 -2
- package/out/solvers/PostcodePositionPenalty.js.map +1 -1
- package/out/tokenization/Span.d.ts +1 -3
- package/out/tokenization/Span.d.ts.map +1 -1
- package/out/tokenization/Span.js +1 -3
- package/out/tokenization/Span.js.map +1 -1
- package/out/tokenization/context.d.ts +1 -2
- package/out/tokenization/context.d.ts.map +1 -1
- package/out/tokenization/context.js +1 -2
- package/out/tokenization/context.js.map +1 -1
- package/out/tokenization/normalizer.js +2 -2
- package/out/tokenization/permutate.d.ts +2 -3
- package/out/tokenization/permutate.d.ts.map +1 -1
- package/out/tokenization/permutate.js +4 -5
- package/out/tokenization/permutate.js.map +1 -1
- package/out/types/classifier.d.ts +21 -23
- package/out/types/classifier.d.ts.map +1 -1
- package/out/types/component.d.ts +6 -7
- package/out/types/component.d.ts.map +1 -1
- package/out/types/component.js +5 -6
- package/out/types/component.js.map +1 -1
- package/out/types/mapping.d.ts +8 -8
- package/out/types/mapping.d.ts.map +1 -1
- package/out/types/mapping.js +13 -13
- package/out/types/mapping.js.map +1 -1
- package/out/utils/data-root.d.ts +5 -5
- package/out/utils/data-root.js +7 -7
- package/out/utils/repo.d.ts +3 -3
- package/out/utils/repo.d.ts.map +1 -1
- package/out/utils/repo.js +16 -19
- package/out/utils/repo.js.map +1 -1
- package/out/vitest.config.d.ts.map +1 -1
- package/out/vitest.config.js.map +1 -1
- package/package.json +21 -19
- package/data/chromium-i18n/ssl-address-download.sh +0 -15
- package/data/libpostal/resources-download.sh +0 -44
- package/out/logging/tables.d.ts +0 -7
- package/out/logging/tables.d.ts.map +0 -1
- package/out/logging/tables.js +0 -75
- package/out/logging/tables.js.map +0 -1
- package/out/sets.d.ts +0 -2
- package/out/sets.d.ts.map +0 -1
- package/out/sets.js +0 -2
- package/out/sets.js.map +0 -1
package/out/pipeline/types.d.ts
CHANGED
|
@@ -33,15 +33,13 @@ export interface PipelineOpts {
|
|
|
33
33
|
/** Disable fast-path shortcuts; always run the full pipeline. */
|
|
34
34
|
forceFullPipeline?: boolean;
|
|
35
35
|
/**
|
|
36
|
-
* The joint-reconcile path (Stage 5 beam search). Promoted to default by Route A Phase II (#427),
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* classifier exposing `parseWithLogits`; when either is absent the pipeline uses argmax
|
|
44
|
-
* regardless.
|
|
36
|
+
* The joint-reconcile path (Stage 5 beam search). Promoted to default by Route A Phase II (#427), then RETIRED AS
|
|
37
|
+
* DEFAULT 2026-06-14: a reconcile-vs-raw-neural audit found it breaks the street+house_number geocode precondition on
|
|
38
|
+
* 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
|
|
39
|
+
* every tag, venue included). The phrase grouper bundles the house number into the STREET_PHRASE and reconcileSpans
|
|
40
|
+
* fuses the span. The #427 "DE +25pp" gains were loose street-string recall on OOD inputs, not the geocode
|
|
41
|
+
* precondition. Default (unset) is now `false` (argmax). It still requires a phrase grouper + a classifier exposing
|
|
42
|
+
* `parseWithLogits`; when either is absent the pipeline uses argmax regardless.
|
|
45
43
|
*
|
|
46
44
|
* Set `jointReconcile: true` to opt back into reconcile (the A/B harnesses do). Report:
|
|
47
45
|
* docs/articles/evals/2026-06-14-reconcile-retirement.md.
|
|
@@ -52,36 +50,36 @@ export interface PipelineOpts {
|
|
|
52
50
|
/** Hard cap on lookups the resolver may issue; passed through. */
|
|
53
51
|
resolveOpts?: ResolveOpts;
|
|
54
52
|
/**
|
|
55
|
-
* Per-component rule-vs-neural arbitration (#478 increment 3). When `true` AND a `ruleProposer`
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
53
|
+
* Per-component rule-vs-neural arbitration (#478 increment 3). When `true` AND a `ruleProposer` stage is wired, the
|
|
54
|
+
* coordinator unions the whole-text neural parse with the solved v0 rule parse (as proposals), filters them
|
|
55
|
+
* per-component via the input-shape router prior, resolves span overlaps, and rebuilds the tree from the survivors.
|
|
56
|
+
* Default (unset) ⇒ `false` ⇒ the neural argmax tree is used unchanged (byte-stable). Behind a flag pending the
|
|
57
|
+
* assembled gate.
|
|
60
58
|
*/
|
|
61
59
|
arbitrate?: boolean;
|
|
62
60
|
/**
|
|
63
|
-
* #690: title-case detected all-caps ASCII input before the Stage 3 classifier (helps on all-caps
|
|
64
|
-
*
|
|
61
|
+
* #690: title-case detected all-caps ASCII input before the Stage 3 classifier (helps on all-caps registry/compliance
|
|
62
|
+
* data). Threaded to `ClassifierOpts.normalizeCase`. Detection-gated
|
|
65
63
|
*
|
|
66
64
|
* - Off by default → byte-stable for mixed-case input.
|
|
67
65
|
*/
|
|
68
66
|
normalizeCase?: boolean;
|
|
69
67
|
/**
|
|
70
|
-
* #743/#194: promote a CONFIDENT coarse-placer guess from the soft `anchorPosterior` boost to a
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
68
|
+
* #743/#194: promote a CONFIDENT coarse-placer guess from the soft `anchorPosterior` boost to a HARD country filter
|
|
69
|
+
* (empty→unresolved) — see {@link ResolveOpts.hardCountry}. Gated three ways: the placer's confidence ≥
|
|
70
|
+
* `HARD_PLACE_COUNTRY_MIN_CONF` (ambiguous DK↔NO stay soft), the country is in the coverage
|
|
71
|
+
* `HARD_PLACE_COUNTRY_SAFELIST` (or a {@link hardCountrySafelist} override), and no caller
|
|
72
|
+
* `hardCountry`/`defaultCountry` is already set. **Default-ON** in the shipped
|
|
73
|
+
* `createRuntimePipeline`/`geocodeAddress` (#743, 2026-06-22) — but the safelist confines the hard filter to
|
|
74
|
+
* well-covered countries, so the low-coverage tail (FI/PL) keeps its recall on the soft path with no regression. Pass
|
|
75
|
+
* `false` to force the pre-#194 soft-only behavior.
|
|
78
76
|
*/
|
|
79
77
|
hardPlaceCountry?: boolean;
|
|
80
78
|
/**
|
|
81
|
-
* #743/#194: override the coverage safelist that gates {@link hardPlaceCountry}. Undefined → the
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
79
|
+
* #743/#194: override the coverage safelist that gates {@link hardPlaceCountry}. Undefined → the built-in
|
|
80
|
+
* `HARD_PLACE_COUNTRY_SAFELIST` (production). Supply a set to test/measure a different coverage frontier — the
|
|
81
|
+
* resolver eval passes the full in-map country set to measure ungated hard-resolve-rates (which is how the production
|
|
82
|
+
* safelist is grown).
|
|
85
83
|
*/
|
|
86
84
|
hardCountrySafelist?: ReadonlySet<string>;
|
|
87
85
|
signal?: AbortSignal;
|
|
@@ -130,14 +128,14 @@ export interface QueryKindResult {
|
|
|
130
128
|
}>;
|
|
131
129
|
}
|
|
132
130
|
/**
|
|
133
|
-
* Stage 2.7 phrase grouper output. Coarse phrase-shape hypothesis attached to a `Section` (sub-Span
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
131
|
+
* Stage 2.7 phrase grouper output. Coarse phrase-shape hypothesis attached to a `Section` (sub-Span of the tokenized
|
|
132
|
+
* input). The classifier (Stage 3) conditions on these proposals so it can answer the simpler "what type is this
|
|
133
|
+
* proposed span?" instead of jointly discovering boundaries and types. The reconciler (Stage 5) consumes them as
|
|
134
|
+
* boundary candidates for joint decoding.
|
|
137
135
|
*
|
|
138
|
-
* Taxonomy is purely structural — no place-name knowledge. A `LOCALITY_PHRASE` proposal is "this
|
|
139
|
-
*
|
|
140
|
-
*
|
|
136
|
+
* Taxonomy is purely structural — no place-name knowledge. A `LOCALITY_PHRASE` proposal is "this looks shaped like a
|
|
137
|
+
* multi-word capitalized phrase that could be a city name" — not "this IS New York." Typing the span is the
|
|
138
|
+
* classifier's job.
|
|
141
139
|
*
|
|
142
140
|
* See `docs/articles/concepts/the-knowledge-ladder.md` § Phrase grouper for the design rationale.
|
|
143
141
|
*/
|
|
@@ -149,10 +147,9 @@ export type PhraseKind = "NUMERIC" | "STREET_PHRASE" | "LOCALITY_PHRASE" | "REGI
|
|
|
149
147
|
* - `kindHypothesis`: structural shape this slice looks like.
|
|
150
148
|
* - `confidence`: 0..1 score. Used by downstream stages to weight proposals.
|
|
151
149
|
*
|
|
152
|
-
* Per "possibilities not constraints", emit a proposal whenever a rule fires — overlapping
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
* grouper prefers).
|
|
150
|
+
* Per "possibilities not constraints", emit a proposal whenever a rule fires — overlapping proposals over the same
|
|
151
|
+
* tokens are expected (e.g. `Saint Petersburg` may surface as one `LOCALITY_PHRASE` AND two `LOCALITY_PHRASE`s, with
|
|
152
|
+
* confidence ordering signalling which the grouper prefers).
|
|
156
153
|
*/
|
|
157
154
|
export interface PhraseProposal {
|
|
158
155
|
span: Section;
|
|
@@ -160,38 +157,37 @@ export interface PhraseProposal {
|
|
|
160
157
|
confidence: number;
|
|
161
158
|
}
|
|
162
159
|
/**
|
|
163
|
-
* Stage 2.7 contract. Structural — any of the rule-based grouper (`@mailwoman/phrase-grouper`), a
|
|
164
|
-
*
|
|
165
|
-
*
|
|
160
|
+
* Stage 2.7 contract. Structural — any of the rule-based grouper (`@mailwoman/phrase-grouper`), a learned span proposer
|
|
161
|
+
* (future), or a fake for tests satisfies this. Async so the coordinator can stay uniform even when implementations
|
|
162
|
+
* call into models.
|
|
166
163
|
*/
|
|
167
164
|
export interface PhraseGrouper {
|
|
168
165
|
group(input: NormalizedInputLite, shape: QueryShapeLite, locale: LocaleHint): Promise<PhraseProposal[]>;
|
|
169
166
|
}
|
|
170
167
|
/**
|
|
171
|
-
* Stage 3 contract: classifier that turns a text into an `AddressTree`. Structural — any of
|
|
172
|
-
*
|
|
173
|
-
* satisfies this.
|
|
168
|
+
* Stage 3 contract: classifier that turns a text into an `AddressTree`. Structural — any of `@mailwoman/neural`'s
|
|
169
|
+
* `NeuralAddressClassifier`, a rule-based classifier, or a fake for tests satisfies this.
|
|
174
170
|
*/
|
|
175
171
|
/**
|
|
176
172
|
* Structural type for the FST gazetteer matcher, compatible with
|
|
177
173
|
*
|
|
178
|
-
* @mailwoman/core/resolver-wof-sqlite's
|
|
174
|
+
* @mailwoman/core/resolver-wof-sqlite's FSTMatcher.
|
|
179
175
|
*/
|
|
180
|
-
export interface
|
|
176
|
+
export interface FSTMatcherLike {
|
|
181
177
|
walk(tokens: string[]): {
|
|
182
|
-
|
|
178
|
+
stateID: number;
|
|
183
179
|
accepted: boolean;
|
|
184
180
|
depth: number;
|
|
185
181
|
} | null;
|
|
186
182
|
walkFrom(prev: {
|
|
187
|
-
|
|
183
|
+
stateID: number;
|
|
188
184
|
depth: number;
|
|
189
185
|
}, token: string): {
|
|
190
|
-
|
|
186
|
+
stateID: number;
|
|
191
187
|
accepted: boolean;
|
|
192
188
|
depth: number;
|
|
193
189
|
} | null;
|
|
194
|
-
accepting(
|
|
190
|
+
accepting(stateID: number): Array<{
|
|
195
191
|
wofID: number;
|
|
196
192
|
placetype: string;
|
|
197
193
|
importance: number;
|
|
@@ -199,14 +195,13 @@ export interface FstMatcherLike {
|
|
|
199
195
|
}
|
|
200
196
|
export interface ClassifierOpts {
|
|
201
197
|
queryShape?: QueryShapeLite;
|
|
202
|
-
fst?:
|
|
198
|
+
fst?: FSTMatcherLike;
|
|
203
199
|
fstBiasScale?: number;
|
|
204
200
|
/** Run the deterministic postcode regex repair pass (v0.7 #35) on the decoded labels. */
|
|
205
201
|
postcodeRepair?: boolean;
|
|
206
202
|
/**
|
|
207
|
-
* #690: title-case a detected all-caps ASCII input before the model (all-caps registry/compliance
|
|
208
|
-
*
|
|
209
|
-
* default.
|
|
203
|
+
* #690: title-case a detected all-caps ASCII input before the model (all-caps registry/compliance data is partly
|
|
204
|
+
* OOD). Detection-gated — mixed-case + non-ASCII input is untouched. Off by default.
|
|
210
205
|
*/
|
|
211
206
|
normalizeCase?: boolean;
|
|
212
207
|
}
|
|
@@ -214,10 +209,9 @@ export interface AddressClassifier {
|
|
|
214
209
|
parse(text: string, opts?: ClassifierOpts): Promise<AddressTree>;
|
|
215
210
|
}
|
|
216
211
|
/**
|
|
217
|
-
* Injectable stage implementations. All optional — when a stage is absent, the coordinator either
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
* can only fast-path on QueryShape known-formats.
|
|
212
|
+
* Injectable stage implementations. All optional — when a stage is absent, the coordinator either skips it (resolver)
|
|
213
|
+
* or substitutes a no-op stub (normalize / queryShape / locale gate / kind classifier). The classifier is required for
|
|
214
|
+
* the full pipeline path; without it, the coordinator can only fast-path on QueryShape known-formats.
|
|
221
215
|
*/
|
|
222
216
|
export interface RuntimePipelineStages {
|
|
223
217
|
normalize?: (raw: string, opts?: {
|
|
@@ -231,17 +225,16 @@ export interface RuntimePipelineStages {
|
|
|
231
225
|
}) => Promise<LocaleHint>;
|
|
232
226
|
classifyKind?: (input: NormalizedInputLite, shape: QueryShapeLite, locale: LocaleHint) => Promise<QueryKindResult>;
|
|
233
227
|
/**
|
|
234
|
-
* Coarse country router (#244). A `(normalizedText) → { country, confidence, posterior? }`
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
* default → byte-stable.
|
|
228
|
+
* Coarse country router (#244). A `(normalizedText) → { country, confidence, posterior? }` predictor (a
|
|
229
|
+
* `CoarsePlacer`-backed fn); `country: null` ⇒ abstained, `"OTHER"` ⇒ off-map. When provided, a confident IN-MAP
|
|
230
|
+
* guess becomes a SOFT country prior fed into the resolver's #369 `anchorPosterior` re-rank (boosts the right-country
|
|
231
|
+
* candidate, never filters); it defers to a caller-supplied posterior (a stronger postcode anchor) and is a no-op on
|
|
232
|
+
* abstain/OTHER. Off by default → byte-stable.
|
|
240
233
|
*
|
|
241
|
-
* `posterior` (residual upgrade) is the full per-in-map-country distribution: when present it IS
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
*
|
|
234
|
+
* `posterior` (residual upgrade) is the full per-in-map-country distribution: when present it IS the
|
|
235
|
+
* `anchorPosterior` (so the resolver breaks country-ambiguous ties with its own place-level evidence); when absent
|
|
236
|
+
* the coordinator falls back to the one-hot `{ [country]: confidence }`. See
|
|
237
|
+
* docs/articles/plan/2026-06-14-coarse-placer-soft-signal-spec.md.
|
|
245
238
|
*/
|
|
246
239
|
placeCountry?: (normalizedText: string) => {
|
|
247
240
|
country: string | null;
|
|
@@ -249,30 +242,28 @@ export interface RuntimePipelineStages {
|
|
|
249
242
|
posterior?: Record<string, number>;
|
|
250
243
|
};
|
|
251
244
|
/**
|
|
252
|
-
* Stage 2.7 phrase grouper. Emits coherent input-unit proposals consumed by Stage 3 (as
|
|
253
|
-
*
|
|
254
|
-
*
|
|
245
|
+
* Stage 2.7 phrase grouper. Emits coherent input-unit proposals consumed by Stage 3 (as conditioning) and Stage 5 (as
|
|
246
|
+
* boundary candidates). Hard dep in v0.5.0; pre-v0.5.0 callers run with no grouper and the result `phraseProposals`
|
|
247
|
+
* field is empty.
|
|
255
248
|
*/
|
|
256
249
|
groupPhrases?: (input: NormalizedInputLite, shape: QueryShapeLite, locale: LocaleHint) => Promise<PhraseProposal[]>;
|
|
257
250
|
classifier?: AddressClassifier;
|
|
258
251
|
/**
|
|
259
|
-
* Pre-built FST gazetteer matcher. When provided, gazetteer matches produce additive emission
|
|
260
|
-
*
|
|
252
|
+
* Pre-built FST gazetteer matcher. When provided, gazetteer matches produce additive emission biases during
|
|
253
|
+
* classification.
|
|
261
254
|
*/
|
|
262
|
-
fst?:
|
|
255
|
+
fst?: FSTMatcherLike;
|
|
263
256
|
resolver?: Resolver;
|
|
264
257
|
/**
|
|
265
|
-
* The gazetteer BACKEND (lower-level than `resolver`), enabling the reconciler's concordance axes
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
* behavior, byte-stable).
|
|
258
|
+
* The gazetteer BACKEND (lower-level than `resolver`), enabling the reconciler's concordance axes (#478): a bounded
|
|
259
|
+
* pre-fetch turns it into the resolver-candidate + parent-chain lookups `reconcileSpans` scores with. Optional —
|
|
260
|
+
* absent, reconcile runs classifier-only (today's behavior, byte-stable).
|
|
269
261
|
*/
|
|
270
262
|
resolverBackend?: ResolverBackend;
|
|
271
263
|
/**
|
|
272
|
-
* The "rule source" for arbitration (#478 increment 3): `(normalizedText, locale) → rule
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
* `createRuntimePipeline` from `createAddressParser` + `solutionToProposals`. Absent ⇒
|
|
264
|
+
* The "rule source" for arbitration (#478 increment 3): `(normalizedText, locale) → rule proposals`, derived from the
|
|
265
|
+
* SOLVED v0 parser (its solver-coordinated output, not raw classifier firings). Invoked only when `opts.arbitrate` is
|
|
266
|
+
* set. Typically wired by `createRuntimePipeline` from `createAddressParser` + `solutionToProposals`. Absent ⇒
|
|
276
267
|
* arbitration is a no-op.
|
|
277
268
|
*/
|
|
278
269
|
ruleProposer?: (normalizedText: string, locale: string) => Promise<ClassificationProposal[]>;
|
|
@@ -288,9 +279,9 @@ export interface PipelineResult {
|
|
|
288
279
|
locale: LocaleHint;
|
|
289
280
|
kind: QueryKindResult;
|
|
290
281
|
/**
|
|
291
|
-
* Stage 2.7 phrase proposals when a grouper was wired. Empty array when the coordinator ran with
|
|
292
|
-
*
|
|
293
|
-
*
|
|
282
|
+
* Stage 2.7 phrase proposals when a grouper was wired. Empty array when the coordinator ran with no grouper
|
|
283
|
+
* (pre-v0.5.0 callers) or when the fast-path skipped Stage 2.7. Stage 3 consumes this as conditioning; Stage 5
|
|
284
|
+
* consumes it as boundary candidates.
|
|
294
285
|
*/
|
|
295
286
|
phraseProposals: PhraseProposal[];
|
|
296
287
|
tree: AddressTree;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../pipeline/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE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/out/policy/defaults.d.ts
CHANGED
|
@@ -10,13 +10,12 @@
|
|
|
10
10
|
import { type ComponentTag } from "@mailwoman/core/types";
|
|
11
11
|
import type { ClassifierPolicy, PolicyMode } from "./policy.js";
|
|
12
12
|
/**
|
|
13
|
-
* Build a fresh array of policies — one per `ComponentTag`, all in `mode`. Returns a new array on
|
|
14
|
-
*
|
|
13
|
+
* Build a fresh array of policies — one per `ComponentTag`, all in `mode`. Returns a new array on each call; callers
|
|
14
|
+
* may mutate it freely.
|
|
15
15
|
*
|
|
16
|
-
* `mode` defaults to `rule_only` (the historical default — every component rule-sourced until a
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* before per-tag config overlays.
|
|
16
|
+
* `mode` defaults to `rule_only` (the historical default — every component rule-sourced until a per-tag migration). The
|
|
17
|
+
* input-shape router (#478 increment 2) passes a shape-derived default (e.g. `neural_preferred` for OOD-script input)
|
|
18
|
+
* so the whole table starts from the routed prior before per-tag config overlays.
|
|
20
19
|
*/
|
|
21
20
|
export declare function buildDefaultPolicies(mode?: PolicyMode): ClassifierPolicy[];
|
|
22
21
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../policy/defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../policy/defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE/D;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,GAAE,UAAwB,GAAG,gBAAgB,EAAE,CAKvF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,YAAY,EAAE,IAAI,GAAE,UAAwB,GAAG,gBAAgB,CAE1G"}
|
package/out/policy/defaults.js
CHANGED
|
@@ -9,13 +9,12 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { COMPONENT_TAGS } from "@mailwoman/core/types";
|
|
11
11
|
/**
|
|
12
|
-
* Build a fresh array of policies — one per `ComponentTag`, all in `mode`. Returns a new array on
|
|
13
|
-
*
|
|
12
|
+
* Build a fresh array of policies — one per `ComponentTag`, all in `mode`. Returns a new array on each call; callers
|
|
13
|
+
* may mutate it freely.
|
|
14
14
|
*
|
|
15
|
-
* `mode` defaults to `rule_only` (the historical default — every component rule-sourced until a
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* before per-tag config overlays.
|
|
15
|
+
* `mode` defaults to `rule_only` (the historical default — every component rule-sourced until a per-tag migration). The
|
|
16
|
+
* input-shape router (#478 increment 2) passes a shape-derived default (e.g. `neural_preferred` for OOD-script input)
|
|
17
|
+
* so the whole table starts from the routed prior before per-tag config overlays.
|
|
19
18
|
*/
|
|
20
19
|
export function buildDefaultPolicies(mode = "rule_only") {
|
|
21
20
|
return COMPONENT_TAGS.map((component) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../policy/defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,cAAc,EAAqB,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../policy/defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,cAAc,EAAqB,MAAM,uBAAuB,CAAA;AAIzE;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAmB,WAAW;IAClE,OAAO,cAAc,CAAC,GAAG,CAAmB,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QAC3D,SAAS;QACT,IAAI;KACJ,CAAC,CAAC,CAAA;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,SAAuB,EAAE,OAAmB,WAAW;IACvF,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAA;AAC3B,CAAC"}
|
|
@@ -36,18 +36,17 @@ export interface PolicyConfigEntry {
|
|
|
36
36
|
/** The JSON shape of a policy config file: locale (or `"*"` for global) → tag → entry. */
|
|
37
37
|
export type PolicyConfig = Record<string, Record<string, PolicyConfigEntry>>;
|
|
38
38
|
/**
|
|
39
|
-
* Build a registry from a parsed policy-config object. Starts from `withDefaults(defaultMode)`
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* JSON path.
|
|
39
|
+
* Build a registry from a parsed policy-config object. Starts from `withDefaults(defaultMode)` (every tag at
|
|
40
|
+
* `defaultMode`, historically `rule_only`) and overlays the config's entries — so an absent tag falls to `defaultMode`.
|
|
41
|
+
* The input-shape router (#478 increment 2) passes its shape-derived default as `defaultMode` so config entries still
|
|
42
|
+
* win per-tag while un-configured tags follow the route. Throws on ANY unrecognized key or value; the error names the
|
|
43
|
+
* offending JSON path.
|
|
45
44
|
*/
|
|
46
45
|
export declare function policyRegistryFromConfig(config: PolicyConfig, defaultMode?: PolicyMode): InMemoryPolicyRegistry;
|
|
47
46
|
/**
|
|
48
|
-
* Build a registry whose default layer is an input-shape route's `defaultMode` (#478 increment 2),
|
|
49
|
-
*
|
|
50
|
-
*
|
|
47
|
+
* Build a registry whose default layer is an input-shape route's `defaultMode` (#478 increment 2), with optional
|
|
48
|
+
* per-tag `config` overlaid on top — so the routed prior fills every un-configured tag while explicit policy still wins
|
|
49
|
+
* per-tag. Thin wrapper over {@link policyRegistryFromConfig}.
|
|
51
50
|
*/
|
|
52
51
|
export declare function policyRegistryFromRoute(route: InputShapeRoute, config?: PolicyConfig): InMemoryPolicyRegistry;
|
|
53
52
|
//# sourceMappingURL=from-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"from-config.d.ts","sourceRoot":"","sources":["../../policy/from-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAMtD,2DAA2D;AAC3D,MAAM,WAAW,iBAAiB;IACjC,IAAI,EAAE,UAAU,CAAA;IAChB,oBAAoB,CAAC,EAAE,MAAM,CAAA;CAC7B;AAED,0FAA0F;AAC1F,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAA;AAE5E
|
|
1
|
+
{"version":3,"file":"from-config.d.ts","sourceRoot":"","sources":["../../policy/from-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAMtD,2DAA2D;AAC3D,MAAM,WAAW,iBAAiB;IACjC,IAAI,EAAE,UAAU,CAAA;IAChB,oBAAoB,CAAC,EAAE,MAAM,CAAA;CAC7B;AAED,0FAA0F;AAC1F,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAA;AAE5E;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACvC,MAAM,EAAE,YAAY,EACpB,WAAW,GAAE,UAAwB,GACnC,sBAAsB,CAqDxB;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,GAAE,YAAiB,GAAG,sBAAsB,CAEjH"}
|
|
@@ -31,12 +31,11 @@ const POLICY_MODES = ["rule_only", "neural_only", "both", "neural_preferred", "r
|
|
|
31
31
|
const ENTRY_FIELDS = new Set(["mode", "confidence_threshold"]);
|
|
32
32
|
const TAG_SET = new Set(COMPONENT_TAGS);
|
|
33
33
|
/**
|
|
34
|
-
* Build a registry from a parsed policy-config object. Starts from `withDefaults(defaultMode)`
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* JSON path.
|
|
34
|
+
* Build a registry from a parsed policy-config object. Starts from `withDefaults(defaultMode)` (every tag at
|
|
35
|
+
* `defaultMode`, historically `rule_only`) and overlays the config's entries — so an absent tag falls to `defaultMode`.
|
|
36
|
+
* The input-shape router (#478 increment 2) passes its shape-derived default as `defaultMode` so config entries still
|
|
37
|
+
* win per-tag while un-configured tags follow the route. Throws on ANY unrecognized key or value; the error names the
|
|
38
|
+
* offending JSON path.
|
|
40
39
|
*/
|
|
41
40
|
export function policyRegistryFromConfig(config, defaultMode = "rule_only") {
|
|
42
41
|
if (typeof config !== "object" || config === null || Array.isArray(config)) {
|
|
@@ -81,9 +80,9 @@ export function policyRegistryFromConfig(config, defaultMode = "rule_only") {
|
|
|
81
80
|
return registry;
|
|
82
81
|
}
|
|
83
82
|
/**
|
|
84
|
-
* Build a registry whose default layer is an input-shape route's `defaultMode` (#478 increment 2),
|
|
85
|
-
*
|
|
86
|
-
*
|
|
83
|
+
* Build a registry whose default layer is an input-shape route's `defaultMode` (#478 increment 2), with optional
|
|
84
|
+
* per-tag `config` overlaid on top — so the routed prior fills every un-configured tag while explicit policy still wins
|
|
85
|
+
* per-tag. Thin wrapper over {@link policyRegistryFromConfig}.
|
|
87
86
|
*/
|
|
88
87
|
export function policyRegistryFromRoute(route, config = {}) {
|
|
89
88
|
return policyRegistryFromConfig(config, route.defaultMode);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"from-config.js","sourceRoot":"","sources":["../../policy/from-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,cAAc,EAAqB,MAAM,uBAAuB,CAAA;AAGzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAEtD,MAAM,YAAY,GAA0B,CAAC,WAAW,EAAE,aAAa,EAAE,MAAM,EAAE,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;AACtH,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC,CAAA;AAC9D,MAAM,OAAO,GAAG,IAAI,GAAG,CAAS,cAAc,CAAC,CAAA;AAW/C
|
|
1
|
+
{"version":3,"file":"from-config.js","sourceRoot":"","sources":["../../policy/from-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,cAAc,EAAqB,MAAM,uBAAuB,CAAA;AAGzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAEtD,MAAM,YAAY,GAA0B,CAAC,WAAW,EAAE,aAAa,EAAE,MAAM,EAAE,kBAAkB,EAAE,gBAAgB,CAAC,CAAA;AACtH,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC,CAAA;AAC9D,MAAM,OAAO,GAAG,IAAI,GAAG,CAAS,cAAc,CAAC,CAAA;AAW/C;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CACvC,MAAoB,EACpB,cAA0B,WAAW;IAErC,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5E,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAA;IACjF,CAAC;IACD,MAAM,QAAQ,G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
|
}
|
|
47
47
|
/**
|
|
48
|
-
* Minimal coarse-placer signal (#244). Compatible with `CoarsePrediction`
|
|
49
|
-
*
|
|
50
|
-
* never as an abstention.
|
|
48
|
+
* Minimal coarse-placer signal (#244). Compatible with `CoarsePrediction` (`core/coarse-placer/coarse-placer.ts`).
|
|
49
|
+
* `null` means no placer ran — treated as "no OOD signal", never as an abstention.
|
|
51
50
|
*/
|
|
52
51
|
export interface RouterPlacerSignal {
|
|
53
52
|
/** The in-map country argmax, `null` when abstained, or `"OTHER"` when off-map. */
|
|
@@ -66,19 +65,18 @@ export interface InputShapeRoute {
|
|
|
66
65
|
*/
|
|
67
66
|
defaultMode: PolicyMode;
|
|
68
67
|
/**
|
|
69
|
-
* True when both sources are weak (low kind confidence and/or the placer abstained on a non-clean
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* `defaultMode` is `both` when this is set (drop nothing).
|
|
68
|
+
* True when both sources are weak (low kind confidence and/or the placer abstained on a non-clean shape). A
|
|
69
|
+
* first-class outcome reserved for the resolver/admin honest-radius downgrade — but it has NO consumer until #478
|
|
70
|
+
* increment 3, so for now it is computed and reported only. `defaultMode` is `both` when this is set (drop nothing).
|
|
73
71
|
*/
|
|
74
72
|
abstain: boolean;
|
|
75
73
|
/** Human-readable trace of which branch fired — for telemetry and test assertions. */
|
|
76
74
|
reason: string;
|
|
77
75
|
}
|
|
78
76
|
/**
|
|
79
|
-
* Minimum kind confidence to route a clean kind to `rule_preferred`. Strict by design: below this,
|
|
80
|
-
*
|
|
81
|
-
*
|
|
77
|
+
* Minimum kind confidence to route a clean kind to `rule_preferred`. Strict by design: below this, v0's rules are
|
|
78
|
+
* brittle on structured input and a confident wrong preference is worse than keeping both sources
|
|
79
|
+
* (DeepSeek-coordinated, 2026-06-17 — 0.7 invited false-preference).
|
|
82
80
|
*/
|
|
83
81
|
export declare const CLEAN_KIND_CONFIDENCE = 0.8;
|
|
84
82
|
/**
|
|
@@ -86,15 +84,13 @@ export declare const CLEAN_KIND_CONFIDENCE = 0.8;
|
|
|
86
84
|
*
|
|
87
85
|
* The decision tree (first match wins):
|
|
88
86
|
*
|
|
89
|
-
* 0. **OOD script** (`cjk` / `cyrillic` / `arabic`) → `neural_preferred`. Script dominates — rules are
|
|
90
|
-
*
|
|
91
|
-
* 1. **Clean structured** — a {@link RULE_CLEAN_KINDS} kind at confidence ≥
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* `
|
|
96
|
-
* 3. **Otherwise** (confident, Latin, placer-OK, but not a clean kind — `landmark`, `vague`,
|
|
97
|
-
* `locality_only`) → `neural_preferred`.
|
|
87
|
+
* 0. **OOD script** (`cjk` / `cyrillic` / `arabic`) → `neural_preferred`. Script dominates — rules are Latin-centric, so
|
|
88
|
+
* non-Latin input is neural's regardless of kind.
|
|
89
|
+
* 1. **Clean structured** — a {@link RULE_CLEAN_KINDS} kind at confidence ≥ {@link CLEAN_KIND_CONFIDENCE}, a Latin/unknown
|
|
90
|
+
* character class, and the placer not abstained → `rule_preferred`. v0's home turf.
|
|
91
|
+
* 2. **Both weak** — the placer abstained, or kind confidence is below the cutoff → `abstain` (mode `both`, drop nothing).
|
|
92
|
+
* 3. **Otherwise** (confident, Latin, placer-OK, but not a clean kind — `landmark`, `vague`, `locality_only`) →
|
|
93
|
+
* `neural_preferred`.
|
|
98
94
|
*
|
|
99
95
|
* @param kind Kind-classifier signal.
|
|
100
96
|
* @param shape Query-shape signal.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-shape-router.d.ts","sourceRoot":"","sources":["../../policy/input-shape-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE7C,oGAAoG;AACpG,MAAM,WAAW,gBAAgB;IAChC,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAA;IACZ,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAA;CAClB;AAED,+FAA+F;AAC/F,MAAM,WAAW,iBAAiB;IACjC;;;;;;;;;;OAUG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;CACvB;AAED
|
|
1
|
+
{"version":3,"file":"input-shape-router.d.ts","sourceRoot":"","sources":["../../policy/input-shape-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE7C,oGAAoG;AACpG,MAAM,WAAW,gBAAgB;IAChC,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAA;IACZ,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAA;CAClB;AAED,+FAA+F;AAC/F,MAAM,WAAW,iBAAiB;IACjC;;;;;;;;;;OAUG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAClC,mFAAmF;IACnF,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,qDAAqD;IACrD,SAAS,EAAE,OAAO,CAAA;CAClB;AAED,qGAAqG;AACrG,MAAM,WAAW,eAAe;IAC/B;;;;;;OAMG;IACH,WAAW,EAAE,UAAU,CAAA;IACvB;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAA;IAChB,sFAAsF;IACtF,MAAM,EAAE,MAAM,CAAA;CACd;AAaD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAA;AAExC;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAC9B,IAAI,EAAE,gBAAgB,EACtB,KAAK,EAAE,iBAAiB,EACxB,MAAM,EAAE,kBAAkB,GAAG,IAAI,GAC/B,eAAe,CAoCjB"}
|
|
@@ -24,16 +24,15 @@
|
|
|
24
24
|
/** Kinds the rules system handles well when the rest of the shape is clean. */
|
|
25
25
|
const RULE_CLEAN_KINDS = new Set(["structured_address", "intersection", "po_box", "postcode_only"]);
|
|
26
26
|
/**
|
|
27
|
-
* Non-Latin scripts where the Latin-centric rules system is weak — hand to neural regardless of
|
|
28
|
-
* kind.
|
|
27
|
+
* Non-Latin scripts where the Latin-centric rules system is weak — hand to neural regardless of kind.
|
|
29
28
|
*/
|
|
30
29
|
const OOD_SCRIPTS = new Set(["cjk", "cyrillic", "arabic"]);
|
|
31
30
|
/** Character classes that count as "Latin / clean" for the `rule_preferred` guard. */
|
|
32
31
|
const LATIN_CLASSES = new Set(["numeric", "alpha", "alphanumeric"]);
|
|
33
32
|
/**
|
|
34
|
-
* Minimum kind confidence to route a clean kind to `rule_preferred`. Strict by design: below this,
|
|
35
|
-
*
|
|
36
|
-
*
|
|
33
|
+
* Minimum kind confidence to route a clean kind to `rule_preferred`. Strict by design: below this, v0's rules are
|
|
34
|
+
* brittle on structured input and a confident wrong preference is worse than keeping both sources
|
|
35
|
+
* (DeepSeek-coordinated, 2026-06-17 — 0.7 invited false-preference).
|
|
37
36
|
*/
|
|
38
37
|
export const CLEAN_KIND_CONFIDENCE = 0.8;
|
|
39
38
|
/**
|
|
@@ -41,15 +40,13 @@ export const CLEAN_KIND_CONFIDENCE = 0.8;
|
|
|
41
40
|
*
|
|
42
41
|
* The decision tree (first match wins):
|
|
43
42
|
*
|
|
44
|
-
* 0. **OOD script** (`cjk` / `cyrillic` / `arabic`) → `neural_preferred`. Script dominates — rules are
|
|
45
|
-
*
|
|
46
|
-
* 1. **Clean structured** — a {@link RULE_CLEAN_KINDS} kind at confidence ≥
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* `
|
|
51
|
-
* 3. **Otherwise** (confident, Latin, placer-OK, but not a clean kind — `landmark`, `vague`,
|
|
52
|
-
* `locality_only`) → `neural_preferred`.
|
|
43
|
+
* 0. **OOD script** (`cjk` / `cyrillic` / `arabic`) → `neural_preferred`. Script dominates — rules are Latin-centric, so
|
|
44
|
+
* non-Latin input is neural's regardless of kind.
|
|
45
|
+
* 1. **Clean structured** — a {@link RULE_CLEAN_KINDS} kind at confidence ≥ {@link CLEAN_KIND_CONFIDENCE}, a Latin/unknown
|
|
46
|
+
* character class, and the placer not abstained → `rule_preferred`. v0's home turf.
|
|
47
|
+
* 2. **Both weak** — the placer abstained, or kind confidence is below the cutoff → `abstain` (mode `both`, drop nothing).
|
|
48
|
+
* 3. **Otherwise** (confident, Latin, placer-OK, but not a clean kind — `landmark`, `vague`, `locality_only`) →
|
|
49
|
+
* `neural_preferred`.
|
|
53
50
|
*
|
|
54
51
|
* @param kind Kind-classifier signal.
|
|
55
52
|
* @param shape Query-shape signal.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-shape-router.js","sourceRoot":"","sources":["../../policy/input-shape-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;
|
|
1
|
+
{"version":3,"file":"input-shape-router.js","sourceRoot":"","sources":["../../policy/input-shape-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AA2DH,+EAA+E;AAC/E,MAAM,gBAAgB,GAAwB,IAAI,GAAG,CAAC,CAAC,oBAAoB,EAAE,cAAc,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAA;AAExH;;GAEG;AACH,MAAM,WAAW,GAAwB,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAA;AAE/E,sFAAsF;AACtF,MAAM,aAAa,GAAwB,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC,CAAA;AAExF;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAA;AAExC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,eAAe,CAC9B,IAAsB,EACtB,KAAwB,EACxB,MAAiC;IAEjC,MAAM,EAAE,GAAG,KAAK,CAAC,cAAc,CAAA;IAC/B,MAAM,eAAe,GAAG,M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