@smart-coders-hq/opencode-model-fallback 1.1.1 → 1.2.0

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/dist/index.js CHANGED
@@ -3262,8 +3262,8 @@ function classifyError(message, statusCode) {
3262
3262
 
3263
3263
  // src/display/notifier.ts
3264
3264
  async function notifyFallback(client, from, to, reason) {
3265
- const fromLabel = from ? shortModelName(from) : "current model";
3266
- const message = `Model fallback: switched from ${fromLabel} to ${shortModelName(to)} (${reason})`;
3265
+ const fromLabel = from ? labelModel(from) : "current model";
3266
+ const message = `Model fallback: switched from ${fromLabel} to ${labelModel(to)} (${reason})`;
3267
3267
  await client.tui.showToast({
3268
3268
  body: {
3269
3269
  title: "Model Fallback",
@@ -3274,7 +3274,7 @@ async function notifyFallback(client, from, to, reason) {
3274
3274
  }).catch(() => {});
3275
3275
  }
3276
3276
  async function notifyFallbackActive(client, originalModel, currentModel) {
3277
- const message = `Using ${shortModelName(currentModel)} (fallback from ${shortModelName(originalModel)})`;
3277
+ const message = `Using ${labelModel(currentModel)} (fallback from ${labelModel(originalModel)})`;
3278
3278
  await client.tui.showToast({
3279
3279
  body: {
3280
3280
  title: "Fallback Active",
@@ -3285,7 +3285,7 @@ async function notifyFallbackActive(client, originalModel, currentModel) {
3285
3285
  }).catch(() => {});
3286
3286
  }
3287
3287
  async function notifyRecovery(client, originalModel) {
3288
- const message = `Original model ${shortModelName(originalModel)} is available again`;
3288
+ const message = `Original model ${labelModel(originalModel)} is available again`;
3289
3289
  await client.tui.showToast({
3290
3290
  body: {
3291
3291
  title: "Model Recovered",
@@ -3295,9 +3295,13 @@ async function notifyRecovery(client, originalModel) {
3295
3295
  }
3296
3296
  }).catch(() => {});
3297
3297
  }
3298
- function shortModelName(key) {
3299
- const parts = key.split("/");
3300
- return parts.length > 1 ? parts.slice(1).join("/") : key;
3298
+ function labelModel(key) {
3299
+ const slash = key.indexOf("/");
3300
+ if (slash === -1)
3301
+ return key;
3302
+ const provider = key.slice(0, slash);
3303
+ const model = key.slice(slash + 1);
3304
+ return `${model} [${provider}]`;
3301
3305
  }
3302
3306
 
3303
3307
  // src/logging/logger.ts
@@ -4,5 +4,6 @@ type Client = PluginInput["client"];
4
4
  export declare function notifyFallback(client: Client, from: ModelKey | null, to: ModelKey, reason: ErrorCategory): Promise<void>;
5
5
  export declare function notifyFallbackActive(client: Client, originalModel: ModelKey, currentModel: ModelKey): Promise<void>;
6
6
  export declare function notifyRecovery(client: Client, originalModel: ModelKey): Promise<void>;
7
+ export declare function labelModel(key: ModelKey): string;
7
8
  export {};
8
9
  //# sourceMappingURL=notifier.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"notifier.d.ts","sourceRoot":"","sources":["../../../src/display/notifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE3D,KAAK,MAAM,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;AAEpC,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,QAAQ,GAAG,IAAI,EACrB,EAAE,EAAE,QAAQ,EACZ,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,IAAI,CAAC,CAef;AAED,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,QAAQ,EACvB,YAAY,EAAE,QAAQ,GACrB,OAAO,CAAC,IAAI,CAAC,CAYf;AAED,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAY3F"}
1
+ {"version":3,"file":"notifier.d.ts","sourceRoot":"","sources":["../../../src/display/notifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE3D,KAAK,MAAM,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;AAEpC,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,QAAQ,GAAG,IAAI,EACrB,EAAE,EAAE,QAAQ,EACZ,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,IAAI,CAAC,CAef;AAED,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,QAAQ,EACvB,YAAY,EAAE,QAAQ,GACrB,OAAO,CAAC,IAAI,CAAC,CAYf;AAED,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAY3F;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,QAAQ,GAAG,MAAM,CAMhD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smart-coders-hq/opencode-model-fallback",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "Ordered model fallback chains with health tracking for OpenCode",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/plugin.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "id": "opencode-model-fallback",
4
4
  "name": "Model Fallback",
5
5
  "description": "Ordered model fallback chains with health tracking and preemptive redirects for OpenCode",
6
- "version": "1.1.1",
6
+ "version": "1.2.0",
7
7
  "entry": "dist/index.js",
8
8
  "links": [
9
9
  {