import type { Accessor } from '../accessor/base.ts';
import { FileStat, type PathSpec } from '../types.ts';
import type { Guard } from './hierarchy/readdir.ts';
import type { ScopeMatch } from './hierarchy/scope.ts';
import type { StatHook } from './hierarchy/stat.ts';
import type { Handed } from '../vfs/types.ts';
export declare function parseTime(value: string): number;
export declare class TimeRange {
    readonly start: number | null;
    readonly end: number | null;
    constructor(start?: string | null, end?: string | null);
    get bounded(): boolean;
    clip(start: number, end: number): [number, number];
    dayBounds(day: string): [number, number];
    requireDay(day: string, path: string): void;
    listingDays(first: string, last: string, span?: readonly [string, string] | null): string[];
    vfsMd(): string;
}
export declare function guardDay(accessor: {
    readonly timeRange: TimeRange;
}, match: ScopeMatch, virtual: string): Promise<void>;
/**
 * The channel a day's chat.jsonl reads, proven by the listing.
 *
 * The typed `name__id` dirname is only trusted once a listing proves it, so a
 * fabricated channel id is ENOENT rather than a raw API error. The file's row
 * carries its channel, and so does its day's, which a day the window does not
 * list still has: a sealed day lists nothing but the file still reads through
 * the channel, reproducing the API's own answer for the fetch. Mirrors
 * Python's `day_channel_id`.
 */
export declare function dayChannelId(path: PathSpec, entry: FileStat | null, parent: FileStat | null): string;
/**
 * Stat a day directory, which resolves beyond the listed window.
 *
 * The parent listing synthesizes a bounded window of recent days, but the API
 * answers a range query for any date, so a well-formed day under a channel or
 * label that exists is a directory whether or not the window lists it,
 * carrying its parent's ids as a listed day does. A bogus parent chain is
 * ENOENT. `guard` refuses a day outside the mount's scope before any lookup,
 * `guardDay` on a scoped mount. Mirrors Python's `day_stat`.
 */
export declare function dayStat<A extends Accessor>(guard?: Guard<A>): StatHook<A>;
/**
 * A chat day's last `n` messages, then each one posted to it after them, as
 * its chat.jsonl lines.
 *
 * `messages` is the day as a read lists it, so its last `n` come first. Then
 * every `interval` seconds `after` is asked for the messages posted since the
 * last one seen (the whole day while none is), until a poll that starts once
 * the day is over: nothing can land in it after that, and the stream waits to
 * be closed, as `tail -f` waits on a file that stops growing. Each ask starts
 * where the last answer ended, so none is lost or printed twice. An iterator
 * rather than a generator: a generator queues `return` behind a pull waiting
 * out its interval, so an idle `tail -f` could never close it. Closing also
 * ends a pull waiting on a stalled ask, whose late answer is dropped, as
 * Python's task cancel ends it there. Mirrors Python's `followed_day`.
 */
export declare function followedDay<M>(messages: readonly M[], n: number, end: number, interval: number, after: (last: M | null) => Promise<M[]>): AsyncIterableIterator<Uint8Array>;
/**
 * A channel's messages from a run's first day through its last, a page at a
 * time. Mirrors Python's `RunPages`.
 */
export type RunPages<M> = (channelId: string, first: string, last: string) => AsyncIterable<M[]>;
/**
 * Several chat days' chat.jsonl files, one walk per run of a channel's
 * consecutive days. Each file is proven as its own read proves it (a day in
 * scope, a channel the listing holds); one that is not, or is no chat file, is
 * left out for its own read to answer, as is a day past `limit` bytes. Each
 * day's lines are the run's messages posted within it, oldest first, as its own
 * read lists them. Mirrors Python's `read_days`.
 */
export declare function readDays<M>(scope: TimeRange, paths: readonly PathSpec[], handed: readonly Handed[], detect: (path: PathSpec) => ScopeMatch, pages: RunPages<M>, order: (message: M) => number | bigint, within: (message: M, start: number, end: number) => boolean, limit: number): Promise<Map<string, Uint8Array>>;
//# sourceMappingURL=time_range.d.ts.map