@azumag/opencode-rate-limit-fallback 1.57.0 → 1.58.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.
@@ -34,7 +34,12 @@ export class PatternLearner {
34
34
  this.trackPattern(candidate);
35
35
  }
36
36
  // Process and potentially save patterns
37
- this.processPatterns();
37
+ // Fire-and-forget with proper error handling
38
+ this.processPatterns().catch((error) => {
39
+ this.logger.error('[PatternLearner] Failed to process patterns', {
40
+ error: error instanceof Error ? error.message : String(error),
41
+ });
42
+ });
38
43
  }
39
44
  catch (error) {
40
45
  this.logger.error('[PatternLearner] Failed to learn from error', {
@@ -81,6 +81,10 @@ export declare class ErrorPatternRegistry {
81
81
  * Learn a new pattern from an error
82
82
  */
83
83
  addLearnedPattern(error: unknown): void;
84
+ /**
85
+ * Learn a new pattern from an error (async version)
86
+ */
87
+ addLearnedPatternAsync(error: unknown): Promise<void>;
84
88
  /**
85
89
  * Get all learned patterns
86
90
  */
@@ -296,6 +296,17 @@ export class ErrorPatternRegistry {
296
296
  this.logger.warn('[ErrorPatternRegistry] Pattern learning is not enabled. Patterns must be manually registered via configuration.');
297
297
  }
298
298
  }
299
+ /**
300
+ * Learn a new pattern from an error (async version)
301
+ */
302
+ async addLearnedPatternAsync(error) {
303
+ if (this.patternLearner) {
304
+ this.patternLearner.learnFromError(error);
305
+ }
306
+ else {
307
+ this.logger.warn('[ErrorPatternRegistry] Pattern learning is not enabled. Patterns must be manually registered via configuration.');
308
+ }
309
+ }
299
310
  /**
300
311
  * Get all learned patterns
301
312
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azumag/opencode-rate-limit-fallback",
3
- "version": "1.57.0",
3
+ "version": "1.58.0",
4
4
  "description": "OpenCode plugin that automatically switches to fallback models when rate limited",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",