@mailwoman/codex 4.2.0 → 4.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.
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Per-address-system parsing conventions (#478's rules-as-constraints slice, started as the #511
7
+ * Tier A corrective). The model's locale head detects WHICH address system a string belongs to;
8
+ * this table says what is and isn't grammatical in that system, so the decoder can obey the
9
+ * detection instead of merely being nudged by it.
10
+ *
11
+ * Every row is a provenance-carrying claim about a national addressing convention — the same
12
+ * no-load-bearing-trivia discipline as the rest of the codex. Add rows with a source, not from
13
+ * vibes; an absent row means "no constraints known", never "no constraints exist".
14
+ *
15
+ * First consumer: `@mailwoman/neural`'s decoder applies `forbiddenTags` as a hard emission mask
16
+ * before Viterbi and treats `postcodePattern` as the system's canonical shape for the snap-only
17
+ * postcode repair pass. Both triggered only when the system is detected confidently (or supplied
18
+ * by the caller) — an undetected system parses exactly as before.
19
+ */
20
+ import type { SystemCode } from "./postcode-systems.js";
21
+ export interface AddressSystemConventions {
22
+ /**
23
+ * Component tags that are NOT grammatical in this address system (names from the core
24
+ * `ComponentTag` union; codex stays dependency-free so they are plain strings here).
25
+ */
26
+ readonly forbiddenTags?: readonly string[];
27
+ /**
28
+ * The system's canonical postcode shape. A decoded postcode span that is a strict sub-match of
29
+ * a pattern-valid string in the raw text is shape-INVALID for this system and eligible for the
30
+ * snap-only repair (extend/clip to the valid match — never invent a span).
31
+ */
32
+ readonly postcodePattern?: RegExp;
33
+ }
34
+ export declare const ADDRESS_SYSTEM_CONVENTIONS: Partial<Record<SystemCode, AddressSystemConventions>>;
35
+ /** Look up conventions for a system. Absent row = no constraints KNOWN (parse unconstrained). */
36
+ export declare function conventionsForSystem(system: SystemCode | null | undefined): AddressSystemConventions | null;
37
+ //# sourceMappingURL=address-system-conventions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address-system-conventions.d.ts","sourceRoot":"","sources":["../address-system-conventions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAEvD,MAAM,WAAW,wBAAwB;IACxC;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC1C;;;;OAIG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAA;CACjC;AAED,eAAO,MAAM,0BAA0B,EAAE,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,wBAAwB,CAAC,CAc5F,CAAA;AAED,iGAAiG;AACjG,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,GAAG,wBAAwB,GAAG,IAAI,CAG3G"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @copyright Sister Software
3
+ * @license AGPL-3.0
4
+ * @author Teffen Ellis, et al.
5
+ *
6
+ * Per-address-system parsing conventions (#478's rules-as-constraints slice, started as the #511
7
+ * Tier A corrective). The model's locale head detects WHICH address system a string belongs to;
8
+ * this table says what is and isn't grammatical in that system, so the decoder can obey the
9
+ * detection instead of merely being nudged by it.
10
+ *
11
+ * Every row is a provenance-carrying claim about a national addressing convention — the same
12
+ * no-load-bearing-trivia discipline as the rest of the codex. Add rows with a source, not from
13
+ * vibes; an absent row means "no constraints known", never "no constraints exist".
14
+ *
15
+ * First consumer: `@mailwoman/neural`'s decoder applies `forbiddenTags` as a hard emission mask
16
+ * before Viterbi and treats `postcodePattern` as the system's canonical shape for the snap-only
17
+ * postcode repair pass. Both triggered only when the system is detected confidently (or supplied
18
+ * by the caller) — an undetected system parses exactly as before.
19
+ */
20
+ import { CODE_POSTAL_PATTERN } from "./fr/code-postal.js";
21
+ export const ADDRESS_SYSTEM_CONVENTIONS = {
22
+ /**
23
+ * France (La Poste / AFNOR NF Z 10-011): street types are LEADING particles of the street name
24
+ * ("Rue de Rivoli", "Avenue des Champs-Élysées") — the libpostal French dictionaries carry no
25
+ * trailing street-suffix class, and the USPS Pub-28 prefix/suffix decomposition has no French
26
+ * counterpart. `street_prefix`/`street_suffix` therefore cannot occur in a French parse; any
27
+ * such emission is US-convention leakage (measured: the 2026-06-10 v1.1.0 gate, where USPS
28
+ * suffix logic fired on "Rue" — RUE is genuinely a Pub-28 suffix variant — and digit-splits
29
+ * corrupted leading postcodes). Postcode: exactly five digits (NF Z 10-011; see fr/code-postal).
30
+ */
31
+ fr: {
32
+ forbiddenTags: ["street_prefix", "street_suffix"],
33
+ postcodePattern: CODE_POSTAL_PATTERN,
34
+ },
35
+ };
36
+ /** Look up conventions for a system. Absent row = no constraints KNOWN (parse unconstrained). */
37
+ export function conventionsForSystem(system) {
38
+ if (!system)
39
+ return null;
40
+ return ADDRESS_SYSTEM_CONVENTIONS[system] ?? null;
41
+ }
42
+ //# sourceMappingURL=address-system-conventions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address-system-conventions.js","sourceRoot":"","sources":["../address-system-conventions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAiBzD,MAAM,CAAC,MAAM,0BAA0B,GAA0D;IAChG;;;;;;;;OAQG;IACH,EAAE,EAAE;QACH,aAAa,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC;QACjD,eAAe,EAAE,mBAAmB;KACpC;CACD,CAAA;AAED,iGAAiG;AACjG,MAAM,UAAU,oBAAoB,CAAC,MAAqC;IACzE,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAA;IACxB,OAAO,0BAA0B,CAAC,MAAM,CAAC,IAAI,IAAI,CAAA;AAClD,CAAC"}
package/out/index.d.ts CHANGED
@@ -17,6 +17,7 @@
17
17
  * `candidateSystemsForPostcode` (the inverse of the per-slice postcode patterns) is a top-level
