import type { SourceMap } from "../../backends/sourceMap.js"; import { type Checkpoint } from "../../runtime/state/checkpointStore.js"; import type { StopLocation } from "../../runtime/waits.js"; export type FrameView = { index: number; name: string; moduleId: string; args: Record; locals: Record; /** Set on a tool loop's frame. */ loop?: { round: number; removedTools: string[]; }; }; /** The frames from the root down to the stopped one, innermost last. */ export declare function stackOf(checkpoint: Checkpoint, branchPath: string[]): FrameView[]; /** Frame `index`, or with none the frame a person inspects at the stop: * the last, or, at one of the tool loop's own stops, the one that * called `llm()` under the loop's frame, as `Checkpoint.shownFrame` * picks for the terminal. */ export declare function frameAt(checkpoint: Checkpoint, stop: { branchPath?: string[]; loopStop?: unknown; } | undefined, index: number | undefined): FrameView | null; export declare function usageOf(checkpoint: Checkpoint): { totalTokens: number; totalCost: number; }; /** The `__sourceMap` a compiled module carries, read from the file as * text so the CLI never loads the program's code. The map is a JSON * object literal after `__sourceMap = `, on one line or many depending * on the compile; it is found by its opening brace and read to the * matching one. Null when the file is not there or has no map. */ export declare function readSourceMap(compiledPath: string): SourceMap | null; /** The balanced `{ … }` that follows `marker` in `text`, strings * skipped, or null when there is none. */ export declare function objectLiteralAfter(text: string, marker: string): string | null; /** A program's path as the person sees it: relative to `cwd` when it is * under it. */ export declare function shownPath(program: string, cwd: string): string; /** The source line of a location, from its module's map; undefined when * the map has no entry for it. */ export declare function lineFor(map: SourceMap | null, location: StopLocation): number | undefined; /** Where a module's source may be on disk: under the current directory, * or beside the compiled program. */ export declare function sourcePathFor(moduleId: string, cwd: string, compiledPath: string): string | null; export type SourceWindow = { path: string; first: number; lines: string[]; }; /** `context` lines either side of `line` in the file, numbered from * `first`. Null when the file cannot be read. */ export declare function sourceAround(filePath: string, line: number, context: number): SourceWindow | null;