Record a tool outcome.
(toolName, success)
| 35 | |
| 36 | /** Record a tool outcome. */ |
| 37 | record(toolName, success) { |
| 38 | if (this.disabled || !toolName) return; |
| 39 | if (!this.scores.has(toolName)) { |
| 40 | this.scores.set(toolName, { consecutiveFails: 0, totalFails: 0, totalCalls: 0 }); |
| 41 | } |
| 42 | const s = this.scores.get(toolName); |
| 43 | s.totalCalls++; |
| 44 | if (success) { |
| 45 | if (this.resetOnSuccess) s.consecutiveFails = 0; |
| 46 | // Don't touch totalFails — it tracks historical |
| 47 | } else { |
| 48 | s.consecutiveFails++; |
| 49 | s.totalFails++; |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Get the trust level for a tool. |