18
18
  * export.
19
19
  */
20
+ export { ADDRESS_SYSTEM_CONVENTIONS, type AddressSystemConventions, conventionsForSystem, } from "./address-system-conventions.js";
20
21
  export * as ca from "./ca/index.js";
21
22
  export * as de from "./de/index.js";
22
23
  export * as fr from "./fr/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,EAAE,2BAA2B,EAAE,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACpF,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACN,0BAA0B,EAC1B,KAAK,wBAAwB,EAC7B,oBAAoB,GACpB,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,EAAE,2BAA2B,EAAE,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACpF,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA"}
package/out/index.js CHANGED
@@ -17,6 +17,7 @@
17
17
  * `candidateSystemsForPostcode` (the inverse of the per-slice postcode patterns) is a top-level
18
18
  * export.
19
19
  */
20
+ export { ADDRESS_SYSTEM_CONVENTIONS, conventionsForSystem, } from "./address-system-conventions.js";
20
21
  export * as ca from "./ca/index.js";
21
22
  export * as de from "./de/index.js";
22
23
  export * as fr from "./fr/index.js";
package/out/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,EAAE,2BAA2B,EAAmB,MAAM,uBAAuB,CAAA;AACpF,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACN,0BAA0B,EAE1B,oBAAoB,GACpB,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA;AACnC,OAAO,EAAE,2BAA2B,EAAmB,MAAM,uBAAuB,CAAA;AACpF,OAAO,KAAK,EAAE,MAAM,eAAe,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mailwoman/codex",
3
- "version": "4.2.0",
3
+ "version": "4.3.0",
4
4
  "description": "Per-address-system postal reference data + branded types (USPS street suffixes, US ZIP codes). Pure, zero-runtime-dep — the shared canonical home for postal-system primitives the parser, resolver, and synthesis layers all reach for.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {