/** * @license * Copyright 2026 Steven Roussey * SPDX-License-Identifier: Apache-2.0 */ export interface LocalFilePathOptions { /** * Directories the path must resolve inside, checked after symlinks are * resolved. Omitting it means `[process.cwd()]` — NOT "anywhere on the * host". * * The entitlement is not a substitute for this. `filesystem:read` is only * consulted when the embedder BOTH runs the graph with * `enforceEntitlements` AND registers an `ENTITLEMENT_ENFORCER` (the token * has no default factory, so setting the flag without one throws). Neither * is the default, so an unconfigured host that treated an absent `roots` as * unrestricted was readable end to end by any graph naming these tasks. * * An empty array is a deliberate "no path is readable" and is honored as * written. */ readonly roots?: readonly string[] | undefined; /** * Skip containment altogether. Only the literal `true` does so: it is the * explicit "this process may read any path it can open" statement an * embedder makes for itself, and it is never implied by leaving `roots` * unset. */ readonly allowAnyRoot?: boolean | undefined; } /** True for an http(s) URL, case-insensitively — `HTTP://x` is an http URL. */ export declare function isHttpUrl(url: string): boolean; /** * The filesystem path a local-file input names, with a `file:` scheme decoded * away and nothing else done to it — no `resolve`, no `realpath`, no * containment. It is the path as the CALLER wrote it, for reporting and for * extension sniffing; {@link resolveLocalFilePath} is what an open must use. */ export declare function localFilePathFromUrl(url: string): string; /** * Real, absolute path for a local-file input, contained within `roots`. * * Order matters: the containment check runs AFTER `realpathSync`, so a symlink * pointing out of a root is caught rather than followed. Callers must open the * returned path, not the one they passed in. * * Every configured root is resolved BEFORE any containment verdict is taken, * so an unresolvable root fails the call wherever it sits in the array. Doing * it inside the `some()` predicate made the outcome depend on array order — * `["good", "missing"]` succeeded because `some` short-circuited before * reaching the broken root, while `["missing", "good"]` threw on identical * input. * * Residual TOCTOU: a component of the path can be swapped between this * resolution and the open that follows it. Closing that needs an * openat-with-fd-relative walk, which Node does not expose. */ export declare function resolveLocalFilePath(url: string, options?: LocalFilePathOptions): string;