import { type FileRecord, type Tree } from '@variance-authority/mcp/tools'; import type { Help } from '@variance-authority/package/help'; import { type SearchIndex } from './search-index.js'; import { type StoreHead } from './store-layout.js'; export interface SnapshotOptions { /** The source index this reading was published beside. */ readonly index?: string; /** Handed the recorded graph without consulting the checkout. */ readonly records?: (records: readonly FileRecord[], graphRoot: string) => void; /** Handed the published graph without decoding the source index. */ readonly tree?: (tree: Tree) => void; } /** * The source index a published value was read off, and the directory of the * workspace under that index's root. A workspace whose members reach beside * its directory is read from the repository's root into an index of its own * beside `index`, as `scopeSourceIndexPath` names it, and its files are * spelled from there; any other is read into `index` from its own directory. */ export declare function publishedSourceIndex(help: Help, index: string): { readonly index: string; readonly within: string; }; /** When the workspace value was published, absent on an unrecorded reading. */ export declare function workspaceGeneration(help: Help): string | undefined; /** When the read behind the workspace value began, in milliseconds, absent on an unrecorded reading. */ export declare function workspaceReadStarted(help: Help): number | undefined; /** * The answerable workspace value published beside one source-index generation: * one binary store holding the packages, the imports by path, the export list * and the search over them, opened in place, with the generation in its head. */ export declare function workspaceSnapshotPath(index: string): string; /** Read the last published value without inspecting the checkout or asking Git. */ export declare function readWorkspaceSnapshot(root: string, options?: SnapshotOptions): Promise; /** * The head of the store published at `index` for the checkout at `root`, read * off the head alone: the rest is every export of the repository, and a caller * asking whether a value is current has no use for it. Absent when there is * none, it is not this format, it belongs to another checkout, or the file is * not the length its header declares — a store cut short no reader opens. */ export declare function publishedHead(root: string, index: string): StoreHead | undefined; /** When the value at `index` was published, as {@link publishedHead} reads it for the checkout at `root`. */ export declare function publishedGeneration(root: string, index: string): Promise; /** * Whether a server holding `held` reads the workspace again before it answers: * when it holds none, when a generation newer than `held` was published since — * `variance index`, or another reader — as {@link publishedGeneration} reads it * off the value's head, or, unless `justAnswer`, when `held` is older than * `refreshAfterMs`. A call where nothing was published costs that head's read. */ export declare function readAgain(held: Help | undefined, root: string, options: { readonly index?: string; readonly justAnswer?: boolean; readonly refreshAfterMs: number; }): Promise; /** * Whether the tree published beside the store whose head is `held`, at * `index`, opens in this build. A tree of another format version, or one whose * bytes moved, is published again rather than kept, though the index it was * drawn from did not move. The tree is its own file: the store is not opened. */ export declare function workspaceTreeOpens(held: StoreHead, index: string): Promise; /** * The digest of the manifest published at `index`. Segments are named by their * own digests, so the manifest's bytes are the whole chain's identity. Absent * when nothing is published there. */ export declare function indexManifestDigest(index: string): Promise; /** * Publish a new generation time when its authoritative changed set is empty. * Nothing was read for it, so the value keeps the time its read began. */ export declare function republishWorkspaceSnapshot(help: Help, index: string): Promise; /** The tree published from `graph`, drawn over `graphRoot` and answered for `root`: the encoded bytes, or the records they encode. */ export declare function publishedTree(graph: readonly FileRecord[] | Uint8Array, graphRoot: string, root: string): Tree; /** * The value the store `store` holds, published at `index` with the tree * `tree` beside it under `graphDigest`: opened first, so it answers whether or * not it could be written, then the tree, which a store on disk names, then the * store. A tree of that digest and length already there is kept, since its * name is its content. */ export declare function publishStore(index: string, store: Uint8Array, tree: Uint8Array, graphDigest: string): Promise; /** The help store's bytes `help` was read from, for a question the addon answers over the store itself; absent for a value read from no store. */ export declare function storeBytesOf(help: Help): Uint8Array | undefined; /** * The search over one Help value, and the rows of it a question names: the * one the store it was read from or published to holds, or one encoded in * memory, once per value. */ export declare function searchIndexOf(help: Help): SearchIndex; /** The value one store holds, with the store and its search held beside it. */ export declare function heldStore(store: Uint8Array): Help; /** * The digest a generation names its tree and its index by: SHA-256 in hex, as * the addon names a tree it draws, which no prefixed digest of * `@variance-authority/core/format` spells. */ export declare function hexDigestOf(bytes: Uint8Array): string; //# sourceMappingURL=snapshot.d.ts.map