import type { AgentEnvironmentEvent } from "@tangle-network/agent-interface/environment-provider"; /** * Attaches an execution's running usage to the step frames of its stream. * * Sandbox reports an execution's usage on its terminal `result` and `done` * frames. Before those frames, the only usage on the stream is the OpenCode * harness's own `step_finish` event, which the sidecar forwards as a `raw` * frame with that step's token counts. No other harness the sidecar runs * forwards usage before the terminal frames, so their streams stay unchanged. */ export interface StepUsageFold { /** * The event, carrying the execution's cumulative usage when it reports a * step not yet counted. Every other event is returned unchanged. */ observe(event: AgentEnvironmentEvent): AgentEnvironmentEvent; } /** * Create the fold for one stream that starts at its execution's first frame. * * A cumulative total counts every step before it, so a stream that resumes * after a cursor, or joins at a live tail, must not use this fold. * * The terminal receipt stays authoritative. Its usage is never replaced, and * the step frames are never rewritten to agree with it. A receipt below the * streamed total is therefore delivered as reported, and a consumer that folds * cumulative usage sees the total fall instead of a silently lowered total. */ export declare function createStepUsageFold(): StepUsageFold;