dsh-llm-fallbacks 0.4.1 → 0.4.2

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
@@ -925,7 +925,8 @@ var FallbackStateStore = class {
925
925
  if (mode !== "half-open") return;
926
926
  for (const key of state.cooldown.keys()) this.isSuppressed(state, key, now, mode);
927
927
  }
928
- observeSuccess(state, key) {
928
+ observeSuccess(state, key, now = Date.now()) {
929
+ if (state.cooldown.peek(key) !== void 0) this.isSuppressed(state, key, now, "half-open");
929
930
  state.recovery.close(key);
930
931
  }
931
932
  };
package/dist/state.d.ts CHANGED
@@ -169,9 +169,17 @@ export declare class FallbackStateStore {
169
169
  */
170
170
  syncRecovery(state: AgentFallbackState, now: number, mode: RecoveryPolicy): void;
171
171
  /**
172
- * Observed completion ⇒ close the circuit (plan P2 rule 6): acts only when
173
- * the entry exists and is half-open; otherwise a no-op (a stale in-flight
174
- * success must not cancel a fresher escalated re-suppression).
172
+ * Observed completion ⇒ close the circuit (plan P2 rule 6). The lazy
173
+ * expiry runs FIRST — the same read the decision path performs — so a
174
+ * cooldown that lapsed BEFORE this completion is treated as what it is:
175
+ * an expired suppression, not an active one. The completion is
176
+ * post-expiry evidence and closes the circuit even when no decision-path
177
+ * read has transitioned the entry to half-open yet (a manual
178
+ * re-selection of the route, or a route no walk ever consulted because the
179
+ * current route kept succeeding). An ACTIVE suppression (`until > now`,
180
+ * including the `Infinity` of `revertPolicy: 'never'`) is untouched:
181
+ * a stale in-flight success must not cancel a fresher escalated
182
+ * re-suppression.
175
183
  */
176
- observeSuccess(state: AgentFallbackState, key: string): void;
184
+ observeSuccess(state: AgentFallbackState, key: string, now?: number): void;
177
185
  }
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "dsh",
6
6
  "dsh-plugin"
7
7
  ],
8
- "version": "0.4.1",
8
+ "version": "0.4.2",
9
9
  "type": "module",
10
10
  "main": "./dist/index.js",
11
11
  "types": "./dist/index.d.ts",