fix(web): honor model load options and backend routing
SH
5h ago+771+771+012345678901234567890123456789-67-67-01234567890123456789
What
Web model loading rejected contextLength, dropped backend preferences, and could route loads or embedding calls to the wrong WASM module or worker.
This PR forwards supported load options, selects a registered backend that supports the model type, and keeps runtime ownership consistent.
Changes
- Forward
contextLength, ordered backend preferences, andforceReload, including the deprecatedframeworkalias. - Reject retired
threadsand unsupportedrequired: truepreferences with structured configuration errors. - Check backend capabilities before selecting a route, retaining the catalog backend as a fallback candidate.
- Use consistent routing across synchronous loads, asynchronous loads, OPFS hydration, retries, and workers.
- Preserve the actual worker framework for model lookups and embedding reloads.
- Clear stale worker ownership after successful main-thread loads, including retries.
- Add regression coverage for backend fallback, embedding reloads, ownership transitions, and failed loads.
Verification
- 310 tests passed across 60 Web test files.
- Full Web workspace typecheck, build, and lint passed, including browser, NodeNext, and Node ESM checks.
- TypeScript protobuf regeneration produced no tracked changes.
git diff --checkpassed.- All 23 GitHub checks passed, including
swift-spm.