/** * What a long run has actually achieved, said alongside what it has spent. * * The warning about a long run was a pure token threshold: at a million tokens, five million, ten * million, it said how many requests and how many tokens and "It is still going. Stop it if that is * not what you meant." It looked at nothing else, so it could not tell a run doing the work from a * run going round in circles, and said the same alarming thing to both. * * Reported by somebody whose run had made 152 requests across two or three tasks and done them: * "is it healthy or?" — a fair question to have to ask, and one the message should have answered. * Worse, the thresholds meant that single run raised it three times. * * The arithmetic is worth keeping in view. 10,028,873 tokens over 152 requests is 66k a request, * which is simply what a 66k conversation costs to re-read 152 times; the part actually produced is * one or two per cent of it. So a token total is a measure of conversation size multiplied by * turns, not a measure of waste, and presenting it alone invites exactly the wrong conclusion. * * What distinguishes the two cases is whether anything is changing. Files written, commands run, * plan steps closed: a run with those is working, however much it has spent, and a run with none of * them after a million tokens is the one worth interrupting. */ import type { TrajectoryEvent } from './trajectory.js'; export interface RunProgress { /** Successful calls to a tool that changes the workspace. */ edits: number; /** Distinct paths those calls touched, which is closer to what a person counts. */ files: number; commands: number; reads: number; stepsDone: number; stepsTotal: number; /** Sub-agents started, since delegated work is work. */ agents: number; } export declare function summariseProgress(events: readonly TrajectoryEvent[], plan?: { steps: readonly { state: string; }[]; }, agents?: number): RunProgress; /** Whether anything has actually moved. Reading is not progress; it is looking for some. */ export declare function isGettingSomewhere(p: RunProgress): boolean; /** What was achieved, in the order a person would ask about it. Empty when nothing was. */ export declare function describeProgress(p: RunProgress): string; export interface RunSpend { requests: number; tokens: number; promptTokens: number; completionTokens: number; cachedTokens: number; delegatedTokens: number; model: string; } /** * The whole message. * * Two different messages, really, and which one you get is the point. A run that is getting * somewhere is told what it has done and what it has spent, with no suggestion that anything is * wrong — because nothing is. A run that has spent a million tokens and changed nothing is told * exactly that, because that is the one worth stopping. * * Neither version recommends setting a turn limit any more. A turn limit stops a run at a number * that has nothing to do with whether the work is finished, and the same person who is told to set * one is later told "Stopped after 40 turns — the work may be unfinished". */ export declare function longRunNotice(spend: RunSpend, progress: RunProgress, opts?: { local: boolean; priced?: boolean; }): string; //# sourceMappingURL=run-progress.d.ts.map