/** * What a run's journal and its event stream say of its visits, read once for * the live view: how each visit last ended, which are running now, the * subagents each spawned, and the lives the run has had. * * The journal holds what earlier lives wrote and the events what this one * told, so one reading takes a finished run's journal alone, a live run's * stream alone, or a resume's journal and stream together. Each life of the * journal opens with its `life_start`, and one with no `run_end` was killed. * A visit's last end is the one the frame draws, whichever life wrote it; a * `copy_lost` forgets every end under its branch, as a resume does. What a * visit cost is every life's, since each one was paid for: a `copy_lost` or a * visit run again forgets how it ended, never what it spent. */ import { type SubagentEvent } from "../../events.ts"; import { type Usage } from "../../usage.ts"; import type { CheckedFlow } from "../checked.ts"; import { type JournalEntry, type VisitEnd } from "../run/index.ts"; /** One life of a run: what it cost, whether it was killed before it could write its end, and the visits it ended. */ export type Life = { readonly usage: Usage; readonly partial: boolean; readonly ends: readonly VisitEnd[]; }; type RunEnd = Extract; /** A run's visits as the journal and the stream left them. */ export declare class Visits { private readonly ends; /** Visits this life started and has not ended. */ private readonly running; private readonly spawned; private readonly frozen; readonly lives: Life[]; /** How the last life ended, when it wrote its end and no later life has begun. */ readonly runEnd: RunEnd | undefined; /** The visit the last life picked up from, when it resumed an earlier one. */ readonly resumedFrom: string | undefined; /** `elapsedMs`, when given, is how long this life has run: a life is running, and that is its time. */ constructor(checked: CheckedFlow, journal: readonly JournalEntry[], events: readonly SubagentEvent[], elapsedMs?: number); /** Whether the visit `path` is running now. */ live(path: string): boolean; /** How the visit `path` last ended, unless it is running again. */ ended(path: string): VisitEnd | undefined; /** Whether any visit at or inside `path` began or ended. */ touched(path: string): boolean; /** What every life spent at or inside `path`: the outermost visits each one ended there, added up. */ spent(path: string): Usage; /** Every visit that ended, as it last did. */ get all(): VisitEnd[]; /** The subagents spawned for the visit `path`. */ subagents(path: string): readonly string[]; /** How many items the `map` visit `path` froze, when a journal says. */ items(path: string): number | undefined; /** Folds this life's `events`, and gives back the visits it ended. */ private tell; } export {}; //# sourceMappingURL=visits.d.ts.map