UNPKG

@struktoai/mirage-core

Version:

A Unified Virtual Filesystem For AI Agents

40 lines • 2.26 kB
import type { FlagValue } from '../../spec/types.ts'; import { IOResult } from '../../../io/types.ts'; import { PathSpec, type ReadStreamFn } from '../../../types.ts'; import type { CommandFnResult, Context } from '../../config.ts'; import type { DispatchFn } from '../../../runtime/types.ts'; export type StoredDigest = (p: PathSpec, algorithm: string) => Promise<string | null>; export interface ChecksumFlags { readonly algorithm: string; readonly check: boolean; readonly binary: boolean; readonly tag: boolean; readonly zero: boolean; readonly strict: boolean; readonly ignoreMissing: boolean; readonly status: boolean; readonly quiet: boolean; readonly warn: boolean; } /** * One line per operand, its digest asked of `stored` (once `stat` has found a * file there) before the file is read; one that fails is reported and the * rest still print. `read` opens an operand now, inside the command's cache * scope. Mirrors Python's hash_operands. */ export declare function hashOperands(paths: readonly PathSpec[], read: ReadStreamFn, algorithm: string, prog: string, render: (digest: string, label: string) => string, stat?: (p: PathSpec) => Promise<unknown>, stored?: StoredDigest): Promise<[AsyncIterable<Uint8Array>, IOResult]>; /** * Parse the shared `*sum` flag set against one command's spec; b2sum adds -l * to the set. The flags, or b2sum's refusal of -l; a combination GNU refuses * throws. Mirrors Python's `parse_flags`. */ export declare function parseFlags(bag: Record<string, FlagValue>, name: string): ChecksumFlags | IOResult; export declare function dispatchedReader(dispatch: DispatchFn, stream: ReadStreamFn): ReadStreamFn; /** * Run a GNU `*sum` over resolved operands. An operand's digest is asked of * `stored` first, the one the mount keeps, once `stat` has found a file * there, and the file is read only when there is none; a list under `-c` is * always verified against the bytes. Mirrors Python's checksum_generic. */ export declare function checksumGeneric(parsed: ChecksumFlags, paths: PathSpec[], ctx: Context, read: ReadStreamFn, name: string, stat?: (p: PathSpec) => Promise<unknown>, stored?: StoredDigest): Promise<CommandFnResult>; //# sourceMappingURL=checksum.d.ts.map