fix: eagerly fetch models in config hook for OpenCode >=1.14.47 compatibility (#12) (#14)
* fix: eagerly fetch models in config hook to fix OpenCode >=1.14.47 picker issue (#12) OpenCode 1.14.47+ reads provider.models eagerly at list time and by copy, so the previous pattern of hydrating models in-place during the auth loader hook no longer works. The picker only saw the 4 hardcoded fallback models. This change makes the config hook eagerly fetch live models from the /v1/models endpoint when auth is available in the store, ensuring the full model list is visible to Provider.list on all OpenCode versions. - Add readAuthFromStore helper to read ~/.local/share/opencode/auth.json - Refactor createRuntimeConfig to accept options directly for reuse - Update config hook to await fetchModels before setting provider.models - Keep loader hook for runtime refresh and fetch interceptor setup Fixes #12 * fix: address code review feedback for issue-12 - Fix import ordering (Node.js built-ins before internal imports) - Fix test temp directory leak with try/finally cleanup - Fix os.homedir() caching by using process.env.HOME directly - Fix eager fetch bypassing cache by using forceRefresh=false * chore: bump version to 1.1.2 * chore: fix README.md * style: address review feedback - fix import ordering and narrow error handling * chore: ignore .worktrees directory
A
Alph4d0g committed
3bf228d4e57702dd3cf482bd08abdc2680681d77
Parent: c891ba9
Committed by GitHub <noreply@github.com>
on 5/13/2026, 7:12:57 PM