fix(wasm): wire JS model provider via set_model_provider(fn) β new JsModelProvider(fn) throws after agent-execute-core import#2490
Draft
hobolabsdigital wants to merge 1 commit into
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.
Problem
wasm_agent_create/createWasmAgentfail for any model with:Root cause: in
attachJsModelProvider,await import('../mcp-tools/agent-execute-core.js')is evaluated, thennew mod.JsModelProvider(fn)is constructed β after that module graph loads, the wasm-bindgen ctor rejects its (valid) JS callback. Reproduced in a fresh Node process viacreateWasmAgentdirectly (not a stale runtime).@ruvector/rvagent-wasm@0.1.0constructs fine in isolation, so it's the construct-after-graph-load interaction. Net effect: ADR-129 P1 real-LLM wiring is dead on the current build β every provider-keyed create throws; only the keyless echo stub survives.Fix
WasmAgent.set_model_provideraccepts a rawFunction(perrvagent_wasm.d.ts). Skip the broken wrapper and pass the callback directly. One-line-ish change inattachJsModelProvider.Verification
Fresh Node process,
RUFLO_PROVIDER=ollama+OLLAMA_API_KEY,model: "ollama:glm-5.2:cloud":createWasmAgentβpromptWasmAgentsucceeds; the provider call lands onglm-5.2:cloudathttps://ollama.com/v1/chat/completionsand returns content (pre-fix: throws).Secondary note (optional, not in this diff)
callOllamaCompatappends/v1/chat/completionstoOLLAMA_BASE_URL, so a base ofhttps://ollama.com/v1becomes.../v1/v1/.... Docs should specify the bare host (https://ollama.com) for the ruflo provider path. (The env-var table also listsOLLAMA_URL=localhost:11434, but the code readsOLLAMA_BASE_URLdefaulting tohttps://ollama.com.)