@mailwoman/neural-web 4.16.1 → 5.0.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/out/index.d.ts CHANGED
@@ -3,8 +3,8 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  */
6
- export { defaultGazetteerLexiconUrl, loadNeuralClassifierFromUrls, type LoadFromUrlsOpts } from "./loader.js";
7
- export { DEFAULT_FIXED_SEQ_LEN, WebOnnxRunner, type WebOnnxRunnerOpts } from "./web-onnx-runner.js";
6
+ export { defaultGazetteerLexiconURL, loadNeuralClassifierFromUrls, type LoadFromUrlsOpts } from "./loader.js";
7
+ export { DEFAULT_FIXED_SEQ_LEN, WebONNXRunner, type WebONNXRunnerOpts } from "./web-onnx-runner.js";
8
8
  export { MailwomanTokenizer, NeuralAddressClassifier, type NeuralAddressClassifierConfig, type NeuralRunner, } from "@mailwoman/neural/browser";
9
9
  export type { InferResult } from "@mailwoman/neural/browser";
10
10
  //# sourceMappingURL=index.d.ts.map
package/out/index.js CHANGED
@@ -3,8 +3,8 @@
3
3
  * @license AGPL-3.0
4
4
  * @author Teffen Ellis, et al.
5
5
  */
6
- export { defaultGazetteerLexiconUrl, loadNeuralClassifierFromUrls } from "./loader.js";
7
- export { DEFAULT_FIXED_SEQ_LEN, WebOnnxRunner } from "./web-onnx-runner.js";
6
+ export { defaultGazetteerLexiconURL, loadNeuralClassifierFromUrls } from "./loader.js";
7
+ export { DEFAULT_FIXED_SEQ_LEN, WebONNXRunner } from "./web-onnx-runner.js";
8
8
  // Re-export the public neural surface so callers don't need both packages on the typed path.
9
9
  // Pull from the browser-safe entry — the default entry would drag onnxruntime-node + node:fs
10
10
  // into the bundle graph via classifier.ts's transitive imports.
package/out/loader.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * @author Teffen Ellis, et al.
5
5
  *
