fix(model): make Transformers peer optional - #87
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes
@huggingface/transformersopt-in so installing the agent for cloud models does not also install the on-device Transformers and ONNX runtimes.Risk
There is no source-interface change. The installation contract changes for applications using
createEngine: npm no longer supplies@huggingface/transformersautomatically, so those applications must declare it directly. This is intentional, documented, and covered by the packed-install smoke test.The release metadata advances every coordinated workspace package to
0.4.2; the runtime behavior change is confined to@inbrowser/model.Local inference now declares its runtime explicitly
mkdir /tmp/inbrowser-local-model cd /tmp/inbrowser-local-model npm init -y npm install @inbrowser/model@0.4.2 @huggingface/transformerscreateEngine, its presets, and its event interface are unchanged. Only ownership of the Transformers installation moves to the application that uses on-device inference.A missing local runtime reports the install command
The error translation is limited to failure to resolve the peer itself. Missing transitive modules and errors thrown while evaluating Transformers retain their original error and stack.
Implementation notes and verification
peerDependenciesMetamarks@huggingface/transformersoptional; it remains a peer so local-inference applications control the version.0.4.2tarballs with npm defaults and asserts that neither@huggingface/transformersnoronnxruntime-nodeappears anywhere in the dependency tree.bun scripts/smoke-pack.ts: 84 checks passed, including packed imports and the missing-peer diagnostic.bun run build: passed for all six packages.bun run check: passed across 427 files.bun test --cwd packages/model: 171 passed; two Claude CLI stdin-fixture tests also fail onmainand are unchanged here.