/** * Owner registry. Each tracked container is an "owner" — keyed by * `::`. We hold the current item count + * a rough byte estimate, and the count at the start of each in-flight * flow so the leak detector can compute per-flow growth. */ import type { MemoryContainerKind, MemoryOwnerSnapshot } from './types.js'; interface OwnerRecord { ownerId: string; ownerInstanceId: string; containerKind: MemoryContainerKind; fieldName: string; itemCount: number; estimatedBytes: number; startCount: number; /** itemCount captured at the start of each active flow, keyed by flowId. */ flowStartCounts: Map; /** * Net items added by each flow's mutations, keyed by flowId. This is * the *attributed* growth — only flows whose own mutations grew the * container are blamed, not every flow that happened to be in flight * while another flow grew it. */ flowDeltas: Map; } export declare function ownerKey(ownerInstanceId: string, fieldName: string): string; export declare function ensureOwner(args: { ownerInstanceId: string; fieldName: string; containerKind: MemoryContainerKind; }): OwnerRecord; export declare function recordCount(rec: OwnerRecord, itemCount: number, estimatedBytes: number): void; export declare function markFlowStart(flowId: string): void; /** Attribute a net item delta to the flow whose mutation caused it. */ export declare function recordFlowDelta(rec: OwnerRecord, flowId: string, delta: number): void; export declare function flowGrowth(flowId: string): Array<{ owner: OwnerRecord; startCount: number; endCount: number; growth: number; }>; export declare function clearFlowStart(flowId: string): void; export declare function allOwners(): MemoryOwnerSnapshot[]; export declare function getOwner(ownerId: string): OwnerRecord | undefined; export declare function resetOwners(): void; export {};