@shutovks/opencode-model-fallback 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -105,3 +105,7 @@ bun run build
105
105
  ## License
106
106
 
107
107
  MIT
108
+
109
+ ---
110
+
111
+ > This project is independent and is not built by, endorsed by, or affiliated with the [OpenCode](https://opencode.ai) team.
package/dist/index.js CHANGED
@@ -167,11 +167,17 @@ function nextModel(config, state) {
167
167
  return config.fallbackModels.find((model) => {
168
168
  if (model === state.currentModel)
169
169
  return false;
170
+ if (config.unavailableModels.includes(model))
171
+ return false;
170
172
  return (state.failedUntil.get(model) ?? 0) <= now;
171
173
  });
172
174
  }
173
175
  function firstFallbackFor(config, model) {
174
- return config.fallbackModels.find((fallbackModel) => fallbackModel !== model);
176
+ return config.fallbackModels.find((fallbackModel) => {
177
+ if (fallbackModel === model)
178
+ return false;
179
+ return !config.unavailableModels.includes(fallbackModel);
180
+ });
175
181
  }
176
182
  function fallbackForUnavailable(config, model) {
177
183
  if (!model || !config.unavailableModels.includes(model))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shutovks/opencode-model-fallback",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "OpenCode plugin that retries failed sessions with fallback models.",
5
5
  "homepage": "https://github.com/ShutovKS/opencode-model-fallback#readme",
6
6
  "bugs": {