Skip to content

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
ruvnet:mainfrom
hobolabsdigital:fix/wasm-set-model-provider-glm
Draft

fix(wasm): wire JS model provider via set_model_provider(fn) β€” new JsModelProvider(fn) throws after agent-execute-core import#2490
hobolabsdigital wants to merge 1 commit into
ruvnet:mainfrom
hobolabsdigital:fix/wasm-set-model-provider-glm

Conversation

@hobolabsdigital

Copy link
Copy Markdown

Problem

wasm_agent_create / createWasmAgent fail for any model with:

JsModelProvider requires a function argument

Root cause: in attachJsModelProvider, await import('../mcp-tools/agent-execute-core.js') is evaluated, then new 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 via createWasmAgent directly (not a stale runtime). @ruvector/rvagent-wasm@0.1.0 constructs 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_provider accepts a raw Function (per rvagent_wasm.d.ts). Skip the broken wrapper and pass the callback directly. One-line-ish change in attachJsModelProvider.

Verification

Fresh Node process, RUFLO_PROVIDER=ollama + OLLAMA_API_KEY, model: "ollama:glm-5.2:cloud": createWasmAgent β†’ promptWasmAgent succeeds; the provider call lands on glm-5.2:cloud at https://ollama.com/v1/chat/completions and returns content (pre-fix: throws).

Secondary note (optional, not in this diff)

callOllamaCompat appends /v1/chat/completions to OLLAMA_BASE_URL, so a base of https://ollama.com/v1 becomes .../v1/v1/.... Docs should specify the bare host (https://ollama.com) for the ruflo provider path. (The env-var table also lists OLLAMA_URL=localhost:11434, but the code reads OLLAMA_BASE_URL defaulting to https://ollama.com.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant