const HARNESS_TURN_USAGE_STATE_KEY=`eve.harness.turnUsage`,ZERO_USAGE={cacheReadTokens:0,inputTokens:0,outputTokens:0};function getTurnUsageState(t){return t?.[HARNESS_TURN_USAGE_STATE_KEY]}function setTurnUsageState(t,n){return{...t,state:{...t.state,[HARNESS_TURN_USAGE_STATE_KEY]:n}}}function accumulateTurnUsage(e){let n=e.previous!==void 0&&e.previous.turnId===e.turnId?e.previous:{...ZERO_USAGE,turnId:e.turnId};return{turnId:e.turnId,cacheReadTokens:n.cacheReadTokens+(e.usage.cachedInputTokens??0),inputTokens:n.inputTokens+(e.usage.inputTokens??0),outputTokens:n.outputTokens+(e.usage.outputTokens??0)}}export{accumulateTurnUsage,getTurnUsageState,setTurnUsageState};