@mailwoman/core 4.10.0 → 4.12.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/README.md +90 -0
- package/data/coarse-placer/meta.json +17 -48
- package/out/decoder/arbitrate-tree.d.ts +45 -0
- package/out/decoder/arbitrate-tree.d.ts.map +1 -0
- package/out/decoder/arbitrate-tree.js +97 -0
- package/out/decoder/arbitrate-tree.js.map +1 -0
- package/out/decoder/build-tree.d.ts +4 -4
- package/out/decoder/build-tree.js +5 -5
- package/out/decoder/build-tree.js.map +1 -1
- package/out/decoder/containment.d.ts +2 -2
- package/out/decoder/containment.js +2 -2
- package/out/decoder/index.d.ts +2 -0
- package/out/decoder/index.d.ts.map +1 -1
- package/out/decoder/index.js +2 -0
- package/out/decoder/index.js.map +1 -1
- package/out/decoder/proposals-to-tree.d.ts +20 -1
- package/out/decoder/proposals-to-tree.d.ts.map +1 -1
- package/out/decoder/proposals-to-tree.js +37 -0
- package/out/decoder/proposals-to-tree.js.map +1 -1
- package/out/decoder/resolve-proposal-overlaps.d.ts +52 -0
- package/out/decoder/resolve-proposal-overlaps.d.ts.map +1 -0
- package/out/decoder/resolve-proposal-overlaps.js +74 -0
- package/out/decoder/resolve-proposal-overlaps.js.map +1 -0
- package/out/decoder/types.d.ts +5 -5
- package/out/decoder/types.js +1 -1
- package/out/kysley/client.d.ts +5 -1
- package/out/kysley/client.d.ts.map +1 -1
- package/out/kysley/client.js +4 -0
- package/out/kysley/client.js.map +1 -1
- package/out/parser/index.d.ts +1 -0
- package/out/parser/index.d.ts.map +1 -1
- package/out/parser/index.js +1 -0
- package/out/parser/index.js.map +1 -1
- package/out/parser/proposal-pipeline.d.ts +16 -3
- package/out/parser/proposal-pipeline.d.ts.map +1 -1
- package/out/parser/proposal-pipeline.js +18 -6
- package/out/parser/proposal-pipeline.js.map +1 -1
- package/out/parser/solution-to-proposals.d.ts +28 -0
- package/out/parser/solution-to-proposals.d.ts.map +1 -0
- package/out/parser/solution-to-proposals.js +44 -0
- package/out/parser/solution-to-proposals.js.map +1 -0
- package/out/pipeline/reconcile.js +1 -1
- package/out/pipeline/runtime-pipeline.d.ts.map +1 -1
- package/out/pipeline/runtime-pipeline.js +32 -4
- package/out/pipeline/runtime-pipeline.js.map +1 -1
- package/out/pipeline/types.d.ts +30 -1
- package/out/pipeline/types.d.ts.map +1 -1
- package/out/policy/defaults.d.ts +11 -6
- package/out/policy/defaults.d.ts.map +1 -1
- package/out/policy/defaults.js +12 -7
- package/out/policy/defaults.js.map +1 -1
- package/out/policy/from-config.d.ts +14 -4
- package/out/policy/from-config.d.ts.map +1 -1
- package/out/policy/from-config.js +16 -5
- package/out/policy/from-config.js.map +1 -1
- package/out/policy/index.d.ts +1 -0
- package/out/policy/index.d.ts.map +1 -1
- package/out/policy/index.js +1 -0
- package/out/policy/index.js.map +1 -1
- package/out/policy/input-shape-router.d.ts +104 -0
- package/out/policy/input-shape-router.d.ts.map +1 -0
- package/out/policy/input-shape-router.js +88 -0
- package/out/policy/input-shape-router.js.map +1 -0
- package/out/policy/registry.d.ts +7 -3
- package/out/policy/registry.d.ts.map +1 -1
- package/out/policy/registry.js +7 -3
- package/out/policy/registry.js.map +1 -1
- package/out/resolver/remote-resolver.d.ts +4 -2
- package/out/resolver/remote-resolver.d.ts.map +1 -1
- package/out/resolver/remote-resolver.js.map +1 -1
- package/out/resolver/resolve.d.ts.map +1 -1
- package/out/resolver/resolve.js +75 -5
- package/out/resolver/resolve.js.map +1 -1
- package/out/resolver/types.d.ts +48 -9
- package/out/resolver/types.d.ts.map +1 -1
- package/out/resolver/types.js +56 -9
- package/out/resolver/types.js.map +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.d.ts.map +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.js +2 -0
- package/out/resources/whosonfirst/PlacetypeDataSource.js.map +1 -1
- package/out/utils/repo.d.ts.map +1 -1
- package/out/utils/repo.js +5 -4
- package/out/utils/repo.js.map +1 -1
- package/package.json +1 -1
package/out/policy/defaults.d.ts
CHANGED
|
@@ -8,14 +8,19 @@
|
|
|
8
8
|
* edits one entry here with a commit-message rationale.
|
|
9
9
|
*/
|
|
10
10
|
import { type ComponentTag } from "@mailwoman/core/types";
|
|
11
|
-
import type { ClassifierPolicy } from "./policy.js";
|
|
11
|
+
import type { ClassifierPolicy, PolicyMode } from "./policy.js";
|
|
12
12
|
/**
|
|
13
|
-
* Build a fresh array of
|
|
14
|
-
* call; callers may mutate it freely.
|
|
13
|
+
* Build a fresh array of policies — one per `ComponentTag`, all in `mode`. Returns a new array on
|
|
14
|
+
* each call; callers may mutate it freely.
|
|
15
|
+
*
|
|
16
|
+
* `mode` defaults to `rule_only` (the historical default — every component rule-sourced until a
|
|
17
|
+
* per-tag migration). The input-shape router (#478 increment 2) passes a shape-derived default
|
|
18
|
+
* (e.g. `neural_preferred` for OOD-script input) so the whole table starts from the routed prior
|
|
19
|
+
* before per-tag config overlays.
|
|
15
20
|
*/
|
|
16
|
-
export declare function buildDefaultPolicies(): ClassifierPolicy[];
|
|
21
|
+
export declare function buildDefaultPolicies(mode?: PolicyMode): ClassifierPolicy[];
|
|
17
22
|
/**
|
|
18
|
-
* Convenience accessor for a single-component default.
|
|
23
|
+
* Convenience accessor for a single-component default. `mode` defaults to `rule_only`.
|
|
19
24
|
*/
|
|
20
|
-
export declare function defaultPolicyFor(component: ComponentTag): ClassifierPolicy;
|
|
25
|
+
export declare function defaultPolicyFor(component: ComponentTag, mode?: PolicyMode): ClassifierPolicy;
|
|
21
26
|
//# sourceMappingURL=defaults.d.ts.map
|
|
@@ -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;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,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;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE/D;;;;;;;;GAQG;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,19 +9,24 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { COMPONENT_TAGS } from "@mailwoman/core/types";
|
|
11
11
|
/**
|
|
12
|
-
* Build a fresh array of
|
|
13
|
-
* call; callers may mutate it freely.
|
|
12
|
+
* Build a fresh array of policies — one per `ComponentTag`, all in `mode`. Returns a new array on
|
|
13
|
+
* each call; callers may mutate it freely.
|
|
14
|
+
*
|
|
15
|
+
* `mode` defaults to `rule_only` (the historical default — every component rule-sourced until a
|
|
16
|
+
* per-tag migration). The input-shape router (#478 increment 2) passes a shape-derived default
|
|
17
|
+
* (e.g. `neural_preferred` for OOD-script input) so the whole table starts from the routed prior
|
|
18
|
+
* before per-tag config overlays.
|
|
14
19
|
*/
|
|
15
|
-
export function buildDefaultPolicies() {
|
|
20
|
+
export function buildDefaultPolicies(mode = "rule_only") {
|
|
16
21
|
return COMPONENT_TAGS.map((component) => ({
|
|
17
22
|
component,
|
|
18
|
-
mode
|
|
23
|
+
mode,
|
|
19
24
|
}));
|
|
20
25
|
}
|
|
21
26
|
/**
|
|
22
|
-
* Convenience accessor for a single-component default.
|
|
27
|
+
* Convenience accessor for a single-component default. `mode` defaults to `rule_only`.
|
|
23
28
|
*/
|
|
24
|
-
export function defaultPolicyFor(component) {
|
|
25
|
-
return { component, mode
|
|
29
|
+
export function defaultPolicyFor(component, mode = "rule_only") {
|
|
30
|
+
return { component, mode };
|
|
26
31
|
}
|
|
27
32
|
//# sourceMappingURL=defaults.js.map
|
|
@@ -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;AAGzE
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../policy/defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,cAAc,EAAqB,MAAM,uBAAuB,CAAA;AAGzE;;;;;;;;GAQG;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"}
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
* `minimumConfidence` typo cost a debugging session on 2026-06-10 — `set()` is structurally typed
|
|
26
26
|
* and won't save a JSON file. This loader is where the contract is enforced.)
|
|
27
27
|
*/
|
|
28
|
+
import type { InputShapeRoute } from "./input-shape-router.js";
|
|
28
29
|
import type { PolicyMode } from "./policy.js";
|
|
29
30
|
import { InMemoryPolicyRegistry } from "./registry.js";
|
|
30
31
|
/** The JSON shape of one tag's policy in a config file. */
|
|
@@ -35,9 +36,18 @@ export interface PolicyConfigEntry {
|
|
|
35
36
|
/** The JSON shape of a policy config file: locale (or `"*"` for global) → tag → entry. */
|
|
36
37
|
export type PolicyConfig = Record<string, Record<string, PolicyConfigEntry>>;
|
|
37
38
|
/**
|
|
38
|
-
* Build a registry from a parsed policy-config object. Starts from `withDefaults()`
|
|
39
|
-
* `rule_only`) and overlays the config's entries — so an
|
|
40
|
-
*
|
|
39
|
+
* Build a registry from a parsed policy-config object. Starts from `withDefaults(defaultMode)`
|
|
40
|
+
* (every tag at `defaultMode`, historically `rule_only`) and overlays the config's entries — so an
|
|
41
|
+
* absent tag falls to `defaultMode`. The input-shape router (#478 increment 2) passes its
|
|
42
|
+
* shape-derived default as `defaultMode` so config entries still win per-tag while un-configured
|
|
43
|
+
* tags follow the route. Throws on ANY unrecognized key or value; the error names the offending
|
|
44
|
+
* JSON path.
|
|
41
45
|
*/
|
|
42
|
-
export declare function policyRegistryFromConfig(config: PolicyConfig): InMemoryPolicyRegistry;
|
|
46
|
+
export declare function policyRegistryFromConfig(config: PolicyConfig, defaultMode?: PolicyMode): InMemoryPolicyRegistry;
|
|
47
|
+
/**
|
|
48
|
+
* Build a registry whose default layer is an input-shape route's `defaultMode` (#478 increment 2),
|
|
49
|
+
* with optional per-tag `config` overlaid on top — so the routed prior fills every un-configured
|
|
50
|
+
* tag while explicit policy still wins per-tag. Thin wrapper over {@link policyRegistryFromConfig}.
|
|
51
|
+
*/
|
|
52
|
+
export declare function policyRegistryFromRoute(route: InputShapeRoute, config?: PolicyConfig): InMemoryPolicyRegistry;
|
|
43
53
|
//# 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,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;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACvC,MAAM,EAAE,YAAY,EACpB,WAAW,GAAE,UAAwB,GACnC,sBAAsB,CA+CxB;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,GAAE,YAAiB,GAAG,sBAAsB,CAEjH"}
|
|
@@ -31,15 +31,18 @@ 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()`
|
|
35
|
-
* `rule_only`) and overlays the config's entries — so an
|
|
36
|
-
*
|
|
34
|
+
* Build a registry from a parsed policy-config object. Starts from `withDefaults(defaultMode)`
|
|
35
|
+
* (every tag at `defaultMode`, historically `rule_only`) and overlays the config's entries — so an
|
|
36
|
+
* absent tag falls to `defaultMode`. The input-shape router (#478 increment 2) passes its
|
|
37
|
+
* shape-derived default as `defaultMode` so config entries still win per-tag while un-configured
|
|
38
|
+
* tags follow the route. Throws on ANY unrecognized key or value; the error names the offending
|
|
39
|
+
* JSON path.
|
|
37
40
|
*/
|
|
38
|
-
export function policyRegistryFromConfig(config) {
|
|
41
|
+
export function policyRegistryFromConfig(config, defaultMode = "rule_only") {
|
|
39
42
|
if (typeof config !== "object" || config === null || Array.isArray(config)) {
|
|
40
43
|
throw new Error("policy config: root must be an object of locale → tag → entry");
|
|
41
44
|
}
|
|
42
|
-
const registry = InMemoryPolicyRegistry.withDefaults();
|
|
45
|
+
const registry = InMemoryPolicyRegistry.withDefaults(defaultMode);
|
|
43
46
|
for (const [localeKey, tags] of Object.entries(config)) {
|
|
44
47
|
if (typeof tags !== "object" || tags === null || Array.isArray(tags)) {
|
|
45
48
|
throw new Error(`policy config: "${localeKey}" must be an object of tag → entry`);
|
|
@@ -77,4 +80,12 @@ export function policyRegistryFromConfig(config) {
|
|
|
77
80
|
}
|
|
78
81
|
return registry;
|
|
79
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Build a registry whose default layer is an input-shape route's `defaultMode` (#478 increment 2),
|
|
85
|
+
* with optional per-tag `config` overlaid on top — so the routed prior fills every un-configured
|
|
86
|
+
* tag while explicit policy still wins per-tag. Thin wrapper over {@link policyRegistryFromConfig}.
|
|
87
|
+
*/
|
|
88
|
+
export function policyRegistryFromRoute(route, config = {}) {
|
|
89
|
+
return policyRegistryFromConfig(config, route.defaultMode);
|
|
90
|
+
}
|
|
80
91
|
//# sourceMappingURL=from-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"from-config.js","sourceRoot":"","sources":["../../policy/from-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AA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,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;oBAChE,MAAM,IAAI,KAAK,CAAC,kBAAkB,IAAI,yDAAyD,CAAC,EAAE,CAAC,CAAA;gBACpG,CAAC;YACF,CAAC;YAED,QAAQ,CAAC,GAAG,CAAC;gBACZ,SAAS,EAAE,GAAmB;gBAC9B,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,GAAG,CAAC,KAAK,CAAC,oBAAoB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,oBAAoB,EAAE,KAAK,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACzG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC7B,CAAC,CAAA;QACH,CAAC;IACF,CAAC;IAED,OAAO,QAAQ,CAAA;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAsB,EAAE,SAAuB,EAAE;IACxF,OAAO,wBAAwB,CAAC,MAAM,EAAE,KAAK,CAAC,WAAW,CAAC,CAAA;AAC3D,CAAC"}
|
package/out/policy/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../policy/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../policy/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,yBAAyB,CAAA;AACvC,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA"}
|
package/out/policy/index.js
CHANGED
package/out/policy/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../policy/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../policy/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,yBAAyB,CAAA;AACvC,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Input-shape router (#478 increment 2) — the arbitration _prior_.
|
|
7
|
+
*
|
|
8
|
+
* A pure, deterministic classification of the input's _shape_ into a default {@link PolicyMode} that
|
|
9
|
+
* seeds the whole per-component policy table before per-tag config overlays. The intuition (the
|
|
10
|
+
* parity capstone, #478): the old rules system owns clean structured Latin addresses (the arena's
|
|
11
|
+
* `v0-only` column), neural owns noisy / off-map / non-Latin input, and when both signals are
|
|
12
|
+
* weak the honest move is to _abstain_ rather than emit a confident-wrong parse.
|
|
13
|
+
*
|
|
14
|
+
* This module is the decision logic only. It does NOT wire itself into a pipeline: the consumer
|
|
15
|
+
* (`policyRegistryFromRoute` → the proposal pipeline) decides whether to apply it, and the
|
|
16
|
+
* production `runPipeline` does not feed it live signals until the two arbitration sites are
|
|
17
|
+
* unified (#478 increment 3). Keeping the prior pure and exhaustively unit-tested here de-risks
|
|
18
|
+
* that wiring — the prior is proven correct in isolation before any behavior changes.
|
|
19
|
+
*
|
|
20
|
+
* Inputs are deliberately _structural lite_ types (not the concrete `QueryKindResult` /
|
|
21
|
+
* `QueryShapeLite` / `CoarsePrediction`) so this file has zero imports beyond `PolicyMode` and is
|
|
22
|
+
* safe to import from anywhere. The real signals satisfy these shapes by construction.
|
|
23
|
+
*/
|
|
24
|
+
import type { PolicyMode } from "./policy.js";
|
|
25
|
+
/** Minimal kind-classifier signal. Compatible with `QueryKindResult` (`core/pipeline/types.ts`). */
|
|
26
|
+
export interface RouterKindSignal {
|
|
27
|
+
/** The classified kind, e.g. `structured_address`, `landmark`, `vague`. */
|
|
28
|
+
kind: string;
|
|
29
|
+
/** Top-class confidence, 0..1. */
|
|
30
|
+
confidence: number;
|
|
31
|
+
}
|
|
32
|
+
/** Minimal query-shape signal. Compatible with `QueryShapeLite` (`core/pipeline/types.ts`). */
|
|
33
|
+
export interface RouterShapeSignal {
|
|
34
|
+
/**
|
|
35
|
+
* Broad character category:
|
|
36
|
+
*
|
|
37
|
+
* - `numeric`
|
|
38
|
+
* - `alpha`
|
|
39
|
+
* - `alphanumeric`
|
|
40
|
+
* - `cjk`
|
|
41
|
+
* - `cyrillic`
|
|
42
|
+
* - `arabic`
|
|
43
|
+
* - `mixed`.
|
|
44
|
+
*/
|
|
45
|
+
characterClass?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Minimal coarse-placer signal (#244). Compatible with `CoarsePrediction`
|
|
49
|
+
* (`core/coarse-placer/coarse-placer.ts`). `null` means no placer ran — treated as "no OOD signal",
|
|
50
|
+
* never as an abstention.
|
|
51
|
+
*/
|
|
52
|
+
export interface RouterPlacerSignal {
|
|
53
|
+
/** The in-map country argmax, `null` when abstained, or `"OTHER"` when off-map. */
|
|
54
|
+
country: string | null;
|
|
55
|
+
/** Explicit abstention flag (M2 open-set reject). */
|
|
56
|
+
abstained: boolean;
|
|
57
|
+
}
|
|
58
|
+
/** The routed prior: a default policy mode for the whole component table, plus an abstain signal. */
|
|
59
|
+
export interface InputShapeRoute {
|
|
60
|
+
/**
|
|
61
|
+
* The default {@link PolicyMode} every component starts from (per-tag config still overrides).
|
|
62
|
+
*
|
|
63
|
+
* - `rule_preferred` — clean structured Latin address; v0's home turf.
|
|
64
|
+
* - `neural_preferred` — noisy / non-Latin / off-map; neural carries it.
|
|
65
|
+
* - `both` — weak/ambiguous; keep every source (paired with `abstain: true`).
|
|
66
|
+
*/
|
|
67
|
+
defaultMode: PolicyMode;
|
|
68
|
+
/**
|
|
69
|
+
* True when both sources are weak (low kind confidence and/or the placer abstained on a non-clean
|
|
70
|
+
* shape). A first-class outcome reserved for the resolver/admin honest-radius downgrade — but it
|
|
71
|
+
* has NO consumer until #478 increment 3, so for now it is computed and reported only.
|
|
72
|
+
* `defaultMode` is `both` when this is set (drop nothing).
|
|
73
|
+
*/
|
|
74
|
+
abstain: boolean;
|
|
75
|
+
/** Human-readable trace of which branch fired — for telemetry and test assertions. */
|
|
76
|
+
reason: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Minimum kind confidence to route a clean kind to `rule_preferred`. Strict by design: below this,
|
|
80
|
+
* v0's rules are brittle on structured input and a confident wrong preference is worse than keeping
|
|
81
|
+
* both sources (DeepSeek-coordinated, 2026-06-17 — 0.7 invited false-preference).
|
|
82
|
+
*/
|
|
83
|
+
export declare const CLEAN_KIND_CONFIDENCE = 0.8;
|
|
84
|
+
/**
|
|
85
|
+
* Classify the input's shape into a default policy mode.
|
|
86
|
+
*
|
|
87
|
+
* The decision tree (first match wins):
|
|
88
|
+
*
|
|
89
|
+
* 0. **OOD script** (`cjk` / `cyrillic` / `arabic`) → `neural_preferred`. Script dominates — rules are
|
|
90
|
+
* Latin-centric, so non-Latin input is neural's regardless of kind.
|
|
91
|
+
* 1. **Clean structured** — a {@link RULE_CLEAN_KINDS} kind at confidence ≥
|
|
92
|
+
* {@link CLEAN_KIND_CONFIDENCE}, a Latin/unknown character class, and the placer not abstained →
|
|
93
|
+
* `rule_preferred`. v0's home turf.
|
|
94
|
+
* 2. **Both weak** — the placer abstained, or kind confidence is below the cutoff → `abstain` (mode
|
|
95
|
+
* `both`, drop nothing).
|
|
96
|
+
* 3. **Otherwise** (confident, Latin, placer-OK, but not a clean kind — `landmark`, `vague`,
|
|
97
|
+
* `locality_only`) → `neural_preferred`.
|
|
98
|
+
*
|
|
99
|
+
* @param kind Kind-classifier signal.
|
|
100
|
+
* @param shape Query-shape signal.
|
|
101
|
+
* @param placer Coarse-placer signal, or `null` when none ran.
|
|
102
|
+
*/
|
|
103
|
+
export declare function routeInputShape(kind: RouterKindSignal, shape: RouterShapeSignal, placer: RouterPlacerSignal | null): InputShapeRoute;
|
|
104
|
+
//# sourceMappingURL=input-shape-router.d.ts.map
|
|
@@ -0,0 +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;;;;GAIG;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;;;;;OAKG;IACH,OAAO,EAAE,OAAO,CAAA;IAChB,sFAAsF;IACtF,MAAM,EAAE,MAAM,CAAA;CACd;AAcD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAA;AAExC;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAC9B,IAAI,EAAE,gBAAgB,EACtB,KAAK,EAAE,iBAAiB,EACxB,MAAM,EAAE,kBAAkB,GAAG,IAAI,GAC/B,eAAe,CAmCjB"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Input-shape router (#478 increment 2) — the arbitration _prior_.
|
|
7
|
+
*
|
|
8
|
+
* A pure, deterministic classification of the input's _shape_ into a default {@link PolicyMode} that
|
|
9
|
+
* seeds the whole per-component policy table before per-tag config overlays. The intuition (the
|
|
10
|
+
* parity capstone, #478): the old rules system owns clean structured Latin addresses (the arena's
|
|
11
|
+
* `v0-only` column), neural owns noisy / off-map / non-Latin input, and when both signals are
|
|
12
|
+
* weak the honest move is to _abstain_ rather than emit a confident-wrong parse.
|
|
13
|
+
*
|
|
14
|
+
* This module is the decision logic only. It does NOT wire itself into a pipeline: the consumer
|
|
15
|
+
* (`policyRegistryFromRoute` → the proposal pipeline) decides whether to apply it, and the
|
|
16
|
+
* production `runPipeline` does not feed it live signals until the two arbitration sites are
|
|
17
|
+
* unified (#478 increment 3). Keeping the prior pure and exhaustively unit-tested here de-risks
|
|
18
|
+
* that wiring — the prior is proven correct in isolation before any behavior changes.
|
|
19
|
+
*
|
|
20
|
+
* Inputs are deliberately _structural lite_ types (not the concrete `QueryKindResult` /
|
|
21
|
+
* `QueryShapeLite` / `CoarsePrediction`) so this file has zero imports beyond `PolicyMode` and is
|
|
22
|
+
* safe to import from anywhere. The real signals satisfy these shapes by construction.
|
|
23
|
+
*/
|
|
24
|
+
/** Kinds the rules system handles well when the rest of the shape is clean. */
|
|
25
|
+
const RULE_CLEAN_KINDS = new Set(["structured_address", "intersection", "po_box", "postcode_only"]);
|
|
26
|
+
/**
|
|
27
|
+
* Non-Latin scripts where the Latin-centric rules system is weak — hand to neural regardless of
|
|
28
|
+
* kind.
|
|
29
|
+
*/
|
|
30
|
+
const OOD_SCRIPTS = new Set(["cjk", "cyrillic", "arabic"]);
|
|
31
|
+
/** Character classes that count as "Latin / clean" for the `rule_preferred` guard. */
|
|
32
|
+
const LATIN_CLASSES = new Set(["numeric", "alpha", "alphanumeric"]);
|
|
33
|
+
/**
|
|
34
|
+
* Minimum kind confidence to route a clean kind to `rule_preferred`. Strict by design: below this,
|
|
35
|
+
* v0's rules are brittle on structured input and a confident wrong preference is worse than keeping
|
|
36
|
+
* both sources (DeepSeek-coordinated, 2026-06-17 — 0.7 invited false-preference).
|
|
37
|
+
*/
|
|
38
|
+
export const CLEAN_KIND_CONFIDENCE = 0.8;
|
|
39
|
+
/**
|
|
40
|
+
* Classify the input's shape into a default policy mode.
|
|
41
|
+
*
|
|
42
|
+
* The decision tree (first match wins):
|
|
43
|
+
*
|
|
44
|
+
* 0. **OOD script** (`cjk` / `cyrillic` / `arabic`) → `neural_preferred`. Script dominates — rules are
|
|
45
|
+
* Latin-centric, so non-Latin input is neural's regardless of kind.
|
|
46
|
+
* 1. **Clean structured** — a {@link RULE_CLEAN_KINDS} kind at confidence ≥
|
|
47
|
+
* {@link CLEAN_KIND_CONFIDENCE}, a Latin/unknown character class, and the placer not abstained →
|
|
48
|
+
* `rule_preferred`. v0's home turf.
|
|
49
|
+
* 2. **Both weak** — the placer abstained, or kind confidence is below the cutoff → `abstain` (mode
|
|
50
|
+
* `both`, drop nothing).
|
|
51
|
+
* 3. **Otherwise** (confident, Latin, placer-OK, but not a clean kind — `landmark`, `vague`,
|
|
52
|
+
* `locality_only`) → `neural_preferred`.
|
|
53
|
+
*
|
|
54
|
+
* @param kind Kind-classifier signal.
|
|
55
|
+
* @param shape Query-shape signal.
|
|
56
|
+
* @param placer Coarse-placer signal, or `null` when none ran.
|
|
57
|
+
*/
|
|
58
|
+
export function routeInputShape(kind, shape, placer) {
|
|
59
|
+
const cc = shape.characterClass;
|
|
60
|
+
const placerAbstained = placer !== null && (placer.abstained || placer.country === null || placer.country === "OTHER");
|
|
61
|
+
// 0. Non-Latin script → neural, before any kind-based routing.
|
|
62
|
+
if (cc !== undefined && OOD_SCRIPTS.has(cc)) {
|
|
63
|
+
return { defaultMode: "neural_preferred", abstain: false, reason: `ood-script:${cc}` };
|
|
64
|
+
}
|
|
65
|
+
// 1. Clean structured Latin address with a confident clean kind and no placer abstention → rules.
|
|
66
|
+
const latinOrUnknown = cc === undefined || LATIN_CLASSES.has(cc);
|
|
67
|
+
if (RULE_CLEAN_KINDS.has(kind.kind) &&
|
|
68
|
+
kind.confidence >= CLEAN_KIND_CONFIDENCE &&
|
|
69
|
+
latinOrUnknown &&
|
|
70
|
+
!placerAbstained) {
|
|
71
|
+
return {
|
|
72
|
+
defaultMode: "rule_preferred",
|
|
73
|
+
abstain: false,
|
|
74
|
+
reason: `clean:${kind.kind}@${kind.confidence.toFixed(2)}`,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
// 2. Both signals weak → abstain (keep every source; drop nothing).
|
|
78
|
+
if (placerAbstained || kind.confidence < CLEAN_KIND_CONFIDENCE) {
|
|
79
|
+
return {
|
|
80
|
+
defaultMode: "both",
|
|
81
|
+
abstain: true,
|
|
82
|
+
reason: `weak:kind=${kind.kind}@${kind.confidence.toFixed(2)},placerAbstained=${placerAbstained}`,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
// 3. Confident, Latin, placer-OK, but not a clean kind → neural.
|
|
86
|
+
return { defaultMode: "neural_preferred", abstain: false, reason: `neural-default:${kind.kind}` };
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=input-shape-router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-shape-router.js","sourceRoot":"","sources":["../../policy/input-shape-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AA6DH,+EAA+E;AAC/E,MAAM,gBAAgB,GAAwB,I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S,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;SAC1D,CAAA;IACF,CAAC;IAED,oEAAoE;IACpE,IAAI,eAAe,IAAI,IAAI,CAAC,UAAU,GAAG,qBAAqB,EAAE,CAAC;QAChE,OAAO;YACN,WAAW,EAAE,MAAM;YACnB,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,aAAa,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,oBAAoB,eAAe,EAAE;SACjG,CAAA;IACF,CAAC;IAED,iEAAiE;IACjE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,kBAAkB,IAAI,CAAC,IAAI,EAAE,EAAE,CAAA;AAClG,CAAC"}
|
package/out/policy/registry.d.ts
CHANGED
|
@@ -10,15 +10,19 @@
|
|
|
10
10
|
* per-locale overrides at startup. Look-up and `apply` are pure.
|
|
11
11
|
*/
|
|
12
12
|
import type { ClassificationProposal, ComponentTag } from "@mailwoman/core/types";
|
|
13
|
-
import type { ClassifierPolicy, PolicyRegistry } from "./policy.js";
|
|
13
|
+
import type { ClassifierPolicy, PolicyMode, PolicyRegistry } from "./policy.js";
|
|
14
14
|
/**
|
|
15
15
|
* Concrete registry implementation. Construct empty with `new InMemoryPolicyRegistry()` and load
|
|
16
16
|
* entries via `set()`, or pre-load defaults via `InMemoryPolicyRegistry.withDefaults()`.
|
|
17
17
|
*/
|
|
18
18
|
export declare class InMemoryPolicyRegistry implements PolicyRegistry {
|
|
19
19
|
#private;
|
|
20
|
-
/**
|
|
21
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Build a registry pre-loaded with `mode` for every component (default `rule_only`). The
|
|
22
|
+
* input-shape router (#478) passes a shape-derived default so the whole table starts from the
|
|
23
|
+
* routed prior.
|
|
24
|
+
*/
|
|
25
|
+
static withDefaults(mode?: PolicyMode): InMemoryPolicyRegistry;
|
|
22
26
|
/** Install a policy entry. Replaces any prior entry with the same key. */
|
|
23
27
|
set(policy: ClassifierPolicy): void;
|
|
24
28
|
/** Remove a policy entry, if present. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../policy/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEjF,OAAO,KAAK,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../policy/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEjF,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAQ/E;;;GAGG;AACH,qBAAa,sBAAuB,YAAW,cAAc;;IAG5D;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,IAAI,GAAE,UAAwB,GAAG,sBAAsB;IAQ3E,0EAA0E;IAC1E,GAAG,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI;IAInC,yCAAyC;IACzC,MAAM,CAAC,SAAS,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAItD,+CAA+C;IAC/C,OAAO,IAAI,gBAAgB,EAAE;IAI7B,MAAM,CAAC,SAAS,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,gBAAgB;IAUlE,KAAK,CAAC,SAAS,EAAE,SAAS,sBAAsB,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,sBAAsB,EAAE;CAkB9F"}
|
package/out/policy/registry.js
CHANGED
|
@@ -20,10 +20,14 @@ function policyKey(component, locale) {
|
|
|
20
20
|
*/
|
|
21
21
|
export class InMemoryPolicyRegistry {
|
|
22
22
|
#entries = new Map();
|
|
23
|
-
/**
|
|
24
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Build a registry pre-loaded with `mode` for every component (default `rule_only`). The
|
|
25
|
+
* input-shape router (#478) passes a shape-derived default so the whole table starts from the
|
|
26
|
+
* routed prior.
|
|
27
|
+
*/
|
|
28
|
+
static withDefaults(mode = "rule_only") {
|
|
25
29
|
const registry = new InMemoryPolicyRegistry();
|
|
26
|
-
for (const policy of buildDefaultPolicies()) {
|
|
30
|
+
for (const policy of buildDefaultPolicies(mode)) {
|
|
27
31
|
registry.set(policy);
|
|
28
32
|
}
|
|
29
33
|
return registry;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../policy/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAGtE,MAAM,iBAAiB,GAAG,GAAG,CAAA;AAE7B,SAAS,SAAS,CAAC,SAAuB,EAAE,MAA0B;IACrE,OAAO,GAAG,SAAS,KAAK,MAAM,IAAI,iBAAiB,EAAE,CAAA;AACtD,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,sBAAsB;IAClC,QAAQ,GAAG,IAAI,GAAG,EAA4B,CAAA;IAE9C
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../policy/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAGtE,MAAM,iBAAiB,GAAG,GAAG,CAAA;AAE7B,SAAS,SAAS,CAAC,SAAuB,EAAE,MAA0B;IACrE,OAAO,GAAG,SAAS,KAAK,MAAM,IAAI,iBAAiB,EAAE,CAAA;AACtD,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,sBAAsB;IAClC,QAAQ,GAAG,IA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AC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;YACzE,SAAQ;QACT,CAAC;QAED,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAA;IAClB,CAAC;IAED,OAAO,GAAG,CAAA;AACX,CAAC"}
|
|
@@ -27,8 +27,10 @@ export type SerializableResolveOpts = Omit<ResolveOpts, "addressPoints" | "inter
|
|
|
27
27
|
/** Strip the live lookup handles from `ResolveOpts` so the rest can be JSON-serialized over HTTP. */
|
|
28
28
|
export declare function serializableResolveOpts(opts?: ResolveOpts): SerializableResolveOpts | undefined;
|
|
29
29
|
export interface RemoteResolverOpts {
|
|
30
|
-
/**
|
|
31
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Full URL of the resolver service's resolve-tree endpoint, e.g.
|
|
32
|
+
* `http://resolver:7081/api/resolve-tree`.
|
|
33
|
+
*/
|
|
32
34
|
endpoint: string;
|
|
33
35
|
/** Injectable fetch (tests / custom agents). Defaults to the global `fetch`. */
|
|
34
36
|
fetch?: typeof fetch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-resolver.d.ts","sourceRoot":"","sources":["../../resolver/remote-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAEvD,oGAAoG;AACpG,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,WAAW,EAAE,eAAe,GAAG,eAAe,CAAC,CAAA;AAE1F,qGAAqG;AACrG,wBAAgB,uBAAuB,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,uBAAuB,GAAG,SAAS,CAI/F;AAED,MAAM,WAAW,kBAAkB;IAClC;
|
|
1
|
+
{"version":3,"file":"remote-resolver.d.ts","sourceRoot":"","sources":["../../resolver/remote-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAEvD,oGAAoG;AACpG,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,WAAW,EAAE,eAAe,GAAG,eAAe,CAAC,CAAA;AAE1F,qGAAqG;AACrG,wBAAgB,uBAAuB,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,uBAAuB,GAAG,SAAS,CAI/F;AAED,MAAM,WAAW,kBAAkB;IAClC;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB,gFAAgF;IAChF,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;IACpB,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,qFAAqF;IACrF,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAChC;AAED,gGAAgG;AAChG,MAAM,WAAW,kBAAkB;IAClC,IAAI,EAAE,WAAW,CAAA;IACjB,IAAI,CAAC,EAAE,uBAAuB,CAAA;CAC9B;AAED,iDAAiD;AACjD,MAAM,WAAW,mBAAmB;IACnC,IAAI,EAAE,WAAW,CAAA;CACjB;AAED,qBAAa,cAAe,YAAW,QAAQ;;gBAMlC,IAAI,EAAE,kBAAkB;IAQ9B,WAAW,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;CAuB9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-resolver.js","sourceRoot":"","sources":["../../resolver/remote-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;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
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../resolver/resolve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EASN,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,MAAM,YAAY,CAAA;AAEnB;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,eAAe,GAAG,QAAQ,CAEpE"}
|