UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

1 lines 484 B
var TurnClock=class{#e;#t={inputTokens:0,outputTokens:0};arm(){this.#e=Date.now(),this.#t={inputTokens:0,outputTokens:0}}get armed(){return this.#e!==void 0}get startedAtMs(){return this.#e}get usage(){return this.#t}addUsage(e){this.#t.inputTokens+=e.inputTokens??0,this.#t.outputTokens+=e.outputTokens??0}settle(){let e=this.#e;if(e!==void 0)return this.#e=void 0,{elapsedMs:Date.now()-e,...this.#t}}reset(){this.#e=void 0,this.#t={inputTokens:0,outputTokens:0}}};export{TurnClock};