UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

22 lines • 995 B
/** * Cooperative time slicing for work that walks a whole transcript on a shared event loop. * Work checks `due` between items and awaits `yield()` once its slice is spent, so sockets, * timers and other sessions run between slices (senpi#3518). */ export declare const DEFAULT_SLICE_BUDGET_MS = 8; export interface EventLoopSlicerOptions { budgetMs?: number; /** Milliseconds; a clock that advances per call makes slicing deterministic in tests. */ clock?: () => number; } export declare class EventLoopSlicer { private readonly budgetMs; private readonly clock; private sliceStart; constructor(options?: EventLoopSlicerOptions); get due(): boolean; /** `setImmediate` rather than a microtask: only a macrotask lets pending I/O callbacks run. */ yield(): Promise<void>; } export declare function mapInSlices<T, R>(items: readonly T[], transform: (item: T) => R, slicer: EventLoopSlicer): Promise<R[]>; //# sourceMappingURL=event-loop-slicer.d.ts.map