diff --git a/src/ml/imf/index.ts b/src/ml/imf/index.ts index b865c7b..30e36bd 100644 --- a/src/ml/imf/index.ts +++ b/src/ml/imf/index.ts @@ -18,4 +18,12 @@ export { } from "./registry.js" export { pickTier, warmUp, type TierCandidate } from "./tiers.js" export { normalizeArabicInput, repetitionGuardCut } from "./guards.js" -export { encode, decode, BYTE_OFFSET, EOS_ID, PAD_ID, UNK_ID } from "./tokens.js" +export { + encode, + decode, + firstAlternates, + BYTE_OFFSET, + EOS_ID, + PAD_ID, + UNK_ID, +} from "./tokens.js" diff --git a/test/ml/public-surface.test.ts b/test/ml/public-surface.test.ts new file mode 100644 index 0000000..15ff494 --- /dev/null +++ b/test/ml/public-surface.test.ts @@ -0,0 +1,13 @@ +import { describe, expect, it } from "vitest" +import * as ml from "../../src/ml/index.js" + +// Public-surface guard: the decode-contract helpers must be reachable +// through the package barrel, not only via source-tree imports. +// (npm 5.8.0 shipped tokens.js with firstAlternates but the imf +// barrel never re-exported it — unreachable by any documented import.) +describe("ml public surface", () => { + it("exposes imf.firstAlternates through the barrel", () => { + expect(typeof ml.imf.firstAlternates).toBe("function") + expect(ml.imf.firstAlternates("a/b c")).toBe("a c") + }) +})