import { Descriptor, type RuntimeFiles } from '../files.ts';
import type { OpenMode } from '../handles/mode.ts';
import type { VFSEntry, VFSStat } from '../types.ts';
/**
 * The filesystem a wasm guest sees: the workspace mounts, through the
 * runtimes' file API. Mirrors Python's `WasmView` for a guest that
 * carries no files of its own (qjs), which is the only one this host
 * runs: no interpreter build is routed beside the mounts.
 *
 * Its job is shape. `RuntimeFiles` answers in virtual paths and one
 * `VFSStat` per path; preview1 asks in `[name, filetype]` pairs and
 * errno, and its filestat record has no mode field at all, so the type
 * bits are read out of the mode and the rest is dropped.
 *
 * @param files - the shared mount op vocabulary, its calls stopped with
 *   the run (`RuntimeFiles.withSignal`); null when no workspace is
 *   attached, so the guest sees nothing.
 */
export declare class WasmView {
    private readonly files;
    constructor(files?: RuntimeFiles | null);
    private requireFiles;
    /**
     * The file adapter for a content call on `path`, inside the view only.
     * Structure is open (a stat, a listing or a readlink answers for any
     * path the workspace has), but content goes only through the runtime's
     * view (`RuntimeFiles.serves`), the rule every guest file adapter keeps.
     */
    private filesFor;
    /** Stat a guest path. */
    stat(path: string): Promise<VFSStat>;
    /**
     * Stat a guest path without following a trailing symlink: a link's own
     * row is the node table's, which the dispatcher serves under `nofollow`.
     */
    lstat(path: string): Promise<VFSStat>;
    /**
     * The adapter's own stat, or ENOENT when no workspace is attached. A
     * path outside the view still answers as structure: a directory row
     * when the workspace lists it (`RuntimeFiles.viewStat`).
     */
    private coreStat;
    /** The path's row, or null when the workspace does not have it. */
    statOrNull(path: string, nofollow?: boolean): Promise<VFSStat | null>;
    /**
     * The mount's unclassified rows for `path`, or null. Asked of a path
     * with no row; a path outside the view never lists here, its stat
     * having already answered the directory row `viewStat` finds.
     */
    listingOrNull(path: string): Promise<VFSEntry[] | null>;
    /** A file's bytes, or a range of them. */
    read(path: string, offset?: number, size?: number, raw?: boolean): Promise<Uint8Array>;
    /** Open a workspace file on the run's core, the open's effect landing there. */
    open(path: string, mode: OpenMode): Promise<Descriptor>;
    unlink(path: string): Promise<void>;
    mkdir(path: string): Promise<void>;
    rmdir(path: string): Promise<void>;
    /** Rename within the workspace. */
    rename(src: string, dst: string): Promise<void>;
    /** Create a symlink at `path` pointing at `target`, stored as typed. */
    symlink(path: string, target: string): Promise<void>;
    /** Where the namespace's links lead `path` (`RuntimeFiles.walked`). */
    walked(path: string, follow?: boolean): string;
    /** The target of the symlink at `path`; EINVAL when it is no link. */
    readlink(path: string): Promise<string>;
    /**
     * Write timestamps, in the namespace overlay where needed. Times are
     * the only attributes preview1 can express.
     */
    setattr(path: string, atime: string | null, mtime: string | null, nofollow: boolean): Promise<void>;
    /**
     * List a guest directory as `[name, preview1 filetype]` pairs. Core
     * entries arrive kind-resolved, and a link is reported as one, so a
     * guest that reads `d_type` answers `is_symlink` without a call.
     */
    readdir(path: string): Promise<[string, number][]>;
}
//# sourceMappingURL=view.d.ts.map