(model: string, usage: TokenUsage, scope: UsageRecordScope = 'session')
| 24 | } |
| 25 | |
| 26 | record(model: string, usage: TokenUsage, scope: UsageRecordScope = 'session'): void { |
| 27 | this.agent?.records.logRecord({ |
| 28 | type: 'usage.record', |
| 29 | model, |
| 30 | usage, |
| 31 | usageScope: scope, |
| 32 | }); |
| 33 | const current = this.byModel[model]; |
| 34 | this.byModel[model] = current === undefined ? copyUsage(usage) : addUsage(current, usage); |
| 35 | |
| 36 | if (scope === 'turn') { |
| 37 | this.currentTurn = |
| 38 | this.currentTurn === undefined ? copyUsage(usage) : addUsage(this.currentTurn, usage); |
| 39 | } |
| 40 | this.agent?.emitStatusUpdated(); |
| 41 | } |
| 42 | |
| 43 | data(): UsageStatus { |
| 44 | const byModel = this.byModelSnapshot(); |
no test coverage detected