/** * The lives of a flow run, read from its journal: its first start, then each * resume, each opened by a `life_start` entry. * * Two readers take them: `usage.json`, which rebuilds a life killed before it * wrote its own, and the live view's summary. A life's cost is what its ended * visits say, each counted once at the outermost visit holding it, since a * visit's usage includes every visit inside it. Nothing else is known of a * life that did not end, and nothing is estimated. */ import type { JournalEntry, VisitEnd } from "../flow/index.ts"; import { type Usage } from "../usage.ts"; import type { LifeUsage } from "./export.ts"; type RunEnd = Extract; /** One life as its journal holds it: when it started, the visits it ended, and its end when it wrote one. */ export type JournalLife = { readonly startedAt?: string; readonly ends: VisitEnd[]; readonly runEnd?: RunEnd; }; /** The lives `journal` holds, in order. What comes before any `life_start` is a life of its own. */ export declare function livesOf(journal: readonly JournalEntry[]): JournalLife[]; /** How a life ended: well, failed, or stopped or killed before its end. */ export declare function lifeEnd(runEnd: RunEnd | undefined): LifeUsage["end"]; /** A life rebuilt from its journal alone: its end's usage when it wrote one, else what its ended visits cost. */ export declare function rebuiltLife(life: JournalLife): LifeUsage; /** * What a set of ended visits cost: each counted once, at the outermost visit * that holds it. The time adds up, for the visits it counts ran one after * the other, unless they were branches running together. */ export declare function costOf(ends: readonly VisitEnd[]): Usage; /** * `ends`, which come innermost first, in plan order: each visit before the * visits it holds, visits under one holder in the order they ended. */ export declare function planOrder(ends: readonly VisitEnd[]): VisitEnd[]; export {}; //# sourceMappingURL=lives.d.ts.map