6
6
  * Browser-side loader that pairs the existing `MailwomanTokenizer` (whose `loadFromBase64` path is
7
- * already browser-safe — it doesn't touch Node fs) with a fresh `WebOnnxRunner`, and returns a
7
+ * already browser-safe — it doesn't touch Node fs) with a fresh `WebONNXRunner`, and returns a
8
8
  * ready-to-use `NeuralAddressClassifier`.
9
9
  *
10
10
  * V1 strategy: fetch both `model.onnx` and `tokenizer.model` over HTTP from caller-provided URLs
@@ -13,98 +13,94 @@
13
13
  * files; for a static deploy, copy them into the public bundle and pass the resulting URLs.
14
14
  */
15
15
  import { NeuralAddressClassifier, type NeuralAddressClassifierConfig } from "@mailwoman/neural/browser";
16
- import { type WebOnnxRunnerDiagnostics, type WebOnnxRunnerOpts } from "./web-onnx-runner.js";
17
- export type { WebOnnxRunnerDiagnostics };
16
+ import { type WebONNXRunnerDiagnostics, type WebONNXRunnerOpts } from "./web-onnx-runner.js";
17
+ export type { WebONNXRunnerDiagnostics };
18
18
  export interface LoadResult {
19
19
  classifier: NeuralAddressClassifier;
20
- diagnostics: WebOnnxRunnerDiagnostics | null;
20
+ diagnostics: WebONNXRunnerDiagnostics | null;
21
21
  /**
22
- * Labels actually applied to the classifier. `null` when no model-card was provided or its
23
- * `labels` field was missing — the classifier fell back to its built-in default (Stage 2).
22
+ * Labels actually applied to the classifier. `null` when no model-card was provided or its `labels` field was missing
23
+ * — the classifier fell back to its built-in default (Stage 2).
24
24
  */
25
25
  labels: readonly string[] | null;
26
26
  /**
27
- * The parsed postcode-anchor lookup (postcode → posterior + centroid), when anchor binaries were
28
- * loaded. Exposed so consumers (the demo's anchor-centroid map fallback) can reuse the SAME
29
- * artifact the model channel feeds from — WOF ships placeholder (0,0) for ~22% of US postcodes;
30
- * this lookup has a real centroid for every covered ZIP.
27
+ * The parsed postcode-anchor lookup (postcode → posterior + centroid), when anchor binaries were loaded. Exposed so
28
+ * consumers (the demo's anchor-centroid map fallback) can reuse the SAME artifact the model channel feeds from — WOF
29
+ * ships placeholder (0,0) for ~22% of US postcodes; this lookup has a real centroid for every covered ZIP.
31
30
  */
32
31
  postcodeAnchorLookup?: import("@mailwoman/neural").AnchorLookup;
33
32
  }
34
33
  export interface LoadFromUrlsOpts {
35
34
  /** URL to the ONNX model file (e.g. `/static/mailwoman/model.onnx`). */
36
- modelUrl: string;
35
+ modelURL: string;
37
36
  /** URL to the SentencePiece tokenizer model (e.g. `/static/mailwoman/tokenizer.model`). */
38
- tokenizerUrl: string;
37
+ tokenizerURL: string;
39
38
  /**
40
- * URL to `model-card.json`. When provided, its `labels` field is threaded into the classifier so
41
- * post-Stage-2 bundles (33-label Stage 3 and beyond) decode correctly. Skip for legacy bundles
42
- * whose cards predate the `labels` field — the loader falls back to the built-in Stage 2
43
- * default.
39
+ * URL to `model-card.json`. When provided, its `labels` field is threaded into the classifier so post-Stage-2 bundles
40
+ * (33-label Stage 3 and beyond) decode correctly. Skip for legacy bundles whose cards predate the `labels` field —
41
+ * the loader falls back to the built-in Stage 2 default.
44
42
  *
45
- * Required for any v0.6.x+ bundle: without it the classifier builds a 21×21 transition mask while
46
- * the model emits 33 logits and viterbi crashes with "Cannot read properties of undefined".
43
+ * Required for any v0.6.x+ bundle: without it the classifier builds a 21×21 transition mask while the model emits 33
44
+ * logits and viterbi crashes with "Cannot read properties of undefined".
47
45
  */
48
- modelCardUrl?: string;
46
+ modelCardURL?: string;
49
47
  /** Runner options (WebGPU toggle, fixed sequence length, WASM path override). */
50
- runner?: WebOnnxRunnerOpts;
48
+ runner?: WebONNXRunnerOpts;
51
49
  /**
52
- * URLs to one or more PCB1 postcode binaries (`postcode-<cc>.bin`). For anchor-trained models
53
- * (#239/#240) these are decoded + merged into the postcode→anchor lookup the classifier feeds at
54
- * inference, so the demo runs the model with the anchor on. Pass the locales the model handles
55
- * (e.g. US + DE). Omit for plain models — the runner then feeds the anchor-off identity.
50
+ * URLs to one or more PCB1 postcode binaries (`postcode-<cc>.bin`). For anchor-trained models (#239/#240) these are
51
+ * decoded + merged into the postcode→anchor lookup the classifier feeds at inference, so the demo runs the model with
52
+ * the anchor on. Pass the locales the model handles (e.g. US + DE). Omit for plain models — the runner then feeds the
53
+ * anchor-off identity.
56
54
  */
57
55
  postcodeBinaryUrls?: readonly string[];
58
56
  /**
59
- * URL to the gazetteer-anchor lexicon JSON (`anchor-lexicon-v1.json`, #464 — the in-repo source
60
- * is `data/gazetteer/anchor-lexicon-v1.json`). Gazetteer-trained models (v4.2.0+, whose ONNX
61
- * declares the `gazetteer_features`/`gazetteer_confidence` inputs) REQUIRE this clue at
62
- * inference: running them on the zero-filled fallback is the measured train/inference mismatch
63
- * that wrecks segmentation ("the zero-fill trap", CONTRIBUTING_MODEL_WORK.mdx eval invariants).
57
+ * URL to the gazetteer-anchor lexicon JSON (`anchor-lexicon-v1.json`, #464 — the in-repo source is
58
+ * `data/gazetteer/anchor-lexicon-v1.json`). Gazetteer-trained models (v4.2.0+, whose ONNX declares the
59
+ * `gazetteer_features`/`gazetteer_confidence` inputs) REQUIRE this clue at inference: running them on the zero-filled
60
+ * fallback is the measured train/inference mismatch that wrecks segmentation ("the zero-fill trap",
61
+ * CONTRIBUTING_MODEL_WORK.mdx eval invariants).
64
62
  *
65
- * Defaults to `anchor-lexicon-v1.json` next to `modelUrl`. A fetch miss (404 etc.) does NOT throw
66
- * — older bundles never shipped the file — but if the loaded model turns out to be
67
- * gazetteer-trained the loader logs a loud `console.error` naming the missing file and the model
68
- * runs gazetteer-off (structurally valid, quality-degraded). Pass `null` to skip the fetch
69
- * entirely.
63
+ * Defaults to `anchor-lexicon-v1.json` next to `modelURL`. A fetch miss (404 etc.) does NOT throw — older bundles
64
+ * never shipped the file — but if the loaded model turns out to be gazetteer-trained the loader logs a loud
65
+ * `console.error` naming the missing file and the model runs gazetteer-off (structurally valid, quality-degraded).
66
+ * Pass `null` to skip the fetch entirely.
70
67
  */
71
- gazetteerLexiconUrl?: string | null;
68
+ gazetteerLexiconURL?: string | null;
72
69
  /**
73
- * Channel choreography (#464, v0.9.13 postcode fix): zero the gazetteer clue on pieces adjacent
74
- * to a postcode-anchor hit. Defaults to TRUE — it pairs with the train-time half on every
75
- * gazetteer-trained bundle (v4.2.0+) and is inert when either channel is absent.
70
+ * Channel choreography (#464, v0.9.13 postcode fix): zero the gazetteer clue on pieces adjacent to a postcode-anchor
71
+ * hit. Defaults to TRUE — it pairs with the train-time half on every gazetteer-trained bundle (v4.2.0+) and is inert
72
+ * when either channel is absent.
76
73
  */
77
74
  suppressGazetteerNearPostcode?: boolean;
78
75
  /**
79
- * Address-system conventions mode (#511 Tier A, v4.3.0+). Defaults to `"auto"` (read the model's
80
- * locale head when exported; inert on bundles without `locale_logits`). Pass a `SystemCode` to
81
- * pin, or `null` to disable.
76
+ * Address-system conventions mode (#511 Tier A, v4.3.0+). Defaults to `"auto"` (read the model's locale head when
77
+ * exported; inert on bundles without `locale_logits`). Pass a `SystemCode` to pin, or `null` to disable.
82
78
  */
83
79
  addressSystemConventions?: NeuralAddressClassifierConfig["addressSystemConventions"] | null;
84
80
  /**
85
- * Span bridge (v4.4.0 declared behavior): merge same-tag spans split at intra-token punctuation
86
- * ("P.O. Box"). Defaults to TRUE per the v4.4.0 ship config (model-card.json: po_box 60.4
87
- * without, 89.1 with). Pass false to disable for pre-bridge bundles where gate parity matters.
81
+ * Span bridge (v4.4.0 declared behavior): merge same-tag spans split at intra-token punctuation ("P.O. Box").
82
+ * Defaults to TRUE per the v4.4.0 ship config (model-card.json: po_box 60.4 without, 89.1 with). Pass false to
83
+ * disable for pre-bridge bundles where gate parity matters.
88
84
  */
89
85
  bridgePunctuationGaps?: boolean;
90
86
  /** Optional fetch override. Defaults to `globalThis.fetch`. */
91
87
  fetchImpl?: typeof fetch;
92
88
  }
93
89
  /**
94
- * Default location of the gazetteer-anchor lexicon: `anchor-lexicon-v1.json` as a sibling of the
95
- * model file. Matches how release bundles lay out their version directory (model.onnx,
96
- * tokenizer.model, model-card.json, postcode-*.bin, anchor-lexicon-v1.json side by side).
90
+ * Default location of the gazetteer-anchor lexicon: `anchor-lexicon-v1.json` as a sibling of the model file. Matches
91
+ * how release bundles lay out their version directory (model.onnx, tokenizer.model, model-card.json, postcode-*.bin,
92
+ * anchor-lexicon-v1.json side by side).
97
93
  */
98
- export declare function defaultGazetteerLexiconUrl(modelUrl: string): string;
94
+ export declare function defaultGazetteerLexiconURL(modelURL: string): string;
99
95
  /**
100
- * Convenience factory: fetch model + tokenizer, build the runner, return a classifier. The
101
- * tokenizer is loaded via the existing `loadFromBase64` path so this file shares zero Node-only
102
- * code with `@mailwoman/neural/classifier`'s `loadFromWeights`.
96
+ * Convenience factory: fetch model + tokenizer, build the runner, return a classifier. The tokenizer is loaded via the
97
+ * existing `loadFromBase64` path so this file shares zero Node-only code with `@mailwoman/neural/classifier`'s
98
+ * `loadFromWeights`.
103
99
  *
104
- * The classifier is constructed with the v4.4.0 ship config by default (gazetteer lexicon +
105
- * postcode anchor when their assets resolve, `suppressGazetteerNearPostcode: true`,
106
- * `addressSystemConventions: "auto"`, `bridgePunctuationGaps: true`) — every knob is inert on
107
- * bundles that predate the corresponding channel, so older versions keep decoding unchanged.
100
+ * The classifier is constructed with the v4.4.0 ship config by default (gazetteer lexicon + postcode anchor when their
101
+ * assets resolve, `suppressGazetteerNearPostcode: true`, `addressSystemConventions: "auto"`, `bridgePunctuationGaps:
102
+ * true`) — every knob is inert on bundles that predate the corresponding channel, so older versions keep decoding
103
+ * unchanged.
108
104
  */
109
105
  export declare function loadNeuralClassifierFromUrls(opts: LoadFromUrlsOpts): Promise<LoadResult>;
110
106
  //# sourceMappingURL=loader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAIN,uBAAuB,EACvB,KAAK,6BAA6B,EAGlC,MAAM,2BAA2B,CAAA;AAElC,OAAO,EAAiB,KAAK,wBAAwB,EAAE,KAAK,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAE3G,YAAY,EAAE,wBAAwB,EAAE,CAAA;AAExC,MAAM,WA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al.
5
5
  *
6
6
  * Browser-side loader that pairs the existing `MailwomanTokenizer` (whose `loadFromBase64` path is
7
- * already browser-safe — it doesn't touch Node fs) with a fresh `WebOnnxRunner`, and returns a
7
+ * already browser-safe — it doesn't touch Node fs) with a fresh `WebONNXRunner`, and returns a
8
8
  * ready-to-use `NeuralAddressClassifier`.
9
9
  *
10
10
  * V1 strategy: fetch both `model.onnx` and `tokenizer.model` over HTTP from caller-provided URLs
@@ -13,7 +13,7 @@
13
13
  * files; for a static deploy, copy them into the public bundle and pass the resulting URLs.
14
14
  */
15
15
  import { MailwomanTokenizer, NeuralAddressClassifier, parseGazetteerLexicon, PostcodeBinaryResolver, } from "@mailwoman/neural/browser";
16
- import { WebOnnxRunner } from "./web-onnx-runner.js";
16
+ import { WebONNXRunner } from "./web-onnx-runner.js";
17
17
  /** Merge per-binary anchor lookups: union the country posteriors per postcode, mean the centroids. */
18
18
  function mergeAnchorLookups(lookups) {
19
19
  if (lookups.length === 1)
@@ -44,40 +44,40 @@ function mergeAnchorLookups(lookups) {
44
44
  return merged;
45
45
  }
46
46
  /**
47
- * Default location of the gazetteer-anchor lexicon: `anchor-lexicon-v1.json` as a sibling of the
48
- * model file. Matches how release bundles lay out their version directory (model.onnx,
49
- * tokenizer.model, model-card.json, postcode-*.bin, anchor-lexicon-v1.json side by side).
47
+ * Default location of the gazetteer-anchor lexicon: `anchor-lexicon-v1.json` as a sibling of the model file. Matches
48
+ * how release bundles lay out their version directory (model.onnx, tokenizer.model, model-card.json, postcode-*.bin,
49
+ * anchor-lexicon-v1.json side by side).
50
50
  */
51
- export function defaultGazetteerLexiconUrl(modelUrl) {
51
+ export function defaultGazetteerLexiconURL(modelURL) {
52
52
  // Swap the final path segment — string surgery rather than `new URL()` so relative model URLs
53
53
  // ("/static/mailwoman/model.onnx") stay relative.
54
- return modelUrl.replace(/[^/]*$/, "anchor-lexicon-v1.json");
54
+ return modelURL.replace(/[^/]*$/, "anchor-lexicon-v1.json");
55
55
  }
56
56
  /**
57
- * Convenience factory: fetch model + tokenizer, build the runner, return a classifier. The
58
- * tokenizer is loaded via the existing `loadFromBase64` path so this file shares zero Node-only
59
- * code with `@mailwoman/neural/classifier`'s `loadFromWeights`.
57
+ * Convenience factory: fetch model + tokenizer, build the runner, return a classifier. The tokenizer is loaded via the
58
+ * existing `loadFromBase64` path so this file shares zero Node-only code with `@mailwoman/neural/classifier`'s
59
+ * `loadFromWeights`.
60
60
  *
61
- * The classifier is constructed with the v4.4.0 ship config by default (gazetteer lexicon +
62
- * postcode anchor when their assets resolve, `suppressGazetteerNearPostcode: true`,
63
- * `addressSystemConventions: "auto"`, `bridgePunctuationGaps: true`) — every knob is inert on
64
- * bundles that predate the corresponding channel, so older versions keep decoding unchanged.
61
+ * The classifier is constructed with the v4.4.0 ship config by default (gazetteer lexicon + postcode anchor when their
62
+ * assets resolve, `suppressGazetteerNearPostcode: true`, `addressSystemConventions: "auto"`, `bridgePunctuationGaps:
63
+ * true`) — every knob is inert on bundles that predate the corresponding channel, so older versions keep decoding
64
+ * unchanged.
65
65
  */
66
66
  export async function loadNeuralClassifierFromUrls(opts) {
67
67
  const fetchImpl = opts.fetchImpl ?? globalThis.fetch;
68
68
  if (!fetchImpl) {
69
69
  throw new Error("no fetch implementation available — pass fetchImpl in non-fetch environments");
70
70
  }
71
- const gazetteerLexiconUrl = opts.gazetteerLexiconUrl === null ? null : (opts.gazetteerLexiconUrl ?? defaultGazetteerLexiconUrl(opts.modelUrl));
71
+ const gazetteerLexiconURL = opts.gazetteerLexiconURL === null ? null : (opts.gazetteerLexiconURL ?? defaultGazetteerLexiconURL(opts.modelURL));
72
72
  const [modelBytes, tokenizerBytes, labels, gazetteerLexicon] = await Promise.all([
73
- fetchBytes(opts.modelUrl, fetchImpl),
74
- fetchBytes(opts.tokenizerUrl, fetchImpl),
75
- opts.modelCardUrl ? fetchLabelsFromModelCard(opts.modelCardUrl, fetchImpl) : Promise.resolve(null),
76
- gazetteerLexiconUrl ? fetchGazetteerLexicon(gazetteerLexiconUrl, fetchImpl) : Promise.resolve(null),
73
+ fetchBytes(opts.modelURL, fetchImpl),
74
+ fetchBytes(opts.tokenizerURL, fetchImpl),
75
+ opts.modelCardURL ? fetchLabelsFromModelCard(opts.modelCardURL, fetchImpl) : Promise.resolve(null),
76
+ gazetteerLexiconURL ? fetchGazetteerLexicon(gazetteerLexiconURL, fetchImpl) : Promise.resolve(null),
77
77
  ]);
78
78
  const [tokenizer, runner, postcodeAnchorLookup] = await Promise.all([
79
79
  MailwomanTokenizer.loadFromBase64(toBase64(tokenizerBytes)),
80
- WebOnnxRunner.fromBytes(modelBytes, opts.runner),
80
+ WebONNXRunner.fromBytes(modelBytes, opts.runner),
81
81
  opts.postcodeBinaryUrls?.length
82
82
  ? Promise.all(opts.postcodeBinaryUrls.map(async (url) => new PostcodeBinaryResolver(await fetchBytes(url, fetchImpl)).toAnchorLookup())).then(mergeAnchorLookups)
83
83
  : Promise.resolve(undefined),
@@ -96,18 +96,17 @@ export async function loadNeuralClassifierFromUrls(opts) {
96
96
  await runner.infer([0]);
97
97
  warnOnUnfedTrainedChannels(runner, {
98
98
  gazetteerLexicon,
99
- gazetteerLexiconUrl,
99
+ gazetteerLexiconURL,
100
100
  postcodeAnchorLookup,
101
101
  });
102
102
  return { classifier, diagnostics: runner.diagnostics, labels };
103
103
  }
104
104
  /**
105
- * Loud degrade (#464): the warmup `infer([0])` above forced session creation, so the graph's
106
- * declared inputs are now known. A gazetteer/anchor-TRAINED model running on the zero-filled
107
- * fallback is a measured failure mode (train/inference mismatch — "the zero-fill trap"), not a
108
- * quality-neutral default; without this check the only symptom would be silently degraded parses.
109
- * (Pre-fix, the symptom was worse still: ORT's cryptic `input 'gazetteer_features' is missing in
110
- * 'feeds'`.) The loader still returns a working classifier — structural fallback, loud console.
105
+ * Loud degrade (#464): the warmup `infer([0])` above forced session creation, so the graph's declared inputs are now
106
+ * known. A gazetteer/anchor-TRAINED model running on the zero-filled fallback is a measured failure mode
107
+ * (train/inference mismatch — "the zero-fill trap"), not a quality-neutral default; without this check the only symptom
108
+ * would be silently degraded parses. (Pre-fix, the symptom was worse still: ORT's cryptic `input 'gazetteer_features'
109
+ * is missing in 'feeds'`.) The loader still returns a working classifier structural fallback, loud console.
111
110
  */
112
111
  function warnOnUnfedTrainedChannels(runner, fed) {
113
112
  const inputNames = runner.inputNames;
@@ -116,10 +115,10 @@ function warnOnUnfedTrainedChannels(runner, fed) {
116
115
  if (inputNames.includes("gazetteer_features") && !fed.gazetteerLexicon) {
117
116
  console.error("[mailwoman/neural-web] This model is gazetteer-anchor-trained (its ONNX declares `gazetteer_features`) " +
118
117
  "but no gazetteer lexicon was loaded" +
119
- (fed.gazetteerLexiconUrl
120
- ? ` — \`anchor-lexicon-v1.json\` could not be fetched from ${fed.gazetteerLexiconUrl}. ` +
121
- "Upload the lexicon next to model.onnx, or pass `gazetteerLexiconUrl` explicitly."
122
- : " — `gazetteerLexiconUrl` was explicitly disabled (null). ") +
118
+ (fed.gazetteerLexiconURL
119
+ ? ` — \`anchor-lexicon-v1.json\` could not be fetched from ${fed.gazetteerLexiconURL}. ` +
120
+ "Upload the lexicon next to model.onnx, or pass `gazetteerLexiconURL` explicitly."
121
+ : " — `gazetteerLexiconURL` was explicitly disabled (null). ") +
123
122
  " Running with zero-filled gazetteer clues: parses will be degraded (train/inference mismatch).");
124
123
  }
125
124
  if (inputNames.includes("anchor_features") && !fed.postcodeAnchorLookup) {
@@ -129,10 +128,10 @@ function warnOnUnfedTrainedChannels(runner, fed) {
129
128
  }
130
129
  }
131
130
  /**
132
- * Fetch + parse `anchor-lexicon-v1.json`. A missing file (404 or network failure) returns null —
133
- * the caller decides whether that matters (it does iff the model declares the gazetteer inputs; see
134
- * `warnOnUnfedTrainedChannels`). A PRESENT-but-malformed lexicon throws loudly via
135
- * `parseGazetteerLexicon`'s validation — never silently zero-fill off bad data.
131
+ * Fetch + parse `anchor-lexicon-v1.json`. A missing file (404 or network failure) returns null — the caller decides
132
+ * whether that matters (it does iff the model declares the gazetteer inputs; see `warnOnUnfedTrainedChannels`). A
133
+ * PRESENT-but-malformed lexicon throws loudly via `parseGazetteerLexicon`'s validation — never silently zero-fill off
134
+ * bad data.
136
135
  */
137
136
  async function fetchGazetteerLexicon(url, fetchImpl) {
138
137
  let res;
@@ -147,12 +146,12 @@ async function fetchGazetteerLexicon(url, fetchImpl) {
147
146
  return parseGazetteerLexicon((await res.json()));
148
147
  }
149
148
  /**
150
- * Browser-side analogue of `weights.readLabelsFromModelCard`. Same shape contract: returns the
151
- * `labels` array only when the card has a non-empty string array, throws on a present-but-malformed
152
- * field, returns `null` when the field is simply absent (legacy pre-v0.4.0 card).
149
+ * Browser-side analogue of `weights.readLabelsFromModelCard`. Same shape contract: returns the `labels` array only when
150
+ * the card has a non-empty string array, throws on a present-but-malformed field, returns `null` when the field is
151
+ * simply absent (legacy pre-v0.4.0 card).
153
152
  *
154
- * A 404 on the model-card itself is treated as "no card provided" — we tolerate older bundles that
155
- * shipped without one and let the classifier fall back to its compile-time default.
153
+ * A 404 on the model-card itself is treated as "no card provided" — we tolerate older bundles that shipped without one
154
+ * and let the classifier fall back to its compile-time default.
156
155
  */
157
156
  async function fetchLabelsFromModelCard(url, fetchImpl) {
158
157
  const res = await fetchImpl(url);
@@ -178,10 +177,9 @@ async function fetchBytes(url, fetchImpl) {
178
177
  return new Uint8Array(await res.arrayBuffer());
179
178
  }
180
179
  /**
181
- * Base64-encode a Uint8Array. Browsers + Node 18+ both have `btoa(String.fromCharCode(...))` but
182
- * String.fromCharCode chokes on long arrays (call-stack overflow on a few MB of bytes). The chunked
183
- * loop avoids that — kept here rather than imported because both browser and Node need it and
184
- * adding a dep for ~5 lines is silly.
180
+ * Base64-encode a Uint8Array. Browsers + Node 18+ both have `btoa(String.fromCharCode(...))` but String.fromCharCode
181
+ * chokes on long arrays (call-stack overflow on a few MB of bytes). The chunked loop avoids that — kept here rather
182
+ * than imported because both browser and Node need it and adding a dep for ~5 lines is silly.
185
183
  */
186
184
  function toBase64(bytes) {
187
185
  const chunkSize = 0x8000;
package/out/loader.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"loader.js","sourceRoot":"","sources":["../loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAGN,kBAAkB,EAClB,uBAAuB,EAEvB,qBAAqB,EACrB,sBAAsB,GACtB,MAAM,2BAA2B,CAAA;AAElC,OAAO,EAAE,aAAa,EAAyD,MAAM,sBAAsB,CAAA;AAiF3G,sGAAsG;AACtG,SAAS,kBAAkB,CAAC,OAAgC;IAC3D,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC,CAAC,CAAE,CAAA;IAC5C,MAAM,MAAM,GAAiB,IAAI,GAAG,EAAE,CAAA;IACtC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC9B,KAAK,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,MAAM,EAAE,CAAC;YACxC,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;YACrC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACf,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,EAAE,GAAG,KAAK,CAAC,SAAS,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAA;gBAC3F,SAAQ;YACT,CAAC;YACD,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;gBAAE,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;YACnF,yDAAyD;YACzD,IAAI,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC;gBACxC,IAAI,QAAQ,CAAC,GAAG,KAAK,CAAC,IA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CAAA;IACF,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,CAAsB,CAAA;AAC1D,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,GAAW,EAAE,SAAuB;IAC7D,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,GAAG,CAAC,CAAA;IAEhC,IAAI,CAAC,GAAG,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,SAAS,GAAG,YAAY,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC,CAAA;IAEpF,OAAO,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,WAAW,EAAE,CAAC,CAAA;AAC/C,CAAC;AAED;;;;GAIG;AACH,SAAS,QAAQ,CAAC,KAAiB;IAClC,MAAM,SAAS,GAAG,MAAM,CAAA;IACxB,IAAI,MAAM,GAAG,EAAE,CAAA;IAEf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,SAAS,EAAE,CAAC;QAClD,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,CAAA;QAC9C,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,CAAA;IACxC,CAAC;IAED,IAAI,OAAO,IAAI,KAAK,UAAU;QAAE,OAAO,IAAI,CAAC,MAAM,CAAC,CAAA;IAEnD,0FAA0F;IAC1F,sEAAsE;IACtE,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;AACxD,CAAC"}
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * Execution provider strategy:
11
11
  *
12
- * - Try WebGPU first when `useWebGpu !== false`. ~10× faster than WASM on supported devices, but
12
+ * - Try WebGPU first when `useWebGPU !== false`. ~10× faster than WASM on supported devices, but
13
13
  * availability depends on browser (Chromium 113+, Safari Tech Preview) AND hardware. The
14
14
  * runtime surfaces a clean error when WebGPU is unavailable, so the constructor falls back to
15
15
  * WASM automatically.
@@ -17,52 +17,51 @@
17
17
  * but works everywhere onnxruntime-web does — including in Node, which is how the test
18
18
  * harness exercises this file.
19
19
  *
20
- * Tensor shape + I/O contract matches `OnnxRunner` exactly: fixed-length int64 inputs, padded with
20
+ * Tensor shape + I/O contract matches `ONNXRunner` exactly: fixed-length int64 inputs, padded with
21
21
  * zeros + attention_mask, output is a `logits` tensor of shape `[batch, seq, num_labels]`. See
22
22
  * `@mailwoman/neural/onnx-runner` for the full export contract this file mirrors.
23
23
  */
24
24
  import { type InferResult, type NeuralRunner } from "@mailwoman/neural/browser";
25
- export interface WebOnnxRunnerOpts {
25
+ export interface WebONNXRunnerOpts {
26
26
  /**
27
- * Try the WebGPU execution provider first. Defaults to true. Set false to skip the WebGPU probe —
28
- * useful in test environments where WebGPU isn't available and the probe failure adds latency.
27
+ * Try the WebGPU execution provider first. Defaults to true. Set false to skip the WebGPU probe — useful in test
28
+ * environments where WebGPU isn't available and the probe failure adds latency.
29
29
  */
30
- useWebGpu?: boolean;
30
+ useWebGPU?: boolean;
31
31
  /**
32
- * Fixed sequence length the model expects. Matches `OnnxRunner.DEFAULT_FIXED_SEQ_LEN` (128) by
33
- * default. Re-quantized models can override.
32
+ * Fixed sequence length the model expects. Matches `ONNXRunner.DEFAULT_FIXED_SEQ_LEN` (128) by default. Re-quantized
33
+ * models can override.
34
34
  */
35
35
  fixedSeqLen?: number;
36
36
  /**
37
- * Optional override for where onnxruntime-web should load its `.wasm` assets from. Defaults to
38
- * the package's CDN paths; bundlers usually want to point this at a self-hosted copy.
37
+ * Optional override for where onnxruntime-web should load its `.wasm` assets from. Defaults to the package's CDN
38
+ * paths; bundlers usually want to point this at a self-hosted copy.
39
39
  *
40
- * Example: `setWasmPaths("/static/ort/")` and put the .wasm files at /static/ort/.
40
+ * Example: `setWASMPaths("/static/ort/")` and put the .wasm files at /static/ort/.
41
41
  */
42
42
  wasmPathsRoot?: string;
43
43
  }
44
44
  export declare const DEFAULT_FIXED_SEQ_LEN = 128;
45
- export interface WebOnnxRunnerDiagnostics {
45
+ export interface WebONNXRunnerDiagnostics {
46
46
  backend: "webgpu" | "wasm";
47
47
  modelBytes: number;
48
48
  }
49
- export declare class WebOnnxRunner implements NeuralRunner {
49
+ export declare class WebONNXRunner implements NeuralRunner {
50
50
  #private;
51
51
  private readonly modelBytes;
52
52
  private readonly opts;
53
53
  readonly fixedSeqLen: number;
54
- diagnostics: WebOnnxRunnerDiagnostics | null;
54
+ diagnostics: WebONNXRunnerDiagnostics | null;
55
55
  private constructor();
56
56
  /** Construct from already-fetched model bytes. */
57
- static fromBytes(modelBytes: Uint8Array, opts?: WebOnnxRunnerOpts): Promise<WebOnnxRunner>;
57
+ static fromBytes(modelBytes: Uint8Array, opts?: WebONNXRunnerOpts): Promise<WebONNXRunner>;
58
58
  /** Fetch the model from a URL and construct. */
59
- static fromUrl(modelUrl: string, opts?: WebOnnxRunnerOpts): Promise<WebOnnxRunner>;
59
+ static fromURL(modelURL: string, opts?: WebONNXRunnerOpts): Promise<WebONNXRunner>;
60
60
  /**
61
- * Names of the inputs the loaded ONNX graph declares. `null` until the session has been created
62
- * (first `infer()` call). Lets callers (e.g. the neural-web loader) detect
63
- * anchor/gazetteer-trained models and warn loudly when the corresponding feature source wasn't
64
- * provided running such a model on the zero-filled fallback is the measured train/inference
65
- * mismatch ("the zero-fill trap"), not a quality-neutral degrade.
61
+ * Names of the inputs the loaded ONNX graph declares. `null` until the session has been created (first `infer()`
62
+ * call). Lets callers (e.g. the neural-web loader) detect anchor/gazetteer-trained models and warn loudly when the
63
+ * corresponding feature source wasn't provided running such a model on the zero-filled fallback is the measured
64
+ * train/inference mismatch ("the zero-fill trap"), not a quality-neutral degrade.
66
65
  */
67
66
  get inputNames(): readonly string[] | null;
68
67
  infer(tokenIds: number[], anchor?: {
@@ -1 +1 @@
1
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EAClB,MAAM,CAAC,EAAE;QAAE,QAAQ,EAAE,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;QAAC,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;KAAE,EAC9F,SAAS,CAAC,EAAE;QAAE,QAAQ,EAAE,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;QAAC,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;KAAE,GAC/F,OAAO,CAAC,WAAW,CAAC;CA4FvB"}
@@ -9,7 +9,7 @@
9
9
  *
10
10
  * Execution provider strategy:
11
11
  *
12
- * - Try WebGPU first when `useWebGpu !== false`. ~10× faster than WASM on supported devices, but
12
+ * - Try WebGPU first when `useWebGPU !== false`. ~10× faster than WASM on supported devices, but
13
13
  * availability depends on browser (Chromium 113+, Safari Tech Preview) AND hardware. The
14
14
  * runtime surfaces a clean error when WebGPU is unavailable, so the constructor falls back to
15
15
  * WASM automatically.
@@ -17,7 +17,7 @@
17
17
  * but works everywhere onnxruntime-web does — including in Node, which is how the test
18
18
  * harness exercises this file.
19
19
  *
20
- * Tensor shape + I/O contract matches `OnnxRunner` exactly: fixed-length int64 inputs, padded with
20
+ * Tensor shape + I/O contract matches `ONNXRunner` exactly: fixed-length int64 inputs, padded with
21
21
  * zeros + attention_mask, output is a `logits` tensor of shape `[batch, seq, num_labels]`. See
22
22
  * `@mailwoman/neural/onnx-runner` for the full export contract this file mirrors.
23
23
  */
@@ -25,14 +25,14 @@ import { ANCHOR_FEATURE_DIM, GAZETTEER_FEATURE_DIM, } from "@mailwoman/neural/br
25
25
  import * as ort from "onnxruntime-web/webgpu";
26
26
  export const DEFAULT_FIXED_SEQ_LEN = 128;
27
27
  /** Apply `wasmPathsRoot` once at module init. Safe to call multiple times. */
28
- function configureWasmPaths(root) {
28
+ function configureWASMPaths(root) {
29
29
  if (!root)
30
30
  return;
31
31
  // onnxruntime-web ships this on `ort.env.wasm`. We assign directly rather than calling
32
- // `setWasmPaths` so it works across the slightly different shapes the typings have had.
32
+ // `setWASMPaths` so it works across the slightly different shapes the typings have had.
33
33
  ort.env.wasm.wasmPaths = root;
34
34
  }
35
- export class WebOnnxRunner {
35
+ export class WebONNXRunner {
36
36
  modelBytes;
37
37
  opts;
38
38
  fixedSeqLen;
@@ -46,25 +46,25 @@ export class WebOnnxRunner {
46
46
  }
47
47
  /** Construct from already-fetched model bytes. */
48
48
  static async fromBytes(modelBytes, opts = {}) {
49
- configureWasmPaths(opts.wasmPathsRoot);
50
- const runner = new WebOnnxRunner(modelBytes, opts);
49
+ configureWASMPaths(opts.wasmPathsRoot);
50
+ const runner = new WebONNXRunner(modelBytes, opts);
51
51
  return runner;
52
52
  }
53
53
  /** Fetch the model from a URL and construct. */
54
- static async fromUrl(modelUrl, opts = {}) {
55
- const res = await fetch(modelUrl);
54
+ static async fromURL(modelURL, opts = {}) {
55
+ const res = await fetch(modelURL);
56
56
  if (!res.ok)
57
- throw new Error(`fetch ${modelUrl} failed: ${res.status} ${res.statusText}`);
57
+ throw new Error(`fetch ${modelURL} failed: ${res.status} ${res.statusText}`);
58
58
  const bytes = new Uint8Array(await res.arrayBuffer());
59
- return WebOnnxRunner.fromBytes(bytes, opts);
59
+ return WebONNXRunner.fromBytes(bytes, opts);
60
60
  }
61
61
  async #ensureSession() {
62
62
  if (this.#session)
63
63
  return this.#session;
64
64
  if (!this.#loadPromise) {
65
65
  this.#loadPromise = (async () => {
66
- const wantWebGpu = this.opts.useWebGpu !== false;
67
- if (wantWebGpu) {
66
+ const wantWebGPU = this.opts.useWebGPU !== false;
67
+ if (wantWebGPU) {
68
68
  try {
69
69
  const session = await ort.InferenceSession.create(this.modelBytes, {
70
70
  executionProviders: ["webgpu", "wasm"],
@@ -90,11 +90,10 @@ export class WebOnnxRunner {
90
90
  return this.#loadPromise;
91
91
  }
92
92
  /**
93
- * Names of the inputs the loaded ONNX graph declares. `null` until the session has been created
94
- * (first `infer()` call). Lets callers (e.g. the neural-web loader) detect
95
- * anchor/gazetteer-trained models and warn loudly when the corresponding feature source wasn't
96
- * provided running such a model on the zero-filled fallback is the measured train/inference
97
- * mismatch ("the zero-fill trap"), not a quality-neutral degrade.
93
+ * Names of the inputs the loaded ONNX graph declares. `null` until the session has been created (first `infer()`
94
+ * call). Lets callers (e.g. the neural-web loader) detect anchor/gazetteer-trained models and warn loudly when the
95
+ * corresponding feature source wasn't provided running such a model on the zero-filled fallback is the measured
96
+ * train/inference mismatch ("the zero-fill trap"), not a quality-neutral degrade.
98
97
  */
99
98
  get inputNames() {
100
99
  return this.#session?.inputNames ?? null;
@@ -112,7 +111,7 @@ export class WebOnnxRunner {
112
111
  input_ids: new ort.Tensor("int64", padded, [1, this.fixedSeqLen]),
113
112
  attention_mask: new ort.Tensor("int64", mask, [1, this.fixedSeqLen]),
114
113
  };
115
- // Anchor channel (#239/#240) — mirror of the node OnnxRunner. Feed the per-piece anchor when the
114
+ // Anchor channel (#239/#240) — mirror of the node ONNXRunner. Feed the per-piece anchor when the
116
115
  // caller supplies it; otherwise, for anchor-trained models (whose ONNX declares the inputs as
117
116
  // mandatory), feed zeros — the confidence=0 identity / anchor-off path. Without this the session
118
117
  // throws on the missing required inputs.
@@ -138,7 +137,7 @@ export class WebOnnxRunner {
138
137
  ]);
139
138
  feeds.anchor_confidence = new ort.Tensor("float32", new Float32Array(this.fixedSeqLen), [1, this.fixedSeqLen]);
140
139
  }
141
- // Gazetteer-anchor channel (#464) — mirror of the node OnnxRunner. Feed the per-piece clue when
140
+ // Gazetteer-anchor channel (#464) — mirror of the node ONNXRunner. Feed the per-piece clue when
142
141
  // the caller supplies it AND the graph declares the inputs; for gazetteer-trained models with no
143
142
  // clue data, feed zeros (the confidence=0 identity — a structural fallback only; see the loader's
144
143
  // loud warning) so the session doesn't throw `input 'gazetteer_features' is missing in 'feeds'`.
@@ -179,7 +178,7 @@ export class WebOnnxRunner {
179
178
  logits.push(row);
180
179
  }
181
180
  // Locale head (#511 Tier A): present on v1.1.0+ exports (shipped v4.3.0+), absent before.
182
- // Mirrors the node OnnxRunner — `addressSystemConventions: "auto"` depends on this surfacing.
181
+ // Mirrors the node ONNXRunner — `addressSystemConventions: "auto"` depends on this surfacing.
183
182
  const localeTensor = output["locale_logits"];
184
183
  const localeLogits = localeTensor ? Array.from(localeTensor.data) : undefined;
185
184
  return { logits, numLabels, ...(localeLogits ? { localeLogits } : {}) };
@@ -1 +1 @@
1
- {"version":3,"file":"web-onnx-runner.js","sourceRoot":"","sources":["../web-onnx-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EACN,kBAAkB,EAClB,qBAAqB,GAGrB,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,GAAG,MAAM,wBAAwB,CAAA;AAsB7C,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAA;AAExC,8EAA8E;AAC9E,SAAS,kBAAkB,CAAC,IAAwB;IACnD,IAAI,CAAC,IAAI;QAAE,OAAM;IACjB,uFAAuF;IACvF,wFAAwF;IACxF,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAA;AAC9B,CAAC;AAOD,MAAM,OAAO,aAAa;IAOP;IACA;IAPF,WAAW,CAAQ;IAC5B,WAAW,GAAoC,IAAI,CAAA;IAC1D,QAAQ,GAAgC,IAAI,CAAA;IAC5C,YAAY,GAAyC,IAAI,CAAA;IAEzD,YACkB,UAAsB,EACtB,IAAuB;QADvB,eAAU,GAAV,UAAU,CAAY;QACtB,SAAI,GAAJ,IAAI,CAAmB;QAExC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,qBAAqB,CAAA;IAC7D,CAAC;IAED,kDAAkD;IAClD,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,UAAsB,EAAE,OAA0B,EAAE;QAC1E,kBAAkB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;QACtC,MAAM,MAAM,GAAG,IAAI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A;YAC5D,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACjB,CAAC;QAED,0FAA0F;QAC1F,8FAA8F;QAC9F,MAAM,YAAY,GAAG,MAAM,CAAC,eAAe,CAAC,CAAA;QAC5C,MAAM,YAAY,GAAG,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,IAAoB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;QAE7F,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAA;IACxE,CAAC;CACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mailwoman/neural-web",
3
- "version": "4.16.1",
3
+ "version": "5.0.0",
4
4
  "description": "Browser-side mailwoman neural runtime. Pairs the existing tokenizer + decoder with an onnxruntime-web inference path (WebGPU primary, WASM SIMD fallback). Drop-in for @mailwoman/neural when targeting a static-asset deploy (Phase B of the demo plan).",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
@@ -8,16 +8,6 @@
8
8
  "url": "https://github.com/sister-software/mailwoman.git",
9
9
  "directory": "neural-web"
10
10
  },
11
- "type": "module",
12
- "exports": {
13
- "./package.json": "./package.json",
14
- ".": "./out/index.js"
15
- },
16
- "dependencies": {
17
- "@mailwoman/core": "4.16.1",
18
- "@mailwoman/neural": "4.16.1",
19
- "onnxruntime-web": "1.25.0-dev.20260327-722743c0e2"
20
- },
21
11
  "files": [
22
12
  "out/**/*.js",
23
13
  "out/**/*.js.map",
@@ -25,7 +15,17 @@
25
15
  "out/**/*.d.ts.map",
26
16
  "README.md"
27
17
  ],
18
+ "type": "module",
19
+ "exports": {
20
+ "./package.json": "./package.json",
21
+ ".": "./out/index.js"
22
+ },
28
23
  "publishConfig": {
29
24
  "access": "public"
25
+ },
26
+ "dependencies": {
27
+ "@mailwoman/core": "5.0.0",
28
+ "@mailwoman/neural": "5.0.0",
29
+ "onnxruntime-web": "1.25.0-dev.20260327-722743c0e2"
30
30
  }
31
31
  }